Package-level declarations

Types

Link copied to clipboard
external interface Color

Parsed CSS color.

Link copied to clipboard
typealias CSSFormatMode = String

CSS formatting: "expanded", "compact" or "compressed".

Link copied to clipboard
external interface CSSUnformattedItem

CSS rule set before formatting.

Link copied to clipboard
external interface CurrentColor : Color

CSS currentColor.

Link copied to clipboard
external interface EmojiRegexMatch

Emoji match in text.

Link copied to clipboard
external interface EmojiSequenceItem

Item that has an emoji sequence and optionally a keyword.

Link copied to clipboard
external interface EmojiTestDataItem

Entry from emoji-test.txt from unicode.org.

Link copied to clipboard
external interface FullIconCustomisations

Icon customisations with all values resolved.

Link copied to clipboard

Icon with all optional properties resolved.

Link copied to clipboard
external interface FunctionColor : Color

CSS color function that is not parsed, such as oklch().

Link copied to clipboard
external interface HSLColor : Color

HSL color.

Link copied to clipboard

Options for generating CSS for one icon as pseudo-element content.

Link copied to clipboard

Selector options for content CSS generation for one icon.

Link copied to clipboard

Options for generating CSS for an icon set as pseudo-element content.

Link copied to clipboard
external interface IconContentSharedOptions

Options shared by content CSS generation for one icon and for an icon set.

Link copied to clipboard
external interface IconCSSFormatOptions

CSS formatting options.

Link copied to clipboard

Options for generating CSS for one icon as background or mask.

Link copied to clipboard
external interface IconCSSIconSelectorOptions

Selector options for CSS generation for one icon.

Link copied to clipboard

Options for generating CSS for an icon set as background or mask.

Link copied to clipboard
typealias IconCSSMode = String

How icons are rendered in CSS: "mask" or "background".

Link copied to clipboard
external interface IconCSSModeOptions

Rendering mode.

Link copied to clipboard

Selector options for CSS generation for an icon set.

Link copied to clipboard
external interface IconCSSSharedOptions

Options shared by CSS generation for one icon and for an icon set.

Link copied to clipboard
external interface IconifyIconBuildAttributes

Attributes of a generated <svg> element.

Link copied to clipboard
external interface IconifyIconBuildResult

Result of building an SVG from an icon.

Link copied to clipboard

Icon customisations: size and transformations.

Link copied to clipboard
external interface IconifyIconName

Icon name split into parts.

Link copied to clipboard

Icon size customisations.

Link copied to clipboard
external interface IconifyLoaderOptions

Options for the icon loader.

Link copied to clipboard
external interface IconSetValidationOptions

Options for validateIconSet.

Link copied to clipboard
external interface LABColor : Color

LAB color.

Link copied to clipboard
external interface LCHColor : Color

LCH color.

Link copied to clipboard
external interface LegacyIconifyInfo

Icon set information in the legacy format used by the Iconify API and collections.json.

Link copied to clipboard
external interface NoColor : Color

Value none.

Link copied to clipboard
external interface ParsedSVGContent

SVG split into element attributes and inner content.

Link copied to clipboard
external interface PreparedEmojiIcon

Emoji mapped to an icon.

Link copied to clipboard
external interface PreparedEmojiResult

Result of preparing emojis for matching in text.

Link copied to clipboard
external interface RGBColor : Color

RGB color.

Link copied to clipboard
external interface SplitSVGDefsResult

Result of splitting definitions from SVG content.

Link copied to clipboard
typealias SVGViewBox = Array<Double>

SVG viewBox: [x, y, width, height].

Link copied to clipboard
external interface TransparentColor : Color

Fully transparent color.

Link copied to clipboard
external interface UnicodeFormattingOptions

Options for formatting emoji code points as a string.

Properties

Link copied to clipboard
external val colorKeywords: dynamic

CSS color keywords, keyed by name.

Link copied to clipboard
external val defaultExtendedIconProps: dynamic

Default values for all properties of ExtendedIconifyIcon: defaultIconProps, an empty body and hidden set to false.

Link copied to clipboard

Default icon customisations: no size, no rotation, no flips.

Link copied to clipboard
external val defaultIconDimensions: dynamic

Default dimensions: left and top 0, width and height 16.

Link copied to clipboard
external val defaultIconProps: dynamic

Default dimensions and transformations.

Link copied to clipboard
external val defaultIconSizeCustomisations: dynamic

Default size customisations: width and height set to null.

Link copied to clipboard

