@shohojdhara/atomix 0.3.14 → 0.3.15
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.
- package/CHANGELOG.md +20 -0
- package/build-tools/EXAMPLES.md +372 -0
- package/build-tools/README.md +242 -0
- package/build-tools/__tests__/error-handler.test.js +230 -0
- package/build-tools/__tests__/index.test.js +141 -0
- package/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/build-tools/__tests__/utils.test.js +161 -0
- package/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/build-tools/error-handler.js +308 -0
- package/build-tools/index.d.ts +43 -0
- package/build-tools/index.js +88 -0
- package/build-tools/package.json +67 -0
- package/build-tools/rollup-plugin.js +236 -0
- package/build-tools/types.d.ts +163 -0
- package/build-tools/utils.js +203 -0
- package/build-tools/vite-plugin.js +161 -0
- package/build-tools/webpack-loader.js +123 -0
- package/dist/atomix.css +203 -90
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +3 -3
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/EXAMPLES.md +372 -0
- package/dist/build-tools/README.md +242 -0
- package/dist/build-tools/__tests__/error-handler.test.js +230 -0
- package/dist/build-tools/__tests__/index.test.js +141 -0
- package/dist/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/dist/build-tools/__tests__/utils.test.js +161 -0
- package/dist/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/dist/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/dist/build-tools/error-handler.js +308 -0
- package/dist/build-tools/index.d.ts +43 -0
- package/dist/build-tools/index.js +88 -0
- package/dist/build-tools/package.json +67 -0
- package/dist/build-tools/rollup-plugin.js +236 -0
- package/dist/build-tools/types.d.ts +163 -0
- package/dist/build-tools/utils.js +203 -0
- package/dist/build-tools/vite-plugin.js +161 -0
- package/dist/build-tools/webpack-loader.js +123 -0
- package/dist/charts.d.ts +1 -1
- package/dist/charts.js +86 -57
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +136 -112
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +2 -5
- package/dist/forms.js +140 -128
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +1 -1
- package/dist/heavy.js +136 -112
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +9 -61
- package/dist/index.esm.js +237 -286
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +250 -299
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +23 -8
- package/scripts/atomix-cli.js +170 -73
- package/scripts/cli/__tests__/README.md +81 -0
- package/scripts/cli/__tests__/basic.test.js +115 -0
- package/scripts/cli/__tests__/component-generator.test.js +332 -0
- package/scripts/cli/__tests__/integration.test.js +327 -0
- package/scripts/cli/__tests__/test-setup.js +133 -0
- package/scripts/cli/__tests__/token-manager.test.js +251 -0
- package/scripts/cli/__tests__/utils.test.js +161 -0
- package/scripts/cli/component-generator.js +253 -299
- package/scripts/cli/dependency-checker.js +355 -0
- package/scripts/cli/interactive-init.js +46 -5
- package/scripts/cli/template-manager.js +0 -2
- package/scripts/cli/templates/common-templates.js +636 -0
- package/scripts/cli/templates/composable-templates.js +148 -126
- package/scripts/cli/templates/index.js +23 -16
- package/scripts/cli/templates/project-templates.js +151 -23
- package/scripts/cli/templates/react-templates.js +280 -210
- package/scripts/cli/templates/scss-templates.js +90 -91
- package/scripts/cli/templates/testing-templates.js +206 -27
- package/scripts/cli/templates/testing-utils.js +278 -0
- package/scripts/cli/templates/types-templates.js +70 -56
- package/scripts/cli/theme-bridge.js +8 -2
- package/scripts/cli/token-manager.js +318 -206
- package/scripts/cli/utils.js +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +369 -870
- package/src/components/AtomixGlass/AtomixGlass.tsx +80 -39
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +103 -81
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +8 -7
- package/src/components/AtomixGlass/glass-utils.ts +2 -2
- package/src/components/AtomixGlass/shader-utils.ts +5 -0
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +131 -0
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2957 -2853
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +348 -0
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +103 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +50 -35
- package/src/components/AtomixGlass/stories/{ShaderVariants.stories.tsx → Shaders.stories.tsx} +1 -1
- package/src/components/AtomixGlass/stories/shared-components.tsx +90 -190
- package/src/components/Avatar/Avatar.stories.tsx +213 -1
- package/src/components/Badge/Badge.stories.tsx +121 -362
- package/src/components/Block/Block.stories.tsx +21 -12
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +141 -23
- package/src/components/Button/Button.stories.tsx +463 -1126
- package/src/components/Button/Button.test.tsx +107 -0
- package/src/components/Button/Button.tsx +46 -50
- package/src/components/Button/ButtonGroup.stories.tsx +373 -217
- package/src/components/Callout/Callout.stories.tsx +289 -634
- package/src/components/Card/Card.stories.tsx +248 -68
- package/src/components/Chart/Chart.stories.tsx +150 -8
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +151 -69
- package/src/components/Countdown/Countdown.stories.tsx +115 -8
- package/src/components/DataTable/DataTable.stories.tsx +346 -146
- package/src/components/DatePicker/DatePicker.stories.tsx +325 -1066
- package/src/components/Dropdown/Dropdown.stories.tsx +153 -33
- package/src/components/EdgePanel/EdgePanel.stories.tsx +230 -21
- package/src/components/Footer/Footer.stories.tsx +392 -328
- package/src/components/Form/Checkbox.stories.tsx +140 -6
- package/src/components/Form/Checkbox.test.tsx +63 -0
- package/src/components/Form/Checkbox.tsx +87 -51
- package/src/components/Form/Form.stories.tsx +119 -20
- package/src/components/Form/FormGroup.stories.tsx +127 -4
- package/src/components/Form/Radio.stories.tsx +140 -5
- package/src/components/Form/Select.stories.tsx +140 -8
- package/src/components/Form/Textarea.stories.tsx +149 -6
- package/src/components/Hero/Hero.stories.tsx +333 -32
- package/src/components/List/List.stories.tsx +141 -3
- package/src/components/Modal/Modal.stories.tsx +181 -42
- package/src/components/Popover/Popover.stories.tsx +448 -98
- package/src/components/Progress/Progress.stories.tsx +167 -5
- package/src/components/River/River.stories.tsx +1 -1
- package/src/components/SectionIntro/SectionIntro.stories.tsx +240 -48
- package/src/components/Spinner/Spinner.stories.tsx +102 -8
- package/src/components/Steps/Steps.stories.tsx +172 -43
- package/src/components/Tabs/Tabs.stories.tsx +136 -10
- package/src/components/Testimonial/Testimonial.stories.tsx +120 -3
- package/src/components/Todo/Todo.stories.tsx +198 -9
- package/src/components/Toggle/Toggle.stories.tsx +126 -39
- package/src/components/Tooltip/Tooltip.stories.tsx +194 -104
- package/src/components/Upload/Upload.stories.tsx +113 -24
- package/src/lib/README.md +2 -2
- package/src/lib/__tests__/theme-tools.test.ts +193 -0
- package/src/lib/composables/index.ts +2 -2
- package/src/lib/composables/useAtomixGlass.ts +28 -56
- package/src/lib/composables/useChartExport.ts +2 -7
- package/src/lib/composables/useDataTable.ts +46 -29
- package/src/lib/constants/components.ts +9 -32
- package/src/lib/theme/devtools/CLI.ts +1 -1
- package/src/lib/types/components.ts +1 -1
- package/src/lib/utils/__tests__/csv.test.ts +45 -0
- package/src/lib/utils/csv.ts +17 -0
- package/src/lib/utils/dataTableExport.ts +1 -10
- package/src/styles/01-settings/_index.scss +2 -1
- package/src/styles/01-settings/_settings.accordion.scss +28 -7
- package/src/styles/01-settings/_settings.colors.scss +11 -11
- package/src/styles/01-settings/_settings.typography.scss +5 -5
- package/src/styles/02-tools/_tools.utility-api.scss +14 -0
- package/src/styles/06-components/_components.accordion.scss +56 -14
- package/src/styles/06-components/_components.checkbox.scss +23 -17
- package/src/styles/99-utilities/_index.scss +2 -0
- package/src/styles/99-utilities/_utilities.scss +3 -1
- package/src/styles/99-utilities/_utilities.text-gradient.scss +45 -0
- package/themes/dark-complementary/README.md +98 -0
- package/themes/dark-complementary/index.scss +158 -0
- package/themes/default-light/README.md +81 -0
- package/themes/default-light/index.scss +154 -0
- package/themes/high-contrast/README.md +105 -0
- package/themes/high-contrast/index.scss +172 -0
- package/themes/test-theme/README.md +38 -0
- package/themes/test-theme/index.scss +47 -0
- package/scripts/cli/templates-original-backup.js +0 -1655
- package/scripts/cli/templates_backup.js +0 -684
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +0 -1438
- package/src/lib/composables/useButton.ts +0 -93
- package/src/lib/composables/useCheckbox.ts +0 -70
|
@@ -1,149 +1,171 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Composable Templates
|
|
3
|
-
* Templates for custom hooks
|
|
2
|
+
* Composable Hook Templates
|
|
3
|
+
* Templates for React custom hooks generation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Default composable hook template that matches existing patterns
|
|
8
8
|
*/
|
|
9
|
-
export const
|
|
10
|
-
|
|
9
|
+
export const composableTemplate = (name) => {
|
|
10
|
+
const componentPrefix = name.toLowerCase().replace(/([A-Z])/g, '-$1').toLowerCase().replace(/^-/, '');
|
|
11
|
+
|
|
12
|
+
return `import { ${name}Props } from '../types/components';
|
|
13
|
+
import { ${name.toUpperCase()} } from '../constants/components';
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
16
|
+
* ${name} state and functionality
|
|
17
|
+
* @param initialProps - Initial ${name.toLowerCase()} properties
|
|
18
|
+
* @returns ${name} state and methods
|
|
15
19
|
*/
|
|
16
20
|
export function use${name}(initialProps?: Partial<${name}Props>) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// State management for controlled/uncontrolled pattern
|
|
25
|
-
const [internalIsOpen, setInternalIsOpen] = useState(defaultIsOpen);
|
|
26
|
-
const isControlled = typeof controlledIsOpen === 'boolean';
|
|
27
|
-
const isOpen = isControlled ? controlledIsOpen : internalIsOpen;
|
|
28
|
-
|
|
29
|
-
// Refs for DOM elements
|
|
30
|
-
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
31
|
-
const panelRef = useRef<HTMLDivElement>(null);
|
|
21
|
+
// Default ${name.toLowerCase()} properties
|
|
22
|
+
const defaultProps: Partial<${name}Props> = {
|
|
23
|
+
variant: 'primary',
|
|
24
|
+
size: 'md',
|
|
25
|
+
disabled: false,
|
|
26
|
+
...initialProps,
|
|
27
|
+
};
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}, [isControlled, onToggle]);
|
|
62
|
-
|
|
63
|
-
// Keyboard navigation
|
|
64
|
-
const handleKeyDown = useCallback((event: KeyboardEvent) => {
|
|
65
|
-
switch (event.key) {
|
|
66
|
-
case 'Enter':
|
|
67
|
-
case ' ':
|
|
68
|
-
event.preventDefault();
|
|
69
|
-
toggle();
|
|
70
|
-
break;
|
|
71
|
-
case 'Escape':
|
|
72
|
-
if (isOpen) {
|
|
73
|
-
close();
|
|
74
|
-
triggerRef.current?.focus();
|
|
75
|
-
}
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
}, [isOpen, toggle, close]);
|
|
79
|
-
|
|
80
|
-
// Accessibility helpers
|
|
81
|
-
const getTriggerProps = useCallback(() => ({
|
|
82
|
-
ref: triggerRef,
|
|
83
|
-
'aria-expanded': isOpen,
|
|
84
|
-
'aria-controls': panelRef.current?.id,
|
|
85
|
-
onKeyDown: handleKeyDown,
|
|
86
|
-
onClick: toggle,
|
|
87
|
-
}), [isOpen, handleKeyDown, toggle]);
|
|
88
|
-
|
|
89
|
-
const getPanelProps = useCallback(() => ({
|
|
90
|
-
ref: panelRef,
|
|
91
|
-
'aria-hidden': !isOpen,
|
|
92
|
-
role: 'region',
|
|
93
|
-
}), [isOpen]);
|
|
94
|
-
|
|
95
|
-
const getHeaderProps = useCallback(() => ({
|
|
96
|
-
role: 'heading',
|
|
97
|
-
'aria-level': 3,
|
|
98
|
-
}), []);
|
|
99
|
-
|
|
100
|
-
const getContentProps = useCallback(() => ({
|
|
101
|
-
// Content-specific props
|
|
102
|
-
}), []);
|
|
103
|
-
|
|
104
|
-
// State object for external access
|
|
105
|
-
const state = {
|
|
106
|
-
isOpen,
|
|
107
|
-
isControlled,
|
|
29
|
+
/**
|
|
30
|
+
* Generate ${name.toLowerCase()} class based on properties
|
|
31
|
+
* @param props - ${name} properties
|
|
32
|
+
* @returns Class string
|
|
33
|
+
*/
|
|
34
|
+
const generateClassNames = (props: Partial<${name}Props> = {}): string => {
|
|
35
|
+
const {
|
|
36
|
+
variant = defaultProps.variant,
|
|
37
|
+
size = defaultProps.size,
|
|
38
|
+
disabled = defaultProps.disabled,
|
|
39
|
+
glass = defaultProps.glass,
|
|
40
|
+
className = '',
|
|
41
|
+
} = props;
|
|
42
|
+
|
|
43
|
+
const sizeClass = size === 'md' ? '' : \`c-${componentPrefix}--\${size}\`;
|
|
44
|
+
const disabledClass = disabled ? 'c-${componentPrefix}--disabled' : '';
|
|
45
|
+
const glassClass = glass ? 'c-${componentPrefix}--glass' : '';
|
|
46
|
+
|
|
47
|
+
return [
|
|
48
|
+
${name.toUpperCase()}.BASE_CLASS,
|
|
49
|
+
\`c-${componentPrefix}--\${variant}\`,
|
|
50
|
+
sizeClass,
|
|
51
|
+
disabledClass,
|
|
52
|
+
glassClass,
|
|
53
|
+
className,
|
|
54
|
+
]
|
|
55
|
+
.filter(Boolean)
|
|
56
|
+
.join(' ');
|
|
108
57
|
};
|
|
109
58
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Handle ${name.toLowerCase()} click with disabled check
|
|
61
|
+
* @param handler - Click handler function
|
|
62
|
+
* @returns Function that respects disabled state
|
|
63
|
+
*/
|
|
64
|
+
const handleClick = (handler?: (event: React.MouseEvent<HTMLDivElement>) => void) => {
|
|
65
|
+
return (event: React.MouseEvent<HTMLDivElement>) => {
|
|
66
|
+
if (!defaultProps.disabled && handler) {
|
|
67
|
+
handler(event);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
};
|
|
116
71
|
|
|
117
72
|
return {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
isControlled,
|
|
122
|
-
|
|
123
|
-
// Actions
|
|
124
|
-
toggle,
|
|
125
|
-
open,
|
|
126
|
-
close,
|
|
127
|
-
setIsOpen,
|
|
128
|
-
|
|
129
|
-
// Props helpers
|
|
130
|
-
getTriggerProps,
|
|
131
|
-
getPanelProps,
|
|
132
|
-
getHeaderProps,
|
|
133
|
-
getContentProps,
|
|
134
|
-
|
|
135
|
-
// Refs
|
|
136
|
-
triggerRef,
|
|
137
|
-
panelRef,
|
|
73
|
+
defaultProps,
|
|
74
|
+
generateClassNames,
|
|
75
|
+
handleClick,
|
|
138
76
|
};
|
|
139
77
|
}
|
|
78
|
+
`;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Simple composable template
|
|
83
|
+
*/
|
|
84
|
+
export const simpleComposableTemplate = (name) => `import { useState } from 'react';
|
|
85
|
+
import type { ${name}Props } from '../types/components';
|
|
86
|
+
|
|
87
|
+
export function use${name}(props: ${name}Props) {
|
|
88
|
+
const [isReady, setIsReady] = useState(false);
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
setIsReady(true);
|
|
92
|
+
}, []);
|
|
93
|
+
|
|
94
|
+
const generateClassNames = (baseClassName = '') => {
|
|
95
|
+
return \`c-${name.toLowerCase()} \${baseClassName}\`.trim();
|
|
96
|
+
};
|
|
140
97
|
|
|
141
|
-
|
|
98
|
+
return {
|
|
99
|
+
isReady,
|
|
100
|
+
generateClassNames,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
142
103
|
`;
|
|
143
104
|
|
|
144
105
|
/**
|
|
145
|
-
*
|
|
106
|
+
* Complex composable template
|
|
146
107
|
*/
|
|
108
|
+
export const complexComposableTemplate = (name) => `import { useState, useEffect, useRef } from 'react';
|
|
109
|
+
import { ${name.toUpperCase()} } from '../constants/components';
|
|
110
|
+
import type { ${name}Props, ${name}State, ElementRefs } from '../types/components';
|
|
111
|
+
|
|
112
|
+
interface Use${name}Result {
|
|
113
|
+
state: ${name}State;
|
|
114
|
+
refs: ElementRefs;
|
|
115
|
+
methods: {
|
|
116
|
+
// Define methods for complex interactions
|
|
117
|
+
updateState: (newState: Partial<${name}State>) => void;
|
|
118
|
+
reset: () => void;
|
|
119
|
+
};
|
|
120
|
+
generateClassNames: (baseClassName?: string) => string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function use${name}(
|
|
124
|
+
initialProps?: Partial<${name}Props>
|
|
125
|
+
): Use${name}Result {
|
|
126
|
+
const defaultProps: Partial<${name}Props> = {
|
|
127
|
+
disabled: false,
|
|
128
|
+
...initialProps,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const [state, setState] = useState<${name}State>({
|
|
132
|
+
// Complex state definition
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const panelRef = useRef<HTMLDivElement>(null);
|
|
136
|
+
const contentRef = useRef<HTMLDivElement>(null);
|
|
137
|
+
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
138
|
+
|
|
139
|
+
const updateState = (newState: Partial<${name}State>) => {
|
|
140
|
+
setState(prev => ({ ...prev, ...newState }));
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const reset = () => {
|
|
144
|
+
// Reset to initial state
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const generateClassNames = (baseClassName = ''): string => {
|
|
148
|
+
const baseClasses = [
|
|
149
|
+
${name.toUpperCase()}.SELECTORS.${name.toUpperCase()}.replace('.', ''),
|
|
150
|
+
state.isOpen ? ${name.toUpperCase()}.CLASSES.IS_OPEN : '',
|
|
151
|
+
defaultProps.disabled ? ${name.toUpperCase()}.CLASSES.IS_DISABLED : '',
|
|
152
|
+
baseClassName
|
|
153
|
+
].filter(Boolean).join(' ');
|
|
154
|
+
|
|
155
|
+
return baseClasses;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
state,
|
|
160
|
+
refs: { panelRef, contentRef, buttonRef },
|
|
161
|
+
methods: { updateState, reset },
|
|
162
|
+
generateClassNames,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
`;
|
|
166
|
+
|
|
147
167
|
export const composableTemplates = {
|
|
148
|
-
|
|
168
|
+
useHook: composableTemplate,
|
|
169
|
+
simpleHook: simpleComposableTemplate,
|
|
170
|
+
complexHook: complexComposableTemplate,
|
|
149
171
|
};
|
|
@@ -13,6 +13,7 @@ import { composableTemplates } from './composable-templates.js';
|
|
|
13
13
|
import * as tokenTemplates from './token-templates.js';
|
|
14
14
|
import { projectTemplates } from './project-templates.js';
|
|
15
15
|
import { configTemplates } from './config-templates.js';
|
|
16
|
+
import { commonTemplates } from './common-templates.js';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Main templates object that maintains backward compatibility
|
|
@@ -20,27 +21,33 @@ import { configTemplates } from './config-templates.js';
|
|
|
20
21
|
*/
|
|
21
22
|
export const componentTemplates = {
|
|
22
23
|
react: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
component: reactTemplates.component,
|
|
25
|
+
simple: reactTemplates.simple,
|
|
26
|
+
medium: reactTemplates.medium,
|
|
27
|
+
complex: reactTemplates.complex,
|
|
28
|
+
index: reactTemplates.index,
|
|
29
|
+
story: storybookTemplates.story,
|
|
30
|
+
test: testingTemplates.test,
|
|
31
|
+
scss: scssTemplates.full,
|
|
32
|
+
settings: scssTemplates.settings,
|
|
33
|
+
componentStyles: scssTemplates.component,
|
|
34
|
+
types: typesTemplates.types,
|
|
35
|
+
constants: typesTemplates.constants,
|
|
28
36
|
},
|
|
29
37
|
composable: composableTemplates,
|
|
38
|
+
storybook: storybookTemplates,
|
|
39
|
+
testing: testingTemplates,
|
|
40
|
+
scss: scssTemplates,
|
|
41
|
+
types: typesTemplates,
|
|
30
42
|
};
|
|
31
43
|
|
|
32
|
-
//
|
|
44
|
+
// Export everything for flexibility
|
|
33
45
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
generateAnimationTokens,
|
|
40
|
-
} from './token-templates.js';
|
|
41
|
-
|
|
42
|
-
// Re-export project and config templates
|
|
43
|
-
export { projectTemplates, configTemplates };
|
|
46
|
+
tokenTemplates,
|
|
47
|
+
projectTemplates,
|
|
48
|
+
configTemplates,
|
|
49
|
+
commonTemplates
|
|
50
|
+
};
|
|
44
51
|
|
|
45
52
|
/**
|
|
46
53
|
* Get template by name and type
|
|
@@ -3,13 +3,35 @@
|
|
|
3
3
|
* Templates for different project types and configurations
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { commonTemplates } from './common-templates.js';
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* React project templates
|
|
8
10
|
*/
|
|
9
11
|
export const reactProjectTemplates = {
|
|
10
12
|
dependencies: ['react', 'react-dom'],
|
|
11
|
-
devDependencies: ['@vitejs/plugin-react', 'vite', 'typescript'],
|
|
13
|
+
devDependencies: ['@vitejs/plugin-react', 'vite', 'typescript', '@types/react', '@types/react-dom', 'sass'],
|
|
12
14
|
files: {
|
|
15
|
+
// TypeScript Configuration
|
|
16
|
+
'tsconfig.json': commonTemplates.typescript.react,
|
|
17
|
+
'tsconfig.node.json': commonTemplates.typescript.reactNode,
|
|
18
|
+
|
|
19
|
+
// Git Configuration
|
|
20
|
+
'.gitignore': commonTemplates.git.gitignore,
|
|
21
|
+
'.gitattributes': commonTemplates.git.gitattributes,
|
|
22
|
+
|
|
23
|
+
// Code Quality
|
|
24
|
+
'.prettierrc': commonTemplates.prettier.prettierrc,
|
|
25
|
+
'.prettierignore': commonTemplates.prettier.prettierignore,
|
|
26
|
+
'.eslintrc.cjs': commonTemplates.eslint.react,
|
|
27
|
+
|
|
28
|
+
// Environment
|
|
29
|
+
'.env.example': commonTemplates.env,
|
|
30
|
+
|
|
31
|
+
// Vite Environment Types
|
|
32
|
+
'src/vite-env.d.ts': commonTemplates.viteEnv,
|
|
33
|
+
|
|
34
|
+
// Main Application Files
|
|
13
35
|
'src/App.tsx': `import React from 'react';
|
|
14
36
|
import './App.css';
|
|
15
37
|
|
|
@@ -27,22 +49,19 @@ function App() {
|
|
|
27
49
|
}
|
|
28
50
|
|
|
29
51
|
export default App;`,
|
|
52
|
+
|
|
30
53
|
'src/main.tsx': `import React from 'react';
|
|
31
54
|
import ReactDOM from 'react-dom/client';
|
|
32
55
|
import App from './App';
|
|
56
|
+
import './styles/index.scss';
|
|
33
57
|
|
|
34
58
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
35
59
|
<React.StrictMode>
|
|
36
60
|
<App />
|
|
37
61
|
</React.StrictMode>,
|
|
38
62
|
);`,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// Your custom theme overrides here
|
|
42
|
-
);
|
|
43
|
-
@use '@shohojdhara/atomix/scss/components';
|
|
44
|
-
|
|
45
|
-
.App {
|
|
63
|
+
|
|
64
|
+
'src/App.css': `.App {
|
|
46
65
|
text-align: center;
|
|
47
66
|
}
|
|
48
67
|
|
|
@@ -57,6 +76,7 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
|
57
76
|
justify-content: center;
|
|
58
77
|
font-size: calc(10px + 2vmin);
|
|
59
78
|
}`,
|
|
79
|
+
|
|
60
80
|
'index.html': `<!DOCTYPE html>
|
|
61
81
|
<html lang="en">
|
|
62
82
|
<head>
|
|
@@ -70,11 +90,21 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
|
70
90
|
<script type="module" src="/src/main.tsx"></script>
|
|
71
91
|
</body>
|
|
72
92
|
</html>`,
|
|
93
|
+
|
|
73
94
|
'vite.config.ts': `import { defineConfig } from 'vite';
|
|
74
95
|
import react from '@vitejs/plugin-react';
|
|
96
|
+
import { resolve } from 'path';
|
|
75
97
|
|
|
76
98
|
export default defineConfig({
|
|
77
99
|
plugins: [react()],
|
|
100
|
+
resolve: {
|
|
101
|
+
alias: {
|
|
102
|
+
'@': resolve(__dirname, './src'),
|
|
103
|
+
'@components': resolve(__dirname, './src/components'),
|
|
104
|
+
'@lib': resolve(__dirname, './src/lib'),
|
|
105
|
+
'@styles': resolve(__dirname, './src/styles'),
|
|
106
|
+
},
|
|
107
|
+
},
|
|
78
108
|
css: {
|
|
79
109
|
preprocessorOptions: {
|
|
80
110
|
scss: {
|
|
@@ -82,7 +112,28 @@ export default defineConfig({
|
|
|
82
112
|
}
|
|
83
113
|
}
|
|
84
114
|
}
|
|
85
|
-
})
|
|
115
|
+
});`,
|
|
116
|
+
|
|
117
|
+
// ITCSS Structure
|
|
118
|
+
'src/styles/index.scss': commonTemplates.itcss.main,
|
|
119
|
+
'src/styles/01-settings/_index.scss': commonTemplates.itcss.settings,
|
|
120
|
+
'src/styles/02-tools/_index.scss': commonTemplates.itcss.tools,
|
|
121
|
+
'src/styles/03-generic/_index.scss': commonTemplates.itcss.generic,
|
|
122
|
+
'src/styles/04-elements/_index.scss': commonTemplates.itcss.elements,
|
|
123
|
+
'src/styles/05-objects/_index.scss': commonTemplates.itcss.objects,
|
|
124
|
+
'src/styles/06-components/_index.scss': commonTemplates.itcss.components,
|
|
125
|
+
'src/styles/99-utilities/_index.scss': commonTemplates.itcss.utilities,
|
|
126
|
+
|
|
127
|
+
// Library Structure
|
|
128
|
+
'src/lib/types/index.ts': commonTemplates.lib.types,
|
|
129
|
+
'src/lib/types/components.ts': `// Component type definitions\n`,
|
|
130
|
+
'src/lib/constants/index.ts': commonTemplates.lib.constants,
|
|
131
|
+
'src/lib/composables/index.ts': commonTemplates.lib.composables,
|
|
132
|
+
'src/lib/utils/index.ts': commonTemplates.lib.utils,
|
|
133
|
+
|
|
134
|
+
// Placeholder files
|
|
135
|
+
'src/components/.gitkeep': '',
|
|
136
|
+
'src/assets/.gitkeep': '',
|
|
86
137
|
}
|
|
87
138
|
};
|
|
88
139
|
|
|
@@ -91,14 +142,31 @@ export default defineConfig({
|
|
|
91
142
|
*/
|
|
92
143
|
export const nextjsProjectTemplates = {
|
|
93
144
|
dependencies: ['next', 'react', 'react-dom'],
|
|
94
|
-
devDependencies: ['typescript', '@types/node', '@types/react', '@types/react-dom', 'sass'],
|
|
145
|
+
devDependencies: ['typescript', '@types/node', '@types/react', '@types/react-dom', 'sass', 'eslint', 'eslint-config-next'],
|
|
95
146
|
files: {
|
|
147
|
+
// TypeScript Configuration
|
|
148
|
+
'tsconfig.json': commonTemplates.typescript.nextjs,
|
|
149
|
+
|
|
150
|
+
// Git Configuration
|
|
151
|
+
'.gitignore': commonTemplates.git.gitignore,
|
|
152
|
+
'.gitattributes': commonTemplates.git.gitattributes,
|
|
153
|
+
|
|
154
|
+
// Code Quality
|
|
155
|
+
'.prettierrc': commonTemplates.prettier.prettierrc,
|
|
156
|
+
'.prettierignore': commonTemplates.prettier.prettierignore,
|
|
157
|
+
'.eslintrc.json': commonTemplates.eslint.nextjs,
|
|
158
|
+
|
|
159
|
+
// Environment
|
|
160
|
+
'.env.example': commonTemplates.env,
|
|
161
|
+
|
|
162
|
+
// Next.js Pages
|
|
96
163
|
'src/pages/_app.tsx': `import '../styles/globals.scss';
|
|
97
164
|
import type { AppProps } from 'next/app';
|
|
98
165
|
|
|
99
166
|
export default function App({ Component, pageProps }: AppProps) {
|
|
100
167
|
return <Component {...pageProps} />;
|
|
101
168
|
}`,
|
|
169
|
+
|
|
102
170
|
'src/pages/index.tsx': `import Head from 'next/head';
|
|
103
171
|
|
|
104
172
|
export default function Home() {
|
|
@@ -116,11 +184,8 @@ export default function Home() {
|
|
|
116
184
|
</>
|
|
117
185
|
);
|
|
118
186
|
}`,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
// Your custom theme overrides here
|
|
122
|
-
);
|
|
123
|
-
@use '@shohojdhara/atomix/scss/components';
|
|
187
|
+
|
|
188
|
+
'src/styles/globals.scss': `@use './index.scss';
|
|
124
189
|
|
|
125
190
|
html,
|
|
126
191
|
body {
|
|
@@ -134,6 +199,7 @@ main {
|
|
|
134
199
|
padding: 2rem;
|
|
135
200
|
text-align: center;
|
|
136
201
|
}`,
|
|
202
|
+
|
|
137
203
|
'next.config.js': `/** @type {import('next').NextConfig} */
|
|
138
204
|
const nextConfig = {
|
|
139
205
|
reactStrictMode: true,
|
|
@@ -142,7 +208,27 @@ const nextConfig = {
|
|
|
142
208
|
},
|
|
143
209
|
};
|
|
144
210
|
|
|
145
|
-
module.exports = nextConfig
|
|
211
|
+
module.exports = nextConfig;`,
|
|
212
|
+
|
|
213
|
+
// ITCSS Structure
|
|
214
|
+
'src/styles/index.scss': commonTemplates.itcss.main,
|
|
215
|
+
'src/styles/01-settings/_index.scss': commonTemplates.itcss.settings,
|
|
216
|
+
'src/styles/02-tools/_index.scss': commonTemplates.itcss.tools,
|
|
217
|
+
'src/styles/03-generic/_index.scss': commonTemplates.itcss.generic,
|
|
218
|
+
'src/styles/04-elements/_index.scss': commonTemplates.itcss.elements,
|
|
219
|
+
'src/styles/05-objects/_index.scss': commonTemplates.itcss.objects,
|
|
220
|
+
'src/styles/06-components/_index.scss': commonTemplates.itcss.components,
|
|
221
|
+
'src/styles/99-utilities/_index.scss': commonTemplates.itcss.utilities,
|
|
222
|
+
|
|
223
|
+
// Library Structure
|
|
224
|
+
'src/lib/types/index.ts': commonTemplates.lib.types,
|
|
225
|
+
'src/lib/types/components.ts': `// Component type definitions\n`,
|
|
226
|
+
'src/lib/constants/index.ts': commonTemplates.lib.constants,
|
|
227
|
+
'src/lib/utils/index.ts': commonTemplates.lib.utils,
|
|
228
|
+
|
|
229
|
+
// Placeholder files
|
|
230
|
+
'src/components/.gitkeep': '',
|
|
231
|
+
'src/public/.gitkeep': '',
|
|
146
232
|
}
|
|
147
233
|
};
|
|
148
234
|
|
|
@@ -151,8 +237,26 @@ module.exports = nextConfig;`
|
|
|
151
237
|
*/
|
|
152
238
|
export const vanillaProjectTemplates = {
|
|
153
239
|
dependencies: [],
|
|
154
|
-
devDependencies: ['vite', 'typescript'],
|
|
240
|
+
devDependencies: ['vite', 'typescript', 'sass'],
|
|
155
241
|
files: {
|
|
242
|
+
// TypeScript Configuration
|
|
243
|
+
'tsconfig.json': commonTemplates.typescript.vanilla,
|
|
244
|
+
|
|
245
|
+
// Git Configuration
|
|
246
|
+
'.gitignore': commonTemplates.git.gitignore,
|
|
247
|
+
'.gitattributes': commonTemplates.git.gitattributes,
|
|
248
|
+
|
|
249
|
+
// Code Quality
|
|
250
|
+
'.prettierrc': commonTemplates.prettier.prettierrc,
|
|
251
|
+
'.prettierignore': commonTemplates.prettier.prettierignore,
|
|
252
|
+
|
|
253
|
+
// Environment
|
|
254
|
+
'.env.example': commonTemplates.env,
|
|
255
|
+
|
|
256
|
+
// Vite Environment Types
|
|
257
|
+
'src/vite-env.d.ts': commonTemplates.viteEnv,
|
|
258
|
+
|
|
259
|
+
// Main Application Files
|
|
156
260
|
'index.html': `<!DOCTYPE html>
|
|
157
261
|
<html lang="en">
|
|
158
262
|
<head>
|
|
@@ -171,14 +275,12 @@ export const vanillaProjectTemplates = {
|
|
|
171
275
|
<script type="module" src="/src/main.ts"></script>
|
|
172
276
|
</body>
|
|
173
277
|
</html>`,
|
|
278
|
+
|
|
174
279
|
'src/main.ts': `import './styles/main.scss';
|
|
175
280
|
|
|
176
281
|
console.log('Atomix Vanilla JavaScript App Initialized');`,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
// Your custom theme overrides here
|
|
180
|
-
);
|
|
181
|
-
@use '@shohojdhara/atomix/scss/components';
|
|
282
|
+
|
|
283
|
+
'src/styles/main.scss': `@use './index.scss';
|
|
182
284
|
|
|
183
285
|
#app {
|
|
184
286
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
@@ -190,9 +292,18 @@ header {
|
|
|
190
292
|
padding: 2rem;
|
|
191
293
|
border-bottom: 1px solid #dee2e6;
|
|
192
294
|
}`,
|
|
295
|
+
|
|
193
296
|
'vite.config.ts': `import { defineConfig } from 'vite';
|
|
297
|
+
import { resolve } from 'path';
|
|
194
298
|
|
|
195
299
|
export default defineConfig({
|
|
300
|
+
resolve: {
|
|
301
|
+
alias: {
|
|
302
|
+
'@': resolve(__dirname, './src'),
|
|
303
|
+
'@lib': resolve(__dirname, './src/lib'),
|
|
304
|
+
'@styles': resolve(__dirname, './src/styles'),
|
|
305
|
+
},
|
|
306
|
+
},
|
|
196
307
|
css: {
|
|
197
308
|
preprocessorOptions: {
|
|
198
309
|
scss: {
|
|
@@ -200,7 +311,24 @@ export default defineConfig({
|
|
|
200
311
|
}
|
|
201
312
|
}
|
|
202
313
|
}
|
|
203
|
-
})
|
|
314
|
+
});`,
|
|
315
|
+
|
|
316
|
+
// ITCSS Structure
|
|
317
|
+
'src/styles/index.scss': commonTemplates.itcss.main,
|
|
318
|
+
'src/styles/01-settings/_index.scss': commonTemplates.itcss.settings,
|
|
319
|
+
'src/styles/02-tools/_index.scss': commonTemplates.itcss.tools,
|
|
320
|
+
'src/styles/03-generic/_index.scss': commonTemplates.itcss.generic,
|
|
321
|
+
'src/styles/04-elements/_index.scss': commonTemplates.itcss.elements,
|
|
322
|
+
'src/styles/05-objects/_index.scss': commonTemplates.itcss.objects,
|
|
323
|
+
'src/styles/06-components/_index.scss': commonTemplates.itcss.components,
|
|
324
|
+
'src/styles/99-utilities/_index.scss': commonTemplates.itcss.utilities,
|
|
325
|
+
|
|
326
|
+
// Library Structure
|
|
327
|
+
'src/lib/types/index.ts': commonTemplates.lib.types,
|
|
328
|
+
'src/lib/utils/index.ts': commonTemplates.lib.utils,
|
|
329
|
+
|
|
330
|
+
// Placeholder files
|
|
331
|
+
'src/assets/.gitkeep': '',
|
|
204
332
|
}
|
|
205
333
|
};
|
|
206
334
|
|