1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//! Reactive Rust for HTML script blocks, compiled by Cargo without a Rust DSL.
//!
//! ```
//! use fusor::{signal, derived, effect, batch};
//! let count = signal(0);
//! let doubled = derived({ let count = count.clone(); move || count.get() * 2 });
//! let subscription = effect(move || println!("{}", doubled.get()));
//! batch(|| { count.set(2); count.set(3); });
//! // Prints 0, then 6. Dropping the subscription stops it.
//! drop(subscription);
//! ```
pub use ;
pub use ;
/// Source-version snapshots for supported renderer and async-read integration.
pub use versions;
/// Versioned contract shared by the HTML compiler and the DOM runtime.
/// This is an implementation interface, not application authoring syntax.
pub use ;
/// The explicit input contract for compiler-resolved component tags.
///
/// `Inputs` is a named-field struct (or a unit struct for empty tags). The
/// compiler builds it with an ordinary struct literal: rustc checks every field,
/// its visibility, and its type. Input expressions and this constructor run once
/// per mounted identity, untracked. Pass signals or memos for live shared inputs.
/// Construction is separate from rendering: browser mounts require `Component`.
/// `owner` is the new child's prepared owner. The caller owns preparation,
/// activation, rollback, and conversion of construction errors. This trait does
/// not itself defer ordinary effects or activate the owner.
///
/// Simple concrete components can use `#[derive(fusor::FromInputs)]`:
/// mark every field `#[input]` (required from the parent) or
/// `#[local(init = expression)]` (initialized once per instance). The derive
/// generates a `TypeNameInputs` struct with the component's visibility and
/// public input fields, plus this trait implementation. Original field
/// visibility is unchanged. Unit and all-local components get unit Inputs.
///
/// Local expressions execute in declaration order in the generated constructor;
/// `Self` refers to the component. They have no implicit `inputs`/`owner` names
/// and cannot access other instance fields. Implement this trait manually for
/// input-dependent initialization, owner-aware setup, or generic components.
/// The derive creates neither a `new` method nor a template association.
/// Use `#[from_inputs(crate = ::alias)]` when renaming the runtime dependency.
/// Enable the `derive` feature to use the derive without any browser dependencies;
/// `dom` also enables it. The derived error type is `std::convert::Infallible`.
///
/// # Migrating manual implementations
///
/// Existing browser implementations add `type Error = fusor::dom::JsValue;` and
/// keep their return signature. `fusor::dom::FromInputs` is this same trait.
/// Portable implementations choose their own error type. Browser mounting uses
/// `fusor::dom::IntoMountError`: it preserves `JsValue` and supports `Infallible`,
/// `String`, and `&str`. Implement it for custom browser errors; there is no
/// blanket `Display` conversion.
pub use FromInputs;
pub use JsInputs;
pub use JsInputs;
/// The small set of types needed by a reactive application.