├── .gitignore ├── .watchmanconfig ├── README.md ├── __tests__ └── nice_test.re ├── bsconfig.json ├── lib ├── es6 │ ├── __tests__ │ │ └── nice_test.js │ ├── site │ │ └── demo.js │ └── src │ │ ├── nice.js │ │ └── nice_prefix.js └── js │ ├── __tests__ │ ├── __snapshots__ │ │ └── nice_test.js.snap │ └── nice_test.js │ ├── site │ └── demo.js │ └── src │ ├── nice.js │ └── nice_prefix.js ├── package.json ├── rollup.config.js ├── site ├── demo.re └── index.html ├── src ├── nice.re └── nice_prefix.re ├── tasks.json └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | .cache 2 | dist 3 | .DS_Store 4 | .merlin 5 | npm-debug.log 6 | /lib/bs/ 7 | /node_modules/ 8 | .bsb.lock 9 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/threepointone/bs-nice/951b84a64609fc9b9f909c63fef75b644da28fc8/.watchmanconfig -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | (work in progress) 2 | 3 | ## nice 4 | 5 | css-in-reason. just because. 6 | 7 | ```reason 8 | open Nice; 9 | 10 | let className = css([| 11 | Display(Flex), 12 | AlignItems(Center), 13 | Color(Red), 14 | Select(":hover", [Color(Blue)]) 15 | |]); 16 | ``` 17 | 18 | ## some nice features 19 | 20 | * pure reason 21 | * typed css 22 | * glamor-style composition 23 | * escape hatch - `Raw(key, value)` 24 | 25 | ## todo 26 | 27 | * vendor prefixing 28 | * keyframes / animations 29 | * font-faces 30 | * better types 31 | * ~ hot reloading 32 | * benchmarks / tests 33 | -------------------------------------------------------------------------------- /__tests__/nice_test.re: -------------------------------------------------------------------------------- 1 | open Jest; 2 | 3 | open Expect; 4 | 5 | let serialized_rule_cache = () => 6 | Hashtbl.fold((k, v, acc) => [(k, v), ...acc], Nice.rule_cache, []); 7 | 8 | let serialized_global_cache = () => 9 | Hashtbl.fold((k, v, acc) => [(k, v), ...acc], Nice.global_cache, []); 10 | 11 | open! Nice; 12 | 13 | describe("Nice", () => { 14 | afterEach(flush); 15 | test("css", () => 16 | expect((css([|Display(Flex), Width(Px(23))|]), serialized_rule_cache())) 17 | |> toMatchSnapshot 18 | ); 19 | test("nesting", () => 20 | expect(( 21 | css([| 22 | Display(Flex), 23 | Color(Red), 24 | MediaQuery( 25 | "screen", 26 | [| 27 | Display(Block), 28 | Color(Green), 29 | Select( 30 | ":hover", 31 | [| 32 | Color(Orange), 33 | FontWeight(Bold), 34 | Overflow(Hidden), 35 | Supports("(display: flex)", [|Color(Blue)|]), 36 | Select( 37 | ":active", 38 | [| 39 | Color(Red), 40 | Display(Block), 41 | Select(".ie6 &", [|Color(Blue)|]) 42 | |] 43 | ) 44 | |] 45 | ) 46 | |] 47 | ) 48 | |]), 49 | serialized_rule_cache() 50 | )) 51 | |> toMatchSnapshot 52 | ); 53 | test("global", () => { 54 | global("html, body", [|Padding(Px(20))|]); 55 | expect(serialized_global_cache()) |> toMatchSnapshot; 56 | }); 57 | }); 58 | -------------------------------------------------------------------------------- /bsconfig.json: -------------------------------------------------------------------------------- 1 | // http://bucklescript.github.io/bucklescript/docson/#build-schema.json 2 | { 3 | "name": "bs-nice", 4 | "version": "0.1.0", 5 | "sources": [ 6 | { "dir": "src" }, 7 | { 8 | "dir": "site", 9 | "type": "dev" 10 | }, 11 | { 12 | "dir": "__tests__", 13 | "type": "dev" 14 | } 15 | ], 16 | "bs-dependencies": [], 17 | "bs-dev-dependencies": ["bs-jest"], 18 | "namespace": false, 19 | "package-specs": ["commonjs", "es6"], 20 | "refmt": 3 21 | } 22 | -------------------------------------------------------------------------------- /lib/es6/__tests__/nice_test.js: -------------------------------------------------------------------------------- 1 | // Generated by BUCKLESCRIPT VERSION 2.1.0, PLEASE EDIT WITH CARE 2 | 'use strict'; 3 | 4 | import * as Jest from "bs-jest/lib/es6/src/jest.js"; 5 | import * as Nice from "../src/nice.js"; 6 | import * as Block from "bs-platform/lib/es6/block.js"; 7 | import * as Hashtbl from "bs-platform/lib/es6/hashtbl.js"; 8 | 9 | function serialized_rule_cache() { 10 | return Hashtbl.fold((function (k, v, acc) { 11 | return /* :: */[ 12 | /* tuple */[ 13 | k, 14 | v 15 | ], 16 | acc 17 | ]; 18 | }), Nice.rule_cache, /* [] */0); 19 | } 20 | 21 | function serialized_global_cache() { 22 | return Hashtbl.fold((function (k, v, acc) { 23 | return /* :: */[ 24 | /* tuple */[ 25 | k, 26 | v 27 | ], 28 | acc 29 | ]; 30 | }), Nice.global_cache, /* [] */0); 31 | } 32 | 33 | describe("Nice", (function () { 34 | afterEach(Nice.flush); 35 | Jest.test("css", (function () { 36 | return Jest.Expect[/* toMatchSnapshot */16](Jest.Expect[/* expect */0](/* tuple */[ 37 | Nice.css(/* array */[ 38 | /* Display */Block.__(0, [/* Flex */5]), 39 | /* Width */Block.__(1, [/* Px */Block.__(0, [23])]) 40 | ]), 41 | serialized_rule_cache(/* () */0) 42 | ])); 43 | })); 44 | Jest.test("nesting", (function () { 45 | return Jest.Expect[/* toMatchSnapshot */16](Jest.Expect[/* expect */0](/* tuple */[ 46 | Nice.css(/* array */[ 47 | /* Display */Block.__(0, [/* Flex */5]), 48 | /* Color */Block.__(63, [/* Red */119]), 49 | /* MediaQuery */Block.__(82, [ 50 | "screen", 51 | /* array */[ 52 | /* Display */Block.__(0, [/* Block */1]), 53 | /* Color */Block.__(63, [/* Green */54]), 54 | /* Select */Block.__(84, [ 55 | ":hover", 56 | /* array */[ 57 | /* Color */Block.__(63, [/* Orange */104]), 58 | /* FontWeight */Block.__(67, [/* Bold */1]), 59 | /* Overflow */Block.__(37, [/* Hidden */1]), 60 | /* Supports */Block.__(83, [ 61 | "(display: flex)", 62 | /* array */[/* Color */Block.__(63, [/* Blue */10])] 63 | ]), 64 | /* Select */Block.__(84, [ 65 | ":active", 66 | /* array */[ 67 | /* Color */Block.__(63, [/* Red */119]), 68 | /* Display */Block.__(0, [/* Block */1]), 69 | /* Select */Block.__(84, [ 70 | ".ie6 &", 71 | /* array */[/* Color */Block.__(63, [/* Blue */10])] 72 | ]) 73 | ] 74 | ]) 75 | ] 76 | ]) 77 | ] 78 | ]) 79 | ]), 80 | serialized_rule_cache(/* () */0) 81 | ])); 82 | })); 83 | return Jest.test("global", (function () { 84 | Nice.$$global("html, body", /* array */[/* Padding */Block.__(18, [/* Px */Block.__(0, [20])])]); 85 | return Jest.Expect[/* toMatchSnapshot */16](Jest.Expect[/* expect */0](serialized_global_cache(/* () */0))); 86 | })); 87 | })); 88 | 89 | export { 90 | serialized_rule_cache , 91 | serialized_global_cache , 92 | 93 | } 94 | /* Not a pure module */ 95 | -------------------------------------------------------------------------------- /lib/es6/site/demo.js: -------------------------------------------------------------------------------- 1 | // Generated by BUCKLESCRIPT VERSION 2.1.0, PLEASE EDIT WITH CARE 2 | 'use strict'; 3 | 4 | import * as Nice from "../src/nice.js"; 5 | import * as Block from "bs-platform/lib/es6/block.js"; 6 | 7 | var className = Nice.css(/* array */[ 8 | /* Display */Block.__(0, [/* Flex */5]), 9 | /* Color */Block.__(63, [/* Red */119]), 10 | /* MediaQuery */Block.__(82, [ 11 | "screen", 12 | /* array */[ 13 | /* Display */Block.__(0, [/* Block */1]), 14 | /* Color */Block.__(63, [/* Green */54]), 15 | /* Select */Block.__(84, [ 16 | ":hover", 17 | /* array */[ 18 | /* Color */Block.__(63, [/* Orange */104]), 19 | /* FontWeight */Block.__(67, [/* Bold */1]), 20 | /* Overflow */Block.__(37, [/* Hidden */1]), 21 | /* Supports */Block.__(83, [ 22 | "(display: flex)", 23 | /* array */[/* Color */Block.__(63, [/* Blue */10])] 24 | ]), 25 | /* Select */Block.__(84, [ 26 | ":hover", 27 | /* array */[ 28 | /* Color */Block.__(63, [/* Red */119]), 29 | /* Display */Block.__(0, [/* Block */1]), 30 | /* Select */Block.__(84, [ 31 | ".ie6 &", 32 | /* array */[/* Color */Block.__(63, [/* Blue */10])] 33 | ]) 34 | ] 35 | ]) 36 | ] 37 | ]) 38 | ] 39 | ]) 40 | ]); 41 | 42 | var cls2 = Nice.css(/* array */[/* Width */Block.__(1, [/* Em */Block.__(1, [4.4])])]); 43 | 44 | Nice.$$global("html, body", /* array */[ 45 | /* Display */Block.__(0, [/* Block */1]), 46 | /* Color */Block.__(63, [/* Green */54]) 47 | ]); 48 | 49 | export { 50 | className , 51 | cls2 , 52 | 53 | } 54 | /* className Not a pure module */ 55 | -------------------------------------------------------------------------------- /lib/es6/src/nice.js: -------------------------------------------------------------------------------- 1 | // Generated by BUCKLESCRIPT VERSION 2.1.0, PLEASE EDIT WITH CARE 2 | 'use strict'; 3 | 4 | import * as Char from "bs-platform/lib/es6/char.js"; 5 | import * as List from "bs-platform/lib/es6/list.js"; 6 | import * as $$Array from "bs-platform/lib/es6/array.js"; 7 | import * as Curry from "bs-platform/lib/es6/curry.js"; 8 | import * as $$String from "bs-platform/lib/es6/string.js"; 9 | import * as Hashtbl from "bs-platform/lib/es6/hashtbl.js"; 10 | import * as Caml_array from "bs-platform/lib/es6/caml_array.js"; 11 | import * as Caml_int32 from "bs-platform/lib/es6/caml_int32.js"; 12 | import * as Pervasives from "bs-platform/lib/es6/pervasives.js"; 13 | import * as Caml_string from "bs-platform/lib/es6/caml_string.js"; 14 | import * as Caml_builtin_exceptions from "bs-platform/lib/es6/caml_builtin_exceptions.js"; 15 | 16 | var match = +(( typeof window !== 'undefined' ) === true); 17 | 18 | var isBrowser = match !== 0 ? /* true */1 : /* false */0; 19 | 20 | var match$1 = +(( process.env.NODE_ENV === 'test' ) === true); 21 | 22 | var isTest = match$1 !== 0 ? /* true */1 : /* false */0; 23 | 24 | function string_of_position(param) { 25 | switch (param) { 26 | case 0 : 27 | return "absolute"; 28 | case 1 : 29 | return "relative"; 30 | case 2 : 31 | return "sticky"; 32 | case 3 : 33 | return "fixed"; 34 | 35 | } 36 | } 37 | 38 | function string_of_flexDirection(param) { 39 | switch (param) { 40 | case 0 : 41 | return "row"; 42 | case 1 : 43 | return "row-reverse"; 44 | case 2 : 45 | return "column"; 46 | case 3 : 47 | return "column-reverse"; 48 | 49 | } 50 | } 51 | 52 | function string_of_flexWrap(param) { 53 | if (param !== 0) { 54 | return "nowrap"; 55 | } else { 56 | return "wrap"; 57 | } 58 | } 59 | 60 | function string_of_justifyContent(param) { 61 | switch (param) { 62 | case 0 : 63 | return "flex-start"; 64 | case 1 : 65 | return "flex-end"; 66 | case 2 : 67 | return "center"; 68 | case 3 : 69 | return "space-between"; 70 | case 4 : 71 | return "space-around"; 72 | 73 | } 74 | } 75 | 76 | function string_of_alignItems(param) { 77 | switch (param) { 78 | case 0 : 79 | return "flex-start"; 80 | case 1 : 81 | return "flex-end"; 82 | case 2 : 83 | return "center"; 84 | case 3 : 85 | return "stretch"; 86 | case 4 : 87 | return "baseline"; 88 | 89 | } 90 | } 91 | 92 | function string_of_alignSelf(param) { 93 | switch (param) { 94 | case 0 : 95 | return "auto"; 96 | case 1 : 97 | return "flex-start"; 98 | case 2 : 99 | return "flex-end"; 100 | case 3 : 101 | return "center"; 102 | case 4 : 103 | return "stretch"; 104 | case 5 : 105 | return "baseline"; 106 | 107 | } 108 | } 109 | 110 | function string_of_alignContent(param) { 111 | switch (param) { 112 | case 0 : 113 | return "start"; 114 | case 1 : 115 | return "end"; 116 | case 2 : 117 | return "flex-start"; 118 | case 3 : 119 | return "flex-end"; 120 | case 4 : 121 | return "left"; 122 | case 5 : 123 | return "right"; 124 | case 6 : 125 | return "center"; 126 | case 7 : 127 | return "stretch"; 128 | case 8 : 129 | return "space-between"; 130 | case 9 : 131 | return "space-around"; 132 | case 10 : 133 | return "baseline"; 134 | case 11 : 135 | return "first baseline"; 136 | case 12 : 137 | return "last baseline"; 138 | case 13 : 139 | return "space-evenly"; 140 | case 14 : 141 | return "safe-center"; 142 | case 15 : 143 | return "unsafe-center"; 144 | 145 | } 146 | } 147 | 148 | function string_of_overflow(param) { 149 | switch (param) { 150 | case 0 : 151 | return "visible"; 152 | case 1 : 153 | return "hidden"; 154 | case 2 : 155 | return "scroll"; 156 | 157 | } 158 | } 159 | 160 | function string_of_display(param) { 161 | switch (param) { 162 | case 0 : 163 | return "none"; 164 | case 1 : 165 | return "block"; 166 | case 2 : 167 | return "inline"; 168 | case 3 : 169 | case 4 : 170 | return "inline-block"; 171 | case 5 : 172 | return "flex"; 173 | 174 | } 175 | } 176 | 177 | function string_of_dimension(param) { 178 | switch (param.tag | 0) { 179 | case 0 : 180 | return "" + (String(param[0]) + "px"); 181 | case 1 : 182 | return "" + (String(param[0]) + "em"); 183 | case 2 : 184 | return "" + (String(param[0]) + "%"); 185 | case 3 : 186 | return "calc(" + (param[0] + ")"); 187 | 188 | } 189 | } 190 | 191 | function string_of_flexBasis(param) { 192 | switch (param) { 193 | case 0 : 194 | return "auto"; 195 | case 1 : 196 | return "max-content"; 197 | case 2 : 198 | return "min-content"; 199 | case 3 : 200 | return "fit-content"; 201 | case 4 : 202 | return "content"; 203 | 204 | } 205 | } 206 | 207 | function string_of_angle(param) { 208 | if (param.tag) { 209 | return "" + (String(param[0]) + "rad"); 210 | } else { 211 | return "" + (String(param[0]) + "deg"); 212 | } 213 | } 214 | 215 | function string_of_transform(param) { 216 | switch (param.tag | 0) { 217 | case 0 : 218 | return "perspective(" + (String(param[0]) + ")"); 219 | case 1 : 220 | return "rotate(" + (string_of_angle(param[0]) + ")"); 221 | case 2 : 222 | return "rotateX(" + (string_of_angle(param[0]) + ")"); 223 | case 3 : 224 | return "rotateY(" + (string_of_angle(param[0]) + ")"); 225 | case 4 : 226 | return "rotateZ(" + (string_of_angle(param[0]) + ")"); 227 | case 5 : 228 | return "scale(" + ("" + (String(param[0]) + "") + ")"); 229 | case 6 : 230 | return "scaleX(" + ("" + (String(param[0]) + "") + ")"); 231 | case 7 : 232 | return "scaleY(" + ("" + (String(param[0]) + "") + ")"); 233 | case 8 : 234 | return "scaleZ(" + ("" + (String(param[0]) + "") + ")"); 235 | case 9 : 236 | return "translate(" + ("" + (String(param[0]) + "") + (", " + ("" + (String(param[1]) + "") + ")"))); 237 | case 10 : 238 | return "translateX(" + ("" + (String(param[0]) + "") + ")"); 239 | case 11 : 240 | return "translateY(" + ("" + (String(param[0]) + "") + ")"); 241 | case 12 : 242 | return "translateZ(" + ("" + (String(param[0]) + "") + ")"); 243 | case 13 : 244 | return "skewX(" + (string_of_angle(param[0]) + ")"); 245 | case 14 : 246 | return "skewY(" + (string_of_angle(param[0]) + ")"); 247 | 248 | } 249 | } 250 | 251 | function string_of_color(param) { 252 | if (typeof param === "number") { 253 | switch (param) { 254 | case 0 : 255 | return "transparent"; 256 | case 1 : 257 | return "aliceblue"; 258 | case 2 : 259 | return "antiquewhite"; 260 | case 3 : 261 | return "aqua"; 262 | case 4 : 263 | return "aquamarine"; 264 | case 5 : 265 | return "azure"; 266 | case 6 : 267 | return "beige"; 268 | case 7 : 269 | return "bisque"; 270 | case 8 : 271 | return "black"; 272 | case 9 : 273 | return "blanchedalmond"; 274 | case 10 : 275 | return "blue"; 276 | case 11 : 277 | return "blueviolet"; 278 | case 12 : 279 | return "brown"; 280 | case 13 : 281 | return "burlywood"; 282 | case 14 : 283 | return "cadetblue"; 284 | case 15 : 285 | return "chartreuse"; 286 | case 16 : 287 | return "chocolate"; 288 | case 17 : 289 | return "coral"; 290 | case 18 : 291 | return "cornflowerblue"; 292 | case 19 : 293 | return "cornsilk"; 294 | case 20 : 295 | return "crimson"; 296 | case 21 : 297 | return "cyan"; 298 | case 22 : 299 | return "darkblue"; 300 | case 23 : 301 | return "darkcyan"; 302 | case 24 : 303 | return "darkgoldenrod"; 304 | case 25 : 305 | return "darkgray"; 306 | case 26 : 307 | return "darkgreen"; 308 | case 27 : 309 | return "darkgrey"; 310 | case 28 : 311 | return "darkkhaki"; 312 | case 29 : 313 | return "darkmagenta"; 314 | case 30 : 315 | return "darkolivegreen"; 316 | case 31 : 317 | return "darkorange"; 318 | case 32 : 319 | return "darkorchid"; 320 | case 33 : 321 | return "darkred"; 322 | case 34 : 323 | return "darksalmon"; 324 | case 35 : 325 | return "darkseagreen"; 326 | case 36 : 327 | return "darkslateblue"; 328 | case 37 : 329 | return "darkslategrey"; 330 | case 38 : 331 | return "darkturquoise"; 332 | case 39 : 333 | return "darkviolet"; 334 | case 40 : 335 | return "deeppink"; 336 | case 41 : 337 | return "deepskyblue"; 338 | case 42 : 339 | return "dimgray"; 340 | case 43 : 341 | return "dimgrey"; 342 | case 44 : 343 | return "dodgerblue"; 344 | case 45 : 345 | return "firebrick"; 346 | case 46 : 347 | return "floralwhite"; 348 | case 47 : 349 | return "forestgreen"; 350 | case 48 : 351 | return "fuchsia"; 352 | case 49 : 353 | return "gainsboro"; 354 | case 50 : 355 | return "ghostwhite"; 356 | case 51 : 357 | return "gold"; 358 | case 52 : 359 | return "goldenrod"; 360 | case 53 : 361 | return "gray"; 362 | case 54 : 363 | return "green"; 364 | case 55 : 365 | return "greenyellow"; 366 | case 56 : 367 | return "grey"; 368 | case 57 : 369 | return "honeydew"; 370 | case 58 : 371 | return "hotpink"; 372 | case 59 : 373 | return "indianred"; 374 | case 60 : 375 | return "indigo"; 376 | case 61 : 377 | return "ivory"; 378 | case 62 : 379 | return "khaki"; 380 | case 63 : 381 | return "lavender"; 382 | case 64 : 383 | return "lavenderblush"; 384 | case 65 : 385 | return "lawngreen"; 386 | case 66 : 387 | return "lemonchiffon"; 388 | case 67 : 389 | return "lightblue"; 390 | case 68 : 391 | return "lightcoral"; 392 | case 69 : 393 | return "lightcyan"; 394 | case 70 : 395 | return "lightgoldenrodyellow"; 396 | case 71 : 397 | return "lightgray"; 398 | case 72 : 399 | return "lightgreen"; 400 | case 73 : 401 | return "lightgrey"; 402 | case 74 : 403 | return "lightpink"; 404 | case 75 : 405 | return "lightsalmon"; 406 | case 76 : 407 | return "lightseagreen"; 408 | case 77 : 409 | return "lightskyblue"; 410 | case 78 : 411 | return "lightslategrey"; 412 | case 79 : 413 | return "lightsteelblue"; 414 | case 80 : 415 | return "lightyellow"; 416 | case 81 : 417 | return "lime"; 418 | case 82 : 419 | return "limegreen"; 420 | case 83 : 421 | return "linen"; 422 | case 84 : 423 | return "magenta"; 424 | case 85 : 425 | return "maroon"; 426 | case 86 : 427 | return "mediumaquamarine"; 428 | case 87 : 429 | return "mediumblue"; 430 | case 88 : 431 | return "mediumorchid"; 432 | case 89 : 433 | return "mediumpurple"; 434 | case 90 : 435 | return "mediumseagreen"; 436 | case 91 : 437 | return "mediumslateblue"; 438 | case 92 : 439 | return "mediumspringgreen"; 440 | case 93 : 441 | return "mediumturquoise"; 442 | case 94 : 443 | return "mediumvioletred"; 444 | case 95 : 445 | return "midnightblue"; 446 | case 96 : 447 | return "mintcream"; 448 | case 97 : 449 | return "mistyrose"; 450 | case 98 : 451 | return "moccasin"; 452 | case 99 : 453 | return "navajowhite"; 454 | case 100 : 455 | return "navy"; 456 | case 101 : 457 | return "oldlace"; 458 | case 102 : 459 | return "olive"; 460 | case 103 : 461 | return "olivedrab"; 462 | case 104 : 463 | return "orange"; 464 | case 105 : 465 | return "orangered"; 466 | case 106 : 467 | return "orchid"; 468 | case 107 : 469 | return "palegoldenrod"; 470 | case 108 : 471 | return "palegreen"; 472 | case 109 : 473 | return "paleturquoise"; 474 | case 110 : 475 | return "palevioletred"; 476 | case 111 : 477 | return "papayawhip"; 478 | case 112 : 479 | return "peachpuff"; 480 | case 113 : 481 | return "peru"; 482 | case 114 : 483 | return "pink"; 484 | case 115 : 485 | return "plum"; 486 | case 116 : 487 | return "powderblue"; 488 | case 117 : 489 | return "purple"; 490 | case 118 : 491 | return "rebeccapurple"; 492 | case 119 : 493 | return "red"; 494 | case 120 : 495 | return "rosybrown"; 496 | case 121 : 497 | return "royalblue"; 498 | case 122 : 499 | return "saddlebrown"; 500 | case 123 : 501 | return "salmon"; 502 | case 124 : 503 | return "sandybrown"; 504 | case 125 : 505 | return "seagreen"; 506 | case 126 : 507 | return "seashell"; 508 | case 127 : 509 | return "sienna"; 510 | case 128 : 511 | return "silver"; 512 | case 129 : 513 | return "skyblue"; 514 | case 130 : 515 | return "slateblue"; 516 | case 131 : 517 | return "slategray"; 518 | case 132 : 519 | return "snow"; 520 | case 133 : 521 | return "springgreen"; 522 | case 134 : 523 | return "steelblue"; 524 | case 135 : 525 | return "tan"; 526 | case 136 : 527 | return "teal"; 528 | case 137 : 529 | return "thistle"; 530 | case 138 : 531 | return "tomato"; 532 | case 139 : 533 | return "turquoise"; 534 | case 140 : 535 | return "violet"; 536 | case 141 : 537 | return "wheat"; 538 | case 142 : 539 | return "white"; 540 | case 143 : 541 | return "whitesmoke"; 542 | case 144 : 543 | return "yellow"; 544 | case 145 : 545 | return "yellowgreen"; 546 | 547 | } 548 | } else { 549 | switch (param.tag | 0) { 550 | case 0 : 551 | return "rgba(" + (String(param[0]) + ("," + (String(param[1]) + ("," + (String(param[2]) + ""))))); 552 | case 1 : 553 | return "rgba(" + (String(param[0]) + ("," + (String(param[1]) + ("," + (String(param[2]) + ("," + (String(param[3]) + ")"))))))); 554 | case 2 : 555 | return "hsl(" + (String(param[0]) + ("," + (String(param[1]) + ("," + (String(param[2]) + ""))))); 556 | case 3 : 557 | return "hsla(" + (String(param[0]) + ("," + (String(param[1]) + ("," + (String(param[2]) + ("," + (String(param[3]) + ""))))))); 558 | 559 | } 560 | } 561 | } 562 | 563 | function string_of_fontWeight(param) { 564 | switch (param) { 565 | case 0 : 566 | return "normal"; 567 | case 1 : 568 | return "bold"; 569 | case 2 : 570 | return "100"; 571 | case 3 : 572 | return "200"; 573 | case 4 : 574 | return "300"; 575 | case 5 : 576 | return "400"; 577 | case 6 : 578 | return "500"; 579 | case 7 : 580 | return "600"; 581 | case 8 : 582 | return "700"; 583 | case 9 : 584 | return "800"; 585 | case 10 : 586 | return "900"; 587 | 588 | } 589 | } 590 | 591 | function string_of_backfaceVisibilty(param) { 592 | if (param !== 0) { 593 | return "hidden"; 594 | } else { 595 | return "visible"; 596 | } 597 | } 598 | 599 | function string_of_borderStyle(param) { 600 | switch (param) { 601 | case 0 : 602 | return "solid"; 603 | case 1 : 604 | return "dotted"; 605 | case 2 : 606 | return "dashed"; 607 | 608 | } 609 | } 610 | 611 | function string_of_fontStyle(param) { 612 | if (param !== 0) { 613 | return "italic"; 614 | } else { 615 | return "normal"; 616 | } 617 | } 618 | 619 | function string_of_fontVariant(param) { 620 | switch (param) { 621 | case 0 : 622 | return "small-caps"; 623 | case 1 : 624 | return "old-style-nums"; 625 | case 2 : 626 | return "lining-nums"; 627 | case 3 : 628 | return "tabular-nums"; 629 | case 4 : 630 | return "proportional-nums"; 631 | 632 | } 633 | } 634 | 635 | function string_of_textAlign(param) { 636 | switch (param) { 637 | case 0 : 638 | return "auto"; 639 | case 1 : 640 | return "left"; 641 | case 2 : 642 | return "right"; 643 | case 3 : 644 | return "center"; 645 | case 4 : 646 | return "justify"; 647 | 648 | } 649 | } 650 | 651 | function string_of_textAlignVertical(param) { 652 | switch (param) { 653 | case 0 : 654 | return "auto"; 655 | case 1 : 656 | return "top"; 657 | case 2 : 658 | return "bottom"; 659 | case 3 : 660 | return "center"; 661 | 662 | } 663 | } 664 | 665 | function string_of_textDecorationLine(param) { 666 | switch (param) { 667 | case 0 : 668 | return "none"; 669 | case 1 : 670 | return "underline"; 671 | case 2 : 672 | return "line-through"; 673 | case 3 : 674 | return "underline line-through"; 675 | 676 | } 677 | } 678 | 679 | function string_of_textDecorationStyle(param) { 680 | switch (param) { 681 | case 0 : 682 | return "solid"; 683 | case 1 : 684 | return "double"; 685 | case 2 : 686 | return "dotted"; 687 | case 3 : 688 | return "dashed"; 689 | 690 | } 691 | } 692 | 693 | function string_of_writingDirection(param) { 694 | switch (param) { 695 | case 0 : 696 | return "auto"; 697 | case 1 : 698 | return "ltr"; 699 | case 2 : 700 | return "rtl"; 701 | 702 | } 703 | } 704 | 705 | function string_of_resizeMode(param) { 706 | switch (param) { 707 | case 0 : 708 | return "contain"; 709 | case 1 : 710 | return "cover"; 711 | case 2 : 712 | return "stretch"; 713 | case 3 : 714 | return "center"; 715 | case 4 : 716 | return "repeat"; 717 | 718 | } 719 | } 720 | 721 | function string_of_style(param) { 722 | switch (param.tag | 0) { 723 | case 0 : 724 | return "display:" + string_of_display(param[0]); 725 | case 1 : 726 | return "width:" + string_of_dimension(param[0]); 727 | case 2 : 728 | return "height:" + string_of_dimension(param[0]); 729 | case 3 : 730 | return "top:" + string_of_dimension(param[0]); 731 | case 4 : 732 | return "bottom:" + string_of_dimension(param[0]); 733 | case 5 : 734 | return "left:" + string_of_dimension(param[0]); 735 | case 6 : 736 | return "right:" + string_of_dimension(param[0]); 737 | case 7 : 738 | return "min-width:" + string_of_dimension(param[0]); 739 | case 8 : 740 | return "max-width:" + string_of_dimension(param[0]); 741 | case 9 : 742 | return "minheight:" + string_of_dimension(param[0]); 743 | case 10 : 744 | return "maxheight:" + string_of_dimension(param[0]); 745 | case 11 : 746 | return "margin:" + string_of_dimension(param[0]); 747 | case 12 : 748 | return "margin-vertical:" + string_of_dimension(param[0]); 749 | case 13 : 750 | return "margin-horizontal:" + string_of_dimension(param[0]); 751 | case 14 : 752 | return "margin-top:" + string_of_dimension(param[0]); 753 | case 15 : 754 | return "margin-bottom:" + string_of_dimension(param[0]); 755 | case 16 : 756 | return "margin-left:" + string_of_dimension(param[0]); 757 | case 17 : 758 | return "margin-right:" + string_of_dimension(param[0]); 759 | case 18 : 760 | return "padding:" + string_of_dimension(param[0]); 761 | case 19 : 762 | return "padding-vertical:" + string_of_dimension(param[0]); 763 | case 20 : 764 | return "padding-horizontal:" + string_of_dimension(param[0]); 765 | case 21 : 766 | return "padding-top:" + string_of_dimension(param[0]); 767 | case 22 : 768 | return "padding-bottom:" + string_of_dimension(param[0]); 769 | case 23 : 770 | return "padding-left:" + string_of_dimension(param[0]); 771 | case 24 : 772 | return "padding-right:" + string_of_dimension(param[0]); 773 | case 25 : 774 | return "border-width:" + string_of_dimension(param[0]); 775 | case 26 : 776 | return "border-top-width:" + string_of_dimension(param[0]); 777 | case 27 : 778 | return "border-bottom-width:" + string_of_dimension(param[0]); 779 | case 28 : 780 | return "border-left-width:" + string_of_dimension(param[0]); 781 | case 29 : 782 | return "border-right-width:" + string_of_dimension(param[0]); 783 | case 30 : 784 | return "position:" + string_of_position(param[0]); 785 | case 31 : 786 | return "flex-direction:" + string_of_flexDirection(param[0]); 787 | case 32 : 788 | return "flex-wrap:" + string_of_flexWrap(param[0]); 789 | case 33 : 790 | return "justify-content:" + string_of_justifyContent(param[0]); 791 | case 34 : 792 | return "align-items:" + string_of_alignItems(param[0]); 793 | case 35 : 794 | return "align-self:" + string_of_alignSelf(param[0]); 795 | case 36 : 796 | return "align-content:" + string_of_alignContent(param[0]); 797 | case 37 : 798 | return "overflow:" + string_of_overflow(param[0]); 799 | case 38 : 800 | return "flex:" + Pervasives.string_of_int(param[0]); 801 | case 39 : 802 | return "flex-grow:" + Pervasives.string_of_int(param[0]); 803 | case 40 : 804 | return "flex-shrink:" + Pervasives.string_of_int(param[0]); 805 | case 41 : 806 | return "flex-basis:" + Pervasives.string_of_int(param[0]); 807 | case 42 : 808 | return "flex-basis:" + string_of_flexBasis(param[0]); 809 | case 43 : 810 | return "shadow-color:" + string_of_color(param[0]); 811 | case 44 : 812 | return "shadow-offset:" + (Pervasives.string_of_int(param[0]) + ("," + Pervasives.string_of_int(param[1]))); 813 | case 45 : 814 | return "shadow-opacity:" + ("" + (String(param[0]) + "")); 815 | case 46 : 816 | return "shadow-radius:" + ("" + (String(param[0]) + "")); 817 | case 47 : 818 | return "transform:" + $$String.concat(",", List.map(string_of_transform, param[0])); 819 | case 48 : 820 | return "backface-visibilty:" + string_of_backfaceVisibilty(param[0]); 821 | case 49 : 822 | return "background-color:" + string_of_color(param[0]); 823 | case 50 : 824 | return "border-color:" + string_of_color(param[0]); 825 | case 51 : 826 | return "border-top-color:" + string_of_color(param[0]); 827 | case 52 : 828 | return "border-bottom-color:" + string_of_color(param[0]); 829 | case 53 : 830 | return "border-left-color:" + string_of_color(param[0]); 831 | case 54 : 832 | return "border-right-color:" + string_of_color(param[0]); 833 | case 55 : 834 | return "border-radius:" + string_of_dimension(param[0]); 835 | case 56 : 836 | return "border-top-right-radius:" + string_of_dimension(param[0]); 837 | case 57 : 838 | return "border-bottom-left-radius:" + string_of_dimension(param[0]); 839 | case 58 : 840 | return "border-bottom-right-radius:" + string_of_dimension(param[0]); 841 | case 59 : 842 | return "border-top-left-radius:" + string_of_dimension(param[0]); 843 | case 60 : 844 | return "border-style:" + string_of_borderStyle(param[0]); 845 | case 61 : 846 | return "opacity:" + ("" + (String(param[0]) + "")); 847 | case 62 : 848 | return "elevation:" + ("" + (String(param[0]) + "")); 849 | case 63 : 850 | return "color:" + string_of_color(param[0]); 851 | case 64 : 852 | return "font-family:" + param[0]; 853 | case 65 : 854 | return "font-size:" + ("" + (String(param[0]) + "")); 855 | case 66 : 856 | return "font-style:" + string_of_fontStyle(param[0]); 857 | case 67 : 858 | return "font-weight:" + string_of_fontWeight(param[0]); 859 | case 68 : 860 | return "font-variant:" + string_of_fontVariant(param[0]); 861 | case 69 : 862 | return "text-shadow-radius:" + ("" + (String(param[0]) + "")); 863 | case 70 : 864 | return "text-shadow-color:" + string_of_color(param[0]); 865 | case 71 : 866 | return "letter-spacing:" + ("" + (String(param[0]) + "")); 867 | case 72 : 868 | return "line-height:" + ("" + (String(param[0]) + "")); 869 | case 73 : 870 | return "text-align:" + string_of_textAlign(param[0]); 871 | case 74 : 872 | return "text-align-vertical:" + string_of_textAlignVertical(param[0]); 873 | case 75 : 874 | return "includefontpadding:" + Pervasives.string_of_bool(param[0]); 875 | case 76 : 876 | return "text-decoration-line:" + string_of_textDecorationLine(param[0]); 877 | case 77 : 878 | return "text-decoration-color:" + string_of_color(param[0]); 879 | case 78 : 880 | return "writing-direction:" + string_of_writingDirection(param[0]); 881 | case 79 : 882 | return "resizemode:" + string_of_resizeMode(param[0]); 883 | case 80 : 884 | return "tintcolor:" + string_of_color(param[0]); 885 | case 81 : 886 | return "overlay-color" + string_of_color(param[0]); 887 | case 85 : 888 | return param[0] + ":unset"; 889 | case 86 : 890 | return param[0] + ":initial"; 891 | case 87 : 892 | return param[0] + ":inherit"; 893 | case 88 : 894 | return param[0] + (":" + param[1]); 895 | default: 896 | throw Caml_builtin_exceptions.not_found; 897 | } 898 | } 899 | 900 | var selectorTokenizer = new RegExp("[(),]|\"(?:\\\\.|[^\"\\n])*\"|'(?:\\\\.|[^'\\n])*'|\\/\\*[\\s\\S]*?\\*\\/", "g"); 901 | 902 | var splitSelector = ( 903 | function(selector) { 904 | if(selector.indexOf(',') === -1) { 905 | return [selector] 906 | } 907 | 908 | var indices = [], res = [], inParen = 0, o 909 | /*eslint-disable no-cond-assign*/ 910 | while (o = selectorTokenizer.exec(selector)) { 911 | /*eslint-enable no-cond-assign*/ 912 | switch (o[0]) { 913 | case '(': inParen++; break 914 | case ')': inParen--; break 915 | case ',': if (inParen) break; indices.push(o.index) 916 | } 917 | } 918 | for (o = indices.length; o--;){ 919 | res.unshift(selector.slice(indices[o] + 1)) 920 | selector = selector.slice(0, indices[o]) 921 | } 922 | res.unshift(selector) 923 | return res 924 | } 925 | ); 926 | 927 | var replacementRegex = new RegExp("&", "g"); 928 | 929 | function replace(str, _with) { 930 | return str.replace(replacementRegex, _with); 931 | } 932 | 933 | function joinSelectors(selectors) { 934 | var joinSelectors$1 = function (selectors) { 935 | if (selectors) { 936 | var t = selectors[1]; 937 | var x = selectors[0]; 938 | if (t) { 939 | if (t[1]) { 940 | return x.replace(replacementRegex, joinSelectors$1(t)); 941 | } else { 942 | return x.replace(replacementRegex, t[0]); 943 | } 944 | } else { 945 | return x; 946 | } 947 | } else { 948 | return ""; 949 | } 950 | }; 951 | return joinSelectors$1(List.flatten(List.map((function (selector) { 952 | return List.map((function (a) { 953 | var match = $$String.contains(a, /* "&" */38); 954 | if (match !== 0) { 955 | return a; 956 | } else { 957 | return "&" + a; 958 | } 959 | }), $$Array.to_list(Curry._1(splitSelector, selector))); 960 | }), selectors))); 961 | } 962 | 963 | function string_of_scope(scope, hash, content) { 964 | var prefix = ""; 965 | var suffix = ""; 966 | if (List.length(scope[/* mqs */0]) > 0) { 967 | prefix = "@media " + ($$String.concat(" and ", List.rev(scope[/* mqs */0])) + "{"); 968 | suffix = suffix + "}"; 969 | } 970 | if (List.length(scope[/* supps */1]) > 0) { 971 | suffix = suffix + "}"; 972 | prefix = prefix + ("@supports " + ($$String.concat(" and ", List.rev(scope[/* supps */1])) + "{")); 973 | } 974 | if (List.length(scope[/* selectors */2]) > 0) { 975 | prefix = prefix + joinSelectors(scope[/* selectors */2]).replace(replacementRegex, hash); 976 | } 977 | prefix = prefix + "{"; 978 | suffix = suffix + "}"; 979 | return prefix + (content + suffix); 980 | } 981 | 982 | var blankScope = /* record */[ 983 | /* mqs : [] */0, 984 | /* supps : [] */0, 985 | /* selectors : :: */[ 986 | "&", 987 | /* [] */0 988 | ] 989 | ]; 990 | 991 | function walk(decls, _idx, scope, _acc) { 992 | while(true) { 993 | var acc = _acc; 994 | var idx = _idx; 995 | if (decls.length - idx) { 996 | var x = Caml_array.caml_array_get(decls, (decls.length - idx | 0) - 1 | 0); 997 | switch (x.tag | 0) { 998 | case 82 : 999 | _acc = walk(x[1], 0, /* record */[ 1000 | /* mqs : :: */[ 1001 | x[0], 1002 | scope[/* mqs */0] 1003 | ], 1004 | /* supps */scope[/* supps */1], 1005 | /* selectors */scope[/* selectors */2] 1006 | ], acc); 1007 | _idx = idx + 1 | 0; 1008 | continue ; 1009 | case 83 : 1010 | _acc = walk(x[1], 0, /* record */[ 1011 | /* mqs */scope[/* mqs */0], 1012 | /* supps : :: */[ 1013 | x[0], 1014 | scope[/* supps */1] 1015 | ], 1016 | /* selectors */scope[/* selectors */2] 1017 | ], acc); 1018 | _idx = idx + 1 | 0; 1019 | continue ; 1020 | case 84 : 1021 | _acc = walk(x[1], 0, /* record */[ 1022 | /* mqs */scope[/* mqs */0], 1023 | /* supps */scope[/* supps */1], 1024 | /* selectors : :: */[ 1025 | x[0], 1026 | scope[/* selectors */2] 1027 | ] 1028 | ], acc); 1029 | _idx = idx + 1 | 0; 1030 | continue ; 1031 | default: 1032 | _acc = /* :: */[ 1033 | /* tuple */[ 1034 | scope, 1035 | x 1036 | ], 1037 | acc 1038 | ]; 1039 | _idx = idx + 1 | 0; 1040 | continue ; 1041 | 1042 | } 1043 | } else { 1044 | return acc; 1045 | } 1046 | }; 1047 | } 1048 | 1049 | function group(normalized) { 1050 | if (normalized) { 1051 | var match = normalized[0]; 1052 | var style = match[1]; 1053 | var scope = match[0]; 1054 | var l = group(normalized[1]); 1055 | if (l) { 1056 | var match$1 = l[0]; 1057 | var lastScope = match$1[0]; 1058 | if (lastScope === scope) { 1059 | return /* :: */[ 1060 | /* tuple */[ 1061 | lastScope, 1062 | /* :: */[ 1063 | style, 1064 | match$1[1] 1065 | ] 1066 | ], 1067 | l[1] 1068 | ]; 1069 | } else { 1070 | return /* :: */[ 1071 | /* tuple */[ 1072 | scope, 1073 | /* :: */[ 1074 | style, 1075 | /* [] */0 1076 | ] 1077 | ], 1078 | l 1079 | ]; 1080 | } 1081 | } else { 1082 | return /* :: */[ 1083 | /* tuple */[ 1084 | scope, 1085 | /* :: */[ 1086 | style, 1087 | /* [] */0 1088 | ] 1089 | ], 1090 | /* [] */0 1091 | ]; 1092 | } 1093 | } else { 1094 | return /* [] */0; 1095 | } 1096 | } 1097 | 1098 | function flatten(decls) { 1099 | return group(walk(decls, 0, blankScope, /* [] */0)); 1100 | } 1101 | 1102 | var global_cache = Hashtbl.create(/* None */0, 100); 1103 | 1104 | var injected_cache = Hashtbl.create(/* None */0, 100); 1105 | 1106 | var rule_cache = Hashtbl.create(/* None */0, 100); 1107 | 1108 | function flush() { 1109 | Hashtbl.reset(injected_cache); 1110 | return Hashtbl.reset(rule_cache); 1111 | } 1112 | 1113 | function insertRule(rule) { 1114 | var match = document.querySelector("style[data-nice]"); 1115 | var tag; 1116 | if (match == null) { 1117 | var tag$1 = document.createElement("style"); 1118 | tag$1.setAttribute("data-nice", ""); 1119 | document.head.appendChild(tag$1); 1120 | tag = tag$1; 1121 | } else { 1122 | tag = match; 1123 | } 1124 | if (process.env.NODE_ENV === "production") { 1125 | tag.sheet.insertRule(rule, tag.sheet.cssRules.length); 1126 | return /* () */0; 1127 | } else { 1128 | tag.appendChild(document.createTextNode(rule)); 1129 | return /* () */0; 1130 | } 1131 | } 1132 | 1133 | var alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 1134 | 1135 | function base62_of_int($$int) { 1136 | var fn = function (n, c) { 1137 | if (n !== 0) { 1138 | return fn(n / 62 | 0, Char.escaped(Caml_string.get(alphabet, n - Caml_int32.imul(62, n / 62 | 0) | 0))) + c; 1139 | } else { 1140 | return c; 1141 | } 1142 | }; 1143 | return fn(Pervasives.abs($$int), ""); 1144 | } 1145 | 1146 | function insert(nodes, hash) { 1147 | if (Hashtbl.mem(injected_cache, hash)) { 1148 | return 0; 1149 | } else { 1150 | var cssRules = List.map((function (param) { 1151 | return string_of_scope(param[0], hash, $$String.concat(";", List.map(string_of_style, param[1]))); 1152 | }), List.filter((function (param) { 1153 | return +(param[1] !== /* [] */0); 1154 | }))(nodes)); 1155 | if (isBrowser && !isTest) { 1156 | List.map(insertRule, cssRules); 1157 | } else { 1158 | Hashtbl.add(rule_cache, hash, cssRules); 1159 | } 1160 | return Hashtbl.add(injected_cache, hash, /* true */1); 1161 | } 1162 | } 1163 | 1164 | function css(decls) { 1165 | var flattened = flatten(decls); 1166 | var className = "css-" + base62_of_int(Hashtbl.hash(flattened)); 1167 | insert(flattened, "." + className); 1168 | return className; 1169 | } 1170 | 1171 | function $$global(select, decls) { 1172 | var flattened = flatten(decls); 1173 | var hash = ".raw-" + base62_of_int(Hashtbl.hash(flattened)); 1174 | if (Hashtbl.mem(injected_cache, hash)) { 1175 | return 0; 1176 | } else { 1177 | var cssRules = List.map((function (param) { 1178 | return string_of_scope(param[0], select, $$String.concat(";", List.map(string_of_style, param[1]))); 1179 | }), List.filter((function (param) { 1180 | return +(param[1] !== /* [] */0); 1181 | }))(flattened)); 1182 | if (isBrowser && !isTest) { 1183 | List.map(insertRule, cssRules); 1184 | } else { 1185 | Hashtbl.add(global_cache, hash, cssRules); 1186 | } 1187 | return Hashtbl.add(injected_cache, hash, /* true */1); 1188 | } 1189 | } 1190 | 1191 | function raw(css) { 1192 | var hash = ".raw-" + base62_of_int(Hashtbl.hash(css)); 1193 | if (Hashtbl.mem(injected_cache, hash)) { 1194 | return 0; 1195 | } else { 1196 | Hashtbl.add(injected_cache, hash, /* true */1); 1197 | if (isBrowser && !isTest) { 1198 | return insertRule(css); 1199 | } else { 1200 | return Hashtbl.add(global_cache, hash, /* :: */[ 1201 | css, 1202 | /* [] */0 1203 | ]); 1204 | } 1205 | } 1206 | } 1207 | 1208 | function keyframes() { 1209 | return /* () */0; 1210 | } 1211 | 1212 | function animation() { 1213 | return /* () */0; 1214 | } 1215 | 1216 | function fontFace() { 1217 | return /* () */0; 1218 | } 1219 | 1220 | var extractIDs = ( 1221 | function (html){ 1222 | let regex = /css\-([a-zA-Z0-9\-_]+)/gm 1223 | let match, ids = new Set(); 1224 | while((match = regex.exec(html)) !== null) { 1225 | ids.add("." + match[0]); 1226 | } 1227 | return Array.from(ids.values()); 1228 | } 1229 | ); 1230 | 1231 | function extract(_html) { 1232 | var ids = Curry._1(extractIDs, _html); 1233 | var css = [/* [] */0]; 1234 | Hashtbl.iter((function (_, v) { 1235 | css[0] = List.concat(/* :: */[ 1236 | v, 1237 | /* :: */[ 1238 | css[0], 1239 | /* [] */0 1240 | ] 1241 | ]); 1242 | return /* () */0; 1243 | }), global_cache); 1244 | $$Array.iter((function (id) { 1245 | css[0] = List.concat(/* :: */[ 1246 | Hashtbl.find(rule_cache, id), 1247 | /* :: */[ 1248 | css[0], 1249 | /* [] */0 1250 | ] 1251 | ]); 1252 | return /* () */0; 1253 | }), ids); 1254 | return /* record */[ 1255 | /* css */css[0], 1256 | /* ids */ids 1257 | ]; 1258 | } 1259 | 1260 | function rehydrate(ids) { 1261 | return $$Array.iter((function (id) { 1262 | return Hashtbl.add(injected_cache, id, /* true */1); 1263 | }), ids); 1264 | } 1265 | 1266 | var Presets = /* module */[ 1267 | /* mobile */"(min-width:400px)", 1268 | /* phablet */"(min-width:550px)", 1269 | /* tablet */"(min-width:750px)", 1270 | /* desktop */"(min-width:1000px)", 1271 | /* hd */"(min-width:1200px)" 1272 | ]; 1273 | 1274 | export { 1275 | isBrowser , 1276 | isTest , 1277 | string_of_position , 1278 | string_of_flexDirection , 1279 | string_of_flexWrap , 1280 | string_of_justifyContent , 1281 | string_of_alignItems , 1282 | string_of_alignSelf , 1283 | string_of_alignContent , 1284 | string_of_overflow , 1285 | string_of_display , 1286 | string_of_dimension , 1287 | string_of_flexBasis , 1288 | string_of_angle , 1289 | string_of_transform , 1290 | string_of_color , 1291 | string_of_fontWeight , 1292 | string_of_backfaceVisibilty , 1293 | string_of_borderStyle , 1294 | string_of_fontStyle , 1295 | string_of_fontVariant , 1296 | string_of_textAlign , 1297 | string_of_textAlignVertical , 1298 | string_of_textDecorationLine , 1299 | string_of_textDecorationStyle , 1300 | string_of_writingDirection , 1301 | string_of_resizeMode , 1302 | string_of_style , 1303 | selectorTokenizer , 1304 | splitSelector , 1305 | replacementRegex , 1306 | replace , 1307 | joinSelectors , 1308 | string_of_scope , 1309 | blankScope , 1310 | walk , 1311 | group , 1312 | flatten , 1313 | global_cache , 1314 | injected_cache , 1315 | rule_cache , 1316 | flush , 1317 | insertRule , 1318 | alphabet , 1319 | base62_of_int , 1320 | insert , 1321 | css , 1322 | $$global , 1323 | raw , 1324 | keyframes , 1325 | animation , 1326 | fontFace , 1327 | extractIDs , 1328 | extract , 1329 | rehydrate , 1330 | Presets , 1331 | 1332 | } 1333 | /* match Not a pure module */ 1334 | -------------------------------------------------------------------------------- /lib/es6/src/nice_prefix.js: -------------------------------------------------------------------------------- 1 | // Generated by BUCKLESCRIPT VERSION 2.1.0, PLEASE EDIT WITH CARE 2 | 'use strict'; 3 | 4 | import * as List from "bs-platform/lib/es6/list.js"; 5 | import * as Block from "bs-platform/lib/es6/block.js"; 6 | 7 | function flex(x) { 8 | if (x.tag) { 9 | return /* :: */[ 10 | x, 11 | /* [] */0 12 | ]; 13 | } else { 14 | var match = x[0]; 15 | if (match !== 4) { 16 | if (match >= 5) { 17 | return List.map((function (x) { 18 | return /* Raw */Block.__(88, [ 19 | "display", 20 | x 21 | ]); 22 | }), /* :: */[ 23 | "-webkit-box", 24 | /* :: */[ 25 | "-moz-box", 26 | /* :: */[ 27 | "-ms-flexbox", 28 | /* :: */[ 29 | "-webkit-flex", 30 | /* :: */[ 31 | "flex", 32 | /* [] */0 33 | ] 34 | ] 35 | ] 36 | ] 37 | ]); 38 | } else { 39 | return /* :: */[ 40 | x, 41 | /* [] */0 42 | ]; 43 | } 44 | } else { 45 | return List.map((function (x) { 46 | return /* Raw */Block.__(88, [ 47 | "display", 48 | x 49 | ]); 50 | }), /* :: */[ 51 | "-webkit-inline-box", 52 | /* :: */[ 53 | "-moz-inline-box", 54 | /* :: */[ 55 | "-ms-inline-flexbox", 56 | /* :: */[ 57 | "-webkit-inline-flex", 58 | /* :: */[ 59 | "inline-flex", 60 | /* [] */0 61 | ] 62 | ] 63 | ] 64 | ] 65 | ]); 66 | } 67 | } 68 | } 69 | 70 | export { 71 | flex , 72 | 73 | } 74 | /* No side effect */ 75 | -------------------------------------------------------------------------------- /lib/js/__tests__/__snapshots__/nice_test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Nice css 1`] = ` 4 | Array [ 5 | "css-1lqfuW", 6 | Array [ 7 | Array [ 8 | ".css-1lqfuW", 9 | Array [ 10 | ".css-1lqfuW{display:flex;width:23px}", 11 | 0, 12 | ], 13 | ], 14 | 0, 15 | ], 16 | ] 17 | `; 18 | 19 | exports[`Nice global 1`] = ` 20 | Array [ 21 | Array [ 22 | ".raw-24eOUU", 23 | Array [ 24 | "html, body{padding:20px}", 25 | 0, 26 | ], 27 | ], 28 | 0, 29 | ] 30 | `; 31 | 32 | exports[`Nice nesting 1`] = ` 33 | Array [ 34 | "css-1cUkzM", 35 | Array [ 36 | Array [ 37 | ".css-1cUkzM", 38 | Array [ 39 | ".css-1cUkzM{display:flex;color:red}", 40 | Array [ 41 | "@media screen{.css-1cUkzM{display:block;color:green}}", 42 | Array [ 43 | "@media screen{.css-1cUkzM:hover{color:orange;font-weight:bold;overflow:hidden}}", 44 | Array [ 45 | "@media screen{@supports (display: flex){.css-1cUkzM:hover{color:blue}}}", 46 | Array [ 47 | "@media screen{.css-1cUkzM:hover:active{color:red;display:block}}", 48 | Array [ 49 | "@media screen{.ie6 .css-1cUkzM:hover:active{color:blue}}", 50 | 0, 51 | ], 52 | ], 53 | ], 54 | ], 55 | ], 56 | ], 57 | ], 58 | 0, 59 | ], 60 | ] 61 | `; 62 | -------------------------------------------------------------------------------- /lib/js/__tests__/nice_test.js: -------------------------------------------------------------------------------- 1 | // Generated by BUCKLESCRIPT VERSION 2.1.0, PLEASE EDIT WITH CARE 2 | 'use strict'; 3 | 4 | var Jest = require("bs-jest/lib/js/src/jest.js"); 5 | var Nice = require("../src/nice.js"); 6 | var Block = require("bs-platform/lib/js/block.js"); 7 | var Hashtbl = require("bs-platform/lib/js/hashtbl.js"); 8 | 9 | function serialized_rule_cache() { 10 | return Hashtbl.fold((function (k, v, acc) { 11 | return /* :: */[ 12 | /* tuple */[ 13 | k, 14 | v 15 | ], 16 | acc 17 | ]; 18 | }), Nice.rule_cache, /* [] */0); 19 | } 20 | 21 | function serialized_global_cache() { 22 | return Hashtbl.fold((function (k, v, acc) { 23 | return /* :: */[ 24 | /* tuple */[ 25 | k, 26 | v 27 | ], 28 | acc 29 | ]; 30 | }), Nice.global_cache, /* [] */0); 31 | } 32 | 33 | describe("Nice", (function () { 34 | afterEach(Nice.flush); 35 | Jest.test("css", (function () { 36 | return Jest.Expect[/* toMatchSnapshot */16](Jest.Expect[/* expect */0](/* tuple */[ 37 | Nice.css(/* array */[ 38 | /* Display */Block.__(0, [/* Flex */5]), 39 | /* Width */Block.__(1, [/* Px */Block.__(0, [23])]) 40 | ]), 41 | serialized_rule_cache(/* () */0) 42 | ])); 43 | })); 44 | Jest.test("nesting", (function () { 45 | return Jest.Expect[/* toMatchSnapshot */16](Jest.Expect[/* expect */0](/* tuple */[ 46 | Nice.css(/* array */[ 47 | /* Display */Block.__(0, [/* Flex */5]), 48 | /* Color */Block.__(63, [/* Red */119]), 49 | /* MediaQuery */Block.__(82, [ 50 | "screen", 51 | /* array */[ 52 | /* Display */Block.__(0, [/* Block */1]), 53 | /* Color */Block.__(63, [/* Green */54]), 54 | /* Select */Block.__(84, [ 55 | ":hover", 56 | /* array */[ 57 | /* Color */Block.__(63, [/* Orange */104]), 58 | /* FontWeight */Block.__(67, [/* Bold */1]), 59 | /* Overflow */Block.__(37, [/* Hidden */1]), 60 | /* Supports */Block.__(83, [ 61 | "(display: flex)", 62 | /* array */[/* Color */Block.__(63, [/* Blue */10])] 63 | ]), 64 | /* Select */Block.__(84, [ 65 | ":active", 66 | /* array */[ 67 | /* Color */Block.__(63, [/* Red */119]), 68 | /* Display */Block.__(0, [/* Block */1]), 69 | /* Select */Block.__(84, [ 70 | ".ie6 &", 71 | /* array */[/* Color */Block.__(63, [/* Blue */10])] 72 | ]) 73 | ] 74 | ]) 75 | ] 76 | ]) 77 | ] 78 | ]) 79 | ]), 80 | serialized_rule_cache(/* () */0) 81 | ])); 82 | })); 83 | return Jest.test("global", (function () { 84 | Nice.$$global("html, body", /* array */[/* Padding */Block.__(18, [/* Px */Block.__(0, [20])])]); 85 | return Jest.Expect[/* toMatchSnapshot */16](Jest.Expect[/* expect */0](serialized_global_cache(/* () */0))); 86 | })); 87 | })); 88 | 89 | exports.serialized_rule_cache = serialized_rule_cache; 90 | exports.serialized_global_cache = serialized_global_cache; 91 | /* Not a pure module */ 92 | -------------------------------------------------------------------------------- /lib/js/site/demo.js: -------------------------------------------------------------------------------- 1 | // Generated by BUCKLESCRIPT VERSION 2.1.0, PLEASE EDIT WITH CARE 2 | 'use strict'; 3 | 4 | var Nice = require("../src/nice.js"); 5 | var Block = require("bs-platform/lib/js/block.js"); 6 | 7 | var className = Nice.css(/* array */[ 8 | /* Display */Block.__(0, [/* Flex */5]), 9 | /* Color */Block.__(63, [/* Red */119]), 10 | /* MediaQuery */Block.__(82, [ 11 | "screen", 12 | /* array */[ 13 | /* Display */Block.__(0, [/* Block */1]), 14 | /* Color */Block.__(63, [/* Green */54]), 15 | /* Select */Block.__(84, [ 16 | ":hover", 17 | /* array */[ 18 | /* Color */Block.__(63, [/* Orange */104]), 19 | /* FontWeight */Block.__(67, [/* Bold */1]), 20 | /* Overflow */Block.__(37, [/* Hidden */1]), 21 | /* Supports */Block.__(83, [ 22 | "(display: flex)", 23 | /* array */[/* Color */Block.__(63, [/* Blue */10])] 24 | ]), 25 | /* Select */Block.__(84, [ 26 | ":hover", 27 | /* array */[ 28 | /* Color */Block.__(63, [/* Red */119]), 29 | /* Display */Block.__(0, [/* Block */1]), 30 | /* Select */Block.__(84, [ 31 | ".ie6 &", 32 | /* array */[/* Color */Block.__(63, [/* Blue */10])] 33 | ]) 34 | ] 35 | ]) 36 | ] 37 | ]) 38 | ] 39 | ]) 40 | ]); 41 | 42 | var cls2 = Nice.css(/* array */[/* Width */Block.__(1, [/* Em */Block.__(1, [4.4])])]); 43 | 44 | Nice.$$global("html, body", /* array */[ 45 | /* Display */Block.__(0, [/* Block */1]), 46 | /* Color */Block.__(63, [/* Green */54]) 47 | ]); 48 | 49 | exports.className = className; 50 | exports.cls2 = cls2; 51 | /* className Not a pure module */ 52 | -------------------------------------------------------------------------------- /lib/js/src/nice.js: -------------------------------------------------------------------------------- 1 | // Generated by BUCKLESCRIPT VERSION 2.1.0, PLEASE EDIT WITH CARE 2 | 'use strict'; 3 | 4 | var Char = require("bs-platform/lib/js/char.js"); 5 | var List = require("bs-platform/lib/js/list.js"); 6 | var $$Array = require("bs-platform/lib/js/array.js"); 7 | var Curry = require("bs-platform/lib/js/curry.js"); 8 | var $$String = require("bs-platform/lib/js/string.js"); 9 | var Hashtbl = require("bs-platform/lib/js/hashtbl.js"); 10 | var Caml_array = require("bs-platform/lib/js/caml_array.js"); 11 | var Caml_int32 = require("bs-platform/lib/js/caml_int32.js"); 12 | var Pervasives = require("bs-platform/lib/js/pervasives.js"); 13 | var Caml_string = require("bs-platform/lib/js/caml_string.js"); 14 | var Caml_builtin_exceptions = require("bs-platform/lib/js/caml_builtin_exceptions.js"); 15 | 16 | var match = +(( typeof window !== 'undefined' ) === true); 17 | 18 | var isBrowser = match !== 0 ? /* true */1 : /* false */0; 19 | 20 | var match$1 = +(( process.env.NODE_ENV === 'test' ) === true); 21 | 22 | var isTest = match$1 !== 0 ? /* true */1 : /* false */0; 23 | 24 | function string_of_position(param) { 25 | switch (param) { 26 | case 0 : 27 | return "absolute"; 28 | case 1 : 29 | return "relative"; 30 | case 2 : 31 | return "sticky"; 32 | case 3 : 33 | return "fixed"; 34 | 35 | } 36 | } 37 | 38 | function string_of_flexDirection(param) { 39 | switch (param) { 40 | case 0 : 41 | return "row"; 42 | case 1 : 43 | return "row-reverse"; 44 | case 2 : 45 | return "column"; 46 | case 3 : 47 | return "column-reverse"; 48 | 49 | } 50 | } 51 | 52 | function string_of_flexWrap(param) { 53 | if (param !== 0) { 54 | return "nowrap"; 55 | } else { 56 | return "wrap"; 57 | } 58 | } 59 | 60 | function string_of_justifyContent(param) { 61 | switch (param) { 62 | case 0 : 63 | return "flex-start"; 64 | case 1 : 65 | return "flex-end"; 66 | case 2 : 67 | return "center"; 68 | case 3 : 69 | return "space-between"; 70 | case 4 : 71 | return "space-around"; 72 | 73 | } 74 | } 75 | 76 | function string_of_alignItems(param) { 77 | switch (param) { 78 | case 0 : 79 | return "flex-start"; 80 | case 1 : 81 | return "flex-end"; 82 | case 2 : 83 | return "center"; 84 | case 3 : 85 | return "stretch"; 86 | case 4 : 87 | return "baseline"; 88 | 89 | } 90 | } 91 | 92 | function string_of_alignSelf(param) { 93 | switch (param) { 94 | case 0 : 95 | return "auto"; 96 | case 1 : 97 | return "flex-start"; 98 | case 2 : 99 | return "flex-end"; 100 | case 3 : 101 | return "center"; 102 | case 4 : 103 | return "stretch"; 104 | case 5 : 105 | return "baseline"; 106 | 107 | } 108 | } 109 | 110 | function string_of_alignContent(param) { 111 | switch (param) { 112 | case 0 : 113 | return "start"; 114 | case 1 : 115 | return "end"; 116 | case 2 : 117 | return "flex-start"; 118 | case 3 : 119 | return "flex-end"; 120 | case 4 : 121 | return "left"; 122 | case 5 : 123 | return "right"; 124 | case 6 : 125 | return "center"; 126 | case 7 : 127 | return "stretch"; 128 | case 8 : 129 | return "space-between"; 130 | case 9 : 131 | return "space-around"; 132 | case 10 : 133 | return "baseline"; 134 | case 11 : 135 | return "first baseline"; 136 | case 12 : 137 | return "last baseline"; 138 | case 13 : 139 | return "space-evenly"; 140 | case 14 : 141 | return "safe-center"; 142 | case 15 : 143 | return "unsafe-center"; 144 | 145 | } 146 | } 147 | 148 | function string_of_overflow(param) { 149 | switch (param) { 150 | case 0 : 151 | return "visible"; 152 | case 1 : 153 | return "hidden"; 154 | case 2 : 155 | return "scroll"; 156 | 157 | } 158 | } 159 | 160 | function string_of_display(param) { 161 | switch (param) { 162 | case 0 : 163 | return "none"; 164 | case 1 : 165 | return "block"; 166 | case 2 : 167 | return "inline"; 168 | case 3 : 169 | case 4 : 170 | return "inline-block"; 171 | case 5 : 172 | return "flex"; 173 | 174 | } 175 | } 176 | 177 | function string_of_dimension(param) { 178 | switch (param.tag | 0) { 179 | case 0 : 180 | return "" + (String(param[0]) + "px"); 181 | case 1 : 182 | return "" + (String(param[0]) + "em"); 183 | case 2 : 184 | return "" + (String(param[0]) + "%"); 185 | case 3 : 186 | return "calc(" + (param[0] + ")"); 187 | 188 | } 189 | } 190 | 191 | function string_of_flexBasis(param) { 192 | switch (param) { 193 | case 0 : 194 | return "auto"; 195 | case 1 : 196 | return "max-content"; 197 | case 2 : 198 | return "min-content"; 199 | case 3 : 200 | return "fit-content"; 201 | case 4 : 202 | return "content"; 203 | 204 | } 205 | } 206 | 207 | function string_of_angle(param) { 208 | if (param.tag) { 209 | return "" + (String(param[0]) + "rad"); 210 | } else { 211 | return "" + (String(param[0]) + "deg"); 212 | } 213 | } 214 | 215 | function string_of_transform(param) { 216 | switch (param.tag | 0) { 217 | case 0 : 218 | return "perspective(" + (String(param[0]) + ")"); 219 | case 1 : 220 | return "rotate(" + (string_of_angle(param[0]) + ")"); 221 | case 2 : 222 | return "rotateX(" + (string_of_angle(param[0]) + ")"); 223 | case 3 : 224 | return "rotateY(" + (string_of_angle(param[0]) + ")"); 225 | case 4 : 226 | return "rotateZ(" + (string_of_angle(param[0]) + ")"); 227 | case 5 : 228 | return "scale(" + ("" + (String(param[0]) + "") + ")"); 229 | case 6 : 230 | return "scaleX(" + ("" + (String(param[0]) + "") + ")"); 231 | case 7 : 232 | return "scaleY(" + ("" + (String(param[0]) + "") + ")"); 233 | case 8 : 234 | return "scaleZ(" + ("" + (String(param[0]) + "") + ")"); 235 | case 9 : 236 | return "translate(" + ("" + (String(param[0]) + "") + (", " + ("" + (String(param[1]) + "") + ")"))); 237 | case 10 : 238 | return "translateX(" + ("" + (String(param[0]) + "") + ")"); 239 | case 11 : 240 | return "translateY(" + ("" + (String(param[0]) + "") + ")"); 241 | case 12 : 242 | return "translateZ(" + ("" + (String(param[0]) + "") + ")"); 243 | case 13 : 244 | return "skewX(" + (string_of_angle(param[0]) + ")"); 245 | case 14 : 246 | return "skewY(" + (string_of_angle(param[0]) + ")"); 247 | 248 | } 249 | } 250 | 251 | function string_of_color(param) { 252 | if (typeof param === "number") { 253 | switch (param) { 254 | case 0 : 255 | return "transparent"; 256 | case 1 : 257 | return "aliceblue"; 258 | case 2 : 259 | return "antiquewhite"; 260 | case 3 : 261 | return "aqua"; 262 | case 4 : 263 | return "aquamarine"; 264 | case 5 : 265 | return "azure"; 266 | case 6 : 267 | return "beige"; 268 | case 7 : 269 | return "bisque"; 270 | case 8 : 271 | return "black"; 272 | case 9 : 273 | return "blanchedalmond"; 274 | case 10 : 275 | return "blue"; 276 | case 11 : 277 | return "blueviolet"; 278 | case 12 : 279 | return "brown"; 280 | case 13 : 281 | return "burlywood"; 282 | case 14 : 283 | return "cadetblue"; 284 | case 15 : 285 | return "chartreuse"; 286 | case 16 : 287 | return "chocolate"; 288 | case 17 : 289 | return "coral"; 290 | case 18 : 291 | return "cornflowerblue"; 292 | case 19 : 293 | return "cornsilk"; 294 | case 20 : 295 | return "crimson"; 296 | case 21 : 297 | return "cyan"; 298 | case 22 : 299 | return "darkblue"; 300 | case 23 : 301 | return "darkcyan"; 302 | case 24 : 303 | return "darkgoldenrod"; 304 | case 25 : 305 | return "darkgray"; 306 | case 26 : 307 | return "darkgreen"; 308 | case 27 : 309 | return "darkgrey"; 310 | case 28 : 311 | return "darkkhaki"; 312 | case 29 : 313 | return "darkmagenta"; 314 | case 30 : 315 | return "darkolivegreen"; 316 | case 31 : 317 | return "darkorange"; 318 | case 32 : 319 | return "darkorchid"; 320 | case 33 : 321 | return "darkred"; 322 | case 34 : 323 | return "darksalmon"; 324 | case 35 : 325 | return "darkseagreen"; 326 | case 36 : 327 | return "darkslateblue"; 328 | case 37 : 329 | return "darkslategrey"; 330 | case 38 : 331 | return "darkturquoise"; 332 | case 39 : 333 | return "darkviolet"; 334 | case 40 : 335 | return "deeppink"; 336 | case 41 : 337 | return "deepskyblue"; 338 | case 42 : 339 | return "dimgray"; 340 | case 43 : 341 | return "dimgrey"; 342 | case 44 : 343 | return "dodgerblue"; 344 | case 45 : 345 | return "firebrick"; 346 | case 46 : 347 | return "floralwhite"; 348 | case 47 : 349 | return "forestgreen"; 350 | case 48 : 351 | return "fuchsia"; 352 | case 49 : 353 | return "gainsboro"; 354 | case 50 : 355 | return "ghostwhite"; 356 | case 51 : 357 | return "gold"; 358 | case 52 : 359 | return "goldenrod"; 360 | case 53 : 361 | return "gray"; 362 | case 54 : 363 | return "green"; 364 | case 55 : 365 | return "greenyellow"; 366 | case 56 : 367 | return "grey"; 368 | case 57 : 369 | return "honeydew"; 370 | case 58 : 371 | return "hotpink"; 372 | case 59 : 373 | return "indianred"; 374 | case 60 : 375 | return "indigo"; 376 | case 61 : 377 | return "ivory"; 378 | case 62 : 379 | return "khaki"; 380 | case 63 : 381 | return "lavender"; 382 | case 64 : 383 | return "lavenderblush"; 384 | case 65 : 385 | return "lawngreen"; 386 | case 66 : 387 | return "lemonchiffon"; 388 | case 67 : 389 | return "lightblue"; 390 | case 68 : 391 | return "lightcoral"; 392 | case 69 : 393 | return "lightcyan"; 394 | case 70 : 395 | return "lightgoldenrodyellow"; 396 | case 71 : 397 | return "lightgray"; 398 | case 72 : 399 | return "lightgreen"; 400 | case 73 : 401 | return "lightgrey"; 402 | case 74 : 403 | return "lightpink"; 404 | case 75 : 405 | return "lightsalmon"; 406 | case 76 : 407 | return "lightseagreen"; 408 | case 77 : 409 | return "lightskyblue"; 410 | case 78 : 411 | return "lightslategrey"; 412 | case 79 : 413 | return "lightsteelblue"; 414 | case 80 : 415 | return "lightyellow"; 416 | case 81 : 417 | return "lime"; 418 | case 82 : 419 | return "limegreen"; 420 | case 83 : 421 | return "linen"; 422 | case 84 : 423 | return "magenta"; 424 | case 85 : 425 | return "maroon"; 426 | case 86 : 427 | return "mediumaquamarine"; 428 | case 87 : 429 | return "mediumblue"; 430 | case 88 : 431 | return "mediumorchid"; 432 | case 89 : 433 | return "mediumpurple"; 434 | case 90 : 435 | return "mediumseagreen"; 436 | case 91 : 437 | return "mediumslateblue"; 438 | case 92 : 439 | return "mediumspringgreen"; 440 | case 93 : 441 | return "mediumturquoise"; 442 | case 94 : 443 | return "mediumvioletred"; 444 | case 95 : 445 | return "midnightblue"; 446 | case 96 : 447 | return "mintcream"; 448 | case 97 : 449 | return "mistyrose"; 450 | case 98 : 451 | return "moccasin"; 452 | case 99 : 453 | return "navajowhite"; 454 | case 100 : 455 | return "navy"; 456 | case 101 : 457 | return "oldlace"; 458 | case 102 : 459 | return "olive"; 460 | case 103 : 461 | return "olivedrab"; 462 | case 104 : 463 | return "orange"; 464 | case 105 : 465 | return "orangered"; 466 | case 106 : 467 | return "orchid"; 468 | case 107 : 469 | return "palegoldenrod"; 470 | case 108 : 471 | return "palegreen"; 472 | case 109 : 473 | return "paleturquoise"; 474 | case 110 : 475 | return "palevioletred"; 476 | case 111 : 477 | return "papayawhip"; 478 | case 112 : 479 | return "peachpuff"; 480 | case 113 : 481 | return "peru"; 482 | case 114 : 483 | return "pink"; 484 | case 115 : 485 | return "plum"; 486 | case 116 : 487 | return "powderblue"; 488 | case 117 : 489 | return "purple"; 490 | case 118 : 491 | return "rebeccapurple"; 492 | case 119 : 493 | return "red"; 494 | case 120 : 495 | return "rosybrown"; 496 | case 121 : 497 | return "royalblue"; 498 | case 122 : 499 | return "saddlebrown"; 500 | case 123 : 501 | return "salmon"; 502 | case 124 : 503 | return "sandybrown"; 504 | case 125 : 505 | return "seagreen"; 506 | case 126 : 507 | return "seashell"; 508 | case 127 : 509 | return "sienna"; 510 | case 128 : 511 | return "silver"; 512 | case 129 : 513 | return "skyblue"; 514 | case 130 : 515 | return "slateblue"; 516 | case 131 : 517 | return "slategray"; 518 | case 132 : 519 | return "snow"; 520 | case 133 : 521 | return "springgreen"; 522 | case 134 : 523 | return "steelblue"; 524 | case 135 : 525 | return "tan"; 526 | case 136 : 527 | return "teal"; 528 | case 137 : 529 | return "thistle"; 530 | case 138 : 531 | return "tomato"; 532 | case 139 : 533 | return "turquoise"; 534 | case 140 : 535 | return "violet"; 536 | case 141 : 537 | return "wheat"; 538 | case 142 : 539 | return "white"; 540 | case 143 : 541 | return "whitesmoke"; 542 | case 144 : 543 | return "yellow"; 544 | case 145 : 545 | return "yellowgreen"; 546 | 547 | } 548 | } else { 549 | switch (param.tag | 0) { 550 | case 0 : 551 | return "rgba(" + (String(param[0]) + ("," + (String(param[1]) + ("," + (String(param[2]) + ""))))); 552 | case 1 : 553 | return "rgba(" + (String(param[0]) + ("," + (String(param[1]) + ("," + (String(param[2]) + ("," + (String(param[3]) + ")"))))))); 554 | case 2 : 555 | return "hsl(" + (String(param[0]) + ("," + (String(param[1]) + ("," + (String(param[2]) + ""))))); 556 | case 3 : 557 | return "hsla(" + (String(param[0]) + ("," + (String(param[1]) + ("," + (String(param[2]) + ("," + (String(param[3]) + ""))))))); 558 | 559 | } 560 | } 561 | } 562 | 563 | function string_of_fontWeight(param) { 564 | switch (param) { 565 | case 0 : 566 | return "normal"; 567 | case 1 : 568 | return "bold"; 569 | case 2 : 570 | return "100"; 571 | case 3 : 572 | return "200"; 573 | case 4 : 574 | return "300"; 575 | case 5 : 576 | return "400"; 577 | case 6 : 578 | return "500"; 579 | case 7 : 580 | return "600"; 581 | case 8 : 582 | return "700"; 583 | case 9 : 584 | return "800"; 585 | case 10 : 586 | return "900"; 587 | 588 | } 589 | } 590 | 591 | function string_of_backfaceVisibilty(param) { 592 | if (param !== 0) { 593 | return "hidden"; 594 | } else { 595 | return "visible"; 596 | } 597 | } 598 | 599 | function string_of_borderStyle(param) { 600 | switch (param) { 601 | case 0 : 602 | return "solid"; 603 | case 1 : 604 | return "dotted"; 605 | case 2 : 606 | return "dashed"; 607 | 608 | } 609 | } 610 | 611 | function string_of_fontStyle(param) { 612 | if (param !== 0) { 613 | return "italic"; 614 | } else { 615 | return "normal"; 616 | } 617 | } 618 | 619 | function string_of_fontVariant(param) { 620 | switch (param) { 621 | case 0 : 622 | return "small-caps"; 623 | case 1 : 624 | return "old-style-nums"; 625 | case 2 : 626 | return "lining-nums"; 627 | case 3 : 628 | return "tabular-nums"; 629 | case 4 : 630 | return "proportional-nums"; 631 | 632 | } 633 | } 634 | 635 | function string_of_textAlign(param) { 636 | switch (param) { 637 | case 0 : 638 | return "auto"; 639 | case 1 : 640 | return "left"; 641 | case 2 : 642 | return "right"; 643 | case 3 : 644 | return "center"; 645 | case 4 : 646 | return "justify"; 647 | 648 | } 649 | } 650 | 651 | function string_of_textAlignVertical(param) { 652 | switch (param) { 653 | case 0 : 654 | return "auto"; 655 | case 1 : 656 | return "top"; 657 | case 2 : 658 | return "bottom"; 659 | case 3 : 660 | return "center"; 661 | 662 | } 663 | } 664 | 665 | function string_of_textDecorationLine(param) { 666 | switch (param) { 667 | case 0 : 668 | return "none"; 669 | case 1 : 670 | return "underline"; 671 | case 2 : 672 | return "line-through"; 673 | case 3 : 674 | return "underline line-through"; 675 | 676 | } 677 | } 678 | 679 | function string_of_textDecorationStyle(param) { 680 | switch (param) { 681 | case 0 : 682 | return "solid"; 683 | case 1 : 684 | return "double"; 685 | case 2 : 686 | return "dotted"; 687 | case 3 : 688 | return "dashed"; 689 | 690 | } 691 | } 692 | 693 | function string_of_writingDirection(param) { 694 | switch (param) { 695 | case 0 : 696 | return "auto"; 697 | case 1 : 698 | return "ltr"; 699 | case 2 : 700 | return "rtl"; 701 | 702 | } 703 | } 704 | 705 | function string_of_resizeMode(param) { 706 | switch (param) { 707 | case 0 : 708 | return "contain"; 709 | case 1 : 710 | return "cover"; 711 | case 2 : 712 | return "stretch"; 713 | case 3 : 714 | return "center"; 715 | case 4 : 716 | return "repeat"; 717 | 718 | } 719 | } 720 | 721 | function string_of_style(param) { 722 | switch (param.tag | 0) { 723 | case 0 : 724 | return "display:" + string_of_display(param[0]); 725 | case 1 : 726 | return "width:" + string_of_dimension(param[0]); 727 | case 2 : 728 | return "height:" + string_of_dimension(param[0]); 729 | case 3 : 730 | return "top:" + string_of_dimension(param[0]); 731 | case 4 : 732 | return "bottom:" + string_of_dimension(param[0]); 733 | case 5 : 734 | return "left:" + string_of_dimension(param[0]); 735 | case 6 : 736 | return "right:" + string_of_dimension(param[0]); 737 | case 7 : 738 | return "min-width:" + string_of_dimension(param[0]); 739 | case 8 : 740 | return "max-width:" + string_of_dimension(param[0]); 741 | case 9 : 742 | return "minheight:" + string_of_dimension(param[0]); 743 | case 10 : 744 | return "maxheight:" + string_of_dimension(param[0]); 745 | case 11 : 746 | return "margin:" + string_of_dimension(param[0]); 747 | case 12 : 748 | return "margin-vertical:" + string_of_dimension(param[0]); 749 | case 13 : 750 | return "margin-horizontal:" + string_of_dimension(param[0]); 751 | case 14 : 752 | return "margin-top:" + string_of_dimension(param[0]); 753 | case 15 : 754 | return "margin-bottom:" + string_of_dimension(param[0]); 755 | case 16 : 756 | return "margin-left:" + string_of_dimension(param[0]); 757 | case 17 : 758 | return "margin-right:" + string_of_dimension(param[0]); 759 | case 18 : 760 | return "padding:" + string_of_dimension(param[0]); 761 | case 19 : 762 | return "padding-vertical:" + string_of_dimension(param[0]); 763 | case 20 : 764 | return "padding-horizontal:" + string_of_dimension(param[0]); 765 | case 21 : 766 | return "padding-top:" + string_of_dimension(param[0]); 767 | case 22 : 768 | return "padding-bottom:" + string_of_dimension(param[0]); 769 | case 23 : 770 | return "padding-left:" + string_of_dimension(param[0]); 771 | case 24 : 772 | return "padding-right:" + string_of_dimension(param[0]); 773 | case 25 : 774 | return "border-width:" + string_of_dimension(param[0]); 775 | case 26 : 776 | return "border-top-width:" + string_of_dimension(param[0]); 777 | case 27 : 778 | return "border-bottom-width:" + string_of_dimension(param[0]); 779 | case 28 : 780 | return "border-left-width:" + string_of_dimension(param[0]); 781 | case 29 : 782 | return "border-right-width:" + string_of_dimension(param[0]); 783 | case 30 : 784 | return "position:" + string_of_position(param[0]); 785 | case 31 : 786 | return "flex-direction:" + string_of_flexDirection(param[0]); 787 | case 32 : 788 | return "flex-wrap:" + string_of_flexWrap(param[0]); 789 | case 33 : 790 | return "justify-content:" + string_of_justifyContent(param[0]); 791 | case 34 : 792 | return "align-items:" + string_of_alignItems(param[0]); 793 | case 35 : 794 | return "align-self:" + string_of_alignSelf(param[0]); 795 | case 36 : 796 | return "align-content:" + string_of_alignContent(param[0]); 797 | case 37 : 798 | return "overflow:" + string_of_overflow(param[0]); 799 | case 38 : 800 | return "flex:" + Pervasives.string_of_int(param[0]); 801 | case 39 : 802 | return "flex-grow:" + Pervasives.string_of_int(param[0]); 803 | case 40 : 804 | return "flex-shrink:" + Pervasives.string_of_int(param[0]); 805 | case 41 : 806 | return "flex-basis:" + Pervasives.string_of_int(param[0]); 807 | case 42 : 808 | return "flex-basis:" + string_of_flexBasis(param[0]); 809 | case 43 : 810 | return "shadow-color:" + string_of_color(param[0]); 811 | case 44 : 812 | return "shadow-offset:" + (Pervasives.string_of_int(param[0]) + ("," + Pervasives.string_of_int(param[1]))); 813 | case 45 : 814 | return "shadow-opacity:" + ("" + (String(param[0]) + "")); 815 | case 46 : 816 | return "shadow-radius:" + ("" + (String(param[0]) + "")); 817 | case 47 : 818 | return "transform:" + $$String.concat(",", List.map(string_of_transform, param[0])); 819 | case 48 : 820 | return "backface-visibilty:" + string_of_backfaceVisibilty(param[0]); 821 | case 49 : 822 | return "background-color:" + string_of_color(param[0]); 823 | case 50 : 824 | return "border-color:" + string_of_color(param[0]); 825 | case 51 : 826 | return "border-top-color:" + string_of_color(param[0]); 827 | case 52 : 828 | return "border-bottom-color:" + string_of_color(param[0]); 829 | case 53 : 830 | return "border-left-color:" + string_of_color(param[0]); 831 | case 54 : 832 | return "border-right-color:" + string_of_color(param[0]); 833 | case 55 : 834 | return "border-radius:" + string_of_dimension(param[0]); 835 | case 56 : 836 | return "border-top-right-radius:" + string_of_dimension(param[0]); 837 | case 57 : 838 | return "border-bottom-left-radius:" + string_of_dimension(param[0]); 839 | case 58 : 840 | return "border-bottom-right-radius:" + string_of_dimension(param[0]); 841 | case 59 : 842 | return "border-top-left-radius:" + string_of_dimension(param[0]); 843 | case 60 : 844 | return "border-style:" + string_of_borderStyle(param[0]); 845 | case 61 : 846 | return "opacity:" + ("" + (String(param[0]) + "")); 847 | case 62 : 848 | return "elevation:" + ("" + (String(param[0]) + "")); 849 | case 63 : 850 | return "color:" + string_of_color(param[0]); 851 | case 64 : 852 | return "font-family:" + param[0]; 853 | case 65 : 854 | return "font-size:" + ("" + (String(param[0]) + "")); 855 | case 66 : 856 | return "font-style:" + string_of_fontStyle(param[0]); 857 | case 67 : 858 | return "font-weight:" + string_of_fontWeight(param[0]); 859 | case 68 : 860 | return "font-variant:" + string_of_fontVariant(param[0]); 861 | case 69 : 862 | return "text-shadow-radius:" + ("" + (String(param[0]) + "")); 863 | case 70 : 864 | return "text-shadow-color:" + string_of_color(param[0]); 865 | case 71 : 866 | return "letter-spacing:" + ("" + (String(param[0]) + "")); 867 | case 72 : 868 | return "line-height:" + ("" + (String(param[0]) + "")); 869 | case 73 : 870 | return "text-align:" + string_of_textAlign(param[0]); 871 | case 74 : 872 | return "text-align-vertical:" + string_of_textAlignVertical(param[0]); 873 | case 75 : 874 | return "includefontpadding:" + Pervasives.string_of_bool(param[0]); 875 | case 76 : 876 | return "text-decoration-line:" + string_of_textDecorationLine(param[0]); 877 | case 77 : 878 | return "text-decoration-color:" + string_of_color(param[0]); 879 | case 78 : 880 | return "writing-direction:" + string_of_writingDirection(param[0]); 881 | case 79 : 882 | return "resizemode:" + string_of_resizeMode(param[0]); 883 | case 80 : 884 | return "tintcolor:" + string_of_color(param[0]); 885 | case 81 : 886 | return "overlay-color" + string_of_color(param[0]); 887 | case 85 : 888 | return param[0] + ":unset"; 889 | case 86 : 890 | return param[0] + ":initial"; 891 | case 87 : 892 | return param[0] + ":inherit"; 893 | case 88 : 894 | return param[0] + (":" + param[1]); 895 | default: 896 | throw Caml_builtin_exceptions.not_found; 897 | } 898 | } 899 | 900 | var selectorTokenizer = new RegExp("[(),]|\"(?:\\\\.|[^\"\\n])*\"|'(?:\\\\.|[^'\\n])*'|\\/\\*[\\s\\S]*?\\*\\/", "g"); 901 | 902 | var splitSelector = ( 903 | function(selector) { 904 | if(selector.indexOf(',') === -1) { 905 | return [selector] 906 | } 907 | 908 | var indices = [], res = [], inParen = 0, o 909 | /*eslint-disable no-cond-assign*/ 910 | while (o = selectorTokenizer.exec(selector)) { 911 | /*eslint-enable no-cond-assign*/ 912 | switch (o[0]) { 913 | case '(': inParen++; break 914 | case ')': inParen--; break 915 | case ',': if (inParen) break; indices.push(o.index) 916 | } 917 | } 918 | for (o = indices.length; o--;){ 919 | res.unshift(selector.slice(indices[o] + 1)) 920 | selector = selector.slice(0, indices[o]) 921 | } 922 | res.unshift(selector) 923 | return res 924 | } 925 | ); 926 | 927 | var replacementRegex = new RegExp("&", "g"); 928 | 929 | function replace(str, _with) { 930 | return str.replace(replacementRegex, _with); 931 | } 932 | 933 | function joinSelectors(selectors) { 934 | var joinSelectors$1 = function (selectors) { 935 | if (selectors) { 936 | var t = selectors[1]; 937 | var x = selectors[0]; 938 | if (t) { 939 | if (t[1]) { 940 | return x.replace(replacementRegex, joinSelectors$1(t)); 941 | } else { 942 | return x.replace(replacementRegex, t[0]); 943 | } 944 | } else { 945 | return x; 946 | } 947 | } else { 948 | return ""; 949 | } 950 | }; 951 | return joinSelectors$1(List.flatten(List.map((function (selector) { 952 | return List.map((function (a) { 953 | var match = $$String.contains(a, /* "&" */38); 954 | if (match !== 0) { 955 | return a; 956 | } else { 957 | return "&" + a; 958 | } 959 | }), $$Array.to_list(Curry._1(splitSelector, selector))); 960 | }), selectors))); 961 | } 962 | 963 | function string_of_scope(scope, hash, content) { 964 | var prefix = ""; 965 | var suffix = ""; 966 | if (List.length(scope[/* mqs */0]) > 0) { 967 | prefix = "@media " + ($$String.concat(" and ", List.rev(scope[/* mqs */0])) + "{"); 968 | suffix = suffix + "}"; 969 | } 970 | if (List.length(scope[/* supps */1]) > 0) { 971 | suffix = suffix + "}"; 972 | prefix = prefix + ("@supports " + ($$String.concat(" and ", List.rev(scope[/* supps */1])) + "{")); 973 | } 974 | if (List.length(scope[/* selectors */2]) > 0) { 975 | prefix = prefix + joinSelectors(scope[/* selectors */2]).replace(replacementRegex, hash); 976 | } 977 | prefix = prefix + "{"; 978 | suffix = suffix + "}"; 979 | return prefix + (content + suffix); 980 | } 981 | 982 | var blankScope = /* record */[ 983 | /* mqs : [] */0, 984 | /* supps : [] */0, 985 | /* selectors : :: */[ 986 | "&", 987 | /* [] */0 988 | ] 989 | ]; 990 | 991 | function walk(decls, _idx, scope, _acc) { 992 | while(true) { 993 | var acc = _acc; 994 | var idx = _idx; 995 | if (decls.length - idx) { 996 | var x = Caml_array.caml_array_get(decls, (decls.length - idx | 0) - 1 | 0); 997 | switch (x.tag | 0) { 998 | case 82 : 999 | _acc = walk(x[1], 0, /* record */[ 1000 | /* mqs : :: */[ 1001 | x[0], 1002 | scope[/* mqs */0] 1003 | ], 1004 | /* supps */scope[/* supps */1], 1005 | /* selectors */scope[/* selectors */2] 1006 | ], acc); 1007 | _idx = idx + 1 | 0; 1008 | continue ; 1009 | case 83 : 1010 | _acc = walk(x[1], 0, /* record */[ 1011 | /* mqs */scope[/* mqs */0], 1012 | /* supps : :: */[ 1013 | x[0], 1014 | scope[/* supps */1] 1015 | ], 1016 | /* selectors */scope[/* selectors */2] 1017 | ], acc); 1018 | _idx = idx + 1 | 0; 1019 | continue ; 1020 | case 84 : 1021 | _acc = walk(x[1], 0, /* record */[ 1022 | /* mqs */scope[/* mqs */0], 1023 | /* supps */scope[/* supps */1], 1024 | /* selectors : :: */[ 1025 | x[0], 1026 | scope[/* selectors */2] 1027 | ] 1028 | ], acc); 1029 | _idx = idx + 1 | 0; 1030 | continue ; 1031 | default: 1032 | _acc = /* :: */[ 1033 | /* tuple */[ 1034 | scope, 1035 | x 1036 | ], 1037 | acc 1038 | ]; 1039 | _idx = idx + 1 | 0; 1040 | continue ; 1041 | 1042 | } 1043 | } else { 1044 | return acc; 1045 | } 1046 | }; 1047 | } 1048 | 1049 | function group(normalized) { 1050 | if (normalized) { 1051 | var match = normalized[0]; 1052 | var style = match[1]; 1053 | var scope = match[0]; 1054 | var l = group(normalized[1]); 1055 | if (l) { 1056 | var match$1 = l[0]; 1057 | var lastScope = match$1[0]; 1058 | if (lastScope === scope) { 1059 | return /* :: */[ 1060 | /* tuple */[ 1061 | lastScope, 1062 | /* :: */[ 1063 | style, 1064 | match$1[1] 1065 | ] 1066 | ], 1067 | l[1] 1068 | ]; 1069 | } else { 1070 | return /* :: */[ 1071 | /* tuple */[ 1072 | scope, 1073 | /* :: */[ 1074 | style, 1075 | /* [] */0 1076 | ] 1077 | ], 1078 | l 1079 | ]; 1080 | } 1081 | } else { 1082 | return /* :: */[ 1083 | /* tuple */[ 1084 | scope, 1085 | /* :: */[ 1086 | style, 1087 | /* [] */0 1088 | ] 1089 | ], 1090 | /* [] */0 1091 | ]; 1092 | } 1093 | } else { 1094 | return /* [] */0; 1095 | } 1096 | } 1097 | 1098 | function flatten(decls) { 1099 | return group(walk(decls, 0, blankScope, /* [] */0)); 1100 | } 1101 | 1102 | var global_cache = Hashtbl.create(/* None */0, 100); 1103 | 1104 | var injected_cache = Hashtbl.create(/* None */0, 100); 1105 | 1106 | var rule_cache = Hashtbl.create(/* None */0, 100); 1107 | 1108 | function flush() { 1109 | Hashtbl.reset(injected_cache); 1110 | return Hashtbl.reset(rule_cache); 1111 | } 1112 | 1113 | function insertRule(rule) { 1114 | var match = document.querySelector("style[data-nice]"); 1115 | var tag; 1116 | if (match == null) { 1117 | var tag$1 = document.createElement("style"); 1118 | tag$1.setAttribute("data-nice", ""); 1119 | document.head.appendChild(tag$1); 1120 | tag = tag$1; 1121 | } else { 1122 | tag = match; 1123 | } 1124 | if (process.env.NODE_ENV === "production") { 1125 | tag.sheet.insertRule(rule, tag.sheet.cssRules.length); 1126 | return /* () */0; 1127 | } else { 1128 | tag.appendChild(document.createTextNode(rule)); 1129 | return /* () */0; 1130 | } 1131 | } 1132 | 1133 | var alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 1134 | 1135 | function base62_of_int($$int) { 1136 | var fn = function (n, c) { 1137 | if (n !== 0) { 1138 | return fn(n / 62 | 0, Char.escaped(Caml_string.get(alphabet, n - Caml_int32.imul(62, n / 62 | 0) | 0))) + c; 1139 | } else { 1140 | return c; 1141 | } 1142 | }; 1143 | return fn(Pervasives.abs($$int), ""); 1144 | } 1145 | 1146 | function insert(nodes, hash) { 1147 | if (Hashtbl.mem(injected_cache, hash)) { 1148 | return 0; 1149 | } else { 1150 | var cssRules = List.map((function (param) { 1151 | return string_of_scope(param[0], hash, $$String.concat(";", List.map(string_of_style, param[1]))); 1152 | }), List.filter((function (param) { 1153 | return +(param[1] !== /* [] */0); 1154 | }))(nodes)); 1155 | if (isBrowser && !isTest) { 1156 | List.map(insertRule, cssRules); 1157 | } else { 1158 | Hashtbl.add(rule_cache, hash, cssRules); 1159 | } 1160 | return Hashtbl.add(injected_cache, hash, /* true */1); 1161 | } 1162 | } 1163 | 1164 | function css(decls) { 1165 | var flattened = flatten(decls); 1166 | var className = "css-" + base62_of_int(Hashtbl.hash(flattened)); 1167 | insert(flattened, "." + className); 1168 | return className; 1169 | } 1170 | 1171 | function $$global(select, decls) { 1172 | var flattened = flatten(decls); 1173 | var hash = ".raw-" + base62_of_int(Hashtbl.hash(flattened)); 1174 | if (Hashtbl.mem(injected_cache, hash)) { 1175 | return 0; 1176 | } else { 1177 | var cssRules = List.map((function (param) { 1178 | return string_of_scope(param[0], select, $$String.concat(";", List.map(string_of_style, param[1]))); 1179 | }), List.filter((function (param) { 1180 | return +(param[1] !== /* [] */0); 1181 | }))(flattened)); 1182 | if (isBrowser && !isTest) { 1183 | List.map(insertRule, cssRules); 1184 | } else { 1185 | Hashtbl.add(global_cache, hash, cssRules); 1186 | } 1187 | return Hashtbl.add(injected_cache, hash, /* true */1); 1188 | } 1189 | } 1190 | 1191 | function raw(css) { 1192 | var hash = ".raw-" + base62_of_int(Hashtbl.hash(css)); 1193 | if (Hashtbl.mem(injected_cache, hash)) { 1194 | return 0; 1195 | } else { 1196 | Hashtbl.add(injected_cache, hash, /* true */1); 1197 | if (isBrowser && !isTest) { 1198 | return insertRule(css); 1199 | } else { 1200 | return Hashtbl.add(global_cache, hash, /* :: */[ 1201 | css, 1202 | /* [] */0 1203 | ]); 1204 | } 1205 | } 1206 | } 1207 | 1208 | function keyframes() { 1209 | return /* () */0; 1210 | } 1211 | 1212 | function animation() { 1213 | return /* () */0; 1214 | } 1215 | 1216 | function fontFace() { 1217 | return /* () */0; 1218 | } 1219 | 1220 | var extractIDs = ( 1221 | function (html){ 1222 | let regex = /css\-([a-zA-Z0-9\-_]+)/gm 1223 | let match, ids = new Set(); 1224 | while((match = regex.exec(html)) !== null) { 1225 | ids.add("." + match[0]); 1226 | } 1227 | return Array.from(ids.values()); 1228 | } 1229 | ); 1230 | 1231 | function extract(_html) { 1232 | var ids = Curry._1(extractIDs, _html); 1233 | var css = [/* [] */0]; 1234 | Hashtbl.iter((function (_, v) { 1235 | css[0] = List.concat(/* :: */[ 1236 | v, 1237 | /* :: */[ 1238 | css[0], 1239 | /* [] */0 1240 | ] 1241 | ]); 1242 | return /* () */0; 1243 | }), global_cache); 1244 | $$Array.iter((function (id) { 1245 | css[0] = List.concat(/* :: */[ 1246 | Hashtbl.find(rule_cache, id), 1247 | /* :: */[ 1248 | css[0], 1249 | /* [] */0 1250 | ] 1251 | ]); 1252 | return /* () */0; 1253 | }), ids); 1254 | return /* record */[ 1255 | /* css */css[0], 1256 | /* ids */ids 1257 | ]; 1258 | } 1259 | 1260 | function rehydrate(ids) { 1261 | return $$Array.iter((function (id) { 1262 | return Hashtbl.add(injected_cache, id, /* true */1); 1263 | }), ids); 1264 | } 1265 | 1266 | var Presets = /* module */[ 1267 | /* mobile */"(min-width:400px)", 1268 | /* phablet */"(min-width:550px)", 1269 | /* tablet */"(min-width:750px)", 1270 | /* desktop */"(min-width:1000px)", 1271 | /* hd */"(min-width:1200px)" 1272 | ]; 1273 | 1274 | exports.isBrowser = isBrowser; 1275 | exports.isTest = isTest; 1276 | exports.string_of_position = string_of_position; 1277 | exports.string_of_flexDirection = string_of_flexDirection; 1278 | exports.string_of_flexWrap = string_of_flexWrap; 1279 | exports.string_of_justifyContent = string_of_justifyContent; 1280 | exports.string_of_alignItems = string_of_alignItems; 1281 | exports.string_of_alignSelf = string_of_alignSelf; 1282 | exports.string_of_alignContent = string_of_alignContent; 1283 | exports.string_of_overflow = string_of_overflow; 1284 | exports.string_of_display = string_of_display; 1285 | exports.string_of_dimension = string_of_dimension; 1286 | exports.string_of_flexBasis = string_of_flexBasis; 1287 | exports.string_of_angle = string_of_angle; 1288 | exports.string_of_transform = string_of_transform; 1289 | exports.string_of_color = string_of_color; 1290 | exports.string_of_fontWeight = string_of_fontWeight; 1291 | exports.string_of_backfaceVisibilty = string_of_backfaceVisibilty; 1292 | exports.string_of_borderStyle = string_of_borderStyle; 1293 | exports.string_of_fontStyle = string_of_fontStyle; 1294 | exports.string_of_fontVariant = string_of_fontVariant; 1295 | exports.string_of_textAlign = string_of_textAlign; 1296 | exports.string_of_textAlignVertical = string_of_textAlignVertical; 1297 | exports.string_of_textDecorationLine = string_of_textDecorationLine; 1298 | exports.string_of_textDecorationStyle = string_of_textDecorationStyle; 1299 | exports.string_of_writingDirection = string_of_writingDirection; 1300 | exports.string_of_resizeMode = string_of_resizeMode; 1301 | exports.string_of_style = string_of_style; 1302 | exports.selectorTokenizer = selectorTokenizer; 1303 | exports.splitSelector = splitSelector; 1304 | exports.replacementRegex = replacementRegex; 1305 | exports.replace = replace; 1306 | exports.joinSelectors = joinSelectors; 1307 | exports.string_of_scope = string_of_scope; 1308 | exports.blankScope = blankScope; 1309 | exports.walk = walk; 1310 | exports.group = group; 1311 | exports.flatten = flatten; 1312 | exports.global_cache = global_cache; 1313 | exports.injected_cache = injected_cache; 1314 | exports.rule_cache = rule_cache; 1315 | exports.flush = flush; 1316 | exports.insertRule = insertRule; 1317 | exports.alphabet = alphabet; 1318 | exports.base62_of_int = base62_of_int; 1319 | exports.insert = insert; 1320 | exports.css = css; 1321 | exports.$$global = $$global; 1322 | exports.raw = raw; 1323 | exports.keyframes = keyframes; 1324 | exports.animation = animation; 1325 | exports.fontFace = fontFace; 1326 | exports.extractIDs = extractIDs; 1327 | exports.extract = extract; 1328 | exports.rehydrate = rehydrate; 1329 | exports.Presets = Presets; 1330 | /* match Not a pure module */ 1331 | -------------------------------------------------------------------------------- /lib/js/src/nice_prefix.js: -------------------------------------------------------------------------------- 1 | // Generated by BUCKLESCRIPT VERSION 2.1.0, PLEASE EDIT WITH CARE 2 | 'use strict'; 3 | 4 | var List = require("bs-platform/lib/js/list.js"); 5 | var Block = require("bs-platform/lib/js/block.js"); 6 | 7 | function flex(x) { 8 | if (x.tag) { 9 | return /* :: */[ 10 | x, 11 | /* [] */0 12 | ]; 13 | } else { 14 | var match = x[0]; 15 | if (match !== 4) { 16 | if (match >= 5) { 17 | return List.map((function (x) { 18 | return /* Raw */Block.__(88, [ 19 | "display", 20 | x 21 | ]); 22 | }), /* :: */[ 23 | "-webkit-box", 24 | /* :: */[ 25 | "-moz-box", 26 | /* :: */[ 27 | "-ms-flexbox", 28 | /* :: */[ 29 | "-webkit-flex", 30 | /* :: */[ 31 | "flex", 32 | /* [] */0 33 | ] 34 | ] 35 | ] 36 | ] 37 | ]); 38 | } else { 39 | return /* :: */[ 40 | x, 41 | /* [] */0 42 | ]; 43 | } 44 | } else { 45 | return List.map((function (x) { 46 | return /* Raw */Block.__(88, [ 47 | "display", 48 | x 49 | ]); 50 | }), /* :: */[ 51 | "-webkit-inline-box", 52 | /* :: */[ 53 | "-moz-inline-box", 54 | /* :: */[ 55 | "-ms-inline-flexbox", 56 | /* :: */[ 57 | "-webkit-inline-flex", 58 | /* :: */[ 59 | "inline-flex", 60 | /* [] */0 61 | ] 62 | ] 63 | ] 64 | ] 65 | ]); 66 | } 67 | } 68 | } 69 | 70 | exports.flex = flex; 71 | /* No side effect */ 72 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bs-nice", 3 | "version": "0.1.5", 4 | "description": "css-in-reason", 5 | "scripts": { 6 | "build": "bsb -make-world", 7 | "start": "bsb -make-world -w", 8 | "clean": "bsb -clean-world", 9 | "site": "parcel site/index.html", 10 | "size": "rollup -c rollup.config.js | google-closure-compiler-js | gzip | wc -c", 11 | "test": "jest" 12 | }, 13 | "keywords": [ 14 | "reason", 15 | "bucklescript", 16 | "css" 17 | ], 18 | "repository": "https://github.com/threepointone/bs-nice", 19 | "homepage": "https://github.com/threepointone/bs-nice#readme", 20 | "bugs": "https://github.com/threepointone/bs-nice/issues", 21 | "license": "MIT", 22 | "devDependencies": { 23 | "bs-jest": "^0.3.2", 24 | "bs-platform": "2.1.0", 25 | "google-closure-compiler-js": "^20180101.0.0", 26 | "parcel-bundler": "^1.2.1", 27 | "rollup": "^0.54.0", 28 | "rollup-plugin-node-resolve": "^3.0.0" 29 | }, 30 | "jest": { 31 | "modulePathIgnorePatterns": [ 32 | "/es6/" 33 | ] 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import resolve from 'rollup-plugin-node-resolve'; 2 | 3 | export default { 4 | input: 'lib/es6/site/demo.js', 5 | output: { 6 | name: 'Nice', 7 | format: 'iife', 8 | }, 9 | plugins: [resolve({})], 10 | }; 11 | -------------------------------------------------------------------------------- /site/demo.re: -------------------------------------------------------------------------------- 1 | open Nice; 2 | 3 | let className = 4 | css([| 5 | Display(Flex), 6 | Color(Red), 7 | MediaQuery( 8 | "screen", 9 | [| 10 | Display(Block), 11 | Color(Green), 12 | Select( 13 | ":hover", 14 | [| 15 | Color(Orange), 16 | FontWeight(Bold), 17 | Overflow(Hidden), 18 | Supports("(display: flex)", [|Color(Blue)|]), 19 | Select( 20 | ":hover", 21 | [|Color(Red), Display(Block), Select(".ie6 &", [|Color(Blue)|])|] 22 | ) 23 | |] 24 | ) 25 | |] 26 | ) 27 | |]); 28 | 29 | let cls2 = css([|Width(Em(4.4))|]); 30 | 31 | global("html, body", [|Display(Block), Color(Green)|]); 32 | -------------------------------------------------------------------------------- /site/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |