feat(packages): angular v17 dead end

This commit is contained in:
Karsa
2025-04-19 17:15:08 +02:00
parent 669f62bb64
commit 6c1e34df19
12 changed files with 3509 additions and 4776 deletions

View File

@@ -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 ![img](data:image/svg+xml;base64,${svgBase64}) - 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`)}
`;
};