Default transformations: no rotation, no flips.

Link copied to clipboard
external val matchIconName: RegExp

Expression matching a valid icon name part.

Link copied to clipboard
external val propsToCopy: Array<String>

Optional properties copied when extracting icons: left, top, width, height and provider.

Functions

Link copied to clipboard

Convert parsed SVG content to SVG attributes and body.

Link copied to clipboard
external fun calculateSize(size: dynamic, ratio: Double, precision: Int = definedExternally): dynamic

Calculate the second dimension when only one dimension is set.

Link copied to clipboard
external fun camelize(str: String): String

Convert a kebab-case string to camelCase: foo-bar becomes fooBar.

Link copied to clipboard
external fun camelToKebab(key: String): String

Convert a camelCase string to kebab-case: fooBar becomes foo-bar.

Link copied to clipboard
external fun cleanUpInnerHTML(html: String): String

Prepare an HTML string for innerHTML assignment.

Link copied to clipboard
external fun clearIDCache()

Clear the ID counter cache used by replaceIDs.

Link copied to clipboard
external fun colorToHexString(color: RGBColor, canCompact: Boolean = definedExternally, canRound: Boolean = definedExternally): String?

Convert an RGB color to a hex string.

Link copied to clipboard
external fun colorToString(color: Color, canRound: Boolean = definedExternally): String

Convert a parsed color back to a CSS string.

Link copied to clipboard
external fun commonObjectProps(item: dynamic, reference: dynamic): dynamic

Get properties of item whose keys exist in reference.

Link copied to clipboard
external fun compareColors(color1: Color, color2: Color): Boolean

Compare two parsed colors.

Link copied to clipboard
external fun compareObjects(obj1: dynamic, obj2: dynamic, ref: dynamic = definedExternally): Boolean

Compare two objects.

Link copied to clipboard
external fun convertEmojiSequenceToUTF16(numbers: Array<Int>): Array<Int>

Convert an emoji sequence to UTF-16 code units.

Link copied to clipboard
external fun convertEmojiSequenceToUTF32(numbers: Array<Int>, throwOnError: Boolean = definedExternally): Array<Int>

Convert an emoji sequence to UTF-32 code points.

Link copied to clipboard
external fun convertIconSetInfo(data: dynamic, expectedPrefix: String = definedExternally): IconifyInfo?

Convert icon set information from the legacy format used by the Iconify API and collections.json to IconifyInfo.

Link copied to clipboard

Convert parsed SVG content to an icon.

Link copied to clipboard
external fun createOptimisedRegex(emojis: Array<dynamic>): String

Create an optimised regular expression source for emojis.

Link copied to clipboard

Create an optimised regular expression source for emoji sequences.

Link copied to clipboard
external fun encodeSvgForCss(svg: String): String

Encode an SVG for use in a CSS url().

Link copied to clipboard
external fun expandIconSet(data: IconifyJSON)

Expand a minified icon set in place.

Link copied to clipboard
external fun findAndReplaceEmojisInText(regexp: dynamic, content: String, callback: (EmojiRegexMatch, String) -> dynamic): String?

Replace emojis in text.

Link copied to clipboard
external fun <T : EmojiSequenceItem> findMissingEmojis(sequences: Array<T>, testDataTree: dynamic): Array<T>

Find emojis missing from sequences by looking them up in emoji test data.

Link copied to clipboard
external fun flipFromString(custom: IconifyIconCustomisations, flip: String)

Apply a flip string to customisations.

Link copied to clipboard
external fun getCustomIcon(custom: dynamic, collection: String, icon: String, options: IconifyLoaderOptions? = definedExternally): Promise<String?>

Get an icon from an inline collection or a custom loader function.

Link copied to clipboard
external fun getEmojiCodePoint(code: String): Int

Convert a hexadecimal code string to a code point.

Link copied to clipboard

Parse an emoji sequence string into code points.

Link copied to clipboard
external fun getEmojiSequenceKeyword(sequence: Array<Int>): String

Convert an emoji sequence to a keyword-style string, without options.

Link copied to clipboard
external fun getEmojiSequenceString(sequence: Array<Int>, options: dynamic = definedExternally): String

Convert an emoji sequence to a hexadecimal string.

Link copied to clipboard
external fun getEmojiUnicode(code: dynamic): String

Convert a code point, or a hexadecimal code string, to a Unicode string.

Link copied to clipboard
external fun getEmojiUnicodeString(code: Int, options: dynamic = definedExternally): String

