mode-less.js 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  1. ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var lang = require("../lib/lang");
  5. var TextHighlightRules = require("./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 = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
  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|required|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. token : "comment", // multi line comment
  25. regex : "\\/\\*",
  26. push : "comment"
  27. }, {
  28. token: "paren.lparen",
  29. regex: "\\{",
  30. push: "ruleset"
  31. }, {
  32. token: "string",
  33. regex: "@.*?{",
  34. push: "media"
  35. }, {
  36. token: "keyword",
  37. regex: "#[a-z0-9-_]+"
  38. }, {
  39. token: "variable",
  40. regex: "\\.[a-z0-9-_]+"
  41. }, {
  42. token: "string",
  43. regex: ":[a-z0-9-_]+"
  44. }, {
  45. token: "constant",
  46. regex: "[a-z0-9-_]+"
  47. }, {
  48. caseInsensitive: true
  49. }],
  50. "media" : [{
  51. token : "comment", // multi line comment
  52. regex : "\\/\\*",
  53. push : "comment"
  54. }, {
  55. token: "paren.lparen",
  56. regex: "\\{",
  57. push: "ruleset"
  58. }, {
  59. token: "string",
  60. regex: "\\}",
  61. next: "pop"
  62. }, {
  63. token: "keyword",
  64. regex: "#[a-z0-9-_]+"
  65. }, {
  66. token: "variable",
  67. regex: "\\.[a-z0-9-_]+"
  68. }, {
  69. token: "string",
  70. regex: ":[a-z0-9-_]+"
  71. }, {
  72. token: "constant",
  73. regex: "[a-z0-9-_]+"
  74. }, {
  75. caseInsensitive: true
  76. }],
  77. "comment" : [{
  78. token : "comment",
  79. regex : "\\*\\/",
  80. next : "pop"
  81. }, {
  82. defaultToken : "comment"
  83. }],
  84. "ruleset" : [
  85. {
  86. token : "paren.rparen",
  87. regex : "\\}",
  88. next: "pop"
  89. }, {
  90. token : "comment", // multi line comment
  91. regex : "\\/\\*",
  92. push : "comment"
  93. }, {
  94. token : "string", // single line
  95. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  96. }, {
  97. token : "string", // single line
  98. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  99. }, {
  100. token : ["constant.numeric", "keyword"],
  101. 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|%)"
  102. }, {
  103. token : "constant.numeric",
  104. regex : numRe
  105. }, {
  106. token : "constant.numeric", // hex6 color
  107. regex : "#[a-f0-9]{6}"
  108. }, {
  109. token : "constant.numeric", // hex3 color
  110. regex : "#[a-f0-9]{3}"
  111. }, {
  112. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  113. regex : pseudoElements
  114. }, {
  115. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  116. regex : pseudoClasses
  117. }, {
  118. token : ["support.function", "string", "support.function"],
  119. regex : "(url\\()(.*)(\\))"
  120. }, {
  121. token : keywordMapper,
  122. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  123. }, {
  124. caseInsensitive: true
  125. }]
  126. };
  127. this.normalizeRules();
  128. };
  129. oop.inherits(CssHighlightRules, TextHighlightRules);
  130. exports.CssHighlightRules = CssHighlightRules;
  131. });
  132. ace.define("ace/mode/less_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/css_highlight_rules"], function(require, exports, module) {
  133. "use strict";
  134. var oop = require("../lib/oop");
  135. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  136. var CssHighlightRules = require('./css_highlight_rules');
  137. var LessHighlightRules = function() {
  138. var keywordList = "@import|@media|@font-face|@keyframes|@-webkit-keyframes|@supports|" +
  139. "@charset|@plugin|@namespace|@document|@page|@viewport|@-ms-viewport|" +
  140. "or|and|when|not";
  141. var keywords = keywordList.split('|');
  142. var properties = CssHighlightRules.supportType.split('|');
  143. var keywordMapper = this.createKeywordMapper({
  144. "support.constant": CssHighlightRules.supportConstant,
  145. "keyword": keywordList,
  146. "support.constant.color": CssHighlightRules.supportConstantColor,
  147. "support.constant.fonts": CssHighlightRules.supportConstantFonts
  148. }, "identifier", true);
  149. var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  150. this.$rules = {
  151. "start" : [
  152. {
  153. token : "comment",
  154. regex : "\\/\\/.*$"
  155. },
  156. {
  157. token : "comment", // multi line comment
  158. regex : "\\/\\*",
  159. next : "comment"
  160. }, {
  161. token : "string", // single line
  162. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  163. }, {
  164. token : "string", // single line
  165. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  166. }, {
  167. token : ["constant.numeric", "keyword"],
  168. 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|%)"
  169. }, {
  170. token : "constant.numeric", // hex6 color
  171. regex : "#[a-f0-9]{6}"
  172. }, {
  173. token : "constant.numeric", // hex3 color
  174. regex : "#[a-f0-9]{3}"
  175. }, {
  176. token : "constant.numeric",
  177. regex : numRe
  178. }, {
  179. token : ["support.function", "paren.lparen", "string", "paren.rparen"],
  180. regex : "(url)(\\()(.*)(\\))"
  181. }, {
  182. token : ["support.function", "paren.lparen"],
  183. regex : "(:extend|[a-z0-9_\\-]+)(\\()"
  184. }, {
  185. token : function(value) {
  186. if (keywords.indexOf(value.toLowerCase()) > -1)
  187. return "keyword";
  188. else
  189. return "variable";
  190. },
  191. regex : "[@\\$][a-z0-9_\\-@\\$]*\\b"
  192. }, {
  193. token : "variable",
  194. regex : "[@\\$]\\{[a-z0-9_\\-@\\$]*\\}"
  195. }, {
  196. token : function(first, second) {
  197. if(properties.indexOf(first.toLowerCase()) > -1) {
  198. return ["support.type.property", "text"];
  199. }
  200. else {
  201. return ["support.type.unknownProperty", "text"];
  202. }
  203. },
  204. regex : "([a-z0-9-_]+)(\\s*:)"
  205. }, {
  206. token : "keyword",
  207. regex : "&" // special case - always treat as keyword
  208. }, {
  209. token : keywordMapper,
  210. regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
  211. }, {
  212. token: "variable.language",
  213. regex: "#[a-z0-9-_]+"
  214. }, {
  215. token: "variable.language",
  216. regex: "\\.[a-z0-9-_]+"
  217. }, {
  218. token: "variable.language",
  219. regex: ":[a-z_][a-z0-9-_]*"
  220. }, {
  221. token: "constant",
  222. regex: "[a-z0-9-_]+"
  223. }, {
  224. token : "keyword.operator",
  225. regex : "<|>|<=|>=|=|!=|-|%|\\+|\\*"
  226. }, {
  227. token : "paren.lparen",
  228. regex : "[[({]"
  229. }, {
  230. token : "paren.rparen",
  231. regex : "[\\])}]"
  232. }, {
  233. token : "text",
  234. regex : "\\s+"
  235. }, {
  236. caseInsensitive: true
  237. }
  238. ],
  239. "comment" : [
  240. {
  241. token : "comment", // closing comment
  242. regex : ".*?\\*\\/",
  243. next : "start"
  244. }, {
  245. token : "comment", // comment spanning whole line
  246. regex : ".+"
  247. }
  248. ]
  249. };
  250. this.normalizeRules();
  251. };
  252. oop.inherits(LessHighlightRules, TextHighlightRules);
  253. exports.LessHighlightRules = LessHighlightRules;
  254. });
  255. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
  256. "use strict";
  257. var Range = require("../range").Range;
  258. var MatchingBraceOutdent = function() {};
  259. (function() {
  260. this.checkOutdent = function(line, input) {
  261. if (! /^\s+$/.test(line))
  262. return false;
  263. return /^\s*\}/.test(input);
  264. };
  265. this.autoOutdent = function(doc, row) {
  266. var line = doc.getLine(row);
  267. var match = line.match(/^(\s*\})/);
  268. if (!match) return 0;
  269. var column = match[1].length;
  270. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  271. if (!openBracePos || openBracePos.row == row) return 0;
  272. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  273. doc.replace(new Range(row, 0, row, column-1), indent);
  274. };
  275. this.$getIndent = function(line) {
  276. return line.match(/^\s*/)[0];
  277. };
  278. }).call(MatchingBraceOutdent.prototype);
  279. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  280. });
  281. ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module) {
  282. "use strict";
  283. var oop = require("../../lib/oop");
  284. var Behaviour = require("../behaviour").Behaviour;
  285. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  286. var TokenIterator = require("../../token_iterator").TokenIterator;
  287. var CssBehaviour = function () {
  288. this.inherit(CstyleBehaviour);
  289. this.add("colon", "insertion", function (state, action, editor, session, text) {
  290. if (text === ':') {
  291. var cursor = editor.getCursorPosition();
  292. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  293. var token = iterator.getCurrentToken();
  294. if (token && token.value.match(/\s+/)) {
  295. token = iterator.stepBackward();
  296. }
  297. if (token && token.type === 'support.type') {
  298. var line = session.doc.getLine(cursor.row);
  299. var rightChar = line.substring(cursor.column, cursor.column + 1);
  300. if (rightChar === ':') {
  301. return {
  302. text: '',
  303. selection: [1, 1]
  304. }
  305. }
  306. if (!line.substring(cursor.column).match(/^\s*;/)) {
  307. return {
  308. text: ':;',
  309. selection: [1, 1]
  310. }
  311. }
  312. }
  313. }
  314. });
  315. this.add("colon", "deletion", function (state, action, editor, session, range) {
  316. var selected = session.doc.getTextRange(range);
  317. if (!range.isMultiLine() && selected === ':') {
  318. var cursor = editor.getCursorPosition();
  319. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  320. var token = iterator.getCurrentToken();
  321. if (token && token.value.match(/\s+/)) {
  322. token = iterator.stepBackward();
  323. }
  324. if (token && token.type === 'support.type') {
  325. var line = session.doc.getLine(range.start.row);
  326. var rightChar = line.substring(range.end.column, range.end.column + 1);
  327. if (rightChar === ';') {
  328. range.end.column ++;
  329. return range;
  330. }
  331. }
  332. }
  333. });
  334. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  335. if (text === ';') {
  336. var cursor = editor.getCursorPosition();
  337. var line = session.doc.getLine(cursor.row);
  338. var rightChar = line.substring(cursor.column, cursor.column + 1);
  339. if (rightChar === ';') {
  340. return {
  341. text: '',
  342. selection: [1, 1]
  343. }
  344. }
  345. }
  346. });
  347. }
  348. oop.inherits(CssBehaviour, CstyleBehaviour);
  349. exports.CssBehaviour = CssBehaviour;
  350. });
  351. ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
  352. "use strict";
  353. var propertyMap = {
  354. "background": {"#$0": 1},
  355. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  356. "background-image": {"url('/$0')": 1},
  357. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  358. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  359. "background-attachment": {"scroll": 1, "fixed": 1},
  360. "background-size": {"cover": 1, "contain": 1},
  361. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  362. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  363. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  364. "border-color": {"#$0": 1},
  365. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  366. "border-collapse": {"collapse": 1, "separate": 1},
  367. "bottom": {"px": 1, "em": 1, "%": 1},
  368. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  369. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  370. "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},
  371. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  372. "empty-cells": {"show": 1, "hide": 1},
  373. "float": {"left": 1, "right": 1, "none": 1},
  374. "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},
  375. "font-size": {"px": 1, "em": 1, "%": 1},
  376. "font-weight": {"bold": 1, "normal": 1},
  377. "font-style": {"italic": 1, "normal": 1},
  378. "font-variant": {"normal": 1, "small-caps": 1},
  379. "height": {"px": 1, "em": 1, "%": 1},
  380. "left": {"px": 1, "em": 1, "%": 1},
  381. "letter-spacing": {"normal": 1},
  382. "line-height": {"normal": 1},
  383. "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},
  384. "margin": {"px": 1, "em": 1, "%": 1},
  385. "margin-right": {"px": 1, "em": 1, "%": 1},
  386. "margin-left": {"px": 1, "em": 1, "%": 1},
  387. "margin-top": {"px": 1, "em": 1, "%": 1},
  388. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  389. "max-height": {"px": 1, "em": 1, "%": 1},
  390. "max-width": {"px": 1, "em": 1, "%": 1},
  391. "min-height": {"px": 1, "em": 1, "%": 1},
  392. "min-width": {"px": 1, "em": 1, "%": 1},
  393. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  394. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  395. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  396. "padding": {"px": 1, "em": 1, "%": 1},
  397. "padding-top": {"px": 1, "em": 1, "%": 1},
  398. "padding-right": {"px": 1, "em": 1, "%": 1},
  399. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  400. "padding-left": {"px": 1, "em": 1, "%": 1},
  401. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  402. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  403. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  404. "right": {"px": 1, "em": 1, "%": 1},
  405. "table-layout": {"fixed": 1, "auto": 1},
  406. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  407. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  408. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  409. "top": {"px": 1, "em": 1, "%": 1},
  410. "vertical-align": {"top": 1, "bottom": 1},
  411. "visibility": {"hidden": 1, "visible": 1},
  412. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  413. "width": {"px": 1, "em": 1, "%": 1},
  414. "word-spacing": {"normal": 1},
  415. "filter": {"alpha(opacity=$0100)": 1},
  416. "text-shadow": {"$02px 2px 2px #777": 1},
  417. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  418. "-moz-border-radius": 1,
  419. "-moz-border-radius-topright": 1,
  420. "-moz-border-radius-bottomright": 1,
  421. "-moz-border-radius-topleft": 1,
  422. "-moz-border-radius-bottomleft": 1,
  423. "-webkit-border-radius": 1,
  424. "-webkit-border-top-right-radius": 1,
  425. "-webkit-border-top-left-radius": 1,
  426. "-webkit-border-bottom-right-radius": 1,
  427. "-webkit-border-bottom-left-radius": 1,
  428. "-moz-box-shadow": 1,
  429. "-webkit-box-shadow": 1,
  430. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  431. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  432. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  433. };
  434. var CssCompletions = function() {
  435. };
  436. (function() {
  437. this.completionsDefined = false;
  438. this.defineCompletions = function() {
  439. if (document) {
  440. var style = document.createElement('c').style;
  441. for (var i in style) {
  442. if (typeof style[i] !== 'string')
  443. continue;
  444. var name = i.replace(/[A-Z]/g, function(x) {
  445. return '-' + x.toLowerCase();
  446. });
  447. if (!propertyMap.hasOwnProperty(name))
  448. propertyMap[name] = 1;
  449. }
  450. }
  451. this.completionsDefined = true;
  452. }
  453. this.getCompletions = function(state, session, pos, prefix) {
  454. if (!this.completionsDefined) {
  455. this.defineCompletions();
  456. }
  457. var token = session.getTokenAt(pos.row, pos.column);
  458. if (!token)
  459. return [];
  460. if (state==='ruleset'){
  461. var line = session.getLine(pos.row).substr(0, pos.column);
  462. if (/:[^;]+$/.test(line)) {
  463. /([\w\-]+):[^:]*$/.test(line);
  464. return this.getPropertyValueCompletions(state, session, pos, prefix);
  465. } else {
  466. return this.getPropertyCompletions(state, session, pos, prefix);
  467. }
  468. }
  469. return [];
  470. };
  471. this.getPropertyCompletions = function(state, session, pos, prefix) {
  472. var properties = Object.keys(propertyMap);
  473. return properties.map(function(property){
  474. return {
  475. caption: property,
  476. snippet: property + ': $0',
  477. meta: "property",
  478. score: Number.MAX_VALUE
  479. };
  480. });
  481. };
  482. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  483. var line = session.getLine(pos.row).substr(0, pos.column);
  484. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  485. if (!property)
  486. return [];
  487. var values = [];
  488. if (property in propertyMap && typeof propertyMap[property] === "object") {
  489. values = Object.keys(propertyMap[property]);
  490. }
  491. return values.map(function(value){
  492. return {
  493. caption: value,
  494. snippet: value,
  495. meta: "property value",
  496. score: Number.MAX_VALUE
  497. };
  498. });
  499. };
  500. }).call(CssCompletions.prototype);
  501. exports.CssCompletions = CssCompletions;
  502. });
  503. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
  504. "use strict";
  505. var oop = require("../../lib/oop");
  506. var Range = require("../../range").Range;
  507. var BaseFoldMode = require("./fold_mode").FoldMode;
  508. var FoldMode = exports.FoldMode = function(commentRegex) {
  509. if (commentRegex) {
  510. this.foldingStartMarker = new RegExp(
  511. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  512. );
  513. this.foldingStopMarker = new RegExp(
  514. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  515. );
  516. }
  517. };
  518. oop.inherits(FoldMode, BaseFoldMode);
  519. (function() {
  520. this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
  521. this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
  522. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  523. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  524. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  525. this._getFoldWidgetBase = this.getFoldWidget;
  526. this.getFoldWidget = function(session, foldStyle, row) {
  527. var line = session.getLine(row);
  528. if (this.singleLineBlockCommentRe.test(line)) {
  529. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  530. return "";
  531. }
  532. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  533. if (!fw && this.startRegionRe.test(line))
  534. return "start"; // lineCommentRegionStart
  535. return fw;
  536. };
  537. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  538. var line = session.getLine(row);
  539. if (this.startRegionRe.test(line))
  540. return this.getCommentRegionBlock(session, line, row);
  541. var match = line.match(this.foldingStartMarker);
  542. if (match) {
  543. var i = match.index;
  544. if (match[1])
  545. return this.openingBracketBlock(session, match[1], row, i);
  546. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  547. if (range && !range.isMultiLine()) {
  548. if (forceMultiline) {
  549. range = this.getSectionRange(session, row);
  550. } else if (foldStyle != "all")
  551. range = null;
  552. }
  553. return range;
  554. }
  555. if (foldStyle === "markbegin")
  556. return;
  557. var match = line.match(this.foldingStopMarker);
  558. if (match) {
  559. var i = match.index + match[0].length;
  560. if (match[1])
  561. return this.closingBracketBlock(session, match[1], row, i);
  562. return session.getCommentFoldRange(row, i, -1);
  563. }
  564. };
  565. this.getSectionRange = function(session, row) {
  566. var line = session.getLine(row);
  567. var startIndent = line.search(/\S/);
  568. var startRow = row;
  569. var startColumn = line.length;
  570. row = row + 1;
  571. var endRow = row;
  572. var maxRow = session.getLength();
  573. while (++row < maxRow) {
  574. line = session.getLine(row);
  575. var indent = line.search(/\S/);
  576. if (indent === -1)
  577. continue;
  578. if (startIndent > indent)
  579. break;
  580. var subRange = this.getFoldWidgetRange(session, "all", row);
  581. if (subRange) {
  582. if (subRange.start.row <= startRow) {
  583. break;
  584. } else if (subRange.isMultiLine()) {
  585. row = subRange.end.row;
  586. } else if (startIndent == indent) {
  587. break;
  588. }
  589. }
  590. endRow = row;
  591. }
  592. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  593. };
  594. this.getCommentRegionBlock = function(session, line, row) {
  595. var startColumn = line.search(/\s*$/);
  596. var maxRow = session.getLength();
  597. var startRow = row;
  598. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  599. var depth = 1;
  600. while (++row < maxRow) {
  601. line = session.getLine(row);
  602. var m = re.exec(line);
  603. if (!m) continue;
  604. if (m[1]) depth--;
  605. else depth++;
  606. if (!depth) break;
  607. }
  608. var endRow = row;
  609. if (endRow > startRow) {
  610. return new Range(startRow, startColumn, endRow, line.length);
  611. }
  612. };
  613. }).call(FoldMode.prototype);
  614. });
  615. 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(require, exports, module) {
  616. "use strict";
  617. var oop = require("../lib/oop");
  618. var TextMode = require("./text").Mode;
  619. var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules;
  620. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  621. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  622. var CssCompletions = require("./css_completions").CssCompletions;
  623. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  624. var Mode = function() {
  625. this.HighlightRules = LessHighlightRules;
  626. this.$outdent = new MatchingBraceOutdent();
  627. this.$behaviour = new CssBehaviour();
  628. this.$completer = new CssCompletions();
  629. this.foldingRules = new CStyleFoldMode();
  630. };
  631. oop.inherits(Mode, TextMode);
  632. (function() {
  633. this.lineCommentStart = "//";
  634. this.blockComment = {start: "/*", end: "*/"};
  635. this.getNextLineIndent = function(state, line, tab) {
  636. var indent = this.$getIndent(line);
  637. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  638. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  639. return indent;
  640. }
  641. var match = line.match(/^.*\{\s*$/);
  642. if (match) {
  643. indent += tab;
  644. }
  645. return indent;
  646. };
  647. this.checkOutdent = function(state, line, input) {
  648. return this.$outdent.checkOutdent(line, input);
  649. };
  650. this.autoOutdent = function(state, doc, row) {
  651. this.$outdent.autoOutdent(doc, row);
  652. };
  653. this.getCompletions = function(state, session, pos, prefix) {
  654. return this.$completer.getCompletions("ruleset", session, pos, prefix);
  655. };
  656. this.$id = "ace/mode/less";
  657. }).call(Mode.prototype);
  658. exports.Mode = Mode;
  659. });