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
//! Runtime helpers for Forge directives: `@class`, `@style`, `@lang`, `@old`.
/// Build a class string from a list of `(class, condition)` pairs.
///
/// ```ignore
/// // In a template:
/// @class([("active", is_active), ("muted", !is_active), ("bg-red-50", has_error)])
///
/// // Lowered to: forge::class_list(&[("active", is_active), ...])
/// ```
/// Build an inline-style string from `(property, value, condition)` triples,
/// or just always-applied `(property, value)` pairs.
///
/// ```ignore
/// @style([("color", "red", has_error), ("font-weight", "bold", true)])
/// ```
/// Placeholder for translation lookup. v0.2 will integrate `fluent` or `rust-i18n`.
///
/// For now, returns the key passed in — apps wanting i18n today can replace this
/// helper via the `forge` re-export.
/// Placeholder for pluralized translation. v0.2 ships real plural rules.
/// A request-scoped map of old form input values, used by `@old('field')`
/// to repopulate forms after a validation failure + redirect.
///
/// The web stack writes flash data containing old input on validation failure;
/// the next request reads it into a `HashMap<String, String>` named `old_input`
/// that the template renders against.
pub type OldInput = HashMap;
/// A typed alias for the error map exposed to templates via `@error('field')`.
pub type FormErrors = IndexMap;