/** * What every input control shares: the prop fragment, the cross-field checks * (state binding, initial value, filter field and match), and the markup * pieces (wrapper attributes, hint, the no-script note). * * A control writes one scalar to `state.`, and inside a `filter-bar` it * filters its target's rows by one field with one enumerated operator. There * is no other behavior to express: no handler, expression or selector. */ import type { DataRow } from '../../data/dataset-types.js'; import type { IrNode } from '../../ir.js'; import type { JsonValue } from '../../json.js'; import type { CheckContext } from '../../registry/block-module.js'; import type { PropSchema } from '../../registry/prop-schema.js'; import type { AttributeValue } from '../../render/escape.js'; import type { RenderContext } from '../../render/render-context.js'; export declare const FILTER_BAR_TYPE = "filter-bar"; /** The JSON type a control writes to state. */ export type ControlValueType = 'string' | 'number' | 'boolean'; /** One control type's binding and filtering contract. */ export interface ControlKind { type: string; valueType: ControlValueType; /** Filter operators the control may use inside a filter-bar; the first is the default. */ matches: readonly string[]; } /** Shown in place of a working control when scripts are off. */ export declare const REQUIRES_JS_NOTE = "Interactive when JavaScript is on."; /** Props shared by every control. `matches` decides whether `match` is a prop at all. */ export declare function controlProps(kind: ControlKind, value: PropSchema, extra?: Record): Record; /** Where a control sits: inside a filter-bar (with its resolved target) or standalone. */ export interface ControlPlacement { bar?: IrNode; target?: IrNode; } export declare function placementOf(node: IrNode, byId: (id: string) => IrNode | undefined): ControlPlacement; /** The declared state key a valid `bind` names, or undefined. */ export declare function boundKey(node: IrNode, state: Record): string | undefined; /** * The value the control starts with: a bound, non-null state value wins over * the authored `value`, so the compiled page matches the state it boots with. */ export declare function initialValue(node: IrNode, state: Record): JsonValue | undefined; /** The checks every control runs; type-specific checks follow in each module. */ export declare function checkControl(node: IrNode, kind: ControlKind, context: CheckContext): void; /** * Distinct, non-null values of one field, as option values: numbers in * numeric order first, then everything else by code unit. Deterministic and * locale-free. */ export declare function distinctFieldValues(rows: readonly DataRow[], field: string): string[]; /** Wrapper attributes: identity, state binding and filter wiring. */ export declare function controlAttributes(node: IrNode, kind: ControlKind, context: RenderContext, className?: string): AttributeValue; /** The operator the runtime applies; checkbox and switch filter on truthiness. */ export declare function filterMatch(node: IrNode, kind: ControlKind): string; export declare function inputId(node: IrNode): string; export declare function hintId(node: IrNode): string; /** `aria-describedby` for the native input, when a hint exists. */ export declare function describedBy(node: IrNode): string | undefined; /** The hint, then the no-script note for a standalone control (a bar carries one note). */ export declare function controlFooter(node: IrNode, context: RenderContext): string; export declare function requiresJsNote(): string; export declare function visibleLabel(node: IrNode): string; /** True when the control sits in a filter-bar, so an empty choice means "no filter". */ export declare function inFilterBar(node: IrNode, context: RenderContext): boolean; //# sourceMappingURL=control-shared.d.ts.map