hljs_css.min.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. export default (() => {
  2. {
  3. let t = ["a", "abbr", "address", "article", "aside", "audio", "b", "blockquote", "body", "button", "canvas", "caption", "cite", "code", "dd", "del", "details", "dfn", "div", "dl", "dt", "em", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "mark", "menu", "nav", "object", "ol", "p", "q", "quote", "samp", "section", "span", "strong", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "tr", "ul", "var", "video"],
  4. o = ["any-hover", "any-pointer", "aspect-ratio", "color", "color-gamut", "color-index", "device-aspect-ratio", "device-height", "device-width", "display-mode", "forced-colors", "grid", "height", "hover", "inverted-colors", "monochrome", "orientation", "overflow-block", "overflow-inline", "pointer", "prefers-color-scheme", "prefers-contrast", "prefers-reduced-motion", "prefers-reduced-transparency", "resolution", "scan", "scripting", "update", "width", "min-width", "max-width", "min-height", "max-height"],
  5. n = ["active", "any-link", "blank", "checked", "current", "default", "defined", "dir", "disabled", "drop", "empty", "enabled", "first", "first-child", "first-of-type", "fullscreen", "future", "focus", "focus-visible", "focus-within", "has", "host", "host-context", "hover", "indeterminate", "in-range", "invalid", "is", "lang", "last-child", "last-of-type", "left", "link", "local-link", "not", "nth-child", "nth-col", "nth-last-child", "nth-last-col", "nth-last-of-type", "nth-of-type", "only-child", "only-of-type", "optional", "out-of-range", "past", "placeholder-shown", "read-only", "read-write", "required", "right", "root", "scope", "target", "target-within", "user-invalid", "valid", "visited", "where"],
  6. a = ["after", "backdrop", "before", "cue", "cue-region", "first-letter", "first-line", "grammar-error", "marker", "part", "placeholder", "selection", "slotted", "spelling-error"],
  7. l = ["align-content", "align-items", "align-self", "all", "animation", "animation-delay", "animation-direction", "animation-duration", "animation-fill-mode", "animation-iteration-count", "animation-name", "animation-play-state", "animation-timing-function", "backface-visibility", "background", "background-attachment", "background-blend-mode", "background-clip", "background-color", "background-image", "background-origin", "background-position", "background-repeat", "background-size", "block-size", "border", "border-block", "border-block-color", "border-block-end", "border-block-end-color", "border-block-end-style", "border-block-end-width", "border-block-start", "border-block-start-color", "border-block-start-style", "border-block-start-width", "border-block-style", "border-block-width", "border-bottom", "border-bottom-color", "border-bottom-left-radius", "border-bottom-right-radius", "border-bottom-style", "border-bottom-width", "border-collapse", "border-color", "border-image", "border-image-outset", "border-image-repeat", "border-image-slice", "border-image-source", "border-image-width", "border-inline", "border-inline-color", "border-inline-end", "border-inline-end-color", "border-inline-end-style", "border-inline-end-width", "border-inline-start", "border-inline-start-color", "border-inline-start-style", "border-inline-start-width", "border-inline-style", "border-inline-width", "border-left", "border-left-color", "border-left-style", "border-left-width", "border-radius", "border-right", "border-right-color", "border-right-style", "border-right-width", "border-spacing", "border-style", "border-top", "border-top-color", "border-top-left-radius", "border-top-right-radius", "border-top-style", "border-top-width", "border-width", "bottom", "box-decoration-break", "box-shadow", "box-sizing", "break-after", "break-before", "break-inside", "caption-side", "caret-color", "clear", "clip", "clip-path", "clip-rule", "color", "column-count", "column-fill", "column-gap", "column-rule", "column-rule-color", "column-rule-style", "column-rule-width", "column-span", "column-width", "columns", "contain", "content", "content-visibility", "counter-increment", "counter-reset", "cue", "cue-after", "cue-before", "cursor", "direction", "display", "empty-cells", "filter", "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", "float", "flow", "font", "font-display", "font-family", "font-feature-settings", "font-kerning", "font-language-override", "font-size", "font-size-adjust", "font-smoothing", "font-stretch", "font-style", "font-synthesis", "font-variant", "font-variant-caps", "font-variant-east-asian", "font-variant-ligatures", "font-variant-numeric", "font-variant-position", "font-variation-settings", "font-weight", "gap", "glyph-orientation-vertical", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow", "grid-auto-rows", "grid-column", "grid-column-end", "grid-column-start", "grid-gap", "grid-row", "grid-row-end", "grid-row-start", "grid-template", "grid-template-areas", "grid-template-columns", "grid-template-rows", "hanging-punctuation", "height", "hyphens", "icon", "image-orientation", "image-rendering", "image-resolution", "ime-mode", "inline-size", "isolation", "justify-content", "left", "letter-spacing", "line-break", "line-height", "list-style", "list-style-image", "list-style-position", "list-style-type", "margin", "margin-block", "margin-block-end", "margin-block-start", "margin-bottom", "margin-inline", "margin-inline-end", "margin-inline-start", "margin-left", "margin-right", "margin-top", "marks", "mask", "mask-border", "mask-border-mode", "mask-border-outset", "mask-border-repeat", "mask-border-slice", "mask-border-source", "mask-border-width", "mask-clip", "mask-composite", "mask-image", "mask-mode", "mask-origin", "mask-position", "mask-repeat", "mask-size", "mask-type", "max-block-size", "max-height", "max-inline-size", "max-width", "min-block-size", "min-height", "min-inline-size", "min-width", "mix-blend-mode", "nav-down", "nav-index", "nav-left", "nav-right", "nav-up", "none", "normal", "object-fit", "object-position", "opacity", "order", "orphans", "outline", "outline-color", "outline-offset", "outline-style", "outline-width", "overflow", "overflow-wrap", "overflow-x", "overflow-y", "padding", "padding-block", "padding-block-end", "padding-block-start", "padding-bottom", "padding-inline", "padding-inline-end", "padding-inline-start", "padding-left", "padding-right", "padding-top", "page-break-after", "page-break-before", "page-break-inside", "pause", "pause-after", "pause-before", "perspective", "perspective-origin", "pointer-events", "position", "quotes", "resize", "rest", "rest-after", "rest-before", "right", "row-gap", "scroll-margin", "scroll-margin-block", "scroll-margin-block-end", "scroll-margin-block-start", "scroll-margin-bottom", "scroll-margin-inline", "scroll-margin-inline-end", "scroll-margin-inline-start", "scroll-margin-left", "scroll-margin-right", "scroll-margin-top", "scroll-padding", "scroll-padding-block", "scroll-padding-block-end", "scroll-padding-block-start", "scroll-padding-bottom", "scroll-padding-inline", "scroll-padding-inline-end", "scroll-padding-inline-start", "scroll-padding-left", "scroll-padding-right", "scroll-padding-top", "scroll-snap-align", "scroll-snap-stop", "scroll-snap-type", "scrollbar-color", "scrollbar-gutter", "scrollbar-width", "shape-image-threshold", "shape-margin", "shape-outside", "speak", "speak-as", "src", "tab-size", "table-layout", "text-align", "text-align-all", "text-align-last", "text-combine-upright", "text-decoration", "text-decoration-color", "text-decoration-line", "text-decoration-style", "text-emphasis", "text-emphasis-color", "text-emphasis-position", "text-emphasis-style", "text-indent", "text-justify", "text-orientation", "text-overflow", "text-rendering", "text-shadow", "text-transform", "text-underline-position", "top", "transform", "transform-box", "transform-origin", "transform-style", "transition", "transition-delay", "transition-duration", "transition-property", "transition-timing-function", "unicode-bidi", "vertical-align", "visibility", "voice-balance", "voice-duration", "voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress", "voice-volume", "white-space", "widows", "width", "will-change", "word-break", "word-spacing", "word-wrap", "writing-mode", "z-index"].reverse();
  8. return e => {
  9. var i = e.regex,
  10. r = {
  11. IMPORTANT: {
  12. scope: "meta",
  13. begin: "!important"
  14. },
  15. BLOCK_COMMENT: e.C_BLOCK_COMMENT_MODE,
  16. HEXCOLOR: {
  17. scope: "number",
  18. begin: /#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/
  19. },
  20. FUNCTION_DISPATCH: {
  21. className: "built_in",
  22. begin: /[\w-]+(?=\()/
  23. },
  24. ATTRIBUTE_SELECTOR_MODE: {
  25. scope: "selector-attr",
  26. begin: /\[/,
  27. end: /\]/,
  28. illegal: "$",
  29. contains: [e.APOS_STRING_MODE, e.QUOTE_STRING_MODE]
  30. },
  31. CSS_NUMBER_MODE: {
  32. scope: "number",
  33. begin: e.NUMBER_RE + "(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",
  34. relevance: 0
  35. },
  36. CSS_VARIABLE: {
  37. className: "attr",
  38. begin: /--[A-Za-z_][A-Za-z0-9_-]*/
  39. }
  40. },
  41. e = [e.APOS_STRING_MODE, e.QUOTE_STRING_MODE];
  42. return {
  43. name: "CSS",
  44. case_insensitive: !0,
  45. illegal: /[=|'\$]/,
  46. keywords: {
  47. keyframePosition: "from to"
  48. },
  49. classNameAliases: {
  50. keyframePosition: "selector-tag"
  51. },
  52. contains: [r.BLOCK_COMMENT, {
  53. begin: /-(webkit|moz|ms|o)-(?=[a-z])/
  54. }, r.CSS_NUMBER_MODE, {
  55. className: "selector-id",
  56. begin: /#[A-Za-z0-9_-]+/,
  57. relevance: 0
  58. }, {
  59. className: "selector-class",
  60. begin: "\\.[a-zA-Z-][a-zA-Z0-9_-]*",
  61. relevance: 0
  62. }, r.ATTRIBUTE_SELECTOR_MODE, {
  63. className: "selector-pseudo",
  64. variants: [{
  65. begin: ":(" + n.join("|") + ")"
  66. }, {
  67. begin: ":(:)?(" + a.join("|") + ")"
  68. }]
  69. }, r.CSS_VARIABLE, {
  70. className: "attribute",
  71. begin: "\\b(" + l.join("|") + ")\\b"
  72. }, {
  73. begin: /:/,
  74. end: /[;}{]/,
  75. contains: [r.BLOCK_COMMENT, r.HEXCOLOR, r.IMPORTANT, r.CSS_NUMBER_MODE, ...e, {
  76. begin: /(url|data-uri)\(/,
  77. end: /\)/,
  78. relevance: 0,
  79. keywords: {
  80. built_in: "url data-uri"
  81. },
  82. contains: [...e, {
  83. className: "string",
  84. begin: /[^)]/,
  85. endsWithParent: !0,
  86. excludeEnd: !0
  87. }]
  88. }, r.FUNCTION_DISPATCH]
  89. }, {
  90. begin: i.lookahead(/@/),
  91. end: "[{;]",
  92. relevance: 0,
  93. illegal: /:/,
  94. contains: [{
  95. className: "keyword",
  96. begin: /@-?\w[\w]*(-\w+)*/
  97. }, {
  98. begin: /\s/,
  99. endsWithParent: !0,
  100. excludeEnd: !0,
  101. relevance: 0,
  102. keywords: {
  103. $pattern: /[a-z-]+/,
  104. keyword: "and or not only",
  105. attribute: o.join(" ")
  106. },
  107. contains: [{
  108. begin: /[a-z-]+(?=:)/,
  109. className: "attribute"
  110. }, ...e, r.CSS_NUMBER_MODE]
  111. }]
  112. }, {
  113. className: "selector-tag",
  114. begin: "\\b(" + t.join("|") + ")\\b"
  115. }]
  116. };
  117. };
  118. }
  119. });