units.js 816 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. 'use strict';
  2. const uniteSets = require('../utils/uniteSets.js');
  3. const lengthUnits = new Set([
  4. // Relative length units
  5. 'em',
  6. 'ex',
  7. 'ch',
  8. 'rem',
  9. 'rlh',
  10. 'lh',
  11. // Viewport-percentage lengths
  12. 'dvh',
  13. 'dvmax',
  14. 'dvmin',
  15. 'dvw',
  16. 'lvh',
  17. 'lvmax',
  18. 'lvmin',
  19. 'lvw',
  20. 'svh',
  21. 'svmax',
  22. 'svmin',
  23. 'svw',
  24. 'vh',
  25. 'vw',
  26. 'vmin',
  27. 'vmax',
  28. 'vm',
  29. // Absolute length units
  30. 'px',
  31. 'mm',
  32. 'cm',
  33. 'in',
  34. 'pt',
  35. 'pc',
  36. 'q',
  37. 'mozmm',
  38. // Flexible length units
  39. 'fr',
  40. // Container query units
  41. 'cqw',
  42. 'cqh',
  43. 'cqi',
  44. 'cqb',
  45. 'cqmin',
  46. 'cqmax',
  47. ]);
  48. const units = uniteSets(lengthUnits, [
  49. // Relative length units
  50. '%',
  51. // Time length units
  52. 's',
  53. 'ms',
  54. // Angle
  55. 'deg',
  56. 'grad',
  57. 'turn',
  58. 'rad',
  59. // Frequency
  60. 'Hz',
  61. 'kHz',
  62. // Resolution
  63. 'dpi',
  64. 'dpcm',
  65. 'dppx',
  66. ]);
  67. module.exports = {
  68. lengthUnits,
  69. units,
  70. };