@glass-ui-kit/cli 0.1.2 → 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.
Files changed (3) hide show
  1. package/README.md +0 -19
  2. package/dist/index.js +82 -31
  3. package/package.json +11 -10
package/README.md CHANGED
@@ -35,13 +35,6 @@ npx @glass-ui-kit/cli add card
35
35
 
36
36
  ```
37
37
 
38
- You can also run the command without any arguments to view a list of all available components:
39
-
40
- ```bash
41
- npx @glass-ui-kit/cli add
42
-
43
- ```
44
-
45
38
  ## Documentation
46
39
 
47
40
  Visit [https://ui-glass.vercel.app](https://ui-glass.vercel.app) to view the registry and documentation.
@@ -49,15 +42,3 @@ Visit [https://ui-glass.vercel.app](https://ui-glass.vercel.app) to view the reg
49
42
  ## License
50
43
 
51
44
  Licensed under the [MIT license](https://github.com/jntellez/glass-ui/blob/master/LICENSE).
52
-
53
- ---
54
-
55
- ### Keywords
56
-
57
- components
58
- ui
59
- glassmorphism
60
- tailwind
61
- design-system
62
- react
63
- cli
package/dist/index.js CHANGED
@@ -71,9 +71,7 @@ async function installDependencies(deps, pm) {
71
71
  return new Promise((resolve, reject) => {
72
72
  const child = spawn(pm, [installCmd, ...deps], {
73
73
  stdio: "inherit",
74
- // Para ver los colores y logs del instalador
75
74
  shell: true
76
- // CRÍTICO para Windows (ejecuta npm.cmd/pnpm.cmd correctamente)
77
75
  });
78
76
  child.on("close", (code) => {
79
77
  if (code !== 0) {
@@ -85,38 +83,75 @@ async function installDependencies(deps, pm) {
85
83
  });
86
84
  }
87
85
 
88
- // src/utils/templates.ts
89
- var UTILS_CN = `import { type ClassValue, clsx } from "clsx";
90
- import { twMerge } from "tailwind-merge";
91
-
92
- export function cn(...inputs: ClassValue[]) {
93
- return twMerge(clsx(inputs));
94
- }
95
- `;
96
- var GLASS_TOKENS = `
86
+ // src/templates/styles.ts
87
+ var GLASS_BASE_STYLES = `
97
88
  @layer base {
98
89
  :root {
99
- /* --- GLASS UI TOKENS (Light) --- */
100
- --glass-surface: rgba(255, 255, 255, 0.4);
101
- --glass-border: rgba(255, 255, 255, 0.6);
102
- --glass-highlight: rgba(255, 255, 255, 0.5);
90
+ /* === Glass UI Tokens (Default) === */
91
+ --glass-bg: rgba(255, 255, 255, 0.4);
92
+ --glass-border: rgba(255, 255, 255, 0.5);
103
93
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
104
94
  --glass-blur: 12px;
105
95
  --glass-saturation: 110%;
96
+
97
+ /* === Intensity Variants === */
98
+ --glass-bg-strong: rgba(255, 255, 255, 0.75);
99
+ --glass-border-strong: rgba(255, 255, 255, 0.8);
100
+ --glass-blur-strong: 20px;
101
+
102
+ --glass-bg-soft: rgba(255, 255, 255, 0.2);
103
+ --glass-border-soft: rgba(255, 255, 255, 0.3);
104
+ --glass-blur-soft: 8px;
106
105
  }
107
106
 
108
107
  .dark {
109
- /* --- GLASS UI TOKENS (Dark) --- */
110
- --glass-surface: rgba(0, 0, 0, 0.3);
108
+ /* === Glass UI Tokens (Dark) === */
109
+ --glass-bg: rgba(15, 23, 42, 0.6);
111
110
  --glass-border: rgba(255, 255, 255, 0.08);
112
- --glass-highlight: rgba(255, 255, 255, 0.03);
113
- --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
114
- --glass-blur: 12px;
115
- --glass-saturation: 100%;
111
+ --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
112
+
113
+ --glass-bg-strong: rgba(15, 23, 42, 0.85);
114
+ --glass-border-strong: rgba(255, 255, 255, 0.15);
115
+
116
+ --glass-bg-soft: rgba(15, 23, 42, 0.3);
117
+ --glass-border-soft: rgba(255, 255, 255, 0.05);
118
+ }
119
+ }
120
+
121
+ @layer components {
122
+ /* La clase base obligatoria */
123
+ .glass {
124
+ background: var(--glass-bg);
125
+ border: 1px solid var(--glass-border);
126
+ backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
127
+ -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
128
+ box-shadow: var(--glass-shadow);
129
+ }
130
+
131
+ /* Variantes sem\xE1nticas (solo reasignan variables) */
132
+ .glass-strong {
133
+ --glass-bg: var(--glass-bg-strong);
134
+ --glass-border: var(--glass-border-strong);
135
+ --glass-blur: var(--glass-blur-strong);
136
+ }
137
+
138
+ .glass-soft {
139
+ --glass-bg: var(--glass-bg-soft);
140
+ --glass-border: var(--glass-border-soft);
141
+ --glass-blur: var(--glass-blur-soft);
116
142
  }
117
143
  }
118
144
  `;
119
145
 
