A vibe coded tangled fork which supports pijul.
1import { h } from "preact";
2import iconNodes from "lucide-static/icon-nodes.json";
3
4interface IconProps {
5 size?: number;
6 color?: string;
7 strokeWidth?: number;
8}
9
10type IconNodeEntry = [string, Record<string, string | number>];
11
12function createIcon(name: string) {
13 const nodes = (iconNodes as unknown as Record<string, IconNodeEntry[]>)[name];
14 if (!nodes) throw new Error(`Icon "${name}" not found`);
15
16 return function Icon({
17 size = 24,
18 color = "currentColor",
19 strokeWidth = 2,
20 }: IconProps = {}) {
21 return h(
22 "svg",
23 {
24 xmlns: "http://www.w3.org/2000/svg",
25 width: size,
26 height: size,
27 viewBox: "0 0 24 24",
28 fill: "none",
29 stroke: color,
30 strokeWidth,
31 strokeLinecap: "round" as const,
32 strokeLinejoin: "round" as const,
33 },
34 nodes.map(([tag, attrs], i) => h(tag, { key: i, ...attrs })),
35 );
36 };
37}
38
39export const Star = createIcon("star");
40export const GitPullRequest = createIcon("git-pull-request");
41export const GitPullRequestClosed = createIcon("git-pull-request-closed");
42export const GitMerge = createIcon("git-merge");
43export const CircleDot = createIcon("circle-dot");
44export const Calendar = createIcon("calendar");
45export const MessageSquare = createIcon("message-square");
46export const MessageSquareCode = createIcon("message-square-code");
47export const Ban = createIcon("ban");
48export const SmilePlus = createIcon("smile-plus");
49export const FileDiff = createIcon("file-diff");
50export const RefreshCw = createIcon("refresh-cw");
51
52export type LucideIcon = typeof Star;