API Reference

Registry

The core functions.
FunctionDescription
register(name, config | source, { default? })Adds a library. Config shape picks the kind and loads it lazily; a source is stored as is. Returns a promise that resolves when live. Re-registering replaces
unregister(name)Removes a library, disposing it
override(name, markup | factory | null, { library? })Pins a name to markup, checked before any library. null removes. Also takes a record. { library } scopes the pin to one library's names
use(name | null)Sets the default library
getIconSync(name, query?)Override, else the library's resolveSync
getIcon(name, query?)getIconSync, else the library's resolve. A source that throws yields undefined, with a console.warn in development builds
subscribe(listener)Called after every change. Returns an unsubscribe
clear()Removes everything

query is { library?, variant? }.

Helpers

FunctionDescription
watchIcon(name, query, onIcon, registry?)Resolves sync-first, then async, and again on every registry change; late results are dropped. Returns stop(). What <ml-sigil-icon> and <Sigil> use
cached(source)Wraps a source so its answers are remembered per name and variant and served synchronously; concurrent requests share one resolution, failures retry
keepLibrary(name, config, registry?)Registers a library and puts it back whenever it goes missing, so unregister(name) from anywhere means "restore the default" rather than "gone for good". Does not override a host's own register(name, …) under the same name. Returns stop()

sigil

The shared instance behind those functions, with the same methods plus:

MemberDescription
defaultLibraryRead the current default
librariesRegistered names, in order
versionPackage version of the copy that created it

createSigil() returns an isolated instance that shares nothing with the page-wide one; Sigil is its type.

munsonlabs · MIT licensed · © 2026