atKeywords.mjs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import uniteSets from '../utils/uniteSets.mjs';
  2. /** @type {ReadonlySet<string>} */
  3. export const deprecatedAtKeywords = new Set(['document', 'nest', 'viewport']);
  4. /**
  5. * @see https://www.w3.org/TR/css-nesting-1/#conditionals
  6. * @type {ReadonlySet<string>}
  7. */
  8. export const nestingSupportedAtKeywords = new Set([
  9. 'apply',
  10. 'container',
  11. 'layer',
  12. 'media',
  13. 'scope',
  14. 'starting-style',
  15. 'supports',
  16. ]);
  17. /**
  18. * @see https://www.w3.org/TR/css-page-3/#syntax-page-selector
  19. * @type {ReadonlySet<string>}
  20. */
  21. export const pageMarginAtKeywords = new Set([
  22. 'top-left-corner',
  23. 'top-left',
  24. 'top-center',
  25. 'top-right',
  26. 'top-right-corner',
  27. 'bottom-left-corner',
  28. 'bottom-left',
  29. 'bottom-center',
  30. 'bottom-right',
  31. 'bottom-right-corner',
  32. 'left-top',
  33. 'left-middle',
  34. 'left-bottom',
  35. 'right-top',
  36. 'right-middle',
  37. 'right-bottom',
  38. ]);
  39. /**
  40. * @see https://www.w3.org/TR/css-fonts-4/#font-feature-values-font-feature-value-type
  41. * @type {ReadonlySet<string>}
  42. */
  43. const fontFeatureValueTypes = new Set([
  44. 'annotation',
  45. 'character-variant',
  46. 'historical-forms',
  47. 'ornaments',
  48. 'styleset',
  49. 'stylistic',
  50. 'swash',
  51. ]);
  52. /**
  53. * @see https://developer.mozilla.org/en/docs/Web/CSS/At-rule
  54. * @type {ReadonlySet<string>}
  55. */
  56. export const atKeywords = uniteSets(
  57. deprecatedAtKeywords,
  58. nestingSupportedAtKeywords,
  59. pageMarginAtKeywords,
  60. fontFeatureValueTypes,
  61. [
  62. 'counter-style',
  63. 'custom-media',
  64. 'custom-selector',
  65. 'font-face',
  66. 'font-feature-values',
  67. 'font-palette-values',
  68. 'import',
  69. 'keyframes',
  70. 'namespace',
  71. 'page',
  72. 'position-try',
  73. 'property',
  74. 'scroll-timeline',
  75. 'view-transition',
  76. ],
  77. );