mediaFeatures.cjs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. // NOTICE: This file is generated by Rollup. To modify it,
  2. // please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
  3. 'use strict';
  4. const uniteSets = require('../utils/uniteSets.cjs');
  5. /** @type {ReadonlySet<string>} */
  6. const deprecatedMediaFeatureNames = new Set([
  7. 'device-aspect-ratio',
  8. 'device-height',
  9. 'device-width',
  10. ]);
  11. /** @type {ReadonlySet<string>} */
  12. const rangeTypeMediaFeatureNames = uniteSets(deprecatedMediaFeatureNames, [
  13. 'aspect-ratio',
  14. 'color',
  15. 'color-index',
  16. 'height',
  17. 'horizontal-viewport-segments',
  18. 'monochrome',
  19. 'resolution',
  20. 'vertical-viewport-segments',
  21. 'width',
  22. ]);
  23. /** @type {ReadonlySet<string>} */
  24. const rangeTypeMediaFeatureNamesWithMinMaxPrefix = new Set(
  25. [...rangeTypeMediaFeatureNames].flatMap((name) => {
  26. return [`min-${name}`, `max-${name}`];
  27. }),
  28. );
  29. /** @type {ReadonlySet<string>} */
  30. const discreteTypeMediaFeatureNames = new Set([
  31. 'any-hover',
  32. 'any-pointer',
  33. 'color-gamut',
  34. 'display-mode',
  35. 'dynamic-range',
  36. 'environment-blending',
  37. 'forced-colors',
  38. 'grid',
  39. 'hover',
  40. 'inverted-colors',
  41. 'light-level',
  42. 'nav-controls',
  43. 'orientation',
  44. 'overflow-block',
  45. 'overflow-inline',
  46. 'pointer',
  47. 'prefers-color-scheme',
  48. 'prefers-contrast',
  49. 'prefers-reduced-data',
  50. 'prefers-reduced-motion',
  51. 'prefers-reduced-transparency',
  52. 'scan',
  53. 'scripting',
  54. 'update',
  55. 'video-color-gamut',
  56. 'video-dynamic-range',
  57. ]);
  58. /** @type {ReadonlySet<string>} */
  59. const mediaFeatureNames = uniteSets(
  60. deprecatedMediaFeatureNames,
  61. rangeTypeMediaFeatureNames,
  62. rangeTypeMediaFeatureNamesWithMinMaxPrefix,
  63. discreteTypeMediaFeatureNames,
  64. );
  65. /** @type {ReadonlyMap<string, ReadonlySet<string>>} */
  66. const mediaFeatureNameAllowedValueKeywords = new Map([
  67. ['any-hover', new Set(['none', 'hover'])],
  68. ['any-pointer', new Set(['none', 'coarse', 'fine'])],
  69. ['color-gamut', new Set(['srgb', 'p3', 'rec2020'])],
  70. [
  71. 'display-mode',
  72. new Set(['fullscreen', 'standalone', 'minimal-ui', 'browser', 'picture-in-picture']),
  73. ],
  74. ['dynamic-range', new Set(['standard', 'high'])],
  75. ['environment-blending', new Set(['opaque', 'additive', 'subtractive'])],
  76. ['forced-colors', new Set(['none', 'active'])],
  77. ['hover', new Set(['none', 'hover'])],
  78. ['inverted-colors', new Set(['none', 'inverted'])],
  79. ['nav-controls', new Set(['none', 'back'])],
  80. ['orientation', new Set(['portrait', 'landscape'])],
  81. ['overflow-block', new Set(['none', 'scroll', 'paged'])],
  82. ['overflow-inline', new Set(['none', 'scroll'])],
  83. ['pointer', new Set(['none', 'coarse', 'fine'])],
  84. ['prefers-color-scheme', new Set(['light', 'dark'])],
  85. ['prefers-contrast', new Set(['no-preference', 'less', 'more', 'custom'])],
  86. ['prefers-reduced-data', new Set(['no-preference', 'reduce'])],
  87. ['prefers-reduced-motion', new Set(['no-preference', 'reduce'])],
  88. ['prefers-reduced-transparency', new Set(['no-preference', 'reduce'])],
  89. ['resolution', new Set(['infinite'])],
  90. ['scan', new Set(['interlace', 'progressive'])],
  91. ['scripting', new Set(['none', 'initial-only', 'enabled'])],
  92. ['update', new Set(['none', 'slow', 'fast'])],
  93. ['video-color-gamut', new Set(['srgb', 'p3', 'rec2020'])],
  94. ['video-dynamic-range', new Set(['standard', 'high'])],
  95. ]);
  96. /** @type {ReadonlyMap<string, ReadonlySet<string>>} */
  97. const mediaFeatureNameAllowedValueTypes = new Map([
  98. ['aspect-ratio', new Set(['ratio'])],
  99. ['color', new Set(['integer'])],
  100. ['color-index', new Set(['integer'])],
  101. ['device-aspect-ratio', new Set(['ratio'])],
  102. ['device-height', new Set(['length'])],
  103. ['device-width', new Set(['length'])],
  104. ['grid', new Set(['mq-boolean'])],
  105. ['height', new Set(['length'])],
  106. ['horizontal-viewport-segments', new Set(['integer'])],
  107. ['monochrome', new Set(['integer'])],
  108. ['resolution', new Set(['resolution'])],
  109. ['vertical-viewport-segments', new Set(['integer'])],
  110. ['width', new Set(['length'])],
  111. ]);
  112. exports.mediaFeatureNameAllowedValueKeywords = mediaFeatureNameAllowedValueKeywords;
  113. exports.mediaFeatureNameAllowedValueTypes = mediaFeatureNameAllowedValueTypes;
  114. exports.mediaFeatureNames = mediaFeatureNames;
  115. exports.rangeTypeMediaFeatureNames = rangeTypeMediaFeatureNames;
  116. exports.rangeTypeMediaFeatureNamesWithMinMaxPrefix = rangeTypeMediaFeatureNamesWithMinMaxPrefix;