RMT Reference: Conditions and Expressions
tools/rmt-language/vnext-parser.js is the source of truth for operators and operand forms.
Conditions appear after when and use a small declarative expression language.
Syntax
| Operator | Form | Allowed contexts | Parameters | Function | Diagnostics | Related operators |
|---|
when | when app.ready == true | Lifecycle, stream, event binding | condition expression | Enables work only when the condition passes. | Expression must be complete. | mount, on |
&& | a == true && b == false | Condition | left and right expression | Logical AND. | Right side must be an expression. | ` | | ` |
| ` | | ` | `a == true | | b == true` | Condition | left and right expression | Logical OR. | Right side must be an expression. | && |
! | !app.disabled | Condition | expression | Negates a boolean path or expression. | Argument must be an expression. | when |
== | app.status == "ready" | Condition | two values | Equality comparison. | Both sides must parse. | != |
!= | app.status != "error" | Condition | two values | Inequality comparison. | Both sides must parse. | == |
> | app.count > 0 | Condition | two values | Greater-than comparison. | Both sides must parse. | >= |
>= | app.count >= 1 | Condition | two values | Greater-than-or-equal comparison. | Both sides must parse. | > |
< | app.count < 10 | Condition | two values | Less-than comparison. | Both sides must parse. | <= |
<= | app.count <= 10 | Condition | two values | Less-than-or-equal comparison. | Both sides must parse. | < |
() | (app.ready == true) | Condition | expression | Groups logic. | Closing parenthesis is required. | &&, ` | | ` |
true | app.ready == true | Condition, primitive value | literal | Boolean true. | Function calls are not allowed. | false |
false | app.disabled == false | Condition, primitive value | literal | Boolean false. | Function calls are not allowed. | true |
null | app.value != null | Condition, primitive value | literal | Null value. | Literal only. | != |
| Strings | "ready" | Condition, primitive value | quoted string | Static text value. | Strings need quotes. | contract, message |
| Integers | 120 | Condition, primitive value | integer | Numeric value. | Only integers are tokenized. | durationMs, weight |
| Paths | app.status.text | Condition, payload, reducer | qualified path | References state, input, detail, target or surface context. | Path must contain identifier segments. | payload, reduce |
Allowed contexts
Conditions appear after when. Literals and paths also appear in primitive values, payload mappings and reducer expressions.
Parameters
Conditions allow paths, strings, integers, true, false, null, comparisons, !, &&, || and parentheses.
Description
The condition language is intentionally smaller than JavaScript. It allows decisions, but not function calls or free execution.
Examples
template reference.conditions {
state app.ready type boolean initial true
state app.disabled type boolean initial false
state app.count type number initial 2
portal app.root root "#app" layer surface
surface shell kind page component x-section {
portal app.root
lane visible weight 80 {
mount shell.card from endpoint app.card when (app.ready == true && !app.disabled) || app.count >= 1
}
}
}
Diagnostics
Function calls such as isReady() are not allowed and produce parser diagnostics. Missing parentheses or incomplete comparisons are also reported.
when, mount, stream, on, payload, reduce.
The RMT reference index shows which records accept conditions and expressions. Related article