mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: proper radix colors typing
This commit is contained in:
1 parent
eba2057306
commit
3d82a2ec75
3 files changed
+8
No files matched your search
@@ -1,7 +1,14 @@
|
||||
import * as ColorsRaw from '@radix-ui/colors';
|
||||
|
||||
type ExcludeSuffix<T> =
|
||||
T extends `${string}${'A' | `${'P3' | 'Dark'}${'' | 'A'}`}` ? never : T;
|
||||
type RadixColor = ExcludeSuffix<keyof typeof ColorsRaw>;
|
||||
|
||||
type Name =
|
||||
| `color-${'background' | `panel-${'solid' | 'translucent'}` | 'surface' | 'overlay'}`
|
||||
| `radius-${1 | 2 | 3 | 4 | 5 | 6 | 'full'}`
|
||||
| `space-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}`
|
||||
| `${RadixColor}-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}`;
|
||||
|
||||
export function Var(name: Name) {
|
||||
return `var(--${name})`;
|
||||
|
||||
Reference in new issue
Block a user