@shohojdhara/atomix 0.4.9 → 0.5.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.
Files changed (67) hide show
  1. package/dist/atomix.css +95 -69
  2. package/dist/atomix.css.map +1 -1
  3. package/dist/atomix.min.css +1 -1
  4. package/dist/atomix.min.css.map +1 -1
  5. package/dist/charts.d.ts +1 -0
  6. package/dist/charts.js +231 -332
  7. package/dist/charts.js.map +1 -1
  8. package/dist/core.d.ts +1 -0
  9. package/dist/core.js +232 -333
  10. package/dist/core.js.map +1 -1
  11. package/dist/forms.d.ts +1 -0
  12. package/dist/forms.js +231 -332
  13. package/dist/forms.js.map +1 -1
  14. package/dist/heavy.d.ts +11 -2
  15. package/dist/heavy.js +233 -334
  16. package/dist/heavy.js.map +1 -1
  17. package/dist/index.d.ts +13 -2
  18. package/dist/index.esm.js +228 -327
  19. package/dist/index.esm.js.map +1 -1
  20. package/dist/index.js +227 -326
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.min.js +1 -1
  23. package/dist/index.min.js.map +1 -1
  24. package/package.json +11 -1
  25. package/src/components/AtomixGlass/AtomixGlass.tsx +188 -128
  26. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +62 -90
  27. package/src/components/AtomixGlass/PerformanceDashboard.tsx +153 -201
  28. package/src/components/AtomixGlass/glass-utils.ts +50 -0
  29. package/src/components/AtomixGlass/shader-utils.ts +1 -1
  30. package/src/components/AtomixGlass/stories/{Phase1-Animation.stories.tsx → AnimationFeatures.stories.tsx} +53 -47
  31. package/src/components/AtomixGlass/stories/Examples.stories.tsx +573 -236
  32. package/src/components/AtomixGlass/stories/Playground.stories.tsx +656 -44
  33. package/src/components/AtomixGlass/stories/argTypes.ts +384 -0
  34. package/src/components/AtomixGlass/stories/shared-components.tsx +82 -3
  35. package/src/components/AtomixGlass/stories/types.ts +127 -0
  36. package/src/lib/composables/useAtomixGlass.ts +108 -71
  37. package/src/lib/composables/useAtomixGlassStyles.ts +0 -2
  38. package/src/lib/constants/components.ts +1 -0
  39. package/src/lib/types/components.ts +1 -0
  40. package/src/lib/utils/displacement-generator.ts +1 -1
  41. package/src/styles/06-components/_components.atomix-glass.scss +158 -97
  42. package/scripts/cli/__tests__/README.md +0 -81
  43. package/scripts/cli/__tests__/basic.test.js +0 -116
  44. package/scripts/cli/__tests__/clean.test.js +0 -278
  45. package/scripts/cli/__tests__/component-generator.test.js +0 -332
  46. package/scripts/cli/__tests__/component-validator.test.js +0 -433
  47. package/scripts/cli/__tests__/generator.test.js +0 -613
  48. package/scripts/cli/__tests__/glass-motion.test.js +0 -256
  49. package/scripts/cli/__tests__/integration.test.js +0 -938
  50. package/scripts/cli/__tests__/migrate.test.js +0 -74
  51. package/scripts/cli/__tests__/security.test.js +0 -206
  52. package/scripts/cli/__tests__/test-setup.js +0 -135
  53. package/scripts/cli/__tests__/theme-bridge.test.js +0 -507
  54. package/scripts/cli/__tests__/token-manager.test.js +0 -251
  55. package/scripts/cli/__tests__/token-provider.test.js +0 -361
  56. package/scripts/cli/__tests__/utils.test.js +0 -165
  57. package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +0 -216
  58. package/src/components/AtomixGlass/stories/Customization.stories.tsx +0 -131
  59. package/src/components/AtomixGlass/stories/Modes.stories.tsx +0 -1082
  60. package/src/components/AtomixGlass/stories/Overview.stories.tsx +0 -497
  61. package/src/components/AtomixGlass/stories/Performance.stories.tsx +0 -103
  62. package/src/components/AtomixGlass/stories/Phase1-Test.stories.tsx +0 -95
  63. package/src/components/AtomixGlass/stories/Shaders.stories.tsx +0 -395
  64. package/src/components/TypedButton/TypedButton.stories.tsx +0 -59
  65. package/src/components/TypedButton/TypedButton.tsx +0 -39
  66. package/src/components/TypedButton/index.ts +0 -2
  67. package/src/lib/composables/useTypedButton.ts +0 -66
