Liking cljdoc? Tell your friends :D

domo.core


add-class!cljs

(add-class! el & xs)
source

add-class-on-mouse-enter-attrscljs

(add-class-on-mouse-enter-attrs s)
source

add-class-on-mouse-enter-attrs-mapcljs

(add-class-on-mouse-enter-attrs-map s)
source

add-event-listener!cljs

(add-event-listener! el nm f opts)
source

array-fromcljs

(array-from iterable)
source

arrow-keycode?cljs

(arrow-keycode? e)
source

as-strcljs

(as-str x)
source

attribute-false?cljs

(attribute-false? el attr)
source

attribute-true?cljs

(attribute-true? el attr)
source

cetcljs

source

cetvcljs

source

class-listcljs

(class-list el)

Returns the element's classList, which is a DOMTokenList

Returns the element's classList, which is a DOMTokenList
sourceraw docstring

class-stringcljs

(class-string el)

Returns the element's class value as a string

Returns the element's class value as a string
sourceraw docstring

click!cljs

(click! el)
source

click-xycljs

(click-xy e)

Returns a js-array of x and y coords of click event.

Returns a js-array of x and y coords of click event.
sourceraw docstring

client-rectcljs

(client-rect el)

Given an dom node, returns a js-object describing the element's geometry relative to the viewport.

Given an dom node, returns a js-object describing the element's geometry
relative to the viewport.
sourceraw docstring

client-rect-mapcljs

(client-rect-map el)

Given an dom node, returns a cljs map describing the element's geometry relative to the viewport.

Given an dom node, returns a cljs map describing the element's geometry
relative to the viewport.
sourceraw docstring

computed-style-valuecljs

(computed-style-value nm)
(computed-style-value el nm)
source

computed-style-value-datacljs

(computed-style-value-data nm)
(computed-style-value-data el nm)
source

copy-to-clipboard!cljs

(copy-to-clipboard! s)
(copy-to-clipboard! el s)
source

css-custom-property-valuecljs

(css-custom-property-value nm)
(css-custom-property-value el nm)

Gets computed style for css custom property. First checks for the computed style on the element, if supplied. If element is not supplied, checks for the computed style on the root html. Returns a string.

Gets computed style for css custom property.
First checks for the computed style on the element, if supplied.
If element is not supplied, checks for the computed style on the root html.
Returns a string.
sourceraw docstring

css-custom-property-value-datacljs

(css-custom-property-value-data nm)
(css-custom-property-value-data el nm)

Gets computed style for css custom property. First checks for the computed style on the element, if supplied. If element is not supplied, checks for the computed style on the root html. Returns a map of values.

(css-custom-property-value-data my-el "--sz") => {:string "500px" :value 500 :units "px"}

If the css-custom-property is not set, returns empty string: (css-custom-property-value-data my-el "--szzz") => {:string ""}

Gets computed style for css custom property.
First checks for the computed style on the element, if supplied.
If element is not supplied, checks for the computed style on the root html.
Returns a map of values.

(css-custom-property-value-data my-el "--sz") =>
{:string "500px" :value  500 :units  "px"}


If the css-custom-property is not set, returns empty string:
(css-custom-property-value-data my-el "--szzz") =>
{:string ""}
sourceraw docstring

css-duration-value->intcljs

(css-duration-value->int s)
source

css-style-stringcljs

(css-style-string m)
source

current-event-targetcljs

(current-event-target e)
source

current-event-target-valuecljs

(current-event-target-value e)
source

data-attrcljs

(data-attr el nm)
source

data-selectorcljs

(data-selector attr)
(data-selector attr v)

(data-selector :foo :bar) => "[data-foo="bar"]"

(data-selector :foo :bar) => "[data-foo=\"bar\"]"
sourceraw docstring

dev-onlycljs

(dev-only x)
source

dispatch-event!cljs

(dispatch-event! el e)
source

dispatch-mousedown-eventcljs

(dispatch-mousedown-event x y)
(dispatch-mousedown-event el x y)
source

distance-between-elscljs

(distance-between-els a b)
source

distance-between-pointscljs

(distance-between-points x1 y1 x2 y2)
source

duration-property-mscljs

(duration-property-ms el)
(duration-property-ms el property)

Given a dom node and a style property, returns the computed style value of that property, in milliseconds.

Properties that take a time value: transition-duration transition-delay animation-duration animation-delay animation-iteration-count transition animation

