@pyreon/unistyle 0.24.5 → 0.24.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -9
- package/src/__tests__/alignContent.test.ts +0 -121
- package/src/__tests__/borderRadius.test.ts +0 -125
- package/src/__tests__/camelToKebab.test.ts +0 -44
- package/src/__tests__/context.test.ts +0 -147
- package/src/__tests__/createMediaQueries.test.ts +0 -98
- package/src/__tests__/edge.test.ts +0 -164
- package/src/__tests__/enrichTheme.test.ts +0 -56
- package/src/__tests__/extendCss.test.ts +0 -45
- package/src/__tests__/index.test.ts +0 -79
- package/src/__tests__/makeItResponsive.test.ts +0 -431
- package/src/__tests__/manifest-snapshot.test.ts +0 -34
- package/src/__tests__/native-marker.test.ts +0 -9
- package/src/__tests__/optimizeBreakpointDeltas.test.ts +0 -124
- package/src/__tests__/processDescriptor.test.ts +0 -322
- package/src/__tests__/responsive.test.ts +0 -221
- package/src/__tests__/special-keys.test.ts +0 -120
- package/src/__tests__/styles.test.ts +0 -273
- package/src/__tests__/unistyle.browser.test.tsx +0 -169
- package/src/__tests__/units.test.ts +0 -134
- package/src/context.tsx +0 -44
- package/src/enrichTheme.ts +0 -42
- package/src/env.d.ts +0 -6
- package/src/index.ts +0 -91
- package/src/manifest.ts +0 -197
- package/src/responsive/breakpoints.ts +0 -15
- package/src/responsive/createMediaQueries.ts +0 -43
- package/src/responsive/index.ts +0 -15
- package/src/responsive/makeItResponsive.ts +0 -223
- package/src/responsive/normalizeTheme.ts +0 -79
- package/src/responsive/optimizeBreakpointDeltas.ts +0 -190
- package/src/responsive/optimizeTheme.ts +0 -60
- package/src/responsive/sortBreakpoints.ts +0 -10
- package/src/responsive/transformTheme.ts +0 -54
- package/src/styles/alignContent.ts +0 -62
- package/src/styles/extendCss.ts +0 -26
- package/src/styles/index.ts +0 -16
- package/src/styles/shorthands/borderRadius.ts +0 -89
- package/src/styles/shorthands/edge.ts +0 -108
- package/src/styles/shorthands/index.ts +0 -4
- package/src/styles/styles/camelToKebab.ts +0 -3
- package/src/styles/styles/index.ts +0 -132
- package/src/styles/styles/processDescriptor.ts +0 -136
- package/src/styles/styles/propertyMap.ts +0 -438
- package/src/styles/styles/types.ts +0 -368
- package/src/types.ts +0 -175
- package/src/units/index.ts +0 -6
- package/src/units/stripUnit.ts +0 -25
- package/src/units/value.ts +0 -47
- package/src/units/values.ts +0 -40
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
type PropertyValue = string | number | null | undefined
|
|
2
|
-
type Color = string | null | undefined
|
|
3
|
-
|
|
4
|
-
export interface ITheme {
|
|
5
|
-
// Special
|
|
6
|
-
fullScreen?: boolean
|
|
7
|
-
hideEmpty?: boolean
|
|
8
|
-
clearFix?: boolean
|
|
9
|
-
extendCss?: string | ((css: (...args: any[]) => string) => string)
|
|
10
|
-
|
|
11
|
-
// Position
|
|
12
|
-
all?: string
|
|
13
|
-
display?: string
|
|
14
|
-
position?: string
|
|
15
|
-
boxSizing?: string
|
|
16
|
-
float?: string
|
|
17
|
-
|
|
18
|
-
// Inset
|
|
19
|
-
inset?: PropertyValue
|
|
20
|
-
insetX?: PropertyValue
|
|
21
|
-
insetY?: PropertyValue
|
|
22
|
-
top?: PropertyValue
|
|
23
|
-
left?: PropertyValue
|
|
24
|
-
bottom?: PropertyValue
|
|
25
|
-
right?: PropertyValue
|
|
26
|
-
|
|
27
|
-
// Sizing
|
|
28
|
-
width?: PropertyValue
|
|
29
|
-
minWidth?: PropertyValue
|
|
30
|
-
maxWidth?: PropertyValue
|
|
31
|
-
height?: PropertyValue
|
|
32
|
-
minHeight?: PropertyValue
|
|
33
|
-
maxHeight?: PropertyValue
|
|
34
|
-
size?: PropertyValue
|
|
35
|
-
minSize?: PropertyValue
|
|
36
|
-
maxSize?: PropertyValue
|
|
37
|
-
gap?: PropertyValue
|
|
38
|
-
aspectRatio?: string
|
|
39
|
-
contain?: string
|
|
40
|
-
containerType?: string
|
|
41
|
-
containerName?: string
|
|
42
|
-
container?: string
|
|
43
|
-
inlineSize?: PropertyValue
|
|
44
|
-
blockSize?: PropertyValue
|
|
45
|
-
minInlineSize?: PropertyValue
|
|
46
|
-
minBlockSize?: PropertyValue
|
|
47
|
-
maxInlineSize?: PropertyValue
|
|
48
|
-
maxBlockSize?: PropertyValue
|
|
49
|
-
|
|
50
|
-
// Spacing
|
|
51
|
-
margin?: PropertyValue
|
|
52
|
-
marginX?: PropertyValue
|
|
53
|
-
marginY?: PropertyValue
|
|
54
|
-
marginTop?: PropertyValue
|
|
55
|
-
marginLeft?: PropertyValue
|
|
56
|
-
marginBottom?: PropertyValue
|
|
57
|
-
marginRight?: PropertyValue
|
|
58
|
-
padding?: PropertyValue
|
|
59
|
-
paddingX?: PropertyValue
|
|
60
|
-
paddingY?: PropertyValue
|
|
61
|
-
paddingTop?: PropertyValue
|
|
62
|
-
paddingLeft?: PropertyValue
|
|
63
|
-
paddingBottom?: PropertyValue
|
|
64
|
-
paddingRight?: PropertyValue
|
|
65
|
-
|
|
66
|
-
// Logical spacing
|
|
67
|
-
marginInline?: PropertyValue
|
|
68
|
-
marginInlineStart?: PropertyValue
|
|
69
|
-
marginInlineEnd?: PropertyValue
|
|
70
|
-
marginBlock?: PropertyValue
|
|
71
|
-
marginBlockStart?: PropertyValue
|
|
72
|
-
marginBlockEnd?: PropertyValue
|
|
73
|
-
paddingInline?: PropertyValue
|
|
74
|
-
paddingInlineStart?: PropertyValue
|
|
75
|
-
paddingInlineEnd?: PropertyValue
|
|
76
|
-
paddingBlock?: PropertyValue
|
|
77
|
-
paddingBlockStart?: PropertyValue
|
|
78
|
-
paddingBlockEnd?: PropertyValue
|
|
79
|
-
|
|
80
|
-
// Logical inset
|
|
81
|
-
insetInline?: PropertyValue
|
|
82
|
-
insetInlineStart?: PropertyValue
|
|
83
|
-
insetInlineEnd?: PropertyValue
|
|
84
|
-
insetBlock?: PropertyValue
|
|
85
|
-
insetBlockStart?: PropertyValue
|
|
86
|
-
insetBlockEnd?: PropertyValue
|
|
87
|
-
|
|
88
|
-
// Flex
|
|
89
|
-
alignContent?: string
|
|
90
|
-
alignItems?: string
|
|
91
|
-
alignSelf?: string
|
|
92
|
-
flex?: string | number
|
|
93
|
-
flexBasis?: string | number
|
|
94
|
-
flexDirection?: string
|
|
95
|
-
flexFlow?: string
|
|
96
|
-
flexGrow?: number
|
|
97
|
-
flexShrink?: number
|
|
98
|
-
flexWrap?: string
|
|
99
|
-
justifyContent?: string
|
|
100
|
-
justifyItems?: string
|
|
101
|
-
justifySelf?: string
|
|
102
|
-
placeItems?: string
|
|
103
|
-
placeContent?: string
|
|
104
|
-
placeSelf?: string
|
|
105
|
-
rowGap?: PropertyValue
|
|
106
|
-
columnGap?: PropertyValue
|
|
107
|
-
|
|
108
|
-
// Grid
|
|
109
|
-
grid?: string
|
|
110
|
-
gridArea?: string
|
|
111
|
-
gridAutoColumns?: PropertyValue
|
|
112
|
-
gridAutoFlow?: string
|
|
113
|
-
gridAutoRows?: PropertyValue
|
|
114
|
-
gridColumn?: string
|
|
115
|
-
gridColumnEnd?: string
|
|
116
|
-
gridColumnGap?: PropertyValue
|
|
117
|
-
gridColumnStart?: PropertyValue
|
|
118
|
-
gridGap?: PropertyValue
|
|
119
|
-
gridRow?: string
|
|
120
|
-
gridRowStart?: string
|
|
121
|
-
gridRowEnd?: string
|
|
122
|
-
gridRowGap?: PropertyValue
|
|
123
|
-
gridTemplate?: string
|
|
124
|
-
gridTemplateAreas?: string
|
|
125
|
-
gridTemplateColumns?: string
|
|
126
|
-
gridTemplateRows?: string
|
|
127
|
-
|
|
128
|
-
// Positioning
|
|
129
|
-
objectFit?: string
|
|
130
|
-
objectPosition?: string
|
|
131
|
-
order?: number
|
|
132
|
-
opacity?: number | string
|
|
133
|
-
resize?: string
|
|
134
|
-
verticalAlign?: string
|
|
135
|
-
|
|
136
|
-
// Font & text
|
|
137
|
-
lineHeight?: string | number
|
|
138
|
-
font?: string
|
|
139
|
-
fontFamily?: string
|
|
140
|
-
fontSize?: PropertyValue
|
|
141
|
-
fontSizeAdjust?: PropertyValue
|
|
142
|
-
fontStretch?: PropertyValue
|
|
143
|
-
fontStyle?: string
|
|
144
|
-
fontVariant?: string
|
|
145
|
-
fontWeight?: string | number
|
|
146
|
-
fontKerning?: string
|
|
147
|
-
fontFeatureSettings?: string
|
|
148
|
-
fontVariationSettings?: string
|
|
149
|
-
fontOpticalSizing?: string
|
|
150
|
-
textAlign?: string
|
|
151
|
-
textAlignLast?: string
|
|
152
|
-
textTransform?: string
|
|
153
|
-
textDecoration?: string
|
|
154
|
-
textDecorationColor?: Color
|
|
155
|
-
textDecorationLine?: string
|
|
156
|
-
textDecorationStyle?: string
|
|
157
|
-
textDecorationThickness?: string
|
|
158
|
-
textUnderlineOffset?: string
|
|
159
|
-
textEmphasis?: string
|
|
160
|
-
textEmphasisColor?: Color
|
|
161
|
-
textEmphasisStyle?: string
|
|
162
|
-
letterSpacing?: string
|
|
163
|
-
wordSpacing?: string
|
|
164
|
-
textIndent?: string
|
|
165
|
-
textJustify?: string
|
|
166
|
-
textOverflow?: string
|
|
167
|
-
textShadow?: string
|
|
168
|
-
textWrap?: string
|
|
169
|
-
textRendering?: string
|
|
170
|
-
whiteSpace?: string
|
|
171
|
-
wordBreak?: string
|
|
172
|
-
wordWrap?: string
|
|
173
|
-
writingMode?: string
|
|
174
|
-
direction?: string
|
|
175
|
-
hyphens?: string
|
|
176
|
-
|
|
177
|
-
// List
|
|
178
|
-
listStyle?: string
|
|
179
|
-
listStyleImage?: string
|
|
180
|
-
listStylePosition?: string
|
|
181
|
-
listStyleType?: string
|
|
182
|
-
|
|
183
|
-
// Background & colors
|
|
184
|
-
color?: Color
|
|
185
|
-
background?: string
|
|
186
|
-
backgroundColor?: Color
|
|
187
|
-
backgroundImage?: string
|
|
188
|
-
backgroundAttachment?: string
|
|
189
|
-
backgroundClip?: string
|
|
190
|
-
backgroundOrigin?: string
|
|
191
|
-
backgroundPosition?: string
|
|
192
|
-
backgroundRepeat?: string
|
|
193
|
-
backgroundSize?: string
|
|
194
|
-
|
|
195
|
-
// Borders
|
|
196
|
-
borderRadius?: PropertyValue
|
|
197
|
-
borderRadiusTop?: PropertyValue
|
|
198
|
-
borderRadiusBottom?: PropertyValue
|
|
199
|
-
borderRadiusLeft?: PropertyValue
|
|
200
|
-
borderRadiusRight?: PropertyValue
|
|
201
|
-
borderRadiusTopLeft?: PropertyValue
|
|
202
|
-
borderRadiusTopRight?: PropertyValue
|
|
203
|
-
borderRadiusBottomLeft?: PropertyValue
|
|
204
|
-
borderRadiusBottomRight?: PropertyValue
|
|
205
|
-
border?: string
|
|
206
|
-
borderTop?: string
|
|
207
|
-
borderBottom?: string
|
|
208
|
-
borderLeft?: string
|
|
209
|
-
borderRight?: string
|
|
210
|
-
borderWidth?: PropertyValue
|
|
211
|
-
borderWidthX?: PropertyValue
|
|
212
|
-
borderWidthY?: PropertyValue
|
|
213
|
-
borderWidthTop?: PropertyValue
|
|
214
|
-
borderWidthLeft?: PropertyValue
|
|
215
|
-
borderWidthBottom?: PropertyValue
|
|
216
|
-
borderWidthRight?: PropertyValue
|
|
217
|
-
borderStyle?: string
|
|
218
|
-
borderStyleX?: string
|
|
219
|
-
borderStyleY?: string
|
|
220
|
-
borderStyleTop?: string
|
|
221
|
-
borderStyleLeft?: string
|
|
222
|
-
borderStyleBottom?: string
|
|
223
|
-
borderStyleRight?: string
|
|
224
|
-
borderColor?: Color
|
|
225
|
-
borderColorX?: Color
|
|
226
|
-
borderColorY?: Color
|
|
227
|
-
borderColorTop?: Color
|
|
228
|
-
borderColorLeft?: Color
|
|
229
|
-
borderColorBottom?: Color
|
|
230
|
-
borderColorRight?: Color
|
|
231
|
-
borderImage?: string
|
|
232
|
-
borderImageOutset?: string
|
|
233
|
-
borderImageRepeat?: string
|
|
234
|
-
borderImageSlice?: string
|
|
235
|
-
borderImageSource?: string
|
|
236
|
-
borderImageWidth?: string
|
|
237
|
-
borderSpacing?: string
|
|
238
|
-
|
|
239
|
-
borderCollapse?: string
|
|
240
|
-
|
|
241
|
-
// Logical borders
|
|
242
|
-
borderInline?: string
|
|
243
|
-
borderBlock?: string
|
|
244
|
-
borderInlineStart?: string
|
|
245
|
-
borderInlineEnd?: string
|
|
246
|
-
borderBlockStart?: string
|
|
247
|
-
borderBlockEnd?: string
|
|
248
|
-
|
|
249
|
-
// Visual effects
|
|
250
|
-
backfaceVisibility?: string
|
|
251
|
-
boxShadow?: string
|
|
252
|
-
filter?: string
|
|
253
|
-
backdropFilter?: string
|
|
254
|
-
mixBlendMode?: string
|
|
255
|
-
backgroundBlendMode?: string
|
|
256
|
-
isolation?: string
|
|
257
|
-
outline?: string
|
|
258
|
-
outlineColor?: Color
|
|
259
|
-
outlineOffset?: string
|
|
260
|
-
outlineStyle?: string
|
|
261
|
-
outlineWidth?: string
|
|
262
|
-
|
|
263
|
-
// Animations
|
|
264
|
-
keyframe?: string
|
|
265
|
-
animation?: string
|
|
266
|
-
animationName?: string
|
|
267
|
-
animationDuration?: string
|
|
268
|
-
animationTimingFunction?: string
|
|
269
|
-
animationDelay?: string
|
|
270
|
-
animationIterationCount?: string | number
|
|
271
|
-
animationDirection?: string
|
|
272
|
-
animationFillMode?: string
|
|
273
|
-
animationPlayState?: string
|
|
274
|
-
transition?: string
|
|
275
|
-
transitionDelay?: string
|
|
276
|
-
transitionDuration?: string
|
|
277
|
-
transitionProperty?: string
|
|
278
|
-
transitionTimingFunction?: string
|
|
279
|
-
|
|
280
|
-
// Transform
|
|
281
|
-
transform?: string
|
|
282
|
-
transformOrigin?: string
|
|
283
|
-
transformStyle?: string
|
|
284
|
-
translate?: string
|
|
285
|
-
rotate?: string
|
|
286
|
-
scale?: string | number
|
|
287
|
-
willChange?: string
|
|
288
|
-
|
|
289
|
-
// Scroll
|
|
290
|
-
scrollBehavior?: string
|
|
291
|
-
scrollSnapType?: string
|
|
292
|
-
scrollSnapAlign?: string
|
|
293
|
-
scrollSnapStop?: string
|
|
294
|
-
scrollMargin?: string
|
|
295
|
-
scrollPadding?: string
|
|
296
|
-
overscrollBehavior?: string
|
|
297
|
-
overscrollBehaviorX?: string
|
|
298
|
-
overscrollBehaviorY?: string
|
|
299
|
-
|
|
300
|
-
// Interaction
|
|
301
|
-
cursor?: string
|
|
302
|
-
pointerEvents?: string
|
|
303
|
-
userSelect?: string
|
|
304
|
-
touchAction?: string
|
|
305
|
-
scrollbarWidth?: string
|
|
306
|
-
scrollbarColor?: string
|
|
307
|
-
scrollbarGutter?: string
|
|
308
|
-
caretColor?: Color
|
|
309
|
-
accentColor?: Color
|
|
310
|
-
colorScheme?: string
|
|
311
|
-
|
|
312
|
-
// Other
|
|
313
|
-
captionSide?: string
|
|
314
|
-
clear?: string
|
|
315
|
-
clip?: string
|
|
316
|
-
clipPath?: string
|
|
317
|
-
content?: string
|
|
318
|
-
contentVisibility?: string
|
|
319
|
-
counterIncrement?: string
|
|
320
|
-
counterReset?: string
|
|
321
|
-
emptyCells?: string
|
|
322
|
-
zIndex?: number | string
|
|
323
|
-
overflow?: string
|
|
324
|
-
overflowWrap?: string
|
|
325
|
-
overflowX?: string
|
|
326
|
-
overflowY?: string
|
|
327
|
-
perspective?: string
|
|
328
|
-
perspectiveOrigin?: string
|
|
329
|
-
quotes?: string
|
|
330
|
-
tabSize?: string | number
|
|
331
|
-
tableLayout?: string
|
|
332
|
-
visibility?: string
|
|
333
|
-
appearance?: string
|
|
334
|
-
imageRendering?: string
|
|
335
|
-
|
|
336
|
-
// Masks
|
|
337
|
-
maskImage?: string
|
|
338
|
-
maskSize?: string
|
|
339
|
-
maskPosition?: string
|
|
340
|
-
maskRepeat?: string
|
|
341
|
-
|
|
342
|
-
// Shapes
|
|
343
|
-
shapeOutside?: string
|
|
344
|
-
shapeMargin?: string
|
|
345
|
-
shapeImageThreshold?: string | number
|
|
346
|
-
|
|
347
|
-
// Columns
|
|
348
|
-
columnCount?: number | string
|
|
349
|
-
columnWidth?: string
|
|
350
|
-
columnRule?: string
|
|
351
|
-
columns?: string
|
|
352
|
-
|
|
353
|
-
// Fragmentation
|
|
354
|
-
breakBefore?: string
|
|
355
|
-
breakAfter?: string
|
|
356
|
-
breakInside?: string
|
|
357
|
-
orphans?: number
|
|
358
|
-
widows?: number
|
|
359
|
-
printColorAdjust?: string
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
export type InnerTheme = {
|
|
363
|
-
[K in keyof ITheme]?: ITheme[K] | null | undefined
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
export type Theme = {
|
|
367
|
-
[K in keyof InnerTheme]?: InnerTheme[K] | (() => ITheme[K])
|
|
368
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import type { config } from '@pyreon/ui-core'
|
|
2
|
-
|
|
3
|
-
export type Css = typeof config.css
|
|
4
|
-
|
|
5
|
-
export type Defaults = 'initial' | 'inherit'
|
|
6
|
-
export type Units = 'px' | 'rem' | 'em' | '%' | 'vh' | 'vw' | 'vmin' | 'vmax' | 'ex'
|
|
7
|
-
export type UnitValue = number | `${number}${Units}`
|
|
8
|
-
export type PropertyValue = UnitValue | 'auto' | Defaults | `calc(${string | number})`
|
|
9
|
-
|
|
10
|
-
export type Size = 'max-content' | 'min-content' | 'fit-content'
|
|
11
|
-
|
|
12
|
-
export type Color =
|
|
13
|
-
| `#${string | number}`
|
|
14
|
-
| 'currentColor'
|
|
15
|
-
| 'transparent'
|
|
16
|
-
| `rgb(${number}, ${number}, ${number})`
|
|
17
|
-
| `rgb(${number},${number},${number})`
|
|
18
|
-
| `rgba(${number}, ${number}, ${number}, ${number})`
|
|
19
|
-
| `rgba(${number},${number},${number},${number})`
|
|
20
|
-
| `hsl(${number}, ${number}%, ${number}%)`
|
|
21
|
-
| `hsl(${number},${number}%,${number}%)`
|
|
22
|
-
| `hsla(${number}, ${number}%, ${number}%, ${number})`
|
|
23
|
-
| `hsla(${number},${number}%,${number}%,${number})`
|
|
24
|
-
| BrowserColors
|
|
25
|
-
| Defaults
|
|
26
|
-
|
|
27
|
-
export type BrowserColors =
|
|
28
|
-
| 'black'
|
|
29
|
-
| 'silver'
|
|
30
|
-
| 'gray'
|
|
31
|
-
| 'white'
|
|
32
|
-
| 'maroon'
|
|
33
|
-
| 'red'
|
|
34
|
-
| 'purple'
|
|
35
|
-
| 'fuchsia'
|
|
36
|
-
| 'green'
|
|
37
|
-
| 'lime'
|
|
38
|
-
| 'olive'
|
|
39
|
-
| 'yellow'
|
|
40
|
-
| 'navy'
|
|
41
|
-
| 'blue'
|
|
42
|
-
| 'teal'
|
|
43
|
-
| 'aqua'
|
|
44
|
-
| 'orange'
|
|
45
|
-
| 'aliceblue'
|
|
46
|
-
| 'antiquewhite'
|
|
47
|
-
| 'aquamarine'
|
|
48
|
-
| 'azure'
|
|
49
|
-
| 'beige'
|
|
50
|
-
| 'bisque'
|
|
51
|
-
| 'blanchedalmond'
|
|
52
|
-
| 'blueviolet'
|
|
53
|
-
| 'brown'
|
|
54
|
-
| 'burlywood'
|
|
55
|
-
| 'cadetblue'
|
|
56
|
-
| 'chartreuse'
|
|
57
|
-
| 'chocolate'
|
|
58
|
-
| 'coral'
|
|
59
|
-
| 'cornflowerblue'
|
|
60
|
-
| 'cornsilk'
|
|
61
|
-
| 'crimson'
|
|
62
|
-
| 'cyan'
|
|
63
|
-
| 'darkblue'
|
|
64
|
-
| 'darkcyan'
|
|
65
|
-
| 'darkgoldenrod'
|
|
66
|
-
| 'darkgray'
|
|
67
|
-
| 'darkgreen'
|
|
68
|
-
| 'darkgrey'
|
|
69
|
-
| 'darkkhaki'
|
|
70
|
-
| 'darkmagenta'
|
|
71
|
-
| 'darkolivegreen'
|
|
72
|
-
| 'darkorange'
|
|
73
|
-
| 'darkorchid'
|
|
74
|
-
| 'darkred'
|
|
75
|
-
| 'darksalmon'
|
|
76
|
-
| 'darkseagreen'
|
|
77
|
-
| 'darkslateblue'
|
|
78
|
-
| 'darkslategray'
|
|
79
|
-
| 'darkslategrey'
|
|
80
|
-
| 'darkturquoise'
|
|
81
|
-
| 'darkviolet'
|
|
82
|
-
| 'deeppink'
|
|
83
|
-
| 'deepskyblue'
|
|
84
|
-
| 'dimgray'
|
|
85
|
-
| 'dimgrey'
|
|
86
|
-
| 'dodgerblue'
|
|
87
|
-
| 'firebrick'
|
|
88
|
-
| 'floralwhite'
|
|
89
|
-
| 'forestgreen'
|
|
90
|
-
| 'gainsboro'
|
|
91
|
-
| 'ghostwhite'
|
|
92
|
-
| 'gold'
|
|
93
|
-
| 'goldenrod'
|
|
94
|
-
| 'greenyellow'
|
|
95
|
-
| 'grey'
|
|
96
|
-
| 'honeydew'
|
|
97
|
-
| 'hotpink'
|
|
98
|
-
| 'indianred'
|
|
99
|
-
| 'indigo'
|
|
100
|
-
| 'ivory'
|
|
101
|
-
| 'khaki'
|
|
102
|
-
| 'lavender'
|
|
103
|
-
| 'lavenderblush'
|
|
104
|
-
| 'lawngreen'
|
|
105
|
-
| 'lemonchiffon'
|
|
106
|
-
| 'lightblue'
|
|
107
|
-
| 'lightcoral'
|
|
108
|
-
| 'lightcyan'
|
|
109
|
-
| 'lightgoldenrodyellow'
|
|
110
|
-
| 'lightgray'
|
|
111
|
-
| 'lightgreen'
|
|
112
|
-
| 'lightgrey'
|
|
113
|
-
| 'lightpink'
|
|
114
|
-
| 'lightsalmon'
|
|
115
|
-
| 'lightseagreen'
|
|
116
|
-
| 'lightskyblue'
|
|
117
|
-
| 'lightslategray'
|
|
118
|
-
| 'lightslategrey'
|
|
119
|
-
| 'lightsteelblue'
|
|
120
|
-
| 'lightyellow'
|
|
121
|
-
| 'limegreen'
|
|
122
|
-
| 'linen'
|
|
123
|
-
| 'magenta'
|
|
124
|
-
| 'mediumaquamarine'
|
|
125
|
-
| 'mediumblue'
|
|
126
|
-
| 'mediumorchid'
|
|
127
|
-
| 'mediumpurple'
|
|
128
|
-
| 'mediumseagreen'
|
|
129
|
-
| 'mediumslateblue'
|
|
130
|
-
| 'mediumspringgreen'
|
|
131
|
-
| 'mediumturquoise'
|
|
132
|
-
| 'mediumvioletred'
|
|
133
|
-
| 'midnightblue'
|
|
134
|
-
| 'mintcream'
|
|
135
|
-
| 'mistyrose'
|
|
136
|
-
| 'moccasin'
|
|
137
|
-
| 'navajowhite'
|
|
138
|
-
| 'oldlace'
|
|
139
|
-
| 'olivedrab'
|
|
140
|
-
| 'orangered'
|
|
141
|
-
| 'orchid'
|
|
142
|
-
| 'palegoldenrod'
|
|
143
|
-
| 'palegreen'
|
|
144
|
-
| 'paleturquoise'
|
|
145
|
-
| 'palevioletred'
|
|
146
|
-
| 'papayawhip'
|
|
147
|
-
| 'peachpuff'
|
|
148
|
-
| 'peru'
|
|
149
|
-
| 'pink'
|
|
150
|
-
| 'plum'
|
|
151
|
-
| 'powderblue'
|
|
152
|
-
| 'rosybrown'
|
|
153
|
-
| 'royalblue'
|
|
154
|
-
| 'saddlebrown'
|
|
155
|
-
| 'salmon'
|
|
156
|
-
| 'sandybrown'
|
|
157
|
-
| 'seagreen'
|
|
158
|
-
| 'seashell'
|
|
159
|
-
| 'sienna'
|
|
160
|
-
| 'skyblue'
|
|
161
|
-
| 'slateblue'
|
|
162
|
-
| 'slategray'
|
|
163
|
-
| 'slategrey'
|
|
164
|
-
| 'snow'
|
|
165
|
-
| 'springgreen'
|
|
166
|
-
| 'steelblue'
|
|
167
|
-
| 'tan'
|
|
168
|
-
| 'thistle'
|
|
169
|
-
| 'tomato'
|
|
170
|
-
| 'turquoise'
|
|
171
|
-
| 'violet'
|
|
172
|
-
| 'wheat'
|
|
173
|
-
| 'whitesmoke'
|
|
174
|
-
| 'yellowgreen'
|
|
175
|
-
| 'rebeccapurple'
|
package/src/units/index.ts
DELETED
package/src/units/stripUnit.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
type Value<V> = V extends string ? number : V
|
|
2
|
-
type Unit<V> = V extends string ? string : undefined
|
|
3
|
-
|
|
4
|
-
export type StripUnit = <V extends string | number, UR extends boolean = false>(
|
|
5
|
-
value: V,
|
|
6
|
-
unitReturn?: UR,
|
|
7
|
-
) => UR extends true ? [Value<V>, Unit<V>] : Value<V>
|
|
8
|
-
|
|
9
|
-
const stripUnit = ((value: string | number, unitReturn?: boolean) => {
|
|
10
|
-
const cssRegex = /^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/
|
|
11
|
-
|
|
12
|
-
if (typeof value !== 'string') return unitReturn ? [value, undefined] : value
|
|
13
|
-
|
|
14
|
-
const matchedValue = value.match(cssRegex)
|
|
15
|
-
|
|
16
|
-
if (unitReturn) {
|
|
17
|
-
if (matchedValue) return [parseFloat(value), matchedValue[2]]
|
|
18
|
-
return [value, undefined]
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (matchedValue) return parseFloat(value)
|
|
22
|
-
return value
|
|
23
|
-
}) as StripUnit
|
|
24
|
-
|
|
25
|
-
export default stripUnit
|
package/src/units/value.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import stripUnit from './stripUnit'
|
|
2
|
-
|
|
3
|
-
type CssUnits =
|
|
4
|
-
| 'px'
|
|
5
|
-
| 'rem'
|
|
6
|
-
| '%'
|
|
7
|
-
| 'em'
|
|
8
|
-
| 'ex'
|
|
9
|
-
| 'cm'
|
|
10
|
-
| 'mm'
|
|
11
|
-
| 'in'
|
|
12
|
-
| 'pt'
|
|
13
|
-
| 'pc'
|
|
14
|
-
| 'ch'
|
|
15
|
-
| 'vh'
|
|
16
|
-
| 'vw'
|
|
17
|
-
| 'vmin'
|
|
18
|
-
| 'vmax'
|
|
19
|
-
|
|
20
|
-
const isNotValue = (val: unknown) => !val && val !== 0
|
|
21
|
-
|
|
22
|
-
export type Value = (
|
|
23
|
-
param: string | number | null | undefined,
|
|
24
|
-
rootSize?: number,
|
|
25
|
-
outputUnit?: CssUnits,
|
|
26
|
-
) => string | number | null
|
|
27
|
-
|
|
28
|
-
const value: Value = (param, rootSize = 16, outputUnit = 'rem'): string | number | null => {
|
|
29
|
-
if (isNotValue(param)) return null
|
|
30
|
-
|
|
31
|
-
// After the guard above, param is guaranteed to be string | number (non-null)
|
|
32
|
-
const p = param as string | number
|
|
33
|
-
|
|
34
|
-
const [val, unit] = stripUnit(p as string, true)
|
|
35
|
-
if (isNotValue(val)) return null
|
|
36
|
-
if (val === 0 || typeof val === 'string') return p
|
|
37
|
-
|
|
38
|
-
const canConvert = rootSize && !Number.isNaN(val)
|
|
39
|
-
if (canConvert && !unit && outputUnit === 'px') return `${val}${outputUnit}`
|
|
40
|
-
if (canConvert && !unit) return `${val / rootSize}rem`
|
|
41
|
-
if (canConvert && unit === 'px' && outputUnit === 'rem') return `${val / rootSize}rem`
|
|
42
|
-
if (unit) return p
|
|
43
|
-
|
|
44
|
-
return `${val}${outputUnit}`
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default value
|
package/src/units/values.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import value from './value'
|
|
2
|
-
|
|
3
|
-
type CssUnits =
|
|
4
|
-
| 'px'
|
|
5
|
-
| 'rem'
|
|
6
|
-
| '%'
|
|
7
|
-
| 'em'
|
|
8
|
-
| 'ex'
|
|
9
|
-
| 'cm'
|
|
10
|
-
| 'mm'
|
|
11
|
-
| 'in'
|
|
12
|
-
| 'pt'
|
|
13
|
-
| 'pc'
|
|
14
|
-
| 'ch'
|
|
15
|
-
| 'vh'
|
|
16
|
-
| 'vw'
|
|
17
|
-
| 'vmin'
|
|
18
|
-
| 'vmax'
|
|
19
|
-
|
|
20
|
-
type GetValueOf = (...args: unknown[]) => number | string
|
|
21
|
-
const getValueOf: GetValueOf = (...args: any[]) =>
|
|
22
|
-
args.find((v) => typeof v !== 'undefined' && v !== null)
|
|
23
|
-
|
|
24
|
-
export type Values = (
|
|
25
|
-
items: unknown[],
|
|
26
|
-
rootSize?: number,
|
|
27
|
-
outputUnit?: CssUnits,
|
|
28
|
-
) => string | number | null
|
|
29
|
-
|
|
30
|
-
const values: Values = (items, rootSize, outputUnit) => {
|
|
31
|
-
const param = getValueOf(...items)
|
|
32
|
-
|
|
33
|
-
if (Array.isArray(param)) {
|
|
34
|
-
return param.map((item) => value(item, rootSize, outputUnit)).join(' ')
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return value(param, rootSize, outputUnit)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default values
|