Skip to main content

Crate formars_ui

Crate formars_ui 

Source
Expand description

formars-ui: Leptos 0.8 companion crate for formars-signals — the use_form hook, the <Form> submit wrapper, and the <TextField> field binding.

§Dependency note: effects availability (FU-DEP-3)

Both leptos and reactive_graph are declared here with default-features = false. In reactive_graph 0.2.x the effect module (reactive_graph::effect) is UNCONDITIONAL — the optional effects feature gates only debug diagnostics, so no effects feature edge appears in cargo tree -e features at all. This is EXPECTED and harmless: formars-signals remains intact because its code paths never schedule effects (FS-DEP-2 holds); only this crate’s <TextField> display effect uses the always-present module.

§SSR submit exclusion (FU-FM-6)

<Form> markup may render server-side, but submit execution is client-path only in v0: leptos::task::spawn_local requires a local-task executor unavailable on server threads, and the composed submit future is deliberately NOT Send, so it can never be driven by tokio::spawn.

§Context resolution behavior (FU-HK-2)

use_form provisions the controller as Leptos context. use_form_controller() PANICS outside any use_form tree; try_form_controller() is the graceful Option-returning variant.

§IME / caret caveat (FU-TF-2)

<TextField> pushes signal content back to the DOM only when it differs from the current DOM value, which prevents caret jumps from same-value writes and avoids fighting mid-composition IME state. Residual composition edge cases vary by rendering engine; treat them as a known limitation and verify manually in a browser.

§No-provider blur behavior (L-1)

When no ancestor called use_form, <TextField>’s blur seam resolves no controller and skips touch-marking: the component still renders and binds values correctly.

§Double-submit race shield (L-2)

<Form> guards each attempt against an in-flight submit and renders its built-in button reactively disabled while submitting. A pathological rapid double-click that slips two attempts past the guard before is_submitting flips cannot be fully excluded natively; the reactive disabled state is the primary shield and this residual race is a known v0 edge.

Structs§

FieldHandle
Accessor view over one registered field’s reactive cells.
FieldPath
Address of the field a FormaIssue refers to.
FormController
Controller-owned registry of form fields.
FormSnapshot
Point-in-time copy of every field value, taken at the submit gate in registry declaration order. Plain owned data — later edits cannot mutate it.
FormaError
Every constraint violated during one parse call, in declaration order (ER-1).
FormaIssue
One violated constraint: where (FieldPath), what (IssueCode), human-readable message, and structured parameters.
UseForm
Returned by use_form; the hook also provisions the controller as Leptos context so descendants can resolve it.

Enums§

IssueCode
Stable, enumerable identifiers for every builtin constraint (ER-3), plus IssueCode::Custom for consumer-defined ones.
RegisterError
Error returned by FormController::register.
SubmitError
Why a composed submit future failed.
SubmitOutcome
Mirrors SubmitError arms plus success, delivered to the caller’s on_outcome callback.
ValidateOn
When a field’s validation issues become visible to the consuming UI.
Value
Dependency-free dynamic value tree — the erased currency of the crate::schema::DynSchema view.

Functions§

Form
Encapsulates async form submission over a FormController.
TextField
One bound string field: bidirectional value bridge over the handle’s get_str/set_str convenience layer, touch-on-blur via the resolved controller, gated error rendering, and conditional pushback.
try_form_controller
Graceful variant of use_form_controller: None when no ancestor called use_form.
use_form
Constructs a controller with default_validate_on, provides it as context (provide_context(controller.clone())), and returns it.
use_form_controller
Resolves the ancestor-provided form controller.