-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathcss.ts
More file actions
73 lines (66 loc) · 2.19 KB
/
css.ts
File metadata and controls
73 lines (66 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import type { ASTNode } from 'ast-types'
import type * as Utils from './utils'
import type { PinceauMediaQueries, PinceauUtils } from './theme'
import type { DefaultThemeMap } from './map'
import type { Variants } from './variants'
import type { NativeProperties, PropertyValue, PseudosProperties, UsableTokens } from './properties'
export type ColorSchemeModes = 'media' | 'class'
export type ComputedStyleProp<T extends string> = T | { [key in PinceauMediaQueries]?: T }
export type ComputedStyleDefinition<T extends string, ComponentProps = {}> = (props: ComponentProps) => PropertyValue<T> | { [key in PinceauMediaQueries]?: PropertyValue<T> }
export type MappedProperty<K extends string, ComponentProps = {}> = K | PropertyValue<K> | ComputedStyleDefinition<K, ComponentProps>
export type CSSProperties<
ComponentProps = {},
MediaQueries extends string = Utils.WrapUnion<PinceauMediaQueries, '@', ''>,
UtilsProperties = PinceauUtils,
> =
// Theme-based tokens
{
[K in keyof DefaultThemeMap]?: MappedProperty<K, ComponentProps> | {}
}
&
// Native properties tokens
{
[K in keyof NativeProperties]?: MappedProperty<K, ComponentProps> | {}
}
&
{
[K in keyof PseudosProperties]?: CSSProperties<ComponentProps> | {}
}
&
// MediaQueries
{
[K in MediaQueries]?: CSSProperties<ComponentProps> | {}
}
&
// Custom properties
{
[K in keyof UtilsProperties]?: UsableTokens | ComputedStyleDefinition<UsableTokens, ComponentProps> | {}
}
&
{
[K in string]?: CSSProperties<ComponentProps> | MappedProperty<K, ComponentProps> | {}
}
export type CSSFunctionType<
ComponentProps = {},
MediaQueries extends string = Utils.WrapUnion<PinceauMediaQueries, '@', ''>,
UtilsProperties = PinceauUtils,
> =
{
variants?: Variants
}
&
{
[K in keyof UtilsProperties]?: K extends string ? MappedProperty<K, ComponentProps> : never | ComputedStyleDefinition<UsableTokens, ComponentProps>
}
&
{
[K in MediaQueries]?: CSSProperties<ComponentProps> | {}
}
&
{
[K in string]: CSSProperties<ComponentProps> | never
}
export interface AnimationAst {
animationName: string
animationCode: ASTNode
}