/** * Icons — what the components draw, and how that changes with the family. * * Everything here works off a catalog: the pair (declared families, translation * table). The local catalog is the bundled copy; the one that counts at runtime * comes from `/icons.json`. That indirection is what makes "support * material" a matter of publishing one more column in the registry, with no CLI * release and no hunting for `lucide` through the code. * * `extractIcons` reads which icons a source uses (the registry publishes this) * `retargetIcons` rewrites a source from one family to another (install uses it) * `iconPackagesFor` says which packages the project needs (init uses it) */ import { type IconFamily, type IconFamilyInfo } from './families.js'; export { ICON_CORE_PACKAGE, ICON_FAMILIES, SOURCE_ICON_FAMILY, type IconFamily, type IconFamilyInfo, } from './families.js'; export { ICON_MAP } from './icon-map.js'; /** An icon by what it means: `check`, `chevron-down`. */ export type IconToken = string; /** * The declared families and the table that translates between them. * * `icons` is keyed by token and then by family — the same shape as * `icon-map.ts`, which is the local copy of this same data. */ export interface IconCatalog { readonly families: Readonly>; readonly icons: Readonly>>>; } /** The catalog bundled with the CLI — used when the registry does not answer. */ export declare const LOCAL_ICON_CATALOG: IconCatalog; /** A list of icons in both forms: as the code writes them, and as the table names them. */ export interface IconList { /** The symbols as they appear in the code (`lucideCheck`). */ readonly symbols: string[]; /** The same icons under the table's neutral key (`check`). */ readonly tokens: IconToken[]; } /** * A component's icons, in the shape the registry publishes them. * * The two lists are separate because they serve different things: `symbols` and * `tokens` are what `add` writes into the project — the ng-icons dependency * comes from them — while `demos` are the icons that only appear in the * documentation examples. A component can draw no icon at all and still have * demos full of them, and switching family has to reach both. */ export interface ComponentIcons extends IconList { /** The family the published files are written in. */ readonly family: IconFamily; readonly demos: IconList; } export declare function iconFamilies(catalog?: IconCatalog): string[]; export declare function isIconFamily(value: string, catalog?: IconCatalog): boolean; export declare function iconFamily(family: IconFamily, catalog?: IconCatalog): IconFamilyInfo | undefined; /** The npm packages a project configured with this family needs. */ export declare function iconPackagesFor(family: IconFamily, catalog?: IconCatalog): string[]; export declare function tokenFor(symbol: string, family?: IconFamily, catalog?: IconCatalog): IconToken | undefined; export declare function symbolFor(token: IconToken, family: IconFamily, catalog?: IconCatalog): string | undefined; /** Tokens that have no symbol declared in this family yet. */ export declare function missingTokensFor(family: IconFamily, catalog?: IconCatalog): IconToken[]; /** * The icon symbols a source imports. * * Only the import counts. A stray `name="lucideCheck"` in a template draws * nothing without the matching `provideIcons`, so the import is at once the * complete list and the list without false positives — `@ng-icons/core` * (NgIcon, provideIcons, IconName) is left out because it is not a family. */ export declare function extractIcons(source: string, family?: IconFamily, catalog?: IconCatalog): string[]; /** The icons of a set of files, in both forms. */ export declare function listIcons(sources: readonly string[], family?: IconFamily, catalog?: IconCatalog): IconList; /** * A component's icon mapping, ready for the registry. * * It comes back filled in even when there is no icon at all: the field always * being present is what tells "this component draws no icons" apart from "this * registry was published before the mapping existed", so a reader never has to * guess which of the two it is. */ export declare function collectIcons(files: readonly string[], demos?: readonly string[], family?: IconFamily, catalog?: IconCatalog): ComponentIcons; export interface RetargetResult { readonly content: string; /** Symbols the target family does not declare — left untouched. */ readonly missing: string[]; } /** * Rewrites a source from one icon family to another. * * Two swaps: the package the symbols come from, and each symbol itself. A symbol * is replaced wherever it appears — the import, the `provideIcons({ lucideCheck })` * and the template's `name="lucideCheck"` are the same word, and the object * shorthand stays valid after the swap. * * A symbol with no equivalent in the target family is not invented: it stays as * it is and comes back in `missing`, so the caller can warn instead of writing * an import that does not resolve. */ export declare function retargetIcons(source: string, from: IconFamily, to: IconFamily, catalog?: IconCatalog): RetargetResult; /** * The mechanical half of the swap, separated from whatever decides what to swap. * * It is exported because this is where rewriting bugs live — whole-word * replacement and the order of the alternation — and because testing it does * not require more than one declared family. */ export declare function rewriteIcons(source: string, fromPackage: string, toPackage: string, replacements: ReadonlyMap): string; //# sourceMappingURL=index.d.ts.map