Given a dom node and a style property, returns the computed style value of
that property, in milliseconds.

Properties that take a time value:
transition-duration
transition-delay
animation-duration
animation-delay
animation-iteration-count
transition
animation
sourceraw docstring

el-by-idcljs

(el-by-id id)
source

el-from-pointcljs

(el-from-point x y)

Expects x and y viewport coordinates and returns the element found at that point.

Expects x and y viewport coordinates and returns the element found at that
point.
sourceraw docstring

el-indexcljs

(el-index el)

Get index of element, relative to its parent

Get index of element, relative to its parent
sourceraw docstring

element-node?cljs

(element-node? el)

If supplied value is a dom element such as <div>, <span>, etc., returns true, else returns false.

If supplied value is a dom element such as <div>, <span>, etc., returns true,
else returns false.
sourceraw docstring

etcljs

source

etvcljs

source

etv->floatcljs

source

etv->intcljs

source

event-targetcljs

(event-target e)
source

event-target-valuecljs

(event-target-value e)
source

event-target-value->floatcljs

(event-target-value->float e)
source

event-target-value->intcljs

(event-target-value->int e)
source

event-xycljs

(event-xy e)

Returns a js array of x and y coords of event.

Returns a js array of x and y coords of event.
sourceraw docstring

fade-incljs

(fade-in el)
(fade-in el {:keys [display opacity duration]})

Orchestrates the fading in of an element.

Orchestrates the fading in of an element.
sourceraw docstring

fade-outcljs

(fade-out el)
(fade-out el {:keys [duration]})

Orchestrates the fading out of an element.

Orchestrates the fading out of an element.
sourceraw docstring

focus!cljs

(focus! el)
source

get-first-onscreen-child-from-topcljs

(get-first-onscreen-child-from-top el)
source

grandparentcljs

(grandparent el)
source

has-attribute?cljs

(has-attribute? el attr)
source

has-class?cljs

(has-class? el classname)
source

intersecting-client-rects?cljs

(intersecting-client-rects? a b)

Expects two js objects representing client-rect instances.

Expects two js objects representing client-rect instances.
sourceraw docstring

keyboard-event!cljs

(keyboard-event! nm)
(keyboard-event! nm opts)
source

matches-media?cljs

(matches-media? prop val)

On a desktop: (matches-media? "any-hover" "hover") => true

On a touch device such as a smartphone that does not support hover: (matches-media? "any-hover" "hover") => false

On a desktop:
(matches-media? "any-hover" "hover") => true

On a touch device such as a smartphone that does not support hover:
(matches-media? "any-hover" "hover") => false
sourceraw docstring

maybecljs

(maybe x pred)
source

media-supports-hover?cljs

(media-supports-hover?)
source

media-supports-touch?cljs

(media-supports-touch?)
source

mouse-down-a11ycljs

(mouse-down-a11y f & args)

Sets up a partial attributes js-obj for using on-mouse-down instead of on-click. Intended for buttons, switches, checkboxes, radios, etc.

The function passed in may accept any number of args, but the last arg needs to be the event.

Contrived example with reagent:

(defn sidenav-item-handler [label modal? e] (domo/scroll-into-view! (domo/qs-data= "foo-bar" label)) (domo/scroll-by! {:y -50}) (when modal? (dismiss-popover! e)))

(defn my-reagent-component [{:keys [coll modal?]}] (into [:ul] (for [{:keys [label]} coll] [:li [button (merge-attrs (sx :.pill ...) (mouse-down-a11y sidenav-item-handler label modal?)) label]])))

Sets up a partial attributes js-obj for using `on-mouse-down` instead of `on-click`.
 Intended for buttons, switches, checkboxes, radios, etc.

 The function passed in may accept any number of args, but the last arg needs 
 to be the event.

 Contrived example with reagent:

(defn sidenav-item-handler [label modal? e]
  (domo/scroll-into-view!
  (domo/qs-data= "foo-bar" label))
  (domo/scroll-by! {:y -50})
  (when modal?
    (dismiss-popover! e)))
 
(defn my-reagent-component
  [{:keys [coll modal?]}]
  (into [:ul]
        (for [{:keys [label]} coll]
          [:li 
          [button
            (merge-attrs
            (sx :.pill
                ...)
            (mouse-down-a11y sidenav-item-handler label modal?))
            label]])))
sourceraw docstring

mouse-down-a11y-mapcljs

(mouse-down-a11y-map f & args)

