mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-09-02 07:58:40 +02:00
* fix(@lucide/svelte): proper doc comments for svelte components * Update license text --------- Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
35 lines
1018 B
TypeScript
35 lines
1018 B
TypeScript
import base64SVG from '@lucide/build-icons/utils/base64SVG';
|
|
import { getHTMLBanner } from './license.mts';
|
|
import defineExportTemplate from '@lucide/build-icons/utils/defineExportTemplate';
|
|
|
|
export default defineExportTemplate(
|
|
async ({ iconName, children, getSvg, deprecated, deprecationReason }) => {
|
|
const svgContents = await getSvg();
|
|
const svgBase64 = base64SVG(svgContents);
|
|
|
|
return `\
|
|
${getHTMLBanner()}
|
|
<script lang="ts">
|
|
import Icon from '../Icon.svelte';
|
|
import type { IconNode, IconProps } from '../types.js';
|
|
|
|
let props: IconProps = $props();
|
|
|
|
const iconNode: IconNode = ${JSON.stringify(children)};
|
|
</script>
|
|
|
|
<!--
|
|
@component
|
|
|
|
Lucide SVG icon component, renders SVG Element with children.
|
|
|
|
@preview  - https://lucide.dev/icons/${iconName}
|
|
@see https://lucide.dev/guide/packages/lucide-svelte - Documentation
|
|
${deprecated ? `\n@deprecated ${deprecationReason}\n` : ''}\
|
|
-->
|
|
|
|
<Icon name="${iconName}" {...props} iconNode={iconNode} />
|
|
`;
|
|
},
|
|
);
|