apphouse
Version:
Component library for React that uses observable state management and theme-able components.
81 lines (80 loc) • 2.92 kB
TypeScript
import { Palette } from '../Palette';
import { Token } from '../Token';
import { ThemeTokens } from '../../styles/defaults/themes.interface';
import { ColorType } from './color.interface';
import { StyleTokenReference } from '../style.interface';
import { ThemeModeType } from '../palette.interface';
/**
* Convert Tokens [Record<string, Token>] into object
* @param value Record<string, Token> Tokens to be transformed
* @returns object
*/
export declare const toTokensObject: (value: Record<string, Token>) => object;
/**
* Convert Tokens [Record<string, Token>] into Themes Things Tokens
* @param value Record<string, Token> Tokens to be transformed
* @returns object
*/
export declare const toApphouseTokens: (value: Record<string, Token>) => ThemeTokens;
/**
* Find the first match for this value in the lookup table
* @param value string value to be matched
* @param lookup lookup table
* @param namespace string if namespace is provided it will help
* finding a value when there are multiple keys with the same value
* in the lookup table
* @returns
*/
export declare const getValueReferenceStringFromObject: (value: string | number, lookup: {
[value: string]: string;
}, namespace?: string) => any;
/**
* The reference here is key colors.onBase
* @param obj object, usually referring to styles or tokens
*/
export declare const getReferenceTokenFromObject: (obj: object, path?: string) => StyleTokenReference | undefined;
/**
* Discover is a key has the word 'color' in it
* @param key string
* @returns if the key contains 'color' it will return true, otherwise it will be false
*/
export declare const hasColorReference: (key: string) => boolean;
/**
*
* @param key string
* @returns if the key contains 'color' it will return PALETTE, otherwise it will be TOKEN
*/
export declare const getStyleTokenReferenceType: (key: string) => 'color' | 'token';
/**
* Create lookup table for value reference
* It only keeps unique objects
* @param obj
* @param root
* @param lookup
* @returns
*/
export declare const getLookupTable: (obj: {
[id: string]: any;
}, lookup?: {
[id: string]: string;
}, root?: string) => {
[id: string]: string;
};
export declare const getTokenListId: (token: any) => string;
export declare const getColorTokensLookupReferenceFromPalettes: (palette: Record<string, Palette>, basePaletteId: string, colorPaletteId?: string | undefined) => {
[id: string]: string;
};
export declare const getLookupTableFromColorType: (colors: ColorType[], mode: ThemeModeType, paletteId?: string) => {
[id: string]: string;
};
export interface hashedObjectReturnType {
lookup: {
[id: string]: any;
};
hashedObject: {
[id: string]: any;
};
}
export declare const toRemsLetterSpacing: (value: string | number) => string;
export declare const toEmLetterSpacing: () => string;
export declare const toPtLettersSpacing: () => void;