@glass-ui-kit/cli 0.1.3 → 0.2.1

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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +0 -12
  3. package/dist/index.js +199 -35
  4. package/package.json +6 -5
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Juan Tellez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -42,15 +42,3 @@ Visit [https://ui-glass.vercel.app](https://ui-glass.vercel.app) to view the reg
42
42
  ## License
43
43
 
44
44
  Licensed under the [MIT license](https://github.com/jntellez/glass-ui/blob/master/LICENSE).
45
-
46
- ---
47
-
48
- ### Keywords
49
-
50
- components
51
- ui
52
- glassmorphism
53
- tailwind
54
- design-system
55
- react
56
- 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,187 @@ 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);
90
+ /* === TEXT TOKENS (Light) === */
91
+ --foreground: #18181b;
92
+ --muted-foreground: #3f3f46;
93
+
94
+ /* === BASE PRIMITIVES (Default) === */
95
+ --glass-bg: rgba(255, 255, 255, 0.35);
101
96
  --glass-border: rgba(255, 255, 255, 0.6);
102
- --glass-highlight: rgba(255, 255, 255, 0.5);
103
- --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
104
- --glass-blur: 12px;
105
- --glass-saturation: 110%;
97
+ --glass-shadow: var(--glass-shadow-sm);
98
+ --glass-blur: 6px;
99
+
100
+ /* === SHADOW SIZES === */
101
+ --glass-shadow-sm: 0 2px 8px 0 rgba(0, 0, 0, 0.06);
102
+ --glass-shadow-md: 0 4px 30px 0 rgba(0, 0, 0, 0.1);
103
+ --glass-shadow-lg: 0 8px 40px 0 rgba(0, 0, 0, 0.2);
104
+
105
+ /* === BORDER RADIUS === */
106
+ --glass-radius-sm: 0.375rem;
107
+ --glass-radius-md: 0.75rem;
108
+ --glass-radius-lg: 1rem;
109
+ --glass-radius-xl: 1.5rem;
110
+
111
+ /* === SEMANTIC VARIANTS === */
112
+ --glass-bg-strong: rgba(255, 255, 255, 0.5);
113
+ --glass-border-strong: rgba(255, 255, 255, 0.8);
114
+ --glass-blur-strong: 10px;
115
+
116
+ --glass-bg-soft: rgba(255, 255, 255, 0.2);
117
+ --glass-border-soft: rgba(255, 255, 255, 0.4);
118
+ --glass-blur-soft: 2px;
106
119
  }
107
120
 