Convert a code point to a hexadecimal string.

Link copied to clipboard

Generate CSS for one icon, rendered as pseudo-element content.

Link copied to clipboard
external fun getIconCSS(icon: IconifyIcon, options: IconCSSIconOptions? = definedExternally): String

Generate CSS for one icon, rendered as background or mask.

Link copied to clipboard
external fun getIconData(data: IconifyJSON, name: String): ExtendedIconifyIcon?

Get icon data from an icon set, resolving aliases and filling in defaults.

Link copied to clipboard
external fun getIcons(data: IconifyJSON, names: Array<String>, notFound: Boolean = definedExternally): IconifyJSON?

Extract a subset of icons from an icon set.

Link copied to clipboard
external fun getIconsContentCSS(iconSet: IconifyJSON, names: Array<String>, options: IconContentIconSetOptions): String

Generate CSS for icons from an icon set, rendered as pseudo-element content.

Link copied to clipboard
external fun getIconsCSS(iconSet: IconifyJSON, names: Array<String>, options: IconCSSIconSetOptions? = definedExternally): String

Generate CSS for icons from an icon set, rendered as background or mask.

Link copied to clipboard
external fun getIconsTree(data: IconifyJSON, names: Array<String>? = definedExternally): dynamic

Parent icons for each icon.

Link copied to clipboard
external fun getPossibleIconNames(icon: String): Array<String>

Possible icon names for a name that may use a different naming convention, from the most specific to the most generic.

Link copied to clipboard

Convert an emoji sequence to its qualified form, adding variation selectors where required.

Link copied to clipboard

Convert emoji sequences to their qualified forms, removing duplicates.

Link copied to clipboard

Convert an emoji sequence or keyword to code points.

Link copied to clipboard
external fun getSVGViewBox(value: String): SVGViewBox?

Parse a viewBox string such as "0 0 24 24".

Link copied to clipboard
external fun getUnqualifiedEmojiSequence(sequence: Array<Int>): Array<Int>

Remove emoji variation selectors, U+FE0F, from a sequence.

Link copied to clipboard
external fun iconToHTML(body: String, attributes: dynamic): String

Build an <svg> string from a body and attributes.

Link copied to clipboard
external fun iconToSVG(icon: IconifyIcon, customisations: IconifyIconCustomisations? = definedExternally): IconifyIconBuildResult

Generate SVG attributes and body from an icon and customisations.

Link copied to clipboard
external fun isUTF32SplitNumber(value: Int): dynamic

Check whether a UTF-16 code unit is part of a surrogate pair.

Link copied to clipboard
external fun joinEmojiSequences(sequences: Array<Array<Int>>, separator: Int = definedExternally): Array<Int>

Join emoji sequences, inserting the separator between them.

Link copied to clipboard
external fun loadIcon(collection: String, icon: String, options: IconifyLoaderOptions? = definedExternally): Promise<String?>

Load an icon from a custom collection registered in IconifyLoaderOptions.customCollections.

Link copied to clipboard

Center an icon in a square viewBox, keeping it at its original size.

Link copied to clipboard
external fun makeViewBoxSquare(viewBox: SVGViewBox): SVGViewBox

Center a viewBox in a square one, keeping the original size.

Link copied to clipboard

Convert customisations to a full set of values.

Link copied to clipboard
external fun mergeDefsAndContent(defs: String, content: String): String

Wrap defs in <defs> and prepend them to content.

Link copied to clipboard
external fun <T : ExtendedIconifyIcon> mergeIconData(parent: T, child: dynamic): T

Merge an icon and its alias, or default values and an icon.

Link copied to clipboard
external fun mergeIconProps(svg: String, collection: String, icon: String, options: IconifyLoaderOptions? = definedExternally, propsProvider: () -> dynamic? = definedExternally, afterCustomizations: (dynamic) -> Unit? = definedExternally): Promise<String>

Apply customisations and extra properties to an SVG string.

Link copied to clipboard

Merge transformations.

Link copied to clipboard
external fun mergeUTF32Numbers(part1: Int, part2: Int): Int?

Merge a UTF-16 surrogate pair into one code point.

Link copied to clipboard
external fun minifyIconSet(data: IconifyJSON)

Minify an icon set in place.

Link copied to clipboard
external fun parseEmojiTestFile(data: String): dynamic

Parse the contents of emoji-test.txt from unicode.org.

Link copied to clipboard
external fun parseIconSet(data: IconifyJSON, callback: (name: String, data: ExtendedIconifyIcon?) -> Any?): Array<String>