Sets up a partial attributes map for using on-mouse-down instead of on-click. Intended for buttons, switches, checkboxes, radios, etc.

The function passed in may accept any number of args, but the last arg needs to be the event.

Contrived example with reagent:

(defn sidenav-item-handler [label modal? e] (domo/scroll-into-view! (domo/qs-data= "foo-bar" label)) (domo/scroll-by! {:y -50}) (when modal? (dismiss-popover! e)))

(defn my-reagent-component [{:keys [coll modal?]}] (into [:ul] (for [{:keys [label]} coll] [:li [button (merge-attrs (sx :.pill ...) (mouse-down-a11y sidenav-item-handler label modal?)) label]])))

Sets up a partial attributes map for using `on-mouse-down` instead of `on-click`.
 Intended for buttons, switches, checkboxes, radios, etc.

 The function passed in may accept any number of args, but the last arg needs 
 to be the event.

 Contrived example with reagent:

(defn sidenav-item-handler [label modal? e]
  (domo/scroll-into-view!
  (domo/qs-data= "foo-bar" label))
  (domo/scroll-by! {:y -50})
  (when modal?
    (dismiss-popover! e)))
 
(defn my-reagent-component
  [{:keys [coll modal?]}]
  (into [:ul]
        (for [{:keys [label]} coll]
          [:li 
          [button
            (merge-attrs
            (sx :.pill
                ...)
            (mouse-down-a11y sidenav-item-handler label modal?))
            label]])))
sourceraw docstring

mouse-event!cljs

(mouse-event! nm)
(mouse-event! nm opts)
source

nearest-ancestorcljs

(nearest-ancestor el sel)
source

next-siblingcljs

(next-sibling el)
source

node-namecljs

(node-name el)
source

object-assigncljs

(object-assign & objs)
source

observe-intersectioncljs

(observe-intersection {:keys [element intersecting not-intersecting f threshold
                              root-margin]
                       :or {threshold 0.1 root-margin "0px"}})
source

parentcljs

(parent el)
source

prefers-reduced-motion?cljs

(prefers-reduced-motion?)
source

prevent-default!cljs

(prevent-default! e)
source

previous-siblingcljs

(previous-sibling el)
source

qscljs

(qs s)
(qs el s)
source

qs-datacljs

(qs-data attr v)
(qs-data el attr v)
source

qsacljs

(qsa s)
(qsa el s)
source

rafcljs

(raf f)

Sugar for (js/requestAnimationFrame f)

Sugar for (js/requestAnimationFrame f)
sourceraw docstring

remove-attribute!cljs

(remove-attribute! el attr)
source

remove-class!cljs

(remove-class! el & xs)
source

round-by-dprcljs

(round-by-dpr n)
source

screen-quadrantcljs

(screen-quadrant el)

Given a dom node, returns a tuple representing the viewport quadrant which which contains the center of the node.

(screen-quadrant (domo.core/el-by-id "my-id")) => [:top :left]

Given a dom node, returns a tuple representing the viewport quadrant which
which contains the center of the node.

(screen-quadrant (domo.core/el-by-id "my-id")) => [:top :left]
sourceraw docstring

screen-quadrant-from-pointcljs

(screen-quadrant-from-point x y)

Given an x and y value, returns a tuple back representing the viewport quadrant which contains the point.

(screen-quadrant 10 20) => [:top :left]

Given an x and y value, returns a tuple back representing the viewport
quadrant which contains the point.

(screen-quadrant 10 20) => [:top :left]
sourceraw docstring

scroll-by!cljs

(scroll-by! {:keys [x y behavior] :or {x 0 y 0 behavior "auto"}})
source

scroll-into-view!cljs

(scroll-into-view! el)
(scroll-into-view! el
                   {:keys [inline block behavior]
                    :or {block "start" inline "nearest" behavior "auto"}})
source

scroll-to-top!cljs

(scroll-to-top!)
source

set-attribute!cljs

(set-attribute! el attr v)
source

set-caret!cljs

(set-caret! el i)
source

set-style!cljs

(set-style! el m)
(set-style! el prop s)
source

sibling-with-attributecljs

(sibling-with-attribute el attr)
(sibling-with-attribute el attr v)

Returns the first sibling with attribute match

Returns the first sibling with attribute match
sourceraw docstring

siblings-with-attributecljs

(siblings-with-attribute el attr)
(siblings-with-attribute el attr v)

Returns a vector of siblings with attribute matches.

