css.js 7.5 KB

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