108
121
  .dark {
109
- /* --- GLASS UI TOKENS (Dark) --- */
110
- --glass-surface: rgba(0, 0, 0, 0.3);
111
- --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%;
122
+ /* === TEXT TOKENS (Dark) === */
123
+ --foreground: #fafafa;
124
+ --muted-foreground: #d4d4d8;
125
+
126
+ /* === DARK PRIMITIVES === */
127
+ --glass-bg: rgba(255, 255, 255, 0.08);
128
+ --glass-border: rgba(255, 255, 255, 0.1);
129
+ --glass-shadow: var(--glass-shadow-sm);
130
+
131
+ /* === DARK SHADOW SIZES === */
132
+ --glass-shadow-sm: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
133
+ --glass-shadow-md: 0 4px 30px 0 rgba(0, 0, 0, 0.2);
134
+ --glass-shadow-lg: 0 8px 40px 0 rgba(0, 0, 0, 0.35);
135
+
136
+ /* === DARK VARIANTS === */
137
+ --glass-bg-strong: rgba(255, 255, 255, 0.15);
138
+ --glass-border-strong: rgba(255, 255, 255, 0.2);
139
+
140
+ --glass-bg-soft: rgba(255, 255, 255, 0.03);
141
+ --glass-border-soft: rgba(255, 255, 255, 0.06);
142
+ }
143
+ }
144
+
145
+ @theme {
146
+ --color-foreground: var(--foreground);
147
+ --color-muted-foreground: var(--muted-foreground);
148
+ --color-glass-bg: var(--glass-bg);
149
+ --color-glass-border: var(--glass-border);
150
+ --shadow-glass: var(--glass-shadow);
151
+ --shadow-glass-sm: var(--glass-shadow-sm);
152
+ --shadow-glass-md: var(--glass-shadow-md);
153
+ --shadow-glass-lg: var(--glass-shadow-lg);
154
+ --backdrop-blur-glass: var(--glass-blur);
155
+ --radius-glass-sm: var(--glass-radius-sm);
156
+ --radius-glass-md: var(--glass-radius-md);
157
+ --radius-glass-lg: var(--glass-radius-lg);
158
+ --radius-glass-xl: var(--glass-radius-xl);
159
+ }
160
+
161
+ /* --- Global Utilities Injected by Glass UI --- */
162
+
163
+ /* Hide native reveal icons in password inputs */
164
+ input[type="password"]::-ms-reveal,
165
+ input[type="password"]::-ms-clear {
166
+ display: none;
167
+ width: 0;
168
+ height: 0;
169
+ }
170
+
171
+ /* Provisional gradient background to highlight Glassmorphism */
172
+ body {
173
+ /* Pastel gradient for light mode */
174
+ background: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%);
175
+ background-attachment: fixed;
176
+ color: var(--foreground);
177
+ min-height: 100vh;
178
+ }
179
+
180
+ .dark body {
181
+ /* Deep gradient for dark mode */
182
+ background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
183
+ background-attachment: fixed;
184
+ color: var(--foreground);
185
+ }
186
+
187
+ @layer components {
188
+ /* .glass -> La clase fundacional.
189
+ Usa las variables por defecto (--glass-bg, etc).
190
+ */
191
+ .glass,
192
+ .hover\\:glass:hover {
193
+ background: var(--glass-bg);
194
+ border: 1px solid var(--glass-border);
195
+ backdrop-filter: blur(var(--glass-blur));
196
+ box-shadow: var(--glass-shadow);
197
+ }
198
+
199
+ /* PRESETS DE INTENSIDAD
200
+ No reescriben propiedades CSS (background, border).
201
+ Solo re-asignan las variables locales.
202
+ */
203
+ .glass-strong,
204
+ .hover\\:glass-strong:hover {
205
+ --glass-bg: var(--glass-bg-strong);
206
+ --glass-border: var(--glass-border-strong);
207
+ --glass-blur: var(--glass-blur-strong);
208
+ }
209
+
210
+ .glass-soft,
211
+ .hover\\:glass-soft:hover {
212
+ --glass-bg: var(--glass-bg-soft);
213
+ --glass-border: var(--glass-border-soft);
214
+ --glass-blur: var(--glass-blur-soft);
215
+ }
216
+
217
+ /* SIZES */
218
+ .input-sm,
219
+ .btn-sm {
220
+ height: 1.5rem;
221
+ padding-left: 0.5rem;
222
+ padding-right: 0.5rem;
223
+ font-size: 0.75rem;
224
+ line-height: 1rem;
225
+ gap: 0.375rem;
226
+ }
227
+
228
+ .input-md,
229
+ .btn-md {
230
+ height: 2rem;
231
+ padding-top: 0.5rem;
232
+ padding-bottom: 0.5rem;
233
+ padding-left: 0.625rem;
234
+ padding-right: 0.625rem;
235
+ font-size: 0.875rem;
236
+ line-height: 1.25rem;
237
+ gap: 0.5rem;
238
+ }
239
+
240
+ .input-lg,
241
+ .btn-lg {
242
+ height: 2.5rem;
243
+ padding-left: 0.875rem;
244
+ padding-right: 0.875rem;
245
+ font-size: 1rem;
246
+ line-height: 1.5rem;
247
+ gap: 0.625rem;
248
+ }
249
+
250
+ /* ICON BUTTON */
251
+ .btn-icon {
252
+ padding: 0;
253
+ aspect-ratio: 1 / 1;
116
254
  }
117
255
  }
