Skip to content

pantoken / packages/core/src / toStyleDictionary

함수: toStyleDictionary()

toStyleDictionary(tokens, mode?): Record<string, SdLeaf>

베타

해결된 IR을 토큰 이름을 키로 하는 평면 Style Dictionary 토큰 딕셔너리로 구성합니다 (앞의 --는 제거됨). 네이티브 이미터를 위해 이것을 tools/sd-config에 전달하세요.

매개변수

tokens

읽기 전용 Token[]

IR입니다.

mode?

Mode = "light"

어떤 색상 모드를 해석할지 (기본값 "light").

반환값

Record<string, SdLeaf>

Style Dictionary 딕셔너리 객체.

예제

네이티브 계보를 위한 IR 구성

ts
import { buildTokens } from "@pantoken/core/build";
import { toStyleDictionary } from "@pantoken/core";

const dictionary = toStyleDictionary(buildTokens(), "light");
// → { "instui-color-background-base": { value: "#…", type: "color" }, … }
// keys drop the leading "--"; feed this to tools/sd-config.