@@ -0,0 +1,384 @@
1
+ /**
2
+ * argTypes.ts
3
+ *
4
+ * Shared argType definitions for AtomixGlass Storybook stories.
5
+ * Provides consistent control configurations across all story files.
6
+ *
7
+ * @package Atomix
8
+ * @component AtomixGlass
9
+ */
10
+
11
+ import type { ArgTypeDefinition, ArgTypeCategory } from './types';
12
+
13
+ /**
14
+ * Base argTypes that are common to all AtomixGlass stories
15
+ */
16
+ export const baseArgTypes = {
17
+ // Content category
18
+ children: {
19
+ control: { type: 'text' },
20
+ description: 'Content to display inside the glass effect',
21
+ table: {
22
+ category: 'Content' as ArgTypeCategory,
23
+ defaultValue: { summary: '-' },
24
+ },
25
+ },
26
+
27
+ // Visual category
28
+ displacementScale: {
29
+ control: { type: 'range', min: 0, max: 100, step: 1 },
30
+ description: 'Displacement scale for the glass effect (default: 70)',
31
+ table: {
32
+ category: 'Visual' as ArgTypeCategory,
33
+ defaultValue: { summary: '70' },
34
+ },
35
+ },
36
+ blurAmount: {
37
+ control: { type: 'range', min: 0, max: 10, step: 0.5 },
38
+ description: 'Blur amount for the backdrop (default: 0.0625)',
39
+ table: {
40
+ category: 'Visual' as ArgTypeCategory,
41
+ defaultValue: { summary: '0.0625' },
42
+ },
43
+ },
44
+ saturation: {
45
+ control: { type: 'range', min: 100, max: 300, step: 5 },
46
+ description: 'Saturation percentage for the backdrop (default: 140)',
47
+ table: {
48
+ category: 'Visual' as ArgTypeCategory,
49
+ defaultValue: { summary: '140' },
50
+ },
51
+ },
52
+ aberrationIntensity: {
53
+ control: { type: 'range', min: 0, max: 10, step: 0.1 },
54
+ description: 'Chromatic aberration intensity (default: 2)',
55
+ table: {
56
+ category: 'Visual' as ArgTypeCategory,
57
+ defaultValue: { summary: '2' },
58
+ },
59
+ },
60
+ elasticity: {
61
+ control: { type: 'range', min: 0, max: 1, step: 0.01 },
62
+ description: 'Elasticity factor for mouse interactions (default: 0.15)',
63
+ table: {
64
+ category: 'Visual' as ArgTypeCategory,
65
+ defaultValue: { summary: '0.15' },
66
+ },
67
+ },
68
+ borderRadius: {
69
+ control: { type: 'range', min: 0, max: 50, step: 1 },
70
+ description: 'Corner radius in pixels (default: 20)',
71
+ table: {
72
+ category: 'Visual' as ArgTypeCategory,
73
+ defaultValue: { summary: '20' },
74
+ },
75
+ },
76
+ overLight: {
77
+ control: {
78
+ type: 'select',
79
+ labels: {
80
+ false: 'false (Dark Background)',
81
+ true: 'true (Light Background)',
82
+ auto: 'auto (Auto-detect)',
83
+ },
84
+ },
85
+ options: [false, true, 'auto'],
86
+ description: 'OverLight configuration mode',
87
+ table: {
88
+ category: 'Visual' as ArgTypeCategory,
89
+ defaultValue: { summary: '"auto"' },
90
+ type: { summary: 'boolean | "auto"' },
91
+ },
92
+ },
93
+ mode: {
94
+ control: { type: 'inline-radio', options: ['standard', 'polar', 'prominent', 'shader'] },
95
+ description: 'Glass effect mode (default: "standard")',
96
+ table: {
97
+ category: 'Visual' as ArgTypeCategory,
98
+ defaultValue: { summary: '"standard"' },
99
+ },
100
+ },
101
+
102
+ // Style category
103
+ padding: {
104
+ control: { type: 'text' },
105
+ description: 'Padding for the glass component',
106
+ table: {
107
+ category: 'Style' as ArgTypeCategory,
108
+ defaultValue: { summary: '0' },
109
+ },
110
+ },
111
+ height: {
112
+ control: { type: 'text' },
113
+ description: 'Height of the glass component',
114
+ table: {
115
+ category: 'Style' as ArgTypeCategory,
116
+ defaultValue: { summary: 'undefined' },
117
+ },
118
+ },
119
+ width: {
120
+ control: { type: 'text' },
121
+ description: 'Width of the glass component',
122
+ table: {
123
+ category: 'Style' as ArgTypeCategory,
124
+ defaultValue: { summary: 'undefined' },
125
+ },
126
+ },
127
+ className: {
128
+ control: { type: 'text' },
129
+ description: 'Additional CSS class names',
130
+ table: {
131
+ category: 'Style' as ArgTypeCategory,
132
+ defaultValue: { summary: '-' },
133
+ },
134
+ },
135
+ style: {
136
+ control: { type: 'object' },
137
+ description: 'CSS style object',
138
+ table: {
139
+ category: 'Style' as ArgTypeCategory,
140
+ defaultValue: { summary: '{}' },
141
+ },
142
+ },
143
+
144
+ // Interaction category
145
+ onClick: {
146
+ action: 'clicked',
147
+ description: 'Click event handler',
148
+ table: {
149
+ category: 'Interaction' as ArgTypeCategory,
150
+ defaultValue: { summary: '-' },
151
+ },
152
+ },
153
+
154
+ // Performance category
155
+ devicePreset: {
156
+ control: { type: 'inline-radio', options: ['performance', 'balanced', 'quality'] },
157
+ description: 'Device preset for responsive optimization (default: "balanced")',
158
+ table: {
159
+ category: 'Performance' as ArgTypeCategory,
160
+ defaultValue: { summary: '"balanced"' },
161
+ },
162
+ },
163
+ disableResponsiveBreakpoints: {
164
+ control: { type: 'boolean' },
165
+ description: 'Disable responsive breakpoint system (default: false)',
166
+ table: {
167
+ category: 'Performance' as ArgTypeCategory,
168
+ defaultValue: { summary: 'false' },
169
+ },
170
+ },
171
+
172
+ // Animation category (Phase 1)
173
+ withTimeAnimation: {
174
+ control: { type: 'boolean' },
175
+ description: 'Enable time-based animation (Phase 1, default: true)',
176
+ table: {
177
+ category: 'Animation' as ArgTypeCategory,
178
+ defaultValue: { summary: 'true' },
179
+ },
180
+ },
181
+ animationSpeed: {
182
+ control: { type: 'range', min: 0, max: 3, step: 0.1 },
183
+ description: 'Animation speed multiplier (Phase 1, default: 1.0)',
184
+ table: {
185
+ category: 'Animation' as ArgTypeCategory,
186
+ defaultValue: { summary: '1.0' },
187
+ },
188
+ },
189
+ withMultiLayerDistortion: {
190
+ control: { type: 'boolean' },
191
+ description: 'Enable multi-layer distortion using FBM (Phase 1, default: false)',
192
+ table: {
193
+ category: 'Animation' as ArgTypeCategory,
194
+ defaultValue: { summary: 'false' },
195
+ },
196
+ },
197
+ distortionOctaves: {
198
+ control: { type: 'range', min: 1, max: 8, step: 1 },
199
+ description: 'Number of octaves for FBM distortion (Phase 1, default: 5)',
200
+ table: {
201
+ category: 'Animation' as ArgTypeCategory,
202
+ defaultValue: { summary: '5' },
203
+ },
204
+ },
205
+ distortionLacunarity: {
206
+ control: { type: 'range', min: 1, max: 4, step: 0.1 },
207
+ description: 'Lacunarity for FBM distortion (Phase 1, default: 2.0)',
208
+ table: {
209
+ category: 'Animation' as ArgTypeCategory,
210
+ defaultValue: { summary: '2.0' },
211
+ },
212
+ },
213
+ distortionGain: {
214
+ control: { type: 'range', min: 0.1, max: 1, step: 0.1 },
215
+ description: 'Gain for FBM distortion (Phase 1, default: 0.5)',
216
+ table: {
217
+ category: 'Animation' as ArgTypeCategory,
218
+ defaultValue: { summary: '0.5' },
219
+ },
220
+ },
221
+ distortionQuality: {
222
+ control: { type: 'select', options: ['low', 'medium', 'high', 'ultra'] },
223
+ description: 'Quality preset for FBM distortion (Phase 1, default: "high")',
224
+ table: {
225
+ category: 'Animation' as ArgTypeCategory,
226
+ defaultValue: { summary: '"high"' },
227
+ },
228
+ },
229
+
230
+ // Debug category
231
+ debugPerformance: {
232
+ control: { type: 'boolean' },
233
+ description: 'Enable performance monitoring dashboard (development only)',
234
+ table: {
235
+ category: 'Debug' as ArgTypeCategory,
236
+ defaultValue: { summary: 'false' },
237
+ },
238
+ },
239
+ debugBorderRadius: {
240
+ control: { type: 'boolean' },
241
+ description: 'Debug mode for corner radius extraction',
242
+ table: {
243
+ category: 'Debug' as ArgTypeCategory,
244
+ defaultValue: { summary: 'false' },
245
+ },
246
+ },
247
+
248
+ // Accessibility category
249
+ 'aria-label': {
250
+ control: { type: 'text' },
251
+ description: 'ARIA label for accessibility',
252
+ table: {
253
+ category: 'Accessibility' as ArgTypeCategory,
254
+ defaultValue: { summary: '-' },
255
+ },
256
+ },
257
+ 'aria-describedby': {
258
+ control: { type: 'text' },
259
+ description: 'ARIA describedby attribute for additional description',
260
+ table: {
261
+ category: 'Accessibility' as ArgTypeCategory,
262
+ defaultValue: { summary: '-' },
263
+ },
264
+ },
265
+ role: {
266
+ control: { type: 'text' },
267
+ description: 'ARIA role attribute',
268
+ table: {
269
+ category: 'Accessibility' as ArgTypeCategory,
270
+ defaultValue: { summary: 'undefined' },
271
+ },
272
+ },
273
+ tabIndex: {
274
+ control: { type: 'number' },
275
+ description: 'Tab index for keyboard navigation',
276
+ table: {
277
+ category: 'Accessibility' as ArgTypeCategory,
278
+ defaultValue: { summary: '0' },
279
+ },
280
+ },
281
+ reducedMotion: {
282
+ control: { type: 'boolean' },
283
+ description: 'Override for reduced motion preference (default: false)',
284
+ table: {
285
+ category: 'Accessibility' as ArgTypeCategory,
286
+ defaultValue: { summary: 'false' },
287
+ },
288
+ },
289
+ highContrast: {
290
+ control: { type: 'boolean' },
291
+ description: 'Override for high contrast preference (default: false)',
292
+ table: {
293
+ category: 'Accessibility' as ArgTypeCategory,
294
+ defaultValue: { summary: 'false' },
295
+ },
296
+ },
297
+ withoutEffects: {
298
+ control: { type: 'boolean' },
299
+ description: 'Disable all visual effects (default: false)',
300
+ table: {
301
+ category: 'Accessibility' as ArgTypeCategory,
302
+ defaultValue: { summary: 'false' },
303
+ },
304
+ },
305
+ } satisfies Record<string, ArgTypeDefinition>;
306
+
307
+ /**
308
+ * Minimal argTypes for simple stories (excludes advanced features)
309
+ */
310
+ export const minimalArgTypes = {
311
+ children: baseArgTypes.children,
312
+ displacementScale: baseArgTypes.displacementScale,
313
+ blurAmount: baseArgTypes.blurAmount,
314
+ saturation: baseArgTypes.saturation,
315
+ aberrationIntensity: baseArgTypes.aberrationIntensity,
316
+ borderRadius: baseArgTypes.borderRadius,
317
+ mode: baseArgTypes.mode,
318
+ padding: baseArgTypes.padding,
319
+ className: baseArgTypes.className,
320
+ onClick: baseArgTypes.onClick,
321
+ } satisfies Record<string, ArgTypeDefinition>;
322
+
323
+ /**
324
+ * Advanced argTypes for playground and testing stories (includes all features)
325
+ */
326
+ export const advancedArgTypes = {
327
+ ...baseArgTypes,
328
+ globalMousePosition: {
329
+ control: { type: 'object' },
330
+ description: 'External global mouse position { x: number; y: number }',
331
+ table: {
332
+ category: 'Interaction' as ArgTypeCategory,
333
+ defaultValue: { summary: 'undefined' },
334
+ },
335
+ },
336
+ mouseOffset: {
337
+ control: { type: 'object' },
338
+ description: 'External mouse offset { x: number; y: number }',
339
+ table: {
340
+ category: 'Interaction' as ArgTypeCategory,
341
+ defaultValue: { summary: 'undefined' },
342
+ },
343
+ },
344
+ mouseContainer: {
345
+ control: false,
346
+ description: 'React ref object for mouse container element',
347
+ table: {
348
+ category: 'Interaction' as ArgTypeCategory,
349
+ defaultValue: { summary: 'undefined' },
350
+ },
351
+ },
352
+ } satisfies Record<string, ArgTypeDefinition>;
353
+
354
+ /**
355
+ * Helper function to pick specific argType categories
356
+ */
357
+ export function pickArgTypeCategories<T extends Record<string, ArgTypeDefinition>>(
358
+ argTypes: T,
359
+ categories: ArgTypeCategory[]
360
+ ): Partial<T> {
361
+ const result: Partial<T> = {};
362
+ Object.entries(argTypes).forEach(([key, value]) => {
363
+ if (value.table?.category && categories.includes(value.table.category)) {
364
+ result[key as keyof T] = value as any;
365
+ }
366
+ });
367
+ return result;
368
+ }
369
+
370
+ /**
371
+ * Helper function to exclude specific argType categories
372
+ */
373
+ export function excludeArgTypeCategories<T extends Record<string, ArgTypeDefinition>>(
374
+ argTypes: T,
375
+ categories: ArgTypeCategory[]
376
+ ): Partial<T> {
377
+ const result: Partial<T> = {};
378
+ Object.entries(argTypes).forEach(([key, value]) => {
379
+ if (value.table?.category && !categories.includes(value.table.category)) {
380
+ result[key as keyof T] = value as any;
381
+ }
382
+ });
383
+ return result;
384
+ }
@@ -10,7 +10,8 @@
10
10
  */
