⇠ Go back to GitHub repository
Overview
- EventFronta ℗
Caching "events info" primary for
attributeChangedCallback
. This in fact caches all function arguments to reproduce calling later.- SVGIconElement ⇐
HTMLElement
SVGIcon Custom Element. When created new
<svg-icon>
tag it registers global style – see style. Also EventFronta for attributes changes (before element mounitg) is registered there.
- createElement() ℗
Creates elemnet in svg namespace
- setHref(element, value) ℗
Sets 'xlink:href' for given element
- setAlias(alias, target)
Registers new alias – this affect only newly created tags
<svg-icon>
since modification!- removeAlias(alias)
Removes registered alias – this affect only newly created tags
<svg-icon>
since modification!- changeOptions(def)
Intended to changing defaults options in options and options
- style_options :
Object
Contains options for generating default styles for
<svg-icon>
. Changes makes sence only before fisrt<svg-icon>
is created. See style.cerate.- aliases_options :
object
Options for setting/getting/using aliases (mainly
separator
). Changes affect only newly created tags<svg-icon>
since modification!
Content
Caching "events info" primary for
attributeChangedCallback
. This in fact caches all function arguments to reproduce calling later.
Kind: global class (defined@14)
Access: private
Refister new event
Kind: instance method of EventFronta
(defined@20)
Param | Type | Default | Description |
---|---|---|---|
event_info | Array |
All necessary infos for later invoking | |
[method] | String |
"push" |
In fact name of operation in Array.prototype (not used any more). Understands as enum of: push, unshift. |
Proccess all cached events
Kind: instance method of EventFronta
(defined@28)
Param | Type | Description |
---|---|---|
callback | function |
Function accepting array of cached arguments |
Empty cache
Kind: instance method of EventFronta
(defined@38)
SVGIcon Custom Element. When created new
<svg-icon>
tag it registers global style – see style. Also EventFronta for attributes changes (before element mounitg) is registered there.
Kind: global class (defined@182)
Extends: HTMLElement
Access: public
Properties
Name | Type | Description |
---|---|---|
_icon | HTMLElement |
Current icon (<use> tag) reference |
_onmount_attributes | EventFronta |
Log events for |
- SVGIconElement ⇐
HTMLElement
- instance
- static
Prepare
<svg>
and<use>
tag for icon.
Kind: instance method of SVGIconElement
(defined@195)
Returns: HTMLElement
- <use>
reference
Access: public
Sets
href
of current icon (SVGIconElement properties)
Kind: instance method of SVGIconElement
(defined@207)
Access: public
Life cycle callback: This method is called when element is mounted to DOM. It renders icon (renderIcon) and process all cached attributeChange events.
Kind: instance method of SVGIconElement
(defined@221)
Access: public
Life cycle callback: Called when element is removed from DOM. It clears icon and listenres.
Kind: instance method of SVGIconElement
(defined@230)
Access: public
Life cycle callback: Element atribute change handler (see observedAttributes). It calls setIcon or save events params into SVGIconElement (if element wasn’t mounted).
Kind: instance method of SVGIconElement
(defined@246)
Access: public
All properties theirs changes will be cached by attributeChangedCallback
Kind: static property of SVGIconElement
(defined@240)
Access: public
Kind: global namespace (defined@62)
Access: private
- style :
object
℗
Kind: static property of style
(defined@68)
Access: public
Properties
Name | Type |
---|---|
options | style_options |
Keeping information the global style was created – see style.cerate
Kind: static property of style
(defined@75)
Access: private
Properties
Name | Type | Default |
---|---|---|
[is_created] | boolean |
false |
Creates new
<style>
inside<head>
with default styling of<svg-icon>
(displays block and size)
Kind: static method of style
(defined@82)
Access: public
Grouping alises functionalities
Kind: global namespace (defined@105)
Access: private
- aliases :
object
℗- .options
- .list ℗
- .has(alias) ⇒
boolean
- .get(alias)
Kind: static property of aliases
(defined@111)
Access: public
Properties
Name | Type |
---|---|
options | aliases_options |
Contains all registered aliases
Kind: static property of aliases
(defined@117)
Access: private
Properties
Name | Type |
---|---|
list | Map | null |
Existence check
Kind: static method of aliases
(defined@125)
Access: public
Param | Type | Description |
---|---|---|
alias | string |
Alias name |
Get coresponding path for given
alias
name. Use has before for existence check!
Kind: static method of aliases
(defined@132)
Access: public
Param | Type | Description |
---|---|---|
alias | string |
Alias name |
Creates elemnet in svg namespace
Kind: global function (defined@9)
Access: private
Sets 'xlink:href' for given element
Kind: global function (defined@49)
Access: private
Param | Type |
---|---|
element | SVGUseElement |
value | String |
Registers new alias – this affect only newly created tags
<svg-icon>
since modification!
Kind: global function (defined@146)
Access: public
Param | Type | Description |
---|---|---|
alias | string |
Alias name |
target | string |
Corresponding full path |
Example
setAlias("icon", "icons_file.svg#");
document.body.innerHTML+= '<svg-icon use="icon-icon_name"></svg-icon>';
//is equivalent to
document.body.innerHTML+= '<svg-icon use="icons_file.svg#icon_name"></svg-icon>';
Removes registered alias – this affect only newly created tags
<svg-icon>
since modification!
Kind: global function (defined@156)
Access: public
Param | Type | Description |
---|---|---|
alias | string |
Alias name |
Intended to changing defaults options in options and options
Kind: global function (defined@170)
Access: public
Param | Type | Description |
---|---|---|
def | object |
|
[def.style] | style_options |
Changing style options |
[def.aliases] | aliases_options |
Changing aliases options |
Contains options for generating default styles for
<svg-icon>
. Changes makes sence only before fisrt<svg-icon>
is created. See style.cerate.
Kind: global typedef (defined@50)
Properties
Name | Type | Default | Description |
---|---|---|---|
[allow] | boolean |
true |
Allow creating global default styles |
[fit] | string |
"contain" |
CSS fit property of <svg> inside <svg-icon> |
[size_variable] | string |
"--svg-icon-size" |
The full name of CSS variable for changin icon size (width and height) |
Options for setting/getting/using aliases (mainly
separator
). Changes affect only newly created tags<svg-icon>
since modification!
Kind: global typedef (defined@94)
Properties
Name | Type | Default | Description |
---|---|---|---|
[separator] | string |
"-" |
Separator for aliases: alias separatoricon_name . |