/** * The translation layer between a code catalog's knobs and a design kit's * vocabulary. * * The two taxonomies are genuinely different and neither is wrong: a code knob * describes the component's API (`size=l`), a kit axis describes how the design * team files its variants (`Size=Large`). Nothing derives one from the other, * so the mapping is a table. * * What keeps a table from becoming a guess: **every candidate it proposes is * checked against the kit's real axis list before use**, and a seed that * resolves to nothing is reported as unresolved rather than approximated. A * wrong translation is worse than none — under a `design-led` direction it * would drive the code away from the kit it is copying, citing a node nobody * meant. * * The defaults below are tuned against Material-3-shaped kits. A kit that files * its variants differently supplies its own via {@link Vocabulary}; the * defaults are a starting point, not a contract. */ /** Knob key → the kit axes it might name, in preference order. */ export type AxisAliases = Record; /** Knob value → the kit's spelling(s), in preference order. */ export type ValueAliases = Record; export interface Vocabulary { axes: AxisAliases; values: ValueAliases; } /** * Knob key -> the kit axis it names. The kit's taxonomy is its own; ours * describes the Compose API. Where the two disagree it is a translation, not a * guess — each entry is checked against the set's real axis list before use. */ export declare const DEFAULT_AXIS_ALIASES: AxisAliases; /** Knob value -> the kit's spelling. Multiple candidates are tried in order. */ export declare const DEFAULT_VALUE_ALIASES: ValueAliases; export declare const DEFAULT_VOCABULARY: Vocabulary; /** * Merge caller-supplied aliases over the defaults, per key. A kit that renames * one axis should not have to restate the other thirty. */ export declare function mergeVocabulary(overrides?: Partial): Vocabulary; /** Strip everything but letters and digits, lowercased — the comparison form. */ export declare const norm: (s: unknown) => string; /** * The comparison form for a name somebody **declared**, as opposed to one being guessed at. * * {@link norm} exists to compare a code slug against a kit spelling, and strips everything outside * `[a-z0-9]`. That is fine for a slug and wrong for a declaration: a kit filing its axes as `サイズ` * and `状態` normalises both to the empty string, so an equality test matches whichever axis * happened to be indexed first — a confident reference to the wrong node, which is precisely what * declaring the kit's own name exists to prevent. This keeps letters and digits in any script and * drops only the separators and punctuation two spellings of one name can reasonably differ by. */ export declare const normName: (s: unknown) => string; /** * Whether two names are the same name, for a declared one. * * Two guards, both about normalisation being able to erase a real difference rather than a * cosmetic one: * * - **Numbers keep their shape.** Dropping the separators turns `1.0` into `10`, which is a real * value of a `Progress` axis and the wrong one — the same collision {@link norm} is deliberately * not asked to resolve for slugs. When one side merges digits that way and the other does not, * only whole-string equality will do. * - **Punctuation-only names fall back to whole-string equality**, since two names that both * normalise to the empty string are not thereby equal. */ export declare const sameName: (a: unknown, b: unknown) => boolean; /** * The distinct lowercase words in a name or value, for set-wise comparison. * * Split on anything that is not a letter or a digit **in any script**. An ASCII-only split drops * every non-Latin word rather than separating them, which left the fused-axis search unable to see * a localised kit's values at all — and that search is the one a declaration relies on when two * seeds share an axis. */ export declare const wordsOf: (s: unknown) => Set; /** `actions` and `action` name the same thing; our knobs pluralise, the kit does not. */ export declare const singular: (s: string) => string; export declare const TRUTHY: Set; export declare const FALSY: Set; /** * The kit axes a knob could name, most specific first. * * Three sources, in order: a name that matches the knob directly, a name the * alias table proposes, and — as a last resort — an axis the vocabulary does * not name but that this knob is recognisably *about*. * * That last resort is deliberately narrow. Verifying a candidate against the * real variant list is not enough on its own: a boolean axis accepts `True` * from any knob, so `footer=true` cheerfully matched `Show back=True` and * `supporting=on` matched `Leading icon=True`. Both are confident references to * the wrong node, which is worse than none — design-parity then measures a * difference nobody asked about. * * So the affinity has to be a shared WORD, with the knob's key or with its * value (`content=avatar` means the `Show avatar` axis, and it is the value * that says so). Word for word, not substring: `Leading icon` contains the * letters of `on`, so `supporting=on` looked related to it under a substring * test and resolved to the wrong axis with the right value. */ export declare function axisCandidates(knob: string, axes: Record, raw: unknown, vocabulary?: Vocabulary): string[]; /** The kit spellings a knob value could take, most likely first. */ export declare function valueCandidates(raw: unknown, vocabulary?: Vocabulary): string[]; //# sourceMappingURL=vocabulary.d.ts.map