import { IChart, IMutField, IVisSpec, PartialChart, TerseSpec } from '../interfaces'; /** * The kind of spec accepted by {@link normalize}: * - `chart`: a (possibly partial) modern spec that already has a `layout` key. Routed through * `parseChart` passthrough, then completed with defaults. * - `vis-spec`: the deprecated `IVisSpec` format (single `config` object carrying layout-ish * fields). Routed through the `forwardVisualConfigs` → `visSpecDecoder` → `convertChart` * migration chain inside `parseChart`. * - `vega-lite`: a Vega-Lite-like spec. Routed through `VegaliteMapper`; requires `meta` to * resolve field names, otherwise unresolved fields fall back to the count field. * - `terse`: the human-authored TerseSpec authoring format (docs/terse-spec-design.md). * Expanded via `expandTerse`; requires `meta` to resolve field names. * - `partial-chart`: everything else — treated as `PartialChart` and completed with defaults. */ export type ISpecKind = 'chart' | 'vis-spec' | 'vega-lite' | 'terse' | 'partial-chart'; /** * Detect which input format a spec is in. The rules are ordered and explicit: * 1. a `$schema` pointing at vega.github.io → `vega-lite`; the tersespec URL → `terse`; * 2. any Vega-Lite-exclusive structural key (`encoding` / `spec` / `layer` / `concat` / * `hconcat` / `vconcat`) → `vega-lite`; * 3. any terse trigger key (`x` / `y` / `computed` / `filters`) without an `encodings` * key → `terse` (this runs before the `layout` rule so the canonical `layout` * escape hatch inside a terse spec does not shadow it); * 4. a bare `mark` (shared key, no terse channels present) → `vega-lite`; * 5. a `layout` key → `chart` (same duck-typing as `parseChart` / `importCode`); * 6. a `config` carrying legacy-only keys (`stack`, `size`, `resolve`, …) → `vis-spec`; * 7. anything else → `partial-chart`. */ export declare function detectSpecKind(input: object): ISpecKind; /** * Normalize any accepted spec input into a complete, canonical IChart: * every encoding channel present, config/layout defaults filled, `visId` generated when missing, * spatial channels linted by `algebraLint`, and a `$schema` version stamp attached. * * This is a pure function (no store, no React, no side effects) and is idempotent: * `normalize(normalize(x, meta), meta)` deep-equals `normalize(x, meta)`. * * Existing import/export paths do not call this function; it is a purely additive entry point. * As a strict entry it also runs the workflow field validation pass and throws on structurally * corrupt field sets (dangling computed references, cyclic dependencies, duplicate fids) that * would otherwise compute silently wrong data downstream. * * @param input a full or partial IChart, a deprecated IVisSpec, or a Vega-Lite-like spec. * @param meta dataset fields; required to resolve field names for the Vega-Lite path. */ export declare function normalize(input: IChart | IVisSpec | PartialChart | TerseSpec | Record, meta?: IMutField[]): IChart;