(anonymous-fn {:keys [form-args form-body]})
Make a function f anonymous by replacing its name with fn.
Make a function f anonymous by replacing its name with fn.
(bind-commands {:keys [form-body form-args] :as f} command-fns)
Wraps the body of a function in a let that makes the view commands available to the body via their names.
Wraps the body of a function in a let that makes the view commands available to the body via their names.
(bind-query-result {:keys [form-body form-args] :as f}
props-query
computed-query)
Wraps the body of a function, binding the values in props and computed props to the names used in the view query and computed query.
Wraps the body of a function, binding the values in props and computed props to the names used in the view query and computed query.
(commands-form? {:keys [form-name]})
Returns true if the input form is a declaration of view commands.
Returns true if the input form is a declaration of view commands.
(default-run-command! cmd-name view params reads)
Default command handler, generating an Om Next transaction with a mutation and queries that correspond 1:1 to the command, its parameters and the optional reads.
Default command handler, generating an Om Next transaction with a mutation and queries that correspond 1:1 to the command, its parameters and the optional reads.
(defview name & forms)
Create a new view with the given name.
Takes an optional query, an optional computed properties "query"
and an arbitrary number of Om Next component functions (such
as ident
, query
, query-params
, initLocalState
or render
)
and JavaScript object methods, without requiring their protocols or
argument bindings (like [this]
or [props]
) to be included in
the definition.
defview
will wrap the function bodies of all instance functions
(ident
, render
, lifecycle functions, any object methods) so that
the values in the query result and in computed properties are bound
to the names appearing in the queries.
Usage:
(defview User
[name email address [street city zipcode]]
[clicked-fn]
(key name)
(validate ...)
(ident [:user/by-name name])
(render
(html
[:div.user {:onClick clicked-fn}
[:h2 name "(" email ")"]
[:ul.address
[:li street]
[:li city]
[:li zipcode]]])))
The above example would define the following:
User
,user
, with a :keyfn
,
derived from (key ...)
, and a :validator
, derived
from (validate ...)
.If the query includes [db [id]]
, corresponding to the Om Next
query attribute :db/id
, it is assumed that the view represents
data from DataScript or Datomic. In this case, defview
will
automatically infer (ident ...)
and (key ...)
functions
based on the database ID. This behavior can be overriden by
specifically defining both, ident
and key
.
Create a new view with the given name. Takes an optional query, an optional computed properties "query" and an arbitrary number of Om Next component functions (such as `ident`, `query`, `query-params`, `initLocalState` or `render`) and JavaScript object methods, without requiring their protocols or argument bindings (like `[this]` or `[props]`) to be included in the definition. `defview` will wrap the function bodies of all instance functions (`ident`, `render`, lifecycle functions, any object methods) so that the values in the query result and in computed properties are bound to the names appearing in the queries. Usage: ``` (defview User [name email address [street city zipcode]] [clicked-fn] (key name) (validate ...) (ident [:user/by-name name]) (render (html [:div.user {:onClick clicked-fn} [:h2 name "(" email ")"] [:ul.address [:li street] [:li city] [:li zipcode]]]))) ``` The above example would define the following: * an Om Next component called `User`, * a component factory called `user`, with a `:keyfn`, derived from `(key ...)`, and a `:validator`, derived from `(validate ...)`. If the query includes `[db [id]]`, corresponding to the Om Next query attribute `:db/id`, it is assumed that the view represents data from DataScript or Datomic. In this case, `defview` will automatically infer `(ident ...)` and `(key ...)` functions based on the database ID. This behavior can be overriden by specifically defining both, `ident` and `key`.
(factory & args)
A wrapper factory around om.next/factory that makes the nil argument for properties optional.
A wrapper factory around om.next/factory that makes the nil argument for properties optional.
(fn-alias {:keys [form-name]})
Return the alias for a view function or the name of the function itself if no alias is defined.
Return the alias for a view function or the name of the function itself if no alias is defined.
A few aliases allowing to define view functions with shorter or more logicial names.
A few aliases allowing to define view functions with shorter or more logicial names.
(fn-args {:keys [form-name]})
Return the arguments (e.g. [this]) for a view function.
Return the arguments (e.g. [this]) for a view function.
(fn-protocol {:keys [form-name]})
Return the scope (e.g. (static om.next/IQuery) for a view function.
Return the scope (e.g. (static om.next/IQuery) for a view function.
(fn-scope {:keys [form-name]})
Return the scope (:static, :instance, :props) for a view function.
Return the scope (:static, :instance, :props) for a view function.
Function specifications for all functions that are not Object instance functions taking [this] as the sole argument.
Function specifications for all functions that are not Object instance functions taking [this] as the sole argument.
(generate-command-fn cmd-name)
Generate an anonymous wrapper function to call the
:run-command
hook with a specific command name.
Generate an anonymous wrapper function to call the `:run-command` hook with a specific command name.
(generate-ident-fn props)
Generate a (ident ...) function from the props spec.
Generate a (ident ...) function from the props spec.
(generate-key-fn props)
Generate a (key ...) function from the props spec.
Generate a (key ...) function from the props spec.
(inject-fn-args f)
Inject a function argument binding vector into f if it doesn't already have one.
Inject a function argument binding vector into f if it doesn't already have one.
(instance-fn {:keys [form-name form-args form-body]})
Make a function to put inside a record or defui expression.
Make a function to put inside a record or defui expression.
(maybe-generate-ident-fn props fns)
If the props spec includes a :db/id property, an (ident ...) function is automatically generated based on this ID.
If the props spec includes a :db/id property, an (ident ...) function is automatically generated based on this ID.
(maybe-generate-key-fn props fns)
If the props spec includes a :db/id property, a (key ...) function is automatically generated based on this ID.
If the props spec includes a :db/id property, a (key ...) function is automatically generated based on this ID.
(maybe-inject-fn-args f)
Inject a function argument binding vector into f unless it is a raw function that is assumed to define its own arguments.
Inject a function argument binding vector into f unless it is a raw function that is assumed to define its own arguments.
(maybe-wrap-render {:keys [form-name form-body] :as f})
If f is the render function, checks whether it has more than one child expression. If so, wraps these children in a wrapper view according to the :wrapper-view option set via workflo.macros.view/configure!.
If f is the render function, checks whether it has more than one child expression. If so, wraps these children in a wrapper view according to the :wrapper-view option set via workflo.macros.view/configure!.
(normalize-fn-name {:keys [form-name] :as f})
Normalize the function name of f. This removes the leading . from the names of raw functions.
Normalize the function name of f. This removes the leading . from the names of raw functions.
(raw-fn? {:keys [form-name]})
Returns true if f is a raw function, that is if its name starts with a ., indicating that its function signature should be left alone.
Returns true if f is a raw function, that is if its name starts with a ., indicating that its function signature should be left alone.
(resolve-fn-alias f)
Resolve the function alias for a view function.
Resolve the function alias for a view function.
(run-command! cmd-name view params reads)
Runs a given command using the configured :run-command handler, if defined.
Runs a given command using the configured :run-command handler, if defined.
(wrap-render {:keys [form-body] :as f})
Wraps the body of the function f in a wrapper view according to the :wrapper-view option set via workflo.macros.view/configure!.
Wraps the body of the function f in a wrapper view according to the :wrapper-view option set via workflo.macros.view/configure!.
(wrapper)
Returns a wrapper factory for use in render functions. If no wrapper function is defined, issues a warning and returns om.dom/div to avoid breaking apps entirely.
Returns a wrapper factory for use in render functions. If no wrapper function is defined, issues a warning and returns om.dom/div to avoid breaking apps entirely.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close