/
mappings.ts
107 lines (99 loc) · 2.46 KB
/
mappings.ts
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
export const directionMap: Record<string, string[]> = {
'l': ['-left'],
'r': ['-right'],
't': ['-top'],
'b': ['-bottom'],
's': ['-inline-start'],
'e': ['-inline-end'],
'x': ['-left', '-right'],
'y': ['-top', '-bottom'],
'': [''],
'bs': ['-block-start'],
'be': ['-block-end'],
'is': ['-inline-start'],
'ie': ['-inline-end'],
'block': ['-block-start', '-block-end'],
'inline': ['-inline-start', '-inline-end'],
}
export const insetMap: Record<string, string[]> = {
...directionMap,
s: ['-inset-inline-start'],
e: ['-inset-inline-end'],
bs: ['-inset-block-start'],
be: ['-inset-block-end'],
is: ['-inset-inline-start'],
ie: ['-inset-inline-end'],
block: ['-inset-block-start', '-inset-block-end'],
inline: ['-inset-inline-start', '-inset-inline-end'],
}
export const cornerMap: Record<string, string[]> = {
'l': ['-top-left', '-bottom-left'],
'r': ['-top-right', '-bottom-right'],
't': ['-top-left', '-top-right'],
'b': ['-bottom-left', '-bottom-right'],
'tl': ['-top-left'],
'lt': ['-top-left'],
'tr': ['-top-right'],
'rt': ['-top-right'],
'bl': ['-bottom-left'],
'lb': ['-bottom-left'],
'br': ['-bottom-right'],
'rb': ['-bottom-right'],
'': [''],
'bs': ['-start-start', '-start-end'],
'be': ['-end-start', '-end-end'],
'is': ['-end-start', '-start-start'],
'ie': ['-start-end', '-end-end'],
'bs-is': ['-start-start'],
'is-bs': ['-start-start'],
'bs-ie': ['-start-end'],
'ie-bs': ['-start-end'],
'be-is': ['-end-start'],
'is-be': ['-end-start'],
'be-ie': ['-end-end'],
'ie-be': ['-end-end'],
}
export const xyzMap: Record<string, string[]> = {
'x': ['-x'],
'y': ['-y'],
'z': ['-z'],
'': ['-x', '-y'],
}
const basePositionMap = [
'top',
'top center',
'top left',
'top right',
'bottom',
'bottom center',
'bottom left',
'bottom right',
'left',
'left center',
'left top',
'left bottom',
'right',
'right center',
'right top',
'right bottom',
'center',
'center top',
'center bottom',
'center left',
'center right',
'center center',
]
export const positionMap: Record<string, string> = Object.assign(
{},
// [{ top: 'top' }, { 'top-center': 'top center' }, ...]
...basePositionMap.map(p => ({ [p.replace(/ /, '-')]: p })),
// [{ t: 'top' }, { tc: 'top center' }, ...]
...basePositionMap.map(p => ({ [p.replace(/\b(\w)\w+/g, '$1').replace(/ /, '')]: p })),
)
export const globalKeywords = [
'inherit',
'initial',
'revert',
'revert-layer',
'unset',
]