// Tabler Icons (MIT), the set the webmail draws since it moved off Lucide. // Path data is copied from @tabler/icons tabler-nodes-outline.json so the // widgets use the same glyphs as the web UI. Widgets render them through // SvgWidget, which rasterises an SVG string. const OUTLINE = { mail: '', inbox: '', send: '', file: '', fileText: '', fileSpreadsheet: '', presentation: '', photo: '', folder: '', calendarClock: '', calendar: '', calendarPlain: '', archive: '', trash: '', ban: '', search: '', edit: '', addressBook: '', server: '', paperclip: '', star: '', message: '', mapPin: '', video: '', clock: '', check: '', plus: '', chevronLeft: '', chevronRight: '', users: '', lock: '', cake: '', beach: '', reply: '', checklist: '', upload: '', refresh: '', tag: '', } as const; const FILLED = { star: '', tag: '', } as const; export type IconName = keyof typeof OUTLINE; export type FilledIconName = keyof typeof FILLED; /** Splits `#rrggbbaa` into an SVG colour plus opacity; rgba() is passed through. */ function paint(color: string): { value: string; opacity: string } { const m = /^#([0-9a-f]{6})([0-9a-f]{2})$/i.exec(color); if (m) return { value: `#${m[1]}`, opacity: (parseInt(m[2], 16) / 255).toFixed(3) }; return { value: color, opacity: '1' }; } /** Outline Tabler icon as an SVG string (24 x 24 viewBox, stroke 2 like the web UI). */ export function icon(name: IconName, color: string, strokeWidth = 2): string { const { value, opacity } = paint(color); return ( `` + `${OUTLINE[name]}` ); } /** Filled Tabler icon (star, tag) as an SVG string. */ export function filledIcon(name: FilledIconName, color: string): string { const { value, opacity } = paint(color); return ( `${FILLED[name]}` ); } /** * A progress ring (quota, task progress, countdown). `fraction` is clamped to * 0..1; the arc starts at 12 o'clock like the webmail's quota ring. */ export function ring(fraction: number, track: string, fill: string, strokeWidth = 6): string { const f = Math.max(0, Math.min(1, Number.isFinite(fraction) ? fraction : 0)); const r = 32 - strokeWidth / 2; const c = 2 * Math.PI * r; const t = paint(track); const p = paint(fill); const arc = f > 0 ? `` : ''; return ( `` + `` + `${arc}` ); }