A JavaScript dependency-injector
OrthoInjectorThe main entry point
Cache-handler. Service can be injected as $cache from Orthogonal.
Primarily used for dependency injection. Contains
methods for reflection -- parsing functions to see
which parameters it has and what they're called.
Can be dependency injected as a service via Orthogonal as $expressionParser.
Dependency injector. Itself injected as $injector from Orthogonal.
Represents an action in OrthoStore
Simple state-management. Dependency-injected as $store from Orthogonal.
Class representing a selector in OrthoStore.
representing a subscriber in OrthoStore
Color-harmony generator
Helpers for converting colors among color-spaces
Class for creating color-wheels that can be drawn on an HTML canvas.
objectInjectable services
objectInjectable services
OrthogonalOrthoCacheOrthoExpressionParserOrthoInjectorOrthoStoreexternal:Windowexternal:DocumentColorHarmonyColorHelperColorWheelFactoryInitializes Orthogonal
Helper function for adding a new getter-method to an object.
anyWrap an value in a Proxy which sets a property, isDirty when the property
named in dirtyProperty is modified.
ObjectObjectObjectObjectAn object representing parts of a color in RGBA colorspace
ObjectAn object representing a color in RGB colorspace
ObjectAn object representing a color in RGBA colorspace
Color-harmony generator
Array.<ColorHSL>Array.<string>ObjectArray.<ColorHSL>Calculate colors for
harmony, starting fromcolor
Returns: Array.<ColorHSL> - - Resulting harmonized list of colors
| Param | Type |
|---|---|
| harmony | string |
| color | ColorHSL |
Array.<string>Get a list of all available harmonies' names
ObjectGet a list of all available harmonies
Helpers for converting colors among color-spaces
ColorRGBColorHSLColorRGBstringColorHSVColorHSLstringColorHSLnumbernumberstringColorHSLColorRGBConvert Hex to RGB.
| Param | Type |
|---|---|
| hex | string |
ColorHSLConvert hex string to HSL
| Param | Type |
|---|---|
| hex | string |
ColorRGB| Param | Type |
|---|---|
| param0 | ColorHSL |
string| Param | Type |
|---|---|
| param0 | ColorHSL |
ColorHSV| Param | Type |
|---|---|
| param0 | ColorHSL |
ColorHSL| Param | Type |
|---|---|
| param0 | ColorHSV |
string| Param | Type |
|---|---|
| param0 | ColorRGB |
ColorHSL| Param | Type |
|---|---|
| param0 | ColorRGB |
numberTranslate from RYB color space to HSL
| Param | Type |
|---|---|
| hue | number |
numberTranslate from HSL color space to RYN
| Param | Type |
|---|---|
| hue | number |
stringConvert from any color space to any string format
| Param | Type | Description |
|---|---|---|
| source | any |
|
| type | string |
"hex", "rgb", "hsl", or "hsv" |
ColorHSLConvert from any color space (include string representations), to HSL.
| Param | Type |
|---|---|
| source | any |
Class for creating color-wheels that can be drawn on an HTML canvas.
| Param | Type |
|---|---|
| canvas | any |
ColorHSLCalculate the color at the given mouse position
| Param | Type |
|---|---|
| mouseEvent | external:MouseEvent |
ObjectCalculate the position of the given color in the color wheel.
| Param | Type |
|---|---|
| param0 | ColorHSL |
Draw the color wheel.
| Param | Type |
|---|---|
| canvas | any |
Alias: ArrayHelper
Array.<any>Array.<any>Array manipulation
Array.<any>Returns: Array.<any> - arrOrItem if it is an array, or [arrOrItem] if not.
| Param | Type |
|---|---|
| arrOrItem | any, Array.<any> |
Array.<any>Returns: Array.<any> - An array containing value length times.
| Param | Type |
|---|---|
| value | any |
| length | number |
stringColorRgbArray.<string>Helpers for working with CSS
stringGet CSS variable with name
key, if it exists underroot
| Param | Type | Default |
|---|---|---|
| key | string |
|
| root | external:HTMLELement |
|
ColorRgbGet CSS variable with name
key, if it exists underroot, converted to RGB.
| Param | Type | Default |
|---|---|---|
| key | string |
|
| root | external:HTMLELement |
|
Array.<string>Create a list of classnames, consisting of
element+element--variantfor everyvariants
| Param | Type |
|---|---|
| element | string |
| ...variants | string |
ObjectObjectstringstringexternal:HTMLElementexternal:ElementHelpers for handling DOM
Connect
callbacksto the list of events ineventNamesonelement.
| Param | Type |
|---|---|
| element | external:Element |
| eventNames | Array.<string> |
| ...callbacks | function |
Connect
callbacksto the list of events ineventNamesonelement. Also wraps all callbacks in a function that calls `e.preventDefault()' on all trigger events.
| Param | Type |
|---|---|
| element | external:Element |
| eventNames | Array.<string> |
| ...callbacks | function |
Dispatch
actiononstorewhen the giveneventNamesoccur.payloadSelectoris a callback-function, which transforms an element into a payload.
| Param | Type |
|---|---|
| element | external:Node |
| eventNames | string, Array.<string> |
| store | OrthoStore |
| action | string |
| payloadSelector | function |
ObjectGet x and y coordinates of
element
| Param | Type |
|---|---|
| element | external:Element |
ObjectGet dimensions of
element
| Param | Type |
|---|---|
| element | external:Element |
stringGet sanitized value from
element(assumed to be an input element), or empty string if there is no value.
| Param | Type |
|---|---|
| element | external:Element |
stringSet sanitized
valueonelement(assumed to be an input element), or empty string if there is no value.
| Param | Type |
|---|---|
| element | external:Element |
| value | string |
external:HTMLElementCreate an HTML element.
| Param | Type |
|---|---|
| tagName | string |
| attributes | Object |
| ...children | any |
external:ElementIf
selectOrElementis anElement, return it, otherwise try to find it treatingselectOrElementas a dom query.
| Param | Type |
|---|---|
| selectorOrElement | string, exernal:Element |
NumberNumberNumberNumberNumbernumberUseful interpolation helpers for converting between scales
NumberReturns: Number - A value between x and y at the decimal point a.
| Param | Type | Description |
|---|---|---|
| x | Number |
|
| y | Number |
|
| a | Number |
Ratio -- between 0.0 and 1.0 (inclusive) |
Example
$linear->lerp(0, 10, .5); // => 5
NumberReturns: Number - a or min if a < min, or max if a > max.
| Param | Type | Default | Description |
|---|---|---|---|
| a | Number |
||
| min | Number |
0 |
(default: 0) |
| max | Number |
1 |
(default: 1) |
Example
$linear->clamp(10, 2, 5); // => 5
NumberReturns: Number - Where a falls between x and y as a ratio
between 0.0 and 1.0. @see lerp
| Param | Type |
|---|---|
| x | Number |
| y | Number |
| a | Number |
NumberConverts a number from one range to another
Returns: Number - The value a converted to the value at the same place in [x2 ... y2]
as a has in [x1 ... y1]
| Param | Type |
|---|---|
| x1 | Number |
| y1 | Number |
| x2 | Number |
| y2 | Number |
| a | Number |
NumberReturns: Number - If maps is an array of maps containing at least the keys
from the string from and to, representing corresponding values in two ranges,
return val from range from fitted to the range b.
| Param | Type | Description |
|---|---|---|
| map | Array.<Map.<string, Array.<Number>>> |
s |
| from | string |
|
| to | string |
|
| val | Number |
numberReturn
numlimited to between0andmax, using modulo logic
| Param | Type |
|---|---|
| num | number |
| max | number |
Object manipulation
Array.<any>ObjectArray.<any>Helpers for querying the dom
Array.<any>Wrapper around
querySelectorAllallowing you to pass along a callback to call on all elements found
Returns: Array.<any> - The mapped list
| Param | Type |
|---|---|
| root | external:HTMLElement |
| selector | string |
| callback | function |
ObjectQuery by attribute name.
Returns: Object - all matching elements, plus metadata.
| Param | Type |
|---|---|
| root | external:HTMLElement |
| attribute | string |
Array.<any>Query by data-attribute. Optionally adds other attributes to result
Returns: Array.<any> - List of elements, along with index, and attribute values.
| Param | Type |
|---|---|
| root | external:HTMLElement |
| attribute | string |
| ...otherAttributes | any |
stringbooleanRgbColorRgbaColorstringstringString manipulation
stringMake sure argument is stringy
| Param | Type |
|---|---|
| str | string |
booleanCheck if argument is empty, i.e.
undefined,null,''&c.
| Param | Type |
|---|---|
| str | string, any |
RgbColorConvert a color in hex format (e.g.
#fff,#00ffee) to RGB.
| Param | Type |
|---|---|
| hex | string |
RgbaColorParse a color in RGBA string format.
| Param | Type |
|---|---|
| rgba | string |
stringConvert a string from
snake-casetocamelCase.
| Param | Type |
|---|---|
| str | string |
stringConvert a string from
camelCasetosnake-case.
| Param | Type |
|---|---|
| str | string |
objectInjectable services
objectInjectable services
OrthogonalOrthoCacheOrthoExpressionParserOrthoInjectorOrthoStoreexternal:Windowexternal:DocumentColorHarmonyColorHelperColorWheelFactoryInitializes Orthogonal
| Param | Type |
|---|---|
| extensions | any |
Helper function for adding a new getter-method to an object.
| Param | Type |
|---|---|
| obj | any |
| name | string |
| handler | function |
anyWrap an value in a Proxy which sets a property,
isDirtywhen the property named indirtyPropertyis modified.
Returns: any - Proxied version of baseObj
| Param | Type |
|---|---|
| baseObj | any |
| dirtyProperty | string |
ObjectProperties
| Name | Type |
|---|---|
| r | number |
| g | number |
| b | number |
ObjectProperties
| Name | Type |
|---|---|
| h | number |
| s | number |
| v | number |
ObjectProperties
| Name | Type |
|---|---|
| h | number |
| s | number |
| l | number |
ObjectAn object representing parts of a color in RGBA colorspace
Properties
| Name | Type | Description |
|---|---|---|
| r | number |
Red |
| g | number |
Green |
| b | number |
Blue |
| a | number |
Alpha |
ObjectAn object representing a color in RGB colorspace
Properties
| Name | Type | Description |
|---|---|---|
| r | number |
Red |
| g | number |
Green |
| b | number |
Blue |
ObjectAn object representing a color in RGBA colorspace
Properties
| Name | Type | Description |
|---|---|---|
| r | number |
Red |
| g | number |
Green |
| b | number |
Blue |
| a | number |
Alpha |