/** * `visibleWhen`: show a block only while a page state value matches. * * A condition is data, never an expression: one state path, one operator from * a closed list, and scalar operands. The compiler evaluates it against the * initial `state` so the emitted markup already shows the initial view (with * scripts off, in print and in a screenshot), and the runtime re-evaluates the * same condition after every state change. `evaluateCondition` here and * `evalCondition` in the runtime's state part must agree exactly. */ import { type DataScalar } from '../data/dataset-types.js'; import { type DiagnosticBag } from '../diagnostics.js'; import { type JsonValue } from '../json.js'; export type Condition = { path: string; op: 'equals' | 'notEquals'; value: DataScalar; } | { path: string; op: 'in' | 'notIn'; value: DataScalar[]; } | { path: string; op: 'truthy' | 'falsy'; }; export declare const CONDITION_OPERATORS: readonly ["equals", "notEquals", "in", "notIn", "truthy", "falsy"]; /** Values an `in` or `notIn` list may hold. */ export declare const MAX_CONDITION_VALUES = 20; /** JSON Schema for `visibleWhen`: the path plus exactly one operator. */ export declare const CONDITION_JSON_SCHEMA: Record; /** * Validate an author condition, `{ path: state.metric, equals: cost }`. Exactly * one operator key. A path whose first key is not declared in `state` is a * warning: the condition reads as unset until an action sets it. */ export declare function validateCondition(value: unknown, path: string, bag: DiagnosticBag, state: Record): Condition | undefined; /** * Evaluate a condition against a state snapshot. Strict equality, list * membership by strict equality, and JavaScript truthiness: the same rules * the runtime applies after every state change. */ export declare function evaluateCondition(condition: Condition, state: Record): boolean; //# sourceMappingURL=conditions.d.ts.map