PluginProbe
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin / 1.8.6
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin v1.8.6
trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.1 All 71 releases
pdf-print / js / css.js

css.js in PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin 1.8.6, at js/css.js

826 lines 36.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 // Distributed under an MIT license: http://codemirror.net/LICENSE
3
4 (function(mod) {
5 if (typeof exports == "object" && typeof module == "object") // CommonJS
6 mod(require("../../lib/codemirror"));
7 else if (typeof define == "function" && define.amd) // AMD
8 define(["../../lib/codemirror"], mod);
9 else // Plain browser env
10 mod(CodeMirror);
11 })(function(CodeMirror) {
12 "use strict";
13
14 CodeMirror.defineMode("css", function(config, parserConfig) {
15 var provided = parserConfig;
16 if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
17 parserConfig.inline = provided.inline;
18
19 var indentUnit = config.indentUnit,
20 tokenHooks = parserConfig.tokenHooks,
21 documentTypes = parserConfig.documentTypes || {},
22 mediaTypes = parserConfig.mediaTypes || {},
23 mediaFeatures = parserConfig.mediaFeatures || {},
24 mediaValueKeywords = parserConfig.mediaValueKeywords || {},
25 propertyKeywords = parserConfig.propertyKeywords || {},
26 nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},
27 fontProperties = parserConfig.fontProperties || {},
28 counterDescriptors = parserConfig.counterDescriptors || {},
29 colorKeywords = parserConfig.colorKeywords || {},
30 valueKeywords = parserConfig.valueKeywords || {},
31 allowNested = parserConfig.allowNested,
32 supportsAtComponent = parserConfig.supportsAtComponent === true;
33
34 var type, override;
35 function ret(style, tp) { type = tp; return style; }
36
37 // Tokenizers
38
39 function tokenBase(stream, state) {
40 var ch = stream.next();
41 if (tokenHooks[ch]) {
42 var result = tokenHooks[ch](stream, state);
43 if (result !== false) return result;
44 }
45 if (ch == "@") {
46 stream.eatWhile(/[\w\\\-]/);
47 return ret("def", stream.current());
48 } else if (ch == "=" || (ch == "~" || ch == "|") && stream.eat("=")) {
49 return ret(null, "compare");
50 } else if (ch == "\"" || ch == "'") {
51 state.tokenize = tokenString(ch);
52 return state.tokenize(stream, state);
53 } else if (ch == "#") {
54 stream.eatWhile(/[\w\\\-]/);
55 return ret("atom", "hash");
56 } else if (ch == "!") {
57 stream.match(/^\s*\w*/);
58 return ret("keyword", "important");
59 } else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) {
60 stream.eatWhile(/[\w.%]/);
61 return ret("number", "unit");
62 } else if (ch === "-") {
63 if (/[\d.]/.test(stream.peek())) {
64 stream.eatWhile(/[\w.%]/);
65 return ret("number", "unit");
66 } else if (stream.match(/^-[\w\\\-]+/)) {
67 stream.eatWhile(/[\w\\\-]/);
68 if (stream.match(/^\s*:/, false))
69 return ret("variable-2", "variable-definition");
70 return ret("variable-2", "variable");
71 } else if (stream.match(/^\w+-/)) {
72 return ret("meta", "meta");
73 }
74 } else if (/[,+>*\/]/.test(ch)) {
75 return ret(null, "select-op");
76 } else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
77 return ret("qualifier", "qualifier");
78 } else if (/[:;{}\[\]\(\)]/.test(ch)) {
79 return ret(null, ch);
80 } else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) ||
81 (ch == "d" && stream.match("omain(")) ||
82 (ch == "r" && stream.match("egexp("))) {
83 stream.backUp(1);
84 state.tokenize = tokenParenthesized;
85 return ret("property", "word");
86 } else if (/[\w\\\-]/.test(ch)) {
87 stream.eatWhile(/[\w\\\-]/);
88 return ret("property", "word");
89 } else {
90 return ret(null, null);
91 }
92 }
93
94 function tokenString(quote) {
95 return function(stream, state) {
96 var escaped = false, ch;
97 while ((ch = stream.next()) != null) {
98 if (ch == quote && !escaped) {
99 if (quote == ")") stream.backUp(1);
100 break;
101 }
102 escaped = !escaped && ch == "\\";
103 }
104 if (ch == quote || !escaped && quote != ")") state.tokenize = null;
105 return ret("string", "string");
106 };
107 }
108
109 function tokenParenthesized(stream, state) {
110 stream.next(); // Must be '('
111 if (!stream.match(/\s*[\"\')]/, false))
112 state.tokenize = tokenString(")");
113 else
114 state.tokenize = null;
115 return ret(null, "(");
116 }
117
118 // Context management
119
120 function Context(type, indent, prev) {
121 this.type = type;
122 this.indent = indent;
123 this.prev = prev;
124 }
125
126 function pushContext(state, stream, type, indent) {
127 state.context = new Context(type, stream.indentation() + (indent === false ? 0 : indentUnit), state.context);
128 return type;
129 }
130
131 function popContext(state) {
132 if (state.context.prev)
133 state.context = state.context.prev;
134 return state.context.type;
135 }
136
137 function pass(type, stream, state) {
138 return states[state.context.type](type, stream, state);
139 }
140 function popAndPass(type, stream, state, n) {
141 for (var i = n || 1; i > 0; i--)
142 state.context = state.context.prev;
143 return pass(type, stream, state);
144 }
145
146 // Parser
147
148 function wordAsValue(stream) {
149 var word = stream.current().toLowerCase();
150 if (valueKeywords.hasOwnProperty(word))
151 override = "atom";
152 else if (colorKeywords.hasOwnProperty(word))
153 override = "keyword";
154 else
155 override = "variable";
156 }
157
158 var states = {};
159
160 states.top = function(type, stream, state) {
161 if (type == "{") {
162 return pushContext(state, stream, "block");
163 } else if (type == "}" && state.context.prev) {
164 return popContext(state);
165 } else if (supportsAtComponent && /@component/.test(type)) {
166 return pushContext(state, stream, "atComponentBlock");
167 } else if (/^@(-moz-)?document$/.test(type)) {
168 return pushContext(state, stream, "documentTypes");
169 } else if (/^@(media|supports|(-moz-)?document|import)$/.test(type)) {
170 return pushContext(state, stream, "atBlock");
171 } else if (/^@(font-face|counter-style)/.test(type)) {
172 state.stateArg = type;
173 return "restricted_atBlock_before";
174 } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
175 return "keyframes";
176 } else if (type && type.charAt(0) == "@") {
177 return pushContext(state, stream, "at");
178 } else if (type == "hash") {
179 override = "builtin";
180 } else if (type == "word") {
181 override = "tag";
182 } else if (type == "variable-definition") {
183 return "maybeprop";
184 } else if (type == "interpolation") {
185 return pushContext(state, stream, "interpolation");
186 } else if (type == ":") {
187 return "pseudo";
188 } else if (allowNested && type == "(") {
189 return pushContext(state, stream, "parens");
190 }
191 return state.context.type;
192 };
193
194 states.block = function(type, stream, state) {
195 if (type == "word") {
196 var word = stream.current().toLowerCase();
197 if (propertyKeywords.hasOwnProperty(word)) {
198 override = "property";
199 return "maybeprop";
200 } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
201 override = "string-2";
202 return "maybeprop";
203 } else if (allowNested) {
204 override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
205 return "block";
206 } else {
207 override += " error";
208 return "maybeprop";
209 }
210 } else if (type == "meta") {
211 return "block";
212 } else if (!allowNested && (type == "hash" || type == "qualifier")) {
213 override = "error";
214 return "block";
215 } else {
216 return states.top(type, stream, state);
217 }
218 };
219
220 states.maybeprop = function(type, stream, state) {
221 if (type == ":") return pushContext(state, stream, "prop");
222 return pass(type, stream, state);
223 };
224
225 states.prop = function(type, stream, state) {
226 if (type == ";") return popContext(state);
227 if (type == "{" && allowNested) return pushContext(state, stream, "propBlock");
228 if (type == "}" || type == "{") return popAndPass(type, stream, state);
229 if (type == "(") return pushContext(state, stream, "parens");
230
231 if (type == "hash" && !/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())) {
232 override += " error";
233 } else if (type == "word") {
234 wordAsValue(stream);
235 } else if (type == "interpolation") {
236 return pushContext(state, stream, "interpolation");
237 }
238 return "prop";
239 };
240
241 states.propBlock = function(type, _stream, state) {
242 if (type == "}") return popContext(state);
243 if (type == "word") { override = "property"; return "maybeprop"; }
244 return state.context.type;
245 };
246
247 states.parens = function(type, stream, state) {
248 if (type == "{" || type == "}") return popAndPass(type, stream, state);
249 if (type == ")") return popContext(state);
250 if (type == "(") return pushContext(state, stream, "parens");
251 if (type == "interpolation") return pushContext(state, stream, "interpolation");
252 if (type == "word") wordAsValue(stream);
253 return "parens";
254 };
255
256 states.pseudo = function(type, stream, state) {
257 if (type == "word") {
258 override = "variable-3";
259 return state.context.type;
260 }
261 return pass(type, stream, state);
262 };
263
264 states.documentTypes = function(type, stream, state) {
265 if (type == "word" && documentTypes.hasOwnProperty(stream.current())) {
266 override = "tag";
267 return state.context.type;
268 } else {
269 return states.atBlock(type, stream, state);
270 }
271 };
272
273 states.atBlock = function(type, stream, state) {
274 if (type == "(") return pushContext(state, stream, "atBlock_parens");
275 if (type == "}" || type == ";") return popAndPass(type, stream, state);
276 if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top");
277
278 if (type == "interpolation") return pushContext(state, stream, "interpolation");
279
280 if (type == "word") {
281 var word = stream.current().toLowerCase();
282 if (word == "only" || word == "not" || word == "and" || word == "or")
283 override = "keyword";
284 else if (mediaTypes.hasOwnProperty(word))
285 override = "attribute";
286 else if (mediaFeatures.hasOwnProperty(word))
287 override = "property";
288 else if (mediaValueKeywords.hasOwnProperty(word))
289 override = "keyword";
290 else if (propertyKeywords.hasOwnProperty(word))
291 override = "property";
292 else if (nonStandardPropertyKeywords.hasOwnProperty(word))
293 override = "string-2";
294 else if (valueKeywords.hasOwnProperty(word))
295 override = "atom";
296 else if (colorKeywords.hasOwnProperty(word))
297 override = "keyword";
298 else
299 override = "error";
300 }
301 return state.context.type;
302 };
303
304 states.atComponentBlock = function(type, stream, state) {
305 if (type == "}")
306 return popAndPass(type, stream, state);
307 if (type == "{")
308 return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top", false);
309 if (type == "word")
310 override = "error";
311 return state.context.type;
312 };
313
314 states.atBlock_parens = function(type, stream, state) {
315 if (type == ")") return popContext(state);
316 if (type == "{" || type == "}") return popAndPass(type, stream, state, 2);
317 return states.atBlock(type, stream, state);
318 };
319
320 states.restricted_atBlock_before = function(type, stream, state) {
321 if (type == "{")
322 return pushContext(state, stream, "restricted_atBlock");
323 if (type == "word" && state.stateArg == "@counter-style") {
324 override = "variable";
325 return "restricted_atBlock_before";
326 }
327 return pass(type, stream, state);
328 };
329
330 states.restricted_atBlock = function(type, stream, state) {
331 if (type == "}") {
332 state.stateArg = null;
333 return popContext(state);
334 }
335 if (type == "word") {
336 if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||
337 (state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))
338 override = "error";
339 else
340 override = "property";
341 return "maybeprop";
342 }
343 return "restricted_atBlock";
344 };
345
346 states.keyframes = function(type, stream, state) {
347 if (type == "word") { override = "variable"; return "keyframes"; }
348 if (type == "{") return pushContext(state, stream, "top");
349 return pass(type, stream, state);
350 };
351
352 states.at = function(type, stream, state) {
353 if (type == ";") return popContext(state);
354 if (type == "{" || type == "}") return popAndPass(type, stream, state);
355 if (type == "word") override = "tag";
356 else if (type == "hash") override = "builtin";
357 return "at";
358 };
359
360 states.interpolation = function(type, stream, state) {
361 if (type == "}") return popContext(state);
362 if (type == "{" || type == ";") return popAndPass(type, stream, state);
363 if (type == "word") override = "variable";
364 else if (type != "variable" && type != "(" && type != ")") override = "error";
365 return "interpolation";
366 };
367
368 return {
369 startState: function(base) {
370 return {tokenize: null,
371 state: parserConfig.inline ? "block" : "top",
372 stateArg: null,
373 context: new Context(parserConfig.inline ? "block" : "top", base || 0, null)};
374 },
375
376 token: function(stream, state) {
377 if (!state.tokenize && stream.eatSpace()) return null;
378 var style = (state.tokenize || tokenBase)(stream, state);
379 if (style && typeof style == "object") {
380 type = style[1];
381 style = style[0];
382 }
383 override = style;
384 state.state = states[state.state](type, stream, state);
385 return override;
386 },
387
388 indent: function(state, textAfter) {
389 var cx = state.context, ch = textAfter && textAfter.charAt(0);
390 var indent = cx.indent;
391 if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev;
392 if (cx.prev) {
393 if (ch == "}" && (cx.type == "block" || cx.type == "top" ||
394 cx.type == "interpolation" || cx.type == "restricted_atBlock")) {
395 // Resume indentation from parent context.
396 cx = cx.prev;
397 indent = cx.indent;
398 } else if (ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
399 ch == "{" && (cx.type == "at" || cx.type == "atBlock")) {
400 // Dedent relative to current context.
401 indent = Math.max(0, cx.indent - indentUnit);
402 cx = cx.prev;
403 }
404 }
405 return indent;
406 },
407
408 electricChars: "}",
409 blockCommentStart: "/*",
410 blockCommentEnd: "*/",
411 fold: "brace"
412 };
413 });
414
415 function keySet(array) {
416 var keys = {};
417 for (var i = 0; i < array.length; ++i) {
418 keys[array[i]] = true;
419 }
420 return keys;
421 }
422
423 var documentTypes_ = [
424 "domain", "regexp", "url", "url-prefix"
425 ], documentTypes = keySet(documentTypes_);
426
427 var mediaTypes_ = [
428 "all", "aural", "braille", "handheld", "print", "projection", "screen",
429 "tty", "tv", "embossed"
430 ], mediaTypes = keySet(mediaTypes_);
431
432 var mediaFeatures_ = [
433 "width", "min-width", "max-width", "height", "min-height", "max-height",
434 "device-width", "min-device-width", "max-device-width", "device-height",
435 "min-device-height", "max-device-height", "aspect-ratio",
436 "min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio",
437 "min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color",
438 "max-color", "color-index", "min-color-index", "max-color-index",
439 "monochrome", "min-monochrome", "max-monochrome", "resolution",
440 "min-resolution", "max-resolution", "scan", "grid", "orientation",
441 "device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
442 "pointer", "any-pointer", "hover", "any-hover"
443 ], mediaFeatures = keySet(mediaFeatures_);
444
445 var mediaValueKeywords_ = [
446 "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
447 "interlace", "progressive"
448 ], mediaValueKeywords = keySet(mediaValueKeywords_);
449
450 var propertyKeywords_ = [
451 "align-content", "align-items", "align-self", "alignment-adjust",
452 "alignment-baseline", "anchor-point", "animation", "animation-delay",
453 "animation-direction", "animation-duration", "animation-fill-mode",
454 "animation-iteration-count", "animation-name", "animation-play-state",
455 "animation-timing-function", "appearance", "azimuth", "backface-visibility",
456 "background", "background-attachment", "background-clip", "background-color",
457 "background-image", "background-origin", "background-position",
458 "background-repeat", "background-size", "baseline-shift", "binding",
459 "bleed", "bookmark-label", "bookmark-level", "bookmark-state",
460 "bookmark-target", "border", "border-bottom", "border-bottom-color",
461 "border-bottom-left-radius", "border-bottom-right-radius",
462 "border-bottom-style", "border-bottom-width", "border-collapse",
463 "border-color", "border-image", "border-image-outset",
464 "border-image-repeat", "border-image-slice", "border-image-source",
465 "border-image-width", "border-left", "border-left-color",
466 "border-left-style", "border-left-width", "border-radius", "border-right",
467 "border-right-color", "border-right-style", "border-right-width",
468 "border-spacing", "border-style", "border-top", "border-top-color",
469 "border-top-left-radius", "border-top-right-radius", "border-top-style",
470 "border-top-width", "border-width", "bottom", "box-decoration-break",
471 "box-shadow", "box-sizing", "break-after", "break-before", "break-inside",
472 "caption-side", "clear", "clip", "color", "color-profile", "column-count",
473 "column-fill", "column-gap", "column-rule", "column-rule-color",
474 "column-rule-style", "column-rule-width", "column-span", "column-width",
475 "columns", "content", "counter-increment", "counter-reset", "crop", "cue",
476 "cue-after", "cue-before", "cursor", "direction", "display",
477 "dominant-baseline", "drop-initial-after-adjust",
478 "drop-initial-after-align", "drop-initial-before-adjust",
479 "drop-initial-before-align", "drop-initial-size", "drop-initial-value",
480 "elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis",
481 "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap",
482 "float", "float-offset", "flow-from", "flow-into", "font", "font-feature-settings",
483 "font-family", "font-kerning", "font-language-override", "font-size", "font-size-adjust",
484 "font-stretch", "font-style", "font-synthesis", "font-variant",
485 "font-variant-alternates", "font-variant-caps", "font-variant-east-asian",
486 "font-variant-ligatures", "font-variant-numeric", "font-variant-position",
487 "font-weight", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow",
488 "grid-auto-position", "grid-auto-rows", "grid-column", "grid-column-end",
489 "grid-column-start", "grid-row", "grid-row-end", "grid-row-start",
490 "grid-template", "grid-template-areas", "grid-template-columns",
491 "grid-template-rows", "hanging-punctuation", "height", "hyphens",
492 "icon", "image-orientation", "image-rendering", "image-resolution",
493 "inline-box-align", "justify-content", "left", "letter-spacing",
494 "line-break", "line-height", "line-stacking", "line-stacking-ruby",
495 "line-stacking-shift", "line-stacking-strategy", "list-style",
496 "list-style-image", "list-style-position", "list-style-type", "margin",
497 "margin-bottom", "margin-left", "margin-right", "margin-top",
498 "marker-offset", "marks", "marquee-direction", "marquee-loop",
499 "marquee-play-count", "marquee-speed", "marquee-style", "max-height",
500 "max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index",
501 "nav-left", "nav-right", "nav-up", "object-fit", "object-position",
502 "opacity", "order", "orphans", "outline",
503 "outline-color", "outline-offset", "outline-style", "outline-width",
504 "overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y",
505 "padding", "padding-bottom", "padding-left", "padding-right", "padding-top",
506 "page", "page-break-after", "page-break-before", "page-break-inside",
507 "page-policy", "pause", "pause-after", "pause-before", "perspective",
508 "perspective-origin", "pitch", "pitch-range", "play-during", "position",
509 "presentation-level", "punctuation-trim", "quotes", "region-break-after",
510 "region-break-before", "region-break-inside", "region-fragment",
511 "rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness",
512 "right", "rotation", "rotation-point", "ruby-align", "ruby-overhang",
513 "ruby-position", "ruby-span", "shape-image-threshold", "shape-inside", "shape-margin",
514 "shape-outside", "size", "speak", "speak-as", "speak-header",
515 "speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set",
516 "tab-size", "table-layout", "target", "target-name", "target-new",
517 "target-position", "text-align", "text-align-last", "text-decoration",
518 "text-decoration-color", "text-decoration-line", "text-decoration-skip",
519 "text-decoration-style", "text-emphasis", "text-emphasis-color",
520 "text-emphasis-position", "text-emphasis-style", "text-height",
521 "text-indent", "text-justify", "text-outline", "text-overflow", "text-shadow",
522 "text-size-adjust", "text-space-collapse", "text-transform", "text-underline-position",
523 "text-wrap", "top", "transform", "transform-origin", "transform-style",
524 "transition", "transition-delay", "transition-duration",
525 "transition-property", "transition-timing-function", "unicode-bidi",
526 "vertical-align", "visibility", "voice-balance", "voice-duration",
527 "voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress",
528 "voice-volume", "volume", "white-space", "widows", "width", "word-break",
529 "word-spacing", "word-wrap", "z-index",
530 // SVG-specific
531 "clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
532 "flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
533 "color-interpolation", "color-interpolation-filters",
534 "color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
535 "marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke",
536 "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
537 "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
538 "baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
539 "glyph-orientation-vertical", "text-anchor", "writing-mode"
540 ], propertyKeywords = keySet(propertyKeywords_);
541
542 var nonStandardPropertyKeywords_ = [
543 "scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color",
544 "scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color",
545 "scrollbar-3d-light-color", "scrollbar-track-color", "shape-inside",
546 "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
547 "searchfield-results-decoration", "zoom"
548 ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);
549
550 var fontProperties_ = [
551 "font-family", "src", "unicode-range", "font-variant", "font-feature-settings",
552 "font-stretch", "font-weight", "font-style"
553 ], fontProperties = keySet(fontProperties_);
554
555 var counterDescriptors_ = [
556 "additive-symbols", "fallback", "negative", "pad", "prefix", "range",
557 "speak-as", "suffix", "symbols", "system"
558 ], counterDescriptors = keySet(counterDescriptors_);
559
560 var colorKeywords_ = [
561 "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
562 "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
563 "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue",
564 "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
565 "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen",
566 "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
567 "darkslateblue", "darkslategray", "darkturquoise", "darkviolet",
568 "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick",
569 "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
570 "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew",
571 "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
572 "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
573 "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink",
574 "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray",
575 "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
576 "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
577 "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
578 "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
579 "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered",
580 "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred",
581 "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
582 "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown",
583 "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue",
584 "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan",
585 "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
586 "whitesmoke", "yellow", "yellowgreen"
587 ], colorKeywords = keySet(colorKeywords_);
588
589 var valueKeywords_ = [
590 "above", "absolute", "activeborder", "additive", "activecaption", "afar",
591 "after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate",
592 "always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
593 "arabic-indic", "armenian", "asterisks", "attr", "auto", "avoid", "avoid-column", "avoid-page",
594 "avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary",
595 "bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
596 "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel",
597 "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian",
598 "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
599 "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
600 "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
601 "col-resize", "collapse", "column", "column-reverse", "compact", "condensed", "contain", "content",
602 "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
603 "cross", "crosshair", "currentcolor", "cursive", "cyclic", "dashed", "decimal",
604 "decimal-leading-zero", "default", "default-button", "destination-atop",
605 "destination-in", "destination-out", "destination-over", "devanagari",
606 "disc", "discard", "disclosure-closed", "disclosure-open", "document",
607 "dot-dash", "dot-dot-dash",
608 "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
609 "element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede",
610 "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er",
611 "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er",
612 "ethiopic-halehame-aa-et", "ethiopic-halehame-am-et",
613 "ethiopic-halehame-gez", "ethiopic-halehame-om-et",
614 "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
615 "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
616 "ethiopic-numeric", "ew-resize", "expanded", "extends", "extra-condensed",
617 "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
618 "forwards", "from", "geometricPrecision", "georgian", "graytext", "groove",
619 "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew",
620 "help", "hidden", "hide", "higher", "highlight", "highlighttext",
621 "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
622 "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
623 "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
624 "inline-block", "inline-flex", "inline-table", "inset", "inside", "intrinsic", "invert",
625 "italic", "japanese-formal", "japanese-informal", "justify", "kannada",
626 "katakana", "katakana-iroha", "keep-all", "khmer",
627 "korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
628 "landscape", "lao", "large", "larger", "left", "level", "lighter",
629 "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
630 "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
631 "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
632 "lower-roman", "lowercase", "ltr", "malayalam", "match", "matrix", "matrix3d",
633 "media-controls-background", "media-current-time-display",
634 "media-fullscreen-button", "media-mute-button", "media-play-button",
635 "media-return-to-realtime-button", "media-rewind-button",
636 "media-seek-back-button", "media-seek-forward-button", "media-slider",
637 "media-sliderthumb", "media-time-remaining-display", "media-volume-slider",
638 "media-volume-slider-container", "media-volume-sliderthumb", "medium",
639 "menu", "menulist", "menulist-button", "menulist-text",
640 "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
641 "mix", "mongolian", "monospace", "move", "multiple", "myanmar", "n-resize",
642 "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
643 "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
644 "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote",
645 "optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
646 "outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
647 "painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter",
648 "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d",
649 "progress", "push-button", "radial-gradient", "radio", "read-only",
650 "read-write", "read-write-plaintext-only", "rectangle", "region",
651 "relative", "repeat", "repeating-linear-gradient",
652 "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse",
653 "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
654 "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
655 "s-resize", "sans-serif", "scale", "scale3d", "scaleX", "scaleY", "scaleZ",
656 "scroll", "scrollbar", "se-resize", "searchfield",
657 "searchfield-cancel-button", "searchfield-decoration",
658 "searchfield-results-button", "searchfield-results-decoration",
659 "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama",
660 "simp-chinese-formal", "simp-chinese-informal", "single",
661 "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
662 "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
663 "small", "small-caps", "small-caption", "smaller", "solid", "somali",
664 "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "spell-out", "square",
665 "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub",
666 "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "table",
667 "table-caption", "table-cell", "table-column", "table-column-group",
668 "table-footer-group", "table-header-group", "table-row", "table-row-group",
669 "tamil",
670 "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai",
671 "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight",
672 "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er",
673 "tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
674 "trad-chinese-formal", "trad-chinese-informal",
675 "translate", "translate3d", "translateX", "translateY", "translateZ",
676 "transparent", "ultra-condensed", "ultra-expanded", "underline", "up",
677 "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
678 "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
679 "var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
680 "visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
681 "window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor",
682 "xx-large", "xx-small"
683 ], valueKeywords = keySet(valueKeywords_);
684
685 var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)
686 .concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)
687 .concat(valueKeywords_);
688 CodeMirror.registerHelper("hintWords", "css", allWords);
689
690 function tokenCComment(stream, state) {
691 var maybeEnd = false, ch;
692 while ((ch = stream.next()) != null) {
693 if (maybeEnd && ch == "/") {
694 state.tokenize = null;
695 break;
696 }
697 maybeEnd = (ch == "*");
698 }
699 return ["comment", "comment"];
700 }
701
702 CodeMirror.defineMIME("text/css", {
703 documentTypes: documentTypes,
704 mediaTypes: mediaTypes,
705 mediaFeatures: mediaFeatures,
706 mediaValueKeywords: mediaValueKeywords,
707 propertyKeywords: propertyKeywords,
708 nonStandardPropertyKeywords: nonStandardPropertyKeywords,
709 fontProperties: fontProperties,
710 counterDescriptors: counterDescriptors,
711 colorKeywords: colorKeywords,
712 valueKeywords: valueKeywords,
713 tokenHooks: {
714 "/": function(stream, state) {
715 if (!stream.eat("*")) return false;
716 state.tokenize = tokenCComment;
717 return tokenCComment(stream, state);
718 }
719 },
720 name: "css"
721 });
722
723 CodeMirror.defineMIME("text/x-scss", {
724 mediaTypes: mediaTypes,
725 mediaFeatures: mediaFeatures,
726 mediaValueKeywords: mediaValueKeywords,
727 propertyKeywords: propertyKeywords,
728 nonStandardPropertyKeywords: nonStandardPropertyKeywords,
729 colorKeywords: colorKeywords,
730 valueKeywords: valueKeywords,
731 fontProperties: fontProperties,
732 allowNested: true,
733 tokenHooks: {
734 "/": function(stream, state) {
735 if (stream.eat("/")) {
736 stream.skipToEnd();
737 return ["comment", "comment"];
738 } else if (stream.eat("*")) {
739 state.tokenize = tokenCComment;
740 return tokenCComment(stream, state);
741 } else {
742 return ["operator", "operator"];
743 }
744 },
745 ":": function(stream) {
746 if (stream.match(/\s*\{/))
747 return [null, "{"];
748 return false;
749 },
750 "$": function(stream) {
751 stream.match(/^[\w-]+/);
752 if (stream.match(/^\s*:/, false))
753 return ["variable-2", "variable-definition"];
754 return ["variable-2", "variable"];
755 },
756 "#": function(stream) {
757 if (!stream.eat("{")) return false;
758 return [null, "interpolation"];
759 }
760 },
761 name: "css",
762 helperType: "scss"
763 });
764
765 CodeMirror.defineMIME("text/x-less", {
766 mediaTypes: mediaTypes,
767 mediaFeatures: mediaFeatures,
768 mediaValueKeywords: mediaValueKeywords,
769 propertyKeywords: propertyKeywords,
770 nonStandardPropertyKeywords: nonStandardPropertyKeywords,
771 colorKeywords: colorKeywords,
772 valueKeywords: valueKeywords,
773 fontProperties: fontProperties,
774 allowNested: true,
775 tokenHooks: {
776 "/": function(stream, state) {
777 if (stream.eat("/")) {
778 stream.skipToEnd();
779 return ["comment", "comment"];
780 } else if (stream.eat("*")) {
781 state.tokenize = tokenCComment;
782 return tokenCComment(stream, state);
783 } else {
784 return ["operator", "operator"];
785 }
786 },
787 "@": function(stream) {
788 if (stream.eat("{")) return [null, "interpolation"];
789 if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false;
790 stream.eatWhile(/[\w\\\-]/);
791 if (stream.match(/^\s*:/, false))
792 return ["variable-2", "variable-definition"];
793 return ["variable-2", "variable"];
794 },
795 "&": function() {
796 return ["atom", "atom"];
797 }
798 },
799 name: "css",
800 helperType: "less"
801 });
802
803 CodeMirror.defineMIME("text/x-gss", {
804 documentTypes: documentTypes,
805 mediaTypes: mediaTypes,
806 mediaFeatures: mediaFeatures,
807 propertyKeywords: propertyKeywords,
808 nonStandardPropertyKeywords: nonStandardPropertyKeywords,
809 fontProperties: fontProperties,
810 counterDescriptors: counterDescriptors,
811 colorKeywords: colorKeywords,
812 valueKeywords: valueKeywords,
813 supportsAtComponent: true,
814 tokenHooks: {
815 "/": function(stream, state) {
816 if (!stream.eat("*")) return false;
817 state.tokenize = tokenCComment;
818 return tokenCComment(stream, state);
819 }
820 },
821 name: "css",
822 helperType: "gss"
823 });
824
825 });
826