css.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*!-----------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Version: 0.31.1(337587859b1c171314b40503171188b6cea6a32a)
  4. * Released under the MIT license
  5. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  6. *-----------------------------------------------------------------------------*/
  7. define("vs/basic-languages/css/css",[],()=>{
  8. var moduleExports = (() => {
  9. var __defProp = Object.defineProperty;
  10. var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
  11. var __export = (target, all) => {
  12. __markAsModule(target);
  13. for (var name in all)
  14. __defProp(target, name, { get: all[name], enumerable: true });
  15. };
  16. // src/basic-languages/css/css.ts
  17. var css_exports = {};
  18. __export(css_exports, {
  19. conf: () => conf,
  20. language: () => language
  21. });
  22. var conf = {
  23. wordPattern: /(#?-?\d*\.\d\w*%?)|((::|[@#.!:])?[\w-?]+%?)|::|[@#.!:]/g,
  24. comments: {
  25. blockComment: ["/*", "*/"]
  26. },
  27. brackets: [
  28. ["{", "}"],
  29. ["[", "]"],
  30. ["(", ")"]
  31. ],
  32. autoClosingPairs: [
  33. { open: "{", close: "}", notIn: ["string", "comment"] },
  34. { open: "[", close: "]", notIn: ["string", "comment"] },
  35. { open: "(", close: ")", notIn: ["string", "comment"] },
  36. { open: '"', close: '"', notIn: ["string", "comment"] },
  37. { open: "'", close: "'", notIn: ["string", "comment"] }
  38. ],
  39. surroundingPairs: [
  40. { open: "{", close: "}" },
  41. { open: "[", close: "]" },
  42. { open: "(", close: ")" },
  43. { open: '"', close: '"' },
  44. { open: "'", close: "'" }
  45. ],
  46. folding: {
  47. markers: {
  48. start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"),
  49. end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/")
  50. }
  51. }
  52. };
  53. var language = {
  54. defaultToken: "",
  55. tokenPostfix: ".css",
  56. ws: "[ \n\r\f]*",
  57. identifier: "-?-?([a-zA-Z]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))([\\w\\-]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))*",
  58. brackets: [
  59. { open: "{", close: "}", token: "delimiter.bracket" },
  60. { open: "[", close: "]", token: "delimiter.bracket" },
  61. { open: "(", close: ")", token: "delimiter.parenthesis" },
  62. { open: "<", close: ">", token: "delimiter.angle" }
  63. ],
  64. tokenizer: {
  65. root: [{ include: "@selector" }],
  66. selector: [
  67. { include: "@comments" },
  68. { include: "@import" },
  69. { include: "@strings" },
  70. [
  71. "[@](keyframes|-webkit-keyframes|-moz-keyframes|-o-keyframes)",
  72. { token: "keyword", next: "@keyframedeclaration" }
  73. ],
  74. ["[@](page|content|font-face|-moz-document)", { token: "keyword" }],
  75. ["[@](charset|namespace)", { token: "keyword", next: "@declarationbody" }],
  76. [
  77. "(url-prefix)(\\()",
  78. ["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }]
  79. ],
  80. [
  81. "(url)(\\()",
  82. ["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }]
  83. ],
  84. { include: "@selectorname" },
  85. ["[\\*]", "tag"],
  86. ["[>\\+,]", "delimiter"],
  87. ["\\[", { token: "delimiter.bracket", next: "@selectorattribute" }],
  88. ["{", { token: "delimiter.bracket", next: "@selectorbody" }]
  89. ],
  90. selectorbody: [
  91. { include: "@comments" },
  92. ["[*_]?@identifier@ws:(?=(\\s|\\d|[^{;}]*[;}]))", "attribute.name", "@rulevalue"],
  93. ["}", { token: "delimiter.bracket", next: "@pop" }]
  94. ],
  95. selectorname: [
  96. ["(\\.|#(?=[^{])|%|(@identifier)|:)+", "tag"]
  97. ],
  98. selectorattribute: [{ include: "@term" }, ["]", { token: "delimiter.bracket", next: "@pop" }]],
  99. term: [
  100. { include: "@comments" },
  101. [
  102. "(url-prefix)(\\()",
  103. ["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }]
  104. ],
  105. [
  106. "(url)(\\()",
  107. ["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }]
  108. ],
  109. { include: "@functioninvocation" },
  110. { include: "@numbers" },
  111. { include: "@name" },
  112. { include: "@strings" },
  113. ["([<>=\\+\\-\\*\\/\\^\\|\\~,])", "delimiter"],
  114. [",", "delimiter"]
  115. ],
  116. rulevalue: [
  117. { include: "@comments" },
  118. { include: "@strings" },
  119. { include: "@term" },
  120. ["!important", "keyword"],
  121. [";", "delimiter", "@pop"],
  122. ["(?=})", { token: "", next: "@pop" }]
  123. ],
  124. warndebug: [["[@](warn|debug)", { token: "keyword", next: "@declarationbody" }]],
  125. import: [["[@](import)", { token: "keyword", next: "@declarationbody" }]],
  126. urldeclaration: [
  127. { include: "@strings" },
  128. ["[^)\r\n]+", "string"],
  129. ["\\)", { token: "delimiter.parenthesis", next: "@pop" }]
  130. ],
  131. parenthizedterm: [
  132. { include: "@term" },
  133. ["\\)", { token: "delimiter.parenthesis", next: "@pop" }]
  134. ],
  135. declarationbody: [
  136. { include: "@term" },
  137. [";", "delimiter", "@pop"],
  138. ["(?=})", { token: "", next: "@pop" }]
  139. ],
  140. comments: [
  141. ["\\/\\*", "comment", "@comment"],
  142. ["\\/\\/+.*", "comment"]
  143. ],
  144. comment: [
  145. ["\\*\\/", "comment", "@pop"],
  146. [/[^*/]+/, "comment"],
  147. [/./, "comment"]
  148. ],
  149. name: [["@identifier", "attribute.value"]],
  150. numbers: [
  151. ["-?(\\d*\\.)?\\d+([eE][\\-+]?\\d+)?", { token: "attribute.value.number", next: "@units" }],
  152. ["#[0-9a-fA-F_]+(?!\\w)", "attribute.value.hex"]
  153. ],
  154. units: [
  155. [
  156. "(em|ex|ch|rem|vmin|vmax|vw|vh|vm|cm|mm|in|px|pt|pc|deg|grad|rad|turn|s|ms|Hz|kHz|%)?",
  157. "attribute.value.unit",
  158. "@pop"
  159. ]
  160. ],
  161. keyframedeclaration: [
  162. ["@identifier", "attribute.value"],
  163. ["{", { token: "delimiter.bracket", switchTo: "@keyframebody" }]
  164. ],
  165. keyframebody: [
  166. { include: "@term" },
  167. ["{", { token: "delimiter.bracket", next: "@selectorbody" }],
  168. ["}", { token: "delimiter.bracket", next: "@pop" }]
  169. ],
  170. functioninvocation: [
  171. ["@identifier\\(", { token: "attribute.value", next: "@functionarguments" }]
  172. ],
  173. functionarguments: [
  174. ["\\$@identifier@ws:", "attribute.name"],
  175. ["[,]", "delimiter"],
  176. { include: "@term" },
  177. ["\\)", { token: "attribute.value", next: "@pop" }]
  178. ],
  179. strings: [
  180. ['~?"', { token: "string", next: "@stringenddoublequote" }],
  181. ["~?'", { token: "string", next: "@stringendquote" }]
  182. ],
  183. stringenddoublequote: [
  184. ["\\\\.", "string"],
  185. ['"', { token: "string", next: "@pop" }],
  186. [/[^\\"]+/, "string"],
  187. [".", "string"]
  188. ],
  189. stringendquote: [
  190. ["\\\\.", "string"],
  191. ["'", { token: "string", next: "@pop" }],
  192. [/[^\\']+/, "string"],
  193. [".", "string"]
  194. ]
  195. }
  196. };
  197. return css_exports;
  198. })();
  199. return moduleExports;
  200. });