@tokens-studio/graph-engine
Version:
An execution engine to handle Token Studios generators and resolvers
40 lines • 1.26 kB
TypeScript
import { DeepKeyTokenMap, SingleToken, TokenTypes } from '@tokens-studio/types';
export interface IResolvedToken {
/**
* Name of the token
*/
name: string;
/**
* Expression that represents the value of the token, botentially jsons stringified
*/
value: SingleToken['value'];
/**
* The type of the token
*/
type: TokenTypes;
/**
* Optional description of the token
*/
description?: string;
}
/**
* Takes in a nested object of tokens and returns a flattened array of tokens
* @param nested
* @param keyPath Optional key path to prefix the name of the token
* @returns
*/
export declare const flatten: (nested: DeepKeyTokenMap, keyPath?: string[]) => IResolvedToken[];
/**
* Takes in an array of tokens and returns a map of tokens.
* This only works if the tokens are flat, meaning they do not have nested tokens
* @param tokens
* @returns
*/
export declare const flatTokensToMap: (tokens: IResolvedToken[]) => Record<string, IResolvedToken>;
/**
* Takes an array of tokens and returns a map of tokens. This does result in nested tokens
* @param tokens
* @returns
*/
export declare const flatTokensRestoreToMap: (tokens: IResolvedToken[]) => {};
//# sourceMappingURL=index.d.ts.map