11
11
 
12
12
  import React, { useState, useEffect, useCallback, useRef } from 'react';
13
- import type { RefObject } from 'react';
13
+ import type { RefObject, ErrorInfo } from 'react';
14
+ import type { StoryErrorBoundaryProps } from './types';
14
15
 
15
16
  /**
16
17
  * Enhanced BackgroundWrapper Component
@@ -78,6 +79,7 @@ export const BackgroundWrapper: React.FC<BackgroundWrapperProps> = ({
78
79
  backgroundSize: 'cover',
79
80
  backgroundPosition: 'center',
80
81
  backgroundRepeat: 'no-repeat',
82
+ backgroundAttachment: 'fixed',
81
83
  height,
82
84
  width,
83
85
  borderRadius,
@@ -99,7 +101,7 @@ export const BackgroundWrapper: React.FC<BackgroundWrapperProps> = ({
99
101
  padding,
100
102
  objectPosition: 'center',
101
103
  objectFit: 'cover',
102
- backgroundPosition: 'fixed'
104
+ backgroundPosition: 'fixed',
103
105
  }}
104
106
  />
105
107
  )}
@@ -196,7 +198,6 @@ export const StoryContainer: React.FC<StoryContainerProps> = ({
196
198
  * Collection of high-quality background images for different moods and scenarios
197
199
  */
