mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-22 22:29:23 +01:00
feat(packages): angular v17 dead end
This commit is contained in:
@@ -2,32 +2,64 @@
|
||||
import base64SVG from '@lucide/build-icons/utils/base64SVG.mjs';
|
||||
|
||||
export default async ({
|
||||
componentName,
|
||||
iconName,
|
||||
children,
|
||||
getSvg,
|
||||
deprecated,
|
||||
deprecationReason,
|
||||
}) => {
|
||||
componentName,
|
||||
iconName,
|
||||
children,
|
||||
getSvg,
|
||||
deprecated,
|
||||
deprecationReason,
|
||||
aliases = [],
|
||||
toPascalCase,
|
||||
}) => {
|
||||
const svgContents = await getSvg();
|
||||
const svgBase64 = base64SVG(svgContents);
|
||||
const angularComponentName = `Lucide${componentName}Component`;
|
||||
let names = {
|
||||
[iconName]: componentName,
|
||||
};
|
||||
|
||||
return `\
|
||||
import { LucideIconData } from './types';
|
||||
import { LucideAngularComponent } from '../lib/lucide-angular.component';
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
/**
|
||||
* @component @name ${componentName}
|
||||
* @description Lucide SVG icon component, renders SVG Element with children.
|
||||
*
|
||||
* @preview  - https://lucide.dev/icons/${iconName}
|
||||
* @see https://lucide.dev/guide/packages/lucide-vue-next - Documentation
|
||||
* @see https://lucide.dev/guide/packages/lucide-angular - Documentation
|
||||
*
|
||||
* @param {Object} props - Lucide icons props and any valid SVG attribute
|
||||
* @returns {FunctionalComponent} Vue component
|
||||
* ${deprecated ? `@deprecated ${deprecationReason}` : ''}
|
||||
*/
|
||||
const ${componentName}: LucideIconData = ${JSON.stringify(children)}; //eslint-disable-line no-shadow-restricted-names
|
||||
@Component({
|
||||
selector: 'lucide-${iconName}',
|
||||
template: '',
|
||||
standalone: true,
|
||||
})
|
||||
export class ${angularComponentName} extends LucideAngularComponent {
|
||||
override icon = ${JSON.stringify(children)} as LucideIconData;
|
||||
override name = '${iconName}';
|
||||
}
|
||||
|
||||
export default ${componentName};
|
||||
${aliases?.map(alias => {
|
||||
const aliasName = typeof alias === 'string' ? alias : alias.name;
|
||||
const aliasComponentName = toPascalCase(aliasName);
|
||||
|
||||
return `
|
||||
/**
|
||||
* @deprecated
|
||||
* @see ${angularComponentName}
|
||||
*/
|
||||
@Component({
|
||||
selector: 'lucide-${alias}',
|
||||
template: '',
|
||||
standalone: true,
|
||||
})
|
||||
export class Lucide${aliasComponentName}Component extends ${angularComponentName} {
|
||||
}
|
||||
`;
|
||||
}).join(`\n\n`)}
|
||||
`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user