mancha 0.17.0 → 0.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +11 -10
- package/.prettierrc +2 -2
- package/.vscode/extensions.json +1 -1
- package/.vscode/launch.json +33 -43
- package/README.md +144 -84
- package/dist/browser.d.ts +2 -0
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/css_gen_basic.js.map +1 -1
- package/dist/css_gen_utils.d.ts +786 -0
- package/dist/css_gen_utils.js +350 -399
- package/dist/css_gen_utils.js.map +1 -1
- package/dist/dome.d.ts +1 -0
- package/dist/dome.js +15 -0
- package/dist/dome.js.map +1 -1
- package/dist/expressions/ast.d.ts +16 -16
- package/dist/expressions/ast.test.js +89 -64
- package/dist/expressions/ast.test.js.map +1 -1
- package/dist/expressions/ast_factory.d.ts +1 -1
- package/dist/expressions/ast_factory.js +17 -17
- package/dist/expressions/ast_factory.js.map +1 -1
- package/dist/expressions/ast_factory.test.js +42 -36
- package/dist/expressions/ast_factory.test.js.map +1 -1
- package/dist/expressions/constants.js +56 -56
- package/dist/expressions/constants.js.map +1 -1
- package/dist/expressions/constants.test.js +57 -57
- package/dist/expressions/constants.test.js.map +1 -1
- package/dist/expressions/eval.d.ts +17 -17
- package/dist/expressions/eval.js +58 -60
- package/dist/expressions/eval.js.map +1 -1
- package/dist/expressions/eval.test.js +11 -8
- package/dist/expressions/eval.test.js.map +1 -1
- package/dist/expressions/expressions.test.d.ts +6 -6
- package/dist/expressions/expressions.test.js +6 -6
- package/dist/expressions/index.d.ts +6 -6
- package/dist/expressions/index.js +6 -6
- package/dist/expressions/parser.d.ts +3 -3
- package/dist/expressions/parser.js +45 -45
- package/dist/expressions/parser.js.map +1 -1
- package/dist/expressions/parser.test.js +43 -2
- package/dist/expressions/parser.test.js.map +1 -1
- package/dist/expressions/tokenizer.js +22 -25
- package/dist/expressions/tokenizer.js.map +1 -1
- package/dist/expressions/tokenizer.test.js +40 -15
- package/dist/expressions/tokenizer.test.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +1 -1
- package/dist/iterator.js.map +1 -1
- package/dist/mancha.js +1 -1
- package/dist/mancha.js.map +1 -1
- package/dist/plugins.js +96 -25
- package/dist/plugins.js.map +1 -1
- package/dist/query.js.map +1 -1
- package/dist/renderer.js +4 -2
- package/dist/renderer.js.map +1 -1
- package/dist/safe_browser.js +1 -1
- package/dist/safe_browser.js.map +1 -1
- package/dist/store.d.ts +10 -4
- package/dist/store.js +26 -10
- package/dist/store.js.map +1 -1
- package/dist/test_utils.d.ts +2 -0
- package/dist/test_utils.js +14 -1
- package/dist/test_utils.js.map +1 -1
- package/dist/trusted_attributes.js +2 -0
- package/dist/trusted_attributes.js.map +1 -1
- package/dist/type_checker.js +57 -22
- package/dist/type_checker.js.map +1 -1
- package/dist/worker.d.ts +2 -0
- package/dist/worker.js +1 -0
- package/dist/worker.js.map +1 -1
- package/docs/css.md +309 -0
- package/docs/quickstart.md +414 -241
- package/global.d.ts +2 -2
- package/gulpfile.ts +44 -0
- package/package.json +86 -84
- package/scripts/generate-css-docs.ts +263 -0
- package/tsconfig.json +42 -19
- package/tsec_exemptions.json +8 -3
- package/webpack.config.esmodule.ts +26 -0
- package/webpack.config.ts +21 -0
- package/gulpfile.js +0 -44
- package/webpack.config.esmodule.js +0 -23
- package/webpack.config.js +0 -18
package/dist/css_gen_utils.js
CHANGED
|
@@ -1,41 +1,44 @@
|
|
|
1
|
-
const MEDIA_BREAKPOINTS = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const REM_UNIT = 0.25;
|
|
8
|
-
const UNITS_SM = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
|
|
1
|
+
export const MEDIA_BREAKPOINTS = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
2
|
+
const MEDIA_ENTRIES = Object.entries(MEDIA_BREAKPOINTS);
|
|
3
|
+
export const REM_UNIT = 0.25;
|
|
4
|
+
// Generate 1-15
|
|
5
|
+
const UNITS_SM = [...Array(15)].map((_, i) => i + 1);
|
|
6
|
+
// Common larger values
|
|
9
7
|
const UNITS_LG = [16, 20, 24, 25, 28, 30, 32, 36, 40, 44, 48, 50, 52, 56, 60];
|
|
10
8
|
const UNITS_XL = [
|
|
11
9
|
64, 72, 80, 96, 100, 112, 128, 144, 160, 192, 200, 224, 256, 288, 300, 320, 384, 400, 448, 500,
|
|
12
10
|
512,
|
|
13
11
|
];
|
|
14
|
-
const UNITS_ALL = [
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
export const UNITS_ALL = [
|
|
13
|
+
...UNITS_SM,
|
|
14
|
+
...UNITS_LG,
|
|
15
|
+
...UNITS_XL,
|
|
16
|
+
...Object.values(MEDIA_BREAKPOINTS),
|
|
17
|
+
];
|
|
18
|
+
export const PERCENTS = [1, 2, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 95, 98, 99, 100];
|
|
19
|
+
export const DURATIONS = [75, 100, 150, 200, 300, 500, 700, 1000];
|
|
17
20
|
const PSEUDO_STATES = ["hover", "focus", "disabled", "active"];
|
|
18
|
-
const PROPS_SPACING = {
|
|
21
|
+
export const PROPS_SPACING = {
|
|
19
22
|
margin: "m",
|
|
20
23
|
padding: "p",
|
|
21
24
|
};
|
|
22
|
-
const PROPS_SIZING = {
|
|
25
|
+
export const PROPS_SIZING = {
|
|
23
26
|
width: "w",
|
|
24
27
|
height: "h",
|
|
25
28
|
};
|
|
26
|
-
const PROPS_POSITION = {
|
|
29
|
+
export const PROPS_POSITION = {
|
|
27
30
|
top: "top",
|
|
28
31
|
right: "right",
|
|
29
32
|
bottom: "bottom",
|
|
30
33
|
left: "left",
|
|
31
34
|
};
|
|
32
|
-
const PROPS_SIZING_MINMAX = {
|
|
35
|
+
export const PROPS_SIZING_MINMAX = {
|
|
33
36
|
"min-width": "min-w",
|
|
34
37
|
"min-height": "min-h",
|
|
35
38
|
"max-width": "max-w",
|
|
36
39
|
"max-height": "max-h",
|
|
37
40
|
};
|
|
38
|
-
const PROPS_CUSTOM = {
|
|
41
|
+
export const PROPS_CUSTOM = {
|
|
39
42
|
// Based on https://tailwindcss.com.
|
|
40
43
|
// Font family.
|
|
41
44
|
"font-mono": { "font-family": "monospace" },
|
|
@@ -270,6 +273,71 @@ const PROPS_CUSTOM = {
|
|
|
270
273
|
"bg-fixed": { "background-attachment": "fixed" },
|
|
271
274
|
"bg-local": { "background-attachment": "local" },
|
|
272
275
|
"bg-scroll": { "background-attachment": "scroll" },
|
|
276
|
+
// Screen/viewport sizing.
|
|
277
|
+
"min-h-screen": { "min-height": "100vh" },
|
|
278
|
+
"max-h-screen": { "max-height": "100vh" },
|
|
279
|
+
"min-w-screen": { "min-width": "100vw" },
|
|
280
|
+
"h-dvh": { height: "100dvh" },
|
|
281
|
+
"h-svh": { height: "100svh" },
|
|
282
|
+
"h-lvh": { height: "100lvh" },
|
|
283
|
+
"w-dvw": { width: "100dvw" },
|
|
284
|
+
"w-svw": { width: "100svw" },
|
|
285
|
+
"w-lvw": { width: "100lvw" },
|
|
286
|
+
"min-h-dvh": { "min-height": "100dvh" },
|
|
287
|
+
"min-h-svh": { "min-height": "100svh" },
|
|
288
|
+
"min-h-lvh": { "min-height": "100lvh" },
|
|
289
|
+
// Flexbox enhancements.
|
|
290
|
+
"flex-none": { flex: "none" },
|
|
291
|
+
"flex-auto": { flex: "1 1 auto" },
|
|
292
|
+
"flex-initial": { flex: "0 1 auto" },
|
|
293
|
+
grow: { "flex-grow": "1" },
|
|
294
|
+
"grow-0": { "flex-grow": "0" },
|
|
295
|
+
shrink: { "flex-shrink": "1" },
|
|
296
|
+
"shrink-0": { "flex-shrink": "0" },
|
|
297
|
+
"self-auto": { "align-self": "auto" },
|
|
298
|
+
"self-start": { "align-self": "flex-start" },
|
|
299
|
+
"self-end": { "align-self": "flex-end" },
|
|
300
|
+
"self-center": { "align-self": "center" },
|
|
301
|
+
"self-stretch": { "align-self": "stretch" },
|
|
302
|
+
"self-baseline": { "align-self": "baseline" },
|
|
303
|
+
"content-normal": { "align-content": "normal" },
|
|
304
|
+
"content-start": { "align-content": "flex-start" },
|
|
305
|
+
"content-end": { "align-content": "flex-end" },
|
|
306
|
+
"content-center": { "align-content": "center" },
|
|
307
|
+
"content-between": { "align-content": "space-between" },
|
|
308
|
+
"content-around": { "align-content": "space-around" },
|
|
309
|
+
"content-evenly": { "align-content": "space-evenly" },
|
|
310
|
+
"content-stretch": { "align-content": "stretch" },
|
|
311
|
+
"items-baseline": { "align-items": "baseline" },
|
|
312
|
+
// Inset utilities.
|
|
313
|
+
"inset-0": { inset: "0" },
|
|
314
|
+
"inset-auto": { inset: "auto" },
|
|
315
|
+
"inset-x-0": { left: "0", right: "0" },
|
|
316
|
+
"inset-y-0": { top: "0", bottom: "0" },
|
|
317
|
+
"inset-x-auto": { left: "auto", right: "auto" },
|
|
318
|
+
"inset-y-auto": { top: "auto", bottom: "auto" },
|
|
319
|
+
// Accessibility.
|
|
320
|
+
"sr-only": {
|
|
321
|
+
position: "absolute",
|
|
322
|
+
width: "1px",
|
|
323
|
+
height: "1px",
|
|
324
|
+
padding: "0",
|
|
325
|
+
margin: "-1px",
|
|
326
|
+
overflow: "hidden",
|
|
327
|
+
clip: "rect(0, 0, 0, 0)",
|
|
328
|
+
"white-space": "nowrap",
|
|
329
|
+
"border-width": "0",
|
|
330
|
+
},
|
|
331
|
+
"not-sr-only": {
|
|
332
|
+
position: "static",
|
|
333
|
+
width: "auto",
|
|
334
|
+
height: "auto",
|
|
335
|
+
padding: "0",
|
|
336
|
+
margin: "0",
|
|
337
|
+
overflow: "visible",
|
|
338
|
+
clip: "auto",
|
|
339
|
+
"white-space": "normal",
|
|
340
|
+
},
|
|
273
341
|
};
|
|
274
342
|
const PROPS_AS_IS = [
|
|
275
343
|
`@keyframes spin {
|
|
@@ -287,544 +355,426 @@ const PROPS_AS_IS = [
|
|
|
287
355
|
50% { opacity: .5 }
|
|
288
356
|
}`,
|
|
289
357
|
];
|
|
290
|
-
const PROPS_COLORS = {
|
|
358
|
+
export const PROPS_COLORS = {
|
|
291
359
|
red: {
|
|
292
|
-
50:
|
|
293
|
-
100:
|
|
294
|
-
200:
|
|
295
|
-
300:
|
|
296
|
-
400:
|
|
297
|
-
500:
|
|
298
|
-
600:
|
|
299
|
-
700:
|
|
300
|
-
800:
|
|
301
|
-
900:
|
|
360
|
+
50: "#ffebee",
|
|
361
|
+
100: "#ffcdd2",
|
|
362
|
+
200: "#ef9a9a",
|
|
363
|
+
300: "#e57373",
|
|
364
|
+
400: "#ef5350",
|
|
365
|
+
500: "#f44336",
|
|
366
|
+
600: "#e53935",
|
|
367
|
+
700: "#d32f2f",
|
|
368
|
+
800: "#c62828",
|
|
369
|
+
900: "#b71c1c",
|
|
302
370
|
},
|
|
303
371
|
pink: {
|
|
304
|
-
50:
|
|
305
|
-
100:
|
|
306
|
-
200:
|
|
307
|
-
300:
|
|
308
|
-
400:
|
|
309
|
-
500:
|
|
310
|
-
600:
|
|
311
|
-
700:
|
|
312
|
-
800:
|
|
313
|
-
900:
|
|
372
|
+
50: "#fce4ec",
|
|
373
|
+
100: "#f8bbd0",
|
|
374
|
+
200: "#f48fb1",
|
|
375
|
+
300: "#f06292",
|
|
376
|
+
400: "#ec407a",
|
|
377
|
+
500: "#e91e63",
|
|
378
|
+
600: "#d81b60",
|
|
379
|
+
700: "#c2185b",
|
|
380
|
+
800: "#ad1457",
|
|
381
|
+
900: "#880e4f",
|
|
314
382
|
},
|
|
315
383
|
purple: {
|
|
316
|
-
50:
|
|
317
|
-
100:
|
|
318
|
-
200:
|
|
319
|
-
300:
|
|
320
|
-
400:
|
|
321
|
-
500:
|
|
322
|
-
600:
|
|
323
|
-
700:
|
|
324
|
-
800:
|
|
325
|
-
900:
|
|
384
|
+
50: "#f3e5f5",
|
|
385
|
+
100: "#e1bee7",
|
|
386
|
+
200: "#ce93d8",
|
|
387
|
+
300: "#ba68c8",
|
|
388
|
+
400: "#ab47bc",
|
|
389
|
+
500: "#9c27b0",
|
|
390
|
+
600: "#8e24aa",
|
|
391
|
+
700: "#7b1fa2",
|
|
392
|
+
800: "#6a1b9a",
|
|
393
|
+
900: "#4a148c",
|
|
326
394
|
},
|
|
327
395
|
"deep-purple": {
|
|
328
|
-
50:
|
|
329
|
-
100:
|
|
330
|
-
200:
|
|
331
|
-
300:
|
|
332
|
-
400:
|
|
333
|
-
500:
|
|
334
|
-
600:
|
|
335
|
-
700:
|
|
336
|
-
800:
|
|
337
|
-
900:
|
|
396
|
+
50: "#ede7f6",
|
|
397
|
+
100: "#d1c4e9",
|
|
398
|
+
200: "#b39ddb",
|
|
399
|
+
300: "#9575cd",
|
|
400
|
+
400: "#7e57c2",
|
|
401
|
+
500: "#673ab7",
|
|
402
|
+
600: "#5e35b1",
|
|
403
|
+
700: "#512da8",
|
|
404
|
+
800: "#4527a0",
|
|
405
|
+
900: "#311b92",
|
|
338
406
|
},
|
|
339
407
|
indigo: {
|
|
340
|
-
50:
|
|
341
|
-
100:
|
|
342
|
-
200:
|
|
343
|
-
300:
|
|
344
|
-
400:
|
|
345
|
-
500:
|
|
346
|
-
600:
|
|
347
|
-
700:
|
|
348
|
-
800:
|
|
349
|
-
900:
|
|
408
|
+
50: "#e8eaf6",
|
|
409
|
+
100: "#c5cae9",
|
|
410
|
+
200: "#9fa8da",
|
|
411
|
+
300: "#7986cb",
|
|
412
|
+
400: "#5c6bc0",
|
|
413
|
+
500: "#3f51b5",
|
|
414
|
+
600: "#3949ab",
|
|
415
|
+
700: "#303f9f",
|
|
416
|
+
800: "#283593",
|
|
417
|
+
900: "#1a237e",
|
|
350
418
|
},
|
|
351
419
|
blue: {
|
|
352
|
-
50:
|
|
353
|
-
100:
|
|
354
|
-
200:
|
|
355
|
-
300:
|
|
356
|
-
400:
|
|
357
|
-
500:
|
|
358
|
-
600:
|
|
359
|
-
700:
|
|
360
|
-
800:
|
|
361
|
-
900:
|
|
420
|
+
50: "#e3f2fd",
|
|
421
|
+
100: "#bbdefb",
|
|
422
|
+
200: "#90caf9",
|
|
423
|
+
300: "#64b5f6",
|
|
424
|
+
400: "#42a5f5",
|
|
425
|
+
500: "#2196f3",
|
|
426
|
+
600: "#1e88e5",
|
|
427
|
+
700: "#1976d2",
|
|
428
|
+
800: "#1565c0",
|
|
429
|
+
900: "#0d47a1",
|
|
362
430
|
},
|
|
363
431
|
"light-blue": {
|
|
364
|
-
50:
|
|
365
|
-
100:
|
|
366
|
-
200:
|
|
367
|
-
300:
|
|
368
|
-
400:
|
|
369
|
-
500:
|
|
370
|
-
600:
|
|
371
|
-
700:
|
|
372
|
-
800:
|
|
373
|
-
900:
|
|
432
|
+
50: "#e1f5fe",
|
|
433
|
+
100: "#b3e5fc",
|
|
434
|
+
200: "#81d4fa",
|
|
435
|
+
300: "#4fc3f7",
|
|
436
|
+
400: "#29b6f6",
|
|
437
|
+
500: "#03a9f4",
|
|
438
|
+
600: "#039be5",
|
|
439
|
+
700: "#0288d1",
|
|
440
|
+
800: "#0277bd",
|
|
441
|
+
900: "#01579b",
|
|
374
442
|
},
|
|
375
443
|
cyan: {
|
|
376
|
-
50:
|
|
377
|
-
100:
|
|
378
|
-
200:
|
|
379
|
-
300:
|
|
380
|
-
400:
|
|
381
|
-
500:
|
|
382
|
-
600:
|
|
383
|
-
700:
|
|
384
|
-
800:
|
|
385
|
-
900:
|
|
444
|
+
50: "#e0f7fa",
|
|
445
|
+
100: "#b2ebf2",
|
|
446
|
+
200: "#80deea",
|
|
447
|
+
300: "#4dd0e1",
|
|
448
|
+
400: "#26c6da",
|
|
449
|
+
500: "#00bcd4",
|
|
450
|
+
600: "#00acc1",
|
|
451
|
+
700: "#0097a7",
|
|
452
|
+
800: "#00838f",
|
|
453
|
+
900: "#006064",
|
|
386
454
|
},
|
|
387
455
|
teal: {
|
|
388
|
-
50:
|
|
389
|
-
100:
|
|
390
|
-
200:
|
|
391
|
-
300:
|
|
392
|
-
400:
|
|
393
|
-
500:
|
|
394
|
-
600:
|
|
395
|
-
700:
|
|
396
|
-
800:
|
|
397
|
-
900:
|
|
456
|
+
50: "#e0f2f1",
|
|
457
|
+
100: "#b2dfdb",
|
|
458
|
+
200: "#80cbc4",
|
|
459
|
+
300: "#4db6ac",
|
|
460
|
+
400: "#26a69a",
|
|
461
|
+
500: "#009688",
|
|
462
|
+
600: "#00897b",
|
|
463
|
+
700: "#00796b",
|
|
464
|
+
800: "#00695c",
|
|
465
|
+
900: "#004d40",
|
|
398
466
|
},
|
|
399
467
|
green: {
|
|
400
|
-
50:
|
|
401
|
-
100:
|
|
402
|
-
200:
|
|
403
|
-
300:
|
|
404
|
-
400:
|
|
405
|
-
500:
|
|
406
|
-
600:
|
|
407
|
-
700:
|
|
408
|
-
800:
|
|
409
|
-
900:
|
|
468
|
+
50: "#e8f5e9",
|
|
469
|
+
100: "#c8e6c9",
|
|
470
|
+
200: "#a5d6a7",
|
|
471
|
+
300: "#81c784",
|
|
472
|
+
400: "#66bb6a",
|
|
473
|
+
500: "#4caf50",
|
|
474
|
+
600: "#43a047",
|
|
475
|
+
700: "#388e3c",
|
|
476
|
+
800: "#2e7d32",
|
|
477
|
+
900: "#1b5e20",
|
|
410
478
|
},
|
|
411
479
|
"light-green": {
|
|
412
|
-
50:
|
|
413
|
-
100:
|
|
414
|
-
200:
|
|
415
|
-
300:
|
|
416
|
-
400:
|
|
417
|
-
500:
|
|
418
|
-
600:
|
|
419
|
-
700:
|
|
420
|
-
800:
|
|
421
|
-
900:
|
|
480
|
+
50: "#f1f8e9",
|
|
481
|
+
100: "#dcedc8",
|
|
482
|
+
200: "#c5e1a5",
|
|
483
|
+
300: "#aed581",
|
|
484
|
+
400: "#9ccc65",
|
|
485
|
+
500: "#8bc34a",
|
|
486
|
+
600: "#7cb342",
|
|
487
|
+
700: "#689f38",
|
|
488
|
+
800: "#558b2f",
|
|
489
|
+
900: "#33691e",
|
|
422
490
|
},
|
|
423
491
|
lime: {
|
|
424
|
-
50:
|
|
425
|
-
100:
|
|
426
|
-
200:
|
|
427
|
-
300:
|
|
428
|
-
400:
|
|
429
|
-
500:
|
|
430
|
-
600:
|
|
431
|
-
700:
|
|
432
|
-
800:
|
|
433
|
-
900:
|
|
492
|
+
50: "#f9fbe7",
|
|
493
|
+
100: "#f0f4c3",
|
|
494
|
+
200: "#e6ee9c",
|
|
495
|
+
300: "#dce775",
|
|
496
|
+
400: "#d4e157",
|
|
497
|
+
500: "#cddc39",
|
|
498
|
+
600: "#c0ca33",
|
|
499
|
+
700: "#afb42b",
|
|
500
|
+
800: "#9e9d24",
|
|
501
|
+
900: "#827717",
|
|
434
502
|
},
|
|
435
503
|
yellow: {
|
|
436
|
-
50:
|
|
437
|
-
100:
|
|
438
|
-
200:
|
|
439
|
-
300:
|
|
440
|
-
400:
|
|
441
|
-
500:
|
|
442
|
-
600:
|
|
443
|
-
700:
|
|
444
|
-
800:
|
|
445
|
-
900:
|
|
504
|
+
50: "#fffde7",
|
|
505
|
+
100: "#fff9c4",
|
|
506
|
+
200: "#fff59d",
|
|
507
|
+
300: "#fff176",
|
|
508
|
+
400: "#ffee58",
|
|
509
|
+
500: "#ffeb3b",
|
|
510
|
+
600: "#fdd835",
|
|
511
|
+
700: "#fbc02d",
|
|
512
|
+
800: "#f9a825",
|
|
513
|
+
900: "#f57f17",
|
|
446
514
|
},
|
|
447
515
|
amber: {
|
|
448
|
-
50:
|
|
449
|
-
100:
|
|
450
|
-
200:
|
|
451
|
-
300:
|
|
452
|
-
400:
|
|
453
|
-
500:
|
|
454
|
-
600:
|
|
455
|
-
700:
|
|
456
|
-
800:
|
|
457
|
-
900:
|
|
516
|
+
50: "#fff8e1",
|
|
517
|
+
100: "#ffecb3",
|
|
518
|
+
200: "#ffe082",
|
|
519
|
+
300: "#ffd54f",
|
|
520
|
+
400: "#ffca28",
|
|
521
|
+
500: "#ffc107",
|
|
522
|
+
600: "#ffb300",
|
|
523
|
+
700: "#ffa000",
|
|
524
|
+
800: "#ff8f00",
|
|
525
|
+
900: "#ff6f00",
|
|
458
526
|
},
|
|
459
527
|
orange: {
|
|
460
|
-
50:
|
|
461
|
-
100:
|
|
462
|
-
200:
|
|
463
|
-
300:
|
|
464
|
-
400:
|
|
465
|
-
500:
|
|
466
|
-
600:
|
|
467
|
-
700:
|
|
468
|
-
800:
|
|
469
|
-
900:
|
|
528
|
+
50: "#fff3e0",
|
|
529
|
+
100: "#ffe0b2",
|
|
530
|
+
200: "#ffcc80",
|
|
531
|
+
300: "#ffb74d",
|
|
532
|
+
400: "#ffa726",
|
|
533
|
+
500: "#ff9800",
|
|
534
|
+
600: "#fb8c00",
|
|
535
|
+
700: "#f57c00",
|
|
536
|
+
800: "#ef6c00",
|
|
537
|
+
900: "#e65100",
|
|
470
538
|
},
|
|
471
539
|
"deep-orange": {
|
|
472
|
-
50:
|
|
473
|
-
100:
|
|
474
|
-
200:
|
|
475
|
-
300:
|
|
476
|
-
400:
|
|
477
|
-
500:
|
|
478
|
-
600:
|
|
479
|
-
700:
|
|
480
|
-
800:
|
|
481
|
-
900:
|
|
540
|
+
50: "#fbe9e7",
|
|
541
|
+
100: "#ffccbc",
|
|
542
|
+
200: "#ffab91",
|
|
543
|
+
300: "#ff8a65",
|
|
544
|
+
400: "#ff7043",
|
|
545
|
+
500: "#ff5722",
|
|
546
|
+
600: "#f4511e",
|
|
547
|
+
700: "#e64a19",
|
|
548
|
+
800: "#d84315",
|
|
549
|
+
900: "#bf360c",
|
|
482
550
|
},
|
|
483
551
|
brown: {
|
|
484
|
-
50:
|
|
485
|
-
100:
|
|
486
|
-
200:
|
|
487
|
-
300:
|
|
488
|
-
400:
|
|
489
|
-
500:
|
|
490
|
-
600:
|
|
491
|
-
700:
|
|
492
|
-
800:
|
|
493
|
-
900:
|
|
552
|
+
50: "#efebe9",
|
|
553
|
+
100: "#d7ccc8",
|
|
554
|
+
200: "#bcaaa4",
|
|
555
|
+
300: "#a1887f",
|
|
556
|
+
400: "#8d6e63",
|
|
557
|
+
500: "#795548",
|
|
558
|
+
600: "#6d4c41",
|
|
559
|
+
700: "#5d4037",
|
|
560
|
+
800: "#4e342e",
|
|
561
|
+
900: "#3e2723",
|
|
494
562
|
},
|
|
495
563
|
gray: {
|
|
496
|
-
50:
|
|
497
|
-
100:
|
|
498
|
-
200:
|
|
499
|
-
300:
|
|
500
|
-
400:
|
|
501
|
-
500:
|
|
502
|
-
600:
|
|
503
|
-
700:
|
|
504
|
-
800:
|
|
505
|
-
900:
|
|
564
|
+
50: "#fafafa",
|
|
565
|
+
100: "#f5f5f5",
|
|
566
|
+
200: "#eeeeee",
|
|
567
|
+
300: "#e0e0e0",
|
|
568
|
+
400: "#bdbdbd",
|
|
569
|
+
500: "#9e9e9e",
|
|
570
|
+
600: "#757575",
|
|
571
|
+
700: "#616161",
|
|
572
|
+
800: "#424242",
|
|
573
|
+
900: "#212121",
|
|
506
574
|
},
|
|
507
575
|
"blue-gray": {
|
|
508
|
-
50:
|
|
509
|
-
100:
|
|
510
|
-
200:
|
|
511
|
-
300:
|
|
512
|
-
400:
|
|
513
|
-
500:
|
|
514
|
-
600:
|
|
515
|
-
700:
|
|
516
|
-
800:
|
|
517
|
-
900:
|
|
576
|
+
50: "#eceff1",
|
|
577
|
+
100: "#cfd8dc",
|
|
578
|
+
200: "#b0bec5",
|
|
579
|
+
300: "#90a4ae",
|
|
580
|
+
400: "#78909c",
|
|
581
|
+
500: "#607d8b",
|
|
582
|
+
600: "#546e7a",
|
|
583
|
+
700: "#455a64",
|
|
584
|
+
800: "#37474f",
|
|
585
|
+
900: "#263238",
|
|
518
586
|
},
|
|
519
587
|
};
|
|
520
|
-
function hexColor(color) {
|
|
521
|
-
return `#${color.toString(16).padStart(6, "0")}`;
|
|
522
|
-
}
|
|
523
588
|
function wrapPseudoStates(klass) {
|
|
524
589
|
return PSEUDO_STATES.map((state) => `.${state}\\:${klass}:${state}`);
|
|
525
590
|
}
|
|
526
591
|
function wrapMediaQueries(klass, rule) {
|
|
527
|
-
return
|
|
592
|
+
return MEDIA_ENTRIES.map(([bp, width]) => `@media (min-width: ${width}px) { .${bp}\\:${klass} { ${rule} } }`);
|
|
593
|
+
}
|
|
594
|
+
function wrapAll(pairs) {
|
|
595
|
+
return pairs.flatMap(([klass, rule]) => [
|
|
596
|
+
`.${klass} { ${rule} }`,
|
|
597
|
+
`${wrapPseudoStates(klass).join(",")} { ${rule} }`,
|
|
598
|
+
...wrapMediaQueries(klass, rule),
|
|
599
|
+
]);
|
|
528
600
|
}
|
|
529
601
|
function ruleSorter(a, b) {
|
|
530
|
-
//
|
|
531
|
-
|
|
602
|
+
// Media queries start with '@', regular rules start with '.'
|
|
603
|
+
const aMedia = a[0] === "@";
|
|
604
|
+
const bMedia = b[0] === "@";
|
|
605
|
+
if (aMedia && !bMedia)
|
|
532
606
|
return 1;
|
|
533
|
-
|
|
534
|
-
else if (!a.includes("@media") && b.includes("@media")) {
|
|
607
|
+
if (!aMedia && bMedia)
|
|
535
608
|
return -1;
|
|
536
|
-
}
|
|
537
|
-
// Otherwise, fall back to a lexicographical sort.
|
|
538
609
|
return a.localeCompare(b);
|
|
539
610
|
}
|
|
540
611
|
function posneg(props) {
|
|
541
|
-
return Object.entries(props)
|
|
542
|
-
.flatMap(([prop, klass]) => [
|
|
543
|
-
// Zero.
|
|
612
|
+
return wrapAll(Object.entries(props).flatMap(([prop, klass]) => [
|
|
544
613
|
[`${klass}-0`, `${prop}: 0`],
|
|
545
|
-
|
|
546
|
-
[`${klass}-screen`, `${prop}: 100v${prop.includes('height') ? 'h' : 'w'}`],
|
|
547
|
-
// Full.
|
|
614
|
+
[`${klass}-screen`, `${prop}: 100v${prop.includes("height") ? "h" : "w"}`],
|
|
548
615
|
[`${klass}-full`, `${prop}: 100%`],
|
|
549
|
-
// Positive REM units.
|
|
550
616
|
...UNITS_ALL.map((v) => [`${klass}-${v}`, `${prop}: ${v * REM_UNIT}rem`]),
|
|
551
|
-
// Negative REM units.
|
|
552
617
|
...UNITS_ALL.map((v) => [`-${klass}-${v}`, `${prop}: -${v * REM_UNIT}rem`]),
|
|
553
|
-
// Positive PX units.
|
|
554
618
|
...UNITS_ALL.map((v) => [`${klass}-${v}px`, `${prop}: ${v}px`]),
|
|
555
|
-
// Negative PX units.
|
|
556
619
|
...UNITS_ALL.map((v) => [`-${klass}-${v}px`, `${prop}: -${v}px`]),
|
|
557
|
-
// Positive percent units.
|
|
558
620
|
...PERCENTS.map((v) => [`${klass}-${v}\\%`, `${prop}: ${v}%`]),
|
|
559
|
-
// Negative percent units.
|
|
560
621
|
...PERCENTS.map((v) => [`-${klass}-${v}\\%`, `${prop}: -${v}%`]),
|
|
561
|
-
])
|
|
562
|
-
.flatMap(([klass, rule]) => [
|
|
563
|
-
`.${klass} { ${rule} }`,
|
|
564
|
-
`${wrapPseudoStates(klass).join(",")} { ${rule} }`,
|
|
565
|
-
...wrapMediaQueries(klass, rule),
|
|
566
|
-
]);
|
|
622
|
+
]));
|
|
567
623
|
}
|
|
568
624
|
function autoxy(props) {
|
|
569
|
-
return Object.entries(props)
|
|
570
|
-
.flatMap(([prop, klass]) => [
|
|
571
|
-
// Auto.
|
|
625
|
+
return wrapAll(Object.entries(props).flatMap(([prop, klass]) => [
|
|
572
626
|
[`${klass}-auto`, `${prop}: auto`],
|
|
573
|
-
// Auto x-axis.
|
|
574
627
|
[`${klass}x-auto`, `${prop}-left: auto; ${prop}-right: auto;`],
|
|
575
|
-
// Auto y-axis.
|
|
576
628
|
[`${klass}y-auto`, `${prop}-top: auto; ${prop}-bottom: auto;`],
|
|
577
|
-
// Zero x-axis.
|
|
578
629
|
[`${klass}x-0`, `${prop}-left: 0; ${prop}-right: 0;`],
|
|
579
|
-
// Zero y-axis.
|
|
580
630
|
[`${klass}y-0`, `${prop}-top: 0; ${prop}-bottom: 0;`],
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
`${
|
|
584
|
-
`${prop}-left: ${v}rem; ${prop}-right: ${v}rem;`,
|
|
631
|
+
...UNITS_ALL.map((v) => [
|
|
632
|
+
`${klass}x-${v}`,
|
|
633
|
+
`${prop}-left: ${v * REM_UNIT}rem; ${prop}-right: ${v * REM_UNIT}rem;`,
|
|
585
634
|
]),
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
`${
|
|
589
|
-
`${prop}-top: ${v}rem; ${prop}-bottom: ${v}rem;`,
|
|
635
|
+
...UNITS_ALL.map((v) => [
|
|
636
|
+
`${klass}y-${v}`,
|
|
637
|
+
`${prop}-top: ${v * REM_UNIT}rem; ${prop}-bottom: ${v * REM_UNIT}rem;`,
|
|
590
638
|
]),
|
|
591
|
-
// Positive PX units x-axis.
|
|
592
639
|
...UNITS_ALL.map((v) => [`${klass}x-${v}px`, `${prop}-left: ${v}px; ${prop}-right: ${v}px;`]),
|
|
593
|
-
// Positive PX units y-axis.
|
|
594
640
|
...UNITS_ALL.map((v) => [`${klass}y-${v}px`, `${prop}-top: ${v}px; ${prop}-bottom: ${v}px;`]),
|
|
595
|
-
// Positive percent units x-axis.
|
|
596
641
|
...PERCENTS.map((v) => [`${klass}x-${v}\\%`, `${prop}-left: ${v}%; ${prop}-right: ${v}%;`]),
|
|
597
|
-
// Positive percent units y-axis.
|
|
598
642
|
...PERCENTS.map((v) => [`${klass}y-${v}\\%`, `${prop}-top: ${v}%; ${prop}-bottom: ${v}%;`]),
|
|
599
|
-
])
|
|
600
|
-
.flatMap(([klass, rule]) => [
|
|
601
|
-
`.${klass} { ${rule} }`,
|
|
602
|
-
`${wrapPseudoStates(klass).join(",")} { ${rule} }`,
|
|
603
|
-
...wrapMediaQueries(klass, rule),
|
|
604
|
-
]);
|
|
643
|
+
]));
|
|
605
644
|
}
|
|
606
645
|
function tblr(props) {
|
|
607
|
-
return Object.entries(props)
|
|
608
|
-
.flatMap(([prop, klass]) => [
|
|
609
|
-
// Zero top.
|
|
646
|
+
return wrapAll(Object.entries(props).flatMap(([prop, klass]) => [
|
|
610
647
|
[`${klass}t-0`, `${prop}-top: 0`],
|
|
611
|
-
// Zero bottom.
|
|
612
648
|
[`${klass}b-0`, `${prop}-bottom: 0`],
|
|
613
|
-
// Zero left.
|
|
614
649
|
[`${klass}l-0`, `${prop}-left: 0`],
|
|
615
|
-
// Zero right.
|
|
616
650
|
[`${klass}r-0`, `${prop}-right: 0`],
|
|
617
|
-
// Auto top.
|
|
618
651
|
[`${klass}t-auto`, `${prop}-top: auto`],
|
|
619
|
-
// Auto bottom.
|
|
620
652
|
[`${klass}b-auto`, `${prop}-bottom: auto`],
|
|
621
|
-
// Auto left.
|
|
622
653
|
[`${klass}l-auto`, `${prop}-left: auto`],
|
|
623
|
-
// Auto right.
|
|
624
654
|
[`${klass}r-auto`, `${prop}-right: auto`],
|
|
625
|
-
// Positive / Negative.
|
|
626
655
|
...["", "-"].flatMap((sign) => [
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
`${
|
|
630
|
-
`${prop}-top: ${sign}${v}rem`,
|
|
656
|
+
...UNITS_ALL.map((v) => [
|
|
657
|
+
`${sign}${klass}t-${v}`,
|
|
658
|
+
`${prop}-top: ${sign}${v * REM_UNIT}rem`,
|
|
631
659
|
]),
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
`${
|
|
635
|
-
`${prop}-bottom: ${sign}${v}rem`,
|
|
660
|
+
...UNITS_ALL.map((v) => [
|
|
661
|
+
`${sign}${klass}b-${v}`,
|
|
662
|
+
`${prop}-bottom: ${sign}${v * REM_UNIT}rem`,
|
|
636
663
|
]),
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
`${
|
|
640
|
-
`${prop}-left: ${sign}${v}rem`,
|
|
664
|
+
...UNITS_ALL.map((v) => [
|
|
665
|
+
`${sign}${klass}l-${v}`,
|
|
666
|
+
`${prop}-left: ${sign}${v * REM_UNIT}rem`,
|
|
641
667
|
]),
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
`${
|
|
645
|
-
`${prop}-right: ${sign}${v}rem`,
|
|
668
|
+
...UNITS_ALL.map((v) => [
|
|
669
|
+
`${sign}${klass}r-${v}`,
|
|
670
|
+
`${prop}-right: ${sign}${v * REM_UNIT}rem`,
|
|
646
671
|
]),
|
|
647
|
-
// PX units top.
|
|
648
672
|
...UNITS_ALL.map((v) => [`${sign}${klass}t-${v}px`, `${prop}-top: ${sign}${v}px`]),
|
|
649
|
-
// PX units bottom.
|
|
650
673
|
...UNITS_ALL.map((v) => [`${sign}${klass}b-${v}px`, `${prop}-bottom: ${sign}${v}px`]),
|
|
651
|
-
// PX units left.
|
|
652
674
|
...UNITS_ALL.map((v) => [`${sign}${klass}l-${v}px`, `${prop}-left: ${sign}${v}px`]),
|
|
653
|
-
// PX units right.
|
|
654
675
|
...UNITS_ALL.map((v) => [`${sign}${klass}r-${v}px`, `${prop}-right: ${sign}${v}px`]),
|
|
655
|
-
// Percent units top.
|
|
656
676
|
...PERCENTS.map((v) => [`${sign}${klass}t-${v}\\%`, `${prop}-top: ${sign}${v}%`]),
|
|
657
|
-
|
|
658
|
-
...PERCENTS.map((v) => [`${sign}${klass}b-${v}\\%`, `${prop}-bottom: ${sign}${v}%;`]),
|
|
659
|
-
// Percent units left.
|
|
677
|
+
...PERCENTS.map((v) => [`${sign}${klass}b-${v}\\%`, `${prop}-bottom: ${sign}${v}%`]),
|
|
660
678
|
...PERCENTS.map((v) => [`${sign}${klass}l-${v}\\%`, `${prop}-left: ${sign}${v}%`]),
|
|
661
|
-
// Percent units right.
|
|
662
679
|
...PERCENTS.map((v) => [`${sign}${klass}r-${v}\\%`, `${prop}-right: ${sign}${v}%`]),
|
|
663
680
|
]),
|
|
664
|
-
])
|
|
665
|
-
.flatMap(([klass, rule]) => [
|
|
666
|
-
`.${klass} { ${rule} }`,
|
|
667
|
-
`${wrapPseudoStates(klass).join(",")} { ${rule} }`,
|
|
668
|
-
...wrapMediaQueries(klass, rule),
|
|
669
|
-
]);
|
|
681
|
+
]));
|
|
670
682
|
}
|
|
671
683
|
function border() {
|
|
672
|
-
return [
|
|
673
|
-
// Single pixel border.
|
|
684
|
+
return wrapAll([
|
|
674
685
|
[`border`, `border: 1px`],
|
|
675
|
-
// Single pixel border x and y.
|
|
676
686
|
[`border-x`, `border-inline-width: 1px`],
|
|
677
687
|
[`border-y`, `border-block-width: 1px`],
|
|
678
|
-
// Pixel units for border width.
|
|
679
688
|
...[0, ...UNITS_SM].map((v) => [`border-${v}`, `border-width: ${v}px`]),
|
|
680
|
-
// Pixel units for border x and y.
|
|
681
689
|
...[0, ...UNITS_SM].map((v) => [`border-x-${v}`, `border-inline-width: ${v}px;`]),
|
|
682
690
|
...[0, ...UNITS_SM].map((v) => [`border-y-${v}`, `border-block-width: ${v}px;`]),
|
|
683
|
-
// TBLR border.
|
|
684
691
|
...["top", "bottom", "left", "right"].flatMap((dir) => [
|
|
685
|
-
// Single pixel border.
|
|
686
692
|
[`border-${dir.slice(0, 1)}`, `border-${dir}: 1px`],
|
|
687
|
-
// Pixel units for border width.
|
|
688
693
|
...[0, ...UNITS_SM].map((v) => [
|
|
689
694
|
`border-${dir.slice(0, 1)}-${v}`,
|
|
690
695
|
`border-${dir}-width: ${v}px`,
|
|
691
696
|
]),
|
|
692
697
|
]),
|
|
693
|
-
].flatMap(([klass, rule]) => [
|
|
694
|
-
`.${klass} { ${rule} }`,
|
|
695
|
-
`${wrapPseudoStates(klass).join(",")} { ${rule} }`,
|
|
696
|
-
...wrapMediaQueries(klass, rule),
|
|
697
698
|
]);
|
|
698
699
|
}
|
|
699
700
|
function zIndex() {
|
|
700
|
-
return [
|
|
701
|
-
// Percent units reused as values for z-index.
|
|
702
|
-
...PERCENTS.map((v) => [`z-${v}`, `z-index: ${v}`]),
|
|
703
|
-
].flatMap(([klass, rule]) => [
|
|
704
|
-
`.${klass} { ${rule} }`,
|
|
705
|
-
`${wrapPseudoStates(klass).join(",")} { ${rule} }`,
|
|
706
|
-
...wrapMediaQueries(klass, rule),
|
|
707
|
-
]);
|
|
701
|
+
return wrapAll(PERCENTS.map((v) => [`z-${v}`, `z-index: ${v}`]));
|
|
708
702
|
}
|
|
709
703
|
function transitions() {
|
|
710
|
-
return [
|
|
711
|
-
// Positive milliseconds for transition.
|
|
712
|
-
...DURATIONS.map((v) => [`duration-${v}`, `transition-duration: ${v}ms`]),
|
|
713
|
-
].flatMap(([klass, rule]) => [
|
|
714
|
-
`.${klass} { ${rule} }`,
|
|
715
|
-
`${wrapPseudoStates(klass).join(",")} { ${rule} }`,
|
|
716
|
-
...wrapMediaQueries(klass, rule),
|
|
717
|
-
]);
|
|
704
|
+
return wrapAll(DURATIONS.map((v) => [`duration-${v}`, `transition-duration: ${v}ms`]));
|
|
718
705
|
}
|
|
719
706
|
function between() {
|
|
720
|
-
return [
|
|
721
|
-
// Zero for x margin.
|
|
707
|
+
return wrapAll([
|
|
722
708
|
[`space-x-0 > *`, `margin-left: 0`],
|
|
723
|
-
// Zero for y margin.
|
|
724
709
|
[`space-y-0 > *`, `margin-top: 0`],
|
|
725
|
-
// Positive REM units for x margin.
|
|
726
710
|
...UNITS_ALL.map((v) => [
|
|
727
711
|
`space-x-${v} > :not(:first-child)`,
|
|
728
712
|
`margin-left: ${v * REM_UNIT}rem`,
|
|
729
713
|
]),
|
|
730
|
-
// Positive REM units for y margin.
|
|
731
714
|
...UNITS_ALL.map((v) => [
|
|
732
715
|
`space-y-${v} > :not(:first-child)`,
|
|
733
716
|
`margin-top: ${v * REM_UNIT}rem`,
|
|
734
717
|
]),
|
|
735
|
-
// Positive PX units for x margin.
|
|
736
718
|
...UNITS_ALL.map((v) => [`space-x-${v}px > :not(:first-child)`, `margin-left: ${v}px`]),
|
|
737
|
-
// Positive PX units for y margin.
|
|
738
719
|
...UNITS_ALL.map((v) => [`space-y-${v}px > :not(:first-child)`, `margin-top: ${v}px`]),
|
|
739
|
-
// Zero for gap.
|
|
740
720
|
[`gap-0`, `gap: 0`],
|
|
741
|
-
// Positive REM units for gap.
|
|
742
721
|
...UNITS_ALL.map((v) => [`gap-${v}`, `gap: ${v * REM_UNIT}rem`]),
|
|
743
|
-
// Positive PX units for gap.
|
|
744
722
|
...UNITS_ALL.map((v) => [`gap-${v}px`, `gap: ${v}px`]),
|
|
745
|
-
// Positive REM units for col gap.
|
|
746
723
|
...UNITS_ALL.map((v) => [`gap-x-${v}`, `column-gap: ${v * REM_UNIT}rem`]),
|
|
747
|
-
// Positive REM units for row gap.
|
|
748
724
|
...UNITS_ALL.map((v) => [`gap-y-${v}`, `row-gap: ${v * REM_UNIT}rem`]),
|
|
749
|
-
// Positive PX units for col gap.
|
|
750
725
|
...UNITS_ALL.map((v) => [`gap-x-${v}px`, `column-gap: ${v}px`]),
|
|
751
|
-
// Positive PX units for row gap.
|
|
752
726
|
...UNITS_ALL.map((v) => [`gap-y-${v}px`, `row-gap: ${v}px`]),
|
|
753
|
-
].flatMap(([klass, rule]) => [
|
|
754
|
-
`.${klass} { ${rule} }`,
|
|
755
|
-
`${wrapPseudoStates(klass).join(",")} { ${rule} }`,
|
|
756
|
-
...wrapMediaQueries(klass, rule),
|
|
757
727
|
]);
|
|
758
728
|
}
|
|
759
729
|
function textSizes() {
|
|
760
|
-
return [
|
|
761
|
-
|
|
762
|
-
...Array.from({ length: 100 }, (_, i) =>
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
`text-${v}rem`,
|
|
766
|
-
`font-size: ${v}rem`,
|
|
730
|
+
return wrapAll([
|
|
731
|
+
...Array.from({ length: 100 }, (_, i) => [`text-${i}px`, `font-size: ${i}px`]),
|
|
732
|
+
...Array.from({ length: 100 }, (_, i) => [
|
|
733
|
+
`text-${i * REM_UNIT}rem`,
|
|
734
|
+
`font-size: ${i * REM_UNIT}rem`,
|
|
767
735
|
]),
|
|
768
|
-
].flatMap(([klass, rule]) => [
|
|
769
|
-
`.${klass} { ${rule} }`,
|
|
770
|
-
`${wrapPseudoStates(klass).join(",")} { ${rule} }`,
|
|
771
|
-
...wrapMediaQueries(klass, rule),
|
|
772
736
|
]);
|
|
773
737
|
}
|
|
774
738
|
function custom() {
|
|
775
|
-
return Object.entries(PROPS_CUSTOM).flatMap(([klass, props]) =>
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
739
|
+
return Object.entries(PROPS_CUSTOM).flatMap(([klass, props]) => {
|
|
740
|
+
const rules = Object.entries(props)
|
|
741
|
+
.map(([k, v]) => `${k}: ${v}`)
|
|
742
|
+
.join("; ");
|
|
743
|
+
return [
|
|
744
|
+
`.${klass} { ${rules} }`,
|
|
745
|
+
`${wrapPseudoStates(klass).join(",")} { ${rules} }`,
|
|
746
|
+
...wrapMediaQueries(klass, rules),
|
|
747
|
+
];
|
|
748
|
+
});
|
|
780
749
|
}
|
|
781
750
|
function colors() {
|
|
782
|
-
const
|
|
783
|
-
["white", "#fff"],
|
|
784
|
-
["black", "#000"],
|
|
785
|
-
["transparent", "transparent"],
|
|
786
|
-
].flatMap(([color, value]) => [
|
|
751
|
+
const colorVariants = (color, value) => [
|
|
787
752
|
[`text-${color}`, `color: ${value}`],
|
|
788
753
|
[`fill-${color}`, `fill: ${value}`],
|
|
789
754
|
[`bg-${color}`, `background-color: ${value}`],
|
|
790
755
|
[`border-${color}`, `border-color: ${value}`],
|
|
791
|
-
]
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
[
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
[`fill-${color}-${shade}`, `fill: ${hexColor(hex)}`],
|
|
801
|
-
[`bg-${color}-${shade}`, `background-color: ${hexColor(hex)}`],
|
|
802
|
-
[`border-${color}-${shade}`, `border-color: ${hexColor(hex)}`],
|
|
803
|
-
]));
|
|
804
|
-
return []
|
|
805
|
-
.concat(bw)
|
|
806
|
-
.concat(mains)
|
|
807
|
-
.concat(shades)
|
|
808
|
-
.flatMap(([klass, rule]) => [
|
|
809
|
-
`.${klass} { ${rule} }`,
|
|
810
|
-
`${wrapPseudoStates(klass).join(",")} { ${rule} }`,
|
|
811
|
-
...wrapMediaQueries(klass, rule),
|
|
756
|
+
];
|
|
757
|
+
return wrapAll([
|
|
758
|
+
...colorVariants("white", "#fff"),
|
|
759
|
+
...colorVariants("black", "#000"),
|
|
760
|
+
...colorVariants("transparent", "transparent"),
|
|
761
|
+
...Object.entries(PROPS_COLORS).flatMap(([color, shades]) => [
|
|
762
|
+
...colorVariants(color, shades[500]),
|
|
763
|
+
...Object.entries(shades).flatMap(([shade, hex]) => colorVariants(`${color}-${shade}`, hex)),
|
|
764
|
+
]),
|
|
812
765
|
]);
|
|
813
766
|
}
|
|
814
767
|
function opacity() {
|
|
815
|
-
return [
|
|
816
|
-
// Zero for opacity.
|
|
768
|
+
return wrapAll([
|
|
817
769
|
[`opacity-0`, `opacity: 0`],
|
|
818
|
-
// Positive percent units for opacity.
|
|
819
770
|
...PERCENTS.map((v) => [`opacity-${v}`, `opacity: ${v / 100}`]),
|
|
820
|
-
].flatMap(([klass, rule]) => [
|
|
821
|
-
`.${klass} { ${rule} }`,
|
|
822
|
-
`${wrapPseudoStates(klass).join(",")} { ${rule} }`,
|
|
823
|
-
...wrapMediaQueries(klass, rule),
|
|
824
771
|
]);
|
|
825
772
|
}
|
|
773
|
+
let cachedRules = null;
|
|
826
774
|
export default function rules() {
|
|
827
|
-
|
|
775
|
+
if (cachedRules !== null)
|
|
776
|
+
return cachedRules;
|
|
777
|
+
cachedRules = [
|
|
828
778
|
// As-is.
|
|
829
779
|
...PROPS_AS_IS,
|
|
830
780
|
// Custom.
|
|
@@ -856,6 +806,7 @@ export default function rules() {
|
|
|
856
806
|
]
|
|
857
807
|
// Sort lexicographical to ensure media queries appear after their base rules.
|
|
858
808
|
.sort(ruleSorter)
|
|
859
|
-
.join("\n")
|
|
809
|
+
.join("\n");
|
|
810
|
+
return cachedRules;
|
|
860
811
|
}
|
|
861
812
|
//# sourceMappingURL=css_gen_utils.js.map
|