| 1 | // Iconos estilo VS Code, en SVG inline propio (sin dependencias). |
| 2 | // Archivos: insignia con la abreviatura y el color canónico del lenguaje. |
| 3 | const FILE_TYPES = { |
| 4 | js: ['JS', '#f1dd3f'], mjs: ['JS', '#f1dd3f'], cjs: ['JS', '#f1dd3f'], |
| 5 | ts: ['TS', '#3178c6'], tsx: ['TS', '#3178c6'], jsx: ['JS', '#61dafb'], |
| 6 | py: ['PY', '#4b8bbe'], rs: ['RS', '#dea584'], go: ['GO', '#00add8'], |
| 7 | java: ['J', '#e76f00'], c: ['C', '#659ad2'], h: ['H', '#659ad2'], |
| 8 | cpp: ['C+', '#f34b7d'], cs: ['C#', '#178600'], |
| 9 | json: ['{}', '#cbcb41'], yaml: ['Y', '#cb4b4b'], yml: ['Y', '#cb4b4b'], |
| 10 | toml: ['T', '#9c4221'], xml: ['<>', '#e37933'], |
| 11 | html: ['<>', '#e34c26'], css: ['#', '#9b7cf6'], scss: ['#', '#c6538c'], |
| 12 | md: ['M', '#519aba'], txt: ['≡', '#8b93a8'], csv: ['⊞', '#89e051'], |
| 13 | sh: ['$', '#89e051'], sql: ['DB', '#e38c00'], |
| 14 | svg: ['SV', '#ffb13b'], png: ['IMG', '#a074c4'], jpg: ['IMG', '#a074c4'], |
| 15 | gif: ['IMG', '#a074c4'], ico: ['IMG', '#a074c4'], |
| 16 | lock: ['🔒', '#8b93a8'], gitignore: ['GIT', '#f05033'], |
| 17 | }; |
| 18 | |
| 19 | export function fileIcon(name) { |
| 20 | const base = name.toLowerCase(); |
| 21 | const ext = base.startsWith('.git') ? 'gitignore' : (base.split('.').pop() || ''); |
| 22 | const [label, color] = FILE_TYPES[ext] || ['·', '#6b7391']; |
| 23 | const fontSize = label.length > 2 ? 5 : (label.length === 2 ? 6.5 : 8); |
| 24 | return `<svg class="fico" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"> |
| 25 | <rect x="1.5" y="1.5" width="13" height="13" rx="3" fill="${color}1f" stroke="${color}" stroke-width="1"/> |
| 26 | <text x="8" y="${label.length > 2 ? 10.4 : 10.8}" font-size="${fontSize}" text-anchor="middle" |
| 27 | fill="${color}" font-family="system-ui" font-weight="700">${label}</text></svg>`; |
| 28 | } |
| 29 | |
| 30 | export function folderIcon() { |
| 31 | return `<svg class="fico chev" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"> |
| 32 | <path class="chevron" d="M6 4.5 L10 8 L6 11.5" fill="none" stroke="#8b93a8" stroke-width="1.6" stroke-linecap="round"/> |
| 33 | </svg><svg class="fico" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"> |
| 34 | <path d="M1.5 4 a1 1 0 0 1 1-1 h3.2 l1.6 1.8 h6.2 a1 1 0 0 1 1 1 v6.7 a1 1 0 0 1 -1 1 h-11 a1 1 0 0 1 -1-1 Z" |
| 35 | fill="#dcb67a33" stroke="#dcb67a" stroke-width="1"/></svg>`; |
| 36 | } |
| 37 | |
| 38 | // Codicons de UI (estilo VS Code, sin emojis). Trazos con currentColor. |
| 39 | const ico = (p, sw = 1.6) => `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round">${p}</svg>`; |
| 40 | export const UI = { |
| 41 | clear: ico('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/><path d="M10 11v6M14 11v6"/>'), |
| 42 | history: ico('<circle cx="12" cy="13" r="8"/><path d="M12 9v4l3 2"/><path d="M5 3.5l1.5 2.5M19 3.5l-1.5 2.5"/>'), |
| 43 | gear: ico('<circle cx="12" cy="12" r="3"/><path d="M12 3v2.5M12 18.5V21M3 12h2.5M18.5 12H21M5.6 5.6l1.8 1.8M16.6 16.6l1.8 1.8M18.4 5.6l-1.8 1.8M7.4 16.6l-1.8 1.8"/>'), |
| 44 | send: ico('<path d="M4 12l16-8-6 16-3.5-6.5L4 12z"/>'), |
| 45 | add: ico('<path d="M12 5v14M5 12h14"/>', 1.8), |
| 46 | slash: ico('<path d="M15 5L9 19"/>', 1.8), |
| 47 | editor: ico('<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M12 4v16"/>'), |
| 48 | chat: ico('<path d="M4 5h16v11H9l-5 4z"/>'), |
| 49 | puzzle: ico('<path d="M10 4h4a1 1 0 0 1 1 1v2a1.5 1.5 0 1 0 3 0V6h2a1 1 0 0 1 1 1v4h-1a1.5 1.5 0 1 0 0 3h1v4a1 1 0 0 1-1 1h-4v-1a1.5 1.5 0 1 0-3 0v1H6a1 1 0 0 1-1-1v-4h1a1.5 1.5 0 1 0 0-3H5V7a1 1 0 0 1 1-1h4z"/>'), |
| 50 | close: ico('<path d="M6 6l12 12M18 6L6 18"/>', 1.8), |
| 51 | code: ico('<path d="M9 8l-5 4 5 4M15 8l5 4-5 4"/>'), |
| 52 | graph: `<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.6"><circle cx="6" cy="6" r="2.4"/><circle cx="18" cy="8" r="2.4"/><circle cx="12" cy="18" r="2.4"/><path d="M8 7l8 1M7 8l4 8M16 10l-3 6"/></svg>`, |
| 53 | city: `<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.6"><path d="M3 21h18"/><rect x="4" y="10" width="5" height="11"/><rect x="10" y="5" width="5" height="16"/><rect x="16" y="13" width="4" height="8"/></svg>`, |
| 54 | terminal: `<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.7"><rect x="3" y="4" width="18" height="16" rx="2"/><path d="M7 9l3 3-3 3M13 15h4"/></svg>`, |
| 55 | }; |
| 56 | |
| 57 | // Codicons de la barra de actividad (trazos simples estilo VS Code). |
| 58 | export const ACTIVITY = { |
| 59 | files: `<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"> |
| 60 | <path d="M7 4h7l4 4v12H7z"/><path d="M14 4v4h4"/><path d="M4 8v13h10" opacity=".55"/></svg>`, |
| 61 | search: `<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"> |
| 62 | <circle cx="10.5" cy="10.5" r="5.5"/><path d="M15 15l5 5"/></svg>`, |
| 63 | gear: `<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"> |
| 64 | <circle cx="12" cy="12" r="3"/><path d="M12 3v2.5M12 18.5V21M3 12h2.5M18.5 12H21M5.6 5.6l1.8 1.8M16.6 16.6l1.8 1.8M18.4 5.6l-1.8 1.8M7.4 16.6l-1.8 1.8"/></svg>`, |
| 65 | chat: `<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"> |
| 66 | <path d="M4 5h16v11H9l-5 4z"/></svg>`, |
| 67 | extensions: `<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"> |
| 68 | <path d="M3.5 9.5h6v6h-6zM3.5 15.5h6v6h-6zM9.5 15.5h6v6h-6z"/><path d="M14.2 6.2l4.3-4.3 4.3 4.3-4.3 4.3z"/></svg>`, |
| 69 | }; |