PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 2.0.7
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v2.0.7
4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 All 340 releases
profile-builder / assets / lib / codemirror / mode / css / css.js

css.js in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 2.0.7, at assets/lib/codemirror/mode/css/css.js

628 lines 28.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 CodeMirror.defineMode("css", function(config, parserConfig) {
2 "use strict";
3
4 if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
5
6 var indentUnit = config.indentUnit,
7 hooks = parserConfig.hooks || {},
8 atMediaTypes = parserConfig.atMediaTypes || {},
9 atMediaFeatures = parserConfig.atMediaFeatures || {},
10 propertyKeywords = parserConfig.propertyKeywords || {},
11 colorKeywords = parserConfig.colorKeywords || {},
12 valueKeywords = parserConfig.valueKeywords || {},
13 allowNested = !!parserConfig.allowNested,
14 type = null;
15
16 function ret(style, tp) { type = tp; return style; }
17
18 function tokenBase(stream, state) {
19 var ch = stream.next();
20 if (hooks[ch]) {
21 // result[0] is style and result[1] is type
22 var result = hooks[ch](stream, state);
23 if (result !== false) return result;
24 }
25 if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("def", stream.current());}
26 else if (ch == "=") ret(null, "compare");
27 else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
28 else if (ch == "\"" || ch == "'") {
29 state.tokenize = tokenString(ch);
30 return state.tokenize(stream, state);
31 }
32 else if (ch == "#") {
33 stream.eatWhile(/[\w\\\-]/);
34 return ret("atom", "hash");
35 }
36 else if (ch == "!") {
37 stream.match(/^\s*\w*/);
38 return ret("keyword", "important");
39 }
40 else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) {
41 stream.eatWhile(/[\w.%]/);
42 return ret("number", "unit");
43 }
44 else if (ch === "-") {
45 if (/\d/.test(stream.peek())) {
46 stream.eatWhile(/[\w.%]/);
47 return ret("number", "unit");
48 } else if (stream.match(/^[^-]+-/)) {
49 return ret("meta", "meta");
50 }
51 }
52 else if (/[,+>*\/]/.test(ch)) {
53 return ret(null, "select-op");
54 }
55 else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
56 return ret("qualifier", "qualifier");
57 }
58 else if (ch == ":") {
59 return ret("operator", ch);
60 }
61 else if (/[;{}\[\]\(\)]/.test(ch)) {
62 return ret(null, ch);
63 }
64 else if (ch == "u" && stream.match("rl(")) {
65 stream.backUp(1);
66 state.tokenize = tokenParenthesized;
67 return ret("property", "variable");
68 }
69 else {
70 stream.eatWhile(/[\w\\\-]/);
71 return ret("property", "variable");
72 }
73 }
74
75 function tokenString(quote, nonInclusive) {
76 return function(stream, state) {
77 var escaped = false, ch;
78 while ((ch = stream.next()) != null) {
79 if (ch == quote && !escaped)
80 break;
81 escaped = !escaped && ch == "\\";
82 }
83 if (!escaped) {
84 if (nonInclusive) stream.backUp(1);
85 state.tokenize = tokenBase;
86 }
87 return ret("string", "string");
88 };
89 }
90
91 function tokenParenthesized(stream, state) {
92 stream.next(); // Must be '('
93 if (!stream.match(/\s*[\"\']/, false))
94 state.tokenize = tokenString(")", true);
95 else
96 state.tokenize = tokenBase;
97 return ret(null, "(");
98 }
99
100 return {
101 startState: function(base) {
102 return {tokenize: tokenBase,
103 baseIndent: base || 0,
104 stack: [],
105 lastToken: null};
106 },
107
108 token: function(stream, state) {
109
110 // Use these terms when applicable (see http://www.xanthir.com/blog/b4E50)
111 //
112 // rule** or **ruleset:
113 // A selector + braces combo, or an at-rule.
114 //
115 // declaration block:
116 // A sequence of declarations.
117 //
118 // declaration:
119 // A property + colon + value combo.
120 //
121 // property value:
122 // The entire value of a property.
123 //
124 // component value:
125 // A single piece of a property value. Like the 5px in
126 // text-shadow: 0 0 5px blue;. Can also refer to things that are
127 // multiple terms, like the 1-4 terms that make up the background-size
128 // portion of the background shorthand.
129 //
130 // term:
131 // The basic unit of author-facing CSS, like a single number (5),
132 // dimension (5px), string ("foo"), or function. Officially defined
133 // by the CSS 2.1 grammar (look for the 'term' production)
134 //
135 //
136 // simple selector:
137 // A single atomic selector, like a type selector, an attr selector, a
138 // class selector, etc.
139 //
140 // compound selector:
141 // One or more simple selectors without a combinator. div.example is
142 // compound, div > .example is not.
143 //
144 // complex selector:
145 // One or more compound selectors chained with combinators.
146 //
147 // combinator:
148 // The parts of selectors that express relationships. There are four
149 // currently - the space (descendant combinator), the greater-than
150 // bracket (child combinator), the plus sign (next sibling combinator),
151 // and the tilda (following sibling combinator).
152 //
153 // sequence of selectors:
154 // One or more of the named type of selector chained with commas.
155
156 state.tokenize = state.tokenize || tokenBase;
157 if (state.tokenize == tokenBase && stream.eatSpace()) return null;
158 var style = state.tokenize(stream, state);
159 if (style && typeof style != "string") style = ret(style[0], style[1]);
160
161 // Changing style returned based on context
162 var context = state.stack[state.stack.length-1];
163 if (style == "variable") {
164 if (type == "variable-definition") state.stack.push("propertyValue");
165 return state.lastToken = "variable-2";
166 } else if (style == "property") {
167 var word = stream.current().toLowerCase();
168 if (context == "propertyValue") {
169 if (valueKeywords.hasOwnProperty(word)) {
170 style = "string-2";
171 } else if (colorKeywords.hasOwnProperty(word)) {
172 style = "keyword";
173 } else {
174 style = "variable-2";
175 }
176 } else if (context == "rule") {
177 if (!propertyKeywords.hasOwnProperty(word)) {
178 style += " error";
179 }
180 } else if (context == "block") {
181 // if a value is present in both property, value, or color, the order
182 // of preference is property -> color -> value
183 if (propertyKeywords.hasOwnProperty(word)) {
184 style = "property";
185 } else if (colorKeywords.hasOwnProperty(word)) {
186 style = "keyword";
187 } else if (valueKeywords.hasOwnProperty(word)) {
188 style = "string-2";
189 } else {
190 style = "tag";
191 }
192 } else if (!context || context == "@media{") {
193 style = "tag";
194 } else if (context == "@media") {
195 if (atMediaTypes[stream.current()]) {
196 style = "attribute"; // Known attribute
197 } else if (/^(only|not)$/.test(word)) {
198 style = "keyword";
199 } else if (word == "and") {
200 style = "error"; // "and" is only allowed in @mediaType
201 } else if (atMediaFeatures.hasOwnProperty(word)) {
202 style = "error"; // Known property, should be in @mediaType(
203 } else {
204 // Unknown, expecting keyword or attribute, assuming attribute
205 style = "attribute error";
206 }
207 } else if (context == "@mediaType") {
208 if (atMediaTypes.hasOwnProperty(word)) {
209 style = "attribute";
210 } else if (word == "and") {
211 style = "operator";
212 } else if (/^(only|not)$/.test(word)) {
213 style = "error"; // Only allowed in @media
214 } else {
215 // Unknown attribute or property, but expecting property (preceded
216 // by "and"). Should be in parentheses
217 style = "error";
218 }
219 } else if (context == "@mediaType(") {
220 if (propertyKeywords.hasOwnProperty(word)) {
221 // do nothing, remains "property"
222 } else if (atMediaTypes.hasOwnProperty(word)) {
223 style = "error"; // Known property, should be in parentheses
224 } else if (word == "and") {
225 style = "operator";
226 } else if (/^(only|not)$/.test(word)) {
227 style = "error"; // Only allowed in @media
228 } else {
229 style += " error";
230 }
231 } else if (context == "@import") {
232 style = "tag";
233 } else {
234 style = "error";
235 }
236 } else if (style == "atom") {
237 if(!context || context == "@media{" || context == "block") {
238 style = "builtin";
239 } else if (context == "propertyValue") {
240 if (!/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())) {
241 style += " error";
242 }
243 } else {
244 style = "error";
245 }
246 } else if (context == "@media" && type == "{") {
247 style = "error";
248 }
249
250 // Push/pop context stack
251 if (type == "{") {
252 if (context == "@media" || context == "@mediaType") {
253 state.stack[state.stack.length-1] = "@media{";
254 }
255 else {
256 var newContext = allowNested ? "block" : "rule";
257 state.stack.push(newContext);
258 }
259 }
260 else if (type == "}") {
261 if (context == "interpolation") style = "operator";
262 state.stack.pop();
263 if (context == "propertyValue") state.stack.pop();
264 }
265 else if (type == "interpolation") state.stack.push("interpolation");
266 else if (type == "@media") state.stack.push("@media");
267 else if (type == "@import") state.stack.push("@import");
268 else if (context == "@media" && /\b(keyword|attribute)\b/.test(style))
269 state.stack[state.stack.length-1] = "@mediaType";
270 else if (context == "@mediaType" && stream.current() == ",")
271 state.stack[state.stack.length-1] = "@media";
272 else if (type == "(") {
273 if (context == "@media" || context == "@mediaType") {
274 // Make sure @mediaType is used to avoid error on {
275 state.stack[state.stack.length-1] = "@mediaType";
276 state.stack.push("@mediaType(");
277 }
278 else state.stack.push("(");
279 }
280 else if (type == ")") {
281 if (context == "propertyValue") {
282 // In @mediaType( without closing ; after propertyValue
283 state.stack.pop();
284 }
285 state.stack.pop();
286 }
287 else if (type == ":" && state.lastToken == "property") state.stack.push("propertyValue");
288 else if (context == "propertyValue" && type == ";") state.stack.pop();
289 else if (context == "@import" && type == ";") state.stack.pop();
290
291 return state.lastToken = style;
292 },
293
294 indent: function(state, textAfter) {
295 var n = state.stack.length;
296 if (/^\}/.test(textAfter))
297 n -= state.stack[n-1] == "propertyValue" ? 2 : 1;
298 return state.baseIndent + n * indentUnit;
299 },
300
301 electricChars: "}",
302 blockCommentStart: "/*",
303 blockCommentEnd: "*/",
304 fold: "brace"
305 };
306 });
307
308 (function() {
309 function keySet(array) {
310 var keys = {};
311 for (var i = 0; i < array.length; ++i) {
312 keys[array[i]] = true;
313 }
314 return keys;
315 }
316
317 var atMediaTypes = keySet([
318 "all", "aural", "braille", "handheld", "print", "projection", "screen",
319 "tty", "tv", "embossed"
320 ]);
321
322 var atMediaFeatures = keySet([
323 "width", "min-width", "max-width", "height", "min-height", "max-height",
324 "device-width", "min-device-width", "max-device-width", "device-height",
325 "min-device-height", "max-device-height", "aspect-ratio",
326 "min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio",
327 "min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color",
328 "max-color", "color-index", "min-color-index", "max-color-index",
329 "monochrome", "min-monochrome", "max-monochrome", "resolution",
330 "min-resolution", "max-resolution", "scan", "grid"
331 ]);
332
333 var propertyKeywords = keySet([
334 "align-content", "align-items", "align-self", "alignment-adjust",
335 "alignment-baseline", "anchor-point", "animation", "animation-delay",
336 "animation-direction", "animation-duration", "animation-iteration-count",
337 "animation-name", "animation-play-state", "animation-timing-function",
338 "appearance", "azimuth", "backface-visibility", "background",
339 "background-attachment", "background-clip", "background-color",
340 "background-image", "background-origin", "background-position",
341 "background-repeat", "background-size", "baseline-shift", "binding",
342 "bleed", "bookmark-label", "bookmark-level", "bookmark-state",
343 "bookmark-target", "border", "border-bottom", "border-bottom-color",
344 "border-bottom-left-radius", "border-bottom-right-radius",
345 "border-bottom-style", "border-bottom-width", "border-collapse",
346 "border-color", "border-image", "border-image-outset",
347 "border-image-repeat", "border-image-slice", "border-image-source",
348 "border-image-width", "border-left", "border-left-color",
349 "border-left-style", "border-left-width", "border-radius", "border-right",
350 "border-right-color", "border-right-style", "border-right-width",
351 "border-spacing", "border-style", "border-top", "border-top-color",
352 "border-top-left-radius", "border-top-right-radius", "border-top-style",
353 "border-top-width", "border-width", "bottom", "box-decoration-break",
354 "box-shadow", "box-sizing", "break-after", "break-before", "break-inside",
355 "caption-side", "clear", "clip", "color", "color-profile", "column-count",
356 "column-fill", "column-gap", "column-rule", "column-rule-color",
357 "column-rule-style", "column-rule-width", "column-span", "column-width",
358 "columns", "content", "counter-increment", "counter-reset", "crop", "cue",
359 "cue-after", "cue-before", "cursor", "direction", "display",
360 "dominant-baseline", "drop-initial-after-adjust",
361 "drop-initial-after-align", "drop-initial-before-adjust",
362 "drop-initial-before-align", "drop-initial-size", "drop-initial-value",
363 "elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis",
364 "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap",
365 "float", "float-offset", "flow-from", "flow-into", "font", "font-feature-settings",
366 "font-family", "font-kerning", "font-language-override", "font-size", "font-size-adjust",
367 "font-stretch", "font-style", "font-synthesis", "font-variant",
368 "font-variant-alternates", "font-variant-caps", "font-variant-east-asian",
369 "font-variant-ligatures", "font-variant-numeric", "font-variant-position",
370 "font-weight", "grid-cell", "grid-column", "grid-column-align",
371 "grid-column-sizing", "grid-column-span", "grid-columns", "grid-flow",
372 "grid-row", "grid-row-align", "grid-row-sizing", "grid-row-span",
373 "grid-rows", "grid-template", "hanging-punctuation", "height", "hyphens",
374 "icon", "image-orientation", "image-rendering", "image-resolution",
375 "inline-box-align", "justify-content", "left", "letter-spacing",
376 "line-break", "line-height", "line-stacking", "line-stacking-ruby",
377 "line-stacking-shift", "line-stacking-strategy", "list-style",
378 "list-style-image", "list-style-position", "list-style-type", "margin",
379 "margin-bottom", "margin-left", "margin-right", "margin-top",
380 "marker-offset", "marks", "marquee-direction", "marquee-loop",
381 "marquee-play-count", "marquee-speed", "marquee-style", "max-height",
382 "max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index",
383 "nav-left", "nav-right", "nav-up", "opacity", "order", "orphans", "outline",
384 "outline-color", "outline-offset", "outline-style", "outline-width",
385 "overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y",
386 "padding", "padding-bottom", "padding-left", "padding-right", "padding-top",
387 "page", "page-break-after", "page-break-before", "page-break-inside",
388 "page-policy", "pause", "pause-after", "pause-before", "perspective",
389 "perspective-origin", "pitch", "pitch-range", "play-during", "position",
390 "presentation-level", "punctuation-trim", "quotes", "region-break-after",
391 "region-break-before", "region-break-inside", "region-fragment",
392 "rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness",
393 "right", "rotation", "rotation-point", "ruby-align", "ruby-overhang",
394 "ruby-position", "ruby-span", "shape-inside", "shape-outside", "size",
395 "speak", "speak-as", "speak-header",
396 "speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set",
397 "tab-size", "table-layout", "target", "target-name", "target-new",
398 "target-position", "text-align", "text-align-last", "text-decoration",
399 "text-decoration-color", "text-decoration-line", "text-decoration-skip",
400 "text-decoration-style", "text-emphasis", "text-emphasis-color",
401 "text-emphasis-position", "text-emphasis-style", "text-height",
402 "text-indent", "text-justify", "text-outline", "text-overflow", "text-shadow",
403 "text-size-adjust", "text-space-collapse", "text-transform", "text-underline-position",
404 "text-wrap", "top", "transform", "transform-origin", "transform-style",
405 "transition", "transition-delay", "transition-duration",
406 "transition-property", "transition-timing-function", "unicode-bidi",
407 "vertical-align", "visibility", "voice-balance", "voice-duration",
408 "voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress",
409 "voice-volume", "volume", "white-space", "widows", "width", "word-break",
410 "word-spacing", "word-wrap", "z-index", "zoom",
411 // SVG-specific
412 "clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
413 "flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
414 "color-interpolation", "color-interpolation-filters", "color-profile",
415 "color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
416 "marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke",
417 "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
418 "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
419 "baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
420 "glyph-orientation-vertical", "kerning", "text-anchor", "writing-mode"
421 ]);
422
423 var colorKeywords = keySet([
424 "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
425 "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
426 "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue",
427 "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
428 "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen",
429 "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
430 "darkslateblue", "darkslategray", "darkturquoise", "darkviolet",
431 "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick",
432 "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
433 "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew",
434 "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
435 "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
436 "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink",
437 "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray",
438 "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
439 "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
440 "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
441 "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
442 "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered",
443 "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred",
444 "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
445 "purple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon",
446 "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue",
447 "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan",
448 "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
449 "whitesmoke", "yellow", "yellowgreen"
450 ]);
451
452 var valueKeywords = keySet([
453 "above", "absolute", "activeborder", "activecaption", "afar",
454 "after-white-space", "ahead", "alias", "all", "all-scroll", "alternate",
455 "always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
456 "arabic-indic", "armenian", "asterisks", "auto", "avoid", "avoid-column", "avoid-page",
457 "avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary",
458 "bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
459 "both", "bottom", "break", "break-all", "break-word", "button", "button-bevel",
460 "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "cambodian",
461 "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
462 "cell", "center", "checkbox", "circle", "cjk-earthly-branch",
463 "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
464 "col-resize", "collapse", "column", "compact", "condensed", "contain", "content",
465 "content-box", "context-menu", "continuous", "copy", "cover", "crop",
466 "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal",
467 "decimal-leading-zero", "default", "default-button", "destination-atop",
468 "destination-in", "destination-out", "destination-over", "devanagari",
469 "disc", "discard", "document", "dot-dash", "dot-dot-dash", "dotted",
470 "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
471 "element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede",
472 "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er",
473 "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er",
474 "ethiopic-halehame-aa-et", "ethiopic-halehame-am-et",
475 "ethiopic-halehame-gez", "ethiopic-halehame-om-et",
476 "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
477 "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et",
478 "ethiopic-halehame-tig", "ew-resize", "expanded", "extra-condensed",
479 "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "footnotes",
480 "forwards", "from", "geometricPrecision", "georgian", "graytext", "groove",
481 "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew",
482 "help", "hidden", "hide", "higher", "highlight", "highlighttext",
483 "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
484 "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
485 "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
486 "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert",
487 "italic", "justify", "kannada", "katakana", "katakana-iroha", "keep-all", "khmer",
488 "landscape", "lao", "large", "larger", "left", "level", "lighter",
489 "line-through", "linear", "lines", "list-item", "listbox", "listitem",
490 "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
491 "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
492 "lower-roman", "lowercase", "ltr", "malayalam", "match",
493 "media-controls-background", "media-current-time-display",
494 "media-fullscreen-button", "media-mute-button", "media-play-button",
495 "media-return-to-realtime-button", "media-rewind-button",
496 "media-seek-back-button", "media-seek-forward-button", "media-slider",
497 "media-sliderthumb", "media-time-remaining-display", "media-volume-slider",
498 "media-volume-slider-container", "media-volume-sliderthumb", "medium",
499 "menu", "menulist", "menulist-button", "menulist-text",
500 "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
501 "mix", "mongolian", "monospace", "move", "multiple", "myanmar", "n-resize",
502 "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
503 "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
504 "ns-resize", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote",
505 "optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
506 "outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
507 "painted", "page", "paused", "persian", "plus-darker", "plus-lighter", "pointer",
508 "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "push-button",
509 "radio", "read-only", "read-write", "read-write-plaintext-only", "rectangle", "region",
510 "relative", "repeat", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba",
511 "ridge", "right", "round", "row-resize", "rtl", "run-in", "running",
512 "s-resize", "sans-serif", "scroll", "scrollbar", "se-resize", "searchfield",
513 "searchfield-cancel-button", "searchfield-decoration",
514 "searchfield-results-button", "searchfield-results-decoration",
515 "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama",
516 "single", "skip-white-space", "slide", "slider-horizontal",
517 "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
518 "small", "small-caps", "small-caption", "smaller", "solid", "somali",
519 "source-atop", "source-in", "source-out", "source-over", "space", "square",
520 "square-button", "start", "static", "status-bar", "stretch", "stroke",
521 "sub", "subpixel-antialiased", "super", "sw-resize", "table",
522 "table-caption", "table-cell", "table-column", "table-column-group",
523 "table-footer-group", "table-header-group", "table-row", "table-row-group",
524 "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai",
525 "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight",
526 "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er",
527 "tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
528 "transparent", "ultra-condensed", "ultra-expanded", "underline", "up",
529 "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
530 "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
531 "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
532 "visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
533 "window", "windowframe", "windowtext", "x-large", "x-small", "xor",
534 "xx-large", "xx-small"
535 ]);
536
537 function tokenCComment(stream, state) {
538 var maybeEnd = false, ch;
539 while ((ch = stream.next()) != null) {
540 if (maybeEnd && ch == "/") {
541 state.tokenize = null;
542 break;
543 }
544 maybeEnd = (ch == "*");
545 }
546 return ["comment", "comment"];
547 }
548
549 CodeMirror.defineMIME("text/css", {
550 atMediaTypes: atMediaTypes,
551 atMediaFeatures: atMediaFeatures,
552 propertyKeywords: propertyKeywords,
553 colorKeywords: colorKeywords,
554 valueKeywords: valueKeywords,
555 hooks: {
556 "<": function(stream, state) {
557 function tokenSGMLComment(stream, state) {
558 var dashes = 0, ch;
559 while ((ch = stream.next()) != null) {
560 if (dashes >= 2 && ch == ">") {
561 state.tokenize = null;
562 break;
563 }
564 dashes = (ch == "-") ? dashes + 1 : 0;
565 }
566 return ["comment", "comment"];
567 }
568 if (stream.eat("!")) {
569 state.tokenize = tokenSGMLComment;
570 return tokenSGMLComment(stream, state);
571 }
572 },
573 "/": function(stream, state) {
574 if (stream.eat("*")) {
575 state.tokenize = tokenCComment;
576 return tokenCComment(stream, state);
577 }
578 return false;
579 }
580 },
581 name: "css"
582 });
583
584 CodeMirror.defineMIME("text/x-scss", {
585 atMediaTypes: atMediaTypes,
586 atMediaFeatures: atMediaFeatures,
587 propertyKeywords: propertyKeywords,
588 colorKeywords: colorKeywords,
589 valueKeywords: valueKeywords,
590 allowNested: true,
591 hooks: {
592 ":": function(stream) {
593 if (stream.match(/\s*{/)) {
594 return [null, "{"];
595 }
596 return false;
597 },
598 "$": function(stream) {
599 stream.match(/^[\w-]+/);
600 if (stream.peek() == ":") {
601 return ["variable", "variable-definition"];
602 }
603 return ["variable", "variable"];
604 },
605 "/": function(stream, state) {
606 if (stream.eat("/")) {
607 stream.skipToEnd();
608 return ["comment", "comment"];
609 } else if (stream.eat("*")) {
610 state.tokenize = tokenCComment;
611 return tokenCComment(stream, state);
612 } else {
613 return ["operator", "operator"];
614 }
615 },
616 "#": function(stream) {
617 if (stream.eat("{")) {
618 return ["operator", "interpolation"];
619 } else {
620 stream.eatWhile(/[\w\\\-]/);
621 return ["atom", "hash"];
622 }
623 }
624 },
625 name: "css"
626 });
627 })();
628