Skip to content

pantoken / packages/core/src / cssSyntaxForValue

함수: cssSyntaxForValue()

cssSyntaxForValue(value): string

베타

토큰이 등록되어야 할 CSS @property syntax을(를) 감지합니다. Tokens Studio types는 CSS 문법에 1:1로 대응하지 않으므로 값이 검사됩니다. 단일로 계산적으로 독립적인 타입화된 토큰이 아닌 모든 것에 대해 "*" (범용)을 반환합니다.

매개변수

value

string

구체적 값( var() / light-dark() 없음).

반환값

string

@property 문법 서술자.

예제들

타입화된 단일 토큰 값

ts
import { cssSyntaxForValue } from "@pantoken/core";

cssSyntaxForValue("#03893D"); // → "<color>"
cssSyntaxForValue("2px");     // → "<length>"
cssSyntaxForValue("50%");     // → "<percentage>"
cssSyntaxForValue("400");     // → "<integer>"

글꼴 상대 단위와 복합 값은 범용으로 폴백됩니다

ts
import { cssSyntaxForValue } from "@pantoken/core";

cssSyntaxForValue("1rem");                     // → "*" (rem isn't computationally independent)
cssSyntaxForValue("Lato, Helvetica, sans-serif"); // → "*"
cssSyntaxForValue("currentColor");             // → "*"