@@ -82,7 +82,9 @@ let join strings separator =
82
82
if index = 0 then item else acc ^ separator ^ item )
83
83
84
84
module Converter = struct
85
- let string_of_time t = Std.Int .toString t ^ {js| ms| js}
85
+ let string_of_time = function
86
+ | `ms t -> Std.Int .toString t ^ {js| ms| js}
87
+ | `s t -> Std.Int .toString t ^ {js| s| js}
86
88
87
89
let string_of_content x =
88
90
match x with
@@ -170,6 +172,7 @@ let alignContent x =
170
172
| #AlignContent .t as ac -> AlignContent .toString ac
171
173
| #NormalAlignment .t as na -> NormalAlignment .toString na
172
174
| #BaselineAlignment .t as ba -> BaselineAlignment .toString ba
175
+ | #OverflowAlignment .t as oa -> OverflowAlignment .toString oa
173
176
| #DistributedAlignment .t as da -> DistributedAlignment .toString da
174
177
| #Var .t as va -> Var .toString va
175
178
| #Cascading .t as c -> Cascading .toString c )
@@ -191,6 +194,7 @@ let alignSelf x =
191
194
match x with
192
195
| #AlignSelf .t as a -> AlignSelf .toString a
193
196
| #PositionalAlignment .t as pa -> PositionalAlignment .toString pa
197
+ | #OverflowAlignment .t as pa -> OverflowAlignment .toString pa
194
198
| #BaselineAlignment .t as ba -> BaselineAlignment .toString ba
195
199
| #Var .t as va -> Var .toString va
196
200
| #Cascading .t as c -> Cascading .toString c )
@@ -225,9 +229,8 @@ let backfaceVisibility x =
225
229
let backdropFilter x =
226
230
D
227
231
( {js| backdropFilter| js},
228
- x
229
- |. Std.Array .map BackdropFilter .toString
230
- |. Std.Array .joinWith ~sep: {js| , | js} )
232
+ x |. Std.Array .map Filter .toString |. Std.Array .joinWith ~sep: {js| , | js}
233
+ )
231
234
232
235
let backgroundAttachment x =
233
236
D
@@ -286,25 +289,35 @@ let backgroundOrigin x =
286
289
| #Var .t as va -> Var .toString va
287
290
| #Cascading .t as c -> Cascading .toString c )
288
291
289
- let string_of_backgroundposition x =
290
- match x with
291
- | #BackgroundPosition .t as bp -> BackgroundPosition .toString bp
292
- | `hv (h , v ) ->
293
- (match h with
292
+ let string_of_backgroundposition2 (x , y ) =
293
+ match x , y with
294
+ | x , Some y ->
295
+ (match x with
294
296
| #BackgroundPosition .X .t as h -> BackgroundPosition .X .toString h
295
297
| #Length .t as l -> Length .toString l )
296
298
^ {js| | js}
297
299
^
298
- (match v with
300
+ (match y with
299
301
| #BackgroundPosition .Y .t as v -> BackgroundPosition .Y .toString v
300
302
| #Length .t as l -> Length .toString l )
303
+ | x , None ->
304
+ (match x with
305
+ | #BackgroundPosition .t as bp -> BackgroundPosition .toString bp
306
+ | #Length .t as l -> Length .toString l )
307
+
308
+ let string_of_backgroundposition x =
309
+ match x with
310
+ | #BackgroundPosition .t as bp -> BackgroundPosition .toString bp
301
311
| #Length .t as l -> Length .toString l
302
312
| #Var .t as va -> Var .toString va
303
313
| #Cascading .t as c -> Cascading .toString c
304
314
305
315
let backgroundPosition x =
306
316
D ({js| backgroundPosition| js}, string_of_backgroundposition x )
307
317
318
+ let backgroundPosition2 x =
319
+ D ({js| backgroundPosition| js}, string_of_backgroundposition2 x )
320
+
308
321
let backgroundPositions bp =
309
322
D
310
323
( {js| backgroundPosition| js},
@@ -727,6 +740,7 @@ let justifyItems x =
727
740
D
728
741
( {js| justifyItems| js},
729
742
match x with
743
+ | `stretch -> {js| stretch| js}
730
744
| #PositionalAlignment .t as pa -> PositionalAlignment .toString pa
731
745
| #NormalAlignment .t as na -> NormalAlignment .toString na
732
746
| #BaselineAlignment .t as ba -> BaselineAlignment .toString ba
@@ -957,17 +971,24 @@ let perspective x =
957
971
| #Var .t as va -> Var .toString va
958
972
| #Cascading .t as c -> Cascading .toString c )
959
973
960
- let perspectiveOrigin x y =
974
+ let perspectiveOrigin x =
975
+ D
976
+ ( {js| perspectiveOrigin| js},
977
+ match x with
978
+ | #Perspective .t as p -> Perspective .toString p
979
+ | #TransformOrigin .t as t -> TransformOrigin .toString t )
980
+
981
+ let perspectiveOrigin2 x y =
961
982
D
962
983
( {js| perspectiveOrigin| js},
963
984
(match x with
964
985
| #Perspective .t as p -> Perspective .toString p
965
- | #Length .t as l -> Length .toString l )
986
+ | #TransformOrigin .t as t -> TransformOrigin .toString t )
966
987
^ {js| | js}
967
988
^
968
989
match y with
969
990
| #Perspective .t as p -> Perspective .toString p
970
- | #Length .t as l -> Length .toString l )
991
+ | #TransformOrigin .t as t -> TransformOrigin .toString t )
971
992
972
993
let pointerEvents x =
973
994
D
@@ -998,6 +1019,7 @@ let justifySelf x =
998
1019
match x with
999
1020
| #JustifySelf .t as j -> JustifySelf .toString j
1000
1021
| #PositionalAlignment .t as pa -> PositionalAlignment .toString pa
1022
+ | #OverflowAlignment .t as oa -> OverflowAlignment .toString oa
1001
1023
| #BaselineAlignment .t as ba -> BaselineAlignment .toString ba
1002
1024
| #Var .t as va -> Var .toString va
1003
1025
| #Cascading .t as c -> Cascading .toString c )
@@ -1142,8 +1164,12 @@ let transforms x =
1142
1164
x |. Std.Array .map Transform .toString |. Std.Array .joinWith ~sep: {js| | js}
1143
1165
)
1144
1166
1145
- let transformOrigin x y =
1146
- D ({js| transformOrigin| js}, Length .toString x ^ {js| | js} ^ Length .toString y )
1167
+ let transformOrigin x = D ({js| transformOrigin| js}, TransformOrigin .toString x )
1168
+
1169
+ let transformOrigin2 x y =
1170
+ D
1171
+ ( {js| transformOrigin| js},
1172
+ TransformOrigin .toString x ^ {js| | js} ^ TransformOrigin .toString y )
1147
1173
1148
1174
let transformOrigin3d x y z =
1149
1175
D
@@ -1367,7 +1393,7 @@ type listStyleType = ListStyleType.t
1367
1393
type repeatValue = RepeatValue .t
1368
1394
type outlineStyle = OutlineStyle .t
1369
1395
type transform = Transform .t
1370
- type 'colorOrVar gradient = 'colorOrVar Gradient .t
1396
+ type gradient = Gradient .t
1371
1397
1372
1398
let initial = Cascading .initial
1373
1399
let inherit_ = Cascading .inherit_
@@ -1632,61 +1658,20 @@ let flexBasis x =
1632
1658
1633
1659
let order x = D ({js| order| js}, Std.Int .toString x )
1634
1660
1635
- let string_of_calc x fn =
1636
- match x with
1637
- | `one a -> {js| calc(| js} ^ fn a ^ {js| )| js}
1638
- | `add (a , b ) -> {js| calc(| js} ^ fn a ^ {js| + | js} ^ fn b ^ {js| )| js}
1639
- | `sub (a , b ) -> {js| calc(| js} ^ fn a ^ {js| - | js} ^ fn b ^ {js| )| js}
1640
- | `mult (a , b ) -> {js| calc(| js} ^ fn a ^ {js| * | js} ^ fn b ^ {js| )| js}
1641
-
1642
1661
let string_of_minmax x =
1643
1662
match x with
1644
1663
| `auto -> {js| auto| js}
1645
- | `calc c -> string_of_calc c Length. toString
1646
- | `ch x -> Std.Float. toString x ^ {js| ch| js}
1647
- | `cm x -> Std.Float. toString x ^ {js| cm| js}
1648
- | `em x -> Std.Float. toString x ^ {js| em| js}
1649
- | `ex x -> Std.Float. toString x ^ {js| ex| js}
1650
- | `mm x -> Std.Float. toString x ^ {js| mm| js}
1651
- | `percent x -> Std.Float. toString x ^ {js|%| js}
1652
- | `pt x -> Std.Int. toString x ^ {js| pt| js}
1653
- | `px x -> Std.Int. toString x ^ {js| px| js}
1654
- | `pxFloat x -> Std.Float. toString x ^ {js| px| js}
1655
- | `rem x -> Std.Float. toString x ^ {js| rem| js}
1656
- | `vh x -> Std.Float. toString x ^ {js| vh| js}
1657
- | `vmax x -> Std.Float. toString x ^ {js| vmax| js}
1658
- | `vmin x -> Std.Float. toString x ^ {js| vmin| js}
1659
- | `vw x -> Std.Float. toString x ^ {js| vw| js}
1664
+ | #Length .t as l -> Length .toString l
1660
1665
| `fr x -> Std.Float .toString x ^ {js| fr| js}
1661
- | `inch x -> Std.Float. toString x ^ {js| in | js}
1662
- | `pc x -> Std.Float. toString x ^ {js| pc| js}
1663
- | `zero -> {js| 0 | js}
1664
1666
| `minContent -> {js| min- content| js}
1665
1667
| `maxContent -> {js| max- content| js}
1666
1668
1667
1669
let string_of_dimension x =
1668
1670
match x with
1669
1671
| `auto -> {js| auto| js}
1670
1672
| `none -> {js| none| js}
1671
- | `calc c -> string_of_calc c Length. toString
1672
- | `ch x -> Std.Float. toString x ^ {js| ch| js}
1673
- | `cm x -> Std.Float. toString x ^ {js| cm| js}
1674
- | `em x -> Std.Float. toString x ^ {js| em| js}
1675
- | `ex x -> Std.Float. toString x ^ {js| ex| js}
1676
- | `mm x -> Std.Float. toString x ^ {js| mm| js}
1677
- | `percent x -> Std.Float. toString x ^ {js|%| js}
1678
- | `pt x -> Std.Int. toString x ^ {js| pt| js}
1679
- | `px x -> Std.Int. toString x ^ {js| px| js}
1680
- | `pxFloat x -> Std.Float. toString x ^ {js| px| js}
1681
- | `rem x -> Std.Float. toString x ^ {js| rem| js}
1682
- | `vh x -> Std.Float. toString x ^ {js| vh| js}
1683
- | `vmax x -> Std.Float. toString x ^ {js| vmax| js}
1684
- | `vmin x -> Std.Float. toString x ^ {js| vmin| js}
1685
- | `vw x -> Std.Float. toString x ^ {js| vw| js}
1673
+ | #Length .t as l -> Length .toString l
1686
1674
| `fr x -> Std.Float .toString x ^ {js| fr| js}
1687
- | `inch x -> Std.Float. toString x ^ {js| in | js}
1688
- | `pc x -> Std.Float. toString x ^ {js| pc| js}
1689
- | `zero -> {js| 0 | js}
1690
1675
| `fitContent -> {js| fit- content| js}
1691
1676
| `minContent -> {js| min- content| js}
1692
1677
| `maxContent -> {js| max- content| js}
@@ -1724,25 +1709,8 @@ let rec gridLengthToJs x =
1724
1709
| `name name -> name
1725
1710
| `none -> {js| none| js}
1726
1711
| `auto -> {js| auto| js}
1727
- | `calc c -> string_of_calc c Length. toString
1728
- | `ch x -> Std.Float. toString x ^ {js| ch| js}
1729
- | `cm x -> Std.Float. toString x ^ {js| cm| js}
1730
- | `em x -> Std.Float. toString x ^ {js| em| js}
1731
- | `ex x -> Std.Float. toString x ^ {js| ex| js}
1732
- | `mm x -> Std.Float. toString x ^ {js| mm| js}
1733
- | `percent x -> Std.Float. toString x ^ {js|%| js}
1734
- | `pt x -> Std.Int. toString x ^ {js| pt| js}
1735
- | `px x -> Std.Int. toString x ^ {js| px| js}
1736
- | `pxFloat x -> Std.Float. toString x ^ {js| px| js}
1737
- | `rem x -> Std.Float. toString x ^ {js| rem| js}
1738
- | `vh x -> Std.Float. toString x ^ {js| vh| js}
1739
- | `inch x -> Std.Float. toString x ^ {js| in | js}
1740
- | `pc x -> Std.Float. toString x ^ {js| pc| js}
1741
- | `vmax x -> Std.Float. toString x ^ {js| vmax| js}
1742
- | `vmin x -> Std.Float. toString x ^ {js| vmin| js}
1743
- | `vw x -> Std.Float. toString x ^ {js| vw| js}
1712
+ | #Length. t as l -> Length. toString l
1744
1713
| `fr x -> Std.Float. toString x ^ {js| fr| js}
1745
- | `zero -> {js| 0 | js}
1746
1714
| `minContent -> {js| min- content| js}
1747
1715
| `maxContent -> {js| max- content| js}
1748
1716
| `fitContent x ->
@@ -1820,26 +1788,31 @@ let gridTemplateAreas l =
1820
1788
1821
1789
type filter =
1822
1790
[ `blur of Length .t
1823
- | `brightness of float
1824
- | `contrast of float
1791
+ | `brightness of [ `percent of float | `num of float ]
1792
+ | `contrast of [ `percent of float | `num of float ]
1825
1793
| `dropShadow of Length .t * Length .t * Length .t * [ Color .t | Var .t ]
1826
- | `grayscale of float
1794
+ | `grayscale of [ `percent of float | `num of float ]
1827
1795
| `hueRotate of angle
1828
- | `invert of float
1829
- | `opacity of float
1830
- | `saturate of float
1831
- | `sepia of float
1796
+ | `invert of [ `percent of float | `num of float ]
1797
+ | `opacity of [ `percent of float | `num of float ]
1798
+ | `saturate of [ `percent of float | `num of float ]
1799
+ | `sepia of [ `percent of float | `num of float ]
1832
1800
| `url of string
1833
1801
| `none
1834
1802
| Var .t
1835
1803
| Cascading .t
1836
1804
]
1837
1805
1806
+ let string_of_amount x =
1807
+ match x with
1808
+ | `percent v -> Std.Float. toString v ^ {js|%| js}
1809
+ | `num v -> Std.Float. toString v
1810
+
1838
1811
let string_of_filter x =
1839
1812
match x with
1840
- | `blur v -> ( {js| blur(| js} ^ Length. toString v) ^ {js| )| js}
1841
- | `brightness v -> ( {js| brightness(| js} ^ Std.Float. toString v) ^ {js|% )| js}
1842
- | `contrast v -> ( {js| contrast(| js} ^ Std.Float. toString v) ^ {js|% )| js}
1813
+ | `blur v -> {js| blur(| js} ^ Length. toString v ^ {js| )| js}
1814
+ | `brightness v -> {js| brightness(| js} ^ string_of_amount v ^ {js|% )| js}
1815
+ | `contrast v -> {js| contrast(| js} ^ string_of_amount v ^ {js|% )| js}
1843
1816
| `dropShadow (a , b , c , d ) ->
1844
1817
{js| drop- shadow(| js}
1845
1818
^ Length. toString a
@@ -1848,16 +1821,16 @@ let string_of_filter x =
1848
1821
^ {js| | js}
1849
1822
^ Length. toString c
1850
1823
^ {js| | js}
1851
- ^ (match d with
1824
+ ^ (match (d : [ Color.t | Var.t ] ) with
1852
1825
| #Color. t as c -> Color. toString c
1853
1826
| #Var. t as v -> Var. toString v)
1854
1827
^ {js| )| js}
1855
- | `grayscale v -> ( {js| grayscale(| js} ^ Std.Float. toString v) ^ {js|% )| js}
1856
- | `hueRotate v -> ( {js| hue- rotate(| js} ^ Angle. toString v) ^ {js| )| js}
1857
- | `invert v -> ( {js| invert(| js} ^ Std.Float. toString v) ^ {js|% )| js}
1858
- | `opacity v -> ( {js| opacity(| js} ^ Std.Float. toString v) ^ {js|% )| js}
1859
- | `saturate v -> ( {js| saturate(| js} ^ Std.Float. toString v) ^ {js|% )| js}
1860
- | `sepia v -> ( {js| sepia(| js} ^ Std.Float. toString v) ^ {js|% )| js}
1828
+ | `grayscale v -> {js| grayscale(| js} ^ string_of_amount v ^ {js|% )| js}
1829
+ | `hueRotate v -> {js| hue- rotate(| js} ^ Angle. toString v ^ {js| )| js}
1830
+ | `invert v -> {js| invert(| js} ^ string_of_amount v ^ {js|% )| js}
1831
+ | `opacity v -> {js| opacity(| js} ^ string_of_amount v ^ {js|% )| js}
1832
+ | `saturate v -> {js| saturate(| js} ^ string_of_amount v ^ {js|% )| js}
1833
+ | `sepia v -> {js| sepia(| js} ^ string_of_amount v ^ {js|% )| js}
1861
1834
| `none -> {js| none| js}
1862
1835
| #Url. t as u -> Url. toString u
1863
1836
| #Var. t as va -> Var. toString va
@@ -2092,8 +2065,8 @@ let transformStyle x =
2092
2065
module Transition = struct
2093
2066
type t = [ `value of string ]
2094
2067
2095
- let shorthand ?(duration = 0 ) ?(delay = 0 ) ?(timingFunction = `ease ) property
2096
- =
2068
+ let shorthand ?(duration = `ms 0 ) ?(delay = `ms 0 ) ?(timingFunction = `ease )
2069
+ property =
2097
2070
`value
2098
2071
(string_of_time duration
2099
2072
^ {js| | js}
@@ -2133,7 +2106,7 @@ let transitionProperty x = D ({js|transitionProperty|js}, x)
2133
2106
module Animation = struct
2134
2107
type t = [ `value of string ]
2135
2108
2136
- let shorthand ?(duration = 0 ) ?(delay = 0 ) ?(direction = `normal )
2109
+ let shorthand ?(duration = `ms 0 ) ?(delay = `ms 0 ) ?(direction = `normal )
2137
2110
?(timingFunction = `ease ) ?(fillMode = `none ) ?(playState = `running )
2138
2111
?(iterationCount = `count 1. ) name =
2139
2112
`value
0 commit comments