118
256
  `;
119
257
 
258
+ // src/templates/utils.ts
259
+ var UTILS_CN = `import { type ClassValue, clsx } from "clsx";
260
+ import { twMerge } from "tailwind-merge";
261
+
262
+ export function cn(...inputs: ClassValue[]) {
263
+ return twMerge(clsx(inputs));
264
+ }
265
+ `;
266
+
120
267
  // src/commands/init.ts
121
268
  var init = new Command().name("init").description("Initialize configuration and dependencies").option("-y, --yes", "Skip confirmation prompt", false).action(async (opts) => {
122
269
  try {
@@ -163,9 +310,10 @@ var init = new Command().name("init").description("Initialize configuration and
163
310
  }
164
311
  } catch (e) {
165
312
  }
166
- if (!cssContent.includes("--glass-surface")) {
167
- const newCssContent = `${GLASS_TOKENS}
168
- ${cssContent}`;
313
+ if (!cssContent.includes("--glass-bg")) {
314
+ const newCssContent = `${cssContent.trimEnd()}
315
+
316
+ ${GLASS_BASE_STYLES}`;
169
317
  await writeFile(cssPath, newCssContent);
170
318
  console.log(chalk.green(` Updated ${cssPath} with glass tokens`));
171
319
  } else {
@@ -302,6 +450,27 @@ function getItem(registry, name) {
302
450
  return registry.find((item) => item.name === name);
303
451
  }
304
452
 
453
+ // src/utils/transformers.ts
454
+ function transformImports(content, config) {
455
+ let transformed = content;
456
+ transformed = transformed.replace(
457
+ /from\s+["'](\.\.\/)+lib\/utils["']/g,
458
+ `from "${config.aliases.utils}"`
459
+ );
460
+ transformed = transformed.replace(
461
+ /from\s+["']~glass\/lib\/utils["']/g,
462
+ `from "${config.aliases.utils}"`
463
+ );
464
+ transformed = transformed.replace(
465
+ /from\s+["'](\.\.\/)+ui\/([\w-]+)["']/g,
466
+ (match, prefix, componentName) => {
467
+ const cleanName = componentName.replace(/\.tsx?$/, "");
468
+ return `from "${config.aliases.components}/${cleanName}"`;
469
+ }
470
+ );
471
+ return transformed;
472
+ }
473
+
305
474
  // src/commands/add.ts
306
475
  var add = new Command2().name("add").description("Add a component to your project").argument("<component>", "The component to add").action(async (componentName) => {
307
476
  try {
@@ -317,11 +486,7 @@ var add = new Command2().name("add").description("Add a component to your projec
317
486
  const registry = await fetchRegistry();
318
487
  const item = getItem(registry, componentName);
319
488
  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(", ")}`));
489
+ console.error(chalk2.red(`Component '${componentName}' not found.`));
325
490
  process.exit(1);
326
491
  }
327
492
  const targetDirAlias = config.aliases.components || "@/components/ui";
@@ -332,7 +497,8 @@ var add = new Command2().name("add").description("Add a component to your projec
332
497
  if (!file.content) {
333
498
  continue;
334
499
  }
335
- await writeFile(filePath, file.content);
500
+ const transformedContent = transformImports(file.content, config);
501
+ await writeFile(filePath, transformedContent);
336
502
  console.log(chalk2.green(` Created ${filePath}`));
337
503
  }
338
504
  if (item.dependencies?.length) {
@@ -345,8 +511,6 @@ Done.`));
345
511
  console.error(chalk2.red("\nOperation failed:"));
346
512
  if (error instanceof Error) {
347
513
  console.error(chalk2.gray(` ${error.message}`));
348
- } else {
349
- console.error(chalk2.gray(" An unknown error occurred."));
350
514
  }
351
515
  process.exit(1);
352
516
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glass-ui-kit/cli",
3
- "version": "0.1.3",
3
+ "version": "0.2.1",
4
4
  "description": "The official CLI for Glass UI. Add glassmorphism components to your React projects in seconds.",
5
5
  "keywords": [
6
6
  "glassmorphism",
@@ -43,15 +43,16 @@
43
43
  "bun-types": "latest",
44
44
  "tsup": "^8.0.1",
45
45
  "typescript": "^5.3.3",
46
- "@glass-ui-kit/schema": "0.0.1",
47
- "@glass-ui-kit/tsconfig": "0.0.1"
46
+ "@glass-ui-kit/tsconfig": "0.0.1",
47
+ "@glass-ui-kit/schema": "0.0.1"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
52
  "scripts": {
53
- "build": "tsup src/index.ts --format esm --clean",
54
- "dev": "bun run ./src/index.ts",
53
+ "sync": "node scripts/sync-styles.mjs",
54
+ "build": "pnpm run sync && tsup src/index.ts --format esm --clean",
55
+ "dev": "pnpm run sync && bun run ./src/index.ts",
55
56
  "lint": "eslint src"
56
57
  }
57
58
  }