/**
* TyIcon Web Component
* PORTED FROM: clj/ty/components/icon.cljs
* SVG icon component with size variants and animations
*/
import type { IconSize, IconTempo, TyIconElement } from '../types/common.js';
import { TyComponent } from '../base/ty-component.js';
import type { PropertyChange } from '../utils/property-manager.js';
import * as IconRegistry from '../utils/icon-registry.js';
/**
* Component internal state (for typing TyComponent)
*/
interface IconState {
name: string;
size: string;
spin: boolean;
pulse: boolean;
tempo: string;
}
/**
* Ty Icon Component
*
* @example
* ```html
*
*
*
* ```
*/
export declare class TyIcon extends TyComponent implements TyIconElement {
static formAssociated: boolean;
protected static properties: {
name: {
type: "string";
visual: boolean;
default: string;
};
size: {
type: "string";
visual: boolean;
default: string;
};
spin: {
type: "boolean";
visual: boolean;
default: boolean;
};
pulse: {
type: "boolean";
visual: boolean;
default: boolean;
};
tempo: {
type: "string";
visual: boolean;
default: string;
};
};
private _watchId;
/** Track currently rendered SVG to avoid unnecessary re-renders */
private _currentSvg;
/**
* Single shadow-DOM that holds either:
* - light-DOM children supplied by the user (server-side path: pasted SVG), or
* - fallback content driven by the registry (`name=`) or NOT_FOUND_ICON.
*
* Browser slot semantics handle precedence: when the host has assigned nodes,
* the slot's fallback content is hidden automatically — no detection logic needed.
*/
private _slot;
constructor();
/**
* Called when component connects to DOM
*/
protected onConnect(): void;
/**
* Called when component disconnects from DOM
*/
protected onDisconnect(): void;
/**
* Handle property changes - called BEFORE render
* Detects name changes to update icon registry watcher
*/
protected onPropertiesChanged(changes: PropertyChange[]): void;
get name(): string;
set name(value: string);
get size(): IconSize | undefined;
set size(value: IconSize | undefined);
get spin(): boolean;
set spin(value: boolean);
get pulse(): boolean;
set pulse(value: boolean);
get tempo(): IconTempo | undefined;
set tempo(value: IconTempo | undefined);
/** Build CSS classes for the host element */
private buildClasses;
/** Update host element classes */
private updateClasses;
/**
* Render the icon SVG
* Smart rendering strategy:
* 1. Check memory registry (instant)
* 2. If found in memory -> render immediately
* 3. If not in memory -> show NOT_FOUND_ICON immediately (prevents empty state)
* 4. Then check cache asynchronously and replace if found
* 5. Only re-render if SVG actually changed
*/
protected render(): void;
/**
* Update the slot's fallback content.
* If the user has slotted light-DOM children (e.g., raw