/** * The declared inputs, in both directions. * * Out: one settings row per `input()` call, which is the whole of the generated * settings dialog. The program already carries the label, the group, the help * text, the bounds and the choices, because a settings dialog and a legend have * to exist before the first bar runs, so nothing here decides anything. It * translates a `kind` into the control a chart renders. * * Back in: what a dialog stored, turned into the values the engine validates. * Two kinds need work and the rest pass through untouched. A colour arrives as a * CSS string and has to become four numbers. A choice arrives as a string even * when the script wrote numbers, because a select control has string values, so * the stored string is matched against the declared options and the option's own * value is what the engine is given. * * **A value the host stored and this module cannot convert is passed through * rather than replaced.** The engine refuses it with OS6019, naming the key and * the rule it broke. Substituting the default here would be a settings dialog * that silently ignores what a user typed, which is the failure `2.6` is written * to prevent, and it would hide it one layer further down than the engine does. * * **And a stored value the engine will refuse is not a value this adapter has.** * The declared shape is built before anything runs, so a settings map holding a * precision of 99 against an input declared `max = 8` put 99 into * `plots[0].priceFormat`, which a host can show in a legend or on a price scale * before the calculation that refuses it has been asked for. What a stored value * is worth has one answer and it is the engine's own: `checkSetting` is the * function the load refuses with, asked here before the load exists. A value it * will not take reads as the **declared default** in the declared shape, and * travels to the engine exactly as the host stored it, so the run still stops * with OS6019 naming the key and the bound. * * Neither half of that is a fallback. The value is not repaired, because the * same map still refuses; and the shape is not withheld, because the settings * dialog a reader corrects the value in is built from the descriptor, and a * study that refuses to describe itself is one whose bad setting cannot be * reached. What a host is handed meanwhile is the shape the script declared, * which is the shape the study has until a settings map the engine takes * arrives. */ import type { CompiledInput, CompiledProgram } from '../../core/emit/index.js'; import type { Value } from '../../core/engine/index.js'; import type { ChartInput, ChartSettings } from './contract.js'; import type { InputLookup } from './fields.js'; /** One settings row per declared input, in source order. */ export declare function inputRows(program: CompiledProgram): readonly ChartInput[]; /** * What the engine is handed as the host's settings. * * Only the declared keys travel. A chart's settings object also carries the * generated per-plot appearance keys and the chart's timezone, and an engine * given those would have nothing to do with them; leaving them out keeps the * two vocabularies from having to agree on anything but the input keys. */ export declare function engineSettings(program: CompiledProgram, settings: ChartSettings): Record; /** The value each declared input currently holds, for a declaration field. */ export declare function lookupFor(program: CompiledProgram, settings: ChartSettings): InputLookup; /** * A comparable spelling of every declared input's value. * * The incremental path is only valid while the engine it holds was loaded from * the same settings, and comparing the two spellings is cheaper and safer than * trusting a chart to have told us that a settings change happened. * * **It spells what the engine is handed, not what the declared shape shows.** * Those part company the moment a stored value is one the engine refuses: every * refused value shows the same declared default, so a signature taken from the * shape would read a change from a setting that runs to one that cannot as no * change at all, keep the held engine and go on drawing the old numbers instead * of reporting OS6019. The kind is spelled beside the value for the same * reason: a stored `7` and a stored `"7"` are one quotation mark apart, and one * of them is refused. */ export declare function signatureOf(program: CompiledProgram, settings: ChartSettings): string; /** The declared default, as the value model holds it. */ export declare function defaultValue(declared: CompiledInput): Value; //# sourceMappingURL=settings.d.ts.map