import type { ChartValues } from './contract.js'; import type { Columns } from './run.js'; /** * Which part of a channel's value a column carries. * * `flag` is a condition rather than a number: a channel that published `true` * for the bar reads 1 and everything else, absence included, reads as a gap. * That is what lets a watched condition travel in a table of numbers, and it * keeps `language.md` 6.6's answer intact on the way: absent is not true. */ export type ColumnPart = 'value' | 'rgb' | 'alpha' | 'flag'; /** * One column of the table: a part of a channel, or the bar each row came from. * * The second kind reads no channel. It holds the index of the bar in the run * the calculation was handed, and it exists because a chart may read the table * onto bars other than those: a chart that transforms its series and runs a * study on the bars the host fed it reads each column at the source bar every * drawn element was completed on, and then hands each hook the element's index. * A hook that reads a column is right by construction. A hook that reads * something the run left elsewhere, indexed by the run's own bars, finds the * bar through this column, which the chart reads across like any other. */ export type ColumnSpec = { readonly key: string; readonly channel: number; readonly part: ColumnPart; } | { readonly key: string; readonly part: 'bar'; }; /** The key a level's price column travels under. */ export declare function levelKey(index: number): string; /** The key one side of a band's computed colour travels under. */ export declare function bandColourKey(band: number, side: 'up' | 'down'): string; /** The two keys a per-bar colour travels under. */ export declare function colourKeys(key: string): { readonly rgb: string; readonly alpha: string; }; /** The colour a per-bar channel carried on one bar, as a chart spells one. */ export declare function colourAt(values: ChartValues, index: number, key: string): string | undefined; /** The two column specifications a per-bar colour channel needs. */ export declare function colourColumns(key: string, channel: number): readonly ColumnSpec[]; /** * The table, for bars `from` up to `to`. * * `from` is zero for a full recompute and the first changed bar for a tail, and * the chart splices a tail onto what it already holds. Every key the full path * produces is produced here too, because a key the tail leaves out is dropped * from the spliced result rather than kept. */ export declare function valuesFrom(specs: readonly ColumnSpec[], columns: Columns, from: number, to: number): ChartValues; //# sourceMappingURL=columns.d.ts.map