146
+ // src/templates/utils.ts
147
+ var UTILS_CN = `import { type ClassValue, clsx } from "clsx";
148
+ import { twMerge } from "tailwind-merge";
149
+
150
+ export function cn(...inputs: ClassValue[]) {
151
+ return twMerge(clsx(inputs));
152
+ }
153
+ `;
154
+
120
155
  // src/commands/init.ts
121
156
  var init = new Command().name("init").description("Initialize configuration and dependencies").option("-y, --yes", "Skip confirmation prompt", false).action(async (opts) => {
122
157
  try {
@@ -163,8 +198,8 @@ var init = new Command().name("init").description("Initialize configuration and
163
198
  }
164
199
  } catch (e) {
165
200
  }
166
- if (!cssContent.includes("--glass-surface")) {
167
- const newCssContent = `${GLASS_TOKENS}
201
+ if (!cssContent.includes("--glass-bg")) {
202
+ const newCssContent = `${GLASS_BASE_STYLES}
168
203
  ${cssContent}`;
169
204
  await writeFile(cssPath, newCssContent);
170
205
  console.log(chalk.green(` Updated ${cssPath} with glass tokens`));
@@ -302,6 +337,27 @@ function getItem(registry, name) {
302
337
  return registry.find((item) => item.name === name);
303
338
  }
304
339
 
340
+ // src/utils/transformers.ts
341
+ function transformImports(content, config) {
342
+ let transformed = content;
343
+ transformed = transformed.replace(
344
+ /from\s+["'](\.\.\/)+lib\/utils["']/g,
345
+ `from "${config.aliases.utils}"`
346
+ );
347
+ transformed = transformed.replace(
348
+ /from\s+["']~glass\/lib\/utils["']/g,
349
+ `from "${config.aliases.utils}"`
350
+ );
351
+ transformed = transformed.replace(
352
+ /from\s+["'](\.\.\/)+ui\/([\w-]+)["']/g,
353
+ (match, prefix, componentName) => {
354
+ const cleanName = componentName.replace(/\.tsx?$/, "");
355
+ return `from "${config.aliases.components}/${cleanName}"`;
356
+ }
357
+ );
358
+ return transformed;
359
+ }
360
+
305
361
  // src/commands/add.ts
306
362
  var add = new Command2().name("add").description("Add a component to your project").argument("<component>", "The component to add").action(async (componentName) => {
307
363
  try {
@@ -317,11 +373,7 @@ var add = new Command2().name("add").description("Add a component to your projec
317
373
  const registry = await fetchRegistry();
318
374
  const item = getItem(registry, componentName);
319
375
  if (!item) {
320
- console.error(
321
- chalk2.red(`Component '${componentName}' not found in registry.`)
322
- );
323
- console.log(chalk2.gray("Available components:"));
324
- console.log(chalk2.gray(` ${registry.map((i) => i.name).join(", ")}`));
376
+ console.error(chalk2.red(`Component '${componentName}' not found.`));
325
377
  process.exit(1);
326
378
  }
327
379
  const targetDirAlias = config.aliases.components || "@/components/ui";
@@ -332,7 +384,8 @@ var add = new Command2().name("add").description("Add a component to your projec
332
384
  if (!file.content) {
333
385
  continue;
334
386
  }
335
- await writeFile(filePath, file.content);
387
+ const transformedContent = transformImports(file.content, config);
388
+ await writeFile(filePath, transformedContent);
336
389
  console.log(chalk2.green(` Created ${filePath}`));
337
390
  }
338
391
  if (item.dependencies?.length) {
@@ -345,8 +398,6 @@ Done.`));
345
398
  console.error(chalk2.red("\nOperation failed:"));
346
399
  if (error instanceof Error) {
347
400
  console.error(chalk2.gray(` ${error.message}`));
348
- } else {
349
- console.error(chalk2.gray(" An unknown error occurred."));
350
401
  }
351
402
  process.exit(1);
352
403
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glass-ui-kit/cli",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "The official CLI for Glass UI. Add glassmorphism components to your React projects in seconds.",
5
5
  "keywords": [
6
6
  "glassmorphism",
@@ -32,6 +32,12 @@
32
32
  "engines": {
33
33
  "node": ">=18.0.0"
34
34
  },
35
+ "scripts": {
36
+ "build": "tsup src/index.ts --format esm --clean",
37
+ "dev": "bun run ./src/index.ts",
38
+ "lint": "eslint src",
39
+ "prepublishOnly": "pnpm run build"
40
+ },
35
41
  "dependencies": {
36
42
  "chalk": "^5.3.0",
37
43
  "commander": "^11.1.0",
@@ -39,19 +45,14 @@
39
45
  "zod": "^3.22.4"
40
46
  },
41
47
  "devDependencies": {
48
+ "@glass-ui-kit/tsconfig": "workspace:*",
49
+ "@glass-ui-kit/schema": "workspace:*",
42
50
  "@types/node": "^20.11.0",
43
51
  "bun-types": "latest",
44
52
  "tsup": "^8.0.1",
45
- "typescript": "^5.3.3",
46
- "@glass-ui-kit/tsconfig": "0.0.1",
47
- "@glass-ui-kit/schema": "0.0.1"
53
+ "typescript": "^5.3.3"
48
54
  },
49
55
  "publishConfig": {
50
56
  "access": "public"
51
- },
52
- "scripts": {
53
- "build": "tsup src/index.ts --format esm --clean",
54
- "dev": "bun run ./src/index.ts",
55
- "lint": "eslint src"
56
57
  }
57
- }
58
+ }