Liking cljdoc? Tell your friends :D

com.fulcrologic.fulcro.algorithms.macro-support

React-agnostic compile-time helpers extracted from the defsc macro. These functions run at macroexpansion time (CLJ only) and are used to validate and rewrite the query, ident, and initial-state options of a stateful component definition.

Errors are reported via an injectable error function so that this namespace does not depend on cljs.analyzer. By default default-macro-error returns an ex-info. The defsc macro rebinds *macro-error* to cljs.analyzer/error so that CLJS compilation produces nice analyzer errors.

React-agnostic compile-time helpers extracted from the `defsc` macro. These functions run at macroexpansion
time (CLJ only) and are used to validate and rewrite the query, ident, and initial-state options of a
stateful component definition.

Errors are reported via an injectable error function so that this namespace does not depend on
`cljs.analyzer`. By default `default-macro-error` returns an `ex-info`. The `defsc` macro rebinds
`*macro-error*` to `cljs.analyzer/error` so that CLJS compilation produces nice analyzer errors.
raw docstring

*macro-error*clj

The function used to construct (not throw) an error from (env msg). Rebound by defsc so that CLJS compilation produces analyzer errors. Defaults to default-macro-error.

The function used to construct (not throw) an error from `(env msg)`. Rebound by `defsc` so that CLJS
compilation produces analyzer errors. Defaults to `default-macro-error`.
sourceraw docstring

(-legal-keys query)

Find the legal keys in a query. NOTE: This is at compile time, so the get-query calls are still embedded (thus cannot use the AST)

Find the legal keys in a query. NOTE: This is at compile time, so the get-query calls are still embedded (thus cannot
use the AST)
sourceraw docstring

build-and-validate-initial-state-mapclj

(build-and-validate-initial-state-map env
                                      sym
                                      initial-state
                                      legal-keys
                                      children-by-query-key)
source

build-identclj

(build-ident env
             thissym
             propsarg
             {:keys [method template keyword]}
             is-legal-key?)

Builds the ident form. If ident is a vector, then it generates the function and validates that the ID is in the query. Otherwise, if ident is of the form (ident [this props] ...) it simply generates the correct entry in defsc without error checking.

Builds the ident form. If ident is a vector, then it generates the function and validates that the ID is
in the query. Otherwise, if ident is of the form (ident [this props] ...) it simply generates the correct
entry in defsc without error checking.
sourceraw docstring

build-initial-stateclj

(build-initial-state env
                     sym
                     {:keys [template method]}
                     legal-keys
                     query-template-or-method)
source

build-query-formsclj

(build-query-forms env class thissym propargs {:keys [template method]})

Validate that the property destructuring and query make sense with each other.

Validate that the property destructuring and query make sense with each other.
sourceraw docstring

build-raw-initial-stateclj

(build-raw-initial-state env method)

Given an initial state form that is a list (function-form), simple copy it into the form needed by defsc.

Given an initial state form that is a list (function-form), simple copy it into the form needed by defsc.
sourceraw docstring

check-query-looks-validclj

(check-query-looks-valid err-env comp-class compile-time-query)
source

children-by-propclj

(children-by-prop query)

Part of Defsc macro implementation. Calculates a map from join key to class (symbol).

Part of Defsc macro implementation. Calculates a map from join key to class (symbol).
sourceraw docstring

compile-time-query->checkableclj

(compile-time-query->checkable query)

Try to simplify the compile-time query (as seen by the macro) to something that EQL can check ((get-query ..) => a made-up vector). Returns nil if this is not possible.

Try to simplify the compile-time query (as seen by the macro)
to something that EQL can check (`(get-query ..)` => a made-up vector).
Returns nil if this is not possible.
sourceraw docstring

component-queryclj

(component-query query-part)
source

default-macro-errorclj

(default-macro-error env msg)

Default macro error function. Returns (does not throw) an ex-info describing msg, including line/column information from env when available.

Default macro error function. Returns (does not throw) an `ex-info` describing `msg`, including line/column
information from `env` when available.
sourceraw docstring

is-link?clj

(is-link? query-element)

Returns true if the given query element is a link query like [:x '_].

Returns true if the given query element is a link query like [:x '_].
sourceraw docstring

macro-errorclj

(macro-error env msg)

Returns an exception (via *macro-error*) for the given macro env and message msg. Does not throw.

Returns an exception (via `*macro-error*`) for the given macro `env` and message `msg`. Does not throw.
sourceraw docstring

replace-and-validate-fnclj

(replace-and-validate-fn env sym external-args user-arity fn-form)
(replace-and-validate-fn env
                         sym
                         external-args
                         user-arity
                         fn-form
                         user-known-sym)

Replace the first sym in a list (the function name) with the given symbol.

env - the macro &env sym - The symbol that the lambda should have external-args - A sequence of arguments that the user should not include, but that you want to be inserted in the external-args by this function. user-arity - The number of external-args the user should supply (resulting user-arity is (count external-args) + user-arity). fn-form - The form to rewrite sym - The symbol to report in the error message (in case the rewrite uses a different target that the user knows).

Replace the first sym in a list (the function name) with the given symbol.

env - the macro &env
sym - The symbol that the lambda should have
external-args - A sequence of arguments that the user should not include, but that you want to be inserted in the external-args by this function.
user-arity - The number of external-args the user should supply (resulting user-arity is (count external-args) + user-arity).
fn-form - The form to rewrite
sym - The symbol to report in the error message (in case the rewrite uses a different target that the user knows).
sourceraw docstring

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