ALPHA. This namespace's API is subject to change.
URLCodec protocol and codec-agnostic functions that convert statechart
configuration into URLs. The protocol defines encode/decode; implementations
live in separate namespaces (e.g. url-codec-transit for the default
transit+base64 codec).
ALPHA. This namespace's API is subject to change. URLCodec protocol and codec-agnostic functions that convert statechart configuration into URLs. The protocol defines encode/decode; implementations live in separate namespaces (e.g. `url-codec-transit` for the default transit+base64 codec).
(configuration->url elements-by-id configuration data-model codec)Combines path and params into a URL string. Builds an encoding context and delegates to the codec.
Combines path and params into a URL string. Builds an encoding context and delegates to the codec.
(deep-configuration->url state-map registry session-id local-data-path-fn codec)Walks the full invocation tree starting from session-id to build a URL that includes
child chart state. Uses the same tree-walk pattern as deep-busy? in routing.
state-map is the current Fulcro app state. registry is the statechart registry.
local-data-path-fn is a function (fn [session-id & ks]) returning the Fulcro state
path for a session's local data (to avoid circular dependency on fulcro_impl).
codec is a URLCodec instance.
Walks the full invocation tree starting from `session-id` to build a URL that includes child chart state. Uses the same tree-walk pattern as `deep-busy?` in routing. `state-map` is the current Fulcro app state. `registry` is the statechart registry. `local-data-path-fn` is a function `(fn [session-id & ks])` returning the Fulcro state path for a session's local data (to avoid circular dependency on fulcro_impl). `codec` is a URLCodec instance.
(element-segment element)Returns the URL path segment for a route element. Uses :route/segment when
present, otherwise falls back to (name (:route/target element)).
Returns the URL path segment for a route `element`. Uses `:route/segment` when present, otherwise falls back to `(name (:route/target element))`.
(params-from-configuration elements-by-id configuration data-model)Given a normalized statechart's elements-by-id, the active configuration, and the
statechart's data model map, collects [:routing/parameters <state-id>] for each active
route state. Returns a map keyed by state ID, or nil if no state has params.
The data-model is the session's local data map (from working memory).
Given a normalized statechart's `elements-by-id`, the active `configuration`, and the statechart's data model map, collects `[:routing/parameters <state-id>]` for each active route state. Returns a map keyed by state ID, or nil if no state has params. The `data-model` is the session's local data map (from working memory).
(path-from-configuration elements-by-id configuration)Given a normalized statechart's elements-by-id and a set of active state IDs (configuration),
finds the active leaf route states and walks up the element tree collecting :route/target
simple names from each ancestor. Returns a path string like /AdminPanel/AdminUserDetail.
A leaf route state is one that has :route/target and no children with :route/target.
If multiple leaf routes are active (parallel regions), returns the path for the first one found.
Given a normalized statechart's `elements-by-id` and a set of active state IDs (`configuration`), finds the active leaf route states and walks up the element tree collecting `:route/target` simple names from each ancestor. Returns a path string like `/AdminPanel/AdminUserDetail`. A leaf route state is one that has `:route/target` and no children with `:route/target`. If multiple leaf routes are active (parallel regions), returns the path for the first one found.
(decode-url this href route-elements)Given a URL string and route-elements map, return {:leaf-id <state-id> :params <map>}, or nil. May return {:params <map>} without :leaf-id when params are present but the leaf segment doesn't match a known route element (e.g. cross-chart targets).
Given a URL string and route-elements map, return {:leaf-id <state-id> :params <map>},
or nil. May return {:params <map>} without :leaf-id when params are present but the
leaf segment doesn't match a known route element (e.g. cross-chart targets).(encode-url this context)Given an encoding context map, return a URL path string (with query if needed). Context keys: :segments (vector of state IDs), :params (map keyed by state-id), :route-elements (map of state-id -> element map).
Given an encoding context map, return a URL path string (with query if needed). Context keys: :segments (vector of state IDs), :params (map keyed by state-id), :route-elements (map of state-id -> element map).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |