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.
Files changed (86) hide show
  1. package/.github/workflows/ci.yml +11 -10
  2. package/.prettierrc +2 -2
  3. package/.vscode/extensions.json +1 -1
  4. package/.vscode/launch.json +33 -43
  5. package/README.md +144 -84
  6. package/dist/browser.d.ts +2 -0
  7. package/dist/browser.js +1 -1
  8. package/dist/browser.js.map +1 -1
  9. package/dist/cli.js.map +1 -1
  10. package/dist/css_gen_basic.js.map +1 -1
  11. package/dist/css_gen_utils.d.ts +786 -0
  12. package/dist/css_gen_utils.js +350 -399
  13. package/dist/css_gen_utils.js.map +1 -1
  14. package/dist/dome.d.ts +1 -0
  15. package/dist/dome.js +15 -0
  16. package/dist/dome.js.map +1 -1
  17. package/dist/expressions/ast.d.ts +16 -16
  18. package/dist/expressions/ast.test.js +89 -64
  19. package/dist/expressions/ast.test.js.map +1 -1
  20. package/dist/expressions/ast_factory.d.ts +1 -1
  21. package/dist/expressions/ast_factory.js +17 -17
  22. package/dist/expressions/ast_factory.js.map +1 -1
  23. package/dist/expressions/ast_factory.test.js +42 -36
  24. package/dist/expressions/ast_factory.test.js.map +1 -1
  25. package/dist/expressions/constants.js +56 -56
  26. package/dist/expressions/constants.js.map +1 -1
  27. package/dist/expressions/constants.test.js +57 -57
  28. package/dist/expressions/constants.test.js.map +1 -1
  29. package/dist/expressions/eval.d.ts +17 -17
  30. package/dist/expressions/eval.js +58 -60
  31. package/dist/expressions/eval.js.map +1 -1
  32. package/dist/expressions/eval.test.js +11 -8
  33. package/dist/expressions/eval.test.js.map +1 -1
  34. package/dist/expressions/expressions.test.d.ts +6 -6
  35. package/dist/expressions/expressions.test.js +6 -6
  36. package/dist/expressions/index.d.ts +6 -6
  37. package/dist/expressions/index.js +6 -6
  38. package/dist/expressions/parser.d.ts +3 -3
  39. package/dist/expressions/parser.js +45 -45
  40. package/dist/expressions/parser.js.map +1 -1
  41. package/dist/expressions/parser.test.js +43 -2
  42. package/dist/expressions/parser.test.js.map +1 -1
  43. package/dist/expressions/tokenizer.js +22 -25
  44. package/dist/expressions/tokenizer.js.map +1 -1
  45. package/dist/expressions/tokenizer.test.js +40 -15
  46. package/dist/expressions/tokenizer.test.js.map +1 -1
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.js +1 -0
  49. package/dist/index.js.map +1 -1
  50. package/dist/interfaces.d.ts +1 -1
  51. package/dist/iterator.js.map +1 -1
  52. package/dist/mancha.js +1 -1
  53. package/dist/mancha.js.map +1 -1
  54. package/dist/plugins.js +96 -25
  55. package/dist/plugins.js.map +1 -1
  56. package/dist/query.js.map +1 -1
  57. package/dist/renderer.js +4 -2
  58. package/dist/renderer.js.map +1 -1
  59. package/dist/safe_browser.js +1 -1
  60. package/dist/safe_browser.js.map +1 -1
  61. package/dist/store.d.ts +10 -4
  62. package/dist/store.js +26 -10
  63. package/dist/store.js.map +1 -1
  64. package/dist/test_utils.d.ts +2 -0
  65. package/dist/test_utils.js +14 -1
  66. package/dist/test_utils.js.map +1 -1
  67. package/dist/trusted_attributes.js +2 -0
  68. package/dist/trusted_attributes.js.map +1 -1
  69. package/dist/type_checker.js +57 -22
  70. package/dist/type_checker.js.map +1 -1
  71. package/dist/worker.d.ts +2 -0
  72. package/dist/worker.js +1 -0
  73. package/dist/worker.js.map +1 -1
  74. package/docs/css.md +309 -0
  75. package/docs/quickstart.md +414 -241
  76. package/global.d.ts +2 -2
  77. package/gulpfile.ts +44 -0
  78. package/package.json +86 -84
  79. package/scripts/generate-css-docs.ts +263 -0
  80. package/tsconfig.json +42 -19
  81. package/tsec_exemptions.json +8 -3
  82. package/webpack.config.esmodule.ts +26 -0
  83. package/webpack.config.ts +21 -0
  84. package/gulpfile.js +0 -44
  85. package/webpack.config.esmodule.js +0 -23
  86. package/webpack.config.js +0 -18