Returns a vector of siblings with attribute matches.
sourceraw docstring

toggle-attribute!cljs

(toggle-attribute! el attr a b)

Toggles an attribute between provided values a and b, depending on the current value of the attribute.

Given the following dom node bound to el:

<div data-foo="baz">

(toggle-attribute! el :data-foo :baz :bar)

mutates the dome to:

<div data-foo="bar">

Toggles an attribute between provided values a and b, depending on the
current value of the attribute.

Given the following dom node bound to `el`:

<div data-foo="baz">

(toggle-attribute! el :data-foo :baz :bar)

mutates the dome to:
<div data-foo="bar">
sourceraw docstring

toggle-boolean-attribute!cljs

(toggle-boolean-attribute! el attr)
source

toggle-class!cljs

(toggle-class! el & xs)
source

token->mscljs

(token->ms x)
(token->ms el x)

Expects a key or string which maps to an existing design token (css custom property). If the value of the token is a valid (css) microseconds or seconds unit, an integer representing the number of microseconds will be returned.

Example:

/* css */ :root { --xxfast: 100; }

;; cljs (token->ms "--xxfast") ; => 100 (token->ms :--xxfast) ; => 100 (token->ms 42) ; => nil

Expects a key or string which maps to an existing design token (css custom
property). If the value of the token is a valid (css) microseconds or seconds
unit, an integer representing the number of microseconds will be returned.

Example:

/* css */
:root {
  --xxfast: 100;
}

;; cljs
(token->ms "--xxfast") ; => 100
(token->ms :--xxfast)    ; => 100
(token->ms 42)           ; => nil
sourceraw docstring

value-selectorcljs

(value-selector v)

(value-selector :baz) => "[value="baz"]"

(value-selector :baz) => "[value=\"baz\"]"
sourceraw docstring

viewportcljs

(viewport)

Returns a js object describing the viewport inner-width and inner-height.

Example:

(viewport) => {inner-width: 275 inner-height-without-scrollbars: 1246 inner-width-without-scrollbars: 275 inner-height: 1246}

Returns a js object describing the viewport inner-width and inner-height.

Example:

(viewport) =>
{inner-width:                     275
 inner-height-without-scrollbars: 1246
 inner-width-without-scrollbars:  275
 inner-height:                    1246}
sourceraw docstring

viewport-mapcljs

(viewport-map)

Returns a cljs hashmap describing the viewport inner-width and inner-height.

Example:

(viewport) => {:inner-width 275 :inner-height-without-scrollbars 1246 :inner-width-without-scrollbars 275 :inner-height 1246}

Returns a cljs hashmap describing the viewport inner-width and inner-height.

Example:

(viewport) =>
{:inner-width                     275
 :inner-height-without-scrollbars 1246
 :inner-width-without-scrollbars  275
 :inner-height                    1246}
sourceraw docstring

viewport-x-fractioncljs

(viewport-x-fraction vp x)

First argument must be a viewport js object produced from domo.core/viewport. Second argument must be a number representing an x coordinate. Returns the position as a fraction of the viewport width.

First argument must be a viewport js object produced from domo.core/viewport.
Second argument must be a number representing an x coordinate. Returns the
position as a fraction of the viewport width.
sourceraw docstring

viewport-y-fractioncljs

(viewport-y-fraction vp y)

First argument must be a viewport js object produced from domo.core/viewport. Second argument must be a number representing an y coordinate. Returns the position as a fraction of the viewport height.

First argument must be a viewport js object produced from domo.core/viewport.
Second argument must be a number representing an y coordinate. Returns the
position as a fraction of the viewport height.
sourceraw docstring

writing-directioncljs

(writing-direction)
source

zip-getcljs

(zip-get el steps)

Zipper-esque navigation for the DOM.

The following 4 calls are equivalent:

(def el (domo.core/el-by-id "my-id"))

(zip-get el "v > >")

(zip-get el [:v :> :>])

(zip-get app-el '[v > >])

(zip-get el "down right right")

(zip-get el [:down :right :right])

(zip-get el '[down right right])

Zipper-esque navigation for the DOM.

The following 4 calls are equivalent:

(def el (domo.core/el-by-id "my-id"))

(zip-get el "v > >")

(zip-get el [:v :> :>])

(zip-get app-el '[v > >])

(zip-get el "down right right")

(zip-get el [:down :right :right])

(zip-get el '[down right right])
sourceraw docstring

zip-navcljs

source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close