@robosophy/ui-vue 1.1.12 → 1.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/ai-context.md +6 -3
- package/components.md +25 -4
- package/dist/components/RsIconPicker/RsIconPicker.types.d.ts +6 -0
- package/dist/components/RsIconPicker/RsIconPicker.types.d.ts.map +1 -0
- package/dist/components/RsIconPicker/RsIconPicker.vue.d.ts +13 -0
- package/dist/components/RsIconPicker/RsIconPicker.vue.d.ts.map +1 -0
- package/dist/components/RsIconPicker/iconCatalog.d.ts +2 -0
- package/dist/components/RsIconPicker/iconCatalog.d.ts.map +1 -0
- package/dist/components/RsIconPicker/index.d.ts +5 -0
- package/dist/components/RsIconPicker/index.d.ts.map +1 -0
- package/dist/components/RsSidebar/RsSidebar.vue.d.ts +2 -2
- package/dist/components/RsSidebar/RsSidebar.vue.d.ts.map +1 -1
- package/dist/icon-manifest.json +371 -1
- package/dist/index.css +74 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +546 -44
- package/dist/index.js.map +1 -1
- package/dist/vite.d.ts +2 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +256 -80
- package/dist/vite.js.map +1 -1
- package/icon-scanner.md +262 -167
- package/package.json +2 -2
package/icon-scanner.md
CHANGED
|
@@ -2,280 +2,373 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
`robosophyMaterialSymbols()` es un plugin de Vite que genera un sprite SVG con solo los
|
|
6
|
+
iconos de **Material Symbols** que tu codigo realmente usa. Sin fuentes tipograficas,
|
|
7
|
+
sin subset fonts, sin dependencias npm.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
It scans every `.vue`, `.ts`, `.tsx`, `.js`, `.jsx`, and `.mjs` file in the project's `src/` directory
|
|
11
|
-
(or custom `roots`), extracts icon names, families, and weights, then downloads the matching SVGs
|
|
12
|
-
from the Google Material Design Icons repository.
|
|
9
|
+
**Pipeline:**
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
```
|
|
12
|
+
source code → scan (8 patterns) → merge with manifest → download SVGs → inline SVG sprite
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
El scanner opera en **build time** y en **dev mode** (con file watching). Escanea archivos
|
|
16
|
+
`.vue`, `.ts`, `.tsx`, `.js`, `.jsx`, y `.mjs` del proyecto, extrae nombres de icono,
|
|
17
|
+
familias y pesos, y descarga los SVGs correspondientes del repositorio oficial de Google.
|
|
18
|
+
|
|
19
|
+
Los iconos que usan los componentes internos de la libreria (`RsSidebar`, `RsAccountSelector`,
|
|
20
|
+
etc.) se precargan en `dist/icon-manifest.json` durante el build del paquete y se fusionan
|
|
21
|
+
con los detectados en el proyecto consumidor.
|
|
19
22
|
|
|
20
23
|
---
|
|
21
24
|
|
|
22
|
-
##
|
|
25
|
+
## Quick Reference
|
|
26
|
+
|
|
27
|
+
| # | Pattern | Categoria | Detecta | Ejemplo |
|
|
28
|
+
|---|---------|-----------|---------|---------|
|
|
29
|
+
| 1 | `<RsIcon>` tag | Componente | `name` estatico + ternarias | `<RsIcon name="home" />` |
|
|
30
|
+
| 2 | `rsPrimeIcon()` | Componente | String literal en helper | `rsPrimeIcon("home")` |
|
|
31
|
+
| 3 | `icon:` property | Dato | Objeto con `icon:` key | `{ icon: "home" }` |
|
|
32
|
+
| 5 | Icon arrays | Dato | Array en variable `*icon*` | `const iconNames = ["home"]` |
|
|
33
|
+
| 5b | Icon objects | Dato | Objeto en variable `*icon*` | `const iconMap = { pc: "article" }` |
|
|
34
|
+
| 6a | Component icon prop | Cross-file | `icon=` en tag PascalCase | `<CustomButton icon="home" />` |
|
|
35
|
+
| 6b | Proxy components | Cross-file | Prop forwarding a `<RsIcon :name>` | `<ProxyIcon icon="home" />` |
|
|
36
|
+
| 4 | Magic comments | Fallback | Declaracion explicita | `// @robosophy-icon: home` |
|
|
23
37
|
|
|
24
|
-
|
|
25
|
-
Patterns 4 and 5 were added for cases that the original three could not handle.
|
|
38
|
+
---
|
|
26
39
|
|
|
27
|
-
|
|
40
|
+
## Automatic Detection
|
|
28
41
|
|
|
29
|
-
|
|
42
|
+
Estos 7 patrones se activan solos. No requieren configuracion manual, solo codigo fuente
|
|
43
|
+
donde los nombres de icono aparezcan como **string literals**.
|
|
30
44
|
|
|
31
|
-
|
|
32
|
-
`:family`, `weight`, `:weight`.
|
|
45
|
+
### Component Patterns
|
|
33
46
|
|
|
34
|
-
|
|
47
|
+
#### Pattern 1: `<RsIcon>` tag
|
|
48
|
+
|
|
49
|
+
**Regex:** `/ <RsIcon\b([\s\S]*?)>/g`
|
|
50
|
+
|
|
51
|
+
Detecta usos directos del componente `<RsIcon>` con `name` estatico, ternarias en `:name`,
|
|
52
|
+
template literals, y tags multi-linea. Soporta `family`, `:family`, `weight`, `:weight`.
|
|
53
|
+
|
|
54
|
+
**Detectado:**
|
|
35
55
|
```vue
|
|
36
56
|
<RsIcon name="home" />
|
|
37
57
|
<RsIcon name="home" family="rounded" />
|
|
38
|
-
<RsIcon :name="cond ? 'home' : 'settings'" family="rounded" />
|
|
39
|
-
<RsIcon
|
|
58
|
+
<RsIcon :name="cond ? 'home' : 'settings'" family="rounded" weight="200" />
|
|
59
|
+
<RsIcon
|
|
60
|
+
name="home"
|
|
61
|
+
family="rounded"
|
|
62
|
+
/>
|
|
63
|
+
<RsIcon :name="`home`" />
|
|
40
64
|
```
|
|
41
65
|
|
|
42
|
-
**
|
|
66
|
+
**No detectado** (variables en `:name`):
|
|
43
67
|
```vue
|
|
44
68
|
<RsIcon :name="iconVar" />
|
|
45
69
|
<RsIcon :name="item.icon" />
|
|
70
|
+
<RsIcon v-for="name in list" :name="name" />
|
|
46
71
|
```
|
|
47
72
|
|
|
48
|
-
|
|
73
|
+
> 💡 Si el binding tiene ternarias con string literals, ambas ramas se extraen.
|
|
74
|
+
> Si es solo una variable (`:name="iconProp"`), usa Pattern 3 en la fuente de datos
|
|
75
|
+
> o Magic Comments como ultimo recurso.
|
|
49
76
|
|
|
50
|
-
|
|
51
|
-
is extracted. For example `:name="cond ? 'add' : 'remove'"` extracts both `add` and `remove`.
|
|
77
|
+
---
|
|
52
78
|
|
|
53
|
-
|
|
54
|
-
like `:name="current_icon"`, the scanner no longer treats it as an icon name
|
|
55
|
-
(improvement 3, see changelog). Use `include` or magic comments for these cases.
|
|
79
|
+
#### Pattern 2: `rsPrimeIcon()` helper
|
|
56
80
|
|
|
57
|
-
|
|
81
|
+
**Regex:** `/\brsPrimeIcon\(\s*["'`]([a-z0-9_]+)["'`](?:\s*,\s*\{([^)]*)\})?/g`
|
|
58
82
|
|
|
59
|
-
|
|
83
|
+
Detecta el helper que PrimeVue usa como string de clases para `Button.icon`,
|
|
84
|
+
`MenuItem.icon`, etc. Soporta `family` opcional.
|
|
60
85
|
|
|
61
|
-
**
|
|
86
|
+
**Detectado:**
|
|
62
87
|
```ts
|
|
63
88
|
rsPrimeIcon("home")
|
|
64
89
|
rsPrimeIcon('settings', { family: 'rounded' })
|
|
90
|
+
rsPrimeIcon(`home`)
|
|
65
91
|
```
|
|
66
92
|
|
|
67
|
-
**
|
|
93
|
+
**No detectado:**
|
|
68
94
|
```ts
|
|
69
|
-
rsPrimeIcon(
|
|
95
|
+
rsPrimeIcon(variableName)
|
|
70
96
|
```
|
|
71
97
|
|
|
72
|
-
|
|
98
|
+
---
|
|
73
99
|
|
|
74
|
-
|
|
100
|
+
### Data Patterns
|
|
75
101
|
|
|
76
|
-
|
|
77
|
-
`family` from its body (using `findEnclosingObject`). Comments are stripped from the body
|
|
78
|
-
before searching for these properties.
|
|
102
|
+
#### Pattern 3: `icon:` property
|
|
79
103
|
|
|
80
|
-
**
|
|
104
|
+
**Regex:** `/\bicon\s*:\s*["'`]([a-z0-9_]+)["'`]/g`
|
|
105
|
+
|
|
106
|
+
Detecta objetos con una propiedad `icon:` y extrae `weight:` y `family:` del mismo objeto.
|
|
107
|
+
Usa `findEnclosingObject` para encontrar los limites del objeto, ignorando comentarios,
|
|
108
|
+
strings escapados y template literals.
|
|
109
|
+
|
|
110
|
+
**Detectado:**
|
|
81
111
|
```ts
|
|
82
112
|
const items = [
|
|
83
113
|
{ label: "Inbox", icon: "inbox" },
|
|
84
114
|
{ label: "Settings", icon: "settings", family: "rounded", weight: 200 },
|
|
85
|
-
|
|
115
|
+
{ icon: `home` },
|
|
116
|
+
]
|
|
86
117
|
```
|
|
87
118
|
|
|
88
|
-
**
|
|
119
|
+
**No detectado:**
|
|
89
120
|
```ts
|
|
90
|
-
|
|
91
|
-
{ icon }
|
|
92
|
-
{ ["icon"]: "home" }
|
|
121
|
+
{ icon: dynamicVar } // variable reference
|
|
122
|
+
{ icon } // shorthand property
|
|
123
|
+
{ ["icon"]: "home" } // computed property key
|
|
93
124
|
```
|
|
94
125
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
- Skips over strings, template literals, escaped quotes, and comments (`//` and `/* */`)
|
|
98
|
-
- Scans forward to find the matching `}`
|
|
99
|
-
- Returns the body content between `{` and `}`
|
|
100
|
-
- The body is then cleaned of comments before searching for `weight:` and `family:`
|
|
126
|
+
> 💡 Pattern 3 es la forma mas comun de declarar iconos en datos de navegacion.
|
|
127
|
+
> RsSidebar recibe `items` con `icon:` — se detecta automaticamente.
|
|
101
128
|
|
|
102
|
-
|
|
103
|
-
// This correctly reads weight=200 and family="rounded":
|
|
104
|
-
{ icon: "home", weight: 200, family: "rounded" }
|
|
105
|
-
|
|
106
|
-
// Comments are ignored:
|
|
107
|
-
{ /* weight: 200, family: "rounded" */ icon: "home" }
|
|
108
|
-
// → default weight 400, default family "outlined"
|
|
109
|
-
```
|
|
129
|
+
---
|
|
110
130
|
|
|
111
|
-
|
|
131
|
+
#### Pattern 5: Icon arrays
|
|
112
132
|
|
|
113
|
-
**Regex:**
|
|
133
|
+
**Regex:** `/(?:const|let|var)\s+(\w*[Ii]con\w*)\s*=\s*\[/g`
|
|
114
134
|
|
|
115
|
-
|
|
116
|
-
|
|
135
|
+
Detecta arrays asignados a variables cuyo nombre contiene "icon" (case-insensitive).
|
|
136
|
+
Extrae strings del nivel superior del array, incluyendo arrays anidados y template literals.
|
|
117
137
|
|
|
118
|
-
**
|
|
138
|
+
**Detectado:**
|
|
119
139
|
```ts
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// @robosophy-icon: manage_accounts family=rounded weight=200
|
|
124
|
-
|
|
125
|
-
const sidebarItems = [
|
|
126
|
-
{ id: "home", label: "Home", icon: "home" },
|
|
127
|
-
{ id: "settings", label: "Settings", icon: "settings" },
|
|
128
|
-
];
|
|
140
|
+
const iconNames = ["home", "settings", "info"]
|
|
141
|
+
const sidebarIcons = ["home", "search"]
|
|
142
|
+
const ICON_LIST = ["warning", "error"]
|
|
129
143
|
```
|
|
130
144
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
145
|
+
```ts
|
|
146
|
+
// Arrays anidados
|
|
147
|
+
const iconGroups = [
|
|
148
|
+
["home", "settings"], // ✅ detectados
|
|
149
|
+
"search" // ✅ detectado
|
|
150
|
+
]
|
|
151
|
+
```
|
|
138
152
|
|
|
139
|
-
|
|
153
|
+
**No detectado:**
|
|
154
|
+
```ts
|
|
155
|
+
const names = ["home", "settings"] // sin "icon" en nombre
|
|
156
|
+
const items = [{ icon: "home" }] // Pattern 3 lo cubre
|
|
157
|
+
```
|
|
140
158
|
|
|
141
|
-
|
|
159
|
+
---
|
|
142
160
|
|
|
143
|
-
|
|
161
|
+
#### Pattern 5b: Icon objects
|
|
144
162
|
|
|
145
|
-
|
|
163
|
+
**Regex:** `/(?:const|let|var)\s+(\w*[Ii]con\w*)[^=]*=\s*\{/g`
|
|
146
164
|
|
|
147
|
-
|
|
165
|
+
Detecta objetos literales asignados a variables con "icon" en el nombre y extrae todos
|
|
166
|
+
los string values que matchean el patron de nombre de icono. Soporta anotaciones de tipo
|
|
167
|
+
TypeScript (`: Record<K, V>`) y TypeScript generics con `<>`.
|
|
148
168
|
|
|
149
|
-
|
|
169
|
+
**Detectado:**
|
|
170
|
+
```ts
|
|
171
|
+
const variantIconMap: Record<string, string> = {
|
|
172
|
+
pc: "article",
|
|
173
|
+
alta: "account_circle",
|
|
174
|
+
cc: "account_balance_wallet",
|
|
175
|
+
cyo: "nest_eco_leaf",
|
|
176
|
+
}
|
|
177
|
+
```
|
|
150
178
|
|
|
151
|
-
**Detected:**
|
|
152
179
|
```ts
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
180
|
+
const iconConfig = {
|
|
181
|
+
default: "home",
|
|
182
|
+
active: "settings",
|
|
183
|
+
}
|
|
156
184
|
```
|
|
157
185
|
|
|
158
|
-
**
|
|
186
|
+
**No detectado:**
|
|
159
187
|
```ts
|
|
160
|
-
const names =
|
|
161
|
-
const items = [{ icon: "home" }]; // already handled by Pattern 3
|
|
188
|
+
const names = { key: "article" } // sin "icon" en nombre
|
|
162
189
|
```
|
|
163
190
|
|
|
164
|
-
|
|
165
|
-
|
|
191
|
+
> 💡 Pattern 5b fue creado especificamente para `variantIconMap` en RsSidebar,
|
|
192
|
+
> donde las claves son nombres de variante y los valores son iconos.
|
|
166
193
|
|
|
167
194
|
---
|
|
168
195
|
|
|
169
|
-
|
|
196
|
+
### Cross-file Patterns
|
|
170
197
|
|
|
171
|
-
|
|
172
|
-
|--------|------|---------|-------------|
|
|
173
|
-
| `include` | `IconInput[]` | `[]` | Icons to include regardless of detection. Each entry is a string (name) or `{ family, name, weight? }`. If weight is omitted, all valid weights (100-700) are included. |
|
|
174
|
-
| `scan` | `boolean` | `true` | Set to `false` to disable source scanning entirely. All icons must be in `include`. |
|
|
175
|
-
| `roots` | `string[]` | `["./src"]` | Directories to scan for icon usage. |
|
|
176
|
-
| `outputDir` | `string` | `"assets"` | Output directory for the SVG sprite. |
|
|
177
|
-
| `fontDisplay` | `string` | — | CSS `font-display` value. |
|
|
178
|
-
| `preload` | `boolean` | `false` | Preload the SVG sprite in the `<head>`. |
|
|
198
|
+
#### Pattern 6a: Component icon prop
|
|
179
199
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
## `icon-manifest.json`
|
|
200
|
+
**Regex:** `/<([A-Z][a-zA-Z0-9_]*)\b([\s\S]*?)>/g`
|
|
183
201
|
|
|
184
|
-
|
|
185
|
-
|
|
202
|
+
Detecta el atributo `icon`, `iconName` o `icon-name` en cualquier tag PascalCase
|
|
203
|
+
(excepto `<RsIcon>` que usa `name`). Funciona sin analisis cross-file.
|
|
186
204
|
|
|
187
|
-
**
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
"sharp": []
|
|
193
|
-
}
|
|
205
|
+
**Detectado:**
|
|
206
|
+
```vue
|
|
207
|
+
<CustomButton icon="home" />
|
|
208
|
+
<AnotherComponent iconName="settings" />
|
|
209
|
+
<ThirdThing icon-name="search" />
|
|
194
210
|
```
|
|
195
211
|
|
|
196
|
-
**
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
212
|
+
**No detectado:**
|
|
213
|
+
```vue
|
|
214
|
+
<RsIcon icon="home" /> <!-- RsIcon usa name, no icon -->
|
|
215
|
+
<CustomButton :icon="var" /> <!-- dynamic binding -->
|
|
216
|
+
```
|
|
201
217
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
even if the consuming project doesn't use those components. However, the manifest may
|
|
205
|
-
include icons that the consumer never uses (it's a conservative baseline). The plugin's
|
|
206
|
-
source scan adds only the icons that the consumer's own code references.
|
|
218
|
+
> 💡 Este patron es util cuando un componente expone un prop `icon` y el valor
|
|
219
|
+
> se pasa como string literal en el template del consumidor.
|
|
207
220
|
|
|
208
221
|
---
|
|
209
222
|
|
|
210
|
-
|
|
223
|
+
#### Pattern 6b: Proxy components
|
|
224
|
+
|
|
225
|
+
**Analisis en dos fases:**
|
|
211
226
|
|
|
212
|
-
|
|
227
|
+
1. **Fase 1** — Encuentra componentes que hacen forwarding de un prop a `<RsIcon>`:
|
|
228
|
+
- Tienen `defineProps` con al menos un prop
|
|
229
|
+
- Tienen `<RsIcon :name="propName">` donde `propName` es un prop
|
|
230
|
+
- Tienen `defineOptions({ name: "ComponentName" })`
|
|
231
|
+
2. **Fase 2** — Escanea los consumos de esos componentes y extrae valores del prop `icon`
|
|
213
232
|
|
|
233
|
+
**Detectado:**
|
|
234
|
+
|
|
235
|
+
Componente (`CustomIconButton.vue`):
|
|
214
236
|
```vue
|
|
215
|
-
|
|
216
|
-
|
|
237
|
+
<script setup lang="ts">
|
|
238
|
+
defineOptions({ name: "CustomIconButton" })
|
|
239
|
+
defineProps<{ icon: string }>()
|
|
240
|
+
</script>
|
|
241
|
+
<template>
|
|
242
|
+
<RsIcon :name="icon" />
|
|
243
|
+
</template>
|
|
244
|
+
```
|
|
217
245
|
|
|
218
|
-
|
|
219
|
-
|
|
246
|
+
Consumo (`App.vue`):
|
|
247
|
+
```vue
|
|
248
|
+
<CustomIconButton icon="home" /> <!-- ✅ detectado -->
|
|
249
|
+
<CustomIconButton icon="settings" /> <!-- ✅ detectado -->
|
|
220
250
|
```
|
|
221
251
|
|
|
222
|
-
|
|
252
|
+
**No detectado:**
|
|
253
|
+
- Componentes sin `defineProps`
|
|
254
|
+
- Componentes sin `defineOptions({ name: ... })`
|
|
255
|
+
- Props que no se pasan a `<RsIcon :name="prop">`
|
|
256
|
+
- Bindings dinamicos (`:icon="variable"`)
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Manual Fallbacks
|
|
261
|
+
|
|
262
|
+
Cuando ningun patron automatico detecta tu icono (ej: viene de una API, de un enum,
|
|
263
|
+
o de una variable calculada), tenes dos opciones. **Usalas solo cuando los patrones
|
|
264
|
+
automaticos no alcancen.**
|
|
223
265
|
|
|
224
|
-
|
|
225
|
-
1. Use `include` in the Vite plugin config
|
|
226
|
-
2. Add magic comments (`// @robosophy-icon: icon_name`) in the component file
|
|
227
|
-
3. Declare the icon in the same file as the data source (Pattern 3 will detect it)
|
|
266
|
+
### Magic comments (Pattern 4)
|
|
228
267
|
|
|
229
|
-
|
|
268
|
+
**Regex:** `/(?:\/\/|\/\*)\s*@robosophy-icon:\s*([a-z0-9_]+)/g`
|
|
269
|
+
|
|
270
|
+
Declara el icono explicitamente en el mismo archivo donde se usa:
|
|
230
271
|
|
|
231
272
|
```ts
|
|
232
|
-
|
|
273
|
+
// @robosophy-icon: manage_accounts
|
|
274
|
+
const item = { icon: props.iconName }
|
|
233
275
|
```
|
|
234
276
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
### Icon names in enums or constants
|
|
277
|
+
Soporta `family=` y `weight=` opcionales en la misma linea:
|
|
238
278
|
|
|
239
279
|
```ts
|
|
240
|
-
|
|
241
|
-
HOME = "home",
|
|
242
|
-
SETTINGS = "settings",
|
|
243
|
-
}
|
|
280
|
+
// @robosophy-icon: settings family=rounded weight=200
|
|
244
281
|
```
|
|
245
282
|
|
|
246
|
-
|
|
283
|
+
### `include` (plugin config)
|
|
247
284
|
|
|
248
|
-
|
|
285
|
+
Para iconos usados en muchos lugares o controlados por configuracion remota:
|
|
249
286
|
|
|
250
287
|
```ts
|
|
251
|
-
|
|
252
|
-
|
|
288
|
+
robosophyMaterialSymbols({
|
|
289
|
+
include: [
|
|
290
|
+
"home",
|
|
291
|
+
{ family: "rounded", name: "settings", weight: 200 },
|
|
292
|
+
],
|
|
293
|
+
})
|
|
253
294
|
```
|
|
254
295
|
|
|
255
|
-
|
|
296
|
+
Si se omite `weight`, se incluyen todos los pesos validos (100-700).
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Plugin Options
|
|
301
|
+
|
|
302
|
+
| Option | Type | Default | Description |
|
|
303
|
+
|--------|------|---------|-------------|
|
|
304
|
+
| `include` | `IconInput[]` | `[]` | Iconos forzados. String = nombre, objeto = `{ family?, name, weight? }` |
|
|
305
|
+
| `scan` | `boolean` | `true` | `false` desactiva el escaneo. Todos los iconos deben ir en `include` |
|
|
306
|
+
| `roots` | `string[]` | `["./src"]` | Directorios a escanear |
|
|
307
|
+
| `outputDir` | `string` | `"assets"` | Directorio de salida del sprite SVG |
|
|
308
|
+
| `fontDisplay` | `string` | — | CSS `font-display` |
|
|
309
|
+
| `preload` | `boolean` | `false` | Precarga el sprite en el `<head>` |
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## `icon-manifest.json`
|
|
314
|
+
|
|
315
|
+
Generado por `scripts/generate-icon-manifest.mjs` durante el build del paquete.
|
|
316
|
+
Escanea `src/components/` y produce `dist/icon-manifest.json`.
|
|
317
|
+
|
|
318
|
+
```json
|
|
319
|
+
{
|
|
320
|
+
"outlined": ["home", "search", "settings"],
|
|
321
|
+
"rounded": ["settings"],
|
|
322
|
+
"sharp": []
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
**Rol en el pipeline:**
|
|
327
|
+
1. Build genera el manifiesto desde los componentes de la libreria
|
|
328
|
+
2. Plugin de Vite carga el manifiesto como baseline
|
|
329
|
+
3. Plugin escanea el proyecto consumidor para iconos adicionales
|
|
330
|
+
4. Plugin descarga los SVGs del set combinado
|
|
331
|
+
|
|
332
|
+
El manifiesto asegura que los iconos de `RsSidebar`, `RsAccountSelector`, etc. esten
|
|
333
|
+
siempre disponibles, incluso si el proyecto consumidor no usa esos componentes.
|
|
256
334
|
|
|
257
335
|
---
|
|
258
336
|
|
|
259
337
|
## Best Practices
|
|
260
338
|
|
|
261
|
-
###
|
|
339
|
+
### Para escribir codigo que se detecta solo
|
|
262
340
|
|
|
263
|
-
1. **
|
|
264
|
-
2. **
|
|
265
|
-
3. **
|
|
266
|
-
4. **
|
|
267
|
-
5. **
|
|
341
|
+
1. **Usa `<RsIcon name="home" />`** — siempre detectado por Pattern 1
|
|
342
|
+
2. **Declara iconos en objetos con `icon:`** — Pattern 3 extrae automaticamente
|
|
343
|
+
3. **Nombra variables con "icon"** cuando almacenes nombres de icono — Patterns 5 y 5b se activan
|
|
344
|
+
4. **Pasa iconos como string literal** a componentes con prop `icon` — Pattern 6a lo detecta
|
|
345
|
+
5. **Usa `rsPrimeIcon("home")`** para PrimeVue — Pattern 2 lo cubre
|
|
268
346
|
|
|
269
|
-
###
|
|
347
|
+
### Para componentes que envuelven RsIcon
|
|
348
|
+
|
|
349
|
+
Si creas un componente que recibe un icono por prop y lo pasa a `<RsIcon :name>`:
|
|
350
|
+
|
|
351
|
+
- Usa `defineProps` con el nombre del prop tipado
|
|
352
|
+
- Usa `defineOptions({ name: "ComponentName" })` para registrar el nombre
|
|
353
|
+
- Pattern 6b lo detectara automaticamente
|
|
354
|
+
|
|
355
|
+
Ejemplo:
|
|
356
|
+
```vue
|
|
357
|
+
<script setup lang="ts">
|
|
358
|
+
defineOptions({ name: "MyIconButton" })
|
|
359
|
+
defineProps<{ icon: string }>()
|
|
360
|
+
</script>
|
|
361
|
+
<template>
|
|
362
|
+
<button><RsIcon :name="icon" /></button>
|
|
363
|
+
</template>
|
|
364
|
+
```
|
|
270
365
|
|
|
271
|
-
|
|
272
|
-
1. Check if it's statically detectable (direct string literal)
|
|
273
|
-
2. If not, add a magic comment near the usage
|
|
274
|
-
3. If the icon is used in many places, add it to the plugin config's `include`
|
|
366
|
+
### Cuando nada funciona
|
|
275
367
|
|
|
276
|
-
|
|
368
|
+
Usa magic comments o `include` — pero considera si podes reescribir el codigo para
|
|
369
|
+
que el scanner lo detecte automaticamente. Es menos mantenimiento a futuro.
|
|
277
370
|
|
|
278
|
-
|
|
371
|
+
### Testing de nombres
|
|
279
372
|
|
|
280
373
|
```
|
|
281
374
|
https://fonts.google.com/icons?icon.query=icon_name
|
|
@@ -287,7 +380,9 @@ https://fonts.google.com/icons?icon.query=icon_name
|
|
|
287
380
|
|
|
288
381
|
| Date | Change |
|
|
289
382
|
|------|--------|
|
|
383
|
+
| 2026-07-17 | Documentacion reestructurada: 8 patrones agrupados por categoria, automaticos primero |
|
|
384
|
+
| 2026-07-17 | **Pattern 5b** (icon objects), **Pattern 6a** (component icon prop), **Pattern 6b** (proxy components) added |
|
|
290
385
|
| 2026-07-13 | **Pattern 4** (magic comments) and **Pattern 5** (icon arrays) added |
|
|
291
|
-
| 2026-07-13 | `findEnclosingObject`:
|
|
292
|
-
| 2026-07-13 | `resolveNames`:
|
|
293
|
-
| 2026-07-13 | Pattern 3: weight
|
|
386
|
+
| 2026-07-13 | `findEnclosingObject`: ahora maneja comentarios, strings escapados y template literals |
|
|
387
|
+
| 2026-07-13 | `resolveNames`: bindings `:name` dinamicos ya no tratan nombres de variable como iconos |
|
|
388
|
+
| 2026-07-13 | Pattern 3: weight y family se extraen del objeto contenedor |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robosophy/ui-vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://robosophy.gitlab.io/robosophy-basf/robosophy-library/",
|
|
@@ -68,4 +68,4 @@
|
|
|
68
68
|
"vue-tsc": "^3.1.0"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {}
|
|
71
|
-
}
|
|
71
|
+
}
|