198
200
  export const backgroundImages = [
199
- 'https://images.unsplash.com/photo-1773609108583-4f0040c75e7f?q=80&w=2532&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
200
201
  'https://images.unsplash.com/photo-1593433073755-4233a78ee359?q=80&w=987&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
201
202
  'https://images.unsplash.com/photo-1637825891028-564f672aa42c?ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80&w=2670',
202
203
  'https://images.unsplash.com/photo-1773062278803-0643c4782445?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
@@ -204,3 +205,81 @@ export const backgroundImages = [
204
205
  'https://images.unsplash.com/photo-1519681393784-d120267933ba?ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80&w=2670',
205
206
  'https://images.unsplash.com/photo-1441974231531-c6227db76b6e?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
206
207
  ];
208
+
209
+ /**
210
+ * StoryErrorBoundary Component
211
+ *
212
+ * Error boundary wrapper for stories to gracefully handle rendering errors.
213
+ * Provides a fallback UI and error logging for better developer experience.
214
+ */
215
+ export class StoryErrorBoundary extends React.Component<
216
+ StoryErrorBoundaryProps,
217
+ { hasError: boolean; error?: Error }
218
+ > {
219
+ constructor(props: StoryErrorBoundaryProps) {
220
+ super(props);
221
+ this.state = { hasError: false };
222
+ }
223
+
224
+ static getDerivedStateFromError(error: Error) {
225
+ return { hasError: true, error };
226
+ }
227
+
228
+ override componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
229
+ console.error('Story Error:', error, errorInfo);
230
+ this.setState({ hasError: true, error });
231
+ }
232
+
233
+ override render() {
234
+ if (this.state.hasError) {
235
+ if (this.props.fallback) {
236
+ return this.props.fallback;
237
+ }
238
+
239
+ return (
240
+ <div
241
+ className="u-flex u-items-center u-justify-center u-p-5"
242
+ style={{
243
+ minHeight: '400px',
244
+ backgroundColor: 'rgba(239, 68, 68, 0.1)',
245
+ borderRadius: '12px',
246
+ border: '2px solid rgba(239, 68, 68, 0.3)',
247
+ }}
248
+ >
249
+ <div className="u-text-center">
250
+ <h3 className="u-mb-2 u-text-xl u-font-bold" style={{ color: '#dc2626' }}>
251
+ Story Rendering Error
252
+ </h3>
253
+ <p className="u-mb-4 u-text-sm" style={{ color: '#7f1d1d' }}>
254
+ {this.state.error?.message || 'An unexpected error occurred'}
255
+ </p>
256
+ <button
257
+ onClick={() => this.setState({ hasError: false })}
258
+ className="u-px-4 u-py-2 u-bg-red-600 u-text-white u-rounded u-cursor-pointer u-border-none u-transition-color u-hover-bg-red-700"
259
+ >
260
+ Try Again
261
+ </button>
262
+ </div>
263
+ </div>
264
+ );
265
+ }
266
+
267
+ return this.props.children;
268
+ }
269
+ }
270
+
271
+ /**
272
+ * FallbackBackground Component
273
+ *
274
+ * Provides a gradient fallback when background images fail to load.
275
+ * Used as a safety net for broken external image URLs.
276
+ */
277
+ export const FallbackBackground: React.FC<{ className?: string }> = ({ className = '' }) => (
278
+ <div
279
+ className={`u-absolute u-inset-0 ${className}`}
280
+ style={{
281
+ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
282
+ zIndex: -1,
283
+ }}
284
+ />
285
+ );
@@ -0,0 +1,127 @@
1
+ /**
2
+ * types.ts
3
+ *
4
+ * Shared type definitions for AtomixGlass Storybook stories.
5
+ * Provides consistent TypeScript types across all story files.
6
+ *
7
+ * @package Atomix
8
+ * @component AtomixGlass
9
+ */
10
+
11
+ import type { StoryObj, Meta } from '@storybook/react';
12
+ import type { ComponentType, ReactNode } from 'react';
13
+ import type AtomixGlass from '../AtomixGlass';
14
+
15
+ /**
16
+ * Type helper for story props without children requirement
17
+ * Used to create flexible story configurations
18
+ */
19
+ export type AtomixGlassStoryProps = Omit<React.ComponentProps<typeof AtomixGlass>, 'children'> & {
20
+ children?: ReactNode;
21
+ };
22
+
23
+ /**
24
+ * Story configuration object for reusable story setups
25
+ */
26
+ export interface StoryConfig {
27
+ /** Story title/description */
28
+ description?: string;
29
+ /** Layout mode: centered, fullscreen, or padded */
30
+ layout?: 'centered' | 'fullscreen' | 'padded';
31
+ /** Background image URL or index */
32
+ backgroundImage?: string;
33
+ /** Enable overlay */
34
+ overlay?: boolean;
35
+ /** Overlay opacity (0-1) */
36
+ overlayOpacity?: number;
37
+ /** Custom CSS class names */
38
+ className?: string;
39
+ }
40
+
41
+ /**
42
+ * ArgType category definitions for organized controls panel
43
+ */
44
+ export type ArgTypeCategory =
45
+ | 'Content'
46
+ | 'Visual'
47
+ | 'Interaction'
48
+ | 'Style'
49
+ | 'Performance'
50
+ | 'Animation'
51
+ | 'Debug'
52
+ | 'Accessibility'
53
+ | 'Events';
54
+
55
+ /**
56
+ * Enhanced argType definition with category support
57
+ */
58
+ export interface ArgTypeDefinition {
59
+ control?: { type: 'text' | 'boolean' | 'object' | 'range' | 'number' | 'color' | 'select' | 'radio' | 'inline-radio' | 'check' | 'inline-check' | 'multi-select' | 'date' | 'file'; [key: string]: unknown } | boolean;
60
+ description?: string;
61
+ table: {
62
+ category?: ArgTypeCategory;
63
+ defaultValue?: { summary: string };
64
+ type?: { summary: string };
65
+ };
66
+ options?: unknown[];
67
+ action?: string;
68
+ }
69
+
70
+ /**
71
+ * Background image item for story wrappers
72
+ */
73
+ export interface BackgroundImageItem {
74
+ url: string;
75
+ label: string;
76
+ tag: 'dark' | 'colorful' | 'light' | 'nature' | 'abstract';
77
+ }
78
+
79
+ /**
80
+ * Error boundary props for story error handling
81
+ */
82
+ export interface StoryErrorBoundaryProps {
83
+ children: ReactNode;
84
+ fallback?: ReactNode;
85
+ onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
86
+ }
87
+
88
+ /**
89
+ * Preset configuration for quick story setup
90
+ */
91
+ export interface GlassPreset {
92
+ name: string;
93
+ description: string;
94
+ args: Partial<AtomixGlassStoryProps>;
95
+ }
96
+
97
+ /**
98
+ * Performance metrics for monitoring story rendering
99
+ */
100
+ export interface PerformanceMetrics {
101
+ renderTime: number;
102
+ fps?: number;
103
+ memoryUsage?: number;
104
+ timestamp: number;
105
+ }
106
+
107
+ /**
108
+ * Story decorator function type
109
+ */
110
+ export type StoryDecorator<T = unknown> = (
111
+ Story: ComponentType,
112
+ context: { args?: T; globals?: Record<string, unknown> }
113
+ ) => ReactNode;
114
+
115
+ /**
116
+ * Helper type for creating typed story objects
117
+ */
118
+ export type TypedStory<T extends ComponentType = typeof AtomixGlass> = StoryObj<Meta<T>>;
119
+
120
+ /**
121
+ * Validation result for story configurations
122
+ */
123
+ export interface StoryValidationResult {
124
+ isValid: boolean;
125
+ errors: string[];
126
+ warnings: string[];
127
+ }