flaming-icons
Version:
Complete icon library with tree-shaking support for Vue and Vuetify
107 lines (100 loc) • 3.08 kB
TypeScript
/**
* Icon category for organizing icons logically
* Categories are automatically determined by folder structure:
* - "actions" for icons in src/svg/actions/
* - "actions/user" for icons in src/svg/actions/user/
* - "navigation" for icons in src/svg/navigation/
* - etc.
*/
declare type IconCategory = string;
/**
* Core icon definition interface
*
* Heavily inspired by Font Awesome's IconDefinition structure:
* Font Awesome Source: /js-packages/@fortawesome/free-solid-svg-icons/faUser.js
*
* Font Awesome's structure:
* {
* prefix: 'fas',
* iconName: 'user',
* icon: [width, height, aliases, unicode, svgPathData]
* }
*
* Our adaptation focuses on modern SVG usage patterns:
*/
declare interface IconDefinition {
/** Icon identifier (kebab-case, e.g., 'user-profile') */
name: IconName;
/** Category for logical grouping */
category: IconCategory;
/** SVG viewBox dimensions [x, y, width, height] */
viewBox: [number, number, number, number];
/** SVG path data - single string or array for complex icons */
path: IconPathData;
/** Alternative names for the icon (for search/backward compatibility) */
aliases?: string[];
/** Keywords for search functionality */
keywords?: string[];
/** Mark icon as deprecated (for migration warnings) */
deprecated?: boolean;
/** Version when icon was added */
since?: string;
/** Custom attributes for special styling needs */
attributes?: Record<string, string>;
}
declare class IconLibrary {
private icons;
/**
* Add icons to the library
*/
add(...icons: IconDefinition[]): void;
/**
* Find icon definition by name
*/
findIconDefinition(params: {
iconName: string;
}): IconDefinition | null;
/**
* Check if icon exists
*/
hasIcon(iconName: string): boolean;
/**
* Get all registered icons
*/
getIcons(): IconDefinition[];
/**
* Get icons by category
*/
getByCategory(category: string): IconDefinition[];
/**
* Get all available categories
*/
getCategories(): string[];
/**
* Clear all icons (for testing)
*/
clear(): void;
}
/**
* Icon Library Types
*
* Inspired by Font Awesome's type system:
* - Font Awesome Source: /js-packages/@fortawesome/fontawesome-common-types/index.d.ts
* - Font Awesome's IconDefinition interface provides the foundation for our icon structure
* - We've adapted their proven patterns for our specific use case
*/
/**
* Icon name type - represents valid icon identifiers
* Inspired by Font Awesome's IconName type pattern
*/
declare type IconName = string;
/**
* SVG Path data - can be single path or multiple paths for complex icons
* Similar to Font Awesome's svgPathData but supporting multiple paths
*/
declare type IconPathData = string | string[];
/**
* Global library instance
*/
export declare const library: IconLibrary;
export { }