import { LinkerFormatter } from "./linked_column_postfix.js"; import { AxisQualification, MatchQualifications, PColumnSpec, PObjectId, PObjectSpec, Trace, Trace as Trace$1, TraceEntry } from "@milaboratories/pl-model-common"; /** SDK-internal trace shape — adds fields used by this algorithm only, not part of the on-disk contract. */ type ExtendedTraceEntry = Trace[number] & { importance?: number; position?: "prefix" | "suffix"; }; export type LinkerStep = { /** Linker column spec — its `axesSpec` yields the source axis (root); its `LinkLabel`/`Label` names it. */ spec: PColumnSpec; /** Axis qualifications applied on this hop. Not yet consumed by the postfix (deferred). */ qualifications?: AxisQualification[]; }; export type Entry = PObjectSpec | { spec: PObjectSpec; /** Extra trace entries merged with the base trace from annotations. */ extraTrace?: ExtendedTraceEntry[]; /** Linker steps (`[0]` source-most) traversed to reach this column; rendered as a "via …" * postfix only when needed for uniqueness — see {@link derivePostfixes}. */ linkerPath?: LinkerStep[]; /** Axis qualifications applied to the hit column / already-bound anchors; rendered as "[…]" suffixes. */ qualifications?: MatchQualifications; /** Something the UI shows beside the label, like a link icon. Columns with different markers * need no "via" postfix to tell them apart. */ marker?: string; }; /** * Per-zone formatters. Each one receives raw inputs and returns the rendered text for that zone, * or `undefined` to suppress the zone entirely (no synthetic injection → no minimization, no render). */ export type DeriveLabelsFormatters = { /** Native column label. Default: identity. `undefined` → label entry not added (treated as if spec had no label). */ native?: (label: string, spec: PObjectSpec, index: number) => string | undefined; /** Linker/source postfix zone (phase 2). Receives the distinguishing tokens (`{ root, linkers }`) * and returns the "via …" text, or `undefined` to suppress. */ linker?: LinkerFormatter; /** Hit-axis qualifications block. Default: `[${formatQualifications(qs)}]`. */ hitQualification?: (qualifications: AxisQualification[], spec: PObjectSpec, index: number) => string | undefined; /** Per-anchor qualifications block. Default: `[${anchorId}: ${formatQualifications(qs)}]`. */ anchorQualification?: (anchorId: PObjectId, qualifications: AxisQualification[], spec: PObjectSpec, index: number) => string | undefined; }; export type DeriveLabelsOptions = { /** Separator to use between label parts (" / " by default). */ separator?: string; /** If true, native label is appended at the end of the trace zone. By default it is prepended (label is the most important name). */ addLabelAsSuffix?: boolean; /** Force inclusion of native column label even when not needed for uniqueness. */ includeNativeLabel?: boolean; /** Trace types that must be included in the label. */ forceTraceElements?: string[]; /** Per-zone custom formatters. Returning `undefined` from any formatter suppresses the corresponding zone. */ formatters?: DeriveLabelsFormatters; }; /** * Distinct labels for a set of columns. Two phases: * 1. {@link deriveStems} — treats each column as a single entity (native label + trace + hit/anchor * qualifications) and produces the minimal distinguishing "stem". * 2. {@link derivePostfixes} — for columns still colliding on their stem, appends a "via …" postfix * describing the difference between their linker sources (root axis, then linker chain). */ export declare function deriveDistinctLabels(values: Entry[], options?: DeriveLabelsOptions): string[]; export type { Trace$1 as Trace, TraceEntry }; //# sourceMappingURL=derive_distinct_labels.d.ts.map