beathers 5.2.2 → 5.3.0
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 +113 -0
- package/dist/css/beathers-icons.min.css +1 -1
- package/dist/css/beathers-icons.min.css.map +1 -1
- package/dist/css/beathers.min.css +2 -2
- package/dist/css/beathers.min.css.map +1 -1
- package/dist/data/colors.d.ts +9 -0
- package/dist/data/colors.js +54 -0
- package/dist/data/font.d.ts +3 -0
- package/dist/data/font.js +32 -0
- package/dist/data/index.d.ts +2 -0
- package/dist/data/index.js +2 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -1
- package/dist/scripts/cli.js +7 -220
- package/dist/scripts/commands/build.d.ts +1 -0
- package/dist/scripts/commands/build.js +128 -0
- package/dist/scripts/commands/colors.d.ts +4 -0
- package/dist/scripts/commands/colors.js +140 -0
- package/dist/scripts/commands/fonts.d.ts +3 -0
- package/dist/scripts/commands/fonts.js +124 -0
- package/dist/scripts/commands/help.d.ts +1 -0
- package/dist/scripts/commands/help.js +42 -0
- package/dist/scripts/commands/index.d.ts +13 -0
- package/dist/scripts/commands/index.js +95 -0
- package/dist/scripts/commands/init.d.ts +1 -0
- package/dist/scripts/commands/init.js +129 -0
- package/dist/scripts/commands/list.d.ts +2 -0
- package/dist/scripts/commands/list.js +29 -0
- package/dist/scripts/commands/version.d.ts +1 -0
- package/dist/scripts/commands/version.js +13 -0
- package/dist/scripts/{BuildScssVariables.d.ts → helpers/BuildScssVariables.d.ts} +1 -1
- package/dist/scripts/{BuildScssVariables.js → helpers/BuildScssVariables.js} +4 -4
- package/dist/scripts/{LoadUserConfigs.d.ts → helpers/LoadUserConfigs.d.ts} +1 -1
- package/dist/scripts/{Merge.d.ts → helpers/Merge.d.ts} +1 -1
- package/dist/scripts/{ReadDefaultValues.d.ts → helpers/ReadDefaultValues.d.ts} +1 -1
- package/dist/scripts/{ReadDefaultValues.js → helpers/ReadDefaultValues.js} +6 -2
- package/dist/scripts/helpers/index.d.ts +5 -0
- package/dist/scripts/helpers/index.js +5 -0
- package/dist/scripts/types.d.ts +41 -4
- package/dist/scripts/types.js +1 -0
- package/package.json +83 -80
- package/readme.md +28 -0
- package/src/scss/_variables.scss +1 -305
- package/src/scss/beathers-icons.min.scss +245 -245
- package/src/scss/beathers.min.scss +2 -4
- package/src/scss/functions/_colors.scss +79 -68
- package/src/scss/functions/_mediaQueries.scss +22 -12
- package/src/scss/functions/_others.scss +31 -22
- package/src/scss/functions/_typographic.scss +11 -2
- package/src/scss/functions/_validations.scss +38 -43
- package/src/scss/settings/_configs.scss +1 -72
- package/src/scss/settings/_defaults.scss +139 -212
- package/src/scss/style/_colors.scss +39 -23
- package/src/scss/style/_grid.scss +23 -25
- package/src/scss/style/_resets.scss +119 -0
- package/src/scss/style/_shaping.scss +142 -89
- package/src/scss/style/_typographic.scss +79 -36
- package/dist/scripts/BuildTheme.d.ts +0 -1
- package/dist/scripts/BuildTheme.js +0 -75
- package/src/scss/settings/_resets.scss +0 -103
- /package/dist/scripts/{CallNewVariables.d.ts → helpers/CallNewVariables.d.ts} +0 -0
- /package/dist/scripts/{CallNewVariables.js → helpers/CallNewVariables.js} +0 -0
- /package/dist/scripts/{LoadUserConfigs.js → helpers/LoadUserConfigs.js} +0 -0
- /package/dist/scripts/{Merge.js → helpers/Merge.js} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Theme } from '../scripts/types.js';
|
|
2
|
+
export declare const basicColors: Theme['colors'];
|
|
3
|
+
export declare const socialColors: Theme['colors'];
|
|
4
|
+
export declare const customColors: Theme['colors'];
|
|
5
|
+
export declare const colorsList: {
|
|
6
|
+
'Basic colors': import("../scripts/types.js").ColorType;
|
|
7
|
+
'Social colors': import("../scripts/types.js").ColorType;
|
|
8
|
+
'Custom colors': import("../scripts/types.js").ColorType;
|
|
9
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export const basicColors = {
|
|
2
|
+
black: { light: '#000000' },
|
|
3
|
+
white: { light: '#ffffff' },
|
|
4
|
+
gray: { light: '#808080' },
|
|
5
|
+
red: { light: '#ff0000' },
|
|
6
|
+
green: { light: '#00ff00' },
|
|
7
|
+
blue: { light: '#0000ff' },
|
|
8
|
+
yellow: { light: '#ffff00' },
|
|
9
|
+
orange: { light: '#ffa500' },
|
|
10
|
+
purple: { light: '#800080' },
|
|
11
|
+
teal: { light: '#008080' },
|
|
12
|
+
silver: { light: '#c0c0c0' },
|
|
13
|
+
gold: { light: '#ffd700' },
|
|
14
|
+
};
|
|
15
|
+
export const socialColors = {
|
|
16
|
+
facebook: { light: '#3b5998' },
|
|
17
|
+
messenger: { light: '#006aff' },
|
|
18
|
+
whatsapp: { light: '#25d366' },
|
|
19
|
+
instagram: { light: '#3f729b' },
|
|
20
|
+
google: { light: '#4285f4' },
|
|
21
|
+
signal: { light: '#2190e8' },
|
|
22
|
+
twitter: { light: '#00acee' },
|
|
23
|
+
telegram: { light: '#0088cc' },
|
|
24
|
+
youtube: { light: '#ff0000' },
|
|
25
|
+
linkedin: { light: '#0077b5' },
|
|
26
|
+
behance: { light: '#053eff' },
|
|
27
|
+
github: { light: '#171515' },
|
|
28
|
+
gitlab: { light: '#fca326' },
|
|
29
|
+
wechat: { light: '#09b83e' },
|
|
30
|
+
tiktok: { light: '#ff0050' },
|
|
31
|
+
snapchat: { light: '#fffc00' },
|
|
32
|
+
pinterest: { light: '#e60023' },
|
|
33
|
+
reddit: { light: '#ff4500' },
|
|
34
|
+
teams: { light: '#464eb8' },
|
|
35
|
+
twitch: { light: '#6441a5' },
|
|
36
|
+
dribbble: { light: '#ea4c89' },
|
|
37
|
+
};
|
|
38
|
+
export const customColors = {
|
|
39
|
+
'custom-1': { light: '#4289c7', dark: '#75b0e4' },
|
|
40
|
+
'custom-2': { light: '#39c2cb', dark: '#79e2e9' },
|
|
41
|
+
'custom-3': { light: '#36c07e', dark: '#86f3be' },
|
|
42
|
+
'custom-4': { light: '#a84fd1', dark: '#cd87ee' },
|
|
43
|
+
'custom-5': { light: '#df4f60', dark: '#df7884' },
|
|
44
|
+
'custom-6': { light: '#dec338', dark: '#e6d689' },
|
|
45
|
+
'custom-7': { light: '#ea6e2c', dark: '#e29f7b' },
|
|
46
|
+
'custom-8': { light: '#a66d38', dark: '#e3b387' },
|
|
47
|
+
'custom-9': { light: '#eb30a0', dark: '#e779bb' },
|
|
48
|
+
'custom-10': { light: '#1e24a5', dark: '#5d64ea' },
|
|
49
|
+
};
|
|
50
|
+
export const colorsList = {
|
|
51
|
+
'Basic colors': basicColors,
|
|
52
|
+
'Social colors': socialColors,
|
|
53
|
+
'Custom colors': customColors,
|
|
54
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const localFont = {
|
|
2
|
+
weights: ['light', 'regular', 'medium', 'bold'],
|
|
3
|
+
styles: ['normal'],
|
|
4
|
+
variants: {
|
|
5
|
+
en: {
|
|
6
|
+
title: 'roboto',
|
|
7
|
+
unicode: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',
|
|
8
|
+
},
|
|
9
|
+
ar: {
|
|
10
|
+
title: 'cairo',
|
|
11
|
+
unicode: 'U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
export const importedFont = {
|
|
16
|
+
weights: ['light', 'regular', 'medium', 'bold'],
|
|
17
|
+
styles: ['normal'],
|
|
18
|
+
variants: {
|
|
19
|
+
en: {
|
|
20
|
+
title: 'roboto',
|
|
21
|
+
isLocal: false,
|
|
22
|
+
url: 'https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap',
|
|
23
|
+
unicode: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',
|
|
24
|
+
},
|
|
25
|
+
ar: {
|
|
26
|
+
title: 'cairo',
|
|
27
|
+
isLocal: false,
|
|
28
|
+
url: 'https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;700&display=swap',
|
|
29
|
+
unicode: 'U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/scripts/cli.js
CHANGED
|
@@ -1,225 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from 'fs-extra';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import { BuildTheme } from './BuildTheme.js';
|
|
7
|
-
import { ReadDefaultValues } from './ReadDefaultValues.js';
|
|
8
|
-
const commands = {
|
|
9
|
-
build: { description: 'Build theme from configuration files', examples: ['beathers build'] },
|
|
10
|
-
init: { description: 'Initialize beathers configuration file', examples: ['beathers init'] },
|
|
11
|
-
version: { description: 'Show version information', examples: ['beathers -v', 'beathers --version'] },
|
|
12
|
-
help: { description: 'Show help information', examples: ['beathers --help'] },
|
|
13
|
-
};
|
|
14
|
-
function showHelp() {
|
|
15
|
-
console.log('\n🎨 Beathers CLI - Design System Builder\n');
|
|
16
|
-
const table = [
|
|
17
|
-
['Command', 'Description', 'Examples'],
|
|
18
|
-
['-------', '-----------', '--------'],
|
|
19
|
-
];
|
|
20
|
-
Object.entries(commands).forEach(([cmd, info]) => {
|
|
21
|
-
table.push([cmd, info.description, info.examples[0]]);
|
|
22
|
-
if (info.examples.length > 1) {
|
|
23
|
-
info.examples.slice(1).forEach((example) => {
|
|
24
|
-
table.push(['', '', example]);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const maxLengths = table[0].map((_, colIndex) => Math.max(...table.map((row) => row[colIndex].length)));
|
|
29
|
-
table.forEach((row) => {
|
|
30
|
-
const formattedRow = row.map((cell, colIndex) => cell.padEnd(maxLengths[colIndex])).join(' ');
|
|
31
|
-
console.log(formattedRow);
|
|
32
|
-
});
|
|
33
|
-
console.log('\nFlags:');
|
|
34
|
-
console.log(' --help Show this help message');
|
|
35
|
-
console.log(' -v, --version Show version information');
|
|
36
|
-
console.log();
|
|
37
|
-
}
|
|
38
|
-
function showVersion() {
|
|
39
|
-
const packagePath = path.join(process.cwd(), 'package.json');
|
|
40
|
-
try {
|
|
41
|
-
const packageInfo = fs.readJsonSync(packagePath);
|
|
42
|
-
console.log(`Beathers v${packageInfo.version}`);
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
console.log('Beathers CLI');
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async function getDefaultValues() {
|
|
49
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
50
|
-
const __dirname = path.dirname(__filename);
|
|
51
|
-
const projectRoot = path.resolve(__dirname, '..', '..');
|
|
52
|
-
return (await ReadDefaultValues([
|
|
53
|
-
path.join(projectRoot, 'src', 'scss', 'settings', '_defaults.scss'),
|
|
54
|
-
path.join(projectRoot, 'src', 'scss', 'settings', '_configs.scss'),
|
|
55
|
-
path.join(projectRoot, 'src', 'scss', 'settings', '_index.scss'),
|
|
56
|
-
], [
|
|
57
|
-
'colors',
|
|
58
|
-
'fonts',
|
|
59
|
-
'fontMainPath',
|
|
60
|
-
'fontFormat',
|
|
61
|
-
'fontWeights',
|
|
62
|
-
'fontStyles',
|
|
63
|
-
'textTruncate',
|
|
64
|
-
'defaultFontFamilies',
|
|
65
|
-
'fontSizes',
|
|
66
|
-
'axisDivisions',
|
|
67
|
-
'breakpoints',
|
|
68
|
-
'wrappers',
|
|
69
|
-
'opacities',
|
|
70
|
-
'blurValues',
|
|
71
|
-
'insetValues',
|
|
72
|
-
'guttersValues',
|
|
73
|
-
'bordersValue',
|
|
74
|
-
'radiuses',
|
|
75
|
-
'useMediaQueries',
|
|
76
|
-
'useIcons',
|
|
77
|
-
'useFontFamilies',
|
|
78
|
-
'useFontSizes',
|
|
79
|
-
'useFontShapes',
|
|
80
|
-
'useTextAligns',
|
|
81
|
-
'useTextTruncate',
|
|
82
|
-
'useColors',
|
|
83
|
-
'useColorsOpacities',
|
|
84
|
-
'useColorsLightMode',
|
|
85
|
-
'useColorsDarkMode',
|
|
86
|
-
'useCurrentColors',
|
|
87
|
-
'useRootColors',
|
|
88
|
-
'useGrid',
|
|
89
|
-
'useFlex',
|
|
90
|
-
'useTransitions',
|
|
91
|
-
'useWrappers',
|
|
92
|
-
'useShadows',
|
|
93
|
-
'useDisplays',
|
|
94
|
-
'useOverflows',
|
|
95
|
-
'useOpacities',
|
|
96
|
-
'useBlur',
|
|
97
|
-
'useObjectFits',
|
|
98
|
-
'usePositions',
|
|
99
|
-
'useInsets',
|
|
100
|
-
'useSizes',
|
|
101
|
-
'useGutters',
|
|
102
|
-
'useBorders',
|
|
103
|
-
'useTextBorders',
|
|
104
|
-
'useRadius',
|
|
105
|
-
]));
|
|
106
|
-
}
|
|
107
|
-
async function promptUser(question) {
|
|
108
|
-
const readline = await import('readline');
|
|
109
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
110
|
-
return new Promise((resolve) => {
|
|
111
|
-
rl.question(question, (answer) => {
|
|
112
|
-
rl.close();
|
|
113
|
-
resolve(answer.toLowerCase().startsWith('y'));
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
async function promptFormat() {
|
|
118
|
-
const readline = await import('readline');
|
|
119
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
120
|
-
return new Promise((resolve) => {
|
|
121
|
-
rl.question('📁 Choose file format (json/js/ts): json', (answer) => {
|
|
122
|
-
rl.close();
|
|
123
|
-
const format = answer.toLowerCase().trim();
|
|
124
|
-
if (format === 'js' || format === 'ts')
|
|
125
|
-
resolve(format);
|
|
126
|
-
else
|
|
127
|
-
resolve('json');
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
async function initCommand() {
|
|
132
|
-
const format = await promptFormat();
|
|
133
|
-
const formatMap = { json: 'beathers.configs.json', js: 'beathers.configs.js', ts: 'beathers.configs.ts' };
|
|
134
|
-
const fileName = formatMap[format];
|
|
135
|
-
const filePath = path.join(process.cwd(), fileName);
|
|
136
|
-
if (await fs.pathExists(filePath)) {
|
|
137
|
-
const shouldOverride = await promptUser(`⚠️ ${fileName} already exists. Do you want to override it? (Y/N): `);
|
|
138
|
-
if (!shouldOverride) {
|
|
139
|
-
console.log('❌ Operation aborted.');
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
const includeStarterValues = await promptUser('📝 Would you like to include starter configuration values? (Y/N): ');
|
|
144
|
-
const emptyTemplate = {
|
|
145
|
-
colors: {},
|
|
146
|
-
typography: {
|
|
147
|
-
defaultFontFamilies: [],
|
|
148
|
-
fontMainPath: '',
|
|
149
|
-
fontFormat: '',
|
|
150
|
-
fontWeights: [],
|
|
151
|
-
fontStyles: [],
|
|
152
|
-
fontSizes: {},
|
|
153
|
-
textTruncate: 0,
|
|
154
|
-
fonts: {},
|
|
155
|
-
},
|
|
156
|
-
settings: {
|
|
157
|
-
axisDivisions: 0,
|
|
158
|
-
opacities: [],
|
|
159
|
-
blurValues: [],
|
|
160
|
-
insetValues: [],
|
|
161
|
-
bordersValue: 0,
|
|
162
|
-
radiuses: [],
|
|
163
|
-
breakpoints: {},
|
|
164
|
-
wrappers: {},
|
|
165
|
-
guttersValues: {},
|
|
166
|
-
},
|
|
167
|
-
roles: {},
|
|
168
|
-
};
|
|
169
|
-
let content = '';
|
|
170
|
-
if (format === 'json') {
|
|
171
|
-
const data = includeStarterValues ? await getDefaultValues() : emptyTemplate;
|
|
172
|
-
content = JSON.stringify(data, null, 2);
|
|
173
|
-
}
|
|
174
|
-
else if (format === 'js') {
|
|
175
|
-
if (includeStarterValues) {
|
|
176
|
-
const defaultValues = await getDefaultValues();
|
|
177
|
-
content = `export default ${JSON.stringify(defaultValues, null, 2)}`;
|
|
178
|
-
}
|
|
179
|
-
else
|
|
180
|
-
content = `export default ${JSON.stringify(emptyTemplate, null, 2)}`;
|
|
181
|
-
}
|
|
182
|
-
else if (format === 'ts') {
|
|
183
|
-
const importLine = "import { Theme } from 'beathers'\n\n";
|
|
184
|
-
if (includeStarterValues) {
|
|
185
|
-
const defaultValues = await getDefaultValues();
|
|
186
|
-
content = `${importLine}export default ${JSON.stringify(defaultValues, null, 2)} satisfies Theme`;
|
|
187
|
-
}
|
|
188
|
-
else
|
|
189
|
-
content = `${importLine}export default ${JSON.stringify(emptyTemplate, null, 2)} satisfies Theme`;
|
|
190
|
-
}
|
|
191
|
-
await fs.writeFile(filePath, content);
|
|
192
|
-
const starterText = includeStarterValues ? ' with starter configuration values' : '';
|
|
193
|
-
console.log(`✅ Created ${fileName}${starterText}`);
|
|
194
|
-
}
|
|
195
|
-
async function buildCommand() {
|
|
196
|
-
try {
|
|
197
|
-
console.log('🎨 Building Beathers theme...');
|
|
198
|
-
await BuildTheme();
|
|
199
|
-
console.log('✅ Theme built successfully!');
|
|
200
|
-
}
|
|
201
|
-
catch (error) {
|
|
202
|
-
console.error('❌ Error building theme:', error);
|
|
203
|
-
process.exit(1);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
2
|
+
import { Commands } from '@commandsList';
|
|
206
3
|
async function main() {
|
|
207
4
|
const args = process.argv.slice(2);
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
await initCommand();
|
|
215
|
-
else if (command === '--help')
|
|
216
|
-
showHelp();
|
|
217
|
-
else if (['-v', '--version'].includes(command))
|
|
218
|
-
showVersion();
|
|
219
|
-
else {
|
|
220
|
-
console.error(`❌ Unknown command: ${command}`);
|
|
221
|
-
console.log('\nUse "beathers --help" to see available commands.');
|
|
222
|
-
process.exit(1);
|
|
223
|
-
}
|
|
5
|
+
let command = args[0] ?? 'build';
|
|
6
|
+
if (command.startsWith('--local'))
|
|
7
|
+
command = 'build';
|
|
8
|
+
const commands = Commands(args);
|
|
9
|
+
const action = commands[command] ?? commands.default;
|
|
10
|
+
await action();
|
|
224
11
|
}
|
|
225
12
|
main();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Build(): Promise<void>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { BuildScssVariables, DeepMerge, LoadUserConfigs, ReadDefaultValues } from '@helpers';
|
|
3
|
+
import { exec } from 'child_process';
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import { promisify } from 'util';
|
|
8
|
+
import { promptInput } from '@commands';
|
|
9
|
+
const execAsync = promisify(exec);
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = path.dirname(__filename);
|
|
12
|
+
const projectRoot = path.resolve(__dirname, '../..');
|
|
13
|
+
const variablesPath = path.join(projectRoot, 'scss', '_variables.scss');
|
|
14
|
+
async function defaultTheme() {
|
|
15
|
+
let values = null;
|
|
16
|
+
try {
|
|
17
|
+
values = await ReadDefaultValues([path.join(projectRoot, 'scss', 'settings', '_index.scss')], [
|
|
18
|
+
'useMediaQueries',
|
|
19
|
+
'useIcons',
|
|
20
|
+
'useFontFamilies',
|
|
21
|
+
'useFontSizes',
|
|
22
|
+
'useFontShapes',
|
|
23
|
+
'useTextAligns',
|
|
24
|
+
'useTextTruncate',
|
|
25
|
+
'useColors',
|
|
26
|
+
'useColorsOpacities',
|
|
27
|
+
'useColorsLightMode',
|
|
28
|
+
'useColorsDarkMode',
|
|
29
|
+
'useCurrentColors',
|
|
30
|
+
'useRootColors',
|
|
31
|
+
'useGrid',
|
|
32
|
+
'useFlex',
|
|
33
|
+
'useTransitions',
|
|
34
|
+
'useWrappers',
|
|
35
|
+
'useShadows',
|
|
36
|
+
'useDisplays',
|
|
37
|
+
'useOverflows',
|
|
38
|
+
'useOpacities',
|
|
39
|
+
'useBlur',
|
|
40
|
+
'useObjectFits',
|
|
41
|
+
'usePositions',
|
|
42
|
+
'useInsets',
|
|
43
|
+
'useSizes',
|
|
44
|
+
'useGutters',
|
|
45
|
+
'useBorders',
|
|
46
|
+
'useTextBorders',
|
|
47
|
+
'useRadius',
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error('❌ Failed to read default theme configuration:', error instanceof Error ? error.message : error);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
return values;
|
|
55
|
+
}
|
|
56
|
+
async function BuildTheme(customOutputPath) {
|
|
57
|
+
try {
|
|
58
|
+
console.log('📦 Loading theme configuration...');
|
|
59
|
+
const defaults = await defaultTheme();
|
|
60
|
+
const userConfigs = await LoadUserConfigs();
|
|
61
|
+
console.log('🔄 Building theme variables...');
|
|
62
|
+
const theme = DeepMerge(defaults, userConfigs);
|
|
63
|
+
const variablesString = BuildScssVariables(theme);
|
|
64
|
+
await fs.writeFile(variablesPath, variablesString, { flag: 'w' });
|
|
65
|
+
console.log(`✅ Theme variables generated: ${variablesPath}`);
|
|
66
|
+
console.log('');
|
|
67
|
+
console.log('🔨 Compiling SCSS to CSS...');
|
|
68
|
+
let buildCommand = 'npm run build';
|
|
69
|
+
if (customOutputPath) {
|
|
70
|
+
const userProjectRoot = process.cwd();
|
|
71
|
+
const outputPath = path.join(userProjectRoot, customOutputPath);
|
|
72
|
+
await fs.ensureDir(outputPath);
|
|
73
|
+
buildCommand = `sass --style compressed --source-map --embed-sources --no-error-css src/scss/:${outputPath}/`;
|
|
74
|
+
console.log(`📁 Output directory: ${outputPath}`);
|
|
75
|
+
}
|
|
76
|
+
const { stdout } = await execAsync(buildCommand);
|
|
77
|
+
console.log('✅ Theme compilation completed successfully!');
|
|
78
|
+
if (stdout)
|
|
79
|
+
console.log('📋 Build details:', stdout.trim());
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error('❌ Failed to build theme:', error);
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export async function Build() {
|
|
87
|
+
try {
|
|
88
|
+
console.log('🎨 Building \x1b[36mBeathers\x1b[0m theme...');
|
|
89
|
+
// Check if --local flag is provided
|
|
90
|
+
const args = process.argv.slice(2);
|
|
91
|
+
const hasLocalFlag = args.includes('--local');
|
|
92
|
+
let customOutputPath;
|
|
93
|
+
if (hasLocalFlag) {
|
|
94
|
+
console.log('🏠 Local build mode enabled');
|
|
95
|
+
customOutputPath = await promptInput('📁 Output path (e.g., public/css): ');
|
|
96
|
+
if (!customOutputPath) {
|
|
97
|
+
console.error('❌ Please provide an output path when using \x1b[33m--local\x1b[0m flag.');
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
await BuildTheme(customOutputPath);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
console.error('❌ Failed to build theme:', error);
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
109
|
+
const args = process.argv.slice(2);
|
|
110
|
+
if (args.includes('--local')) {
|
|
111
|
+
console.log('🏠 Local build mode enabled');
|
|
112
|
+
const { promptInput } = await import('@commands');
|
|
113
|
+
const customOutputPath = await promptInput('📁 Output path (e.g., public/css): ');
|
|
114
|
+
if (!customOutputPath) {
|
|
115
|
+
console.error('❌ Please provide an output path when using \x1b[33m--local\x1b[0m flag.');
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
BuildTheme(customOutputPath).catch((error) => {
|
|
119
|
+
console.error('❌ Build failed:', error);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
else
|
|
124
|
+
BuildTheme().catch((error) => {
|
|
125
|
+
console.error('❌ Build failed:', error);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { findConfigFile, loadConfig, promptInput, promptSelection, saveConfig } from '@commands';
|
|
3
|
+
import { colorsList } from '@data';
|
|
4
|
+
export async function AddColors() {
|
|
5
|
+
const configFile = await findConfigFile();
|
|
6
|
+
if (!configFile) {
|
|
7
|
+
console.error('❌ Config file not found. Please run \x1b[36mbeathers init\x1b[0m to set up your project.');
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
try {
|
|
11
|
+
const config = await loadConfig(configFile);
|
|
12
|
+
config.colors ??= {};
|
|
13
|
+
while (true) {
|
|
14
|
+
const colorName = await promptInput('🎨 Color name (type "finish" to complete): ');
|
|
15
|
+
if (!colorName || colorName.toLowerCase() === 'finish')
|
|
16
|
+
break;
|
|
17
|
+
const lightColor = await promptInput('☀️ Light mode color (hex format, e.g., #ffffff): ');
|
|
18
|
+
const darkColor = await promptInput('🌙 Dark mode color (hex format, e.g., #000000): ');
|
|
19
|
+
if (!lightColor && !darkColor) {
|
|
20
|
+
console.error('❌ Please provide at least one color (light or dark mode).');
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const hexPattern = /^#[0-9A-Fa-f]{6}$/;
|
|
24
|
+
if (lightColor && !hexPattern.test(lightColor)) {
|
|
25
|
+
console.error('❌ Invalid light color format. Please use hex format (e.g., #ffffff)');
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (darkColor && !hexPattern.test(darkColor)) {
|
|
29
|
+
console.error('❌ Invalid dark color format. Please use hex format (e.g., #000000)');
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
config.colors[colorName] = {
|
|
33
|
+
...(lightColor && { light: lightColor }),
|
|
34
|
+
...(darkColor && { dark: darkColor }),
|
|
35
|
+
};
|
|
36
|
+
console.log(`✅ Color "${colorName}" added successfully.`);
|
|
37
|
+
}
|
|
38
|
+
console.log('💾 Saving configuration...');
|
|
39
|
+
await saveConfig(configFile, config);
|
|
40
|
+
console.log('✅ All colors saved to your configuration!');
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error('❌ Failed to add colors:', error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export async function RemoveColor() {
|
|
47
|
+
const configFile = await findConfigFile();
|
|
48
|
+
if (!configFile) {
|
|
49
|
+
console.error('❌ Config file not found. Please run \x1b[36mbeathers init\x1b[0m to set up your project.');
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
const config = await loadConfig(configFile);
|
|
54
|
+
if (!config.colors || Object.keys(config.colors).length === 0) {
|
|
55
|
+
console.error('❌ No colors found in your configuration.');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const colorName = await promptInput('🗑️ Color name to remove: ');
|
|
59
|
+
if (!colorName) {
|
|
60
|
+
console.error('❌ Please provide a color name.');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (!config.colors[colorName]) {
|
|
64
|
+
console.error(`❌ Color "${colorName}" not found in your configuration.`);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
delete config.colors[colorName];
|
|
68
|
+
console.log('💾 Updating configuration...');
|
|
69
|
+
await saveConfig(configFile, config);
|
|
70
|
+
console.log(`✅ Color "${colorName}" removed successfully!`);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
console.error('❌ Failed to remove color:', error);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export async function ImportColorPack() {
|
|
77
|
+
const configFile = await findConfigFile();
|
|
78
|
+
if (!configFile) {
|
|
79
|
+
console.error('❌ Config file not found. Please run \x1b[36mbeathers init\x1b[0m to set up your project.');
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const packName = await promptSelection('📦 Choose a color pack to import:', Object.keys(colorsList));
|
|
84
|
+
const selectedPack = colorsList[packName];
|
|
85
|
+
console.log('💾 Importing color pack...');
|
|
86
|
+
const config = await loadConfig(configFile);
|
|
87
|
+
config.colors ??= {};
|
|
88
|
+
Object.assign(config.colors, selectedPack);
|
|
89
|
+
await saveConfig(configFile, config);
|
|
90
|
+
console.log(`✅ Color pack "${packName}" imported successfully!`);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
console.error('❌ Failed to import color pack:', error);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export async function ImportColor() {
|
|
97
|
+
const configFile = await findConfigFile();
|
|
98
|
+
if (!configFile) {
|
|
99
|
+
console.error('❌ Config file not found. Please run \x1b[36mbeathers init\x1b[0m to set up your project.');
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
const packName = await promptSelection('📦 Choose a color pack:', Object.keys(colorsList));
|
|
104
|
+
if (!packName) {
|
|
105
|
+
console.error('❌ Please select a color pack.');
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const colorName = await promptSelection('🎨 Choose a color to import:', Object.keys(colorsList[packName]));
|
|
109
|
+
if (!colorName) {
|
|
110
|
+
console.error('❌ Please select a color.');
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
let foundColor = null;
|
|
114
|
+
let foundInPack = '';
|
|
115
|
+
for (const [packName, pack] of Object.entries(colorsList)) {
|
|
116
|
+
if (pack[colorName]) {
|
|
117
|
+
foundColor = pack[colorName];
|
|
118
|
+
foundInPack = packName;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (!foundColor) {
|
|
123
|
+
console.error(`❌ Color "${colorName}" not found in any color pack.`);
|
|
124
|
+
console.log('📋 Available colors:');
|
|
125
|
+
Object.entries(colorsList).forEach(([packName, pack]) => {
|
|
126
|
+
console.log(` • ${packName}: ${Object.keys(pack).join(', ')}`);
|
|
127
|
+
});
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
console.log('💾 Importing color...');
|
|
131
|
+
const config = await loadConfig(configFile);
|
|
132
|
+
config.colors ??= {};
|
|
133
|
+
config.colors[colorName] = foundColor;
|
|
134
|
+
await saveConfig(configFile, config);
|
|
135
|
+
console.log(`✅ Color "${colorName}" from "${foundInPack}" imported successfully!`);
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
console.error('❌ Failed to import color:', error);
|
|
139
|
+
}
|
|
140
|
+
}
|