You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

819 lines
34 KiB

12 months ago
  1. ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  2. "use strict";
  3. var oop = acequire("../lib/oop");
  4. var lang = acequire("../lib/lang");
  5. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  6. var supportType = exports.supportType = "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|border|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-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-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|min-height|min-width|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index";
  7. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  8. var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
  9. var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen";
  10. var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
  11. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  12. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  13. var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|acequired|root|target|valid|visited)\\b";
  14. var CssHighlightRules = function() {
  15. var keywordMapper = this.createKeywordMapper({
  16. "support.function": supportFunction,
  17. "support.constant": supportConstant,
  18. "support.type": supportType,
  19. "support.constant.color": supportConstantColor,
  20. "support.constant.fonts": supportConstantFonts
  21. }, "text", true);
  22. this.$rules = {
  23. "start" : [{
  24. include : ["strings", "url", "comments"]
  25. }, {
  26. token: "paren.lparen",
  27. regex: "\\{",
  28. next: "ruleset"
  29. }, {
  30. token: "paren.rparen",
  31. regex: "\\}"
  32. }, {
  33. token: "string",
  34. regex: "@",
  35. next: "media"
  36. }, {
  37. token: "keyword",
  38. regex: "#[a-z0-9-_]+"
  39. }, {
  40. token: "keyword",
  41. regex: "%"
  42. }, {
  43. token: "variable",
  44. regex: "\\.[a-z0-9-_]+"
  45. }, {
  46. token: "string",
  47. regex: ":[a-z0-9-_]+"
  48. }, {
  49. token : "constant.numeric",
  50. regex : numRe
  51. }, {
  52. token: "constant",
  53. regex: "[a-z0-9-_]+"
  54. }, {
  55. caseInsensitive: true
  56. }],
  57. "media": [{
  58. include : ["strings", "url", "comments"]
  59. }, {
  60. token: "paren.lparen",
  61. regex: "\\{",
  62. next: "start"
  63. }, {
  64. token: "paren.rparen",
  65. regex: "\\}",
  66. next: "start"
  67. }, {
  68. token: "string",
  69. regex: ";",
  70. next: "start"
  71. }, {
  72. token: "keyword",
  73. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  74. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  75. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  76. }],
  77. "comments" : [{
  78. token: "comment", // multi line comment
  79. regex: "\\/\\*",
  80. push: [{
  81. token : "comment",
  82. regex : "\\*\\/",
  83. next : "pop"
  84. }, {
  85. defaultToken : "comment"
  86. }]
  87. }],
  88. "ruleset" : [{
  89. regex : "-(webkit|ms|moz|o)-",
  90. token : "text"
  91. }, {
  92. token : "paren.rparen",
  93. regex : "\\}",
  94. next : "start"
  95. }, {
  96. include : ["strings", "url", "comments"]
  97. }, {
  98. token : ["constant.numeric", "keyword"],
  99. regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
  100. }, {
  101. token : "constant.numeric",
  102. regex : numRe
  103. }, {
  104. token : "constant.numeric", // hex6 color
  105. regex : "#[a-f0-9]{6}"
  106. }, {
  107. token : "constant.numeric", // hex3 color
  108. regex : "#[a-f0-9]{3}"
  109. }, {
  110. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  111. regex : pseudoElements
  112. }, {
  113. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  114. regex : pseudoClasses
  115. }, {
  116. include: "url"
  117. }, {
  118. token : keywordMapper,
  119. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  120. }, {
  121. caseInsensitive: true
  122. }],
  123. url: [{
  124. token : "support.function",
  125. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  126. push: [{
  127. token : "support.function",
  128. regex : "\\)",
  129. next : "pop"
  130. }, {
  131. defaultToken: "string"
  132. }]
  133. }],
  134. strings: [{
  135. token : "string.start",
  136. regex : "'",
  137. push : [{
  138. token : "string.end",
  139. regex : "'|$",
  140. next: "pop"
  141. }, {
  142. include : "escapes"
  143. }, {
  144. token : "constant.language.escape",
  145. regex : /\\$/,
  146. consumeLineEnd: true
  147. }, {
  148. defaultToken: "string"
  149. }]
  150. }, {
  151. token : "string.start",
  152. regex : '"',
  153. push : [{
  154. token : "string.end",
  155. regex : '"|$',
  156. next: "pop"
  157. }, {
  158. include : "escapes"
  159. }, {
  160. token : "constant.language.escape",
  161. regex : /\\$/,
  162. consumeLineEnd: true
  163. }, {
  164. defaultToken: "string"
  165. }]
  166. }],
  167. escapes: [{
  168. token : "constant.language.escape",
  169. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  170. }]
  171. };
  172. this.normalizeRules();
  173. };
  174. oop.inherits(CssHighlightRules, TextHighlightRules);
  175. exports.CssHighlightRules = CssHighlightRules;
  176. });
  177. ace.define("ace/mode/less_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/css_highlight_rules"], function(acequire, exports, module) {
  178. "use strict";
  179. var oop = acequire("../lib/oop");
  180. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  181. var CssHighlightRules = acequire('./css_highlight_rules');
  182. var LessHighlightRules = function() {
  183. var keywordList = "@import|@media|@font-face|@keyframes|@-webkit-keyframes|@supports|" +
  184. "@charset|@plugin|@namespace|@document|@page|@viewport|@-ms-viewport|" +
  185. "or|and|when|not";
  186. var keywords = keywordList.split('|');
  187. var properties = CssHighlightRules.supportType.split('|');
  188. var keywordMapper = this.createKeywordMapper({
  189. "support.constant": CssHighlightRules.supportConstant,
  190. "keyword": keywordList,
  191. "support.constant.color": CssHighlightRules.supportConstantColor,
  192. "support.constant.fonts": CssHighlightRules.supportConstantFonts
  193. }, "identifier", true);
  194. var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  195. this.$rules = {
  196. "start" : [
  197. {
  198. token : "comment",
  199. regex : "\\/\\/.*$"
  200. },
  201. {
  202. token : "comment", // multi line comment
  203. regex : "\\/\\*",
  204. next : "comment"
  205. }, {
  206. token : "string", // single line
  207. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  208. }, {
  209. token : "string", // single line
  210. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  211. }, {
  212. token : ["constant.numeric", "keyword"],
  213. regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
  214. }, {
  215. token : "constant.numeric", // hex6 color
  216. regex : "#[a-f0-9]{6}"
  217. }, {
  218. token : "constant.numeric", // hex3 color
  219. regex : "#[a-f0-9]{3}"
  220. }, {
  221. token : "constant.numeric",
  222. regex : numRe
  223. }, {
  224. token : ["support.function", "paren.lparen", "string", "paren.rparen"],
  225. regex : "(url)(\\()(.*)(\\))"
  226. }, {
  227. token : ["support.function", "paren.lparen"],
  228. regex : "(:extend|[a-z0-9_\\-]+)(\\()"
  229. }, {
  230. token : function(value) {
  231. if (keywords.indexOf(value.toLowerCase()) > -1)
  232. return "keyword";
  233. else
  234. return "variable";
  235. },
  236. regex : "[@\\$][a-z0-9_\\-@\\$]*\\b"
  237. }, {
  238. token : "variable",
  239. regex : "[@\\$]\\{[a-z0-9_\\-@\\$]*\\}"
  240. }, {
  241. token : function(first, second) {
  242. if(properties.indexOf(first.toLowerCase()) > -1) {
  243. return ["support.type.property", "text"];
  244. }
  245. else {
  246. return ["support.type.unknownProperty", "text"];
  247. }
  248. },
  249. regex : "([a-z0-9-_]+)(\\s*:)"
  250. }, {
  251. token : "keyword",
  252. regex : "&" // special case - always treat as keyword
  253. }, {
  254. token : keywordMapper,
  255. regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
  256. }, {
  257. token: "variable.language",
  258. regex: "#[a-z0-9-_]+"
  259. }, {
  260. token: "variable.language",
  261. regex: "\\.[a-z0-9-_]+"
  262. }, {
  263. token: "variable.language",
  264. regex: ":[a-z_][a-z0-9-_]*"
  265. }, {
  266. token: "constant",
  267. regex: "[a-z0-9-_]+"
  268. }, {
  269. token : "keyword.operator",
  270. regex : "<|>|<=|>=|=|!=|-|%|\\+|\\*"
  271. }, {
  272. token : "paren.lparen",
  273. regex : "[[({]"
  274. }, {
  275. token : "paren.rparen",
  276. regex : "[\\])}]"
  277. }, {
  278. token : "text",
  279. regex : "\\s+"
  280. }, {
  281. caseInsensitive: true
  282. }
  283. ],
  284. "comment" : [
  285. {
  286. token : "comment", // closing comment
  287. regex : "\\*\\/",
  288. next : "start"
  289. }, {
  290. defaultToken : "comment"
  291. }
  292. ]
  293. };
  294. this.normalizeRules();
  295. };
  296. oop.inherits(LessHighlightRules, TextHighlightRules);
  297. exports.LessHighlightRules = LessHighlightRules;
  298. });
  299. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports, module) {
  300. "use strict";
  301. var Range = acequire("../range").Range;
  302. var MatchingBraceOutdent = function() {};
  303. (function() {
  304. this.checkOutdent = function(line, input) {
  305. if (! /^\s+$/.test(line))
  306. return false;
  307. return /^\s*\}/.test(input);
  308. };
  309. this.autoOutdent = function(doc, row) {
  310. var line = doc.getLine(row);
  311. var match = line.match(/^(\s*\})/);
  312. if (!match) return 0;
  313. var column = match[1].length;
  314. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  315. if (!openBracePos || openBracePos.row == row) return 0;
  316. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  317. doc.replace(new Range(row, 0, row, column-1), indent);
  318. };
  319. this.$getIndent = function(line) {
  320. return line.match(/^\s*/)[0];
  321. };
  322. }).call(MatchingBraceOutdent.prototype);
  323. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  324. });
  325. ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(acequire, exports, module) {
  326. "use strict";
  327. var oop = acequire("../../lib/oop");
  328. var Behaviour = acequire("../behaviour").Behaviour;
  329. var CstyleBehaviour = acequire("./cstyle").CstyleBehaviour;
  330. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  331. var CssBehaviour = function () {
  332. this.inherit(CstyleBehaviour);
  333. this.add("colon", "insertion", function (state, action, editor, session, text) {
  334. if (text === ':') {
  335. var cursor = editor.getCursorPosition();
  336. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  337. var token = iterator.getCurrentToken();
  338. if (token && token.value.match(/\s+/)) {
  339. token = iterator.stepBackward();
  340. }
  341. if (token && token.type === 'support.type') {
  342. var line = session.doc.getLine(cursor.row);
  343. var rightChar = line.substring(cursor.column, cursor.column + 1);
  344. if (rightChar === ':') {
  345. return {
  346. text: '',
  347. selection: [1, 1]
  348. };
  349. }
  350. if (!line.substring(cursor.column).match(/^\s*;/)) {
  351. return {
  352. text: ':;',
  353. selection: [1, 1]
  354. };
  355. }
  356. }
  357. }
  358. });
  359. this.add("colon", "deletion", function (state, action, editor, session, range) {
  360. var selected = session.doc.getTextRange(range);
  361. if (!range.isMultiLine() && selected === ':') {
  362. var cursor = editor.getCursorPosition();
  363. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  364. var token = iterator.getCurrentToken();
  365. if (token && token.value.match(/\s+/)) {
  366. token = iterator.stepBackward();
  367. }
  368. if (token && token.type === 'support.type') {
  369. var line = session.doc.getLine(range.start.row);
  370. var rightChar = line.substring(range.end.column, range.end.column + 1);
  371. if (rightChar === ';') {
  372. range.end.column ++;
  373. return range;
  374. }
  375. }
  376. }
  377. });
  378. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  379. if (text === ';') {
  380. var cursor = editor.getCursorPosition();
  381. var line = session.doc.getLine(cursor.row);
  382. var rightChar = line.substring(cursor.column, cursor.column + 1);
  383. if (rightChar === ';') {
  384. return {
  385. text: '',
  386. selection: [1, 1]
  387. };
  388. }
  389. }
  390. });
  391. };
  392. oop.inherits(CssBehaviour, CstyleBehaviour);
  393. exports.CssBehaviour = CssBehaviour;
  394. });
  395. ace.define("ace/mode/css_completions",["require","exports","module"], function(acequire, exports, module) {
  396. "use strict";
  397. var propertyMap = {
  398. "background": {"#$0": 1},
  399. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  400. "background-image": {"url('/$0')": 1},
  401. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  402. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  403. "background-attachment": {"scroll": 1, "fixed": 1},
  404. "background-size": {"cover": 1, "contain": 1},
  405. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  406. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  407. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  408. "border-color": {"#$0": 1},
  409. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  410. "border-collapse": {"collapse": 1, "separate": 1},
  411. "bottom": {"px": 1, "em": 1, "%": 1},
  412. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  413. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  414. "cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1},
  415. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  416. "empty-cells": {"show": 1, "hide": 1},
  417. "float": {"left": 1, "right": 1, "none": 1},
  418. "font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1},
  419. "font-size": {"px": 1, "em": 1, "%": 1},
  420. "font-weight": {"bold": 1, "normal": 1},
  421. "font-style": {"italic": 1, "normal": 1},
  422. "font-variant": {"normal": 1, "small-caps": 1},
  423. "height": {"px": 1, "em": 1, "%": 1},
  424. "left": {"px": 1, "em": 1, "%": 1},
  425. "letter-spacing": {"normal": 1},
  426. "line-height": {"normal": 1},
  427. "list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1},
  428. "margin": {"px": 1, "em": 1, "%": 1},
  429. "margin-right": {"px": 1, "em": 1, "%": 1},
  430. "margin-left": {"px": 1, "em": 1, "%": 1},
  431. "margin-top": {"px": 1, "em": 1, "%": 1},
  432. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  433. "max-height": {"px": 1, "em": 1, "%": 1},
  434. "max-width": {"px": 1, "em": 1, "%": 1},
  435. "min-height": {"px": 1, "em": 1, "%": 1},
  436. "min-width": {"px": 1, "em": 1, "%": 1},
  437. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  438. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  439. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  440. "padding": {"px": 1, "em": 1, "%": 1},
  441. "padding-top": {"px": 1, "em": 1, "%": 1},
  442. "padding-right": {"px": 1, "em": 1, "%": 1},
  443. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  444. "padding-left": {"px": 1, "em": 1, "%": 1},
  445. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  446. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  447. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  448. "right": {"px": 1, "em": 1, "%": 1},
  449. "table-layout": {"fixed": 1, "auto": 1},
  450. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  451. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  452. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  453. "top": {"px": 1, "em": 1, "%": 1},
  454. "vertical-align": {"top": 1, "bottom": 1},
  455. "visibility": {"hidden": 1, "visible": 1},
  456. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  457. "width": {"px": 1, "em": 1, "%": 1},
  458. "word-spacing": {"normal": 1},
  459. "filter": {"alpha(opacity=$0100)": 1},
  460. "text-shadow": {"$02px 2px 2px #777": 1},
  461. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  462. "-moz-border-radius": 1,
  463. "-moz-border-radius-topright": 1,
  464. "-moz-border-radius-bottomright": 1,
  465. "-moz-border-radius-topleft": 1,
  466. "-moz-border-radius-bottomleft": 1,
  467. "-webkit-border-radius": 1,
  468. "-webkit-border-top-right-radius": 1,
  469. "-webkit-border-top-left-radius": 1,
  470. "-webkit-border-bottom-right-radius": 1,
  471. "-webkit-border-bottom-left-radius": 1,
  472. "-moz-box-shadow": 1,
  473. "-webkit-box-shadow": 1,
  474. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  475. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  476. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  477. };
  478. var CssCompletions = function() {
  479. };
  480. (function() {
  481. this.completionsDefined = false;
  482. this.defineCompletions = function() {
  483. if (document) {
  484. var style = document.createElement('c').style;
  485. for (var i in style) {
  486. if (typeof style[i] !== 'string')
  487. continue;
  488. var name = i.replace(/[A-Z]/g, function(x) {
  489. return '-' + x.toLowerCase();
  490. });
  491. if (!propertyMap.hasOwnProperty(name))
  492. propertyMap[name] = 1;
  493. }
  494. }
  495. this.completionsDefined = true;
  496. };
  497. this.getCompletions = function(state, session, pos, prefix) {
  498. if (!this.completionsDefined) {
  499. this.defineCompletions();
  500. }
  501. var token = session.getTokenAt(pos.row, pos.column);
  502. if (!token)
  503. return [];
  504. if (state==='ruleset'){
  505. var line = session.getLine(pos.row).substr(0, pos.column);
  506. if (/:[^;]+$/.test(line)) {
  507. /([\w\-]+):[^:]*$/.test(line);
  508. return this.getPropertyValueCompletions(state, session, pos, prefix);
  509. } else {
  510. return this.getPropertyCompletions(state, session, pos, prefix);
  511. }
  512. }
  513. return [];
  514. };
  515. this.getPropertyCompletions = function(state, session, pos, prefix) {
  516. var properties = Object.keys(propertyMap);
  517. return properties.map(function(property){
  518. return {
  519. caption: property,
  520. snippet: property + ': $0;',
  521. meta: "property",
  522. score: Number.MAX_VALUE
  523. };
  524. });
  525. };
  526. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  527. var line = session.getLine(pos.row).substr(0, pos.column);
  528. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  529. if (!property)
  530. return [];
  531. var values = [];
  532. if (property in propertyMap && typeof propertyMap[property] === "object") {
  533. values = Object.keys(propertyMap[property]);
  534. }
  535. return values.map(function(value){
  536. return {
  537. caption: value,
  538. snippet: value,
  539. meta: "property value",
  540. score: Number.MAX_VALUE
  541. };
  542. });
  543. };
  544. }).call(CssCompletions.prototype);
  545. exports.CssCompletions = CssCompletions;
  546. });
  547. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
  548. "use strict";
  549. var oop = acequire("../../lib/oop");
  550. var Range = acequire("../../range").Range;
  551. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  552. var FoldMode = exports.FoldMode = function(commentRegex) {
  553. if (commentRegex) {
  554. this.foldingStartMarker = new RegExp(
  555. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  556. );
  557. this.foldingStopMarker = new RegExp(
  558. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  559. );
  560. }
  561. };
  562. oop.inherits(FoldMode, BaseFoldMode);
  563. (function() {
  564. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  565. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  566. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  567. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  568. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  569. this._getFoldWidgetBase = this.getFoldWidget;
  570. this.getFoldWidget = function(session, foldStyle, row) {
  571. var line = session.getLine(row);
  572. if (this.singleLineBlockCommentRe.test(line)) {
  573. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  574. return "";
  575. }
  576. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  577. if (!fw && this.startRegionRe.test(line))
  578. return "start"; // lineCommentRegionStart
  579. return fw;
  580. };
  581. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  582. var line = session.getLine(row);
  583. if (this.startRegionRe.test(line))
  584. return this.getCommentRegionBlock(session, line, row);
  585. var match = line.match(this.foldingStartMarker);
  586. if (match) {
  587. var i = match.index;
  588. if (match[1])
  589. return this.openingBracketBlock(session, match[1], row, i);
  590. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  591. if (range && !range.isMultiLine()) {
  592. if (forceMultiline) {
  593. range = this.getSectionRange(session, row);
  594. } else if (foldStyle != "all")
  595. range = null;
  596. }
  597. return range;
  598. }
  599. if (foldStyle === "markbegin")
  600. return;
  601. var match = line.match(this.foldingStopMarker);
  602. if (match) {
  603. var i = match.index + match[0].length;
  604. if (match[1])
  605. return this.closingBracketBlock(session, match[1], row, i);
  606. return session.getCommentFoldRange(row, i, -1);
  607. }
  608. };
  609. this.getSectionRange = function(session, row) {
  610. var line = session.getLine(row);
  611. var startIndent = line.search(/\S/);
  612. var startRow = row;
  613. var startColumn = line.length;
  614. row = row + 1;
  615. var endRow = row;
  616. var maxRow = session.getLength();
  617. while (++row < maxRow) {
  618. line = session.getLine(row);
  619. var indent = line.search(/\S/);
  620. if (indent === -1)
  621. continue;
  622. if (startIndent > indent)
  623. break;
  624. var subRange = this.getFoldWidgetRange(session, "all", row);
  625. if (subRange) {
  626. if (subRange.start.row <= startRow) {
  627. break;
  628. } else if (subRange.isMultiLine()) {
  629. row = subRange.end.row;
  630. } else if (startIndent == indent) {
  631. break;
  632. }
  633. }
  634. endRow = row;
  635. }
  636. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  637. };
  638. this.getCommentRegionBlock = function(session, line, row) {
  639. var startColumn = line.search(/\s*$/);
  640. var maxRow = session.getLength();
  641. var startRow = row;
  642. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  643. var depth = 1;
  644. while (++row < maxRow) {
  645. line = session.getLine(row);
  646. var m = re.exec(line);
  647. if (!m) continue;
  648. if (m[1]) depth--;
  649. else depth++;
  650. if (!depth) break;
  651. }
  652. var endRow = row;
  653. if (endRow > startRow) {
  654. return new Range(startRow, startColumn, endRow, line.length);
  655. }
  656. };
  657. }).call(FoldMode.prototype);
  658. });
  659. ace.define("ace/mode/less",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/less_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/css","ace/mode/css_completions","ace/mode/folding/cstyle"], function(acequire, exports, module) {
  660. "use strict";
  661. var oop = acequire("../lib/oop");
  662. var TextMode = acequire("./text").Mode;
  663. var LessHighlightRules = acequire("./less_highlight_rules").LessHighlightRules;
  664. var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
  665. var CssBehaviour = acequire("./behaviour/css").CssBehaviour;
  666. var CssCompletions = acequire("./css_completions").CssCompletions;
  667. var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
  668. var Mode = function() {
  669. this.HighlightRules = LessHighlightRules;
  670. this.$outdent = new MatchingBraceOutdent();
  671. this.$behaviour = new CssBehaviour();
  672. this.$completer = new CssCompletions();
  673. this.foldingRules = new CStyleFoldMode();
  674. };
  675. oop.inherits(Mode, TextMode);
  676. (function() {
  677. this.lineCommentStart = "//";
  678. this.blockComment = {start: "/*", end: "*/"};
  679. this.getNextLineIndent = function(state, line, tab) {
  680. var indent = this.$getIndent(line);
  681. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  682. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  683. return indent;
  684. }
  685. var match = line.match(/^.*\{\s*$/);
  686. if (match) {
  687. indent += tab;
  688. }
  689. return indent;
  690. };
  691. this.checkOutdent = function(state, line, input) {
  692. return this.$outdent.checkOutdent(line, input);
  693. };
  694. this.autoOutdent = function(state, doc, row) {
  695. this.$outdent.autoOutdent(doc, row);
  696. };
  697. this.getCompletions = function(state, session, pos, prefix) {
  698. return this.$completer.getCompletions("ruleset", session, pos, prefix);
  699. };
  700. this.$id = "ace/mode/less";
  701. }).call(Mode.prototype);
  702. exports.Mode = Mode;
  703. });