@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
@@ -1,256 +0,0 @@
1
- /**
2
- * Glassmorphism & Motion Generator Tests
3
- * Tests for Phase 3: Premium UI & Animation System
4
- */
5
-
6
- import { describe, it, expect, beforeEach } from 'vitest';
7
- import {
8
- GLASS_PRESETS,
9
- generateGlassStyles,
10
- getGlassPresets,
11
- validateGlassConfig
12
- } from '../internal/glass-generator.js';
13
-
14
- import {
15
- ANIMATION_PRESETS,
16
- generateMotionTokens,
17
- getAnimationPresets
18
- } from '../internal/motion-generator.js';
19
-
20
- describe('Glass Generator', () => {
21
- describe('Glass Presets', () => {
22
- it('should have all predefined presets', () => {
23
- const presets = getGlassPresets();
24
-
25
- expect(presets).toContain('subtle');
26
- expect(presets).toContain('default');
27
- expect(presets).toContain('strong');
28
- expect(presets).toContain('frost');
29
- expect(presets).toContain('crystal');
30
- });
31
-
32
- it('should have valid preset configurations', () => {
33
- for (const [name, config] of Object.entries(GLASS_PRESETS)) {
34
- expect(config).toHaveProperty('displacementScale');
35
- expect(config).toHaveProperty('blurAmount');
36
- expect(config).toHaveProperty('saturation');
37
- expect(config).toHaveProperty('opacity');
38
- expect(config).toHaveProperty('borderOpacity');
39
-
40
- // Validate ranges
41
- expect(config.displacementScale).toBeGreaterThanOrEqual(0);
42
- expect(config.displacementScale).toBeLessThanOrEqual(100);
43
- expect(config.blurAmount).toBeGreaterThanOrEqual(0);
44
- expect(config.blurAmount).toBeLessThanOrEqual(50);
45
- expect(config.opacity).toBeGreaterThanOrEqual(0);
46
- expect(config.opacity).toBeLessThanOrEqual(1);
47
- }
48
- });
49
- });
50
-
51
- describe('Glass Styles Generation', () => {
52
- it('should generate glass styles with default preset', () => {
53
- const styles = generateGlassStyles('Button', 'default');
54
-
55
- expect(styles).toContain('.button--glass');
56
- expect(styles).toContain('backdrop-filter');
57
- expect(styles).toContain('background: rgba');
58
- expect(styles).toContain('&:hover');
59
- });
60
-
61
- it('should include dark mode styles', () => {
62
- const styles = generateGlassStyles('Card', 'strong');
63
-
64
- expect(styles).toContain('.dark .card--glass');
65
- });
66
-
67
- it('should include accessibility features', () => {
68
- const styles = generateGlassStyles('Modal', 'subtle');
69
-
70
- expect(styles).toContain('prefers-reduced-transparency');
71
- expect(styles).toContain('prefers-reduced-motion');
72
- });
73
-
74
- it('should generate different styles for different presets', () => {
75
- const subtleStyles = generateGlassStyles('Button', 'subtle');
76
- const crystalStyles = generateGlassStyles('Button', 'crystal');
77
-
78
- expect(subtleStyles).not.toBe(crystalStyles);
79
- expect(crystalStyles).toContain('blur(40px)');
80
- expect(subtleStyles).toContain('blur(5px)');
81
- });
82
- });
83
-
84
- describe('Glass Config Validation', () => {
85
- it('should validate correct configuration', () => {
86
- const result = validateGlassConfig({
87
- displacementScale: 20,
88
- blurAmount: 10,
89
- saturation: 200,
90
- opacity: 0.15
91
- });
92
-
93
- expect(result.valid).toBe(true);
94
- expect(result.issues).toHaveLength(0);
95
- });
96
-
97
- it('should reject invalid displacement scale', () => {
98
- const result = validateGlassConfig({
99
- displacementScale: 150 // Out of range
100
- });
101
-
102
- expect(result.valid).toBe(false);
103
- expect(result.issues).toContain('displacementScale must be between 0 and 100');
104
- });
105
-
106
- it('should reject invalid blur amount', () => {
107
- const result = validateGlassConfig({
108
- blurAmount: -5 // Negative
109
- });
110
-
111
- expect(result.valid).toBe(false);
112
- expect(result.issues).toContain('blurAmount must be between 0 and 50');
113
- });
114
-
115
- it('should reject invalid opacity', () => {
116
- const result = validateGlassConfig({
117
- opacity: 1.5 // > 1
118
- });
119
-
120
- expect(result.valid).toBe(false);
121
- expect(result.issues).toContain('opacity must be between 0 and 1');
122
- });
123
-
124
- it('should accept multiple validation errors', () => {
125
- const result = validateGlassConfig({
126
- displacementScale: 200,
127
- blurAmount: 100,
128
- opacity: 2
129
- });
130
-
131
- expect(result.valid).toBe(false);
132
- expect(result.issues.length).toBeGreaterThan(2);
133
- });
134
- });
135
- });
136
-
137
- describe('Motion Generator', () => {
138
- describe('Animation Presets', () => {
139
- it('should have all animation presets', () => {
140
- const presets = getAnimationPresets();
141
-
142
- expect(presets).toContain('fade');
143
- expect(presets).toContain('fadeIn');
144
- expect(presets).toContain('fadeOut');
145
- expect(presets).toContain('slideInUp');
146
- expect(presets).toContain('slideInDown');
147
- expect(presets).toContain('scaleIn');
148
- expect(presets).toContain('bounce');
149
- expect(presets).toContain('spin');
150
- expect(presets).toContain('shake');
151
- expect(presets).toContain('pulse');
152
- expect(presets).toContain('shimmer');
153
- });
154
-
155
- it('should have valid preset structure', () => {
156
- for (const [name, preset] of Object.entries(ANIMATION_PRESETS)) {
157
- expect(preset).toHaveProperty('keyframes');
158
- expect(preset).toHaveProperty('duration');
159
- expect(preset).toHaveProperty('easing');
160
-
161
- // Keyframes should be non-empty string
162
- expect(typeof preset.keyframes).toBe('string');
163
- expect(preset.keyframes.length).toBeGreaterThan(0);
164
- }
165
- });
166
- });
167
-
168
- describe('Motion Tokens Generation', () => {
169
- it('should generate duration scale tokens', () => {
170
- const tokens = generateMotionTokens();
171
-
172
- expect(tokens).toContain('--atomix-duration-instant');
173
- expect(tokens).toContain('--atomix-duration-fast');
174
- expect(tokens).toContain('--atomix-duration-base');
175
- expect(tokens).toContain('--atomix-duration-slow');
176
- });
177
-
178
- it('should generate easing tokens', () => {
179
- const tokens = generateMotionTokens();
180
-
181
- expect(tokens).toContain('--atomix-easing-linear');
182
- expect(tokens).toContain('--atomix-ease-in');
183
- expect(tokens).toContain('--atomix-ease-out');
184
- expect(tokens).toContain('--atomix-ease-in-out');
185
- expect(tokens).toContain('--atomix-easing-smooth');
186
- });
187
-
188
- it('should generate keyframe definitions', () => {
189
- const tokens = generateMotionTokens();
190
-
191
- expect(tokens).toContain('@keyframes atomix-fade-in');
192
- expect(tokens).toContain('@keyframes atomix-slide-in-up');
193
- expect(tokens).toContain('@keyframes atomix-scale-in');
194
- expect(tokens).toContain('@keyframes atomix-bounce');
195
- expect(tokens).toContain('@keyframes atomix-spin');
196
- });
197
-
198
- it('should generate utility classes', () => {
199
- const tokens = generateMotionTokens();
200
-
201
- expect(tokens).toContain('.atomix-animate-fade-in');
202
- expect(tokens).toContain('.atomix-animate-slide-in-up');
203
- expect(tokens).toContain('.atomix-animate-scale-in');
204
- expect(tokens).toContain('.atomix-animate-spin');
205
- });
206
-
207
- it('should include reduced motion media query', () => {
208
- const tokens = generateMotionTokens();
209
-
210
- expect(tokens).toContain('@media (prefers-reduced-motion: reduce)');
211
- expect(tokens).toContain('animation-duration: 0.01ms !important');
212
- });
213
-
214
- it('should generate transition presets', () => {
215
- const tokens = generateMotionTokens();
216
-
217
- expect(tokens).toContain('--atomix-transition-fast');
218
- expect(tokens).toContain('--atomix-transition-base');
219
- expect(tokens).toContain('--atomix-transition-colors');
220
- expect(tokens).toContain('--atomix-transition-opacity');
221
- });
222
- });
223
-
224
- describe('Component Animation Generation', () => {
225
- it('should generate component-specific animation config', () => {
226
- // This would be tested through generateComponentAnimation
227
- // which is exported but we're testing the pattern here
228
- expect(ANIMATION_PRESETS.fade).toBeDefined();
229
- expect(ANIMATION_PRESETS.fade.duration).toBe('var(--atomix-duration-base)');
230
- });
231
- });
232
- });
233
-
234
- describe('Integration Tests', () => {
235
- it('should work together for premium components', () => {
236
- // Verify both generators can be used together
237
- const glassStyles = generateGlassStyles('PremiumCard', 'crystal');
238
- const motionTokens = generateMotionTokens();
239
-
240
- expect(glassStyles).toBeDefined();
241
- expect(motionTokens).toBeDefined();
242
-
243
- // Both should include accessibility features
244
- expect(glassStyles).toContain('prefers-reduced');
245
- expect(motionTokens).toContain('prefers-reduced-motion');
246
- });
247
-
248
- it('should provide consistent design tokens', () => {
249
- const glassConfig = GLASS_PRESETS.default;
250
- const fadeAnimation = ANIMATION_PRESETS.fade;
251
-
252
- // Both should use CSS custom properties for theming
253
- expect(fadeAnimation.duration).toContain('var(--');
254
- expect(fadeAnimation.easing).toContain('var(--');
255
- });
256
- });