Invoke callback for each icon in the icon set.

Link copied to clipboard
external fun parseIconSetAsync(data: IconifyJSON, callback: (name: String, data: ExtendedIconifyIcon?) -> dynamic): Promise<Array<String>>

Asynchronous version of parseIconSet: awaits each callback before processing the next icon.

Link copied to clipboard
external fun parseSVGContent(content: String): ParsedSVGContent?

Extract attributes and content from an SVG string.

Link copied to clipboard
external fun pascalize(str: String): String

Convert a kebab-case string to PascalCase: foo-bar becomes FooBar.

Link copied to clipboard
external fun prepareEmojiForIconSet(iconSet: IconifyJSON, rawTestData: String = definedExternally): PreparedEmojiResult

Prepare the chars of an icon set for matching emojis in text.

Link copied to clipboard
external fun prepareEmojiForIconsList(icons: dynamic, rawTestData: String = definedExternally): PreparedEmojiResult

Prepare an emoji to icon name map for matching emojis in text.

Link copied to clipboard
external fun prettifySVG(content: String, tab: String = definedExternally, depth: Int = definedExternally): String?

Pretty-print SVG content.

Link copied to clipboard
external fun quicklyValidateIconSet(obj: dynamic): IconifyJSON?

Quick validation of an icon set.

Link copied to clipboard
external fun replaceIDs(body: String): String

Replace IDs in an SVG body with unique IDs, updating their references.

Link copied to clipboard
external fun rotateFromString(value: String, defaultValue: Int = definedExternally): Int

Parse a rotation string such as "90deg", "25%" or "1" into a number of 90 degree rotations, normalised to 0..3.

Link copied to clipboard
external fun sanitiseTitleAttribute(content: String): String

Remove characters that would break an XML attribute: <, > and &.

Link copied to clipboard
external fun searchForIcon(iconSet: IconifyJSON, collection: String, ids: Array<String>, options: IconifyLoaderOptions? = definedExternally): Promise<String?>

Search for an icon in an icon set, trying names from ids in order.

Link copied to clipboard
external fun snakelize(str: String): String

Convert a camelCase string to snake_case: fooBar becomes foo_bar.

Link copied to clipboard
external fun splitEmojiSequences(sequence: Array<Int>, separator: Int = definedExternally): Array<Array<Int>>

Split an emoji sequence by the joiner into smaller sequences.

Link copied to clipboard
external fun splitSVGDefs(content: String, tag: String = definedExternally): SplitSVGDefsResult

Extract non-nestable definitions, such as masks and clip paths, from SVG content.

Link copied to clipboard
external fun splitUTF32Number(code: Int): Array<Int>?

Split a code point above U+FFFF into a UTF-16 surrogate pair.

Link copied to clipboard
external fun stringToColor(value: String): Color?

Parse a CSS color string: a hex color, a color keyword, or an rgb, hsl, lab or lch function.

Link copied to clipboard
external fun stringToIcon(value: String, validate: Boolean = definedExternally, allowSimpleName: Boolean = definedExternally, provider: String = definedExternally): IconifyIconName?

Convert a string such as mdi:home, @provider:mdi:home or mdi-home to an icon name object.

Link copied to clipboard
external fun svgToData(svg: String): String

Generate a data:image/svg+xml URL from an SVG string.

Link copied to clipboard
external fun svgToURL(svg: String): String

Generate a CSS url("data:image/svg+xml,...") value from an SVG string.

Link copied to clipboard
external fun toBoolean(name: String, value: dynamic, defaultValue: Boolean): Boolean

Read a boolean customisation value from an attribute.

Link copied to clipboard
external fun trimSVG(str: String): String

Remove unnecessary whitespace from an SVG string.

Link copied to clipboard
external fun unmergeObjects(obj1: dynamic, obj2: dynamic): dynamic

Remove properties that are identical in both objects.

Link copied to clipboard
external fun validateIconName(icon: IconifyIconName?, allowSimpleName: Boolean = definedExternally): Boolean

Check whether an icon name is valid: the prefix must not be empty, unless allowSimpleName is set, and the name must not be empty.

Link copied to clipboard
external fun validateIconSet(obj: dynamic, options: IconSetValidationOptions? = definedExternally): IconifyJSON

Validate an icon set, optionally fixing it.

Link copied to clipboard
external fun wrapSVGContent(body: String, start: String, end: String): String

Wrap SVG content with start and end, leaving definitions unwrapped.