Files
RuneStone/src/lib/ui/Icon.svelte
T
2026-11-03 00:23:07 -07:00

173 lines
7.4 KiB
Svelte

<script lang="ts">
import type { IconName } from "./IconButton.svelte";
import { actionIcons } from "./actionIcons";
let { icon }: { icon: IconName } = $props();
</script>
<svg viewBox="0 0 24 24" aria-hidden="true">
{#if icon === "settings"}
<path d="M9.5 6 10 3 14 3 14.5 6 15.95 6.83 18.79 5.77 20.79 9.23 18.45 11.17 18.45 12.83 20.79 14.77 18.79 18.23 15.95 17.17 14.5 18 14 21 10 21 9.5 18 8.05 17.17 5.21 18.23 3.21 14.77 5.55 12.83 5.55 11.17 3.21 9.23 5.21 5.77 8.05 6.83Z" /><circle cx="12" cy="12" r="3" />
{:else if icon === "sun"}
<circle cx="12" cy="12" r="4" /><path d="M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M5 19l1.5-1.5m11-11L19 5" />
{:else if icon === "git"}
{@html actionIcons.git}
{:else if icon === "globe"}
<circle cx="12" cy="12" r="9" /><ellipse cx="12" cy="12" rx="4" ry="9" /><path d="M3 12h18" />
{:else if icon === "arrow-left"}
<path d="M20 12H4m6-6-6 6 6 6" />
{:else if icon === "arrow-right"}
<path d="M4 12h16m-6-6 6 6-6 6" />
{:else if icon === "copy"}
<rect x="8" y="8" width="12" height="12" rx="2" /><path d="M16 8V4H4v12h4" />
{:else if icon === "duplicate"}
<rect x="8" y="8" width="12" height="12" rx="2" /><path d="M16 8V4H4v12h4M14 11v6M11 14h6" />
{:else if icon === "stop"}
<rect x="5" y="5" width="14" height="14" rx="2" />
{:else if icon === "help"}
<circle cx="12" cy="12" r="9" /><path d="M9.5 9a2.5 2.5 0 1 1 4 2c-1 .6-1.5 1-1.5 3M12 17h.01" />
{:else if icon === "puzzle"}
<path d="M9 3H4v6a3 3 0 1 1 0 6v5h6a3 3 0 1 1 6 0h4v-6a3 3 0 1 0 0-6V3h-5a3 3 0 1 1-6 0Z" />
{:else if icon === "up" || icon === "down" || icon === "kanban" || icon === "link" || icon === "zoom-in" || icon === "zoom-out"}
{@html actionIcons[icon]}
{:else if icon === "more"}
<circle cx="5" cy="12" r="1" /><circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" />
{:else if icon === "chevron-down"}
<path d="m6 9 6 6 6-6" />
{:else if icon === "chevrons-up-down"}
<path d="m7 15 5 5 5-5M7 9l5-5 5 5" />
{:else if icon === "scroll"}
<path d="M12 3v5m-3-2 3-3 3 3M12 21v-5m-3 2 3 3 3-3M3 12h5m-2-3-3 3 3 3M21 12h-5m2-3 3 3-3 3" /><circle cx="12" cy="12" r="1" />
{:else if icon === "maximize"}
<path d="M8 3H3v5M16 3h5v5M21 16v5h-5M8 21H3v-5" />
{:else if icon === "minimize"}
<path d="M5 12h14" />
{:else if icon === "window-maximize"}
<rect x="5" y="5" width="14" height="14" />
{:else if icon === "window-restore"}
<path d="M9 8V4h11v11h-4" /><rect x="4" y="9" width="11" height="11" />
{:else if icon === "check"}
<path d="M5 12.5 9.5 17 19 7" />
{:else if icon === "alert"}
<path d="M12 3 2.5 20h19Z" /><path d="M12 10v4M12 17h.01" />
{:else if icon === "palette"}
<path d="M12 3a9 9 0 0 0 0 18c1.1 0 1.6-.8 1.6-1.6 0-.5-.2-.8-.5-1.2-.3-.4-.5-.7-.5-1.2 0-.9.7-1.6 1.6-1.6H16a5 5 0 0 0 5-5c0-4.1-4-7.4-9-7.4Z" /><circle cx="7.5" cy="11" r="1" /><circle cx="10.5" cy="7.5" r="1" /><circle cx="15" cy="8" r="1" />
{:else if icon === "undo"}
<path d="M9 14 4 9l5-5" /><path d="M4 9h10.5a5.5 5.5 0 0 1 0 11H11" />
{:else if icon === "restore"}
<path d="M3 8h5V3M21 8h-5V3M16 21v-5h5M3 16h5v5" />
{:else if icon === "split"}
<rect x="3" y="4" width="18" height="16" rx="2" />
<path d="M12 4v16M6 8h3M6 12h3M15 8h3M15 12h3M15 16h3" />
{:else if icon === "text"}
<path d="M4 6h16M4 10h16M4 14h10M4 18h13" />
{:else if icon === "refresh"}
<path d="M20 7v5h-5M4 17v-5h5M6 7a7 7 0 0 1 12-1l2 3M4 15l2 3a7 7 0 0 0 12-1" />
{:else if icon === "folder-open"}
<path d="M6 14l1.5-2.9A2 2 0 0 1 9.2 10H20a2 2 0 0 1 1.8 2.8l-1.5 3.2A2 2 0 0 1 18.5 17H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h3.7a2 2 0 0 1 1.4.6L10 6h8a2 2 0 0 1 2 2" />
{:else if icon === "file-plus"}
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<path d="M14 2v6h6" />
<path d="M12 18v-6" />
<path d="M9 15h6" />
{:else if icon === "folder-plus"}
<path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.7-.9L9.2 3.9A2 2 0 0 0 7.5 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z" />
<path d="M12 10v6" />
<path d="M9 13h6" />
{:else if icon === "save"}
<path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" />
<path d="M17 21v-8H7v8" />
<path d="M7 3v5h8" />
{:else if icon === "pen"}
<path d="M12 20h9" />
<path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z" />
{:else if icon === "code"}
<path d="m16 18 6-6-6-6" />
<path d="m8 6-6 6 6 6" />
{:else if icon === "terminal"}
<path d="M4 5h16v14H4z" />
<path d="m8 9 3 3-3 3" />
<path d="M13 15h4" />
{:else if icon === "eye"}
<path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7-10-7-10-7Z" />
<circle cx="12" cy="12" r="3" />
{:else if icon === "panel-left"}
<path d="M4 5h16v14H4z" />
<path d="M9 5v14" />
{:else if icon === "panel-right"}
<path d="M4 5h16v14H4z" />
<path d="M15 5v14" />
{:else if icon === "spark"}
<path d="M12 3v4" />
<path d="M12 17v4" />
<path d="M5 12H3" />
<path d="M21 12h-2" />
<path d="m7 7 2 2" />
<path d="m15 15 2 2" />
<path d="m17 7-2 2" />
<path d="m9 15-2 2" />
{:else if icon === "list"}
<path d="M8 6h13" />
<path d="M8 12h13" />
<path d="M8 18h13" />
<path d="M3 6h.01" />
<path d="M3 12h.01" />
<path d="M3 18h.01" />
{:else if icon === "search"}
<circle cx="11" cy="11" r="7" />
<path d="m20 20-3-3" />
{:else if icon === "bookmark"}
<path d="M6 4h12v16l-6-3-6 3z" />
{:else if icon === "files"}
<path d="M4 6h9v14H4z" />
<path d="M8 6V4h9v14h-2" />
{:else if icon === "sort"}
<path d="m3 8 4-4 4 4" />
<path d="M7 4v16" />
<path d="m21 16-4 4-4-4" />
<path d="M17 20V4" />
{:else if icon === "fold"}
<path d="m7 11 5-5 5 5" />
<path d="m7 20 5-5 5 5" />
{:else if icon === "unfold"}
<path d="m7 4 5 5 5-5" />
<path d="m7 13 5 5 5-5" />
{:else if icon === "book-open"}
<path d="M12 7v13" />
<path d="M4 19a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h6a3 3 0 0 1 3 3" />
<path d="M12 7a3 3 0 0 1 3-3h6a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3" />
{:else if icon === "close"}
<path d="M6 6l12 12" />
<path d="M18 6l-12 12" />
{:else if icon === "trash"}
<path d="M4 7h16" />
<path d="M9 7V5h6v2" />
<path d="M6 7l1 13h10l1-13" />
{:else if icon === "plus"}
<path d="M12 5v14" />
<path d="M5 12h14" />
{:else if icon === "download"}
<path d="M12 4v11" /><path d="M7 10l5 5 5-5" /><path d="M5 20h14" />
{:else if icon === "upload"}
<path d="M12 20V9" /><path d="M7 14l5-5 5 5" /><path d="M5 4h14" />
{:else if icon === "minus"}
<path d="M5 12h14" />
{:else if icon === "toggle"}
<rect x="3" y="7" width="18" height="10" rx="5" /><circle cx="16" cy="12" r="2.5" />
{:else if icon === "fit-width"}
<path d="M3 4v16M21 4v16M7 12h10M10 9l-3 3 3 3M14 9l3 3-3 3" />
{:else if icon === "rotate"}
<path d="M20 7v5h-5" /><path d="M20 12a8 8 0 1 0-2 6" />
{/if}
</svg>
<style>
svg {
width: 16px;
height: 16px;
flex: 0 0 16px;
fill: none;
stroke: currentColor;
stroke-width: 1.6;
stroke-linecap: round;
stroke-linejoin: round;
}
</style>