-
-
Notifications
You must be signed in to change notification settings - Fork 210
/
typescript-test.ts
216 lines (178 loc) · 6.63 KB
/
typescript-test.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
import * as polished from './lib/index'
import { ENGINE_METHOD_NONE } from 'constants'
/*
* Math
*/
const math = polished.math('20px + 10px')
/*
* Mixins
*/
let between: string = polished.between('20px', '100px', '400px', '1000px')
between = polished.between('20px', '100px')
let clearFix: object = polished.clearFix()
clearFix = polished.clearFix('&')
let cover: object = polished.cover()
cover = polished.cover('100px')
let ellipsis: object = polished.ellipsis()
ellipsis = polished.ellipsis('250px')
let fluidRange: object = polished.fluidRange(
{
prop: 'padding',
fromSize: '20px',
toSize: '100px',
},
'400px',
'1000px'
)
fluidRange = polished.fluidRange(
[
{
prop: 'padding',
fromSize: '20px',
toSize: '100px',
},
{
prop: 'margin',
fromSize: '5px',
toSize: '25px',
},
],
'400px',
'1000px'
)
fluidRange = polished.fluidRange({
prop: 'padding',
fromSize: '20px',
toSize: '100px',
})
const fontFace: object = polished.fontFace({
fontFamily: 'Sans-Pro',
fontFilePath: 'path/to/file',
fontStretch: '',
fontStyle: '',
fontVariant: '',
fontWeight: '',
fileFormats: [''],
localFonts: [''],
unicodeRange: '',
})
const hideText: object = polished.hideText()
const hideVisually: object = polished.hideVisually()
let hiDPI: string = polished.hiDPI()
hiDPI = polished.hiDPI(1.5)
const normalize: object = polished.normalize()
const radialGradient: object = polished.radialGradient({
colorStops: ['#00FFFF 0%', 'rgba(0, 0, 255, 0) 50%', '#0000FF 95%'],
extent: 'farthest-corner at 45px 45px',
position: 'center',
shape: 'ellipse',
fallback: '',
})
const linearGradient: object = polished.linearGradient({
colorStops: ['#00FFFF 0%', 'rgba(0, 0, 255, 0) 50%', '#0000FF 95%'],
toDirection: 'to top right',
fallback: '#FFF',
})
let retinaImage: object = polished.retinaImage('')
retinaImage = polished.retinaImage('', '')
retinaImage = polished.retinaImage('', '', '')
retinaImage = polished.retinaImage('', '', '', '')
retinaImage = polished.retinaImage('', '', '', '', '')
const timingFunctions = polished.timingFunctions('easeInBack')
const triangle = polished.triangle({
backgroundColor: 'red',
foregroundColor: 'red',
pointingDirection: 'right',
width: 100,
height: 100,
})
let wordWrap: object = polished.wordWrap()
wordWrap = polished.wordWrap('')
/*
* Colors
*/
const adjustHue: string = polished.adjustHue(180, '#448')
const complement: string = polished.complement('#448')
const darken: string = polished.darken(0.2, '#FFCD64')
const desaturate: string = polished.desaturate(0.2, '#CCCD64')
const getContrast: number = polished.getContrast('#444', '#fff')
const getLuminance: number = polished.getLuminance('#6564CDB3')
const grayscale: string = polished.grayscale('#CCCD64')
let hsl: string = polished.hsl(359, 0.75, 0.4)
hsl = polished.hsl({ hue: 360, saturation: 0.75, lightness: 0.4 })
let hsla: string = polished.hsla(359, 0.75, 0.4, 0.7)
hsla = polished.hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.7 })
const invert: string = polished.invert('#CCCD64')
const lighten: string = polished.lighten(0.2, '#CCCD64')
const meetsContrastGuidelines: object = polished.meetsContrastGuidelines('#444', '#fff')
const mix: string = polished.mix(0.5, '#f00', '#00f')
const opacify: string = polished.opacify(0.1, 'rgba(255, 255, 255, 0.9)')
const parseToHsl = polished.parseToHsl('rgb(255, 0, 0)')
const parseToRgb = polished.parseToRgb('rgb(255, 0, 0)')
const readableColor = polished.readableColor('rgb(255,0,0)')
let rgb: string = polished.rgb(255, 205, 100)
rgb = polished.rgb({ red: 255, green: 205, blue: 100 })
let rgba: string = polished.rgba(255, 205, 100, 0.7)
rgba = polished.rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 })
const saturate: string = polished.saturate(0.2, '#CCCD64')
const setHue: string = polished.setHue(42, '#CCCD64')
const setLightness: string = polished.setLightness(0.2, '#CCCD64')
const setSaturation: string = polished.setSaturation(0.2, '#CCCD64')
const shade: string = polished.shade(0.25, '#00f')
const tint: string = polished.tint(0.25, '#00f')
let toColorString: string = polished.toColorString({ red: 255, green: 205, blue: 100 })
toColorString = polished.toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 })
toColorString = polished.toColorString({ hue: 240, saturation: 1, lightness: 0.5 })
toColorString = polished.toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 })
const transparentize: string = polished.transparentize(0.1, '#fff')
/*
* Shorthands
*/
const animation: object = polished.animation(['rotate', 1, 'ease-in-out'], ['colorchange', '2s'])
const backgroundImages: object = polished.backgroundImages(
'url("/image/background.jpg")',
'linear-gradient(red, green)'
)
const backgrounds: object = polished.backgrounds(
'url("/image/background.jpg")',
'linear-gradient(red, green)',
'center no-repeat'
)
const border: object = polished.border('top', '1px', 'solid', 'red')
const borderColor: object = polished.borderColor('red', null, undefined, 'green')
const borderRadius: object = polished.borderRadius('top', '5px')
const borderStyle: object = polished.borderStyle('solid', null, undefined, 'dashed')
const borderWidth: object = polished.borderWidth('12px', null, undefined, '24px')
const buttons: string = polished.buttons(null, undefined, 'active')
const margin: object = polished.margin('12px', null, undefined, '24px')
const padding: object = polished.padding('12px', null, undefined, '24px')
let position: object = polished.position(null)
polished.position('absolute', '12px', null, undefined, '24px')
position = polished.position(null, '12px', null, undefined, '24px')
position = polished.position(undefined, '12px', null, undefined, '24px')
let size: object = polished.size('')
size = polished.size('', '')
const textInputs: string = polished.textInputs('active', null, undefined)
const transitions: object = polished.transitions('opacity 1.0s ease-in 0s', 'width 2.0s ease-in 2s')
/*
* Helpers
*/
const directionalProperty: object = polished.directionalProperty(
'padding',
'12px',
null,
undefined,
'24px'
)
let em: string = polished.em('12px')
em = polished.em(12)
const getValueAndUnit: [number | string, string | void] = polished.getValueAndUnit('100px')
let modularScale: string = polished.modularScale(2)
modularScale = polished.modularScale(2, 2)
modularScale = polished.modularScale(2, '')
modularScale = polished.modularScale(2, 2, 5)
modularScale = polished.modularScale(2, 2, 'minorSecond')
let rem: string = polished.rem('12px')
rem = polished.rem(12)
const remToPx: string = polished.remToPx('1.6rem', '10px')
const stripUnit: number | string = polished.stripUnit('100px')