@stylexjs/stylex 0.5.1 → 0.6.1
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/lib/StyleXCSSTypes.d.ts +88 -45
- package/lib/StyleXCSSTypes.js.flow +89 -45
- package/lib/StyleXTypes.d.ts +14 -11
- package/lib/StyleXTypes.js.flow +37 -29
- package/lib/VarTypes.d.ts +108 -0
- package/lib/VarTypes.js +1 -0
- package/lib/VarTypes.js.flow +109 -0
- package/lib/es/VarTypes.mjs +0 -0
- package/lib/stylex.d.ts +42 -45
- package/lib/stylex.js.flow +41 -46
- package/package.json +6 -6
package/lib/StyleXCSSTypes.d.ts
CHANGED
|
@@ -48,29 +48,54 @@ type CSSCursor =
|
|
|
48
48
|
| '-webkit-grab'
|
|
49
49
|
| '-webkit-grabbing';
|
|
50
50
|
type alignContent =
|
|
51
|
+
| 'center'
|
|
52
|
+
| 'start'
|
|
53
|
+
| 'end'
|
|
51
54
|
| 'flex-start'
|
|
52
55
|
| 'flex-end'
|
|
53
|
-
| '
|
|
56
|
+
| 'normal'
|
|
57
|
+
| 'baseline'
|
|
58
|
+
| 'first baseline'
|
|
59
|
+
| 'last baseline'
|
|
54
60
|
| 'space-between'
|
|
55
61
|
| 'space-around'
|
|
62
|
+
| 'space-evenly'
|
|
56
63
|
| 'stretch'
|
|
64
|
+
| 'safe center'
|
|
65
|
+
| 'unsafe center'
|
|
57
66
|
| all;
|
|
58
67
|
type alignItems =
|
|
68
|
+
| 'normal'
|
|
69
|
+
| 'stretch'
|
|
70
|
+
| 'center'
|
|
59
71
|
| 'start'
|
|
60
72
|
| 'end'
|
|
61
73
|
| 'flex-start'
|
|
62
74
|
| 'flex-end'
|
|
63
|
-
| '
|
|
75
|
+
| 'self-start'
|
|
76
|
+
| 'self-end'
|
|
64
77
|
| 'baseline'
|
|
65
|
-
| '
|
|
78
|
+
| 'first baseline'
|
|
79
|
+
| 'last baseline'
|
|
80
|
+
| 'safe center'
|
|
81
|
+
| 'unsafe center'
|
|
66
82
|
| all;
|
|
67
83
|
type alignSelf =
|
|
68
84
|
| 'auto'
|
|
85
|
+
| 'normal'
|
|
86
|
+
| 'center'
|
|
87
|
+
| 'start'
|
|
88
|
+
| 'end'
|
|
89
|
+
| 'self-start'
|
|
90
|
+
| 'self-end'
|
|
69
91
|
| 'flex-start'
|
|
70
92
|
| 'flex-end'
|
|
71
|
-
| 'center'
|
|
72
93
|
| 'baseline'
|
|
94
|
+
| 'first baseline'
|
|
95
|
+
| 'last baseline'
|
|
73
96
|
| 'stretch'
|
|
97
|
+
| 'safe center'
|
|
98
|
+
| 'unsafe center'
|
|
74
99
|
| all;
|
|
75
100
|
type all = null | 'initial' | 'inherit' | 'unset';
|
|
76
101
|
type animationDelay = time;
|
|
@@ -136,7 +161,7 @@ type borderRightColor = color;
|
|
|
136
161
|
type borderRightStyle = brStyle;
|
|
137
162
|
type borderRightWidth = borderWidth;
|
|
138
163
|
type borderRadius = lengthPercentage;
|
|
139
|
-
type borderSpacing = number;
|
|
164
|
+
type borderSpacing = number | string;
|
|
140
165
|
type borderStyle = brStyle;
|
|
141
166
|
type borderTopLeftRadius = lengthPercentage;
|
|
142
167
|
type borderTopRightRadius = lengthPercentage;
|
|
@@ -145,10 +170,10 @@ type borderTopWidth = borderWidth;
|
|
|
145
170
|
type boxAlign = 'start' | 'center' | 'end' | 'baseline' | 'stretch';
|
|
146
171
|
type boxDecorationBreak = 'slice' | 'clone';
|
|
147
172
|
type boxDirection = 'normal' | 'reverse' | 'inherit';
|
|
148
|
-
type boxFlex = number;
|
|
149
|
-
type boxFlexGroup = number;
|
|
173
|
+
type boxFlex = number | string;
|
|
174
|
+
type boxFlexGroup = number | string;
|
|
150
175
|
type boxLines = 'single' | 'multiple';
|
|
151
|
-
type boxOrdinalGroup = number;
|
|
176
|
+
type boxOrdinalGroup = number | string;
|
|
152
177
|
type boxOrient =
|
|
153
178
|
| 'horizontal'
|
|
154
179
|
| 'vertical'
|
|
@@ -200,7 +225,7 @@ type captionSide =
|
|
|
200
225
|
type clear = 'none' | 'left' | 'right' | 'both' | 'inline-start' | 'inline-end';
|
|
201
226
|
type clip = string | 'auto';
|
|
202
227
|
type clipPath = string | 'none';
|
|
203
|
-
type columnCount = number | 'auto';
|
|
228
|
+
type columnCount = number | 'auto' | string;
|
|
204
229
|
type columnFill = 'auto' | 'balance';
|
|
205
230
|
type columnGap = number | string | 'normal';
|
|
206
231
|
type columnRule = columnRuleWidth | columnRuleStyle | columnRuleColor;
|
|
@@ -208,7 +233,7 @@ type columnRuleColor = color;
|
|
|
208
233
|
type columnRuleStyle = brStyle;
|
|
209
234
|
type columnRuleWidth = borderWidth;
|
|
210
235
|
type columnSpan = 'none' | 'all';
|
|
211
|
-
type columnWidth = number | 'auto';
|
|
236
|
+
type columnWidth = number | 'auto' | string;
|
|
212
237
|
type columns = columnWidth | columnCount;
|
|
213
238
|
type contain = 'none' | 'strict' | 'content' | string;
|
|
214
239
|
type content = string;
|
|
@@ -276,8 +301,8 @@ type flexDirection =
|
|
|
276
301
|
| 'column-reverse'
|
|
277
302
|
| 'inherit';
|
|
278
303
|
type flexFlow = flexDirection | flexWrap;
|
|
279
|
-
type flexGrow = number |
|
|
280
|
-
type flexShrink = number |
|
|
304
|
+
type flexGrow = all | number | string;
|
|
305
|
+
type flexShrink = all | number | string;
|
|
281
306
|
type flexWrap = 'nowrap' | 'wrap' | 'wrap-reverse' | 'inherit';
|
|
282
307
|
type float =
|
|
283
308
|
| 'left'
|
|
@@ -372,33 +397,63 @@ type initialLetterAlign = string;
|
|
|
372
397
|
type inlineSize = width;
|
|
373
398
|
type isolation = 'auto' | 'isolate';
|
|
374
399
|
type justifyContent =
|
|
400
|
+
| 'center'
|
|
401
|
+
| 'start'
|
|
402
|
+
| 'end'
|
|
375
403
|
| 'flex-start'
|
|
376
404
|
| 'flex-end'
|
|
377
|
-
| '
|
|
405
|
+
| 'left'
|
|
406
|
+
| 'right'
|
|
407
|
+
| 'normal'
|
|
378
408
|
| 'space-between'
|
|
379
409
|
| 'space-around'
|
|
380
410
|
| 'space-evenly'
|
|
411
|
+
| 'stretch'
|
|
412
|
+
| 'safe center'
|
|
413
|
+
| 'unsafe center'
|
|
381
414
|
| 'inherit';
|
|
382
415
|
type justifyItems =
|
|
416
|
+
| 'normal'
|
|
417
|
+
| 'stretch'
|
|
418
|
+
| 'center'
|
|
383
419
|
| 'start'
|
|
384
420
|
| 'end'
|
|
385
421
|
| 'flex-start'
|
|
386
422
|
| 'flex-end'
|
|
387
|
-
| '
|
|
423
|
+
| 'self-start'
|
|
424
|
+
| 'self-end'
|
|
425
|
+
| 'left'
|
|
426
|
+
| 'right'
|
|
388
427
|
| 'baseline'
|
|
389
|
-
| '
|
|
428
|
+
| 'first baseline'
|
|
429
|
+
| 'last baseline'
|
|
430
|
+
| 'safe center'
|
|
431
|
+
| 'unsafe center'
|
|
432
|
+
| 'legacy right'
|
|
433
|
+
| 'legacy left'
|
|
434
|
+
| 'legacy center'
|
|
390
435
|
| all;
|
|
391
436
|
type justifySelf =
|
|
392
437
|
| 'auto'
|
|
393
438
|
| 'normal'
|
|
394
439
|
| 'stretch'
|
|
395
|
-
|
|
|
396
|
-
|
|
|
440
|
+
| 'center'
|
|
441
|
+
| 'start'
|
|
442
|
+
| 'end'
|
|
443
|
+
| 'flex-start'
|
|
444
|
+
| 'flex-end'
|
|
445
|
+
| 'self-start'
|
|
446
|
+
| 'self-end'
|
|
397
447
|
| 'left'
|
|
398
|
-
| 'right'
|
|
448
|
+
| 'right'
|
|
449
|
+
| 'baseline'
|
|
450
|
+
| 'first baseline'
|
|
451
|
+
| 'last baseline'
|
|
452
|
+
| 'safe center'
|
|
453
|
+
| 'unsafe center';
|
|
399
454
|
type letterSpacing = 'normal' | lengthPercentage;
|
|
400
455
|
type lineBreak = 'auto' | 'loose' | 'normal' | 'strict';
|
|
401
|
-
type lineHeight = 'inherit' | number;
|
|
456
|
+
type lineHeight = 'inherit' | number | string;
|
|
402
457
|
type listStyle = listStyleType | listStylePosition | listStyleImage;
|
|
403
458
|
type listStyleImage = string | 'none';
|
|
404
459
|
type listStylePosition = 'inside' | 'outside';
|
|
@@ -412,7 +467,7 @@ type marginInlineStart = marginLeft;
|
|
|
412
467
|
type marginLeft = number | string | 'auto';
|
|
413
468
|
type marginRight = number | string | 'auto';
|
|
414
469
|
type marginTop = number | string | 'auto';
|
|
415
|
-
type markerOffset = number | 'auto';
|
|
470
|
+
type markerOffset = number | 'auto' | string;
|
|
416
471
|
type mask = maskLayer;
|
|
417
472
|
type maskClip = string;
|
|
418
473
|
type maskComposite = compositeOperator;
|
|
@@ -471,11 +526,11 @@ type MsOverflowStyle =
|
|
|
471
526
|
type objectFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
|
|
472
527
|
type objectPosition = string;
|
|
473
528
|
type opacity = number | string;
|
|
474
|
-
type order = number;
|
|
475
|
-
type orphans = number;
|
|
529
|
+
type order = number | string;
|
|
530
|
+
type orphans = number | string;
|
|
476
531
|
type outline = string;
|
|
477
532
|
type outlineColor = color | 'invert';
|
|
478
|
-
type outlineOffset = number;
|
|
533
|
+
type outlineOffset = number | string;
|
|
479
534
|
type outlineStyle = 'auto' | brStyle;
|
|
480
535
|
type outlineWidth = borderWidth;
|
|
481
536
|
type overflow = 'visible' | 'hidden' | 'scroll' | 'auto';
|
|
@@ -520,18 +575,10 @@ type rubyPosition = 'over' | 'under' | 'inter-character';
|
|
|
520
575
|
type scrollBehavior = 'auto' | 'smooth';
|
|
521
576
|
type scrollSnapAlign = 'none' | 'start' | 'end' | 'center';
|
|
522
577
|
type scrollSnapType = 'none' | 'x mandatory' | 'y mandatory';
|
|
523
|
-
type
|
|
524
|
-
| 'center'
|
|
525
|
-
| 'start'
|
|
526
|
-
| 'end'
|
|
527
|
-
| 'self-start'
|
|
528
|
-
| 'self-end'
|
|
529
|
-
| 'flex-start'
|
|
530
|
-
| 'flex-end';
|
|
531
|
-
type shapeImageThreshold = number;
|
|
578
|
+
type shapeImageThreshold = number | string;
|
|
532
579
|
type shapeMargin = lengthPercentage;
|
|
533
580
|
type shapeOutside = 'none' | shapeBox | string;
|
|
534
|
-
type tabSize = number;
|
|
581
|
+
type tabSize = number | string;
|
|
535
582
|
type tableLayout = 'auto' | 'fixed';
|
|
536
583
|
type textAlign =
|
|
537
584
|
| 'start'
|
|
@@ -619,7 +666,7 @@ type whiteSpace =
|
|
|
619
666
|
| 'pre-line'
|
|
620
667
|
| 'initial'
|
|
621
668
|
| 'inherit';
|
|
622
|
-
type widows = number;
|
|
669
|
+
type widows = number | string;
|
|
623
670
|
type width =
|
|
624
671
|
| string
|
|
625
672
|
| number
|
|
@@ -653,7 +700,6 @@ type alignmentBaseline =
|
|
|
653
700
|
| 'alphabetic'
|
|
654
701
|
| 'hanging'
|
|
655
702
|
| 'mathematical';
|
|
656
|
-
type baselinePosition = 'baseline' | 'first baseline' | 'last baseline';
|
|
657
703
|
type baselineShift = 'baseline' | 'sub' | 'super' | svgLength;
|
|
658
704
|
type behavior = string;
|
|
659
705
|
type clipRule = 'nonzero' | 'evenodd';
|
|
@@ -674,10 +720,10 @@ type dominantBaseline =
|
|
|
674
720
|
| 'text-after-edge'
|
|
675
721
|
| 'text-before-edge';
|
|
676
722
|
type fill = paint;
|
|
677
|
-
type fillOpacity = number;
|
|
723
|
+
type fillOpacity = number | string;
|
|
678
724
|
type fillRule = 'nonzero' | 'evenodd';
|
|
679
|
-
type glyphOrientationHorizontal = number;
|
|
680
|
-
type glyphOrientationVertical = number;
|
|
725
|
+
type glyphOrientationHorizontal = number | string;
|
|
726
|
+
type glyphOrientationVertical = number | string;
|
|
681
727
|
type kerning = 'auto' | svgLength;
|
|
682
728
|
type marker = 'none' | string;
|
|
683
729
|
type markerEnd = 'none' | string;
|
|
@@ -730,8 +776,8 @@ type strokeDasharray = 'none' | string;
|
|
|
730
776
|
type strokeDashoffset = svgLength;
|
|
731
777
|
type strokeLinecap = 'butt' | 'round' | 'square';
|
|
732
778
|
type strokeLinejoin = 'miter' | 'round' | 'bevel';
|
|
733
|
-
type strokeMiterlimit = number;
|
|
734
|
-
type strokeOpacity = number;
|
|
779
|
+
type strokeMiterlimit = number | string;
|
|
780
|
+
type strokeOpacity = number | string;
|
|
735
781
|
type strokeWidth = svgLength;
|
|
736
782
|
type textAnchor = 'start' | 'middle' | 'end';
|
|
737
783
|
type unicodeRange = string;
|
|
@@ -867,20 +913,20 @@ export type CSSProperties = Readonly<{
|
|
|
867
913
|
| 'padding-box'
|
|
868
914
|
| 'content-box'
|
|
869
915
|
| 'text';
|
|
870
|
-
backgroundClip?: all | 'border-box' | 'padding-box' | 'content-box' | 'text';
|
|
871
916
|
WebkitBoxOrient?:
|
|
872
917
|
| null
|
|
873
918
|
| 'vertical'
|
|
874
919
|
| 'horizontal'
|
|
875
920
|
| 'inline-axis'
|
|
876
921
|
| 'block-axis';
|
|
877
|
-
WebkitLineClamp?: all | number;
|
|
922
|
+
WebkitLineClamp?: all | number | string;
|
|
878
923
|
accentColor?: all | color;
|
|
879
924
|
aspectRatio?: all | number | string;
|
|
880
925
|
placeContent?: all | string;
|
|
881
926
|
alignContent?: all | alignContent;
|
|
882
927
|
justifyContent?: all | justifyContent;
|
|
883
928
|
placeItems?: all | string;
|
|
929
|
+
placeSelf?: all | string;
|
|
884
930
|
alignItems?: all | alignItems;
|
|
885
931
|
justifyItems?: all | justifyItems;
|
|
886
932
|
alignSelf?: all | alignSelf;
|
|
@@ -1095,9 +1141,6 @@ export type CSSProperties = Readonly<{
|
|
|
1095
1141
|
fontVariantNumeric?: all | fontVariantNumeric;
|
|
1096
1142
|
fontVariantPosition?: all | fontVariantPosition;
|
|
1097
1143
|
fontWeight?: all | fontWeight;
|
|
1098
|
-
fontFeatureSettings?: all | string;
|
|
1099
|
-
fontKerning?: all | 'auto' | 'normal' | 'none';
|
|
1100
|
-
fontLanguageOverride?: all | string;
|
|
1101
1144
|
fontOpticalSizing?: all | 'auto' | 'none';
|
|
1102
1145
|
fontPalette?: all | 'light' | 'dark' | string;
|
|
1103
1146
|
fontVariationSettings?: all | string;
|
|
@@ -49,29 +49,54 @@ type CSSCursor =
|
|
|
49
49
|
| '-webkit-grabbing';
|
|
50
50
|
|
|
51
51
|
type alignContent =
|
|
52
|
+
| 'center'
|
|
53
|
+
| 'start'
|
|
54
|
+
| 'end'
|
|
52
55
|
| 'flex-start'
|
|
53
56
|
| 'flex-end'
|
|
54
|
-
| '
|
|
57
|
+
| 'normal'
|
|
58
|
+
| 'baseline'
|
|
59
|
+
| 'first baseline'
|
|
60
|
+
| 'last baseline'
|
|
55
61
|
| 'space-between'
|
|
56
62
|
| 'space-around'
|
|
63
|
+
| 'space-evenly'
|
|
57
64
|
| 'stretch'
|
|
65
|
+
| 'safe center'
|
|
66
|
+
| 'unsafe center'
|
|
58
67
|
| all;
|
|
59
68
|
type alignItems =
|
|
69
|
+
| 'normal'
|
|
70
|
+
| 'stretch'
|
|
71
|
+
| 'center'
|
|
60
72
|
| 'start'
|
|
61
73
|
| 'end'
|
|
62
74
|
| 'flex-start'
|
|
63
75
|
| 'flex-end'
|
|
64
|
-
| '
|
|
76
|
+
| 'self-start'
|
|
77
|
+
| 'self-end'
|
|
65
78
|
| 'baseline'
|
|
66
|
-
| '
|
|
79
|
+
| 'first baseline'
|
|
80
|
+
| 'last baseline'
|
|
81
|
+
| 'safe center'
|
|
82
|
+
| 'unsafe center'
|
|
67
83
|
| all;
|
|
68
84
|
type alignSelf =
|
|
69
85
|
| 'auto'
|
|
86
|
+
| 'normal'
|
|
87
|
+
| 'center'
|
|
88
|
+
| 'start'
|
|
89
|
+
| 'end'
|
|
90
|
+
| 'self-start'
|
|
91
|
+
| 'self-end'
|
|
70
92
|
| 'flex-start'
|
|
71
93
|
| 'flex-end'
|
|
72
|
-
| 'center'
|
|
73
94
|
| 'baseline'
|
|
95
|
+
| 'first baseline'
|
|
96
|
+
| 'last baseline'
|
|
74
97
|
| 'stretch'
|
|
98
|
+
| 'safe center'
|
|
99
|
+
| 'unsafe center'
|
|
75
100
|
| all;
|
|
76
101
|
type all = null | 'initial' | 'inherit' | 'unset';
|
|
77
102
|
type animationDelay = time;
|
|
@@ -138,7 +163,7 @@ type borderRightColor = color;
|
|
|
138
163
|
type borderRightStyle = brStyle;
|
|
139
164
|
type borderRightWidth = borderWidth;
|
|
140
165
|
type borderRadius = lengthPercentage;
|
|
141
|
-
type borderSpacing = number;
|
|
166
|
+
type borderSpacing = number | string;
|
|
142
167
|
type borderStyle = brStyle;
|
|
143
168
|
type borderTopLeftRadius = lengthPercentage;
|
|
144
169
|
type borderTopRightRadius = lengthPercentage;
|
|
@@ -147,10 +172,10 @@ type borderTopWidth = borderWidth;
|
|
|
147
172
|
type boxAlign = 'start' | 'center' | 'end' | 'baseline' | 'stretch';
|
|
148
173
|
type boxDecorationBreak = 'slice' | 'clone';
|
|
149
174
|
type boxDirection = 'normal' | 'reverse' | 'inherit';
|
|
150
|
-
type boxFlex = number;
|
|
151
|
-
type boxFlexGroup = number;
|
|
175
|
+
type boxFlex = number | string;
|
|
176
|
+
type boxFlexGroup = number | string;
|
|
152
177
|
type boxLines = 'single' | 'multiple';
|
|
153
|
-
type boxOrdinalGroup = number;
|
|
178
|
+
type boxOrdinalGroup = number | string;
|
|
154
179
|
type boxOrient =
|
|
155
180
|
| 'horizontal'
|
|
156
181
|
| 'vertical'
|
|
@@ -202,7 +227,7 @@ type captionSide =
|
|
|
202
227
|
type clear = 'none' | 'left' | 'right' | 'both' | 'inline-start' | 'inline-end';
|
|
203
228
|
type clip = string | 'auto';
|
|
204
229
|
type clipPath = string | 'none';
|
|
205
|
-
type columnCount = number | 'auto';
|
|
230
|
+
type columnCount = number | 'auto' | string;
|
|
206
231
|
type columnFill = 'auto' | 'balance';
|
|
207
232
|
type columnGap = number | string | 'normal';
|
|
208
233
|
type columnRule = columnRuleWidth | columnRuleStyle | columnRuleColor;
|
|
@@ -210,7 +235,7 @@ type columnRuleColor = color;
|
|
|
210
235
|
type columnRuleStyle = brStyle;
|
|
211
236
|
type columnRuleWidth = borderWidth;
|
|
212
237
|
type columnSpan = 'none' | 'all';
|
|
213
|
-
type columnWidth = number | 'auto';
|
|
238
|
+
type columnWidth = number | 'auto' | string;
|
|
214
239
|
type columns = columnWidth | columnCount;
|
|
215
240
|
type contain = 'none' | 'strict' | 'content' | string;
|
|
216
241
|
type content = string;
|
|
@@ -278,8 +303,8 @@ type flexDirection =
|
|
|
278
303
|
| 'column-reverse'
|
|
279
304
|
| 'inherit';
|
|
280
305
|
type flexFlow = flexDirection | flexWrap;
|
|
281
|
-
type flexGrow = number |
|
|
282
|
-
type flexShrink = number |
|
|
306
|
+
type flexGrow = all | number | string;
|
|
307
|
+
type flexShrink = all | number | string;
|
|
283
308
|
type flexWrap = 'nowrap' | 'wrap' | 'wrap-reverse' | 'inherit';
|
|
284
309
|
type float =
|
|
285
310
|
| 'left'
|
|
@@ -374,21 +399,41 @@ type initialLetterAlign = string;
|
|
|
374
399
|
type inlineSize = width;
|
|
375
400
|
type isolation = 'auto' | 'isolate';
|
|
376
401
|
type justifyContent =
|
|
402
|
+
| 'center'
|
|
403
|
+
| 'start'
|
|
404
|
+
| 'end'
|
|
377
405
|
| 'flex-start'
|
|
378
406
|
| 'flex-end'
|
|
379
|
-
| '
|
|
407
|
+
| 'left'
|
|
408
|
+
| 'right'
|
|
409
|
+
| 'normal'
|
|
380
410
|
| 'space-between'
|
|
381
411
|
| 'space-around'
|
|
382
412
|
| 'space-evenly'
|
|
413
|
+
| 'stretch'
|
|
414
|
+
| 'safe center'
|
|
415
|
+
| 'unsafe center'
|
|
383
416
|
| 'inherit';
|
|
384
417
|
type justifyItems =
|
|
418
|
+
| 'normal'
|
|
419
|
+
| 'stretch'
|
|
420
|
+
| 'center'
|
|
385
421
|
| 'start'
|
|
386
422
|
| 'end'
|
|
387
423
|
| 'flex-start'
|
|
388
424
|
| 'flex-end'
|
|
389
|
-
| '
|
|
425
|
+
| 'self-start'
|
|
426
|
+
| 'self-end'
|
|
427
|
+
| 'left'
|
|
428
|
+
| 'right'
|
|
390
429
|
| 'baseline'
|
|
391
|
-
| '
|
|
430
|
+
| 'first baseline'
|
|
431
|
+
| 'last baseline'
|
|
432
|
+
| 'safe center'
|
|
433
|
+
| 'unsafe center'
|
|
434
|
+
| 'legacy right'
|
|
435
|
+
| 'legacy left'
|
|
436
|
+
| 'legacy center'
|
|
392
437
|
| all;
|
|
393
438
|
// There's an optional overflowPosition (safe vs unsafe) prefix to
|
|
394
439
|
// [selfPosition | 'left' | 'right']. It's not used on www, so, it's not added
|
|
@@ -397,13 +442,24 @@ type justifySelf =
|
|
|
397
442
|
| 'auto'
|
|
398
443
|
| 'normal'
|
|
399
444
|
| 'stretch'
|
|
400
|
-
|
|
|
401
|
-
|
|
|
445
|
+
| 'center'
|
|
446
|
+
| 'start'
|
|
447
|
+
| 'end'
|
|
448
|
+
| 'flex-start'
|
|
449
|
+
| 'flex-end'
|
|
450
|
+
| 'self-start'
|
|
451
|
+
| 'self-end'
|
|
402
452
|
| 'left'
|
|
403
|
-
| 'right'
|
|
453
|
+
| 'right'
|
|
454
|
+
| 'baseline'
|
|
455
|
+
| 'first baseline'
|
|
456
|
+
| 'last baseline'
|
|
457
|
+
| 'safe center'
|
|
458
|
+
| 'unsafe center';
|
|
459
|
+
|
|
404
460
|
type letterSpacing = 'normal' | lengthPercentage;
|
|
405
461
|
type lineBreak = 'auto' | 'loose' | 'normal' | 'strict';
|
|
406
|
-
type lineHeight = 'inherit' | number;
|
|
462
|
+
type lineHeight = 'inherit' | number | string;
|
|
407
463
|
type listStyle = listStyleType | listStylePosition | listStyleImage;
|
|
408
464
|
type listStyleImage = string | 'none';
|
|
409
465
|
type listStylePosition = 'inside' | 'outside';
|
|
@@ -417,7 +473,7 @@ type marginInlineStart = marginLeft;
|
|
|
417
473
|
type marginLeft = number | string | 'auto';
|
|
418
474
|
type marginRight = number | string | 'auto';
|
|
419
475
|
type marginTop = number | string | 'auto';
|
|
420
|
-
type markerOffset = number | 'auto';
|
|
476
|
+
type markerOffset = number | 'auto' | string;
|
|
421
477
|
type mask = maskLayer;
|
|
422
478
|
type maskClip = string;
|
|
423
479
|
type maskComposite = compositeOperator;
|
|
@@ -476,11 +532,11 @@ type MsOverflowStyle =
|
|
|
476
532
|
type objectFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
|
|
477
533
|
type objectPosition = string;
|
|
478
534
|
type opacity = number | string;
|
|
479
|
-
type order = number;
|
|
480
|
-
type orphans = number;
|
|
535
|
+
type order = number | string;
|
|
536
|
+
type orphans = number | string;
|
|
481
537
|
type outline = string;
|
|
482
538
|
type outlineColor = color | 'invert';
|
|
483
|
-
type outlineOffset = number;
|
|
539
|
+
type outlineOffset = number | string;
|
|
484
540
|
type outlineStyle = 'auto' | brStyle;
|
|
485
541
|
type outlineWidth = borderWidth;
|
|
486
542
|
type overflow = 'visible' | 'hidden' | 'scroll' | 'auto';
|
|
@@ -525,18 +581,10 @@ type rubyPosition = 'over' | 'under' | 'inter-character';
|
|
|
525
581
|
type scrollBehavior = 'auto' | 'smooth';
|
|
526
582
|
type scrollSnapAlign = 'none' | 'start' | 'end' | 'center';
|
|
527
583
|
type scrollSnapType = 'none' | 'x mandatory' | 'y mandatory';
|
|
528
|
-
type
|
|
529
|
-
| 'center'
|
|
530
|
-
| 'start'
|
|
531
|
-
| 'end'
|
|
532
|
-
| 'self-start'
|
|
533
|
-
| 'self-end'
|
|
534
|
-
| 'flex-start'
|
|
535
|
-
| 'flex-end';
|
|
536
|
-
type shapeImageThreshold = number;
|
|
584
|
+
type shapeImageThreshold = number | string;
|
|
537
585
|
type shapeMargin = lengthPercentage;
|
|
538
586
|
type shapeOutside = 'none' | shapeBox | string;
|
|
539
|
-
type tabSize = number;
|
|
587
|
+
type tabSize = number | string;
|
|
540
588
|
type tableLayout = 'auto' | 'fixed';
|
|
541
589
|
type textAlign =
|
|
542
590
|
| 'start'
|
|
@@ -624,7 +672,7 @@ type whiteSpace =
|
|
|
624
672
|
| 'pre-line'
|
|
625
673
|
| 'initial'
|
|
626
674
|
| 'inherit';
|
|
627
|
-
type widows = number;
|
|
675
|
+
type widows = number | string;
|
|
628
676
|
type width =
|
|
629
677
|
| string
|
|
630
678
|
| number
|
|
@@ -658,7 +706,6 @@ type alignmentBaseline =
|
|
|
658
706
|
| 'alphabetic'
|
|
659
707
|
| 'hanging'
|
|
660
708
|
| 'mathematical';
|
|
661
|
-
type baselinePosition = 'baseline' | 'first baseline' | 'last baseline';
|
|
662
709
|
type baselineShift = 'baseline' | 'sub' | 'super' | svgLength;
|
|
663
710
|
type behavior = string;
|
|
664
711
|
type clipRule = 'nonzero' | 'evenodd';
|
|
@@ -679,10 +726,10 @@ type dominantBaseline =
|
|
|
679
726
|
| 'text-after-edge'
|
|
680
727
|
| 'text-before-edge';
|
|
681
728
|
type fill = paint;
|
|
682
|
-
type fillOpacity = number;
|
|
729
|
+
type fillOpacity = number | string;
|
|
683
730
|
type fillRule = 'nonzero' | 'evenodd';
|
|
684
|
-
type glyphOrientationHorizontal = number;
|
|
685
|
-
type glyphOrientationVertical = number;
|
|
731
|
+
type glyphOrientationHorizontal = number | string;
|
|
732
|
+
type glyphOrientationVertical = number | string;
|
|
686
733
|
type kerning = 'auto' | svgLength;
|
|
687
734
|
type marker = 'none' | string;
|
|
688
735
|
type markerEnd = 'none' | string;
|
|
@@ -735,8 +782,8 @@ type strokeDasharray = 'none' | string;
|
|
|
735
782
|
type strokeDashoffset = svgLength;
|
|
736
783
|
type strokeLinecap = 'butt' | 'round' | 'square';
|
|
737
784
|
type strokeLinejoin = 'miter' | 'round' | 'bevel';
|
|
738
|
-
type strokeMiterlimit = number;
|
|
739
|
-
type strokeOpacity = number;
|
|
785
|
+
type strokeMiterlimit = number | string;
|
|
786
|
+
type strokeOpacity = number | string;
|
|
740
787
|
type strokeWidth = svgLength;
|
|
741
788
|
type textAnchor = 'start' | 'middle' | 'end';
|
|
742
789
|
type unicodeRange = string;
|
|
@@ -887,7 +934,6 @@ export type CSSProperties = $ReadOnly<{
|
|
|
887
934
|
| 'padding-box'
|
|
888
935
|
| 'content-box'
|
|
889
936
|
| 'text',
|
|
890
|
-
backgroundClip?: all | 'border-box' | 'padding-box' | 'content-box' | 'text',
|
|
891
937
|
|
|
892
938
|
WebkitBoxOrient?:
|
|
893
939
|
| null
|
|
@@ -895,7 +941,7 @@ export type CSSProperties = $ReadOnly<{
|
|
|
895
941
|
| 'horizontal'
|
|
896
942
|
| 'inline-axis'
|
|
897
943
|
| 'block-axis',
|
|
898
|
-
WebkitLineClamp?: all | number,
|
|
944
|
+
WebkitLineClamp?: all | number | string,
|
|
899
945
|
// ENDOF ...$Exact<SupportedVendorSpecificCSSProperties>,
|
|
900
946
|
|
|
901
947
|
accentColor?: all | color,
|
|
@@ -906,6 +952,7 @@ export type CSSProperties = $ReadOnly<{
|
|
|
906
952
|
alignContent?: all | alignContent,
|
|
907
953
|
justifyContent?: all | justifyContent,
|
|
908
954
|
placeItems?: all | string,
|
|
955
|
+
placeSelf?: all | string,
|
|
909
956
|
alignItems?: all | alignItems,
|
|
910
957
|
justifyItems?: all | justifyItems,
|
|
911
958
|
alignSelf?: all | alignSelf,
|
|
@@ -1142,9 +1189,6 @@ export type CSSProperties = $ReadOnly<{
|
|
|
1142
1189
|
fontWeight?: all | fontWeight,
|
|
1143
1190
|
// fontHeight?: all | number | string,
|
|
1144
1191
|
// fontWidth?: all | number | string,
|
|
1145
|
-
fontFeatureSettings?: all | string,
|
|
1146
|
-
fontKerning?: all | 'auto' | 'normal' | 'none',
|
|
1147
|
-
fontLanguageOverride?: all | string,
|
|
1148
1192
|
fontOpticalSizing?: all | 'auto' | 'none',
|
|
1149
1193
|
fontPalette?: all | 'light' | 'dark' | string,
|
|
1150
1194
|
fontVariationSettings?: all | string,
|
package/lib/StyleXTypes.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import type { CSSType } from './VarTypes';
|
|
8
9
|
import type { CSSProperties } from './StyleXCSSTypes';
|
|
9
10
|
|
|
10
11
|
// Using an opaque type to declare ClassNames generated by stylex.
|
|
@@ -86,15 +87,16 @@ export type StyleXSingleStyle = false | (null | undefined | NestedCSSPropTypes);
|
|
|
86
87
|
export type Keyframes = Readonly<{ [name: string]: CSSProperties }>;
|
|
87
88
|
export type LegacyThemeStyles = Readonly<{ [constantName: string]: string }>;
|
|
88
89
|
|
|
89
|
-
type ComplexStyleValueType<T> =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
type ComplexStyleValueType<T> =
|
|
91
|
+
T extends StyleXVar<infer U>
|
|
92
|
+
? U
|
|
93
|
+
: T extends string | number | null
|
|
94
|
+
? T
|
|
95
|
+
: T extends ReadonlyArray<infer U>
|
|
96
|
+
? U
|
|
97
|
+
: T extends Readonly<{ default: infer A; [cond: CondStr]: infer B }>
|
|
98
|
+
? ComplexStyleValueType<A> | ComplexStyleValueType<B>
|
|
99
|
+
: T;
|
|
98
100
|
|
|
99
101
|
export type MapNamespace<CSS> = Readonly<{
|
|
100
102
|
[Key in keyof CSS]: StyleXClassNameFor<Key, ComplexStyleValueType<CSS[Key]>>;
|
|
@@ -143,7 +145,7 @@ type GenStylePropType<CSS extends UserAuthoredStyles> = Readonly<
|
|
|
143
145
|
// Replace `XStyle` with this.
|
|
144
146
|
export type StaticStyles<
|
|
145
147
|
CSS extends UserAuthoredStyles = CSSPropertiesWithExtras,
|
|
146
|
-
> = StyleXArray<false | null | GenStylePropType<CSS>>;
|
|
148
|
+
> = StyleXArray<false | null | undefined | GenStylePropType<CSS>>;
|
|
147
149
|
|
|
148
150
|
export type StaticStylesWithout<CSS extends UserAuthoredStyles> = StaticStyles<
|
|
149
151
|
Omit<CSSPropertiesWithExtras, keyof CSS>
|
|
@@ -153,6 +155,7 @@ export type StyleXStyles<
|
|
|
153
155
|
CSS extends UserAuthoredStyles = CSSPropertiesWithExtras,
|
|
154
156
|
> = StyleXArray<
|
|
155
157
|
| null
|
|
158
|
+
| undefined
|
|
156
159
|
| false
|
|
157
160
|
| GenStylePropType<CSS>
|
|
158
161
|
| Readonly<[GenStylePropType<CSS>, InlineStyles]>
|
|
@@ -181,7 +184,7 @@ export type IDFromVarGroup<T extends VarGroup<unknown, unknown>> =
|
|
|
181
184
|
T['__opaqueId'];
|
|
182
185
|
|
|
183
186
|
type TTokens = Readonly<{
|
|
184
|
-
[key: string]: string | { [key: string]: string };
|
|
187
|
+
[key: string]: CSSType | string | { [key: string]: string };
|
|
185
188
|
}>;
|
|
186
189
|
|
|
187
190
|
type UnwrapVars<T> = T extends StyleXVar<infer U> ? U : T;
|
package/lib/StyleXTypes.js.flow
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @flow strict
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import type { CSSType } from './VarTypes';
|
|
10
11
|
import type { CSSProperties } from './StyleXCSSTypes';
|
|
11
12
|
|
|
12
13
|
// Using an opaque type to declare ClassNames generated by stylex.
|
|
@@ -61,15 +62,16 @@ export type LegacyThemeStyles = $ReadOnly<{
|
|
|
61
62
|
...
|
|
62
63
|
}>;
|
|
63
64
|
|
|
64
|
-
type ComplexStyleValueType<+T> =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
type ComplexStyleValueType<+T> =
|
|
66
|
+
T extends StyleXVar<infer U>
|
|
67
|
+
? U
|
|
68
|
+
: T extends string | number | null
|
|
69
|
+
? T
|
|
70
|
+
: T extends $ReadOnlyArray<infer U>
|
|
71
|
+
? U
|
|
72
|
+
: T extends $ReadOnly<{ default: infer A, +[string]: infer B }>
|
|
73
|
+
? ComplexStyleValueType<A> | ComplexStyleValueType<B>
|
|
74
|
+
: $ReadOnly<T>;
|
|
73
75
|
|
|
74
76
|
type _MapNamespace<+CSS: { +[string]: mixed }> = $ReadOnly<{
|
|
75
77
|
[Key in keyof CSS]: StyleXClassNameFor<Key, ComplexStyleValueType<CSS[Key]>>,
|
|
@@ -128,35 +130,41 @@ export type StyleXStylesWithout<+CSS: { +[string]: mixed }> = StyleXStyles<
|
|
|
128
130
|
// This is the type for the variables object
|
|
129
131
|
declare export opaque type StyleXVar<+Val: mixed>;
|
|
130
132
|
|
|
131
|
-
|
|
133
|
+
export type VarGroup<
|
|
132
134
|
+Tokens: { +[string]: mixed },
|
|
133
135
|
+_ID: string = string,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
>
|
|
144
|
-
|
|
145
|
-
|
|
136
|
+
> = $ReadOnly<{
|
|
137
|
+
[Key in keyof Tokens]: StyleXVar<Tokens[Key]>,
|
|
138
|
+
}>;
|
|
139
|
+
|
|
140
|
+
export type TokensFromVarGroup<T: VarGroup<{ +[string]: mixed }>> = $ReadOnly<{
|
|
141
|
+
[Key in keyof T]: T[Key] extends StyleXVar<infer U> ? U : empty,
|
|
142
|
+
}>;
|
|
143
|
+
|
|
144
|
+
type IDFromVarGroup<+T: VarGroup<{ +[string]: mixed }>> =
|
|
145
|
+
T extends VarGroup<{ +[string]: mixed }, infer ID> ? ID : empty;
|
|
146
|
+
|
|
147
|
+
type NestedVarObject<+T> =
|
|
148
|
+
| T
|
|
149
|
+
| $ReadOnly<{
|
|
150
|
+
default: NestedVarObject<T>,
|
|
151
|
+
[string]: NestedVarObject<T>,
|
|
152
|
+
}>;
|
|
146
153
|
|
|
147
154
|
type TTokens = $ReadOnly<{
|
|
148
155
|
[string]:
|
|
149
|
-
| number
|
|
150
|
-
| string
|
|
151
|
-
|
|
|
152
|
-
| StyleXVar<string | number>,
|
|
156
|
+
| NestedVarObject<string | number>
|
|
157
|
+
| StyleXVar<string | number>
|
|
158
|
+
| CSSType<string | number>,
|
|
153
159
|
}>;
|
|
154
160
|
|
|
155
161
|
type UnwrapVars<T> = T extends StyleXVar<infer U> ? U : T;
|
|
156
162
|
export type FlattenTokens<T: TTokens> = {
|
|
157
|
-
+[Key in keyof T]: T[Key] extends
|
|
158
|
-
? UnwrapVars<
|
|
159
|
-
:
|
|
163
|
+
+[Key in keyof T]: T[Key] extends CSSType<string | number>
|
|
164
|
+
? UnwrapVars<T[Key]>
|
|
165
|
+
: T[Key] extends { +default: infer X, +[string]: infer Y }
|
|
166
|
+
? UnwrapVars<X | Y>
|
|
167
|
+
: UnwrapVars<T[Key]>,
|
|
160
168
|
};
|
|
161
169
|
|
|
162
170
|
export type StyleX$DefineVars = <DefaultTokens: TTokens, ID: string = string>(
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type ValueWithDefault<T> =
|
|
11
|
+
| T
|
|
12
|
+
| Readonly<{
|
|
13
|
+
default: ValueWithDefault<T>;
|
|
14
|
+
[$$Key$$: string]: ValueWithDefault<T>;
|
|
15
|
+
}>;
|
|
16
|
+
export type CSSSyntax =
|
|
17
|
+
| '*'
|
|
18
|
+
| '<length>'
|
|
19
|
+
| '<number>'
|
|
20
|
+
| '<percentage>'
|
|
21
|
+
| '<length-percentage>'
|
|
22
|
+
| '<color>'
|
|
23
|
+
| '<image>'
|
|
24
|
+
| '<url>'
|
|
25
|
+
| '<integer>'
|
|
26
|
+
| '<angle>'
|
|
27
|
+
| '<time>'
|
|
28
|
+
| '<resolution>'
|
|
29
|
+
| '<transform-function>'
|
|
30
|
+
| '<custom-ident>'
|
|
31
|
+
| '<transform-list>';
|
|
32
|
+
type CSSSyntaxType = CSSSyntax;
|
|
33
|
+
interface ICSSType<_T extends string | number> {
|
|
34
|
+
readonly value: ValueWithDefault<string>;
|
|
35
|
+
readonly syntax: CSSSyntaxType;
|
|
36
|
+
}
|
|
37
|
+
export declare class Angle<T extends string | 0> implements ICSSType<T> {
|
|
38
|
+
readonly value: ValueWithDefault<string>;
|
|
39
|
+
readonly syntax: CSSSyntaxType;
|
|
40
|
+
}
|
|
41
|
+
export declare class Color<T extends string> implements ICSSType<T> {
|
|
42
|
+
readonly value: ValueWithDefault<string>;
|
|
43
|
+
readonly syntax: CSSSyntaxType;
|
|
44
|
+
}
|
|
45
|
+
export declare class Url<T extends string> implements ICSSType<T> {
|
|
46
|
+
readonly value: ValueWithDefault<string>;
|
|
47
|
+
readonly syntax: CSSSyntaxType;
|
|
48
|
+
}
|
|
49
|
+
export declare class Image<T extends string> implements ICSSType<T> {
|
|
50
|
+
readonly value: ValueWithDefault<string>;
|
|
51
|
+
readonly syntax: CSSSyntaxType;
|
|
52
|
+
}
|
|
53
|
+
export declare class Integer<T extends string | number> implements ICSSType<T> {
|
|
54
|
+
readonly value: ValueWithDefault<string>;
|
|
55
|
+
readonly syntax: CSSSyntaxType;
|
|
56
|
+
}
|
|
57
|
+
export declare class LengthPercentage<T extends string | number>
|
|
58
|
+
implements ICSSType<T>
|
|
59
|
+
{
|
|
60
|
+
readonly value: ValueWithDefault<string>;
|
|
61
|
+
readonly syntax: CSSSyntaxType;
|
|
62
|
+
}
|
|
63
|
+
export declare class Length<T extends string | number> implements ICSSType<T> {
|
|
64
|
+
readonly value: ValueWithDefault<string>;
|
|
65
|
+
readonly syntax: CSSSyntaxType;
|
|
66
|
+
}
|
|
67
|
+
export declare class Percentage<T extends string | number>
|
|
68
|
+
implements ICSSType<T>
|
|
69
|
+
{
|
|
70
|
+
readonly value: ValueWithDefault<string>;
|
|
71
|
+
readonly syntax: CSSSyntaxType;
|
|
72
|
+
}
|
|
73
|
+
export declare class Num<T extends string | number> implements ICSSType<T> {
|
|
74
|
+
readonly value: ValueWithDefault<string>;
|
|
75
|
+
readonly syntax: CSSSyntaxType;
|
|
76
|
+
}
|
|
77
|
+
export declare class Resolution<T extends string> implements ICSSType<T> {
|
|
78
|
+
readonly value: ValueWithDefault<string>;
|
|
79
|
+
readonly syntax: CSSSyntaxType;
|
|
80
|
+
}
|
|
81
|
+
export declare class Time<T extends string | 0> implements ICSSType<T> {
|
|
82
|
+
readonly value: ValueWithDefault<string>;
|
|
83
|
+
readonly syntax: CSSSyntaxType;
|
|
84
|
+
}
|
|
85
|
+
export declare class TransformFunction<T extends string>
|
|
86
|
+
implements ICSSType<T>
|
|
87
|
+
{
|
|
88
|
+
readonly value: ValueWithDefault<string>;
|
|
89
|
+
readonly syntax: CSSSyntaxType;
|
|
90
|
+
}
|
|
91
|
+
export declare class TransformList<T extends string> implements ICSSType<T> {
|
|
92
|
+
readonly value: ValueWithDefault<string>;
|
|
93
|
+
readonly syntax: CSSSyntaxType;
|
|
94
|
+
}
|
|
95
|
+
export type CSSType<T extends string | number> =
|
|
96
|
+
| Angle<T>
|
|
97
|
+
| Color<T>
|
|
98
|
+
| Url<T>
|
|
99
|
+
| Image<T>
|
|
100
|
+
| Integer<T>
|
|
101
|
+
| LengthPercentage<T>
|
|
102
|
+
| Length<T>
|
|
103
|
+
| Percentage<T>
|
|
104
|
+
| Num<T>
|
|
105
|
+
| Resolution<T>
|
|
106
|
+
| Time<T>
|
|
107
|
+
| TransformFunction<T>
|
|
108
|
+
| TransformList<T>;
|
package/lib/VarTypes.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type ValueWithDefault<+T> =
|
|
11
|
+
| T
|
|
12
|
+
| $ReadOnly<{
|
|
13
|
+
default: ValueWithDefault<T>,
|
|
14
|
+
[string]: ValueWithDefault<T>,
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
export type CSSSyntax =
|
|
18
|
+
| '*'
|
|
19
|
+
| '<length>'
|
|
20
|
+
| '<number>'
|
|
21
|
+
| '<percentage>'
|
|
22
|
+
| '<length-percentage>'
|
|
23
|
+
| '<color>'
|
|
24
|
+
| '<image>'
|
|
25
|
+
| '<url>'
|
|
26
|
+
| '<integer>'
|
|
27
|
+
| '<angle>'
|
|
28
|
+
| '<time>'
|
|
29
|
+
| '<resolution>'
|
|
30
|
+
| '<transform-function>'
|
|
31
|
+
| '<custom-ident>'
|
|
32
|
+
| '<transform-list>';
|
|
33
|
+
|
|
34
|
+
type CSSSyntaxType = CSSSyntax;
|
|
35
|
+
|
|
36
|
+
interface ICSSType<+_T: string | number> {
|
|
37
|
+
+value: ValueWithDefault<string>;
|
|
38
|
+
+syntax: CSSSyntaxType;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare export class Angle<+T: string | 0> implements ICSSType<T> {
|
|
42
|
+
+value: ValueWithDefault<string>;
|
|
43
|
+
+syntax: CSSSyntaxType;
|
|
44
|
+
}
|
|
45
|
+
declare export class Color<+T: string> implements ICSSType<T> {
|
|
46
|
+
+value: ValueWithDefault<string>;
|
|
47
|
+
+syntax: CSSSyntaxType;
|
|
48
|
+
}
|
|
49
|
+
declare export class Url<+T: string> implements ICSSType<T> {
|
|
50
|
+
+value: ValueWithDefault<string>;
|
|
51
|
+
+syntax: CSSSyntaxType;
|
|
52
|
+
}
|
|
53
|
+
declare export class Image<+T: string> implements ICSSType<T> {
|
|
54
|
+
+value: ValueWithDefault<string>;
|
|
55
|
+
+syntax: CSSSyntaxType;
|
|
56
|
+
}
|
|
57
|
+
declare export class Integer<+T: string | number> implements ICSSType<T> {
|
|
58
|
+
+value: ValueWithDefault<string>;
|
|
59
|
+
+syntax: CSSSyntaxType;
|
|
60
|
+
}
|
|
61
|
+
declare export class LengthPercentage<+T: string | number>
|
|
62
|
+
implements ICSSType<T>
|
|
63
|
+
{
|
|
64
|
+
+value: ValueWithDefault<string>;
|
|
65
|
+
+syntax: CSSSyntaxType;
|
|
66
|
+
}
|
|
67
|
+
declare export class Length<+T: string | number> implements ICSSType<T> {
|
|
68
|
+
+value: ValueWithDefault<string>;
|
|
69
|
+
+syntax: CSSSyntaxType;
|
|
70
|
+
}
|
|
71
|
+
declare export class Percentage<+T: string | number> implements ICSSType<T> {
|
|
72
|
+
+value: ValueWithDefault<string>;
|
|
73
|
+
+syntax: CSSSyntaxType;
|
|
74
|
+
}
|
|
75
|
+
declare export class Num<+T: string | number> implements ICSSType<T> {
|
|
76
|
+
+value: ValueWithDefault<string>;
|
|
77
|
+
+syntax: CSSSyntaxType;
|
|
78
|
+
}
|
|
79
|
+
declare export class Resolution<+T: string> implements ICSSType<T> {
|
|
80
|
+
+value: ValueWithDefault<string>;
|
|
81
|
+
+syntax: CSSSyntaxType;
|
|
82
|
+
}
|
|
83
|
+
declare export class Time<+T: string | 0> implements ICSSType<T> {
|
|
84
|
+
+value: ValueWithDefault<string>;
|
|
85
|
+
+syntax: CSSSyntaxType;
|
|
86
|
+
}
|
|
87
|
+
declare export class TransformFunction<+T: string> implements ICSSType<T> {
|
|
88
|
+
+value: ValueWithDefault<string>;
|
|
89
|
+
+syntax: CSSSyntaxType;
|
|
90
|
+
}
|
|
91
|
+
declare export class TransformList<+T: string> implements ICSSType<T> {
|
|
92
|
+
+value: ValueWithDefault<string>;
|
|
93
|
+
+syntax: CSSSyntaxType;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type CSSType<+T: string | number> =
|
|
97
|
+
| Angle<T>
|
|
98
|
+
| Color<T>
|
|
99
|
+
| Url<T>
|
|
100
|
+
| Image<T>
|
|
101
|
+
| Integer<T>
|
|
102
|
+
| LengthPercentage<T>
|
|
103
|
+
| Length<T>
|
|
104
|
+
| Percentage<T>
|
|
105
|
+
| Num<T>
|
|
106
|
+
| Resolution<T>
|
|
107
|
+
| Time<T>
|
|
108
|
+
| TransformFunction<T>
|
|
109
|
+
| TransformList<T>;
|
|
File without changes
|
package/lib/stylex.d.ts
CHANGED
|
@@ -17,6 +17,22 @@ import type {
|
|
|
17
17
|
InlineStyles,
|
|
18
18
|
StyleXClassNameFor,
|
|
19
19
|
} from './StyleXTypes';
|
|
20
|
+
import type {
|
|
21
|
+
ValueWithDefault,
|
|
22
|
+
Angle,
|
|
23
|
+
Color,
|
|
24
|
+
Url,
|
|
25
|
+
Image,
|
|
26
|
+
Integer,
|
|
27
|
+
LengthPercentage,
|
|
28
|
+
Length,
|
|
29
|
+
Percentage,
|
|
30
|
+
Num,
|
|
31
|
+
Resolution,
|
|
32
|
+
Time,
|
|
33
|
+
TransformFunction,
|
|
34
|
+
TransformList,
|
|
35
|
+
} from './VarTypes';
|
|
20
36
|
export type {
|
|
21
37
|
VarGroup,
|
|
22
38
|
Theme,
|
|
@@ -65,57 +81,38 @@ export declare const create: Stylex$Create;
|
|
|
65
81
|
export declare const defineVars: StyleX$DefineVars;
|
|
66
82
|
export declare const createTheme: StyleX$CreateTheme;
|
|
67
83
|
export declare const include: Stylex$Include;
|
|
68
|
-
type ValueWithDefault<T> =
|
|
69
|
-
| T
|
|
70
|
-
| Readonly<{
|
|
71
|
-
readonly default: T;
|
|
72
|
-
readonly [$$Key$$: string]: ValueWithDefault<T>;
|
|
73
|
-
}>;
|
|
74
|
-
type CSSSyntax =
|
|
75
|
-
| '*'
|
|
76
|
-
| '<length>'
|
|
77
|
-
| '<number>'
|
|
78
|
-
| '<percentage>'
|
|
79
|
-
| '<length-percentage>'
|
|
80
|
-
| '<color>'
|
|
81
|
-
| '<image>'
|
|
82
|
-
| '<url>'
|
|
83
|
-
| '<integer>'
|
|
84
|
-
| '<angle>'
|
|
85
|
-
| '<time>'
|
|
86
|
-
| '<resolution>'
|
|
87
|
-
| '<transform-function>'
|
|
88
|
-
| '<custom-ident>'
|
|
89
|
-
| '<transform-list>';
|
|
90
|
-
type CSSSyntaxType = CSSSyntax | ReadonlyArray<CSSSyntax>;
|
|
91
|
-
interface ICSSType<T extends string | number> {
|
|
92
|
-
readonly value: ValueWithDefault<T>;
|
|
93
|
-
readonly syntax: CSSSyntaxType;
|
|
94
|
-
}
|
|
95
84
|
export declare const types: {
|
|
96
|
-
angle: <T extends
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
85
|
+
angle: <T extends string | 0 = string | 0>(
|
|
86
|
+
_v: ValueWithDefault<T>,
|
|
87
|
+
) => Angle<T>;
|
|
88
|
+
color: <T extends string = string>(_v: ValueWithDefault<T>) => Color<T>;
|
|
89
|
+
url: <T extends string = string>(_v: ValueWithDefault<T>) => Url<T>;
|
|
90
|
+
image: <T extends string = string>(_v: ValueWithDefault<T>) => Image<T>;
|
|
91
|
+
integer: <T extends number | string = number | string>(
|
|
92
|
+
_v: ValueWithDefault<T>,
|
|
93
|
+
) => Integer<T>;
|
|
94
|
+
lengthPercentage: <T extends number | string = number | string>(
|
|
95
|
+
_v: ValueWithDefault<T>,
|
|
96
|
+
) => LengthPercentage<T>;
|
|
97
|
+
length: <T extends number | string = number | string>(
|
|
98
|
+
_v: ValueWithDefault<T>,
|
|
99
|
+
) => Length<T>;
|
|
100
|
+
percentage: <T extends number | string = number | string>(
|
|
102
101
|
_v: ValueWithDefault<T>,
|
|
103
|
-
) =>
|
|
104
|
-
|
|
105
|
-
percentage: <T extends number | string>(
|
|
102
|
+
) => Percentage<T>;
|
|
103
|
+
number: <T extends number | string = number | string>(
|
|
106
104
|
_v: ValueWithDefault<T>,
|
|
107
|
-
) =>
|
|
108
|
-
|
|
109
|
-
resolution: <T extends number | string>(
|
|
105
|
+
) => Num<T>;
|
|
106
|
+
resolution: <T extends string = string>(
|
|
110
107
|
_v: ValueWithDefault<T>,
|
|
111
|
-
) =>
|
|
112
|
-
time: <T extends
|
|
113
|
-
transformFunction: <T extends
|
|
108
|
+
) => Resolution<T>;
|
|
109
|
+
time: <T extends string | 0 = string | 0>(_v: ValueWithDefault<T>) => Time<T>;
|
|
110
|
+
transformFunction: <T extends string = string>(
|
|
114
111
|
_v: ValueWithDefault<T>,
|
|
115
|
-
) =>
|
|
116
|
-
transformList: <T extends
|
|
112
|
+
) => TransformFunction<T>;
|
|
113
|
+
transformList: <T extends string = string>(
|
|
117
114
|
_v: ValueWithDefault<T>,
|
|
118
|
-
) =>
|
|
115
|
+
) => TransformList<T>;
|
|
119
116
|
};
|
|
120
117
|
export declare const keyframes: (keyframes: Keyframes) => string;
|
|
121
118
|
export declare const firstThatWorks: <T extends string | number>(
|
package/lib/stylex.js.flow
CHANGED
|
@@ -17,6 +17,22 @@ import type {
|
|
|
17
17
|
InlineStyles,
|
|
18
18
|
StyleXClassNameFor,
|
|
19
19
|
} from './StyleXTypes';
|
|
20
|
+
import type {
|
|
21
|
+
ValueWithDefault,
|
|
22
|
+
Angle,
|
|
23
|
+
Color,
|
|
24
|
+
Url,
|
|
25
|
+
Image,
|
|
26
|
+
Integer,
|
|
27
|
+
LengthPercentage,
|
|
28
|
+
Length,
|
|
29
|
+
Percentage,
|
|
30
|
+
Num,
|
|
31
|
+
Resolution,
|
|
32
|
+
Time,
|
|
33
|
+
TransformFunction,
|
|
34
|
+
TransformList,
|
|
35
|
+
} from './VarTypes';
|
|
20
36
|
|
|
21
37
|
export type {
|
|
22
38
|
VarGroup,
|
|
@@ -70,55 +86,34 @@ declare export const createTheme: StyleX$CreateTheme;
|
|
|
70
86
|
|
|
71
87
|
declare export const include: Stylex$Include;
|
|
72
88
|
|
|
73
|
-
type ValueWithDefault<+T> =
|
|
74
|
-
| T
|
|
75
|
-
| $ReadOnly<{
|
|
76
|
-
+default: T,
|
|
77
|
-
+[string]: ValueWithDefault<T>,
|
|
78
|
-
}>;
|
|
79
|
-
|
|
80
|
-
type CSSSyntax =
|
|
81
|
-
| '*'
|
|
82
|
-
| '<length>'
|
|
83
|
-
| '<number>'
|
|
84
|
-
| '<percentage>'
|
|
85
|
-
| '<length-percentage>'
|
|
86
|
-
| '<color>'
|
|
87
|
-
| '<image>'
|
|
88
|
-
| '<url>'
|
|
89
|
-
| '<integer>'
|
|
90
|
-
| '<angle>'
|
|
91
|
-
| '<time>'
|
|
92
|
-
| '<resolution>'
|
|
93
|
-
| '<transform-function>'
|
|
94
|
-
| '<custom-ident>'
|
|
95
|
-
| '<transform-list>';
|
|
96
|
-
|
|
97
|
-
type CSSSyntaxType = CSSSyntax | $ReadOnlyArray<CSSSyntax>;
|
|
98
|
-
|
|
99
|
-
interface ICSSType<+T: string | number> {
|
|
100
|
-
+value: ValueWithDefault<T>;
|
|
101
|
-
+syntax: CSSSyntaxType;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
89
|
declare export const types: {
|
|
105
|
-
angle: <T:
|
|
106
|
-
color: <T:
|
|
107
|
-
url: <T:
|
|
108
|
-
image: <T:
|
|
109
|
-
integer: <T: number | string
|
|
110
|
-
|
|
90
|
+
angle: <T: string | 0 = string | 0>(_v: ValueWithDefault<T>) => Angle<T>,
|
|
91
|
+
color: <T: string = string>(_v: ValueWithDefault<T>) => Color<T>,
|
|
92
|
+
url: <T: string = string>(_v: ValueWithDefault<T>) => Url<T>,
|
|
93
|
+
image: <T: string = string>(_v: ValueWithDefault<T>) => Image<T>,
|
|
94
|
+
integer: <T: number | string = number | string>(
|
|
95
|
+
_v: ValueWithDefault<T>,
|
|
96
|
+
) => Integer<T>,
|
|
97
|
+
lengthPercentage: <T: number | string = number | string>(
|
|
98
|
+
_v: ValueWithDefault<T>,
|
|
99
|
+
) => LengthPercentage<T>,
|
|
100
|
+
length: <T: number | string = number | string>(
|
|
101
|
+
_v: ValueWithDefault<T>,
|
|
102
|
+
) => Length<T>,
|
|
103
|
+
percentage: <T: number | string = number | string>(
|
|
104
|
+
_v: ValueWithDefault<T>,
|
|
105
|
+
) => Percentage<T>,
|
|
106
|
+
number: <T: number | string = number | string>(
|
|
107
|
+
_v: ValueWithDefault<T>,
|
|
108
|
+
) => Num<T>,
|
|
109
|
+
resolution: <T: string = string>(_v: ValueWithDefault<T>) => Resolution<T>,
|
|
110
|
+
time: <T: string | 0 = string | 0>(_v: ValueWithDefault<T>) => Time<T>,
|
|
111
|
+
transformFunction: <T: string = string>(
|
|
111
112
|
_v: ValueWithDefault<T>,
|
|
112
|
-
) =>
|
|
113
|
-
|
|
114
|
-
percentage: <T: number | string>(_v: ValueWithDefault<T>) => ICSSType<T>,
|
|
115
|
-
number: <T: number | string>(_v: ValueWithDefault<T>) => ICSSType<T>,
|
|
116
|
-
resolution: <T: number | string>(_v: ValueWithDefault<T>) => ICSSType<T>,
|
|
117
|
-
time: <T: number | string>(_v: ValueWithDefault<T>) => ICSSType<T>,
|
|
118
|
-
transformFunction: <T: number | string>(
|
|
113
|
+
) => TransformFunction<T>,
|
|
114
|
+
transformList: <T: string = string>(
|
|
119
115
|
_v: ValueWithDefault<T>,
|
|
120
|
-
) =>
|
|
121
|
-
transformList: <T: number | string>(_v: ValueWithDefault<T>) => ICSSType<T>,
|
|
116
|
+
) => TransformList<T>,
|
|
122
117
|
};
|
|
123
118
|
|
|
124
119
|
declare export const keyframes: (keyframes: Keyframes) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexjs/stylex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "A library for defining styles for optimized user interfaces.",
|
|
5
5
|
"main": "./lib/stylex.js",
|
|
6
6
|
"module": "./lib/es/stylex.mjs",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"scripts": {
|
|
34
34
|
"prebuild": "gen-types -i src/ -o lib/",
|
|
35
|
-
"build:cjs": "BABEL_ENV=cjs babel src/ --out-dir lib/ --copy-files",
|
|
36
|
-
"build:esm": "BABEL_ENV=esm babel src/ --out-dir lib/es --out-file-extension .mjs",
|
|
35
|
+
"build:cjs": "cross-env BABEL_ENV=cjs babel src/ --out-dir lib/ --copy-files",
|
|
36
|
+
"build:esm": "cross-env BABEL_ENV=esm babel src/ --out-dir lib/es --out-file-extension .mjs",
|
|
37
37
|
"postbuild:esm": "rollup -c ./rollup.config.mjs",
|
|
38
38
|
"build": "npm run build:cjs && npm run build:esm",
|
|
39
39
|
"build-haste": "rewrite-imports -i src/ -o lib/",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"css-mediaquery": "^0.1.2",
|
|
44
44
|
"invariant": "^2.2.4",
|
|
45
|
-
"styleq": "0.1.3"
|
|
46
|
-
"utility-types": "^3.10.0"
|
|
45
|
+
"styleq": "0.1.3"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
|
-
"@stylexjs/scripts": "0.
|
|
48
|
+
"@stylexjs/scripts": "0.6.1",
|
|
49
|
+
"cross-env": "^7.0.3"
|
|
50
50
|
},
|
|
51
51
|
"jest": {},
|
|
52
52
|
"files": [
|