Module: bajaux/icon/iconUtils

Methods


<static> toCssClass(uri)

Convert the URI to a usable CSS class, expected to be represented in the
spritesheet CSS for that module.

Parameters:
Name Type Description
uri String
Returns:
Type
String

<static> toHtml(icon)

Given an icon value (string, baja.Icon, etc), convert it into a usable
HTML snippet.

The HTML will consist of a one or more span tags. Each span will have
one img element. If the icon is accounted for in a spritesheet, the
img tag will be hidden and the icon will be represented solely by the
span using pure CSS. If the icon is not in a spritesheet, the img
tag will be shown and have its src tag set to the raw icon image.

Parameters:
Name Type Description
icon String | baja.Ord | Array.<(String|baja.Ord)> | baja.Icon
Returns:

promise to be resolved with a raw HTML string containing
one or more span tags

Type
Promise

<static> toUris(icon)

Convert a value to an array of image URIs.

Parameters:
Name Type Description
icon String | baja.Ord | Array.<(String|baja.Ord)> | baja.Icon

a string
or array of strings. Each string can be a URI directly, or a module://
ORD. These will be converted to URIs to image files. If passing in
arbitrary ORDs, it's recommended to relativizeToSession() first.

Throws:

if invalid input given

Type
Error
Returns:

array of image URIs

Type
Array.<String>

Module: bajaux/icon/iconUtils

Utility functions for working with icons and associated HTML.

Methods


<static> toCssClass(uri)

Convert the URI to a usable CSS class, expected to be represented in the
spritesheet CSS for that module.

Parameters:
Name Type Description
uri String
Returns:
Type
String

<static> toHtml(icon)

Given an icon value (string, baja.Icon, etc), convert it into a usable
HTML snippet.

The HTML will consist of a one or more span tags. Each span will have
one img element. If the icon is accounted for in a spritesheet, the
img tag will be hidden and the icon will be represented solely by the
span using pure CSS. If the icon is not in a spritesheet, the img
tag will be shown and have its src tag set to the raw icon image.

Parameters:
Name Type Description
icon String | baja.Ord | Array.<(String|baja.Ord)> | baja.Icon
Returns:

promise to be resolved with a raw HTML string containing
one or more span tags

Type
Promise

<static> toUris(icon)

Convert a value to an array of image URIs.

Parameters:
Name Type Description
icon String | baja.Ord | Array.<(String|baja.Ord)> | baja.Icon

a string
or array of strings. Each string can be a URI directly, or a module://
ORD. These will be converted to URIs to image files. If passing in
arbitrary ORDs, it's recommended to relativizeToSession() first.

Throws:

if invalid input given

Type
Error
Returns:

array of image URIs

Type
Array.<String>