(add-ratom id val)
Add a ratom for a dashboard model. id
is the key for the ratom in
the dashboard model db and is typically a keyword, but must be a
print readably object. val
is the initial value for the
model. Dashboard ratoms are used in conjunction with 'symbol
translated' callback functions (see add-symxlate
) to hold the
state of reactive components in dashboards.
Add a ratom for a dashboard model. `id` is the key for the ratom in the dashboard model db and is typically a keyword, but must be a print readably object. `val` is the initial value for the model. Dashboard ratoms are used in conjunction with 'symbol translated' callback functions (see `add-symxlate`) to hold the state of reactive components in dashboards.
(add-symxlate sym val)
Add a symbol to function mapping to the symbol to function translation db. 'sym' must be a symbol. Typically it will be a symbol in the namespace of the tab issuing the call. 'val' must be a function. The symbol may then be used in place of the function in any associated hiccup and/or re-com components which require a function at the given location. The primary purpose is to enable saving and restoring reactive function parameters across document loads and server restarts.
Example:
;;; Set up the symbol translation for a slider component (let [sval (sc/add-ratom :m4 "1.0") chgfn #(density-fn % :rhist sval)] (sc/add-symxlate 'density-fn chgfn))
...
[slider :model (sc/get-ratom :m4 (str begden)) :min 0.2, :max 2.0, :step 0.2 :width "200px" :on-change 'density-fn]
Add a symbol to function mapping to the symbol to function translation db. 'sym' must be a symbol. Typically it will be a symbol in the namespace of the tab issuing the call. 'val' must be a function. The symbol may then be used in place of the function in any associated hiccup and/or re-com components which require a function at the given location. The primary purpose is to enable saving and restoring reactive function parameters across document loads and server restarts. Example: ;;; Set up the symbol translation for a slider component (let [sval (sc/add-ratom :m4 "1.0") chgfn #(density-fn % :rhist sval)] (sc/add-symxlate 'density-fn chgfn)) ... [slider :model (sc/get-ratom :m4 (str begden)) :min 0.2, :max 2.0, :step 0.2 :width "200px" :on-change 'density-fn]
(add-update-frame picframe fid locid)
Programmatically add, or update if exists, the picture frame with
frame id fid
with the new content given by the legal fully
transformed template picframe
defining the frame and any
visualization. locid
is the relative placement location, one of
:beg
for beginning of doc body
:end
for end of doc body
:before
for before the current frame
:after
for after the current frame
Programmatically add, or update if exists, the picture frame with frame id `fid` with the new content given by the legal fully transformed template `picframe` defining the frame and any visualization. `locid` is the relative placement location, one of `:beg` for beginning of doc body `:end` for end of doc body `:before` for before the current frame `:after` for after the current frame
(delete-frame fid)
Programmatically delete the frame with frame id fid
from the
current tab's document body.
Programmatically delete the frame with frame id `fid` from the current tab's document body.
(get-cur-date & {:keys [month-name]})
Get the current date as a string 'y-m-d'. The month m is either
1-12 or, if :month-name
is given and true, the 3 letter
abbreviation for month, eg, 'Jan', 'Mar', 'Jul'.
Get the current date as a string 'y-m-d'. The month m is either 1-12 or, if `:month-name` is given and true, the 3 letter abbreviation for month, eg, 'Jan', 'Mar', 'Jul'.
(get-ratom id)
Return the ratom associated with id
in the dashboard model db. See
add-ratom
for more details.
Return the ratom associated with `id` in the dashboard model db. See `add-ratom` for more details.
(get-symxlate sym)
Return the function associated with the symbol sym
in the symbol to
function translation db. See add-symxlate
for more details.
Return the function associated with the symbol `sym` in the symbol to function translation db. See `add-symxlate` for more details.
(react-hack)
Monkey patching ... sigh ... This changes the (incorrect) behavior of
React's removeChild and insertBefore functions which do not properly
track changes in the DOM as effected by 3rd party libs. MathJax,
Google Translate, etc. For details see
https://github.com/facebook/react/issues/11538
Monkey patching ... sigh ... This changes the (incorrect) behavior of React's removeChild and insertBefore functions which do not properly track changes in the DOM as effected by 3rd party libs. MathJax, Google Translate, etc. For details see `https://github.com/facebook/react/issues/11538`
(run-prom-chain prom bodyfn)
Run the promise chain implicit in promise prom
- if prom
results
in another promise, recurse on this result until the result is no
longer a promise. At this end of the chain, run the function
bodyfn
in the context of the chain's results
Run the promise chain implicit in promise `prom` - if `prom` results in another promise, recurse on this result until the result is no longer a promise. At this end of the chain, run the function `bodyfn` in the context of the chain's results
(set-md-defaults optsmap)
Set the tab defaults for various markdown and codemirror document
parameters.optsmap
is a nested map with two top level keys: :md
and :cm
for general markdown parameters and parameters specific to
the layout and behavior of codemirror elements respectively.
:md
a map of the following keys and associated values:
:vmargin
<a string giving CSS size - typically 'xxxpx'>
The vertical spacing of a markdown element from others
:margin
<a string giving a CSS size - typically 'xxxpx'>
The horizontal spacing of a markdown element from others
:width
<a string giving a CSS size - typically 'xxxpx'>
The width of the textual field for a markdown element
:font-size
<a string giving a CSS size - typically 'xxxpx'>
Size of the font for the markdown element text (including LaTex)
:cm
a map of the following keys and associated values:
:width
<a string giving a size in pixels 'xxxpx'>
The width of the editor pane
:height
<a string giving a size in pixels 'xxxpx'>
The height of the editor pane
:out-width
<a string giving a size in pixels 'xxxpx'>
The width of the associated output pane if editor is live
:out-height
<a string giving a size in pixels 'xxxpx'>
The height of the associated output pane if editor is live
:readonly
<boolean true or false>
Whether the editor is live (editable) or a static pane
If :readonly
is true editor is a static pane w/o an output pane
:layout
<:left-right or :up-down>
Orientation (relative placement) of the editor and its output pane.
:ed-out-order
<:first-last or :last-first>
The order of the editor and its output wrt the layout. If :first-last
the editor matches 'left' or 'up' and output pane matches 'right' or
'down'. Vice-versa for :last-first.
Set the tab defaults for various markdown and codemirror document parameters.`optsmap` is a nested map with two top level keys: `:md` and `:cm` for general markdown parameters and parameters specific to the layout and behavior of codemirror elements respectively. `:md` a map of the following keys and associated values: `:vmargin` <a string giving CSS size - typically 'xxxpx'> The vertical spacing of a markdown element from others `:margin` <a string giving a CSS size - typically 'xxxpx'> The horizontal spacing of a markdown element from others `:width` <a string giving a CSS size - typically 'xxxpx'> The width of the textual field for a markdown element `:font-size` <a string giving a CSS size - typically 'xxxpx'> Size of the font for the markdown element text (including LaTex) `:cm` a map of the following keys and associated values: `:width` <a string giving a size in pixels 'xxxpx'> The width of the editor pane `:height` <a string giving a size in pixels 'xxxpx'> The height of the editor pane `:out-width` <a string giving a size in pixels 'xxxpx'> The width of the associated output pane if editor is live `:out-height` <a string giving a size in pixels 'xxxpx'> The height of the associated output pane if editor is live `:readonly` <boolean true or false> Whether the editor is live (editable) or a static pane If `:readonly` is true editor is a static pane w/o an output pane `:layout` <:left-right or :up-down> Orientation (relative placement) of the editor and its output pane. `:ed-out-order` <:first-last or :last-first> The order of the editor and its output wrt the layout. If :first-last the editor matches 'left' or 'up' and output pane matches 'right' or 'down'. Vice-versa for :last-first.
(update-data data-maps)
Originally meant as general updater of vis plot/chart data values. But to render these, requires knowledge of the application pages/structure. So, this is not currently used. If we can figure out Vega chageSets and how they update, we may be able to make this a general op in Hanami.
Originally meant as general updater of vis plot/chart data values. But to _render_ these, requires knowledge of the application pages/structure. So, this is not currently used. If we can figure out Vega chageSets and how they update, we may be able to make this a general op in Hanami.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close