/** * The sanctioned bidirectional bridge between the two Signal vocabularies: * * - {@link SignalSource} — the typed discriminated union ({@link signal.ts}), * the SOURCE OF TRUTH for what a signal reads from. * - {@link SignalInput} — the branded dot-string ({@link brands.ts}) carried on * the wire (`data-czap-boundary`, the serialized boundary `input` field). * * Before this module the two were structurally unrelated: the runtime hot path * (`@czap/astro` boundary/inspector, `@czap/vite` css-quantize) re-parsed the * dot-string with hand-rolled `input.startsWith('scroll.')` forks, each free to * drift from the union's vocabulary AND from each other. This module is the * single place that knows the grammar, so every reader derives its axis from * the SAME parse — the input vocabulary's evaluator-consolidation. * * LAW: `sourceToInput` and `inputToSource` round-trip on every recognized * `SignalSource` (after normalization of omitted discriminants). The drift * guard in `tests/property/signal-input-roundtrip.prop.test.ts` pins it. * * `inputToSource` is intentionally LENIENT: the `SignalInput` brand is an * unvalidated free-form dot-string (tests author `'b'`, `'brightness'`, * `'scroll.depth'`). Unrecognized inputs map to `undefined`, and the runtime * readers treat that exactly as the pre-existing "no built-in reader → frozen" * semantics — never a throw. * * @module */ import { SignalInput } from './brands.js'; import type { SignalSource } from './signal.js'; /** * Project a {@link SignalSource} onto its canonical {@link SignalInput} * dot-string. The forward half of the sanctioned bridge — the one place that * decides what string a typed source serializes to. Omitted discriminants are * treated as their documented defaults so the projection is total. * * @example * ```ts * sourceToInput({ type: 'scroll', axis: 'progress' }); // 'scroll.progress' * sourceToInput({ type: 'viewport' }); // 'viewport.width' * sourceToInput({ type: 'audio', mode: 'amplitude' }); // 'audio.amplitude' * ``` */ export declare function sourceToInput(source: SignalSource): SignalInput; /** * Parse a {@link SignalInput} dot-string back into its typed * {@link SignalSource}, or `undefined` when the string is not a recognized * member of the vocabulary. The inverse half of the bridge and the SINGLE * place the runtime parses an input string — `boundary.ts`, `inspector.ts`, * and `css-quantize.ts` all derive their axis from this, never a re-parse. * * Bare family names (`'viewport'`, `'scroll'`, `'time'`, `'audio'`) resolve to * the family's default discriminant, matching {@link sourceToInput}'s defaults. * * @example * ```ts * inputToSource('scroll.progress'); // { type: 'scroll', axis: 'progress' } * inputToSource('viewport'); // { type: 'viewport', axis: 'width' } * inputToSource('audio.amplitude'); // { type: 'audio', mode: 'amplitude' } * inputToSource('brightness'); // undefined (not in the vocabulary) * ``` */ export declare function inputToSource(input: string): SignalSource | undefined; /** The {@link SignalSourceType} family of an input string, or `undefined`. */ export declare function inputSourceType(input: string): SignalSource['type'] | undefined; //# sourceMappingURL=signal-input.d.ts.map