API Reference
Types
The shared types.
interface IconQuery {
library?: string
variant?: string
}
interface IconRequest {
name: string
variant?: string
}
interface ResolvedIcon {
tag: string
className?: string
html?: string
text?: string
}
interface IconSource {
resolveSync?(request: IconRequest): ResolvedIcon | undefined
resolve?(request: IconRequest): Promise<ResolvedIcon | undefined>
dispose?(): void
}
interface OverrideRequest extends IconRequest {
library?: string // the library the query would otherwise have gone to
}
type IconOverride = string | ((request: OverrideRequest) => string)
type LibraryConfig = IconSource | SvgLibraryOptions | FontLibraryOptions
interface Sigil {
readonly version: string
readonly defaultLibrary: string | null
readonly libraries: string[]
register(name: string, config: LibraryConfig, options?: { default?: boolean }): Promise<void>
unregister(name: string): void
use(name: string | null): void
override(name: string, icon: IconOverride | null): void
override(icons: Record<string, IconOverride | null>): void
getIconSync(name: string, query?: IconQuery): ResolvedIcon | undefined
getIcon(name: string, query?: IconQuery): Promise<ResolvedIcon | undefined>
subscribe(listener: () => void): () => void
clear(): void
}
All from @munsonlabs/sigil. SvgLibraryOptions and FontLibraryOptions are the config shapes on Sources; Sigil is the type of the shared sigil and of what createSigil() returns.