style-dictionary
Version:
Style once, use everywhere. A build system for creating cross-platform styles.
18 lines (17 loc) • 638 B
TypeScript
import type { TransformedToken } from './DesignToken.js';
import { builtInSorts } from '../lib/enums/sorts.js';
export type BuiltInSorts = typeof builtInSorts;
export interface Sort {
name: string;
sort: SortFn;
}
/**
* A single sort function - either a built-in sort referenced by name string or a custom comparator function
* for inline usage
*/
export type SortFn = string | ((a: TransformedToken, b: TransformedToken) => number);
/**
* Sort option for formattedVariables - can be a single sort item or an array of sort items
* (for chaining multiple sorts as tie-breakers)
*/
export type SortOption = SortFn | SortFn[];