Documentation

website.util

->css-var

(->css-var var-name value)

Set value of CSS variable. Causing issues ‘no prot method IMap.-dissoc defined for object CSSStyleDeclaration’ - in interceptor, is re-frisk related or?

<-css-var

(<-css-var var-name & calc)

Get value of CSS variable. Have to apply to dummy div to force calc

<-store

(<-store & coll-docs)

add-attrs

(add-attrs component attrs)

Put more attrs in something already defined…

at

(at val-or-atom & [fallback])

Take symbol: if value, return it. If ratom, deref it, thereby avoiding nil derefing etc…

bounding-rect

(bounding-rect e)

client-xy

(client-xy e)

cs

(cs & names)

css-arg

(css-arg & parts)

css-rot

(css-rot angle)

css-str

(css-str f & args)

string builder

cubic-bezier

(cubic-bezier & args)

deep-merge

(deep-merge & values)

Recursively merge maps, concat seqs.

elem-by-id

(elem-by-id id)

elem-by-type

(elem-by-type type)

elem-in-view?

(elem-in-view? el)

Returns true when element is visible

elem-or-document

(elem-or-document id-or)

element-height-rem

(element-height-rem element)

em->px

(em->px el em-val)

Convert em to pixels, passing element for sizing

ensure-elem

(ensure-elem el)

for-i

(for-i l)

format-number

(format-number n & [precision])

interleave-all

(interleave-all & seqs)

interleaves including remainder of longer seqs.

keys-in

(keys-in m)

Returns a sequence of all key paths in a given map using DFS walk.

keyvec->str

(keyvec->str v)

Converts a vector of keywords to a string

lists->for

(lists->for & lists)

local-time

(local-time clock)

Format a full provider ISO timestamp as local HH:mm:ss plus its UTC offset.

log

(log message)(log level title message & messages)

Log to both console and app

log-errors

(log-errors errors)

m->json

(m->json m)

make-key

(make-key & ids)

Make key easily for React lists…

md->normal

(md->normal text)

merge-attrs

(merge-attrs attrs-1 attrs-2)

Combine attrs instead of replacing. Would support some common stuff like merging :style, wrapping :ref, combining :class strs

normalize-store-result

(normalize-store-result response)

observer

(observer on-view-change & [opt-map])

on-document

(on-document event f & [opt-map])

on-event

(on-event node event f & [active?])

on-window

(on-window event f)

play-pauser

(play-pauser video & {:keys [rate-step time-per-step], :or {rate-step 0.3, time-per-step 330}})

Returns fn to :play or :pause video smoothly by changing playback rate progressively (calls itself in intervals)

playing?

(playing? video)

Check if video is stopped

pluralize

(pluralize amount thing)

Swap 0/no and grammar

previous-month-date

(previous-month-date ms)

UTC calendar subtraction, clamped to the preceding month’s last day.

px->em

(px->em el px-val)

Convert pixels to em, passing element for sizing

px-to-rem

(px-to-rem px-val)

Convert pixels to rem. Doesnt seem like gets quite perfect…

rem-to-px

(rem-to-px rem-val)

Convert rem to pixels. Doesnt seem like gets quite perfect…

remove-nils

(remove-nils m)

Remove keys with nil or empty seq values, even in nested maps.

remove-on-document

(remove-on-document event f & [opt-map])

rescale-to-frac

(rescale-to-frac n min-input max-input)

resize-canvas-to-display-size

(resize-canvas-to-display-size canvas)

run-highlighter!

(run-highlighter! el-type & [div-ref])

scroll-by

(scroll-by rem & [id])

Manually scroll view by. But guess need custom for Safar-eye

scroll-to

(scroll-to id & [offset])

Manual so Safari gets same fn as chrome Plus move page down correctly when open menu etc… There is a CSS offset thing but cant get it working?

scroll-to-end!

(scroll-to-end! element)

Scroll a referenced element without changing React-owned markup.

scroll-to-px

(scroll-to-px scroll-y-px)

Pixels, simply

set-attr!

(set-attr! id-or attr value)

Set attribute on element. Avoid for general use. Good for document (pass id nil)

timestamp

(timestamp ms)(timestamp ms now)

Use minutes ago, hours ago, then a UTC date. Optional now keeps this pure in tests.

toggle-class!

(toggle-class! id-or class)

Toggle class on element. Avoid for general use. Good for root (pass id nil or :root), can also pass type/class

unix->ts

(unix->ts ms & [format])

Format epoch milliseconds in UTC, matching the original log/chat formatter.

when-seen

(when-seen on-view & [repeating?])

Dispatch event when observer hit, then end

wrap-fn

(wrap-fn f wrapped)

Wraps a function so gets called as part of outer fn

xy-in

(xy-in e dimension)

xy-in-rect

(xy-in-rect e dimension rect)