Files
pterodactyl-panel/resources/scripts/components/elements/iconCatalog.ts
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

15 lines
653 B
TypeScript

import { icons, type LucideIcon } from 'lucide-react';
import names from '../../../../packages/sdk/icons.json';
// Import lazily only: this module pulls the whole lucide icon set into its chunk.
const catalog: Readonly<Record<string, LucideIcon | undefined>> = icons;
const known = new Set<string>(names);
const exportName = (name: string): string =>
name.replace(/(?:^|-)([a-z0-9])/g, (_match, letter: string) => letter.toUpperCase());
export const iconNames: readonly string[] = Object.freeze([...names]);
export function resolveIcon(name: string): LucideIcon | undefined {
return known.has(name) ? catalog[exportName(name)] : undefined;
}