Skip to content

Latest commit

 

History

History
974 lines (655 loc) · 38.4 KB

File metadata and controls

974 lines (655 loc) · 38.4 KB

SVGBigHeads – Documentation

⇠ Go back to GitHub repository


Overview


Classes

SVGBigHeadsElementHTMLElement
SVGBigHeadsPartElementHTMLElement

Members

colors

Dictionary of all editable colors (in the form --bigheads-color-${name}) with default values

Objects

data : object
style_global : object
avatar_svg : object

Constants

parts_dictionary : _JSON_parts

All values are _JSON_Tarray

createElement : __createElementNS

Creates elemnet in svg namespace

version : string

Library version

type : "client" | "server"

Functions

isNotGenderType(candidate)boolean
createGroupedElement(els_object)GroupedElement
createSVG()SVGElement
setHref(element, value)

Sets 'xlink:href' for given element

createUSE(href)SVGUseElement
mixinObservedAttributes(BaseClass, attributes_names)HTMLElement

Helper for registering observedAttributes and getters/setters

avatarPartHref(d, type, [name])string
findSafeLayer(d, type)SVGUseElement
hairFullConfig(name)HairPartsNames

Returns filtered non-false parts and with full name as values (eg. long01-back).

avatarUpdateHair(svg, d)
nextPartName(part_name, current_name, [shift])string
getFromJSON()json

Typedefs

ConfigKeys : "href" | _JSON_parts_keys
_PreConfig : object
Data : object
Config : _PreConfig | _JSON_config_parts
__createElementNSSVGElement | SVGUseElement
GroupedElement : Object
style_options : Object

Contains options for generating default styles for <svg-bigheads>. Changes makes sence only before fisrt <svg-bigheads> is created. See style.cerate.

HairPartsNames : object
_JSON_colors_keys : "hair" | "clothes" | "hat" | "mouth" | "skin"

Final usage of colors are: --bigheads-color-__color_name__

_JSON_parts_keys : "glasses" | "breasts" | "eyebrow" | "facialhair" | "hair" | "hat" | "nose" | "base" | "clothes" | "eyes" | "mouth"

All svg files options

_JSON_Tstring : string
_JSON_Tarray : Array.<string>
_JSON_Tobject : object
_JSON_colors : object
_JSON_parts : object
_JSON_config_colors : object
_JSON_config_parts : object
_JSON_safe_layers_nth : Array.<_JSON_parts_keys>
_JSON_safe_layers : _JSON_safe_layers_nth | Array.<_JSON_safe_layers_nth>
json : object

Content


SVGBigHeadsElement ⇐ HTMLElement

Kind: global class (defined@467)
Extends: HTMLElement


new SVGBigHeadsElement()

Represents html tag <svg-bigheads …>, for all possibilities (the '…' part) see ConfigKeys and parts_dictionary.


svgBigHeadsElement.update(type)

Kind: instance method of SVGBigHeadsElement (defined@501)

Param Type
type ConfigKeys

SVGBigHeadsElement.tag_name

Returns html name represantion

Kind: static property of SVGBigHeadsElement (defined@478)
Getter:


SVGBigHeadsPartElement ⇐ HTMLElement

Kind: global class (defined@535)
Extends: HTMLElement


new SVGBigHeadsPartElement()

Represents html tag <svg-bigheads-part href="…" type="…" name="…">.


svgBigHeadsPartElement.nextValue(shift)

Regenrate html elememnt with the next svg part in parts_dictionary.

Kind: instance method of SVGBigHeadsPartElement (defined@568)

Param Type Default
shift numbet 1

colors

Dictionary of all editable colors (in the form --bigheads-color-${name}) with default values

Kind: global variable (defined@7)
Properties

Name Type
colors object

data : object

Kind: global namespace (defined@37)
Access: private


data.isFromMultiplePieces(name) ⇒ boolean

Kind: static method of data (defined@46)

Param Type
name _JSON_parts_keys

data.isNullable(name) ⇒ boolean

Kind: static method of data (defined@54)

Param Type
name _JSON_parts_keys

data.getNextPartName(part_name, current_name, [shift]) ⇒ string

Kind: static method of data (defined@63)

Param Type Default
part_name _JSON_parts_keys
current_name string
[shift] number 1

