Files
lucide/packages/vue/scripts/exportTemplate.mts

37 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-06-18 17:07:38 +02:00
import base64SVG from '@lucide/build-icons/utils/base64SVG';
import defineExportTemplate from '@lucide/build-icons/utils/defineExportTemplate';
2025-06-18 15:39:13 +02:00
2025-06-18 17:07:38 +02:00
export default defineExportTemplate(async({
2025-06-18 15:39:13 +02:00
componentName,
iconName,
children,
getSvg,
deprecated,
deprecationReason,
}) => {
const svgContents = await getSvg();
const svgBase64 = base64SVG(svgContents);
return `
import createLucideIcon from '../createLucideIcon';
2025-06-18 17:07:38 +02:00
import { IconNode } from '../types';
export const __iconNode: IconNode = ${JSON.stringify(children)}
2025-06-18 15:39:13 +02:00
/**
* @component @name ${componentName}
* @description Lucide SVG icon component, renders SVG Element with children.
*
* @preview ![img](data:image/svg+xml;base64,${svgBase64}) - https://lucide.dev/icons/${iconName}
2025-06-18 17:07:38 +02:00
* @see https://lucide.dev/guide/packages/lucide-react - Documentation
2025-06-18 15:39:13 +02:00
*
* @param {Object} props - Lucide icons props and any valid SVG attribute
2025-06-18 17:07:38 +02:00
* @returns {JSX.Element} JSX Element
2025-06-18 15:39:13 +02:00
* ${deprecated ? `@deprecated ${deprecationReason}` : ''}
*/
2025-06-18 17:07:38 +02:00
const ${componentName} = createLucideIcon('${iconName}', __iconNode);
2025-06-18 15:39:13 +02:00
export default ${componentName};
`;
2025-06-18 17:07:38 +02:00
});