@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,122 @@
1
+ /**
2
+ * Atomix CLI Universal Token Engine
3
+ * Manages token providers and bi-directional sync
4
+ */
5
+
6
+ import { logger } from '../../utils/logger.js';
7
+ import { configLoader } from '../config-loader.js';
8
+ import { hookManager } from '../hooks.js';
9
+
10
+ export class TokenEngine {
11
+ constructor() {
12
+ this.providers = new Map();
13
+ }
14
+
15
+ /**
16
+ * Initializes the engine with providers from the config
17
+ */
18
+ async initialize() {
19
+ const config = configLoader.getConfig();
20
+ const tokenEngineConfig = config.tokenEngine || {};
21
+ const providers = tokenEngineConfig.providers || {};
22
+
23
+ for (const [name, providerConfig] of Object.entries(providers)) {
24
+ try {
25
+ const provider = await this._instantiateProvider(providerConfig);
26
+ if (provider) {
27
+ this.providers.set(name, provider);
28
+ logger.debug(`Initialized token provider: ${name} (${providerConfig.type})`);
29
+ }
30
+ } catch (error) {
31
+ logger.error(`Failed to initialize token provider ${name}: ${error.message}`);
32
+ }
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Instantiates a provider based on its type
38
+ * @private
39
+ */
40
+ async _instantiateProvider(providerConfig) {
41
+ const { type, options } = providerConfig;
42
+
43
+ switch (type) {
44
+ case 'figma': {
45
+ const { FigmaProvider } = await import('./providers/figma.js');
46
+ return new FigmaProvider(options);
47
+ }
48
+ case 'style-dictionary': {
49
+ const { StyleDictionaryProvider } = await import('./providers/style-dictionary.js');
50
+ return new StyleDictionaryProvider(options);
51
+ }
52
+ case 'w3c': {
53
+ const { W3CProvider } = await import('./providers/w3c.js');
54
+ return new W3CProvider(options);
55
+ }
56
+ default:
57
+ logger.warn(`Unknown token provider type: ${type}`);
58
+ return null;
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Returns the list of configured provider names (for help and prompts)
64
+ * @returns {string[]}
65
+ */
66
+ getProviderNames() {
67
+ return [...this.providers.keys()];
68
+ }
69
+
70
+ /**
71
+ * Pulls tokens from a specific provider
72
+ * @param {string} providerName - Name of the provider to pull from
73
+ */
74
+ async pull(providerName) {
75
+ const provider = this.providers.get(providerName);
76
+ if (!provider) {
77
+ throw new Error(`Token provider not found: ${providerName}`);
78
+ }
79
+
80
+ logger.info(`Pulling tokens from ${providerName}...`);
81
+
82
+ // Lifecycle hook
83
+ const initialData = await hookManager.trigger('prePullTokens', { providerName });
84
+
85
+ const tokens = await provider.pull();
86
+
87
+ // Lifecycle hook
88
+ const finalTokens = await hookManager.trigger('postPullTokens', tokens);
89
+
90
+ logger.debug(`Successfully pulled tokens from ${providerName}`);
91
+ return finalTokens;
92
+ }
93
+
94
+ /**
95
+ * Pushes tokens back to a provider (Experimental)
96
+ * @param {string} providerName - Name of the provider to push to
97
+ * @param {Object} tokens - The tokens to push
98
+ */
99
+ async push(providerName, tokens) {
100
+ const provider = this.providers.get(providerName);
101
+ if (!provider) {
102
+ throw new Error(`Token provider not found: ${providerName}`);
103
+ }
104
+
105
+ logger.info(`Pushing tokens to ${providerName}...`);
106
+
107
+ // Lifecycle hook
108
+ const preparedTokens = await hookManager.trigger('prePushTokens', tokens);
109
+
110
+ const success = await provider.push(preparedTokens);
111
+
112
+ if (success) {
113
+ logger.info(`Successfully pushed tokens to ${providerName}`);
114
+ } else {
115
+ logger.error(`Failed to push tokens to ${providerName}`);
116
+ }
117
+
118
+ return success;
119
+ }
120
+ }
121
+
122
+ export const tokenEngine = new TokenEngine();
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Atomix CLI Token Provider Base Class
3
+ */
4
+
5
+ export class TokenProvider {
6
+ constructor(options = {}) {
7
+ this.options = options;
8
+ }
9
+
10
+ /**
11
+ * Fetches tokens from the source
12
+ * @returns {Promise<Object>} - The fetched tokens
13
+ */
14
+ async pull() {
15
+ throw new Error('Provider.pull() not implemented');
16
+ }
17
+
18
+ /**
19
+ * Pushes local changes to the source (Experimental)
20
+ * @param {Object} tokens - The tokens to push
21
+ * @returns {Promise<boolean>} - Success status
22
+ */
23
+ async push(tokens) {
24
+ throw new Error('Provider.push() not implemented');
25
+ }
26
+
27
+ /**
28
+ * Validates the provider configuration
29
+ * @returns {Object} - { isValid: boolean, error?: string }
30
+ */
31
+ validate() {
32
+ return { isValid: true };
33
+ }
34
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Atomix CLI Figma Token Provider
3
+ */
4
+
5
+ import { TokenProvider } from '../provider.js';
6
+ import { logger } from '../../../utils/logger.js';
7
+
8
+ export class FigmaProvider extends TokenProvider {
9
+ constructor(options = {}) {
10
+ super(options);
11
+ this.apiKey = options.apiKey || process.env.FIGMA_API_KEY;
12
+ this.fileId = options.fileId;
13
+ }
14
+
15
+ /**
16
+ * Fetches tokens from Figma
17
+ */
18
+ async pull() {
19
+ if (!this.apiKey || !this.fileId) {
20
+ throw new Error('Figma provider requires an API key and file ID.');
21
+ }
22
+
23
+ logger.debug(`Fetching Figma file: ${this.fileId}`);
24
+
25
+ // In a real implementation, we'd use the Figma API here.
26
+ // For now, return a placeholder to demonstrate the architecture.
27
+ return {
28
+ source: 'figma',
29
+ fileId: this.fileId,
30
+ tokens: {
31
+ colors: {
32
+ primary: '#3b82f6',
33
+ secondary: '#10b981'
34
+ },
35
+ spacing: {
36
+ '1': '0.25rem',
37
+ '2': '0.5rem'
38
+ }
39
+ }
40
+ };
41
+ }
42
+
43
+ /**
44
+ * Pushes tokens to Figma (Experimental)
45
+ */
46
+ async push(tokens) {
47
+ logger.warn('Pushing tokens to Figma is currently experimental and not fully implemented.');
48
+ return false;
49
+ }
50
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Atomix CLI Style Dictionary Token Provider
3
+ */
4
+
5
+ import { TokenProvider } from '../provider.js';
6
+ import { logger } from '../../../utils/logger.js';
7
+ import { existsSync, readFileSync } from 'fs';
8
+ import { join } from 'path';
9
+
10
+ export class StyleDictionaryProvider extends TokenProvider {
11
+ constructor(options = {}) {
12
+ super(options);
13
+ this.configPath = options.configPath || './style-dictionary.config.js';
14
+ }
15
+
16
+ /**
17
+ * Fetches tokens from Style Dictionary
18
+ */
19
+ async pull() {
20
+ const fullPath = join(process.cwd(), this.configPath);
21
+ if (!existsSync(fullPath)) {
22
+ throw new Error(`Style Dictionary config not found: ${this.configPath}`);
23
+ }
24
+
25
+ logger.debug(`Loading Style Dictionary config: ${this.configPath}`);
26
+
27
+ // In a real implementation, we'd use Style Dictionary here.
28
+ // For now, return a placeholder to demonstrate the architecture.
29
+ return {
30
+ source: 'style-dictionary',
31
+ config: this.configPath,
32
+ tokens: {
33
+ colors: {
34
+ brand: '#3b82f6',
35
+ accent: '#10b981'
36
+ }
37
+ }
38
+ };
39
+ }
40
+
41
+ /**
42
+ * Pushes tokens back (Not supported for Style Dictionary)
43
+ */
44
+ async push(tokens) {
45
+ logger.warn('Style Dictionary provider does not support pushing tokens.');
46
+ return false;
47
+ }
48
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Atomix CLI W3C Token Provider
3
+ */
4
+
5
+ import { TokenProvider } from '../provider.js';
6
+ import { logger } from '../../../utils/logger.js';
7
+ import { existsSync, readFileSync } from 'fs';
8
+ import { join } from 'path';
9
+
10
+ export class W3CProvider extends TokenProvider {
11
+ constructor(options = {}) {
12
+ super(options);
13
+ this.tokenPath = options.tokenPath || './tokens.json';
14
+ }
15
+
16
+ /**
17
+ * Fetches tokens from a W3C Design Tokens file
18
+ */
19
+ async pull() {
20
+ const fullPath = join(process.cwd(), this.tokenPath);
21
+ if (!existsSync(fullPath)) {
22
+ throw new Error(`W3C tokens file not found: ${this.tokenPath}`);
23
+ }
24
+
25
+ logger.debug(`Loading W3C tokens file: ${this.tokenPath}`);
26
+
27
+ try {
28
+ const content = readFileSync(fullPath, 'utf8');
29
+ const tokens = JSON.parse(content);
30
+
31
+ return {
32
+ source: 'w3c',
33
+ tokenPath: this.tokenPath,
34
+ tokens
35
+ };
36
+ } catch (error) {
37
+ throw new Error(`Failed to parse W3C tokens file: ${error.message}`);
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Pushes tokens back (Experimental)
43
+ */
44
+ async push(tokens) {
45
+ logger.warn('W3C provider does not support pushing tokens.');
46
+ return false;
47
+ }
48
+ }