UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

25 lines (24 loc) 3.23 kB
import { AnyString } from "../../utils/index.js"; import { ReactNode } from "react"; //#region src/providers/i18n-provider/icu.types.d.ts type FindElements<Y> = Y extends `${string}<${infer M}>${infer D}` ? M extends `/${string}` ? [] : [M, ...FindElements<D>] : []; type FindBlocks<Y> = Y extends `${string}{${infer M}` ? ReadBlock<"", M, ""> extends [infer D, infer H] ? [D, ...FindBlocks<H>] : [] : []; type ReadBlock<Y extends string, M$1 extends string, D$1 extends string> = M$1 extends `${infer H}}${infer R}` ? H extends `${infer T}{${infer M}` ? ReadBlock<`${Y}${T}{`, `${M$1}}${R}`, `${D$1}+`> : D$1 extends `+${infer M}` ? ReadBlock<`${Y}${H}}`, R, M$1> : [`${Y}${H}`, R] : []; type Whitespace = " " | "\n" | "\r" | "\t"; type Trim<Y> = Y extends `${Whitespace}${infer M}` ? Trim<M> : Y extends `${infer D}${Whitespace}` ? Trim<D> : Y extends string ? Y : never; type ExcludeEscape<Y> = Y extends `${infer M}'${string}'${infer D}` ? `${ExcludeEscape<M>}${ExcludeEscape<D>}` : Y; type ExcludeEmptyObject<Y> = Y extends { [key: string]: never; } ? never : Y; type TransformOther<Y> = Y extends "other" ? AnyString : Y; type ArgumentValue<Y, M$1 extends string = string> = Y extends "select" ? never : Y extends "plural" ? number : Y extends "number" ? number : Y extends "date" ? Date : Y extends "time" ? Date : AnyString | M$1 | number; type ParseSelectBlock<Y, M$1, D$1 extends string = string> = M$1 extends `${infer H}{${infer R}` ? ReadBlock<"", R, ""> extends [infer T, infer M] ? (ParseBlocks<FindBlocks<T>, D$1> & { [M in Trim<Y>]: TransformOther<Trim<H>> }) | ParseSelectBlock<Y, M$1, D$1> : never : never; type ConcatBlocks<Y> = Y extends readonly [infer M, ...infer D] ? [...FindBlocks<M>, ...ConcatBlocks<D>] : []; type ParseBlock<Y, M$1 extends string = string> = Y extends `${infer D},${infer H},${infer R}` ? Trim<H> extends "select" ? ParseSelectBlock<D, Trim<R>, M$1> : ParseBlocks<ConcatBlocks<FindBlocks<R>>, M$1> & { [T in Trim<D>]: ArgumentValue<Trim<H>, M$1> } : Y extends `${infer D},${infer H}` ? { [T in Trim<D>]: ArgumentValue<Trim<H>, M$1> } : { [T in Trim<Y>]: AnyString | M$1 | number }; type ParseBlocks<Y, M$1 extends string = string> = Y extends [infer D, ...infer H] ? { [R in keyof ParseBlock<D, M$1> | keyof ParseBlocks<H, M$1>]: R extends keyof ParseBlock<D, M$1> ? ParseBlock<D, M$1>[R] : R extends keyof ParseBlocks<H, M$1> ? ParseBlocks<H, M$1>[R] : never } : {}; type ParseElement<Y> = { [M in Trim<Y>]: (chunks: string[]) => ReactNode }; type ParseElements<Y> = Y extends [infer M, ...infer D] ? { [H in keyof ParseElement<M> | keyof ParseElements<D>]: H extends keyof ParseElement<M> ? ParseElement<M>[H] : H extends keyof ParseElements<D> ? ParseElements<D>[H] : never } : {}; type IcuArgs<Y, M$1 extends string = string> = ExcludeEmptyObject<{ [D in keyof ParseBlocks<FindBlocks<ExcludeEscape<Y>>, M$1> | keyof ParseElements<FindElements<ExcludeEscape<Y>>>]: D extends keyof ParseBlocks<FindBlocks<ExcludeEscape<Y>>, M$1> ? ParseBlocks<FindBlocks<ExcludeEscape<Y>>, M$1>[D] : D extends keyof ParseElements<FindElements<ExcludeEscape<Y>>> ? ParseElements<FindElements<ExcludeEscape<Y>>>[D] : never }>; //#endregion export { IcuArgs }; //# sourceMappingURL=icu.types.d.ts.map