70c7bdd44d2ca09448bd60194fcdd912.js 36 KB

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