@mimi-ng/cli 0.1.0 → 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 +19 -1
- package/dist/collection.json +1 -1
- package/dist/init/css.js +17 -0
- package/dist/init/index.js +7 -5
- package/dist/init/items.js +9 -0
- package/dist/ng-add/index.js +17 -1
- package/dist/ng-add/schema.json +27 -0
- package/dist/registry.json +222 -1
- package/dist/templates/components/avatar/avatar.ts +1 -1
- package/dist/templates/components/avatar/avatar.variants.ts +4 -4
- package/dist/templates/components/badge/badge.ts +41 -6
- package/dist/templates/components/badge/badge.variants.ts +105 -11
- package/dist/templates/components/button/button.ts +74 -7
- package/dist/templates/components/button/button.variants.ts +145 -21
- package/dist/templates/components/card/card.ts +8 -5
- package/dist/templates/components/checkbox/checkbox.ts +3 -3
- package/dist/templates/components/confirm/confirm-texts.ts +46 -0
- package/dist/templates/components/confirm/confirm.ts +190 -0
- package/dist/templates/components/confirm/index.ts +2 -0
- package/dist/templates/components/context-menu/context-menu.ts +378 -0
- package/dist/templates/components/context-menu/index.ts +14 -0
- package/dist/templates/components/dialog/dialog-texts.ts +41 -0
- package/dist/templates/components/dialog/dialog.ts +701 -0
- package/dist/templates/components/dialog/index.ts +18 -0
- package/dist/templates/components/dropdown-menu/dropdown-menu.ts +252 -0
- package/dist/templates/components/dropdown-menu/index.ts +14 -0
- package/dist/templates/components/form-field/form-error.ts +1 -1
- package/dist/templates/components/form-field/form-field.ts +3 -2
- package/dist/templates/components/input/input.variants.ts +6 -4
- package/dist/templates/components/menu/index.ts +15 -0
- package/dist/templates/components/menu/menu.ts +656 -0
- package/dist/templates/components/pagination/index.ts +2 -0
- package/dist/templates/components/pagination/pagination-page-size.ts +74 -0
- package/dist/templates/components/pagination/pagination-texts.ts +69 -0
- package/dist/templates/components/pagination/pagination.ts +443 -0
- package/dist/templates/components/popover/index.ts +12 -0
- package/dist/templates/components/popover/popover.ts +399 -0
- package/dist/templates/components/select/index.ts +12 -0
- package/dist/templates/components/select/select-texts.ts +62 -0
- package/dist/templates/components/select/select.ts +1085 -0
- package/dist/templates/components/separator/separator.variants.ts +10 -7
- package/dist/templates/components/skeleton/skeleton.ts +4 -1
- package/dist/templates/components/switch/switch.ts +6 -6
- package/dist/templates/components/tabs/index.ts +2 -0
- package/dist/templates/components/tabs/tabs.ts +426 -0
- package/dist/templates/components/textarea/textarea.variants.ts +14 -11
- package/dist/templates/components/toast/index.ts +3 -0
- package/dist/templates/components/toast/toast-config.ts +45 -0
- package/dist/templates/components/toast/toast-texts.ts +46 -0
- package/dist/templates/components/toast/toast.ts +1000 -0
- package/dist/templates/components/toolbar/index.ts +1 -0
- package/dist/templates/components/toolbar/toolbar.ts +377 -0
- package/dist/templates/components/tooltip/index.ts +7 -0
- package/dist/templates/components/tooltip/tooltip.ts +407 -0
- package/dist/templates/theme/provider.ts +62 -6
- package/dist/templates/theme/theme-base.css +307 -9
- package/dist/templates/theme/types.ts +278 -4
- package/dist/templates/utils/cn.ts +15 -1
- package/dist/templates/utils/control-styles.ts +2 -2
- package/dist/templates/utils/overlay.ts +140 -0
- package/dist/ui/index.js +80 -8
- package/dist/ui/schema.json +44 -0
- package/dist/utils/write-files.js +156 -59
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Mimi para Angular
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@mimi-ng/cli)
|
|
4
|
+
[](https://github.com/nuki23/mimi-ng/blob/main/LICENSE)
|
|
5
|
+
|
|
3
6
|
> Angular + Tailwind CSS components you copy into your project. Docs in Spanish; English coming soon.
|
|
4
7
|
|
|
5
8
|
Componentes para **Angular** y **Tailwind CSS 4** que una CLI copia a tu proyecto: desde ese momento, el código es tuyo. Un solo prefijo (`mimi`), tema opcional y tipado, y formularios con errores automáticos.
|
|
@@ -10,6 +13,8 @@ Mimi nació como "lo mío". Su promesa es que sea tuyo.
|
|
|
10
13
|
|
|
11
14
|
Documentación: **https://ng.mimiworks.dev**
|
|
12
15
|
|
|
16
|
+

|
|
17
|
+
|
|
13
18
|
## Requisitos
|
|
14
19
|
|
|
15
20
|
- Angular 22 o superior.
|
|
@@ -41,7 +46,9 @@ ng g mimi # menú para elegir (terminal interactiva)
|
|
|
41
46
|
ng g @mimi-ng/cli:ui button # forma larga (si Mimi no está en schematicCollections)
|
|
42
47
|
```
|
|
43
48
|
|
|
44
|
-
Cada componente se copia a `src/app/components/ui/<nombre>`, con lo que necesite, y se instalan las dependencias que falten.
|
|
49
|
+
Cada componente se copia a `src/app/components/ui/<nombre>`, con lo que necesite, y se instalan las dependencias que falten. Algunos usan por dentro `@angular/cdk` y `@angular/aria`, paquetes oficiales del equipo de Angular: `ng g mimi` los instala cuando hacen falta (aria en la versión exacta de tu cdk) y agrega los estilos del CDK a tu CSS global. Más en [Fundamentos](https://ng.mimiworks.dev/docs/foundations).
|
|
50
|
+
|
|
51
|
+
Después lo importas como cualquier otro:
|
|
45
52
|
|
|
46
53
|
```ts
|
|
47
54
|
import { MimiButton } from '@/components/ui/button';
|
|
@@ -61,12 +68,23 @@ export class App {}
|
|
|
61
68
|
- **Button**: `ng g mimi button` · [documentación](https://ng.mimiworks.dev/docs/components/button)
|
|
62
69
|
- **Card**: `ng g mimi card` · [documentación](https://ng.mimiworks.dev/docs/components/card)
|
|
63
70
|
- **Checkbox**: `ng g mimi checkbox` · [documentación](https://ng.mimiworks.dev/docs/components/switch)
|
|
71
|
+
- **Confirm**: `ng g mimi confirm` · [documentación](https://ng.mimiworks.dev/docs/components/confirm)
|
|
72
|
+
- **Context Menu**: `ng g mimi context-menu` · [documentación](https://ng.mimiworks.dev/docs/components/context-menu)
|
|
73
|
+
- **Dialog**: `ng g mimi dialog` · [documentación](https://ng.mimiworks.dev/docs/components/dialog)
|
|
74
|
+
- **Dropdown Menu**: `ng g mimi dropdown-menu` · [documentación](https://ng.mimiworks.dev/docs/components/dropdown-menu)
|
|
64
75
|
- **FormField**: `ng g mimi form-field` · [documentación](https://ng.mimiworks.dev/docs/components/form-field)
|
|
65
76
|
- **Input**: `ng g mimi input` · [documentación](https://ng.mimiworks.dev/docs/components/input)
|
|
77
|
+
- **Pagination**: `ng g mimi pagination` · [documentación](https://ng.mimiworks.dev/docs/components/pagination)
|
|
78
|
+
- **Popover**: `ng g mimi popover` · [documentación](https://ng.mimiworks.dev/docs/components/popover)
|
|
79
|
+
- **Select**: `ng g mimi select` · [documentación](https://ng.mimiworks.dev/docs/components/select)
|
|
66
80
|
- **Separator**: `ng g mimi separator` · [documentación](https://ng.mimiworks.dev/docs/components/separator)
|
|
67
81
|
- **Skeleton**: `ng g mimi skeleton` · [documentación](https://ng.mimiworks.dev/docs/components/skeleton)
|
|
68
82
|
- **Switch**: `ng g mimi switch` · [documentación](https://ng.mimiworks.dev/docs/components/switch)
|
|
83
|
+
- **Tabs**: `ng g mimi tabs` · [documentación](https://ng.mimiworks.dev/docs/components/tabs)
|
|
69
84
|
- **Textarea**: `ng g mimi textarea` · [documentación](https://ng.mimiworks.dev/docs/components/input)
|
|
85
|
+
- **Toast**: `ng g mimi toast` · [documentación](https://ng.mimiworks.dev/docs/components/toast)
|
|
86
|
+
- **Toolbar**: `ng g mimi toolbar` · [documentación](https://ng.mimiworks.dev/docs/components/toolbar)
|
|
87
|
+
- **Tooltip**: `ng g mimi tooltip` · [documentación](https://ng.mimiworks.dev/docs/components/tooltip)
|
|
70
88
|
|
|
71
89
|
## Tus cambios
|
|
72
90
|
|
package/dist/collection.json
CHANGED
package/dist/init/css.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findTailwindImport = findTailwindImport;
|
|
4
4
|
exports.insertAfterTailwind = insertAfterTailwind;
|
|
5
|
+
exports.insertAfterTheme = insertAfterTheme;
|
|
5
6
|
exports.hasDirective = hasDirective;
|
|
6
7
|
/** `@import "tailwindcss";` o `@import 'tailwindcss' source(none);`, en su propia línea. */
|
|
7
8
|
const TAILWIND_IMPORT = /^[ \t]*@import\s+(["'])tailwindcss\1([^;\n]*);[^\n]*$/m;
|
|
@@ -25,6 +26,22 @@ function insertAfterTailwind(css, lines) {
|
|
|
25
26
|
const insert = lines.map((line) => eol + line).join('');
|
|
26
27
|
return css.slice(0, found.end) + insert + css.slice(found.end);
|
|
27
28
|
}
|
|
29
|
+
/** `@import` del tema de Mimi (`…/theme/theme-base.css`), en su propia línea. */
|
|
30
|
+
const THEME_IMPORT = /^[ \t]*@import\s+(["'])[^"'\n]*theme-base\.css\1[^;\n]*;[^\n]*$/m;
|
|
31
|
+
/**
|
|
32
|
+
* Inserta líneas después del `@import` del tema o, si no está, después del de Tailwind.
|
|
33
|
+
* Devuelve null si no hay ninguno de los dos (no se sabe dónde ponerlas).
|
|
34
|
+
*/
|
|
35
|
+
function insertAfterTheme(css, lines) {
|
|
36
|
+
const theme = THEME_IMPORT.exec(css);
|
|
37
|
+
if (!theme)
|
|
38
|
+
return findTailwindImport(css) ? insertAfterTailwind(css, lines) : null;
|
|
39
|
+
if (lines.length === 0)
|
|
40
|
+
return css;
|
|
41
|
+
const end = theme.index + theme[0].length;
|
|
42
|
+
const eol = eolOf(css);
|
|
43
|
+
return css.slice(0, end) + lines.map((line) => eol + line).join('') + css.slice(end);
|
|
44
|
+
}
|
|
28
45
|
/** ¿Ya hay un `@import` o `@source` con esa ruta (con comillas simples o dobles)? */
|
|
29
46
|
function hasDirective(css, directive, path) {
|
|
30
47
|
const escaped = path.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
package/dist/init/index.js
CHANGED
|
@@ -9,11 +9,10 @@ const registry_1 = require("../registry");
|
|
|
9
9
|
const project_1 = require("../utils/project");
|
|
10
10
|
const write_files_1 = require("../utils/write-files");
|
|
11
11
|
const css_1 = require("./css");
|
|
12
|
+
const items_1 = require("./items");
|
|
12
13
|
const paths_1 = require("./paths");
|
|
13
14
|
/** Alias que usan todos los componentes. Lo configurable es la carpeta a la que apunta. */
|
|
14
15
|
exports.ALIAS = '@/components/ui/*';
|
|
15
|
-
/** Ítems del registro que copia init: el tema y las utilidades base. */
|
|
16
|
-
const INIT_ITEMS = ['theme', 'utils/cn', 'utils/control-styles'];
|
|
17
16
|
/** Paquetes que instala init (versiones del registro). */
|
|
18
17
|
const INIT_PACKAGES = ['clsx', 'tailwind-merge', 'class-variance-authority'];
|
|
19
18
|
const ICONS_PACKAGE = '@lucide/angular';
|
|
@@ -35,7 +34,7 @@ function init(options) {
|
|
|
35
34
|
const report = (0, write_files_1.emptyReport)();
|
|
36
35
|
return (0, schematics_1.chain)([
|
|
37
36
|
(0, write_files_1.writeTemplates)({
|
|
38
|
-
|
|
37
|
+
items: items_1.INIT_ITEMS.flatMap((item) => (0, registry_1.resolveItems)(item)),
|
|
39
38
|
componentsDir: plan.componentsDir,
|
|
40
39
|
overwrite: options.overwrite ?? false,
|
|
41
40
|
version: registry_1.registry.version,
|
|
@@ -219,7 +218,7 @@ function writeMimiConfig(plan) {
|
|
|
219
218
|
if (plan.mimiConfig)
|
|
220
219
|
return;
|
|
221
220
|
const config = {
|
|
222
|
-
style: '
|
|
221
|
+
style: 'mimi',
|
|
223
222
|
tailwind: { css: plan.cssPath },
|
|
224
223
|
aliases: {
|
|
225
224
|
components: plan.componentsDir,
|
|
@@ -270,10 +269,13 @@ function nextSteps(plan, report, icons) {
|
|
|
270
269
|
for (const file of report.overwritten) {
|
|
271
270
|
context.logger.info(`Reemplazado: ${plan.componentsDir}/${file}`);
|
|
272
271
|
}
|
|
273
|
-
const itemOf = (file) => INIT_ITEMS.find((item) => registry_1.registry.items[item].files.includes(file)) ?? file;
|
|
272
|
+
const itemOf = (file) => items_1.INIT_ITEMS.find((item) => registry_1.registry.items[item].files.includes(file)) ?? file;
|
|
274
273
|
for (const message of (0, write_files_1.updatedMessages)(report, itemOf, registry_1.registry.version)) {
|
|
275
274
|
context.logger.info(message);
|
|
276
275
|
}
|
|
276
|
+
for (const message of (0, write_files_1.blockedMessages)(report, plan.componentsDir, registry_1.registry.version)) {
|
|
277
|
+
context.logger.warn(message);
|
|
278
|
+
}
|
|
277
279
|
if (!plan.changed && !(0, write_files_1.hasFileChanges)(report)) {
|
|
278
280
|
context.logger.info('Mimi ya estaba configurado; no hubo cambios.');
|
|
279
281
|
return;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.INIT_ITEMS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Ítems del registro que copia init: el tema y las utilidades base. `ng g mimi` también los
|
|
6
|
+
* revisa (y los actualiza si el usuario no los modificó), para que el tema no quede en una
|
|
7
|
+
* versión anterior a la de los componentes.
|
|
8
|
+
*/
|
|
9
|
+
exports.INIT_ITEMS = ['theme', 'utils/cn', 'utils/control-styles'];
|
package/dist/ng-add/index.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseIcons = parseIcons;
|
|
3
4
|
exports.ngAdd = ngAdd;
|
|
4
5
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
/**
|
|
7
|
+
* Antes de instalar el paquete, `ng add` no conoce este esquema y pasa `--icons=false` y
|
|
8
|
+
* `--icons=true` como texto (tarea 0.1.1-1). Se convierten aquí, porque init vuelve a validar
|
|
9
|
+
* con su esquema booleano.
|
|
10
|
+
*/
|
|
11
|
+
function parseIcons(icons) {
|
|
12
|
+
if (icons === undefined || typeof icons === 'boolean')
|
|
13
|
+
return icons;
|
|
14
|
+
if (icons === 'true')
|
|
15
|
+
return true;
|
|
16
|
+
if (icons === 'false')
|
|
17
|
+
return false;
|
|
18
|
+
throw new schematics_1.SchematicsException(`--icons acepta true o false (se recibió "${icons}").`);
|
|
19
|
+
}
|
|
5
20
|
/** `ng add @mimi-ng/cli`: ejecuta init con las mismas opciones. */
|
|
6
21
|
function ngAdd(options) {
|
|
7
|
-
|
|
22
|
+
const icons = parseIcons(options.icons);
|
|
23
|
+
return (0, schematics_1.schematic)('init', { ...options, icons });
|
|
8
24
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "MimiNgAdd",
|
|
4
|
+
"title": "Mimi ng-add",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Proyecto de angular.json. Solo hace falta si el workspace tiene varias aplicaciones.",
|
|
10
|
+
"$default": { "$source": "projectName" }
|
|
11
|
+
},
|
|
12
|
+
"icons": {
|
|
13
|
+
"type": ["boolean", "string"],
|
|
14
|
+
"description": "Instala @lucide/angular para tus íconos. Acepta también \"true\" y \"false\": antes de instalar el paquete, ng add pasa --icons=false como texto.",
|
|
15
|
+
"default": false,
|
|
16
|
+
"x-prompt": {
|
|
17
|
+
"message": "¿Quieres instalar @lucide/angular para tus íconos? (recomendado)",
|
|
18
|
+
"type": "confirmation"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"overwrite": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"description": "Reemplaza los archivos de Mimi que ya existan con otro contenido.",
|
|
24
|
+
"default": false
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
package/dist/registry.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.2.0",
|
|
3
3
|
"suggestedDependencies": {
|
|
4
4
|
"@lucide/angular": "^1.47.0"
|
|
5
5
|
},
|
|
@@ -29,6 +29,29 @@
|
|
|
29
29
|
"@angular/forms": "^22.0.0"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
+
"utils/overlay": {
|
|
33
|
+
"type": "util",
|
|
34
|
+
"files": [
|
|
35
|
+
"utils/overlay.ts"
|
|
36
|
+
],
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@angular/cdk": "^22.2.0"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"menu": {
|
|
42
|
+
"type": "util",
|
|
43
|
+
"files": [
|
|
44
|
+
"components/menu/menu.ts",
|
|
45
|
+
"components/menu/index.ts"
|
|
46
|
+
],
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@angular/aria": "^22.2.0"
|
|
49
|
+
},
|
|
50
|
+
"registryDependencies": [
|
|
51
|
+
"utils/cn",
|
|
52
|
+
"utils/overlay"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
32
55
|
"theme": {
|
|
33
56
|
"type": "theme",
|
|
34
57
|
"files": [
|
|
@@ -106,6 +129,148 @@
|
|
|
106
129
|
"utils/field-state"
|
|
107
130
|
]
|
|
108
131
|
},
|
|
132
|
+
"confirm": {
|
|
133
|
+
"type": "component",
|
|
134
|
+
"files": [
|
|
135
|
+
"components/confirm/confirm.ts",
|
|
136
|
+
"components/confirm/confirm-texts.ts",
|
|
137
|
+
"components/confirm/index.ts"
|
|
138
|
+
],
|
|
139
|
+
"registryDependencies": [
|
|
140
|
+
"button",
|
|
141
|
+
"dialog",
|
|
142
|
+
"utils/cn"
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
"context-menu": {
|
|
146
|
+
"type": "component",
|
|
147
|
+
"files": [
|
|
148
|
+
"components/context-menu/context-menu.ts",
|
|
149
|
+
"components/context-menu/index.ts"
|
|
150
|
+
],
|
|
151
|
+
"peerDependencies": {
|
|
152
|
+
"@angular/cdk": "^22.2.0"
|
|
153
|
+
},
|
|
154
|
+
"cssImports": [
|
|
155
|
+
"@angular/cdk/overlay-prebuilt.css"
|
|
156
|
+
],
|
|
157
|
+
"registryDependencies": [
|
|
158
|
+
"menu",
|
|
159
|
+
"utils/overlay"
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
"dialog": {
|
|
163
|
+
"type": "component",
|
|
164
|
+
"files": [
|
|
165
|
+
"components/dialog/dialog.ts",
|
|
166
|
+
"components/dialog/dialog-texts.ts",
|
|
167
|
+
"components/dialog/index.ts"
|
|
168
|
+
],
|
|
169
|
+
"peerDependencies": {
|
|
170
|
+
"@angular/cdk": "^22.2.0"
|
|
171
|
+
},
|
|
172
|
+
"cssImports": [
|
|
173
|
+
"@angular/cdk/overlay-prebuilt.css"
|
|
174
|
+
],
|
|
175
|
+
"registryDependencies": [
|
|
176
|
+
"utils/cn",
|
|
177
|
+
"utils/control-styles",
|
|
178
|
+
"utils/overlay"
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
"tabs": {
|
|
182
|
+
"type": "component",
|
|
183
|
+
"files": [
|
|
184
|
+
"components/tabs/tabs.ts",
|
|
185
|
+
"components/tabs/index.ts"
|
|
186
|
+
],
|
|
187
|
+
"dependencies": {
|
|
188
|
+
"class-variance-authority": "^0.7.1"
|
|
189
|
+
},
|
|
190
|
+
"peerDependencies": {
|
|
191
|
+
"@angular/aria": "^22.2.0"
|
|
192
|
+
},
|
|
193
|
+
"registryDependencies": [
|
|
194
|
+
"utils/cn",
|
|
195
|
+
"utils/control-styles"
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
"toast": {
|
|
199
|
+
"type": "component",
|
|
200
|
+
"files": [
|
|
201
|
+
"components/toast/toast.ts",
|
|
202
|
+
"components/toast/toast-config.ts",
|
|
203
|
+
"components/toast/toast-texts.ts",
|
|
204
|
+
"components/toast/index.ts"
|
|
205
|
+
],
|
|
206
|
+
"dependencies": {
|
|
207
|
+
"class-variance-authority": "^0.7.1"
|
|
208
|
+
},
|
|
209
|
+
"peerDependencies": {
|
|
210
|
+
"@angular/cdk": "^22.2.0"
|
|
211
|
+
},
|
|
212
|
+
"registryDependencies": [
|
|
213
|
+
"button",
|
|
214
|
+
"utils/cn",
|
|
215
|
+
"utils/control-styles",
|
|
216
|
+
"utils/overlay"
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
"pagination": {
|
|
220
|
+
"type": "component",
|
|
221
|
+
"files": [
|
|
222
|
+
"components/pagination/pagination.ts",
|
|
223
|
+
"components/pagination/pagination-page-size.ts",
|
|
224
|
+
"components/pagination/pagination-texts.ts",
|
|
225
|
+
"components/pagination/index.ts"
|
|
226
|
+
],
|
|
227
|
+
"dependencies": {
|
|
228
|
+
"class-variance-authority": "^0.7.1"
|
|
229
|
+
},
|
|
230
|
+
"peerDependencies": {
|
|
231
|
+
"@angular/cdk": "^22.2.0"
|
|
232
|
+
},
|
|
233
|
+
"registryDependencies": [
|
|
234
|
+
"button",
|
|
235
|
+
"input",
|
|
236
|
+
"select",
|
|
237
|
+
"utils/cn"
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
"toolbar": {
|
|
241
|
+
"type": "component",
|
|
242
|
+
"files": [
|
|
243
|
+
"components/toolbar/toolbar.ts",
|
|
244
|
+
"components/toolbar/index.ts"
|
|
245
|
+
],
|
|
246
|
+
"dependencies": {
|
|
247
|
+
"class-variance-authority": "^0.7.1"
|
|
248
|
+
},
|
|
249
|
+
"peerDependencies": {
|
|
250
|
+
"@angular/cdk": "^22.2.0"
|
|
251
|
+
},
|
|
252
|
+
"registryDependencies": [
|
|
253
|
+
"utils/cn",
|
|
254
|
+
"utils/control-styles"
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
"dropdown-menu": {
|
|
258
|
+
"type": "component",
|
|
259
|
+
"files": [
|
|
260
|
+
"components/dropdown-menu/dropdown-menu.ts",
|
|
261
|
+
"components/dropdown-menu/index.ts"
|
|
262
|
+
],
|
|
263
|
+
"peerDependencies": {
|
|
264
|
+
"@angular/cdk": "^22.2.0"
|
|
265
|
+
},
|
|
266
|
+
"cssImports": [
|
|
267
|
+
"@angular/cdk/overlay-prebuilt.css"
|
|
268
|
+
],
|
|
269
|
+
"registryDependencies": [
|
|
270
|
+
"menu",
|
|
271
|
+
"utils/overlay"
|
|
272
|
+
]
|
|
273
|
+
},
|
|
109
274
|
"form-field": {
|
|
110
275
|
"type": "component",
|
|
111
276
|
"files": [
|
|
@@ -135,6 +300,45 @@
|
|
|
135
300
|
"utils/field-state"
|
|
136
301
|
]
|
|
137
302
|
},
|
|
303
|
+
"popover": {
|
|
304
|
+
"type": "component",
|
|
305
|
+
"files": [
|
|
306
|
+
"components/popover/popover.ts",
|
|
307
|
+
"components/popover/index.ts"
|
|
308
|
+
],
|
|
309
|
+
"peerDependencies": {
|
|
310
|
+
"@angular/cdk": "^22.2.0"
|
|
311
|
+
},
|
|
312
|
+
"cssImports": [
|
|
313
|
+
"@angular/cdk/overlay-prebuilt.css"
|
|
314
|
+
],
|
|
315
|
+
"registryDependencies": [
|
|
316
|
+
"utils/cn",
|
|
317
|
+
"utils/overlay"
|
|
318
|
+
]
|
|
319
|
+
},
|
|
320
|
+
"select": {
|
|
321
|
+
"type": "component",
|
|
322
|
+
"files": [
|
|
323
|
+
"components/select/select.ts",
|
|
324
|
+
"components/select/select-texts.ts",
|
|
325
|
+
"components/select/index.ts"
|
|
326
|
+
],
|
|
327
|
+
"peerDependencies": {
|
|
328
|
+
"@angular/aria": "^22.2.0",
|
|
329
|
+
"@angular/cdk": "^22.2.0",
|
|
330
|
+
"@angular/forms": "^22.0.0"
|
|
331
|
+
},
|
|
332
|
+
"cssImports": [
|
|
333
|
+
"@angular/cdk/overlay-prebuilt.css"
|
|
334
|
+
],
|
|
335
|
+
"registryDependencies": [
|
|
336
|
+
"utils/cn",
|
|
337
|
+
"utils/control-styles",
|
|
338
|
+
"utils/field-state",
|
|
339
|
+
"utils/overlay"
|
|
340
|
+
]
|
|
341
|
+
},
|
|
138
342
|
"separator": {
|
|
139
343
|
"type": "component",
|
|
140
344
|
"files": [
|
|
@@ -174,6 +378,23 @@
|
|
|
174
378
|
"utils/field-state"
|
|
175
379
|
]
|
|
176
380
|
},
|
|
381
|
+
"tooltip": {
|
|
382
|
+
"type": "component",
|
|
383
|
+
"files": [
|
|
384
|
+
"components/tooltip/tooltip.ts",
|
|
385
|
+
"components/tooltip/index.ts"
|
|
386
|
+
],
|
|
387
|
+
"peerDependencies": {
|
|
388
|
+
"@angular/cdk": "^22.2.0"
|
|
389
|
+
},
|
|
390
|
+
"cssImports": [
|
|
391
|
+
"@angular/cdk/overlay-prebuilt.css"
|
|
392
|
+
],
|
|
393
|
+
"registryDependencies": [
|
|
394
|
+
"utils/cn",
|
|
395
|
+
"utils/overlay"
|
|
396
|
+
]
|
|
397
|
+
},
|
|
177
398
|
"textarea": {
|
|
178
399
|
"type": "component",
|
|
179
400
|
"files": [
|
|
@@ -117,7 +117,7 @@ export class MimiAvatarFallback {
|
|
|
117
117
|
|
|
118
118
|
protected readonly classes = computed(() =>
|
|
119
119
|
cn(
|
|
120
|
-
'flex size-full items-center justify-center rounded-
|
|
120
|
+
'flex size-full items-center justify-center rounded-[var(--mimi-avatar-radius,calc(infinity*1px))] bg-[color:var(--mimi-avatar-bg,var(--mimi-secondary))] font-semibold text-[color:var(--mimi-avatar-fg,var(--mimi-secondary-foreground))]',
|
|
121
121
|
this.userClass(),
|
|
122
122
|
// Al final: con la imagen cargada se oculta aunque el usuario pase `flex`.
|
|
123
123
|
this.avatar.status() === 'loaded' && 'hidden',
|
|
@@ -6,13 +6,13 @@ import { cva, type VariantProps } from 'class-variance-authority';
|
|
|
6
6
|
* default 40px / 14px, lg 56px / 18px (el tamaño de letra lo heredan las iniciales).
|
|
7
7
|
*/
|
|
8
8
|
export const avatarVariants = cva(
|
|
9
|
-
'relative inline-flex shrink-0 overflow-hidden rounded-
|
|
9
|
+
'relative inline-flex shrink-0 overflow-hidden rounded-[var(--mimi-avatar-radius,calc(infinity*1px))] bg-muted select-none',
|
|
10
10
|
{
|
|
11
11
|
variants: {
|
|
12
12
|
size: {
|
|
13
|
-
sm: 'size-
|
|
14
|
-
default: 'size-
|
|
15
|
-
lg: 'size-
|
|
13
|
+
sm: 'size-[var(--mimi-avatar-size-sm,2rem)] text-xs',
|
|
14
|
+
default: 'size-[var(--mimi-avatar-size,2.5rem)] text-sm',
|
|
15
|
+
lg: 'size-[var(--mimi-avatar-size-lg,3.5rem)] text-lg',
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
defaultVariants: { size: 'default' },
|
|
@@ -1,21 +1,56 @@
|
|
|
1
|
-
import { Directive, computed, input } from '@angular/core';
|
|
1
|
+
import { Directive, computed, input, isDevMode } from '@angular/core';
|
|
2
2
|
import { cn } from '@/components/ui/utils/cn';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type BadgeTone,
|
|
5
|
+
type BadgeVariant,
|
|
6
|
+
badgeVariants,
|
|
7
|
+
resolveBadgeStyle,
|
|
8
|
+
} from './badge.variants';
|
|
4
9
|
|
|
5
|
-
/**
|
|
10
|
+
/** El aviso de atajo + tone sale una sola vez por página. */
|
|
11
|
+
let warnedShortcutWithTone = false;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Etiqueta estática de Mimi sobre el `<span>` nativo: `<span mimiBadge>Nuevo</span>`.
|
|
15
|
+
*
|
|
16
|
+
* - `variant` (solid, soft, outline) y `tone` (primary, secondary, success, warning, info,
|
|
17
|
+
* danger). Sin `tone`, cada variante usa su tono natural: outline es neutro (secondary); las
|
|
18
|
+
* demás, primary. `data-variant` y `data-tone` muestran los valores resueltos.
|
|
19
|
+
* - Los atajos de la 0.1.0 (`default`, `secondary`, `destructive`) siguen funcionando y ganan
|
|
20
|
+
* sobre `tone` (en modo desarrollo, avisa una vez).
|
|
21
|
+
*/
|
|
6
22
|
@Directive({
|
|
7
23
|
selector: 'span[mimiBadge]',
|
|
8
24
|
exportAs: 'mimiBadge',
|
|
9
25
|
host: {
|
|
10
26
|
'[class]': 'classes()',
|
|
11
|
-
'[attr.data-variant]': '
|
|
27
|
+
'[attr.data-variant]': 'resolved().variant',
|
|
28
|
+
'[attr.data-tone]': 'resolved().tone',
|
|
12
29
|
},
|
|
13
30
|
})
|
|
14
31
|
export class MimiBadge {
|
|
15
|
-
|
|
32
|
+
/** Incluye los atajos de la 0.1.x (`BadgeVariantShortcut`, deprecados). */
|
|
33
|
+
readonly variant = input<BadgeVariant>('solid');
|
|
34
|
+
readonly tone = input<BadgeTone>();
|
|
16
35
|
readonly userClass = input('', { alias: 'class' });
|
|
17
36
|
|
|
37
|
+
protected readonly resolved = computed(() => {
|
|
38
|
+
const style = resolveBadgeStyle(this.variant(), this.tone());
|
|
39
|
+
if (style.ignoredTone && isDevMode() && !warnedShortcutWithTone) {
|
|
40
|
+
warnedShortcutWithTone = true;
|
|
41
|
+
console.warn(
|
|
42
|
+
`[Mimi] Badge: variant="${this.variant()}" ya define el color; se ignora ` +
|
|
43
|
+
`tone="${this.tone()}". Usa variant="${style.variant}" con tone (los atajos se ` +
|
|
44
|
+
`quitan en la 1.0).`,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return style;
|
|
48
|
+
});
|
|
49
|
+
|
|
18
50
|
protected readonly classes = computed(() =>
|
|
19
|
-
cn(
|
|
51
|
+
cn(
|
|
52
|
+
badgeVariants({ variant: this.resolved().variant, tone: this.resolved().tone }),
|
|
53
|
+
this.userClass(),
|
|
54
|
+
),
|
|
20
55
|
);
|
|
21
56
|
}
|