import { type MatchedProperty } from "./seeded-properties.js"; import type { KitIndex, ResolvedVariant, VariantSeed } from "./types.js"; import { type Vocabulary } from "./vocabulary.js"; /** What a knob turned out to be, when the kit models it as a property. */ export interface SeedProperty { setName: string; properties: MatchedProperty[]; /** * The property's default already equals what this variant seeds — so the * reference draws the VARIANT, and it is the base pair beside it that depicts * something its own render never claimed. */ coversVariant: boolean; } /** Optional content a set switches on by default, whatever the code drew. */ export interface DefaultedContent { name: string; setName: string; } /** `size` for a size/shape knob, `state` for everything else. */ export declare function slotFor(seedOrSeeds: VariantSeed | VariantSeed[], variantName: string): { size: string; } | { state: string; }; /** * A `kitAxis` / `kitValue` declaration naming something the kit does not have. * * The one miss whose fix is in the catalog's own source: somebody spelled the * kit's name by hand and got it wrong, or the kit renamed it since. Naming what * was declared beside what the set publishes is the difference between "this * resolved to nothing" and a one-line correction. */ export interface DeclaredMiss { /** The seed the declaration sits on, as `key=value`. */ seed: string; /** Whether the kit lacks the declared axis, or the declared value of one. */ declares: "axis" | "value"; /** The name the declaration gave. */ named: string; /** What the kit publishes there: the set's axes, or the axis's values. */ published: string[]; } /** * Why a vector resolved to nothing — see {@link KitIndexResolver.explainUnresolved}. * * Four answers, and a reader does something different with each: `declared` is * a mistake in the catalog, `base` is not a gap at all, `combination` is a gap * in the kit's matrix rather than in its vocabulary, and `seeds` names what to * go and look for. */ export type UnresolvedReason = /** A `kitAxis` / `kitValue` declaration names something the kit does not publish. */ { kind: "declared"; missing: DeclaredMiss[]; } /** The reference already draws this: the base variant carries every seeded value. */ | { kind: "base"; variant: string; } /** Each seed resolves alone; the kit draws no node carrying them together. */ | { kind: "combination"; seeds: string[]; } /** These seeds have no counterpart at all — the actual gap. */ | { kind: "seeds"; missing: string[]; }; export interface KitIndexResolverOptions { /** Per-kit overrides merged over the built-in translation tables. */ vocabulary?: Partial; } /** * A loaded kit index, ready to answer questions about it. * * Constructed from the index **object** rather than a path: the index is a * committed artifact a caller has already read (and may have got from a * bundle, a cache, or a test fixture), and a resolver that reads a fixed * filename from the working directory cannot be used twice in one process or * tested without a real kit. */ export declare class KitIndexResolver { #private; constructor(index: KitIndex, opts?: KitIndexResolverOptions); /** The file every node id in this index is addressed within. */ get fileKey(): string; /** * The node Figma can actually export for a definition reference. * * Most definitions render directly. Hidden component sets are the exception: * the kit keeps their definitions as vocabulary and places visible instances * on the component page as the renderable examples. */ renderableRef(ref: string): string; /** * The kit node for `seeds` applied to the component referenced by `ref`. * * Resolution order is deliberate — **axes before properties**. An axis names * an exact sibling definition and is the stronger signal; projecting a seed * onto component properties first would let `Icon (selected)` steal the real * `Selected` axis, or a `Segments` slot steal a count axis. * * @returns the node and its kit name, or `undefined` when the kit models no * such variation. Those misses are real gaps, to be reported rather than * guessed at. */ resolveVariant(ref: string, seedOrSeeds: VariantSeed | VariantSeed[]): ResolvedVariant | undefined; /** * The kit property a knob names, when the kit models it as a property rather * than an axis — so there is no sibling node to compare against, and the miss * is a limit of references rather than a gap in the kit. */ propertyForSeed(ref: string, seed: VariantSeed): SeedProperty | undefined; /** * Why a set of seeds resolved to nothing. * * "No counterpart in the kit" is true of every miss and useful about almost * none of them, because it collapses three different situations a reader has * to act on differently. Working out which one you are looking at otherwise * means re-resolving seeds by hand against the kit index — which is exactly * what this does, once, at the point the miss is recorded. * * Call only after {@link resolveVariant} has already returned `undefined`; * on a resolvable vector the answer is meaningless. */ explainUnresolved(ref: string, seeds: VariantSeed[]): UnresolvedReason; /** * Optional content the kit switches ON by default, which every render made * from this reference therefore includes whether or not the code does. */ defaultedContent(ref: string): DefaultedContent[]; } //# sourceMappingURL=resolve.d.ts.map