data.get(target) ⇒ Data

Kind: static method of data (defined@74)

Param Type
target SVGBigHeadsElement

data.setAttribute(data, name, [value])

Kind: static method of data (defined@82)

Param Type Default
data Data
name ConfigKeys
[value] string | null null

data.getAttribute(data, name)

Kind: static method of data (defined@88)

Param Type
data Data
name ConfigKeys

data.hasElement(data, name) ⇒ boolean

Kind: static method of data (defined@95)

Param Type
data Data
name _JSON_parts_keys

data.getElement(data, name) ⇒ SVGUseElement | GroupedElement | undefined

Kind: static method of data (defined@102)

Param Type
data Data
name _JSON_parts_keys

data.setElement(data, name, el)

Kind: static method of data (defined@109)

Param Type
data Data
name _JSON_parts_keys
el SVGUseElement | GroupedElement

data.deleteElement(data, name)

Kind: static method of data (defined@115)

Param Type
data Data
name _JSON_parts_keys

style_global : object

Kind: global namespace (defined@270)
Access: private


style_global.options

Kind: static property of style_global (defined@276)
Access: public
Properties

Name Type
options style_options

style_global.is_created ℗

Keeping information the global style was created – see style.cerate

Kind: static property of style_global (defined@283)
Access: private
Properties

Name Type Default
[is_created] boolean false

style_global.create()

Creates new <style> inside <head> with default styling of <svg-bigheads> (displays block and size)

Kind: static method of style_global (defined@290)
Access: public


avatar_svg : object

Kind: global namespace (defined@400)
Access: private


avatar_svg.create(big_heads)

Kind: static method of avatar_svg (defined@408)

Param Type
big_heads SVGBigHeadsElement

avatar_svg.get(big_heads)

Kind: static method of avatar_svg (defined@417)

Param Type
big_heads SVGBigHeadsElement

avatar_svg.appendUSE(svg, d, name) ⇒ SVGUseElement

Append <use> to internal <svg>.

Kind: static method of avatar_svg (defined@426)

Param Type
svg SVGElement
d Data
name _JSON_parts_keys

avatar_svg.insertAfterUSE(svg, d, name, el) ⇒ SVGUseElement

Insert <use> to <svg> before el.

Kind: static method of avatar_svg (defined@440)

Param Type
svg SVGElement
d Data
name _JSON_parts_keys
el SVGUseElement

avatar_svg.remove(big_heads)

Kind: static method of avatar_svg (defined@449)

Param Type
big_heads SVGBigHeadsElement

parts_dictionary : _JSON_parts

All values are _JSON_Tarray

Kind: global constant (defined@165)


createElement : __createElementNS

Creates elemnet in svg namespace

Kind: global constant (defined@191)
Access: private


version : string

Library version

Kind: global constant (defined@687)


type : "client" | "server"

Kind: global constant (defined@691)


isNotGenderType(candidate) ⇒ boolean

Kind: global function (defined@180)

Param Type
candidate _JSON_parts_keys

createGroupedElement(els_object) ⇒ GroupedElement

Kind: global function (defined@208)
Access: private

Param Type
els_object object
[els_object.front] SVGUseElement
[els_object.top] SVGUseElement
[els_object.back] SVGUseElement

createSVG() ⇒ SVGElement

Kind: global function (defined@217)
Access: private


setHref(element, value) ℗

Sets 'xlink:href' for given element

Kind: global function (defined@229)
Access: private

Param Type
element SVGUseElement
value String

createUSE(href) ⇒ SVGUseElement

Kind: global function (defined@235)
Access: private

Param Type
href string

mixinObservedAttributes(BaseClass, attributes_names) ⇒ HTMLElement

Helper for registering observedAttributes and getters/setters

Kind: global function (defined@247)
Access: private

Param Type
BaseClass HTMLElement
attributes_names Array.<string>

avatarPartHref(d, type, [name]) ⇒ string

Kind: global function (defined@308)
Access: private

Param Type Description
d Data
type ConfigKeys
[name] string Defaults to value saved in d

findSafeLayer(d, type) ⇒ SVGUseElement

Kind: global function (defined@322)
Access: private

Param Type
d Data
type _JSON_parts_keys

hairFullConfig(name) ⇒ HairPartsNames

