galaxy-design 0.2.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/README.md +320 -0
- package/dist/bin.js +11 -0
- package/dist/bin.js.map +1 -0
- package/dist/commands/add.js +252 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/init-old.js +159 -0
- package/dist/commands/init-old.js.map +1 -0
- package/dist/commands/init.js +266 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cli.js +5 -0
- package/dist/lib/cli.js.map +1 -0
- package/dist/registries/blocks-angular.json +89 -0
- package/dist/registries/blocks-flutter.json +60 -0
- package/dist/registries/blocks-react-native.json +60 -0
- package/dist/registries/blocks-react.json +89 -0
- package/dist/registries/blocks-vue.json +89 -0
- package/dist/registries/registry-angular.json +557 -0
- package/dist/registries/registry-flutter.json +491 -0
- package/dist/registries/registry-flutter.json.old +258 -0
- package/dist/registries/registry-react-native.json +491 -0
- package/dist/registries/registry-react-native.json.old +379 -0
- package/dist/registries/registry-react.json +526 -0
- package/dist/registries/registry-vue.json +586 -0
- package/dist/registry.json +460 -0
- package/dist/schemas/components-schema.json +91 -0
- package/dist/templates/tailwind.config.template +45 -0
- package/dist/templates/utils.ts.template +11 -0
- package/dist/utils/component-copier.js +207 -0
- package/dist/utils/component-copier.js.map +1 -0
- package/dist/utils/components-config.js +58 -0
- package/dist/utils/components-config.js.map +1 -0
- package/dist/utils/config-schema.js +221 -0
- package/dist/utils/config-schema.js.map +1 -0
- package/dist/utils/config.js +88 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/detect.js +86 -0
- package/dist/utils/detect.js.map +1 -0
- package/dist/utils/files.js +52 -0
- package/dist/utils/files.js.map +1 -0
- package/dist/utils/framework-registry.js +133 -0
- package/dist/utils/framework-registry.js.map +1 -0
- package/dist/utils/github-fetcher.js +120 -0
- package/dist/utils/github-fetcher.js.map +1 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/package-manager.js +173 -0
- package/dist/utils/package-manager.js.map +1 -0
- package/dist/utils/platform-detector.js +176 -0
- package/dist/utils/platform-detector.js.map +1 -0
- package/dist/utils/registry-loader.js +143 -0
- package/dist/utils/registry-loader.js.map +1 -0
- package/dist/utils/registry.js +92 -0
- package/dist/utils/registry.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import prompts from 'prompts';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
import { execa } from 'execa';
|
|
6
|
+
import { resolve, dirname } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
import { readFileSync } from 'fs';
|
|
9
|
+
import { detectFramework, detectPackageManager, isTailwindInstalled } from '../utils/detect.js';
|
|
10
|
+
import { createConfig, configExists, getDefaultConfig } from '../utils/config.js';
|
|
11
|
+
import { writeFile, ensureDir, fileExists } from '../utils/files.js';
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = dirname(__filename);
|
|
14
|
+
export async function initCommand(options) {
|
|
15
|
+
console.log(chalk.bold.cyan('\nš Galaxy UI CLI\n'));
|
|
16
|
+
const cwd = options.cwd;
|
|
17
|
+
// Check if already initialized
|
|
18
|
+
if (await configExists(cwd)) {
|
|
19
|
+
console.log(chalk.yellow('ā Galaxy UI is already initialized in this project.'));
|
|
20
|
+
const { overwrite } = await prompts({
|
|
21
|
+
type: 'confirm',
|
|
22
|
+
name: 'overwrite',
|
|
23
|
+
message: 'Do you want to overwrite the existing configuration?',
|
|
24
|
+
initial: false
|
|
25
|
+
});
|
|
26
|
+
if (!overwrite) {
|
|
27
|
+
console.log(chalk.gray('Initialization cancelled.'));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Detect framework
|
|
32
|
+
const detectedFramework = detectFramework(cwd);
|
|
33
|
+
if (detectedFramework === 'unknown') {
|
|
34
|
+
console.log(chalk.red('ā Could not detect framework. Please ensure you are in a valid Angular, React, or Vue project.'));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (detectedFramework !== 'angular') {
|
|
38
|
+
console.log(chalk.yellow(`ā Detected ${detectedFramework} framework, but Galaxy UI currently only supports Angular.`));
|
|
39
|
+
console.log(chalk.gray('Support for React and Vue is coming soon!'));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
console.log(chalk.green(`ā Detected ${chalk.bold(detectedFramework)} framework`));
|
|
43
|
+
// Detect package manager
|
|
44
|
+
const packageManager = detectPackageManager(cwd);
|
|
45
|
+
console.log(chalk.green(`ā Using ${chalk.bold(packageManager)} package manager`));
|
|
46
|
+
// Get configuration from user
|
|
47
|
+
let config = getDefaultConfig(detectedFramework);
|
|
48
|
+
if (!options.yes) {
|
|
49
|
+
const responses = await prompts([
|
|
50
|
+
{
|
|
51
|
+
type: 'text',
|
|
52
|
+
name: 'componentsPath',
|
|
53
|
+
message: 'Where would you like to place your components?',
|
|
54
|
+
initial: config.componentsPath
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: 'text',
|
|
58
|
+
name: 'utilsPath',
|
|
59
|
+
message: 'Where would you like to place your utils file?',
|
|
60
|
+
initial: config.utilsPath
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'confirm',
|
|
64
|
+
name: 'configureTailwind',
|
|
65
|
+
message: 'Would you like to configure Tailwind CSS?',
|
|
66
|
+
initial: !isTailwindInstalled(cwd)
|
|
67
|
+
}
|
|
68
|
+
]);
|
|
69
|
+
if (!responses.componentsPath) {
|
|
70
|
+
console.log(chalk.gray('Initialization cancelled.'));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
config = _extends({}, config, {
|
|
74
|
+
componentsPath: responses.componentsPath,
|
|
75
|
+
utilsPath: responses.utilsPath
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
console.log('\n');
|
|
79
|
+
// Install dependencies
|
|
80
|
+
const spinner = ora('Installing dependencies...').start();
|
|
81
|
+
const dependencies = [
|
|
82
|
+
'lucide-angular@^0.548.0',
|
|
83
|
+
'clsx@^2.1.1',
|
|
84
|
+
'tailwind-merge@^3.3.1'
|
|
85
|
+
];
|
|
86
|
+
if (!isTailwindInstalled(cwd)) {
|
|
87
|
+
dependencies.push('tailwindcss@^3.4.0', 'autoprefixer@^10.4.0', 'postcss@^8.4.0');
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const installCommand = packageManager === 'npm' ? 'npm install' : packageManager === 'bun' ? 'bun add' : `${packageManager} add`;
|
|
91
|
+
await execa(installCommand, dependencies, {
|
|
92
|
+
cwd,
|
|
93
|
+
shell: true
|
|
94
|
+
});
|
|
95
|
+
spinner.succeed('Dependencies installed');
|
|
96
|
+
} catch (error) {
|
|
97
|
+
spinner.fail('Failed to install dependencies');
|
|
98
|
+
console.error(chalk.red(error));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
// Create directories
|
|
102
|
+
const dirSpinner = ora('Creating directories...').start();
|
|
103
|
+
try {
|
|
104
|
+
const componentsDir = resolve(cwd, config.componentsPath);
|
|
105
|
+
const utilsDir = dirname(resolve(cwd, config.utilsPath));
|
|
106
|
+
ensureDir(componentsDir);
|
|
107
|
+
ensureDir(utilsDir);
|
|
108
|
+
dirSpinner.succeed('Directories created');
|
|
109
|
+
} catch (error) {
|
|
110
|
+
dirSpinner.fail('Failed to create directories');
|
|
111
|
+
console.error(chalk.red(error));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
// Create utils file
|
|
115
|
+
const utilsSpinner = ora('Creating utils file...').start();
|
|
116
|
+
try {
|
|
117
|
+
const utilsPath = resolve(cwd, config.utilsPath);
|
|
118
|
+
const templatePath = resolve(__dirname, '../templates/utils.ts.template');
|
|
119
|
+
const template = readFileSync(templatePath, 'utf-8');
|
|
120
|
+
writeFile(utilsPath, template);
|
|
121
|
+
utilsSpinner.succeed('Utils file created');
|
|
122
|
+
} catch (error) {
|
|
123
|
+
utilsSpinner.fail('Failed to create utils file');
|
|
124
|
+
console.error(chalk.red(error));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
// Configure Tailwind
|
|
128
|
+
if (!isTailwindInstalled(cwd) || !fileExists(resolve(cwd, 'tailwind.config.js'))) {
|
|
129
|
+
const tailwindSpinner = ora('Configuring Tailwind CSS...').start();
|
|
130
|
+
try {
|
|
131
|
+
const tailwindConfigPath = resolve(cwd, 'tailwind.config.js');
|
|
132
|
+
const templatePath = resolve(__dirname, '../templates/tailwind.config.template');
|
|
133
|
+
const template = readFileSync(templatePath, 'utf-8');
|
|
134
|
+
writeFile(tailwindConfigPath, template);
|
|
135
|
+
tailwindSpinner.succeed('Tailwind CSS configured');
|
|
136
|
+
} catch (error) {
|
|
137
|
+
tailwindSpinner.fail('Failed to configure Tailwind CSS');
|
|
138
|
+
console.error(chalk.red(error));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// Save configuration
|
|
142
|
+
const configSpinner = ora('Saving configuration...').start();
|
|
143
|
+
try {
|
|
144
|
+
await createConfig(cwd, config);
|
|
145
|
+
configSpinner.succeed('Configuration saved');
|
|
146
|
+
} catch (error) {
|
|
147
|
+
configSpinner.fail('Failed to save configuration');
|
|
148
|
+
console.error(chalk.red(error));
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
// Success message
|
|
152
|
+
console.log('\n' + chalk.green.bold('ā Galaxy UI initialized successfully!\n'));
|
|
153
|
+
console.log(chalk.gray('Next steps:'));
|
|
154
|
+
console.log(chalk.gray(' 1. Run') + chalk.cyan(' galaxy add <component>') + chalk.gray(' to add components'));
|
|
155
|
+
console.log(chalk.gray(' 2. Import components in your Angular modules'));
|
|
156
|
+
console.log(chalk.gray(' 3. Start building amazing UIs! š\n'));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
//# sourceMappingURL=init-old.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/init-old.ts"],"sourcesContent":["import prompts from 'prompts';\nimport chalk from 'chalk';\nimport ora from 'ora';\nimport { execa } from 'execa';\nimport { resolve, dirname } from 'path';\nimport { fileURLToPath } from 'url';\nimport { readFileSync } from 'fs';\nimport {\n detectFramework,\n detectPackageManager,\n isGalaxyInitialized,\n isTailwindInstalled,\n} from '../utils/detect.js';\nimport {\n loadConfig,\n createConfig,\n configExists,\n getDefaultConfig,\n} from '../utils/config.js';\nimport { writeFile, ensureDir, fileExists } from '../utils/files.js';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\ninterface InitOptions {\n yes?: boolean;\n cwd: string;\n}\n\nexport async function initCommand(options: InitOptions) {\n console.log(chalk.bold.cyan('\\nš Galaxy UI CLI\\n'));\n\n const cwd = options.cwd;\n\n // Check if already initialized\n if (await configExists(cwd)) {\n console.log(chalk.yellow('ā Galaxy UI is already initialized in this project.'));\n const { overwrite } = await prompts({\n type: 'confirm',\n name: 'overwrite',\n message: 'Do you want to overwrite the existing configuration?',\n initial: false,\n });\n\n if (!overwrite) {\n console.log(chalk.gray('Initialization cancelled.'));\n return;\n }\n }\n\n // Detect framework\n const detectedFramework = detectFramework(cwd);\n\n if (detectedFramework === 'unknown') {\n console.log(\n chalk.red(\n 'ā Could not detect framework. Please ensure you are in a valid Angular, React, or Vue project.'\n )\n );\n return;\n }\n\n if (detectedFramework !== 'angular') {\n console.log(\n chalk.yellow(\n `ā Detected ${detectedFramework} framework, but Galaxy UI currently only supports Angular.`\n )\n );\n console.log(chalk.gray('Support for React and Vue is coming soon!'));\n return;\n }\n\n console.log(chalk.green(`ā Detected ${chalk.bold(detectedFramework)} framework`));\n\n // Detect package manager\n const packageManager = detectPackageManager(cwd);\n console.log(chalk.green(`ā Using ${chalk.bold(packageManager)} package manager`));\n\n // Get configuration from user\n let config = getDefaultConfig(detectedFramework);\n\n if (!options.yes) {\n const responses = await prompts([\n {\n type: 'text',\n name: 'componentsPath',\n message: 'Where would you like to place your components?',\n initial: config.componentsPath,\n },\n {\n type: 'text',\n name: 'utilsPath',\n message: 'Where would you like to place your utils file?',\n initial: config.utilsPath,\n },\n {\n type: 'confirm',\n name: 'configureTailwind',\n message: 'Would you like to configure Tailwind CSS?',\n initial: !isTailwindInstalled(cwd),\n },\n ]);\n\n if (!responses.componentsPath) {\n console.log(chalk.gray('Initialization cancelled.'));\n return;\n }\n\n config = {\n ...config,\n componentsPath: responses.componentsPath,\n utilsPath: responses.utilsPath,\n };\n }\n\n console.log('\\n');\n\n // Install dependencies\n const spinner = ora('Installing dependencies...').start();\n\n const dependencies = ['lucide-angular@^0.548.0', 'clsx@^2.1.1', 'tailwind-merge@^3.3.1'];\n\n if (!isTailwindInstalled(cwd)) {\n dependencies.push('tailwindcss@^3.4.0', 'autoprefixer@^10.4.0', 'postcss@^8.4.0');\n }\n\n try {\n const installCommand =\n packageManager === 'npm'\n ? 'npm install'\n : packageManager === 'bun'\n ? 'bun add'\n : `${packageManager} add`;\n\n await execa(installCommand, dependencies, {\n cwd,\n shell: true,\n });\n\n spinner.succeed('Dependencies installed');\n } catch (error) {\n spinner.fail('Failed to install dependencies');\n console.error(chalk.red(error));\n return;\n }\n\n // Create directories\n const dirSpinner = ora('Creating directories...').start();\n\n try {\n const componentsDir = resolve(cwd, config.componentsPath);\n const utilsDir = dirname(resolve(cwd, config.utilsPath));\n\n ensureDir(componentsDir);\n ensureDir(utilsDir);\n\n dirSpinner.succeed('Directories created');\n } catch (error) {\n dirSpinner.fail('Failed to create directories');\n console.error(chalk.red(error));\n return;\n }\n\n // Create utils file\n const utilsSpinner = ora('Creating utils file...').start();\n\n try {\n const utilsPath = resolve(cwd, config.utilsPath);\n const templatePath = resolve(__dirname, '../templates/utils.ts.template');\n const template = readFileSync(templatePath, 'utf-8');\n\n writeFile(utilsPath, template);\n\n utilsSpinner.succeed('Utils file created');\n } catch (error) {\n utilsSpinner.fail('Failed to create utils file');\n console.error(chalk.red(error));\n return;\n }\n\n // Configure Tailwind\n if (!isTailwindInstalled(cwd) || !fileExists(resolve(cwd, 'tailwind.config.js'))) {\n const tailwindSpinner = ora('Configuring Tailwind CSS...').start();\n\n try {\n const tailwindConfigPath = resolve(cwd, 'tailwind.config.js');\n const templatePath = resolve(__dirname, '../templates/tailwind.config.template');\n const template = readFileSync(templatePath, 'utf-8');\n\n writeFile(tailwindConfigPath, template);\n\n tailwindSpinner.succeed('Tailwind CSS configured');\n } catch (error) {\n tailwindSpinner.fail('Failed to configure Tailwind CSS');\n console.error(chalk.red(error));\n }\n }\n\n // Save configuration\n const configSpinner = ora('Saving configuration...').start();\n\n try {\n await createConfig(cwd, config);\n configSpinner.succeed('Configuration saved');\n } catch (error) {\n configSpinner.fail('Failed to save configuration');\n console.error(chalk.red(error));\n return;\n }\n\n // Success message\n console.log('\\n' + chalk.green.bold('ā Galaxy UI initialized successfully!\\n'));\n\n console.log(chalk.gray('Next steps:'));\n console.log(chalk.gray(' 1. Run') + chalk.cyan(' galaxy add <component>') + chalk.gray(' to add components'));\n console.log(chalk.gray(' 2. Import components in your Angular modules'));\n console.log(chalk.gray(' 3. Start building amazing UIs! š\\n'));\n}\n"],"names":["prompts","chalk","ora","execa","resolve","dirname","fileURLToPath","readFileSync","detectFramework","detectPackageManager","isTailwindInstalled","createConfig","configExists","getDefaultConfig","writeFile","ensureDir","fileExists","__filename","url","__dirname","initCommand","options","console","log","bold","cyan","cwd","yellow","overwrite","type","name","message","initial","gray","detectedFramework","red","green","packageManager","config","yes","responses","componentsPath","utilsPath","spinner","start","dependencies","push","installCommand","shell","succeed","error","fail","dirSpinner","componentsDir","utilsDir","utilsSpinner","templatePath","template","tailwindSpinner","tailwindConfigPath","configSpinner"],"mappings":";AAAA,OAAOA,aAAa,UAAU;AAC9B,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,S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KAAK;IAE1D,IAAI;QACF,MAAMjC,aAAae,KAAKY;QACxBsB,cAAcX,OAAO,CAAC;IACxB,EAAE,OAAOC,OAAO;QACdU,cAAcT,IAAI,CAAC;QACnB7B,QAAQ4B,KAAK,CAACjD,MAAMkC,GAAG,CAACe;QACxB;IACF;IAEA,kBAAkB;IAClB5B,QAAQC,GAAG,CAAC,OAAOtB,MAAMmC,KAAK,CAACZ,IAAI,CAAC;IAEpCF,QAAQC,GAAG,CAACtB,MAAMgC,IAAI,CAAC;IACvBX,QAAQC,GAAG,CAACtB,MAAMgC,IAAI,CAAC,cAAchC,MAAMwB,IAAI,CAAC,6BAA6BxB,MAAMgC,IAAI,CAAC;IACxFX,QAAQC,GAAG,CAACtB,MAAMgC,IAAI,CAAC;IACvBX,QAAQC,GAAG,CAACtB,MAAMgC,IAAI,CAAC;AACzB"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import prompts from 'prompts';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
import { detectFramework, detectPackageManager } from '../utils/detect.js';
|
|
6
|
+
import { createComponentsConfig, hasComponentsConfig } from '../utils/components-config.js';
|
|
7
|
+
import { getDefaultConfig } from '../utils/config-schema.js';
|
|
8
|
+
import { writeFile, ensureDir } from '../utils/files.js';
|
|
9
|
+
import { installDependencies } from '../utils/package-manager.js';
|
|
10
|
+
import { resolve } from 'path';
|
|
11
|
+
export async function initCommand(options) {
|
|
12
|
+
console.log(chalk.bold.cyan('\nš Galaxy UI CLI - Multi-Framework Edition\n'));
|
|
13
|
+
const cwd = options.cwd;
|
|
14
|
+
// Check if already initialized
|
|
15
|
+
if (hasComponentsConfig(cwd)) {
|
|
16
|
+
console.log(chalk.yellow('ā components.json already exists in this project.'));
|
|
17
|
+
const { overwrite } = await prompts({
|
|
18
|
+
type: 'confirm',
|
|
19
|
+
name: 'overwrite',
|
|
20
|
+
message: 'Do you want to overwrite the existing configuration?',
|
|
21
|
+
initial: false
|
|
22
|
+
});
|
|
23
|
+
if (!overwrite) {
|
|
24
|
+
console.log(chalk.gray('Initialization cancelled.'));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Detect framework
|
|
29
|
+
const detectedFramework = detectFramework(cwd);
|
|
30
|
+
if (detectedFramework === 'unknown') {
|
|
31
|
+
console.log(chalk.red('ā Could not detect framework. Please ensure you are in a valid Angular, React, Vue, React Native, or Flutter project.'));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
console.log(chalk.green(`ā Detected ${chalk.bold(detectedFramework)} framework`));
|
|
35
|
+
// Map detected framework to Framework type
|
|
36
|
+
const frameworkMap = {
|
|
37
|
+
angular: 'angular',
|
|
38
|
+
react: 'react',
|
|
39
|
+
vue: 'vue',
|
|
40
|
+
'react-native': 'react-native',
|
|
41
|
+
flutter: 'flutter',
|
|
42
|
+
unknown: null
|
|
43
|
+
};
|
|
44
|
+
const framework = frameworkMap[detectedFramework];
|
|
45
|
+
if (!framework) {
|
|
46
|
+
console.log(chalk.red('ā Unsupported framework detected.'));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// Detect package manager
|
|
50
|
+
const packageManager = detectPackageManager(cwd);
|
|
51
|
+
console.log(chalk.green(`ā Using ${chalk.bold(packageManager)} package manager`));
|
|
52
|
+
// Get configuration from user (or use defaults with --yes)
|
|
53
|
+
let config = getDefaultConfig(framework);
|
|
54
|
+
if (!options.yes) {
|
|
55
|
+
console.log(chalk.cyan('\nš Configuration\n'));
|
|
56
|
+
// Build prompts based on framework
|
|
57
|
+
const promptQuestions = [];
|
|
58
|
+
// TypeScript prompt (not for Flutter)
|
|
59
|
+
if (framework !== 'flutter') {
|
|
60
|
+
promptQuestions.push({
|
|
61
|
+
type: 'toggle',
|
|
62
|
+
name: 'typescript',
|
|
63
|
+
message: 'Would you like to use TypeScript?',
|
|
64
|
+
initial: true,
|
|
65
|
+
active: 'yes',
|
|
66
|
+
inactive: 'no'
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
// Base color prompt (for all frameworks)
|
|
70
|
+
promptQuestions.push({
|
|
71
|
+
type: 'select',
|
|
72
|
+
name: 'baseColor',
|
|
73
|
+
message: 'Which base color would you like to use?',
|
|
74
|
+
choices: [
|
|
75
|
+
{
|
|
76
|
+
title: 'Slate',
|
|
77
|
+
value: 'slate'
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
title: 'Gray',
|
|
81
|
+
value: 'gray'
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
title: 'Zinc',
|
|
85
|
+
value: 'zinc'
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
title: 'Neutral',
|
|
89
|
+
value: 'neutral'
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
title: 'Stone',
|
|
93
|
+
value: 'stone'
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
initial: 0
|
|
97
|
+
});
|
|
98
|
+
// Icon library prompt (not for Flutter - uses built-in icons)
|
|
99
|
+
if (framework !== 'flutter') {
|
|
100
|
+
promptQuestions.push({
|
|
101
|
+
type: 'select',
|
|
102
|
+
name: 'iconLibrary',
|
|
103
|
+
message: 'Which icon library would you like to use?',
|
|
104
|
+
choices: [
|
|
105
|
+
{
|
|
106
|
+
title: 'Lucide (Recommended)',
|
|
107
|
+
value: 'lucide'
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
title: 'Heroicons',
|
|
111
|
+
value: 'heroicons'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
title: 'Radix Icons',
|
|
115
|
+
value: 'radix-icons'
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
initial: 0
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
// CSS file prompt (only for web frameworks and React Native)
|
|
122
|
+
if (framework !== 'flutter' && config.tailwind.css) {
|
|
123
|
+
promptQuestions.push({
|
|
124
|
+
type: 'text',
|
|
125
|
+
name: 'cssFile',
|
|
126
|
+
message: framework === 'react-native' ? 'Where is your global CSS file (for NativeWind)?' : 'Where is your global CSS file?',
|
|
127
|
+
initial: config.tailwind.css
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const answers = await prompts(promptQuestions);
|
|
131
|
+
if (Object.keys(answers).length === 0) {
|
|
132
|
+
console.log(chalk.gray('Initialization cancelled.'));
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
var _answers_typescript, _answers_iconLibrary, _answers_baseColor, _answers_cssFile;
|
|
136
|
+
// Update config with user choices
|
|
137
|
+
config = _extends({}, config, {
|
|
138
|
+
typescript: (_answers_typescript = answers.typescript) != null ? _answers_typescript : config.typescript,
|
|
139
|
+
iconLibrary: (_answers_iconLibrary = answers.iconLibrary) != null ? _answers_iconLibrary : config.iconLibrary,
|
|
140
|
+
tailwind: _extends({}, config.tailwind, {
|
|
141
|
+
baseColor: (_answers_baseColor = answers.baseColor) != null ? _answers_baseColor : config.tailwind.baseColor,
|
|
142
|
+
css: (_answers_cssFile = answers.cssFile) != null ? _answers_cssFile : config.tailwind.css
|
|
143
|
+
})
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
console.log(chalk.cyan('\nš¦ Installing dependencies...\n'));
|
|
147
|
+
// Install dependencies
|
|
148
|
+
const spinner = ora('Installing dependencies...').start();
|
|
149
|
+
const dependencies = [];
|
|
150
|
+
const devDependencies = [];
|
|
151
|
+
// Common dependencies
|
|
152
|
+
dependencies.push('clsx', 'tailwind-merge');
|
|
153
|
+
// Framework-specific dependencies
|
|
154
|
+
switch(framework){
|
|
155
|
+
case 'vue':
|
|
156
|
+
dependencies.push('radix-vue');
|
|
157
|
+
devDependencies.push('tailwindcss', 'autoprefixer', 'postcss');
|
|
158
|
+
if (config.iconLibrary === 'lucide') {
|
|
159
|
+
dependencies.push('lucide-vue-next');
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
case 'react':
|
|
163
|
+
dependencies.push('@radix-ui/react-slot');
|
|
164
|
+
devDependencies.push('tailwindcss', 'autoprefixer', 'postcss');
|
|
165
|
+
if (config.iconLibrary === 'lucide') {
|
|
166
|
+
dependencies.push('lucide-react');
|
|
167
|
+
}
|
|
168
|
+
if (config.typescript) {
|
|
169
|
+
devDependencies.push('@types/react', '@types/react-dom');
|
|
170
|
+
}
|
|
171
|
+
break;
|
|
172
|
+
case 'angular':
|
|
173
|
+
// Angular components use Radix NG primitives
|
|
174
|
+
dependencies.push('@radix-ng/primitives');
|
|
175
|
+
if (config.iconLibrary === 'lucide') {
|
|
176
|
+
dependencies.push('lucide-angular');
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
try {
|
|
181
|
+
// Install dependencies
|
|
182
|
+
if (dependencies.length > 0) {
|
|
183
|
+
await installDependencies(dependencies, {
|
|
184
|
+
cwd,
|
|
185
|
+
silent: true
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
// Install devDependencies
|
|
189
|
+
if (devDependencies.length > 0) {
|
|
190
|
+
await installDependencies(devDependencies, {
|
|
191
|
+
cwd,
|
|
192
|
+
dev: true,
|
|
193
|
+
silent: true
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
spinner.succeed('Dependencies installed');
|
|
197
|
+
} catch (error) {
|
|
198
|
+
spinner.fail('Failed to install dependencies');
|
|
199
|
+
console.error(chalk.red(error));
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
// Create directories
|
|
203
|
+
const dirSpinner = ora('Creating directories...').start();
|
|
204
|
+
try {
|
|
205
|
+
const componentsPath = resolve(cwd, config.aliases.components.replace('@/', ''));
|
|
206
|
+
const utilsPath = resolve(cwd, config.aliases.utils.replace('@/', ''));
|
|
207
|
+
await ensureDir(componentsPath);
|
|
208
|
+
await ensureDir(resolve(componentsPath, 'ui'));
|
|
209
|
+
await ensureDir(utilsPath.replace('/utils', '')); // Create lib dir
|
|
210
|
+
dirSpinner.succeed('Directories created');
|
|
211
|
+
} catch (error) {
|
|
212
|
+
dirSpinner.fail('Failed to create directories');
|
|
213
|
+
console.error(chalk.red(error));
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
// Create utils file
|
|
217
|
+
const utilsSpinner = ora('Creating utility functions...').start();
|
|
218
|
+
try {
|
|
219
|
+
const utilsPath = resolve(cwd, config.aliases.utils.replace('@/', '') + '.ts');
|
|
220
|
+
const utilsContent = getUtilsContent();
|
|
221
|
+
writeFile(utilsPath, utilsContent);
|
|
222
|
+
utilsSpinner.succeed('Utility functions created');
|
|
223
|
+
} catch (error) {
|
|
224
|
+
utilsSpinner.fail('Failed to create utility functions');
|
|
225
|
+
console.error(chalk.red(error));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
// Save components.json
|
|
229
|
+
const configSpinner = ora('Creating components.json...').start();
|
|
230
|
+
try {
|
|
231
|
+
createComponentsConfig(cwd, framework);
|
|
232
|
+
configSpinner.succeed('components.json created');
|
|
233
|
+
} catch (error) {
|
|
234
|
+
configSpinner.fail('Failed to create components.json');
|
|
235
|
+
console.error(chalk.red(error));
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
// Success message
|
|
239
|
+
console.log(chalk.green('\n⨠Success! Galaxy UI has been initialized.\n'));
|
|
240
|
+
console.log(chalk.cyan('Next steps:\n'));
|
|
241
|
+
console.log(chalk.white(` 1. Configure Tailwind CSS in ${config.tailwind.config}`));
|
|
242
|
+
console.log(chalk.white(` 2. Import utilities in ${config.tailwind.css}`));
|
|
243
|
+
console.log(chalk.white(` 3. Add components:`));
|
|
244
|
+
console.log(chalk.gray(` galaxy-ui add button`));
|
|
245
|
+
console.log(chalk.gray(` galaxy-ui add input card`));
|
|
246
|
+
console.log(chalk.gray(` galaxy-ui add --all\n`));
|
|
247
|
+
console.log(chalk.cyan('Learn more:'));
|
|
248
|
+
console.log(chalk.white(' Documentation: https://galaxy-design.vercel.app'));
|
|
249
|
+
console.log(chalk.white(' GitHub: https://github.com/buikevin/galaxy-design-cli\n'));
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Get utils.ts content
|
|
253
|
+
*/ function getUtilsContent() {
|
|
254
|
+
return `import { clsx, type ClassValue } from 'clsx';
|
|
255
|
+
import { twMerge } from 'tailwind-merge';
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Merge Tailwind CSS classes
|
|
259
|
+
*/
|
|
260
|
+
export function cn(...inputs: ClassValue[]) {
|
|
261
|
+
return twMerge(clsx(inputs));
|
|
262
|
+
}
|
|
263
|
+
`;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/init.ts"],"sourcesContent":["import prompts from 'prompts';\nimport chalk from 'chalk';\nimport ora from 'ora';\nimport {\n detectFramework,\n detectPackageManager,\n type Framework as DetectedFramework,\n} from '../utils/detect.js';\nimport {\n createComponentsConfig,\n hasComponentsConfig,\n loadComponentsConfig,\n type Framework,\n} from '../utils/components-config.js';\nimport {\n getDefaultConfig,\n type BaseColor,\n type IconLibrary,\n} from '../utils/config-schema.js';\nimport { writeFile, ensureDir } from '../utils/files.js';\nimport { installDependencies } from '../utils/package-manager.js';\nimport { resolve } from 'path';\n\ninterface InitOptions {\n yes?: boolean;\n cwd: string;\n}\n\nexport async function initCommand(options: InitOptions) {\n console.log(chalk.bold.cyan('\\nš Galaxy UI CLI - Multi-Framework Edition\\n'));\n\n const cwd = options.cwd;\n\n // Check if already initialized\n if (hasComponentsConfig(cwd)) {\n console.log(chalk.yellow('ā components.json already exists in this project.'));\n const { overwrite } = await prompts({\n type: 'confirm',\n name: 'overwrite',\n message: 'Do you want to overwrite the existing configuration?',\n initial: false,\n });\n\n if (!overwrite) {\n console.log(chalk.gray('Initialization cancelled.'));\n return;\n }\n }\n\n // Detect framework\n const detectedFramework = detectFramework(cwd);\n\n if (detectedFramework === 'unknown') {\n console.log(\n chalk.red(\n 'ā Could not detect framework. Please ensure you are in a valid Angular, React, Vue, React Native, or Flutter project.'\n )\n );\n return;\n }\n\n console.log(chalk.green(`ā Detected ${chalk.bold(detectedFramework)} framework`));\n\n // Map detected framework to Framework type\n const frameworkMap: Record<DetectedFramework, Framework | null> = {\n angular: 'angular',\n react: 'react',\n vue: 'vue',\n 'react-native': 'react-native',\n flutter: 'flutter',\n unknown: null,\n };\n\n const framework = frameworkMap[detectedFramework];\n if (!framework) {\n console.log(chalk.red('ā Unsupported framework detected.'));\n return;\n }\n\n // Detect package manager\n const packageManager = detectPackageManager(cwd);\n console.log(chalk.green(`ā Using ${chalk.bold(packageManager)} package manager`));\n\n // Get configuration from user (or use defaults with --yes)\n let config = getDefaultConfig(framework);\n\n if (!options.yes) {\n console.log(chalk.cyan('\\nš Configuration\\n'));\n\n // Build prompts based on framework\n const promptQuestions: any[] = [];\n\n // TypeScript prompt (not for Flutter)\n if (framework !== 'flutter') {\n promptQuestions.push({\n type: 'toggle',\n name: 'typescript',\n message: 'Would you like to use TypeScript?',\n initial: true,\n active: 'yes',\n inactive: 'no',\n });\n }\n\n // Base color prompt (for all frameworks)\n promptQuestions.push({\n type: 'select',\n name: 'baseColor',\n message: 'Which base color would you like to use?',\n choices: [\n { title: 'Slate', value: 'slate' },\n { title: 'Gray', value: 'gray' },\n { title: 'Zinc', value: 'zinc' },\n { title: 'Neutral', value: 'neutral' },\n { title: 'Stone', value: 'stone' },\n ],\n initial: 0,\n });\n\n // Icon library prompt (not for Flutter - uses built-in icons)\n if (framework !== 'flutter') {\n promptQuestions.push({\n type: 'select',\n name: 'iconLibrary',\n message: 'Which icon library would you like to use?',\n choices: [\n { title: 'Lucide (Recommended)', value: 'lucide' },\n { title: 'Heroicons', value: 'heroicons' },\n { title: 'Radix Icons', value: 'radix-icons' },\n ],\n initial: 0,\n });\n }\n\n // CSS file prompt (only for web frameworks and React Native)\n if (framework !== 'flutter' && config.tailwind.css) {\n promptQuestions.push({\n type: 'text',\n name: 'cssFile',\n message: framework === 'react-native'\n ? 'Where is your global CSS file (for NativeWind)?'\n : 'Where is your global CSS file?',\n initial: config.tailwind.css,\n });\n }\n\n const answers = await prompts(promptQuestions);\n\n if (Object.keys(answers).length === 0) {\n console.log(chalk.gray('Initialization cancelled.'));\n return;\n }\n\n // Update config with user choices\n config = {\n ...config,\n typescript: answers.typescript ?? config.typescript,\n iconLibrary: (answers.iconLibrary as IconLibrary) ?? config.iconLibrary,\n tailwind: {\n ...config.tailwind,\n baseColor: (answers.baseColor as BaseColor) ?? config.tailwind.baseColor,\n css: answers.cssFile ?? config.tailwind.css,\n },\n };\n }\n\n console.log(chalk.cyan('\\nš¦ Installing dependencies...\\n'));\n\n // Install dependencies\n const spinner = ora('Installing dependencies...').start();\n\n const dependencies: string[] = [];\n const devDependencies: string[] = [];\n\n // Common dependencies\n dependencies.push('clsx', 'tailwind-merge');\n\n // Framework-specific dependencies\n switch (framework) {\n case 'vue':\n dependencies.push('radix-vue');\n devDependencies.push('tailwindcss', 'autoprefixer', 'postcss');\n if (config.iconLibrary === 'lucide') {\n dependencies.push('lucide-vue-next');\n }\n break;\n\n case 'react':\n dependencies.push('@radix-ui/react-slot');\n devDependencies.push('tailwindcss', 'autoprefixer', 'postcss');\n if (config.iconLibrary === 'lucide') {\n dependencies.push('lucide-react');\n }\n if (config.typescript) {\n devDependencies.push('@types/react', '@types/react-dom');\n }\n break;\n\n case 'angular':\n // Angular components use Radix NG primitives\n dependencies.push('@radix-ng/primitives');\n if (config.iconLibrary === 'lucide') {\n dependencies.push('lucide-angular');\n }\n break;\n }\n\n try {\n // Install dependencies\n if (dependencies.length > 0) {\n await installDependencies(dependencies, {\n cwd,\n silent: true,\n });\n }\n\n // Install devDependencies\n if (devDependencies.length > 0) {\n await installDependencies(devDependencies, {\n cwd,\n dev: true,\n silent: true,\n });\n }\n\n spinner.succeed('Dependencies installed');\n } catch (error) {\n spinner.fail('Failed to install dependencies');\n console.error(chalk.red(error));\n return;\n }\n\n // Create directories\n const dirSpinner = ora('Creating directories...').start();\n\n try {\n const componentsPath = resolve(cwd, config.aliases.components.replace('@/', ''));\n const utilsPath = resolve(cwd, config.aliases.utils.replace('@/', ''));\n\n await ensureDir(componentsPath);\n await ensureDir(resolve(componentsPath, 'ui'));\n await ensureDir(utilsPath.replace('/utils', '')); // Create lib dir\n\n dirSpinner.succeed('Directories created');\n } catch (error) {\n dirSpinner.fail('Failed to create directories');\n console.error(chalk.red(error));\n return;\n }\n\n // Create utils file\n const utilsSpinner = ora('Creating utility functions...').start();\n\n try {\n const utilsPath = resolve(cwd, config.aliases.utils.replace('@/', '') + '.ts');\n const utilsContent = getUtilsContent();\n writeFile(utilsPath, utilsContent);\n\n utilsSpinner.succeed('Utility functions created');\n } catch (error) {\n utilsSpinner.fail('Failed to create utility functions');\n console.error(chalk.red(error));\n return;\n }\n\n // Save components.json\n const configSpinner = ora('Creating components.json...').start();\n\n try {\n createComponentsConfig(cwd, framework);\n configSpinner.succeed('components.json created');\n } catch (error) {\n configSpinner.fail('Failed to create components.json');\n console.error(chalk.red(error));\n return;\n }\n\n // Success message\n console.log(chalk.green('\\n⨠Success! Galaxy UI has been initialized.\\n'));\n console.log(chalk.cyan('Next steps:\\n'));\n console.log(chalk.white(` 1. Configure Tailwind CSS in ${config.tailwind.config}`));\n console.log(chalk.white(` 2. Import utilities in ${config.tailwind.css}`));\n console.log(chalk.white(` 3. Add components:`));\n console.log(chalk.gray(` galaxy-ui add button`));\n console.log(chalk.gray(` galaxy-ui add input card`));\n console.log(chalk.gray(` galaxy-ui add --all\\n`));\n\n console.log(chalk.cyan('Learn more:'));\n console.log(chalk.white(' Documentation: https://galaxy-design.vercel.app'));\n console.log(chalk.white(' GitHub: https://github.com/buikevin/galaxy-design-cli\\n'));\n}\n\n/**\n * Get utils.ts content\n */\nfunction getUtilsContent(): string {\n return `import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * Merge Tailwind CSS classes\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n`;\n}\n"],"names":["prompts","chalk","ora","detectFramework","detectPackageManager","createComponentsConfig","hasComponentsConfig","getDefaultConfig","writeFile","ensureDir","installDependencies","resolve","initCommand","options","console","log","bold","cyan","cwd","yellow","overwrite","type","name","message","initial","gray","detectedFramework","red","green","frameworkMap","angular","react","vue","flutter","unknown","framework","packageManager","config","yes","promptQuestions","push","active","inactive","choices","title","value","tailwind","css","answers","Object","keys","length","typescript","iconLibrary","baseColor","cssFile","spinner","start","dependencies","devDependencies","silent","dev","succeed","error","fail","dirSpinner","componentsPath","aliases","components","replace","utilsPath","utils","utilsSpinner","utilsContent","getUtilsContent","configSpinner","white"],"mappings":";AAAA,OAAOA,aAAa,UAAU;AAC9B,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,SAAS,MAAM;AACtB,SACEC,eAAe,EACfC,oBAAoB,QAEf,qBAAqB;AAC5B,SACEC,sBAAsB,EACtBC,mBAAmB,QAGd,gCAAgC;AACvC,SACEC,gBAAgB,QAGX,4BAA4B;AACnC,SAASC,SAAS,EAAEC,SAAS,QAAQ,oBAAoB;AACzD,SAASC,mBAAmB,QAAQ,8BAA8B;AAClE,SAASC,OAAO,QAAQ,OAAO;AAO/B,OAAO,eAAeC,YAAYC,OAAoB;IACpDC,QAAQC,GAAG,CAACd,MAAMe,IAAI,CAACC,IAAI,CAAC;IAE5B,MAAMC,MAAML,QAAQK,GAAG;IAEvB,+BAA+B;IAC/B,IAAIZ,oBAAoBY,MAAM;QAC5BJ,QAAQC,GAAG,CAACd,MAAMkB,MAAM,CAAC;QACzB,MAAM,EAAEC,SAAS,EAAE,GAAG,MAAMpB,QAAQ;YAClCqB,MAAM;YACNC,MAAM;YACNC,SAAS;YACTC,SAAS;QACX;QAEA,IAAI,CAACJ,WAAW;YACdN,QAAQC,GAAG,CAACd,MAAMwB,IAAI,CAAC;YAC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T,MAAM,EAAE;IAClFvB,QAAQC,GAAG,CAACd,MAAM2E,KAAK,CAAC,CAAC,yBAAyB,EAAEvC,OAAOS,QAAQ,CAACC,GAAG,EAAE;IACzEjC,QAAQC,GAAG,CAACd,MAAM2E,KAAK,CAAC,CAAC,oBAAoB,CAAC;IAC9C9D,QAAQC,GAAG,CAACd,MAAMwB,IAAI,CAAC,CAAC,yBAAyB,CAAC;IAClDX,QAAQC,GAAG,CAACd,MAAMwB,IAAI,CAAC,CAAC,6BAA6B,CAAC;IACtDX,QAAQC,GAAG,CAACd,MAAMwB,IAAI,CAAC,CAAC,0BAA0B,CAAC;IAEnDX,QAAQC,GAAG,CAACd,MAAMgB,IAAI,CAAC;IACvBH,QAAQC,GAAG,CAACd,MAAM2E,KAAK,CAAC;IACxB9D,QAAQC,GAAG,CAACd,MAAM2E,KAAK,CAAC;AAC1B;AAEA;;CAEC,GACD,SAASF;IACP,OAAO,CAAC;;;;;;;;;AASV,CAAC;AACD"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './commands/init.js';\nexport * from './commands/add.js';\nexport * from './utils/detect.js';\nexport * from './utils/files.js';\nexport * from './utils/registry.js';\nexport * from './utils/config.js';\n"],"names":[],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,oBAAoB"}
|
package/dist/lib/cli.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/cli.ts"],"sourcesContent":["export function cli(): string {\n return 'cli';\n}\n"],"names":["cli"],"mappings":"AAAA,OAAO,SAASA;IACd,OAAO;AACT"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../schemas/registry-schema.json",
|
|
3
|
+
"name": "angular-blocks",
|
|
4
|
+
"components": {
|
|
5
|
+
"chat-ui": {
|
|
6
|
+
"name": "Chat UI",
|
|
7
|
+
"type": "block",
|
|
8
|
+
"description": "Complete chat interface with message list, input, user avatars and auto-scroll",
|
|
9
|
+
"dependencies": [],
|
|
10
|
+
"devDependencies": [],
|
|
11
|
+
"registryDependencies": ["avatar", "button", "scroll-area", "textarea"],
|
|
12
|
+
"files": [
|
|
13
|
+
"types.ts",
|
|
14
|
+
"chat-message.component.ts",
|
|
15
|
+
"message-list.component.ts",
|
|
16
|
+
"message-input.component.ts",
|
|
17
|
+
"chat-ui.component.ts",
|
|
18
|
+
"index.ts"
|
|
19
|
+
],
|
|
20
|
+
"category": "blocks"
|
|
21
|
+
},
|
|
22
|
+
"sidebar": {
|
|
23
|
+
"name": "Sidebar",
|
|
24
|
+
"type": "block",
|
|
25
|
+
"description": "Collapsible navigation sidebar with nested menu items, badges, and icons",
|
|
26
|
+
"dependencies": [],
|
|
27
|
+
"devDependencies": [],
|
|
28
|
+
"registryDependencies": ["button", "separator"],
|
|
29
|
+
"files": [
|
|
30
|
+
"types.ts",
|
|
31
|
+
"sidebar-item.component.ts",
|
|
32
|
+
"sidebar.component.ts",
|
|
33
|
+
"index.ts"
|
|
34
|
+
],
|
|
35
|
+
"category": "blocks"
|
|
36
|
+
},
|
|
37
|
+
"authentication": {
|
|
38
|
+
"name": "Authentication",
|
|
39
|
+
"type": "block",
|
|
40
|
+
"description": "Complete authentication forms with login, register, validation, and social login",
|
|
41
|
+
"dependencies": [],
|
|
42
|
+
"devDependencies": [],
|
|
43
|
+
"registryDependencies": ["button", "input", "label", "checkbox", "separator"],
|
|
44
|
+
"files": [
|
|
45
|
+
"types.ts",
|
|
46
|
+
"login-form.component.ts",
|
|
47
|
+
"register-form.component.ts",
|
|
48
|
+
"auth-form.component.ts",
|
|
49
|
+
"index.ts"
|
|
50
|
+
],
|
|
51
|
+
"category": "blocks"
|
|
52
|
+
},
|
|
53
|
+
"email": {
|
|
54
|
+
"name": "Email Client",
|
|
55
|
+
"type": "block",
|
|
56
|
+
"description": "Gmail-like email interface with inbox, folders, email list, and reading pane",
|
|
57
|
+
"dependencies": [],
|
|
58
|
+
"devDependencies": [],
|
|
59
|
+
"registryDependencies": ["button", "input", "avatar", "separator", "scroll-area"],
|
|
60
|
+
"files": [
|
|
61
|
+
"types.ts",
|
|
62
|
+
"email-client.component.ts",
|
|
63
|
+
"index.ts"
|
|
64
|
+
],
|
|
65
|
+
"category": "blocks"
|
|
66
|
+
},
|
|
67
|
+
"featured": {
|
|
68
|
+
"name": "Featured Sections",
|
|
69
|
+
"type": "block",
|
|
70
|
+
"description": "Landing page sections including hero and features grid with multiple variants",
|
|
71
|
+
"dependencies": [],
|
|
72
|
+
"devDependencies": [],
|
|
73
|
+
"registryDependencies": ["button"],
|
|
74
|
+
"files": [
|
|
75
|
+
"types.ts",
|
|
76
|
+
"hero-section.component.ts",
|
|
77
|
+
"featured-section.component.ts",
|
|
78
|
+
"index.ts"
|
|
79
|
+
],
|
|
80
|
+
"category": "blocks"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"groups": {
|
|
84
|
+
"all-blocks": {
|
|
85
|
+
"name": "All Blocks",
|
|
86
|
+
"components": ["chat-ui", "sidebar", "authentication", "email", "featured"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../schemas/registry-schema.json",
|
|
3
|
+
"name": "flutter-blocks",
|
|
4
|
+
"components": {
|
|
5
|
+
"chat-ui": {
|
|
6
|
+
"name": "Chat UI (Mobile)",
|
|
7
|
+
"type": "block",
|
|
8
|
+
"description": "Mobile-optimized chat interface with Material Design 3 styling",
|
|
9
|
+
"dependencies": [],
|
|
10
|
+
"devDependencies": [],
|
|
11
|
+
"registryDependencies": ["avatar", "button"],
|
|
12
|
+
"files": [
|
|
13
|
+
"types.dart",
|
|
14
|
+
"chat_message.dart",
|
|
15
|
+
"message_list.dart",
|
|
16
|
+
"message_input.dart",
|
|
17
|
+
"chat_ui.dart",
|
|
18
|
+
"index.dart"
|
|
19
|
+
],
|
|
20
|
+
"category": "mobile-blocks"
|
|
21
|
+
},
|
|
22
|
+
"sidebar": {
|
|
23
|
+
"name": "Navigation Drawer (Mobile)",
|
|
24
|
+
"type": "block",
|
|
25
|
+
"description": "Flutter drawer navigation with Material Design components",
|
|
26
|
+
"dependencies": [],
|
|
27
|
+
"devDependencies": [],
|
|
28
|
+
"registryDependencies": ["button"],
|
|
29
|
+
"files": [
|
|
30
|
+
"types.dart",
|
|
31
|
+
"drawer_item.dart",
|
|
32
|
+
"navigation_drawer.dart",
|
|
33
|
+
"index.dart"
|
|
34
|
+
],
|
|
35
|
+
"category": "mobile-blocks"
|
|
36
|
+
},
|
|
37
|
+
"authentication": {
|
|
38
|
+
"name": "Authentication (Mobile)",
|
|
39
|
+
"type": "block",
|
|
40
|
+
"description": "Mobile authentication forms with Flutter form validation",
|
|
41
|
+
"dependencies": [],
|
|
42
|
+
"devDependencies": [],
|
|
43
|
+
"registryDependencies": ["button", "input", "checkbox"],
|
|
44
|
+
"files": [
|
|
45
|
+
"types.dart",
|
|
46
|
+
"login_form.dart",
|
|
47
|
+
"register_form.dart",
|
|
48
|
+
"auth_form.dart",
|
|
49
|
+
"index.dart"
|
|
50
|
+
],
|
|
51
|
+
"category": "mobile-blocks"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"groups": {
|
|
55
|
+
"all-mobile-blocks": {
|
|
56
|
+
"name": "All Mobile Blocks",
|
|
57
|
+
"components": ["chat-ui", "sidebar", "authentication"]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|