Files
2026-10-27 05:49:38 -05:00

49 lines
3.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
icons.js — inline SVG icons (stroke style, 24×24). icon(name, { size, fill }) → <svg>.
*/
import { h } from '../util.js';
const P = {
play: [['path', { d: 'M7 4.5v15a1 1 0 0 0 1.5.86l12.5-7.5a1 1 0 0 0 0-1.72L8.5 3.64A1 1 0 0 0 7 4.5z', fill: 'currentColor', stroke: 'none' }]],
info: [['circle', { cx: 12, cy: 12, r: 9.5 }], ['path', { d: 'M12 11v6M12 7.5v.01' }]],
plus: [['path', { d: 'M12 5v14M5 12h14' }]],
check: [['path', { d: 'M5 12.5l4.5 4.5L19 7.5' }]],
search: [['circle', { cx: 11, cy: 11, r: 7 }], ['path', { d: 'M20.5 20.5L16 16' }]],
settings: [['circle', { cx: 12, cy: 12, r: 3 }], ['path', { d: 'M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z' }]],
home: [['path', { d: 'M3 10.5L12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z' }]],
film: [['rect', { x: 3, y: 3, width: 18, height: 18, rx: 2.5 }], ['path', { d: 'M7 3v18M17 3v18M3 8h4M3 16h4M17 8h4M17 16h4M3 12h18' }]],
tv: [['rect', { x: 2.5, y: 6.5, width: 19, height: 13, rx: 2.5 }], ['path', { d: 'M8 2.5l4 4 4-4' }]],
bookmark: [['path', { d: 'M6 3.5h12a.5.5 0 0 1 .5.5v17l-6.5-4.5L5.5 21V4a.5.5 0 0 1 .5-.5z' }]],
share: [['circle', { cx: 18, cy: 5, r: 2.5 }], ['circle', { cx: 6, cy: 12, r: 2.5 }], ['circle', { cx: 18, cy: 19, r: 2.5 }], ['path', { d: 'M8.2 13.3l7.6 4.4M15.8 6.3l-7.6 4.4' }]],
trailer: [['rect', { x: 3, y: 4, width: 18, height: 16, rx: 2.5 }], ['path', { d: 'M10 9v6l5-3z', fill: 'currentColor' }]],
star: [['path', { d: 'M12 2.8l2.8 5.8 6.3.9-4.6 4.4 1.1 6.3L12 17.2l-5.6 3 1.1-6.3L2.9 9.5l6.3-.9z', fill: 'currentColor', stroke: 'none' }]],
close: [['path', { d: 'M6 6l12 12M18 6L6 18' }]],
left: [['path', { d: 'M15 18l-6-6 6-6' }]],
right: [['path', { d: 'M9 6l6 6-6 6' }]],
down: [['path', { d: 'M6 9l6 6 6-6' }]],
back: [['path', { d: 'M19 12H5M11 18l-6-6 6-6' }]],
trash: [['path', { d: 'M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3' }]],
user: [['circle', { cx: 12, cy: 8, r: 4 }], ['path', { d: 'M4 21c1.5-4 4.5-6 8-6s6.5 2 8 6' }]],
spark: [['path', { d: 'M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5L18 18M6 18l2.5-2.5M15.5 8.5L18 6' }]],
fire: [['path', { d: 'M12 22c4 0 7-2.7 7-6.6 0-3.6-2.4-5.7-4-8.4-.5 2-1.6 3.2-3 3.4.4-3-1-6-4-8.4.2 3.3-1.4 5.5-2.8 7.4C4.2 11 3 12.6 3 15.4 3 19.3 6 22 10 22z' }]],
list: [['path', { d: 'M8 6h13M8 12h13M8 18h13M3.5 6h.01M3.5 12h.01M3.5 18h.01' }]],
};
export function icon(name, opts = {}) {
const size = opts.size || 20;
const parts = P[name] || P.info;
return h('svg', {
class: ['icon', opts.class],
viewBox: '0 0 24 24',
width: size,
height: size,
fill: 'none',
stroke: 'currentColor',
'stroke-width': opts.stroke || 2,
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
'aria-hidden': 'true',
focusable: 'false',
}, parts.map(([tag, attrs]) => h(tag, attrs)));
}