Returns filtered non-false parts and with full name as values (eg. long01-back).

Kind: global function (defined@354)
Access: private

Param Type
name string

avatarUpdateHair(svg, d) ℗

Kind: global function (defined@375)
Access: private

Param Type
svg SVGElement
d Data

nextPartName(part_name, current_name, [shift]) ⇒ string

Kind: global function (defined@584)

Param Type Default
part_name _JSON_parts_keys
current_name string
[shift] number 1

getFromJSON() ⇒ json

Kind: global function (defined@681)
Access: private


ConfigKeys : "href" | _JSON_parts_keys

Kind: global typedef (defined@10)
Access: private


_PreConfig : object

Kind: global typedef (defined@15)
Access: private
Properties

Name Type Description
[href] string Target of svg file

Data : object

Kind: global typedef (defined@21)
Access: private
Properties

Name Type
attributes Config
els Object.<_JSON_parts_keys, (SVGElement|SVGUseElement)>

Kind: global typedef (defined@28)
Access: private


__createElementNS ⇒ SVGElement | SVGUseElement

Kind: global typedef (defined@181)


GroupedElement : Object

Kind: global typedef (defined@192)
Properties

Name Type Description
[front] SVGUseElement
[top] SVGUseElement
[back] SVGUseElement
remove function Removes all elements

style_options : Object

Contains options for generating default styles for <svg-bigheads>. Changes makes sence only before fisrt <svg-bigheads> is created. See style.cerate.

Kind: global typedef (defined@258)
Properties

Name Type Default Description
[allow] boolean true Allow creating global default styles
[fit] string "contain" CSS fit property of <svg> inside <svg-bigheads>
[big_hat] string "bigheads-hat-longhairs" Class name for making hat bigger when long hair

HairPartsNames : object

Kind: global typedef (defined@341)
Properties

Name Type
[front] string
[top] string
[back] string

_JSON_colors_keys : "hair" | "clothes" | "hat" | "mouth" | "skin"

Final usage of colors are: --bigheads-color-__color_name__

Kind: global typedef (defined@586)


_JSON_parts_keys : "glasses" | "breasts" | "eyebrow" | "facialhair" | "hair" | "hat" | "nose" | "base" | "clothes" | "eyes" | "mouth"

All svg files options

Kind: global typedef (defined@591)


_JSON_Tstring : string

Kind: global typedef (defined@596)


_JSON_Tarray : Array.<string>

Kind: global typedef (defined@600)


_JSON_Tobject : object

Kind: global typedef (defined@604)
Properties

Name Type Description
[front] boolean
[back] boolean
[top] boolean
[parent] string The name of hair to be also used

_JSON_colors : object

Kind: global typedef (defined@612)
Properties

Name Type
hair _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
clothes _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
hat _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
mouth _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
skin _JSON_Tstring | _JSON_Tarray | _JSON_Tobject

_JSON_parts : object

Kind: global typedef (defined@621)
Properties

Name Type
glasses _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
breasts _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
eyebrow _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
facialhair _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
hair _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
hat _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
nose _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
base _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
clothes _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
eyes _JSON_Tstring | _JSON_Tarray | _JSON_Tobject
mouth _JSON_Tstring | _JSON_Tarray | _JSON_Tobject

_JSON_config_colors : object

Kind: global typedef (defined@636)
Properties

Name Type Default
[hair] string "#d96e27"
[clothes] string "#d67070"
[hat] string "#5bcaf0"
[mouth] string "#dd3e3e"
[skin] string "#fdd2b2"

_JSON_config_parts : object

Kind: global typedef (defined@645)
Properties

Name Type Default
[glasses] string "none"
[breasts] string "none"
[eyebrow] string "none"
[facialhair] string "none"
[hair] string "none"
[hat] string "none"
[nose] string "none"
[base] string "base"
[clothes] string "dressshirt"
[eyes] string "narrower"
[mouth] string "lips"

_JSON_safe_layers_nth : Array.<_JSON_parts_keys>

Kind: global typedef (defined@660)


Kind: global typedef (defined@664)


json : object

Kind: global typedef (defined@669)
Access: private
Properties

Name Type
colors _JSON_colors
parts _JSON_parts
safe_layers _JSON_safe_layers