@teamsparta/stack-core
Version:
stack core
24 lines (22 loc) • 1.49 kB
TypeScript
/** 별칭이면 canonical로, 아니면(sm/md/lg/xl 등) 그대로 반환한다. */
declare function toCanonicalKey(key: string): string;
/**
* Responsive 값 객체의 키를 canonical(sm/md/lg)로 정규화한다. (값 작성 경로)
* - 별칭(mobile/tablet/desktop)은 sm/md/lg로 변환된다.
* - 한 객체에 canonical과 별칭이 같은 슬롯으로 겹치면 canonical을 우선하고
* console.warn으로 알린다. (작성 순서와 무관하게 결정적)
*/
declare function normalizeResponsiveKeys<T extends Record<string, unknown>>(value: T): T;
/**
* Provider 등록표의 키를 canonical로 정규화한다. (Provider 설정 경로)
* 작성 경로와 달리 "뒤 키가 앞을 덮는다" — override가 기본값을 교체하는 게 의도다.
* 한 객체에 별칭과 canonical이 같은 슬롯으로 함께 오면(예: { lg, desktop })
* 객체 순서상 뒤 키가 이긴다(작성 경로의 canonical-우선과 다름).
*/
declare function normalizeBreakpointTable(table: Partial<Record<string, number>>): Record<string, number>;
/**
* sm/md/lg 기본값 위에 정규화한 override를 얹어 최종 등록표를 만든다.
* StackBreakpointProvider가 사용한다. (string 키로 받아 BreakpointOverride 증강 키도 통과)
*/
declare function mergeBreakpointTable(overrides?: Partial<Record<string, number>>): Record<string, number>;
export { mergeBreakpointTable, normalizeBreakpointTable, normalizeResponsiveKeys, toCanonicalKey };