@shohojdhara/atomix 0.3.5 ā 0.3.7
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/README.md +101 -199
- package/atomix.config.ts +241 -0
- package/dist/atomix.css +260 -179
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +250 -179
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.js +69 -166
- package/dist/charts.js.map +1 -1
- package/dist/core.js +184 -263
- package/dist/core.js.map +1 -1
- package/dist/forms.js +55 -131
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js +184 -263
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +1831 -1657
- package/dist/index.esm.js +4497 -4318
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4510 -4328
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/theme.d.ts +1431 -1472
- package/dist/theme.js +4175 -4138
- package/dist/theme.js.map +1 -1
- package/package.json +6 -20
- package/src/components/Accordion/Accordion.stories.tsx +50 -17
- package/src/components/AtomixGlass/AtomixGlass.tsx +128 -322
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +12 -5
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -32
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/shared-components.tsx +0 -31
- package/src/components/Avatar/Avatar.stories.tsx +7 -0
- package/src/components/Badge/Badge.stories.tsx +91 -13
- package/src/components/Block/Block.stories.tsx +7 -23
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +7 -0
- package/src/components/Button/Button.stories.tsx +141 -22
- package/src/components/Button/Button.tsx +85 -167
- package/src/components/Button/ButtonGroup.stories.tsx +315 -0
- package/src/components/Button/ButtonGroup.tsx +67 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Callout/Callout.stories.tsx +8 -6
- package/src/components/Card/Card.stories.tsx +82 -28
- package/src/components/Chart/AnimatedChart.tsx +0 -1
- package/src/components/Chart/AreaChart.tsx +0 -1
- package/src/components/Chart/BarChart.tsx +0 -1
- package/src/components/Chart/BubbleChart.tsx +0 -1
- package/src/components/Chart/CandlestickChart.tsx +0 -1
- package/src/components/Chart/Chart.stories.tsx +5 -7
- package/src/components/Chart/Chart.tsx +0 -16
- package/src/components/Chart/ChartRenderer.tsx +1 -1
- package/src/components/Chart/DonutChart.tsx +0 -1
- package/src/components/Chart/FunnelChart.tsx +0 -1
- package/src/components/Chart/GaugeChart.tsx +0 -1
- package/src/components/Chart/HeatmapChart.tsx +0 -1
- package/src/components/Chart/LineChart.tsx +0 -1
- package/src/components/Chart/MultiAxisChart.tsx +0 -1
- package/src/components/Chart/PieChart.tsx +0 -1
- package/src/components/Chart/RadarChart.tsx +0 -1
- package/src/components/Chart/ScatterChart.tsx +0 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -1
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +7 -0
- package/src/components/DataTable/DataTable.stories.tsx +23 -16
- package/src/components/DatePicker/DatePicker.stories.tsx +27 -19
- package/src/components/Dropdown/Dropdown.stories.tsx +11 -19
- package/src/components/EdgePanel/EdgePanel.stories.tsx +1 -0
- package/src/components/Footer/Footer.stories.tsx +8 -6
- package/src/components/Footer/FooterLink.tsx +9 -2
- package/src/components/Form/Checkbox.stories.tsx +7 -0
- package/src/components/Form/Form.stories.tsx +7 -0
- package/src/components/Form/FormGroup.stories.tsx +9 -1
- package/src/components/Form/Input.stories.tsx +69 -16
- package/src/components/Form/Radio.stories.tsx +9 -1
- package/src/components/Form/Select.stories.tsx +9 -1
- package/src/components/Form/Textarea.stories.tsx +10 -2
- package/src/components/Hero/Hero.stories.tsx +7 -0
- package/src/components/List/List.stories.tsx +7 -0
- package/src/components/Messages/Messages.stories.tsx +8 -7
- package/src/components/Modal/Modal.stories.tsx +17 -6
- package/src/components/Navigation/Menu/Menu.stories.tsx +7 -0
- package/src/components/Navigation/Nav/Nav.stories.tsx +7 -0
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +1 -0
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +188 -111
- package/src/components/Pagination/Pagination.tsx +83 -3
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -5
- package/src/components/Popover/Popover.stories.tsx +191 -115
- package/src/components/ProductReview/ProductReview.stories.tsx +80 -58
- package/src/components/Progress/Progress.stories.tsx +79 -49
- package/src/components/Rating/Rating.stories.tsx +109 -84
- package/src/components/River/River.stories.tsx +194 -114
- package/src/components/SectionIntro/SectionIntro.stories.tsx +19 -9
- package/src/components/Slider/Slider.stories.tsx +7 -0
- package/src/components/Spinner/Spinner.stories.tsx +15 -11
- package/src/components/Steps/Steps.stories.tsx +132 -98
- package/src/components/Tabs/Tabs.stories.tsx +163 -112
- package/src/components/Testimonial/Testimonial.stories.tsx +114 -68
- package/src/components/Todo/Todo.stories.tsx +38 -12
- package/src/components/Toggle/Toggle.stories.tsx +61 -28
- package/src/components/Tooltip/Tooltip.stories.tsx +318 -200
- package/src/components/Upload/Upload.stories.tsx +122 -84
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +7 -24
- package/src/components/index.ts +1 -0
- package/src/lib/composables/useAtomixGlass.ts +9 -10
- package/src/lib/composables/useNavbar.ts +0 -10
- package/src/lib/config/loader.ts +4 -4
- package/src/lib/constants/components.ts +17 -0
- package/src/lib/hooks/useComponentCustomization.ts +1 -1
- package/src/lib/hooks/usePerformanceMonitor.ts +1 -1
- package/src/lib/hooks/useThemeTokens.ts +105 -0
- package/src/lib/theme/README.md +174 -0
- package/src/lib/theme/adapters/index.ts +31 -0
- package/src/lib/theme/adapters/themeAdapter.ts +287 -0
- package/src/lib/theme/config/__tests__/configLoader.test.ts +207 -0
- package/src/lib/theme/config/configLoader.ts +95 -0
- package/src/lib/theme/config/loader.ts +37 -54
- package/src/lib/theme/config/types.ts +2 -2
- package/src/lib/theme/config/validator.ts +15 -91
- package/src/lib/theme/{constants.ts ā constants/constants.ts} +1 -19
- package/src/lib/theme/constants/index.ts +8 -0
- package/src/lib/theme/core/ThemeRegistry.ts +75 -266
- package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
- package/src/lib/theme/core/composeTheme.ts +105 -0
- package/src/lib/theme/core/createTheme.ts +108 -0
- package/src/lib/theme/{createTheme.ts ā core/createThemeObject.ts} +12 -8
- package/src/lib/theme/core/index.ts +19 -19
- package/src/lib/theme/devtools/Comparator.tsx +346 -22
- package/src/lib/theme/devtools/IMPROVEMENTS.md +139 -38
- package/src/lib/theme/devtools/Inspector.tsx +335 -51
- package/src/lib/theme/devtools/LiveEditor.tsx +478 -107
- package/src/lib/theme/devtools/Preview.tsx +471 -221
- package/src/lib/theme/{core ā devtools}/ThemeValidator.ts +1 -1
- package/src/lib/theme/devtools/index.ts +14 -4
- package/src/lib/theme/devtools/useHistory.ts +130 -0
- package/src/lib/theme/{errors.ts ā errors/errors.ts} +1 -1
- package/src/lib/theme/errors/index.ts +12 -0
- package/src/lib/theme/generators/cssFile.ts +79 -0
- package/src/lib/theme/generators/generateCSS.ts +89 -0
- package/src/lib/theme/generators/generateCSSNested.ts +130 -0
- package/src/lib/theme/{generateCSSVariables.ts ā generators/generateCSSVariables.ts} +3 -13
- package/src/lib/theme/generators/index.ts +25 -0
- package/src/lib/theme/i18n/rtl.ts +5 -6
- package/src/lib/theme/index.ts +149 -19
- package/src/lib/theme/runtime/ThemeApplicator.ts +53 -112
- package/src/lib/theme/{ThemeContext.tsx ā runtime/ThemeContext.tsx} +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +5 -5
- package/src/lib/theme/runtime/ThemeProvider.tsx +266 -282
- package/src/lib/theme/runtime/index.ts +2 -2
- package/src/lib/theme/runtime/useTheme.ts +1 -2
- package/src/lib/theme/runtime/useThemeTokens.ts +131 -0
- package/src/lib/theme/test/testTheme.ts +385 -0
- package/src/lib/theme/tokens/index.ts +12 -0
- package/src/lib/theme/tokens/tokens.ts +721 -0
- package/src/lib/theme/types.ts +6 -42
- package/src/lib/theme/utils/componentTheming.ts +132 -0
- package/src/lib/theme/{utils.ts ā utils/domUtils.ts} +2 -2
- package/src/lib/theme/utils/index.ts +11 -0
- package/src/lib/theme/utils/injectCSS.ts +90 -0
- package/src/lib/theme/utils/naming.ts +100 -0
- package/src/lib/theme/utils/themeHelpers.ts +78 -0
- package/src/lib/theme/{themeUtils.ts ā utils/themeUtils.ts} +7 -7
- package/src/lib/theme-tools.ts +7 -8
- package/src/lib/types/components.ts +40 -130
- package/src/lib/utils/componentUtils.ts +2 -2
- package/src/lib/utils/memoryMonitor.ts +3 -3
- package/src/lib/utils/themeNaming.ts +135 -0
- package/src/styles/01-settings/_settings.design-tokens.scss +4 -1
- package/src/styles/02-tools/_tools.button.scss +66 -79
- package/src/styles/06-components/_components.atomix-glass.scss +13 -3
- package/src/styles/06-components/_components.pagination.scss +88 -0
- package/scripts/sync-theme-config.js +0 -309
- package/src/lib/theme/composeTheme.ts +0 -370
- package/src/lib/theme/core/ThemeCache.ts +0 -283
- package/src/lib/theme/core/ThemeEngine.test.ts +0 -146
- package/src/lib/theme/core/ThemeEngine.ts +0 -665
- package/src/lib/theme/createThemeFromConfig.ts +0 -132
- package/src/lib/theme/devtools/CLI.ts +0 -364
- package/src/lib/theme/runtime/ThemeManager.test.ts +0 -192
- package/src/lib/theme/runtime/ThemeManager.ts +0 -446
- package/src/styles/03-generic/_generated-root.css +0 -26
- package/src/themes/README.md +0 -442
- package/src/themes/themes.config.js +0 -68
- /package/src/lib/theme/{cssVariableMapper.ts ā adapters/cssVariableMapper.ts} +0 -0
|
@@ -153,4 +153,92 @@
|
|
|
153
153
|
&__icon-skip-forward::before {
|
|
154
154
|
content: 'ā';
|
|
155
155
|
}
|
|
156
|
+
|
|
157
|
+
// Search functionality
|
|
158
|
+
&__search {
|
|
159
|
+
margin-top: 1rem;
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
align-items: center;
|
|
163
|
+
gap: 0.5rem;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&__search-wrapper {
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
gap: 0.5rem;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&__search-label {
|
|
173
|
+
display: flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
gap: 0.5rem;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&__search-label-text {
|
|
179
|
+
font-size: var(--#{config.$prefix}pagination-font-size);
|
|
180
|
+
color: var(--#{config.$prefix}pagination-color);
|
|
181
|
+
white-space: nowrap;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
&__search-input {
|
|
185
|
+
width: 80px;
|
|
186
|
+
padding: var(--#{config.$prefix}pagination-padding-y)
|
|
187
|
+
var(--#{config.$prefix}pagination-padding-x);
|
|
188
|
+
font-size: var(--#{config.$prefix}pagination-font-size);
|
|
189
|
+
text-align: center;
|
|
190
|
+
border: 1px solid var(--#{config.$prefix}pagination-color);
|
|
191
|
+
border-radius: var(--#{config.$prefix}pagination-border-radius);
|
|
192
|
+
@include dynamic-background(var(--#{config.$prefix}pagination-bg));
|
|
193
|
+
color: var(--#{config.$prefix}pagination-color);
|
|
194
|
+
transition: all 0.2s ease-in-out;
|
|
195
|
+
|
|
196
|
+
&:focus {
|
|
197
|
+
outline: none;
|
|
198
|
+
border-color: var(--#{config.$prefix}pagination-focus-border-color);
|
|
199
|
+
border-width: var(--#{config.$prefix}pagination-focus-border-width);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&.is-error {
|
|
203
|
+
border-color: var(--#{config.$prefix}error-color, #dc3545);
|
|
204
|
+
background-color: var(--#{config.$prefix}error-bg-subtle, rgba(220, 53, 69, 0.1));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&__search-button {
|
|
209
|
+
display: flex;
|
|
210
|
+
align-items: center;
|
|
211
|
+
justify-content: center;
|
|
212
|
+
@include size.square(var(--#{config.$prefix}pagination-size));
|
|
213
|
+
padding: var(--#{config.$prefix}pagination-padding-y)
|
|
214
|
+
var(--#{config.$prefix}pagination-padding-x);
|
|
215
|
+
@include dynamic-background(var(--#{config.$prefix}pagination-bg));
|
|
216
|
+
border: 1px solid var(--#{config.$prefix}pagination-color);
|
|
217
|
+
border-radius: var(--#{config.$prefix}pagination-border-radius);
|
|
218
|
+
color: var(--#{config.$prefix}pagination-color);
|
|
219
|
+
cursor: pointer;
|
|
220
|
+
transition: all 0.2s ease-in-out;
|
|
221
|
+
|
|
222
|
+
&:hover {
|
|
223
|
+
--#{config.$prefix}pagination-color: var(--#{config.$prefix}pagination-hover-color);
|
|
224
|
+
--#{config.$prefix}pagination-bg: var(--#{config.$prefix}pagination-hover-bg);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
&:focus-visible {
|
|
228
|
+
outline: none;
|
|
229
|
+
border-color: var(--#{config.$prefix}pagination-focus-border-color);
|
|
230
|
+
border-width: var(--#{config.$prefix}pagination-focus-border-width);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.c-icon {
|
|
234
|
+
color: inherit;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
&__search-error {
|
|
239
|
+
font-size: 0.75rem;
|
|
240
|
+
color: var(--#{config.$prefix}error-color, #dc3545);
|
|
241
|
+
text-align: center;
|
|
242
|
+
margin-top: 0.25rem;
|
|
243
|
+
}
|
|
156
244
|
}
|
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sync Theme Configuration
|
|
5
|
-
*
|
|
6
|
-
* This script generates src/themes/themes.config.js from theme.config.ts
|
|
7
|
-
* to maintain a single source of truth for theme configuration.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { readFile, writeFile } from 'fs/promises';
|
|
11
|
-
import { join, dirname } from 'path';
|
|
12
|
-
import { fileURLToPath } from 'url';
|
|
13
|
-
|
|
14
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
-
const __dirname = dirname(__filename);
|
|
16
|
-
|
|
17
|
-
// File paths
|
|
18
|
-
const THEME_CONFIG_TS = join(__dirname, '../theme.config.ts');
|
|
19
|
-
const THEMES_CONFIG_JS = join(__dirname, '../src/themes/themes.config.js');
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Parse theme.config.ts to extract configuration
|
|
23
|
-
* Note: This is a simplified parser that works with the current structure
|
|
24
|
-
*/
|
|
25
|
-
async function parseThemeConfigTS() {
|
|
26
|
-
try {
|
|
27
|
-
const content = await readFile(THEME_CONFIG_TS, 'utf8');
|
|
28
|
-
|
|
29
|
-
// Extract themes object
|
|
30
|
-
const themesMatch = content.match(/themes:\s*{([^}]+(?:{[^}]*}[^}]*)*[^}]+)}/s);
|
|
31
|
-
if (!themesMatch) {
|
|
32
|
-
throw new Error('Could not find themes configuration');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Extract individual theme configurations
|
|
36
|
-
const themes = {};
|
|
37
|
-
const themeRegex = /['"]([^'"]+)['"]\s*:\s*{([^}]+(?:{[^}]*}[^}]*)*[^}]+)}/gs;
|
|
38
|
-
let match;
|
|
39
|
-
|
|
40
|
-
while ((match = themeRegex.exec(themesMatch[1])) !== null) {
|
|
41
|
-
const [, themeName, themeConfig] = match;
|
|
42
|
-
|
|
43
|
-
// Parse theme properties
|
|
44
|
-
const theme = {
|
|
45
|
-
name: extractValue(themeConfig, 'name'),
|
|
46
|
-
description: extractValue(themeConfig, 'description'),
|
|
47
|
-
author: extractValue(themeConfig, 'author'),
|
|
48
|
-
version: extractValue(themeConfig, 'version'),
|
|
49
|
-
tags: extractArray(themeConfig, 'tags'),
|
|
50
|
-
supportsDarkMode: extractBoolean(themeConfig, 'supportsDarkMode'),
|
|
51
|
-
status: extractValue(themeConfig, 'status'),
|
|
52
|
-
color: extractValue(themeConfig, 'color'),
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// Parse features if present
|
|
56
|
-
const featuresMatch = themeConfig.match(/features:\s*\[([^\]]*)\]/s);
|
|
57
|
-
if (featuresMatch) {
|
|
58
|
-
theme.features = featuresMatch[1]
|
|
59
|
-
.split(',')
|
|
60
|
-
.map(f => f.trim().replace(/['"]/g, ''))
|
|
61
|
-
.filter(f => f.length > 0);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Parse a11y if present
|
|
65
|
-
const a11yMatch = themeConfig.match(/a11y:\s*{([^}]*)}/);
|
|
66
|
-
if (a11yMatch) {
|
|
67
|
-
theme.a11y = {
|
|
68
|
-
contrastTarget: extractNumber(a11yMatch[1], 'contrastTarget'),
|
|
69
|
-
modes: extractArray(a11yMatch[1], 'modes'),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
themes[themeName] = theme;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Extract build configuration
|
|
77
|
-
const buildMatch = content.match(/build:\s*(defaultBuildConfig|{[^}]+})/);
|
|
78
|
-
const build = buildMatch && buildMatch[1] === 'defaultBuildConfig'
|
|
79
|
-
? getDefaultBuildConfig()
|
|
80
|
-
: parseBuildConfig(buildMatch?.[1]);
|
|
81
|
-
|
|
82
|
-
// Extract runtime configuration
|
|
83
|
-
const runtimeMatch = content.match(/runtime:\s*(defaultRuntimeConfig|{[^}]+})/);
|
|
84
|
-
const runtime = runtimeMatch && runtimeMatch[1] === 'defaultRuntimeConfig'
|
|
85
|
-
? getDefaultRuntimeConfig()
|
|
86
|
-
: parseRuntimeConfig(runtimeMatch?.[1]);
|
|
87
|
-
|
|
88
|
-
// Extract integration configuration
|
|
89
|
-
const integrationMatch = content.match(/integration:\s*(defaultIntegrationConfig|{[^}]+})/);
|
|
90
|
-
const integration = integrationMatch && integrationMatch[1] === 'defaultIntegrationConfig'
|
|
91
|
-
? getDefaultIntegrationConfig()
|
|
92
|
-
: parseIntegrationConfig(integrationMatch?.[1]);
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
themes,
|
|
96
|
-
build,
|
|
97
|
-
runtime,
|
|
98
|
-
integration,
|
|
99
|
-
dependencies: {},
|
|
100
|
-
};
|
|
101
|
-
} catch (error) {
|
|
102
|
-
console.error('ā Failed to parse theme.config.ts:', error.message);
|
|
103
|
-
throw error;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Helper function to extract string values
|
|
109
|
-
*/
|
|
110
|
-
function extractValue(text, key) {
|
|
111
|
-
const regex = new RegExp(`${key}:\\s*['"]([^'"]+)['"]`);
|
|
112
|
-
const match = text.match(regex);
|
|
113
|
-
return match ? match[1] : undefined;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Helper function to extract number values
|
|
118
|
-
*/
|
|
119
|
-
function extractNumber(text, key) {
|
|
120
|
-
const regex = new RegExp(`${key}:\\s*(\\d+(?:\\.\\d+)?)`);
|
|
121
|
-
const match = text.match(regex);
|
|
122
|
-
return match ? parseFloat(match[1]) : undefined;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Helper function to extract boolean values
|
|
127
|
-
*/
|
|
128
|
-
function extractBoolean(text, key) {
|
|
129
|
-
const regex = new RegExp(`${key}:\\s*(true|false)`);
|
|
130
|
-
const match = text.match(regex);
|
|
131
|
-
return match ? match[1] === 'true' : undefined;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Helper function to extract array values
|
|
136
|
-
*/
|
|
137
|
-
function extractArray(text, key) {
|
|
138
|
-
const regex = new RegExp(`${key}:\\s*\\[([^\\]]*)\\]`);
|
|
139
|
-
const match = text.match(regex);
|
|
140
|
-
if (!match) return undefined;
|
|
141
|
-
|
|
142
|
-
return match[1]
|
|
143
|
-
.split(',')
|
|
144
|
-
.map(item => item.trim().replace(/['"]/g, ''))
|
|
145
|
-
.filter(item => item.length > 0);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Get default build configuration
|
|
150
|
-
*/
|
|
151
|
-
function getDefaultBuildConfig() {
|
|
152
|
-
return {
|
|
153
|
-
output: {
|
|
154
|
-
directory: 'themes',
|
|
155
|
-
formats: {
|
|
156
|
-
expanded: '.css',
|
|
157
|
-
compressed: '.min.css',
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
sass: {
|
|
161
|
-
style: 'expanded',
|
|
162
|
-
sourceMap: true,
|
|
163
|
-
loadPaths: ['src'],
|
|
164
|
-
},
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Get default runtime configuration
|
|
170
|
-
*/
|
|
171
|
-
function getDefaultRuntimeConfig() {
|
|
172
|
-
return {
|
|
173
|
-
basePath: '/themes',
|
|
174
|
-
cdnPath: null,
|
|
175
|
-
preload: [],
|
|
176
|
-
lazy: true,
|
|
177
|
-
defaultTheme: '',
|
|
178
|
-
storageKey: 'atomix-theme',
|
|
179
|
-
useMinified: "process.env.NODE_ENV === 'production'",
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Get default integration configuration
|
|
185
|
-
*/
|
|
186
|
-
function getDefaultIntegrationConfig() {
|
|
187
|
-
return {
|
|
188
|
-
cssVariables: {
|
|
189
|
-
colorMode: '--storybook-color-mode',
|
|
190
|
-
},
|
|
191
|
-
classNames: {
|
|
192
|
-
theme: 'data-theme',
|
|
193
|
-
colorMode: 'data-atomix-color-mode',
|
|
194
|
-
},
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Parse build configuration
|
|
200
|
-
*/
|
|
201
|
-
function parseBuildConfig(configText) {
|
|
202
|
-
if (!configText) return getDefaultBuildConfig();
|
|
203
|
-
// For now, return default config
|
|
204
|
-
// A more sophisticated parser would be needed for complex objects
|
|
205
|
-
return getDefaultBuildConfig();
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Parse runtime configuration
|
|
210
|
-
*/
|
|
211
|
-
function parseRuntimeConfig(configText) {
|
|
212
|
-
if (!configText) return getDefaultRuntimeConfig();
|
|
213
|
-
// For now, return default config
|
|
214
|
-
// A more sophisticated parser would be needed for complex objects
|
|
215
|
-
return getDefaultRuntimeConfig();
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Parse integration configuration
|
|
220
|
-
*/
|
|
221
|
-
function parseIntegrationConfig(configText) {
|
|
222
|
-
if (!configText) return getDefaultIntegrationConfig();
|
|
223
|
-
// For now, return default config
|
|
224
|
-
// A more sophisticated parser would be needed for complex objects
|
|
225
|
-
return getDefaultIntegrationConfig();
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Generate themes.config.js content
|
|
230
|
-
*/
|
|
231
|
-
function generateThemesConfigJS(config) {
|
|
232
|
-
const { themes, build, runtime, integration, dependencies } = config;
|
|
233
|
-
|
|
234
|
-
// Convert themes to metadata format
|
|
235
|
-
const metadata = {};
|
|
236
|
-
for (const [key, theme] of Object.entries(themes)) {
|
|
237
|
-
metadata[key] = { ...theme };
|
|
238
|
-
// Remove undefined values
|
|
239
|
-
Object.keys(metadata[key]).forEach(k => {
|
|
240
|
-
if (metadata[key][k] === undefined) {
|
|
241
|
-
delete metadata[key][k];
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return `/**
|
|
247
|
-
* Theme Configuration
|
|
248
|
-
*
|
|
249
|
-
* This file is auto-generated from theme.config.ts
|
|
250
|
-
* DO NOT EDIT MANUALLY - Edit theme.config.ts instead
|
|
251
|
-
*
|
|
252
|
-
* Generated on: ${new Date().toISOString()}
|
|
253
|
-
*/
|
|
254
|
-
|
|
255
|
-
export const themesConfig = {
|
|
256
|
-
// Theme metadata
|
|
257
|
-
metadata: ${JSON.stringify(metadata, null, 4).replace(/"([^"]+)":/g, '$1:')},
|
|
258
|
-
|
|
259
|
-
// Build configuration
|
|
260
|
-
build: ${JSON.stringify(build, null, 4).replace(/"([^"]+)":/g, '$1:')},
|
|
261
|
-
|
|
262
|
-
// Export configuration for package.json
|
|
263
|
-
exports: {
|
|
264
|
-
'./themes/*': './dist/themes/*.css',
|
|
265
|
-
'./themes/*.min': './dist/themes/*.min.css',
|
|
266
|
-
},
|
|
267
|
-
|
|
268
|
-
// Theme integration settings
|
|
269
|
-
integration: ${JSON.stringify(integration, null, 4).replace(/"([^"]+)":/g, '$1:')},
|
|
270
|
-
|
|
271
|
-
// Runtime theme loading configuration
|
|
272
|
-
runtime: ${JSON.stringify(runtime, null, 4).replace(/"([^"]+)":/g, '$1:').replace(/"process\.env\.NODE_ENV === 'production'"/g, "process.env.NODE_ENV === 'production'")},
|
|
273
|
-
|
|
274
|
-
// Theme dependencies (if a theme requires another theme to be loaded)
|
|
275
|
-
dependencies: ${JSON.stringify(dependencies, null, 4).replace(/"([^"]+)":/g, '$1:')},
|
|
276
|
-
};`;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Main function
|
|
281
|
-
*/
|
|
282
|
-
async function main() {
|
|
283
|
-
console.log('š Syncing theme configuration...\n');
|
|
284
|
-
|
|
285
|
-
try {
|
|
286
|
-
// Parse theme.config.ts
|
|
287
|
-
console.log('š Reading theme.config.ts...');
|
|
288
|
-
const config = await parseThemeConfigTS();
|
|
289
|
-
console.log(` ā
Found ${Object.keys(config.themes).length} themes`);
|
|
290
|
-
|
|
291
|
-
// Generate themes.config.js
|
|
292
|
-
console.log('\nš Generating themes.config.js...');
|
|
293
|
-
const jsContent = generateThemesConfigJS(config);
|
|
294
|
-
|
|
295
|
-
// Write to file
|
|
296
|
-
await writeFile(THEMES_CONFIG_JS, jsContent, 'utf8');
|
|
297
|
-
console.log(' ā
Written to src/themes/themes.config.js');
|
|
298
|
-
|
|
299
|
-
console.log('\n⨠Configuration sync complete!');
|
|
300
|
-
console.log(' themes.config.js has been updated from theme.config.ts');
|
|
301
|
-
|
|
302
|
-
} catch (error) {
|
|
303
|
-
console.error('\nš„ Sync failed:', error.message);
|
|
304
|
-
process.exit(1);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// Run the sync
|
|
309
|
-
main();
|