@@ -1,41 +1,44 @@
1
- const MEDIA_BREAKPOINTS = {
2
- sm: 640,
3
- md: 768,
4
- lg: 1024,
5
- xl: 1280,
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 = [...UNITS_SM, ...UNITS_LG, ...UNITS_XL, ...Object.values(MEDIA_BREAKPOINTS)];
15
- const PERCENTS = [1, 2, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 95, 98, 99, 100];
16
- const DURATIONS = [75, 100, 150, 200, 300, 500, 700, 1000];
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: 0xffebee,
293
- 100: 0xffcdd2,
294
- 200: 0xef9a9a,
295
- 300: 0xe57373,
296
- 400: 0xef5350,
297
- 500: 0xf44336,
298
- 600: 0xe53935,
299
- 700: 0xd32f2f,
300
- 800: 0xc62828,
301
- 900: 0xb71c1c,
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: 0xfce4ec,
305
- 100: 0xf8bbd0,
306
- 200: 0xf48fb1,
307
- 300: 0xf06292,
308
- 400: 0xec407a,
309
- 500: 0xe91e63,
310
- 600: 0xd81b60,
311
- 700: 0xc2185b,
312
- 800: 0xad1457,
313
- 900: 0x880e4f,
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: 0xf3e5f5,
317
- 100: 0xe1bee7,
318
- 200: 0xce93d8,
319
- 300: 0xba68c8,
320
- 400: 0xab47bc,
321
- 500: 0x9c27b0,
322
- 600: 0x8e24aa,
323
- 700: 0x7b1fa2,
324
- 800: 0x6a1b9a,
325
- 900: 0x4a148c,
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: 0xede7f6,
329
- 100: 0xd1c4e9,
330
- 200: 0xb39ddb,
331
- 300: 0x9575cd,
332
- 400: 0x7e57c2,
333
- 500: 0x673ab7,
334
- 600: 0x5e35b1,
335
- 700: 0x512da8,
336
- 800: 0x4527a0,
337
- 900: 0x311b92,
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: 0xe8eaf6,
341
- 100: 0xc5cae9,
342
- 200: 0x9fa8da,
343
- 300: 0x7986cb,
344
- 400: 0x5c6bc0,
345
- 500: 0x3f51b5,
346
- 600: 0x3949ab,
347
- 700: 0x303f9f,
348
- 800: 0x283593,
349
- 900: 0x1a237e,
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: 0xe3f2fd,
353
- 100: 0xbbdefb,
354
- 200: 0x90caf9,
355
- 300: 0x64b5f6,
356
- 400: 0x42a5f5,
357
- 500: 0x2196f3,
358
- 600: 0x1e88e5,
359
- 700: 0x1976d2,
360
- 800: 0x1565c0,
361
- 900: 0x0d47a1,
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: 0xe1f5fe,
365
- 100: 0xb3e5fc,
366
- 200: 0x81d4fa,
367
- 300: 0x4fc3f7,
368
- 400: 0x29b6f6,
369
- 500: 0x03a9f4,
370
- 600: 0x039be5,
371
- 700: 0x0288d1,
372
- 800: 0x0277bd,
373
- 900: 0x01579b,
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: 0xe0f7fa,
377
- 100: 0xb2ebf2,
378
- 200: 0x80deea,
379
- 300: 0x4dd0e1,
380
- 400: 0x26c6da,
381
- 500: 0x00bcd4,
382
- 600: 0x00acc1,
383
- 700: 0x0097a7,
384
- 800: 0x00838f,
385
- 900: 0x006064,
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: 0xe0f2f1,
389
- 100: 0xb2dfdb,
390
- 200: 0x80cbc4,
391
- 300: 0x4db6ac,
392
- 400: 0x26a69a,
393
- 500: 0x009688,
394
- 600: 0x00897b,
395
- 700: 0x00796b,
396
- 800: 0x00695c,
397
- 900: 0x004d40,
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: 0xe8f5e9,
401
- 100: 0xc8e6c9,
402
- 200: 0xa5d6a7,
403
- 300: 0x81c784,
404
- 400: 0x66bb6a,
405
- 500: 0x4caf50,
406
- 600: 0x43a047,
407
- 700: 0x388e3c,
408
- 800: 0x2e7d32,
409
- 900: 0x1b5e20,
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: 0xf1f8e9,
413
- 100: 0xdcedc8,
414
- 200: 0xc5e1a5,
415
- 300: 0xaed581,
416
- 400: 0x9ccc65,
417
- 500: 0x8bc34a,
418
- 600: 0x7cb342,
419
- 700: 0x689f38,
420
- 800: 0x558b2f,
421
- 900: 0x33691e,
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: 0xf9fbe7,
425
- 100: 0xf0f4c3,
426
- 200: 0xe6ee9c,
427
- 300: 0xdce775,
428
- 400: 0xd4e157,
429
- 500: 0xcddc39,
430
- 600: 0xc0ca33,
431
- 700: 0xafb42b,
432
- 800: 0x9e9d24,
433
- 900: 0x827717,
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: 0xfffde7,
437
- 100: 0xfff9c4,
438
- 200: 0xfff59d,
439
- 300: 0xfff176,
440
- 400: 0xffee58,
441
- 500: 0xffeb3b,
442
- 600: 0xfdd835,
443
- 700: 0xfbc02d,
444
- 800: 0xf9a825,
445
- 900: 0xf57f17,
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: 0xfff8e1,
449
- 100: 0xffecb3,
450
- 200: 0xffe082,
451
- 300: 0xffd54f,
452
- 400: 0xffca28,
453
- 500: 0xffc107,
454
- 600: 0xffb300,
455
- 700: 0xffa000,
456
- 800: 0xff8f00,
457
- 900: 0xff6f00,
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: 0xfff3e0,
461
- 100: 0xffe0b2,
462
- 200: 0xffcc80,
463
- 300: 0xffb74d,
464
- 400: 0xffa726,
465
- 500: 0xff9800,
466
- 600: 0xfb8c00,
467
- 700: 0xf57c00,
468
- 800: 0xef6c00,
469
- 900: 0xe65100,
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: 0xfbe9e7,
473
- 100: 0xffccbc,
474
- 200: 0xffab91,
475
- 300: 0xff8a65,
476
- 400: 0xff7043,
477
- 500: 0xff5722,
478
- 600: 0xf4511e,
479
- 700: 0xe64a19,
480
- 800: 0xd84315,
481
- 900: 0xbf360c,
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: 0xefebe9,
485
- 100: 0xd7ccc8,
486
- 200: 0xbcaaa4,
487
- 300: 0xa1887f,
488
- 400: 0x8d6e63,
489
- 500: 0x795548,
490
- 600: 0x6d4c41,
491
- 700: 0x5d4037,
492
- 800: 0x4e342e,
493
- 900: 0x3e2723,
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: 0xfafafa,
497
- 100: 0xf5f5f5,
498
- 200: 0xeeeeee,
499
- 300: 0xe0e0e0,
500
- 400: 0xbdbdbd,
501
- 500: 0x9e9e9e,
502
- 600: 0x757575,
503
- 700: 0x616161,
504
- 800: 0x424242,
505
- 900: 0x212121,
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: 0xeceff1,
509
- 100: 0xcfd8dc,
510
- 200: 0xb0bec5,
511
- 300: 0x90a4ae,
512
- 400: 0x78909c,
513
- 500: 0x607d8b,
514
- 600: 0x546e7a,
515
- 700: 0x455a64,
516
- 800: 0x37474f,
517
- 900: 0x263238,
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 Object.entries(MEDIA_BREAKPOINTS).map(([bp, width]) => `@media (min-width: ${width}px) { .${bp}\\:${klass} { ${rule} } }`);
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
- // If one rule is a media query, it goes after the base rules.
531
- if (a.includes("@media") && !b.includes("@media")) {
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
- // Screen.
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
- // Positive REM units x-axis.
582
- ...UNITS_ALL.map((v) => [v, v * REM_UNIT]).map(([k, v]) => [
583
- `${klass}x-${k}`,
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
- // Positive REM units y-axis.
587
- ...UNITS_ALL.map((v) => [v, v * REM_UNIT]).map(([k, v]) => [
588
- `${klass}y-${k}`,
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
- // REM units top.
628
- ...UNITS_ALL.map((v) => [v, v * REM_UNIT]).map(([k, v]) => [
629
- `${sign}${klass}t-${k}`,
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
- // REM units bottom.
633
- ...UNITS_ALL.map((v) => [v, v * REM_UNIT]).map(([k, v]) => [
634
- `${sign}${klass}b-${k}`,
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
- // REM units left.
638
- ...UNITS_ALL.map((v) => [v, v * REM_UNIT]).map(([k, v]) => [
639
- `${sign}${klass}l-${k}`,
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
- // REM units right.
643
- ...UNITS_ALL.map((v) => [v, v * REM_UNIT]).map(([k, v]) => [
644
- `${sign}${klass}r-${k}`,
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
- // Percent units bottom.
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
- // 100 font sizes in single pixel increments.
762
- ...Array.from({ length: 100 }, (_, i) => i).map((v) => [`text-${v}px`, `font-size: ${v}px`]),
763
- // 100 font sizes in REM_UNIT (0.25) increments.
764
- ...Array.from({ length: 100 }, (_, i) => i * REM_UNIT).map((v) => [
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]) => Object.entries(props).flatMap(([propkey, propval]) => [
776
- `.${klass} { ${propkey}: ${propval} }`,
777
- `${wrapPseudoStates(klass).join(",")} { ${propkey}: ${propval} }`,
778
- ...wrapMediaQueries(klass, `${propkey}: ${propval}`),
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 bw = [
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
- const mains = Object.entries(PROPS_COLORS).flatMap(([color, shades]) => [
793
- [`text-${color}`, `color: ${hexColor(shades[500])}`],
794
- [`fill-${color}`, `fill: ${hexColor(shades[500])}`],
795
- [`bg-${color}`, `background-color: ${hexColor(shades[500])}`],
796
- [`border-${color}`, `border-color: ${hexColor(shades[500])}`],
797
- ]);
798
- const shades = Object.entries(PROPS_COLORS).flatMap(([color, shades]) => Object.entries(shades).flatMap(([shade, hex]) => [
799
- [`text-${color}-${shade}`, `color: ${hexColor(hex)}`],
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
- return ([
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