Registra componentes nuevos en la pagina Design System de Figma y los organiza por categoria. Usa cuando se crea un componente nuevo que debe agregarse a la libreria local, o cuando hay componentes sueltos que deben organizarse.
Registra, organiza y mantiene la libreria de componentes locales en la pagina "Design System" de Figma.
Todo componente creado durante el diseño de pantallas DEBE registrarse en la libreria local. Si no esta en Design System, no existe.
Los tokens DEBEN estar aplicados ANTES de componentizar. Si el archivo no tiene variables de color aplicadas, ejecutar
/token-syncprimero. Componentes sin tokens = componentes que habra que re-hacer cuando se tokenice.
Design System (pagina)
├── Seccion: Componentes Locales (SECTION frame)
│ ├── Categoría: Bars
│ │ └── {nombre} (COMPONENT_SET o COMPONENT)
│ ├── Categoría: Cards
│ │ └── {nombre} (COMPONENT_SET o COMPONENT)
│ ├── Categoría: Navigation
│ │ └── sidebar, menu, tabs, breadcrumbs...
│ ├── Categoría: Forms
│ │ └── input, select, checkbox, radio, switch...
│ ├── Categoría: Buttons
│ │ └── primary, secondary, icon buttons...
│ ├── Categoría: Layout
│ │ └── header, bg, divider, title...
│ └── Categoría: Modals
│ └── confirmation, form modals...
│
├── Componentes sueltos (mover a la seccion)
│
└── {Framework} Overrides (opcional)
└── Componentes que extienden la libreria UI externa
Nota: Las categorias se adaptan al proyecto. Descubrir los componentes existentes y organizarlos por tipo, no por nombre de proyecto.
// Buscar en toda la pagina Design System
const designSystem = figma.root.children.find(p => p.name === 'Design System');
const existing = designSystem.findAll(n =>
n.type === 'COMPONENT' && n.name.toLowerCase().includes(searchTerm)
);
Si ya existe → NO duplicar. Informar al usuario.
| Si el componente es... | Categoría |
|---|---|
| Row/fila de tabla con variantes | Bars |
| Tarjeta con contenido | Cards |
| Menu, sidebar, tab, breadcrumb | Navigation |
| Input, select, checkbox, radio, switch | Forms |
| Botón (cualquier tipo) | Buttons |
| Header, footer, divider, background | Layout |
| Diálogo/overlay | Modals |
| Otro | Misc (crear nueva categoría) |
// Si el elemento es un FRAME, convertirlo a COMPONENT
if (node.type === 'FRAME') {
// En Figma Plugin API: usar figma.createComponent() y copiar children
const component = figma.createComponent();
component.name = node.name;
component.resize(node.width, node.height);
// Copiar propiedades visuales
component.fills = node.fills;
component.strokes = node.strokes;
component.cornerRadius = node.cornerRadius;
// Mover children
for (const child of [...node.children]) {
component.appendChild(child);
}
// Reemplazar en el árbol
node.parent.insertChild(node.parent.children.indexOf(node), component);
node.remove();
}
Convención de naming:
- Componentes simples: kebab-case → "list-item", "product-card"
- Component sets: kebab-case → "primary button" con variantes
- Variantes: "Property=Value" → "State=Default", "State=Hover", "Size=Small"
NO usar:
- "Variant2", "Variant3" → usar nombres semánticos
- "Property 1=Default" → renombrar la propiedad
- Nombres genéricos: "Group 127", "Frame 159"
Si el componente tiene estados o variantes:
// via use_figma: agregar propiedades de componente
// Usar figma.variables.* o component.addComponentProperty() API
Actualizar el inventario del componente:
| Componente | Tipo | Variantes | Categoría | Node ID |
|---|---|---|---|---|
| {nombre} | COMPONENT/COMPONENT_SET | {N} | {categoría} | {id} |
Ancho total: 6000px (expandible)
Gap entre categorías: 200px vertical
Gap entre componentes: 80px horizontal, 40px vertical
Estructura visual:
┌─────────────────────────────────────────────────┐
│ TÍTULO: "Componentes Locales" (Section label) │
├─────────────────────────────────────────────────┤
│ │
│ ── Bars ──────────────────────────────────── │
│ [bar entret.] [bar restaur.] [bar serv.] │
│ [bar amenid.] [bar promos ] │
│ │
│ ── Cards ─────────────────────────────────── │
│ [card hotel] [card fotos] [dsct hotels] │
│ [foto-drag ] │
│ │
│ ── Navigation ────────────────────────────── │
│ [side bar] [item] [menu interno] │
│ [menu serv] [hoteles tab] │
│ │
│ ── Forms ─────────────────────────────────── │
│ [input] [select] [checkbox] [tab seo] │
│ │
│ ── Buttons ───────────────────────────────── │
│ [primary] [secondary] [secondary blue] │
│ │
│ ── Layout ────────────────────────────────── │
│ [base bar] [bg] [divisor] [titulo] │
│ │
│ ── Modals ────────────────────────────────── │
│ [modal amenid.] [modal preguntas] │
│ │
└─────────────────────────────────────────────────┘
// Algoritmo de posicionamiento
let currentX = sectionX + 40; // padding izquierdo
let currentY = sectionY + 80; // debajo del título de categoría
const maxWidth = 5000;
const hGap = 80;
const vGap = 40;
const categoryGap = 200;
for (const category of categories) {
// Título de categoría (texto)
createCategoryLabel(category.name, currentX, currentY);
currentY += 40;
let rowStartY = currentY;
let rowMaxHeight = 0;
for (const component of category.components) {
if (currentX + component.width > maxWidth) {
// Nueva fila
currentX = sectionX + 40;
currentY += rowMaxHeight + vGap;
rowMaxHeight = 0;
}
component.x = currentX;
component.y = currentY;
currentX += component.width + hGap;
rowMaxHeight = Math.max(rowMaxHeight, component.height);
}
currentY += rowMaxHeight + categoryGap;
currentX = sectionX + 40;
}
Si hay componentes fuera de "Componentes Locales" en la página Design System:
use_figma (findAll type=COMPONENT fuera de la sección)| Cuándo | Skill relacionado |
|---|---|
| Se crea pantalla nueva con componente nuevo | screen-creator → luego component-library-sync |
| Se detecta componente sin registrar | design-normalizer → luego component-library-sync |
| Se necesita mapear componente a código | component-library-sync → luego code-connect-bridge |
| Se crean variantes desde código | variant-generator → luego component-library-sync |
## Componente Registrado
- Nombre: {nombre}
- Tipo: COMPONENT / COMPONENT_SET
- Variantes: {lista de variantes}
- Categoría: {categoría}
- Node ID: {id}
- Página: Design System
## Posición
- Dentro de: Componentes Locales > {categoría}
- Coordenadas: x={x}, y={y}
## Acciones realizadas
- [ ] Convertido de FRAME a COMPONENT (si aplica)
- [ ] Nombrado correctamente
- [ ] Posicionado en categoría
- [ ] Propiedades de componente agregadas
- [ ] Sección expandida para contener nuevo componente
- [ ] Screenshot de validación tomado