fix(packages/lucide-angular): fix hasA11yProp import path (non-relative import path will not get properly resolved by ng-packagr)

This commit is contained in:
Karsa
2025-12-10 12:40:01 +01:00
parent c53decf3a1
commit bf3749502a

View File

@@ -12,7 +12,7 @@ import { LucideIconData } from '../icons/types';
import defaultAttributes from '../icons/constants/default-attributes'; import defaultAttributes from '../icons/constants/default-attributes';
import { LUCIDE_ICONS, LucideIconProviderInterface } from './lucide-icon.provider'; import { LUCIDE_ICONS, LucideIconProviderInterface } from './lucide-icon.provider';
import { LucideIconConfig } from './lucide-icon.config'; import { LucideIconConfig } from './lucide-icon.config';
import { hasA11yProp } from 'src/utils/hasA11yProp'; import { hasA11yProp } from '../utils/hasA11yProp';
interface TypedChange<T> extends SimpleChange { interface TypedChange<T> extends SimpleChange {
previousValue: T; previousValue: T;
@@ -52,7 +52,7 @@ export class LucideAngularComponent implements OnChanges {
@Inject(Renderer2) private renderer: Renderer2, @Inject(Renderer2) private renderer: Renderer2,
@Inject(ChangeDetectorRef) private changeDetector: ChangeDetectorRef, @Inject(ChangeDetectorRef) private changeDetector: ChangeDetectorRef,
@Inject(LUCIDE_ICONS) private iconProviders: LucideIconProviderInterface[], @Inject(LUCIDE_ICONS) private iconProviders: LucideIconProviderInterface[],
@Inject(LucideIconConfig) private iconConfig: LucideIconConfig, @Inject(LucideIconConfig) private iconConfig: LucideIconConfig
) { ) {
this.defaultSize = defaultAttributes.height; this.defaultSize = defaultAttributes.height;
} }
@@ -106,7 +106,7 @@ export class LucideAngularComponent implements OnChanges {
this.replaceElement(icoOfName); this.replaceElement(icoOfName);
} else { } else {
throw new Error( throw new Error(
`The "${nameOrIcon}" icon has not been provided by any available icon providers.`, `The "${nameOrIcon}" icon has not been provided by any available icon providers.`
); );
} }
} else if (Array.isArray(nameOrIcon)) { } else if (Array.isArray(nameOrIcon)) {
@@ -123,7 +123,7 @@ export class LucideAngularComponent implements OnChanges {
const childElements = this.elem.nativeElement.childNodes; const childElements = this.elem.nativeElement.childNodes;
const restAttributeMap: NamedNodeMap = this.elem.nativeElement.attributes; const restAttributeMap: NamedNodeMap = this.elem.nativeElement.attributes;
const restAttributes = Object.fromEntries( const restAttributes = Object.fromEntries(
Array.from(restAttributeMap).map((item) => [item.name, item.value]), Array.from(restAttributeMap).map((item) => [item.name, item.value])
); );
const hasChildren = childElements.length > 0; const hasChildren = childElements.length > 0;
@@ -155,7 +155,7 @@ export class LucideAngularComponent implements OnChanges {
...this.class ...this.class
.split(/ /) .split(/ /)
.map((a) => a.trim()) .map((a) => a.trim())
.filter((a) => a.length > 0), .filter((a) => a.length > 0)
); );
} }
@@ -168,7 +168,7 @@ export class LucideAngularComponent implements OnChanges {
toPascalCase(str: string): string { toPascalCase(str: string): string {
return str.replace( return str.replace(
/(\w)([a-z0-9]*)(_|-|\s*)/g, /(\w)([a-z0-9]*)(_|-|\s*)/g,
(g0, g1, g2) => g1.toUpperCase() + g2.toLowerCase(), (g0, g1, g2) => g1.toUpperCase() + g2.toLowerCase()
); );
} }
@@ -197,7 +197,7 @@ export class LucideAngularComponent implements OnChanges {
private createElement([tag, attrs, children = []]: readonly [ private createElement([tag, attrs, children = []]: readonly [
string, string,
SvgAttributes, SvgAttributes,
LucideIconData?, LucideIconData?
]) { ]) {
const element = this.renderer.createElement(tag, 'http://www.w3.org/2000/svg'); const element = this.renderer.createElement(tag, 'http://www.w3.org/2000/svg');