Expand description
The macro template’s value language (catalog/macros.json $comment):
{props.x} paths with |fallback, len(path), range(n), !path,
string interpolation, and the $map / $cond / $eq / $lt / $add /
$sub / $clamp / $percent / $coalesce / $text / $not / $fill
value objects. Mirrors src/expr.ts line by line.
Round 1 (docs/round-1-contract.md §1): an input may be an A2UI DYNAMIC
value — a data binding {path} or a function call {call, args} — which
has no value at expansion time. The evaluator then EMITS a call over the
core functions that the renderer evaluates at bind time (data::bind_tree)
instead of computing. A whole-string {props.x} that is a MEMBER passes a
dynamic value through unchanged (two-way binding survives); as an OPERAND
of a $-object a |fallback is kept as fallback{value, default}.
$fill ALWAYS emits fill (its template is a $string.<id> the
surface’s string table resolves at bind time).
JavaScript’s undefined is None; JSON null is Some(Value::Null).
Structs§
- Expr
Context - What a template expression can see: the node id, its props, and the
$eachloop variables (item,index, …).
Enums§
- Decided
- A condition decided now (
Bool) or the dynamic value it depends on.
Constants§
- CORE_
FUNCTION_ NAMES - The core function names in catalog order (
set= the action; the format functions live informat). - MAX_
RANGE_ ITEMS - The most indexes
range(n)yields (R8 F51): a Rating’smaxof 1e8 or 1e300 would otherwise allocate that many items before the component budget could refuse them. Equalslimits::MAX_TEMPLATE_ITEMS; a largernis silently clamped (the reducer’smaxComponentsreports the overflow). MirrorsMAX_RANGE_ITEMSinsrc/expr.ts.
Functions§
- call
{call: name, args}with undefined args dropped (the TScall).- clamp_
number clamp: the value as a number held inside [min, max]; a missing bound (undefined or null) does not clamp;minwins when max < min.- core_
function - The core value functions (
core.catalog.jsonfunctions.core;setis an action,data::run_action) once the arguments are resolved: the reference every client function table mirrors (src/expr.ts CORE_FUNCTIONS). OuterNone= not a core function; innerNone= undefined. - eval_
condition - A condition decided NOW: a dynamic condition counts as true (the part
exists;
visiblecarries the bound test, seemacros). - eval_
condition_ value - A condition: a string expression or a value object (
$eq…).Boolwhen it can be decided now; the dynamic value when it cannot. - eval_
expr - One expression:
len(path),range(n),path|fallback,!path,path. The function forms wrap the whole expression and are tried first, so a fallback inside their parentheses stays theirs. - eval_
value - Any template value: strings interpolate, arrays and objects recurse, the
$-objects compute (or emit a call when an input is dynamic).None(undefined) results are dropped from objects and arrays;nullis kept. - fill_
template fill: the template (already resolved through the string table) with its{name}placeholders filled from params (strings::format_string).- filter_
items - Round 4 (VAPP-103)
filter(src/expr.ts filterItems): the items of an array that match, in order.where= field → value, every entry must hold (eqequality); an entry whose value is null or “” does NOT constrain.query= a case-insensitive substring of ANY offields(the item’s own string and number values whenfieldsis absent; a string or number item matches itself); a missing or blank query does not constrain. Not an array → []. - is_
binding - An A2UI data binding: an object with exactly one key,
path(a string). - is_call
- An A2UI function call: an object with a string
call. - is_
dynamic - A value the expander cannot evaluate: the renderer will.
- js_
round - JS
Math.round(half rounds UP, also for negatives). - percent
$percent’s arithmetic, shared with the corepercentfunction: the share ofmaxas “N%”, clamped to 0..100, two decimals.- to_
number - The TS
toNumber: numbers stay, everything elseNumber(v ?? 0) || 0. - truthy
undefined,null,falseand""are false; 0 is TRUE (a count of zero still shows).- truthy_
opt truthyover an optional (None= undefined = false).- values_
equal eq(and$eq): strict equality, except that a NUMBER and a string spelling that number are equal (5vs"5": form and URL state arrive as strings). Nothing else coerces (0vs"",1vstruediffer).