A JavaScript dependency-injector
OrthoInjector
The 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.
object
Injectable services
object
Injectable services
Orthogonal
OrthoCache
OrthoExpressionParser
OrthoInjector
OrthoStore
external:Window
external:Document
ColorHarmony
ColorHelper
ColorWheelFactory
Initializes Orthogonal
Helper function for adding a new getter-method to an object.
any
Wrap an value in a Proxy which sets a property, isDirty
when the property
named in dirtyProperty
is modified.
Object
Object
Object
Object
An object representing parts of a color in RGBA colorspace
Object
An object representing a color in RGB colorspace
Object
An object representing a color in RGBA colorspace
Color-harmony generator
Array.<ColorHSL>
Array.<string>
Object
Array.<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
Object
Get a list of all available harmonies
Helpers for converting colors among color-spaces
ColorRGB
ColorHSL
ColorRGB
string
ColorHSV
ColorHSL
string
ColorHSL
number
number
string
ColorHSL
ColorRGB
Convert Hex to RGB.
Param | Type |
---|---|
hex | string |
ColorHSL
Convert 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 |
number
Translate from RYB color space to HSL
Param | Type |
---|---|
hue | number |
number
Translate from HSL color space to RYN
Param | Type |
---|---|
hue | number |
string
Convert from any color space to any string format
Param | Type | Description |
---|---|---|
source | any |
|
type | string |
"hex" , "rgb" , "hsl" , or "hsv" |
ColorHSL
Convert 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 |
ColorHSL
Calculate the color at the given mouse position
Param | Type |
---|---|
mouseEvent | external:MouseEvent |
Object
Calculate 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 |
string
ColorRgb
Array.<string>
Helpers for working with CSS
string
Get CSS variable with name
key
, if it exists underroot
Param | Type | Default |
---|---|---|
key | string |
|
root | external:HTMLELement |
|
ColorRgb
Get 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--variant
for everyvariants
Param | Type |
---|---|
element | string |
...variants | string |
Object
Object
string
string
external:HTMLElement
external:Element
Helpers for handling DOM
Connect
callbacks
to the list of events ineventNames
onelement
.
Param | Type |
---|---|
element | external:Element |
eventNames | Array.<string> |
...callbacks | function |
Connect
callbacks
to the list of events ineventNames
onelement
. 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
action
onstore
when the giveneventNames
occur.payloadSelector
is 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 |
Object
Get x and y coordinates of
element
Param | Type |
---|---|
element | external:Element |
Object
Get dimensions of
element
Param | Type |
---|---|
element | external:Element |
string
Get sanitized value from
element
(assumed to be an input element), or empty string if there is no value.
Param | Type |
---|---|
element | external:Element |
string
Set sanitized
value
onelement
(assumed to be an input element), or empty string if there is no value.
Param | Type |
---|---|
element | external:Element |
value | string |
external:HTMLElement
Create an HTML element.
Param | Type |
---|---|
tagName | string |
attributes | Object |
...children | any |
external:Element
If
selectOrElement
is anElement
, return it, otherwise try to find it treatingselectOrElement
as a dom query.
Param | Type |
---|---|
selectorOrElement | string , exernal:Element |
Number
Number
Number
Number
Number
number
Useful interpolation helpers for converting between scales
Number
Returns: 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
Number
Returns: 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
Number
Returns: 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 |
Number
Converts 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 |
Number
Returns: 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 |
number
Return
num
limited to between0
andmax
, using modulo logic
Param | Type |
---|---|
num | number |
max | number |
Object manipulation
Array.<any>
Object
Array.<any>
Helpers for querying the dom
Array.<any>
Wrapper around
querySelectorAll
allowing 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 |
Object
Query 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 |
string
boolean
RgbColor
RgbaColor
string
string
String manipulation
string
Make sure argument is stringy
Param | Type |
---|---|
str | string |
boolean
Check if argument is empty, i.e.
undefined
,null
,''
&c.
Param | Type |
---|---|
str | string , any |
RgbColor
Convert a color in hex format (e.g.
#fff
,#00ffee
) to RGB.
Param | Type |
---|---|
hex | string |
RgbaColor
Parse a color in RGBA string format.
Param | Type |
---|---|
rgba | string |
string
Convert a string from
snake-case
tocamelCase
.
Param | Type |
---|---|
str | string |
string
Convert a string from
camelCase
tosnake-case
.
Param | Type |
---|---|
str | string |
object
Injectable services
object
Injectable services
Orthogonal
OrthoCache
OrthoExpressionParser
OrthoInjector
OrthoStore
external:Window
external:Document
ColorHarmony
ColorHelper
ColorWheelFactory
Initializes Orthogonal
Param | Type |
---|---|
extensions | any |
Helper function for adding a new getter-method to an object.
Param | Type |
---|---|
obj | any |
name | string |
handler | function |
any
Wrap an value in a Proxy which sets a property,
isDirty
when the property named indirtyProperty
is modified.
Returns: any
- Proxied version of baseObj
Param | Type |
---|---|
baseObj | any |
dirtyProperty | string |
Object
Properties
Name | Type |
---|---|
r | number |
g | number |
b | number |
Object
Properties
Name | Type |
---|---|
h | number |
s | number |
v | number |
Object
Properties
Name | Type |
---|---|
h | number |
s | number |
l | number |
Object
An 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 |
Object
An object representing a color in RGB colorspace
Properties
Name | Type | Description |
---|---|---|
r | number |
Red |
g | number |
Green |
b | number |
Blue |
Object
An object representing a color in RGBA colorspace
Properties
Name | Type | Description |
---|---|---|
r | number |
Red |
g | number |
Green |
b | number |
Blue |
a | number |
Alpha |