import { TokenSet, TokenSets } from "../tokens/types.js"; import { ThemeObject, TokenSetStatus } from "@tokens-studio/types"; /** The subset of a `$themes.json` entry the transformer needs. `id` and `group` are optional. */ export type ThemeObjectInput = Pick & Partial>; /** A token set selected by a mode in `$themes.json`, and whether it was found in `tokenSets`. */ export type SelectedTokenSet = { tokenSet: string; status: TokenSetStatus; exists: boolean; }; /** One mode in a Figma variable collection. */ export type FigmaMode = { /** `$themes.json` entry id, when present. */ id: string | null; modeName: string; /** Every token set the mode selects, in `selectedTokenSets` order, regardless of status. */ tokenSets: SelectedTokenSet[]; /** Deep-merge of the mode's existing, non-disabled (and, if enabled, `source`) token sets. */ tokens: TokenSet; }; /** Figma collections keyed by `$themes` group name (e.g. "Color scheme"), each a list of modes. */ export type FigmaCollections = Record; /** * Names of the Figma variable collections, i.e. the `group` values in the generated * `$themes.json`. The Figma plugin keys its import rules on these, so they live here * to keep the generator and the plugin in sync. */ export declare const FIGMA_COLLECTION: { readonly THEME: "Theme"; readonly COLOR_SCHEME: "Color scheme"; readonly SEMANTIC: "Semantic"; readonly COLOR: "Color"; readonly SIZE: "Size"; readonly TYPOGRAPHY: "Typography"; }; /** Group used for `$themes` entries that have no `group`. */ export declare const UNGROUPED = "(ungrouped)"; export type ToFigmaCollectionsOptions = { /** * Include `source` token sets when merging `tokens`. * Token Studio uses `source` sets for reference resolution only and does not export * them as variables, so they are excluded by default. They are always listed in * `tokenSets` so callers can still use them for alias resolution. * @default false */ includeSource?: boolean; /** * Called for every selected token set that has no entry in `tokenSets`. * @default () => {} (silently skipped) */ onMissingTokenSet?: (tokenSet: string, theme: ThemeObjectInput) => void; }; /** * Groups `$themes.json` entries by their `group` into Figma collections. Every theme entry * becomes one mode in its group's collection, carrying its selected token sets (with * status and existence) and the tokens of those sets deep-merged in `selectedTokenSets` * order, later sets overriding earlier ones. * * Entries without a `group` are collected under {@link UNGROUPED}. */ export declare function toFigmaCollections($themes: ThemeObjectInput[], tokenSets: TokenSets, options?: ToFigmaCollectionsOptions): FigmaCollections; /** Deep-merges two token sets. A token (`$value` node) in `override` replaces the base node whole. */ export declare function mergeTokenSets(base: TokenSet, override: TokenSet): TokenSet;