2014-10-05 17:43:05 +00:00
|
|
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
|
|
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
|
|
|
|
|
|
|
(function(mod) {
|
|
|
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
|
|
|
mod(require("../../lib/codemirror"));
|
|
|
|
else if (typeof define == "function" && define.amd) // AMD
|
|
|
|
define(["../../lib/codemirror"], mod);
|
|
|
|
else // Plain browser env
|
|
|
|
mod(CodeMirror);
|
|
|
|
})(function(CodeMirror) {
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
CodeMirror.defineMode("css", function(config, parserConfig) {
|
2017-02-08 12:35:49 +00:00
|
|
|
var inline = parserConfig.inline
|
2014-10-05 17:43:05 +00:00
|
|
|
if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
|
|
|
|
|
|
|
|
var indentUnit = config.indentUnit,
|
|
|
|
tokenHooks = parserConfig.tokenHooks,
|
2015-02-25 02:42:17 +00:00
|
|
|
documentTypes = parserConfig.documentTypes || {},
|
2014-10-05 17:43:05 +00:00
|
|
|
mediaTypes = parserConfig.mediaTypes || {},
|
|
|
|
mediaFeatures = parserConfig.mediaFeatures || {},
|
2017-02-08 12:35:49 +00:00
|
|
|
mediaValueKeywords = parserConfig.mediaValueKeywords || {},
|
2014-10-05 17:43:05 +00:00
|
|
|
propertyKeywords = parserConfig.propertyKeywords || {},
|
|
|
|
nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},
|
2015-02-25 02:42:17 +00:00
|
|
|
fontProperties = parserConfig.fontProperties || {},
|
|
|
|
counterDescriptors = parserConfig.counterDescriptors || {},
|
2014-10-05 17:43:05 +00:00
|
|
|
colorKeywords = parserConfig.colorKeywords || {},
|
|
|
|
valueKeywords = parserConfig.valueKeywords || {},
|
2017-02-08 12:35:49 +00:00
|
|
|
allowNested = parserConfig.allowNested,
|
2017-03-18 00:24:59 +00:00
|
|
|
lineComment = parserConfig.lineComment,
|
2017-02-08 12:35:49 +00:00
|
|
|
supportsAtComponent = parserConfig.supportsAtComponent === true;
|
2014-10-05 17:43:05 +00:00
|
|
|
|
|
|
|
var type, override;
|
|
|
|
function ret(style, tp) { type = tp; return style; }
|
|
|
|
|
|
|
|
// Tokenizers
|
|
|
|
|
|
|
|
function tokenBase(stream, state) {
|
|
|
|
var ch = stream.next();
|
|
|
|
if (tokenHooks[ch]) {
|
|
|
|
var result = tokenHooks[ch](stream, state);
|
|
|
|
if (result !== false) return result;
|
|
|
|
}
|
|
|
|
if (ch == "@") {
|
|
|
|
stream.eatWhile(/[\w\\\-]/);
|
|
|
|
return ret("def", stream.current());
|
|
|
|
} else if (ch == "=" || (ch == "~" || ch == "|") && stream.eat("=")) {
|
|
|
|
return ret(null, "compare");
|
|
|
|
} else if (ch == "\"" || ch == "'") {
|
|
|
|
state.tokenize = tokenString(ch);
|
|
|
|
return state.tokenize(stream, state);
|
|
|
|
} else if (ch == "#") {
|
|
|
|
stream.eatWhile(/[\w\\\-]/);
|
|
|
|
return ret("atom", "hash");
|
|
|
|
} else if (ch == "!") {
|
|
|
|
stream.match(/^\s*\w*/);
|
|
|
|
return ret("keyword", "important");
|
|
|
|
} else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) {
|
|
|
|
stream.eatWhile(/[\w.%]/);
|
|
|
|
return ret("number", "unit");
|
|
|
|
} else if (ch === "-") {
|
|
|
|
if (/[\d.]/.test(stream.peek())) {
|
|
|
|
stream.eatWhile(/[\w.%]/);
|
|
|
|
return ret("number", "unit");
|
2015-02-25 02:42:17 +00:00
|
|
|
} else if (stream.match(/^-[\w\\\-]+/)) {
|
|
|
|
stream.eatWhile(/[\w\\\-]/);
|
|
|
|
if (stream.match(/^\s*:/, false))
|
|
|
|
return ret("variable-2", "variable-definition");
|
|
|
|
return ret("variable-2", "variable");
|
2014-10-05 17:43:05 +00:00
|
|
|
} else if (stream.match(/^\w+-/)) {
|
|
|
|
return ret("meta", "meta");
|
|
|
|
}
|
|
|
|
} else if (/[,+>*\/]/.test(ch)) {
|
|
|
|
return ret(null, "select-op");
|
|
|
|
} else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
|
|
|
|
return ret("qualifier", "qualifier");
|
|
|
|
} else if (/[:;{}\[\]\(\)]/.test(ch)) {
|
|
|
|
return ret(null, ch);
|
2015-02-25 02:42:17 +00:00
|
|
|
} else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) ||
|
|
|
|
(ch == "d" && stream.match("omain(")) ||
|
|
|
|
(ch == "r" && stream.match("egexp("))) {
|
2014-10-05 17:43:05 +00:00
|
|
|
stream.backUp(1);
|
|
|
|
state.tokenize = tokenParenthesized;
|
|
|
|
return ret("property", "word");
|
|
|
|
} else if (/[\w\\\-]/.test(ch)) {
|
|
|
|
stream.eatWhile(/[\w\\\-]/);
|
|
|
|
return ret("property", "word");
|
|
|
|
} else {
|
|
|
|
return ret(null, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function tokenString(quote) {
|
|
|
|
return function(stream, state) {
|
|
|
|
var escaped = false, ch;
|
|
|
|
while ((ch = stream.next()) != null) {
|
|
|
|
if (ch == quote && !escaped) {
|
|
|
|
if (quote == ")") stream.backUp(1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
escaped = !escaped && ch == "\\";
|
|
|
|
}
|
|
|
|
if (ch == quote || !escaped && quote != ")") state.tokenize = null;
|
|
|
|
return ret("string", "string");
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function tokenParenthesized(stream, state) {
|
|
|
|
stream.next(); // Must be '('
|
|
|
|
if (!stream.match(/\s*[\"\')]/, false))
|
|
|
|
state.tokenize = tokenString(")");
|
|
|
|
else
|
|
|
|
state.tokenize = null;
|
|
|
|
return ret(null, "(");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Context management
|
|
|
|
|
|
|
|
function Context(type, indent, prev) {
|
|
|
|
this.type = type;
|
|
|
|
this.indent = indent;
|
|
|
|
this.prev = prev;
|
|
|
|
}
|
|
|
|
|
2017-02-08 12:35:49 +00:00
|
|
|
function pushContext(state, stream, type, indent) {
|
|
|
|
state.context = new Context(type, stream.indentation() + (indent === false ? 0 : indentUnit), state.context);
|
2014-10-05 17:43:05 +00:00
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
function popContext(state) {
|
2017-02-08 12:35:49 +00:00
|
|
|
if (state.context.prev)
|
|
|
|
state.context = state.context.prev;
|
2014-10-05 17:43:05 +00:00
|
|
|
return state.context.type;
|
|
|
|
}
|
|
|
|
|
|
|
|
function pass(type, stream, state) {
|
|
|
|
return states[state.context.type](type, stream, state);
|
|
|
|
}
|
|
|
|
function popAndPass(type, stream, state, n) {
|
|
|
|
for (var i = n || 1; i > 0; i--)
|
|
|
|
state.context = state.context.prev;
|
|
|
|
return pass(type, stream, state);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parser
|
|
|
|
|
|
|
|
function wordAsValue(stream) {
|
|
|
|
var word = stream.current().toLowerCase();
|
|
|
|
if (valueKeywords.hasOwnProperty(word))
|
|
|
|
override = "atom";
|
|
|
|
else if (colorKeywords.hasOwnProperty(word))
|
|
|
|
override = "keyword";
|
|
|
|
else
|
|
|
|
override = "variable";
|
|
|
|
}
|
|
|
|
|
|
|
|
var states = {};
|
|
|
|
|
|
|
|
states.top = function(type, stream, state) {
|
|
|
|
if (type == "{") {
|
|
|
|
return pushContext(state, stream, "block");
|
|
|
|
} else if (type == "}" && state.context.prev) {
|
|
|
|
return popContext(state);
|
2017-02-08 12:35:49 +00:00
|
|
|
} else if (supportsAtComponent && /@component/.test(type)) {
|
|
|
|
return pushContext(state, stream, "atComponentBlock");
|
|
|
|
} else if (/^@(-moz-)?document$/.test(type)) {
|
|
|
|
return pushContext(state, stream, "documentTypes");
|
|
|
|
} else if (/^@(media|supports|(-moz-)?document|import)$/.test(type)) {
|
2015-02-25 02:42:17 +00:00
|
|
|
return pushContext(state, stream, "atBlock");
|
2017-02-08 12:35:49 +00:00
|
|
|
} else if (/^@(font-face|counter-style)/.test(type)) {
|
2015-02-25 02:42:17 +00:00
|
|
|
state.stateArg = type;
|
|
|
|
return "restricted_atBlock_before";
|
2014-10-05 17:43:05 +00:00
|
|
|
} else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
|
|
|
|
return "keyframes";
|
|
|
|
} else if (type && type.charAt(0) == "@") {
|
|
|
|
return pushContext(state, stream, "at");
|
|
|
|
} else if (type == "hash") {
|
|
|
|
override = "builtin";
|
|
|
|
} else if (type == "word") {
|
|
|
|
override = "tag";
|
|
|
|
} else if (type == "variable-definition") {
|
|
|
|
return "maybeprop";
|
|
|
|
} else if (type == "interpolation") {
|
|
|
|
return pushContext(state, stream, "interpolation");
|
|
|
|
} else if (type == ":") {
|
|
|
|
return "pseudo";
|
|
|
|
} else if (allowNested && type == "(") {
|
|
|
|
return pushContext(state, stream, "parens");
|
|
|
|
}
|
|
|
|
return state.context.type;
|
|
|
|
};
|
|
|
|
|
|
|
|
states.block = function(type, stream, state) {
|
|
|
|
if (type == "word") {
|
|
|
|
var word = stream.current().toLowerCase();
|
|
|
|
if (propertyKeywords.hasOwnProperty(word)) {
|
|
|
|
override = "property";
|
|
|
|
return "maybeprop";
|
|
|
|
} else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
|
|
|
|
override = "string-2";
|
|
|
|
return "maybeprop";
|
|
|
|
} else if (allowNested) {
|
2015-02-25 02:42:17 +00:00
|
|
|
override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
|
2014-10-05 17:43:05 +00:00
|
|
|
return "block";
|
|
|
|
} else {
|
|
|
|
override += " error";
|
|
|
|
return "maybeprop";
|
|
|
|
}
|
|
|
|
} else if (type == "meta") {
|
|
|
|
return "block";
|
|
|
|
} else if (!allowNested && (type == "hash" || type == "qualifier")) {
|
|
|
|
override = "error";
|
|
|
|
return "block";
|
|
|
|
} else {
|
|
|
|
return states.top(type, stream, state);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
states.maybeprop = function(type, stream, state) {
|
|
|
|
if (type == ":") return pushContext(state, stream, "prop");
|
|
|
|
return pass(type, stream, state);
|
|
|
|
};
|
|
|
|
|
|
|
|
states.prop = function(type, stream, state) {
|
|
|
|
if (type == ";") return popContext(state);
|
|
|
|
if (type == "{" && allowNested) return pushContext(state, stream, "propBlock");
|
|
|
|
if (type == "}" || type == "{") return popAndPass(type, stream, state);
|
|
|
|
if (type == "(") return pushContext(state, stream, "parens");
|
|
|
|
|
2017-02-08 12:35:49 +00:00
|
|
|
if (type == "hash" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) {
|
2014-10-05 17:43:05 +00:00
|
|
|
override += " error";
|
|
|
|
} else if (type == "word") {
|
|
|
|
wordAsValue(stream);
|
|
|
|
} else if (type == "interpolation") {
|
|
|
|
return pushContext(state, stream, "interpolation");
|
|
|
|
}
|
|
|
|
return "prop";
|
|
|
|
};
|
|
|
|
|
|
|
|
states.propBlock = function(type, _stream, state) {
|
|
|
|
if (type == "}") return popContext(state);
|
|
|
|
if (type == "word") { override = "property"; return "maybeprop"; }
|
|
|
|
return state.context.type;
|
|
|
|
};
|
|
|
|
|
|
|
|
states.parens = function(type, stream, state) {
|
|
|
|
if (type == "{" || type == "}") return popAndPass(type, stream, state);
|
|
|
|
if (type == ")") return popContext(state);
|
|
|
|
if (type == "(") return pushContext(state, stream, "parens");
|
2015-04-23 02:44:04 +00:00
|
|
|
if (type == "interpolation") return pushContext(state, stream, "interpolation");
|
2014-10-05 17:43:05 +00:00
|
|
|
if (type == "word") wordAsValue(stream);
|
|
|
|
return "parens";
|
|
|
|
};
|
|
|
|
|
|
|
|
states.pseudo = function(type, stream, state) {
|
2017-03-18 00:24:59 +00:00
|
|
|
if (type == "meta") return "pseudo";
|
|
|
|
|
2014-10-05 17:43:05 +00:00
|
|
|
if (type == "word") {
|
|
|
|
override = "variable-3";
|
|
|
|
return state.context.type;
|
|
|
|
}
|
|
|
|
return pass(type, stream, state);
|
|
|
|
};
|
|
|
|
|
2017-02-08 12:35:49 +00:00
|
|
|
states.documentTypes = function(type, stream, state) {
|
|
|
|
if (type == "word" && documentTypes.hasOwnProperty(stream.current())) {
|
|
|
|
override = "tag";
|
|
|
|
return state.context.type;
|
|
|
|
} else {
|
|
|
|
return states.atBlock(type, stream, state);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-02-25 02:42:17 +00:00
|
|
|
states.atBlock = function(type, stream, state) {
|
|
|
|
if (type == "(") return pushContext(state, stream, "atBlock_parens");
|
2017-02-08 12:35:49 +00:00
|
|
|
if (type == "}" || type == ";") return popAndPass(type, stream, state);
|
2014-10-05 17:43:05 +00:00
|
|
|
if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top");
|
|
|
|
|
2017-02-08 12:35:49 +00:00
|
|
|
if (type == "interpolation") return pushContext(state, stream, "interpolation");
|
|
|
|
|
2014-10-05 17:43:05 +00:00
|
|
|
if (type == "word") {
|
|
|
|
var word = stream.current().toLowerCase();
|
2015-02-25 02:42:17 +00:00
|
|
|
if (word == "only" || word == "not" || word == "and" || word == "or")
|
2014-10-05 17:43:05 +00:00
|
|
|
override = "keyword";
|
|
|
|
else if (mediaTypes.hasOwnProperty(word))
|
|
|
|
override = "attribute";
|
|
|
|
else if (mediaFeatures.hasOwnProperty(word))
|
|
|
|
override = "property";
|
2017-02-08 12:35:49 +00:00
|
|
|
else if (mediaValueKeywords.hasOwnProperty(word))
|
|
|
|
override = "keyword";
|
2015-02-25 02:42:17 +00:00
|
|
|
else if (propertyKeywords.hasOwnProperty(word))
|
|
|
|
override = "property";
|
|
|
|
else if (nonStandardPropertyKeywords.hasOwnProperty(word))
|
|
|
|
override = "string-2";
|
|
|
|
else if (valueKeywords.hasOwnProperty(word))
|
|
|
|
override = "atom";
|
2015-07-29 23:36:59 +00:00
|
|
|
else if (colorKeywords.hasOwnProperty(word))
|
|
|
|
override = "keyword";
|
2014-10-05 17:43:05 +00:00
|
|
|
else
|
|
|
|
override = "error";
|
|
|
|
}
|
|
|
|
return state.context.type;
|
|
|
|
};
|
|
|
|
|
2017-02-08 12:35:49 +00:00
|
|
|
states.atComponentBlock = function(type, stream, state) {
|
|
|
|
if (type == "}")
|
|
|
|
return popAndPass(type, stream, state);
|
|
|
|
if (type == "{")
|
|
|
|
return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top", false);
|
|
|
|
if (type == "word")
|
|
|
|
override = "error";
|
|
|
|
return state.context.type;
|
|
|
|
};
|
|
|
|
|
2015-02-25 02:42:17 +00:00
|
|
|
states.atBlock_parens = function(type, stream, state) {
|
2014-10-05 17:43:05 +00:00
|
|
|
if (type == ")") return popContext(state);
|
|
|
|
if (type == "{" || type == "}") return popAndPass(type, stream, state, 2);
|
2015-02-25 02:42:17 +00:00
|
|
|
return states.atBlock(type, stream, state);
|
2014-10-05 17:43:05 +00:00
|
|
|
};
|
|
|
|
|
2015-02-25 02:42:17 +00:00
|
|
|
states.restricted_atBlock_before = function(type, stream, state) {
|
2014-10-05 17:43:05 +00:00
|
|
|
if (type == "{")
|
2015-02-25 02:42:17 +00:00
|
|
|
return pushContext(state, stream, "restricted_atBlock");
|
|
|
|
if (type == "word" && state.stateArg == "@counter-style") {
|
|
|
|
override = "variable";
|
|
|
|
return "restricted_atBlock_before";
|
|
|
|
}
|
2014-10-05 17:43:05 +00:00
|
|
|
return pass(type, stream, state);
|
|
|
|
};
|
|
|
|
|
2015-02-25 02:42:17 +00:00
|
|
|
states.restricted_atBlock = function(type, stream, state) {
|
|
|
|
if (type == "}") {
|
|
|
|
state.stateArg = null;
|
|
|
|
return popContext(state);
|
|
|
|
}
|
2014-10-05 17:43:05 +00:00
|
|
|
if (type == "word") {
|
2015-02-25 02:42:17 +00:00
|
|
|
if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||
|
|
|
|
(state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))
|
2014-10-05 17:43:05 +00:00
|
|
|
override = "error";
|
|
|
|
else
|
|
|
|
override = "property";
|
|
|
|
return "maybeprop";
|
|
|
|
}
|
2015-02-25 02:42:17 +00:00
|
|
|
return "restricted_atBlock";
|
2014-10-05 17:43:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
states.keyframes = function(type, stream, state) {
|
|
|
|
if (type == "word") { override = "variable"; return "keyframes"; }
|
|
|
|
if (type == "{") return pushContext(state, stream, "top");
|
|
|
|
return pass(type, stream, state);
|
|
|
|
};
|
|
|
|
|
|
|
|
states.at = function(type, stream, state) {
|
|
|
|
if (type == ";") return popContext(state);
|
|
|
|
if (type == "{" || type == "}") return popAndPass(type, stream, state);
|
|
|
|
if (type == "word") override = "tag";
|
|
|
|
else if (type == "hash") override = "builtin";
|
|
|
|
return "at";
|
|
|
|
};
|
|
|
|
|
|
|
|
states.interpolation = function(type, stream, state) {
|
|
|
|
if (type == "}") return popContext(state);
|
|
|
|
if (type == "{" || type == ";") return popAndPass(type, stream, state);
|
2015-04-23 02:44:04 +00:00
|
|
|
if (type == "word") override = "variable";
|
2015-07-29 23:36:59 +00:00
|
|
|
else if (type != "variable" && type != "(" && type != ")") override = "error";
|
2014-10-05 17:43:05 +00:00
|
|
|
return "interpolation";
|
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
startState: function(base) {
|
|
|
|
return {tokenize: null,
|
2017-02-08 12:35:49 +00:00
|
|
|
state: inline ? "block" : "top",
|
2015-02-25 02:42:17 +00:00
|
|
|
stateArg: null,
|
2017-02-08 12:35:49 +00:00
|
|
|
context: new Context(inline ? "block" : "top", base || 0, null)};
|
2014-10-05 17:43:05 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
token: function(stream, state) {
|
|
|
|
if (!state.tokenize && stream.eatSpace()) return null;
|
|
|
|
var style = (state.tokenize || tokenBase)(stream, state);
|
|
|
|
if (style && typeof style == "object") {
|
|
|
|
type = style[1];
|
|
|
|
style = style[0];
|
|
|
|
}
|
|
|
|
override = style;
|
|
|
|
state.state = states[state.state](type, stream, state);
|
|
|
|
return override;
|
|
|
|
},
|
|
|
|
|
|
|
|
indent: function(state, textAfter) {
|
|
|
|
var cx = state.context, ch = textAfter && textAfter.charAt(0);
|
|
|
|
var indent = cx.indent;
|
|
|
|
if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev;
|
2017-02-08 12:35:49 +00:00
|
|
|
if (cx.prev) {
|
|
|
|
if (ch == "}" && (cx.type == "block" || cx.type == "top" ||
|
|
|
|
cx.type == "interpolation" || cx.type == "restricted_atBlock")) {
|
|
|
|
// Resume indentation from parent context.
|
|
|
|
cx = cx.prev;
|
|
|
|
indent = cx.indent;
|
|
|
|
} else if (ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
|
|
|
|
ch == "{" && (cx.type == "at" || cx.type == "atBlock")) {
|
|
|
|
// Dedent relative to current context.
|
|
|
|
indent = Math.max(0, cx.indent - indentUnit);
|
|
|
|
}
|
2014-10-05 17:43:05 +00:00
|
|
|
}
|
|
|
|
return indent;
|
|
|
|
},
|
|
|
|
|
|
|
|
electricChars: "}",
|
|
|
|
blockCommentStart: "/*",
|
|
|
|
blockCommentEnd: "*/",
|
2017-03-18 00:24:59 +00:00
|
|
|
lineComment: lineComment,
|
2014-10-05 17:43:05 +00:00
|
|
|
fold: "brace"
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
function keySet(array) {
|
|
|
|
var keys = {};
|
|
|
|
for (var i = 0; i < array.length; ++i) {
|
2017-02-08 12:35:49 +00:00
|
|
|
keys[array[i].toLowerCase()] = true;
|
2014-10-05 17:43:05 +00:00
|
|
|
}
|
|
|
|
return keys;
|
|
|
|
}
|
|
|
|
|
2015-02-25 02:42:17 +00:00
|
|
|
var documentTypes_ = [
|
|
|
|
"domain", "regexp", "url", "url-prefix"
|
|
|
|
], documentTypes = keySet(documentTypes_);
|
|
|
|
|
2014-10-05 17:43:05 +00:00
|
|
|
var mediaTypes_ = [
|
2012-11-27 18:06:37 +00:00
|
|
|
"all", "aural", "braille", "handheld", "print", "projection", "screen",
|
|
|
|
"tty", "tv", "embossed"
|
2014-10-05 17:43:05 +00:00
|
|
|
], mediaTypes = keySet(mediaTypes_);
|
|
|
|
|
|
|
|
var mediaFeatures_ = [
|
2012-11-27 18:06:37 +00:00
|
|
|
"width", "min-width", "max-width", "height", "min-height", "max-height",
|
|
|
|
"device-width", "min-device-width", "max-device-width", "device-height",
|
|
|
|
"min-device-height", "max-device-height", "aspect-ratio",
|
|
|
|
"min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio",
|
|
|
|
"min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color",
|
|
|
|
"max-color", "color-index", "min-color-index", "max-color-index",
|
|
|
|
"monochrome", "min-monochrome", "max-monochrome", "resolution",
|
2017-02-08 12:35:49 +00:00
|
|
|
"min-resolution", "max-resolution", "scan", "grid", "orientation",
|
|
|
|
"device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
|
|
|
|
"pointer", "any-pointer", "hover", "any-hover"
|
2014-10-05 17:43:05 +00:00
|
|
|
], mediaFeatures = keySet(mediaFeatures_);
|
2012-11-27 18:06:37 +00:00
|
|
|
|
2017-02-08 12:35:49 +00:00
|
|
|
var mediaValueKeywords_ = [
|
|
|
|
"landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
|
|
|
|
"interlace", "progressive"
|
|
|
|
], mediaValueKeywords = keySet(mediaValueKeywords_);
|
|
|
|
|
2014-10-05 17:43:05 +00:00
|
|
|
var propertyKeywords_ = [
|
2012-11-27 18:06:37 +00:00
|
|
|
"align-content", "align-items", "align-self", "alignment-adjust",
|
|
|
|
"alignment-baseline", "anchor-point", "animation", "animation-delay",
|
2014-10-05 17:43:05 +00:00
|
|
|
"animation-direction", "animation-duration", "animation-fill-mode",
|
|
|
|
"animation-iteration-count", "animation-name", "animation-play-state",
|
|
|
|
"animation-timing-function", "appearance", "azimuth", "backface-visibility",
|
2017-02-08 12:35:49 +00:00
|
|
|
"background", "background-attachment", "background-blend-mode", "background-clip",
|
|
|
|
"background-color", "background-image", "background-origin", "background-position",
|
2012-11-27 18:06:37 +00:00
|
|
|
"background-repeat", "background-size", "baseline-shift", "binding",
|
|
|
|
"bleed", "bookmark-label", "bookmark-level", "bookmark-state",
|
|
|
|
"bookmark-target", "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-decoration-break",
|
|
|
|
"box-shadow", "box-sizing", "break-after", "break-before", "break-inside",
|
2017-06-29 13:39:01 +00:00
|
|
|
"caption-side", "caret-color", "clear", "clip", "color", "color-profile", "column-count",
|
2012-11-27 18:06:37 +00:00
|
|
|
"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", "crop", "cue",
|
|
|
|
"cue-after", "cue-before", "cursor", "direction", "display",
|
|
|
|
"dominant-baseline", "drop-initial-after-adjust",
|
|
|
|
"drop-initial-after-align", "drop-initial-before-adjust",
|
|
|
|
"drop-initial-before-align", "drop-initial-size", "drop-initial-value",
|
|
|
|
"elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis",
|
|
|
|
"flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap",
|
2014-10-05 17:43:05 +00:00
|
|
|
"float", "float-offset", "flow-from", "flow-into", "font", "font-feature-settings",
|
|
|
|
"font-family", "font-kerning", "font-language-override", "font-size", "font-size-adjust",
|
2012-11-27 18:06:37 +00:00
|
|
|
"font-stretch", "font-style", "font-synthesis", "font-variant",
|
|
|
|
"font-variant-alternates", "font-variant-caps", "font-variant-east-asian",
|
|
|
|
"font-variant-ligatures", "font-variant-numeric", "font-variant-position",
|
2014-10-05 17:43:05 +00:00
|
|
|
"font-weight", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow",
|
2017-02-08 12:35:49 +00:00
|
|
|
"grid-auto-rows", "grid-column", "grid-column-end", "grid-column-gap",
|
|
|
|
"grid-column-start", "grid-gap", "grid-row", "grid-row-end", "grid-row-gap",
|
|
|
|
"grid-row-start", "grid-template", "grid-template-areas", "grid-template-columns",
|
2014-10-05 17:43:05 +00:00
|
|
|
"grid-template-rows", "hanging-punctuation", "height", "hyphens",
|
2012-11-27 18:06:37 +00:00
|
|
|
"icon", "image-orientation", "image-rendering", "image-resolution",
|
2017-06-29 13:39:01 +00:00
|
|
|
"inline-box-align", "justify-content", "justify-items", "justify-self", "left", "letter-spacing",
|
2012-11-27 18:06:37 +00:00
|
|
|
"line-break", "line-height", "line-stacking", "line-stacking-ruby",
|
|
|
|
"line-stacking-shift", "line-stacking-strategy", "list-style",
|
|
|
|
"list-style-image", "list-style-position", "list-style-type", "margin",
|
|
|
|
"margin-bottom", "margin-left", "margin-right", "margin-top",
|
2017-02-08 12:35:49 +00:00
|
|
|
"marks", "marquee-direction", "marquee-loop",
|
2012-11-27 18:06:37 +00:00
|
|
|
"marquee-play-count", "marquee-speed", "marquee-style", "max-height",
|
|
|
|
"max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index",
|
2014-10-05 17:43:05 +00:00
|
|
|
"nav-left", "nav-right", "nav-up", "object-fit", "object-position",
|
|
|
|
"opacity", "order", "orphans", "outline",
|
2012-11-27 18:06:37 +00:00
|
|
|
"outline-color", "outline-offset", "outline-style", "outline-width",
|
|
|
|
"overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y",
|
|
|
|
"padding", "padding-bottom", "padding-left", "padding-right", "padding-top",
|
|
|
|
"page", "page-break-after", "page-break-before", "page-break-inside",
|
|
|
|
"page-policy", "pause", "pause-after", "pause-before", "perspective",
|
2017-06-29 13:39:01 +00:00
|
|
|
"perspective-origin", "pitch", "pitch-range", "place-content", "place-items", "place-self", "play-during", "position",
|
2014-10-05 17:43:05 +00:00
|
|
|
"presentation-level", "punctuation-trim", "quotes", "region-break-after",
|
|
|
|
"region-break-before", "region-break-inside", "region-fragment",
|
|
|
|
"rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness",
|
|
|
|
"right", "rotation", "rotation-point", "ruby-align", "ruby-overhang",
|
|
|
|
"ruby-position", "ruby-span", "shape-image-threshold", "shape-inside", "shape-margin",
|
|
|
|
"shape-outside", "size", "speak", "speak-as", "speak-header",
|
2012-11-27 18:06:37 +00:00
|
|
|
"speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set",
|
|
|
|
"tab-size", "table-layout", "target", "target-name", "target-new",
|
|
|
|
"target-position", "text-align", "text-align-last", "text-decoration",
|
|
|
|
"text-decoration-color", "text-decoration-line", "text-decoration-skip",
|
|
|
|
"text-decoration-style", "text-emphasis", "text-emphasis-color",
|
|
|
|
"text-emphasis-position", "text-emphasis-style", "text-height",
|
2014-10-05 17:43:05 +00:00
|
|
|
"text-indent", "text-justify", "text-outline", "text-overflow", "text-shadow",
|
|
|
|
"text-size-adjust", "text-space-collapse", "text-transform", "text-underline-position",
|
2012-11-27 18:06:37 +00:00
|
|
|
"text-wrap", "top", "transform", "transform-origin", "transform-style",
|
|
|
|
"transition", "transition-delay", "transition-duration",
|
|
|
|
"transition-property", "transition-timing-function", "unicode-bidi",
|
2017-02-08 12:35:49 +00:00
|
|
|
"user-select", "vertical-align", "visibility", "voice-balance", "voice-duration",
|
2012-11-27 18:06:37 +00:00
|
|
|
"voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress",
|
2017-02-08 12:35:49 +00:00
|
|
|
"voice-volume", "volume", "white-space", "widows", "width", "will-change", "word-break",
|
2014-10-05 17:43:05 +00:00
|
|
|
"word-spacing", "word-wrap", "z-index",
|
|
|
|
// SVG-specific
|
|
|
|
"clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
|
|
|
|
"flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
|
|
|
|
"color-interpolation", "color-interpolation-filters",
|
|
|
|
"color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
|
|
|
|
"marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke",
|
|
|
|
"stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
|
|
|
|
"stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
|
|
|
|
"baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
|
|
|
|
"glyph-orientation-vertical", "text-anchor", "writing-mode"
|
|
|
|
], propertyKeywords = keySet(propertyKeywords_);
|
|
|
|
|
|
|
|
var nonStandardPropertyKeywords_ = [
|
|
|
|
"scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color",
|
|
|
|
"scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color",
|
|
|
|
"scrollbar-3d-light-color", "scrollbar-track-color", "shape-inside",
|
|
|
|
"searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
|
|
|
|
"searchfield-results-decoration", "zoom"
|
|
|
|
], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);
|
|
|
|
|
2015-02-25 02:42:17 +00:00
|
|
|
var fontProperties_ = [
|
|
|
|
"font-family", "src", "unicode-range", "font-variant", "font-feature-settings",
|
|
|
|
"font-stretch", "font-weight", "font-style"
|
|
|
|
], fontProperties = keySet(fontProperties_);
|
|
|
|
|
|
|
|
var counterDescriptors_ = [
|
|
|
|
"additive-symbols", "fallback", "negative", "pad", "prefix", "range",
|
|
|
|
"speak-as", "suffix", "symbols", "system"
|
|
|
|
], counterDescriptors = keySet(counterDescriptors_);
|
|
|
|
|
2014-10-05 17:43:05 +00:00
|
|
|
var colorKeywords_ = [
|
|
|
|
"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", "darkkhaki", "darkmagenta", "darkolivegreen",
|
|
|
|
"darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
|
|
|
|
"darkslateblue", "darkslategray", "darkturquoise", "darkviolet",
|
|
|
|
"deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick",
|
|
|
|
"floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
|
|
|
|
"gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew",
|
|
|
|
"hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
|
|
|
|
"lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
|
|
|
|
"lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink",
|
|
|
|
"lightsalmon", "lightseagreen", "lightskyblue", "lightslategray",
|
|
|
|
"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", "snow", "springgreen", "steelblue", "tan",
|
|
|
|
"teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
|
|
|
|
"whitesmoke", "yellow", "yellowgreen"
|
|
|
|
], colorKeywords = keySet(colorKeywords_);
|
|
|
|
|
|
|
|
var valueKeywords_ = [
|
2015-02-25 02:42:17 +00:00
|
|
|
"above", "absolute", "activeborder", "additive", "activecaption", "afar",
|
|
|
|
"after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate",
|
2012-11-27 18:06:37 +00:00
|
|
|
"always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
|
2017-02-08 12:35:49 +00:00
|
|
|
"arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page",
|
2014-10-05 17:43:05 +00:00
|
|
|
"avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary",
|
|
|
|
"bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
|
2015-02-25 02:42:17 +00:00
|
|
|
"both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel",
|
|
|
|
"buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian",
|
2012-11-27 18:06:37 +00:00
|
|
|
"capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
|
2015-02-25 02:42:17 +00:00
|
|
|
"cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
|
2012-11-27 18:06:37 +00:00
|
|
|
"cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
|
2017-02-08 12:35:49 +00:00
|
|
|
"col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse",
|
|
|
|
"compact", "condensed", "contain", "content", "contents",
|
2015-02-25 02:42:17 +00:00
|
|
|
"content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
|
2017-02-08 12:35:49 +00:00
|
|
|
"cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
|
|
|
|
"decimal-leading-zero", "default", "default-button", "dense", "destination-atop",
|
|
|
|
"destination-in", "destination-out", "destination-over", "devanagari", "difference",
|
2015-02-25 02:42:17 +00:00
|
|
|
"disc", "discard", "disclosure-closed", "disclosure-open", "document",
|
|
|
|
"dot-dash", "dot-dot-dash",
|
|
|
|
"dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
|
2014-10-05 17:43:05 +00:00
|
|
|
"element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede",
|
2012-11-27 18:06:37 +00:00
|
|
|
"ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er",
|
|
|
|
"ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er",
|
|
|
|
"ethiopic-halehame-aa-et", "ethiopic-halehame-am-et",
|
|
|
|
"ethiopic-halehame-gez", "ethiopic-halehame-om-et",
|
|
|
|
"ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
|
2015-02-25 02:42:17 +00:00
|
|
|
"ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
|
2017-02-08 12:35:49 +00:00
|
|
|
"ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed",
|
|
|
|
"extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
|
|
|
|
"forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove",
|
|
|
|
"gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew",
|
2012-11-27 18:06:37 +00:00
|
|
|
"help", "hidden", "hide", "higher", "highlight", "highlighttext",
|
2017-02-08 12:35:49 +00:00
|
|
|
"hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore",
|
2012-11-27 18:06:37 +00:00
|
|
|
"inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
|
|
|
|
"infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
|
2017-02-08 12:35:49 +00:00
|
|
|
"inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert",
|
2015-02-25 02:42:17 +00:00
|
|
|
"italic", "japanese-formal", "japanese-informal", "justify", "kannada",
|
|
|
|
"katakana", "katakana-iroha", "keep-all", "khmer",
|
|
|
|
"korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
|
2017-02-08 12:35:49 +00:00
|
|
|
"landscape", "lao", "large", "larger", "left", "level", "lighter", "lighten",
|
2015-02-25 02:42:17 +00:00
|
|
|
"line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
|
2012-11-27 18:06:37 +00:00
|
|
|
"local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
|
|
|
|
"lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
|
2017-02-08 12:35:49 +00:00
|
|
|
"lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "match", "matrix", "matrix3d",
|
2012-11-27 18:06:37 +00:00
|
|
|
"media-controls-background", "media-current-time-display",
|
|
|
|
"media-fullscreen-button", "media-mute-button", "media-play-button",
|
|
|
|
"media-return-to-realtime-button", "media-rewind-button",
|
|
|
|
"media-seek-back-button", "media-seek-forward-button", "media-slider",
|
|
|
|
"media-sliderthumb", "media-time-remaining-display", "media-volume-slider",
|
|
|
|
"media-volume-slider-container", "media-volume-sliderthumb", "medium",
|
|
|
|
"menu", "menulist", "menulist-button", "menulist-text",
|
|
|
|
"menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
|
2017-02-08 12:35:49 +00:00
|
|
|
"mix", "mongolian", "monospace", "move", "multiple", "multiply", "myanmar", "n-resize",
|
2014-10-05 17:43:05 +00:00
|
|
|
"narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
|
2012-11-27 18:06:37 +00:00
|
|
|
"no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
|
2017-02-08 12:35:49 +00:00
|
|
|
"ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "opacity", "open-quote",
|
2012-11-27 18:06:37 +00:00
|
|
|
"optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
|
2014-10-05 17:43:05 +00:00
|
|
|
"outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
|
2015-02-25 02:42:17 +00:00
|
|
|
"painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter",
|
|
|
|
"pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d",
|
|
|
|
"progress", "push-button", "radial-gradient", "radio", "read-only",
|
|
|
|
"read-write", "read-write-plaintext-only", "rectangle", "region",
|
|
|
|
"relative", "repeat", "repeating-linear-gradient",
|
|
|
|
"repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse",
|
|
|
|
"rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
|
2017-02-08 12:35:49 +00:00
|
|
|
"rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
|
|
|
|
"s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen",
|
|
|
|
"scroll", "scrollbar", "scroll-position", "se-resize", "searchfield",
|
2012-11-27 18:06:37 +00:00
|
|
|
"searchfield-cancel-button", "searchfield-decoration",
|
2017-06-29 13:39:01 +00:00
|
|
|
"searchfield-results-button", "searchfield-results-decoration", "self-start", "self-end",
|
2012-11-27 18:06:37 +00:00
|
|
|
"semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama",
|
2015-02-25 02:42:17 +00:00
|
|
|
"simp-chinese-formal", "simp-chinese-informal", "single",
|
|
|
|
"skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
|
2012-11-27 18:06:37 +00:00
|
|
|
"slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
|
2017-02-08 12:35:49 +00:00
|
|
|
"small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali",
|
2017-06-29 13:39:01 +00:00
|
|
|
"source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square",
|
2015-02-25 02:42:17 +00:00
|
|
|
"square-button", "start", "static", "status-bar", "stretch", "stroke", "sub",
|
2017-03-18 00:24:59 +00:00
|
|
|
"subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table",
|
2012-11-27 18:06:37 +00:00
|
|
|
"table-caption", "table-cell", "table-column", "table-column-group",
|
|
|
|
"table-footer-group", "table-header-group", "table-row", "table-row-group",
|
2015-02-25 02:42:17 +00:00
|
|
|
"tamil",
|
2012-11-27 18:06:37 +00:00
|
|
|
"telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai",
|
|
|
|
"thick", "thin", "threeddarkshadow", "threedface", "threedhighlight",
|
|
|
|
"threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er",
|
|
|
|
"tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
|
2017-02-08 12:35:49 +00:00
|
|
|
"trad-chinese-formal", "trad-chinese-informal", "transform",
|
2015-02-25 02:42:17 +00:00
|
|
|
"translate", "translate3d", "translateX", "translateY", "translateZ",
|
2017-02-08 12:35:49 +00:00
|
|
|
"transparent", "ultra-condensed", "ultra-expanded", "underline", "unset", "up",
|
2012-11-27 18:06:37 +00:00
|
|
|
"upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
|
|
|
|
"upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
|
2015-02-25 02:42:17 +00:00
|
|
|
"var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
|
2014-10-05 17:43:05 +00:00
|
|
|
"visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
|
2017-02-08 12:35:49 +00:00
|
|
|
"window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor",
|
2014-10-05 17:43:05 +00:00
|
|
|
"xx-large", "xx-small"
|
|
|
|
], valueKeywords = keySet(valueKeywords_);
|
2012-11-27 18:06:37 +00:00
|
|
|
|
2017-02-08 12:35:49 +00:00
|
|
|
var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)
|
|
|
|
.concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)
|
|
|
|
.concat(valueKeywords_);
|
2014-10-05 17:43:05 +00:00
|
|
|
CodeMirror.registerHelper("hintWords", "css", allWords);
|
2012-11-27 18:06:37 +00:00
|
|
|
|
|
|
|
function tokenCComment(stream, state) {
|
|
|
|
var maybeEnd = false, ch;
|
|
|
|
while ((ch = stream.next()) != null) {
|
|
|
|
if (maybeEnd && ch == "/") {
|
2014-10-05 17:43:05 +00:00
|
|
|
state.tokenize = null;
|
2012-11-27 18:06:37 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
maybeEnd = (ch == "*");
|
|
|
|
}
|
2014-10-05 17:43:05 +00:00
|
|
|
return ["comment", "comment"];
|
2012-11-27 18:06:37 +00:00
|
|
|
}
|
|
|
|
|
2014-10-05 17:43:05 +00:00
|
|
|
CodeMirror.defineMIME("text/css", {
|
2015-02-25 02:42:17 +00:00
|
|
|
documentTypes: documentTypes,
|
2014-10-05 17:43:05 +00:00
|
|
|
mediaTypes: mediaTypes,
|
|
|
|
mediaFeatures: mediaFeatures,
|
2017-02-08 12:35:49 +00:00
|
|
|
mediaValueKeywords: mediaValueKeywords,
|
2014-10-05 17:43:05 +00:00
|
|
|
propertyKeywords: propertyKeywords,
|
|
|
|
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
2015-02-25 02:42:17 +00:00
|
|
|
fontProperties: fontProperties,
|
|
|
|
counterDescriptors: counterDescriptors,
|
2014-10-05 17:43:05 +00:00
|
|
|
colorKeywords: colorKeywords,
|
|
|
|
valueKeywords: valueKeywords,
|
|
|
|
tokenHooks: {
|
|
|
|
"/": function(stream, state) {
|
|
|
|
if (!stream.eat("*")) return false;
|
|
|
|
state.tokenize = tokenCComment;
|
|
|
|
return tokenCComment(stream, state);
|
2012-11-27 18:06:37 +00:00
|
|
|
}
|
|
|
|
},
|
2014-10-05 17:43:05 +00:00
|
|
|
name: "css"
|
|
|
|
});
|
2012-11-27 18:06:37 +00:00
|
|
|
|
2014-10-05 17:43:05 +00:00
|
|
|
CodeMirror.defineMIME("text/x-scss", {
|
|
|
|
mediaTypes: mediaTypes,
|
|
|
|
mediaFeatures: mediaFeatures,
|
2017-02-08 12:35:49 +00:00
|
|
|
mediaValueKeywords: mediaValueKeywords,
|
2014-10-05 17:43:05 +00:00
|
|
|
propertyKeywords: propertyKeywords,
|
|
|
|
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
|
|
|
colorKeywords: colorKeywords,
|
|
|
|
valueKeywords: valueKeywords,
|
|
|
|
fontProperties: fontProperties,
|
|
|
|
allowNested: true,
|
2017-03-18 00:24:59 +00:00
|
|
|
lineComment: "//",
|
2014-10-05 17:43:05 +00:00
|
|
|
tokenHooks: {
|
|
|
|
"/": function(stream, state) {
|
|
|
|
if (stream.eat("/")) {
|
|
|
|
stream.skipToEnd();
|
|
|
|
return ["comment", "comment"];
|
|
|
|
} else if (stream.eat("*")) {
|
|
|
|
state.tokenize = tokenCComment;
|
|
|
|
return tokenCComment(stream, state);
|
2012-11-27 18:06:37 +00:00
|
|
|
} else {
|
2014-10-05 17:43:05 +00:00
|
|
|
return ["operator", "operator"];
|
2012-11-27 18:06:37 +00:00
|
|
|
}
|
2014-10-05 17:43:05 +00:00
|
|
|
},
|
|
|
|
":": function(stream) {
|
2017-06-29 13:39:01 +00:00
|
|
|
if (stream.match(/\s*\{/, false))
|
|
|
|
return [null, null]
|
2014-10-05 17:43:05 +00:00
|
|
|
return false;
|
|
|
|
},
|
|
|
|
"$": function(stream) {
|
|
|
|
stream.match(/^[\w-]+/);
|
|
|
|
if (stream.match(/^\s*:/, false))
|
|
|
|
return ["variable-2", "variable-definition"];
|
|
|
|
return ["variable-2", "variable"];
|
|
|
|
},
|
|
|
|
"#": function(stream) {
|
|
|
|
if (!stream.eat("{")) return false;
|
|
|
|
return [null, "interpolation"];
|
2012-11-27 18:06:37 +00:00
|
|
|
}
|
2014-10-05 17:43:05 +00:00
|
|
|
},
|
|
|
|
name: "css",
|
|
|
|
helperType: "scss"
|
|
|
|
});
|
2012-11-27 18:06:37 +00:00
|
|
|
|
2014-10-05 17:43:05 +00:00
|
|
|
CodeMirror.defineMIME("text/x-less", {
|
|
|
|
mediaTypes: mediaTypes,
|
|
|
|
mediaFeatures: mediaFeatures,
|
2017-02-08 12:35:49 +00:00
|
|
|
mediaValueKeywords: mediaValueKeywords,
|
2014-10-05 17:43:05 +00:00
|
|
|
propertyKeywords: propertyKeywords,
|
|
|
|
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
|
|
|
colorKeywords: colorKeywords,
|
|
|
|
valueKeywords: valueKeywords,
|
|
|
|
fontProperties: fontProperties,
|
|
|
|
allowNested: true,
|
2017-03-18 00:24:59 +00:00
|
|
|
lineComment: "//",
|
2014-10-05 17:43:05 +00:00
|
|
|
tokenHooks: {
|
|
|
|
"/": function(stream, state) {
|
|
|
|
if (stream.eat("/")) {
|
|
|
|
stream.skipToEnd();
|
|
|
|
return ["comment", "comment"];
|
|
|
|
} else if (stream.eat("*")) {
|
|
|
|
state.tokenize = tokenCComment;
|
|
|
|
return tokenCComment(stream, state);
|
|
|
|
} else {
|
|
|
|
return ["operator", "operator"];
|
2012-11-27 18:06:37 +00:00
|
|
|
}
|
2014-10-05 17:43:05 +00:00
|
|
|
},
|
|
|
|
"@": function(stream) {
|
2015-04-23 02:44:04 +00:00
|
|
|
if (stream.eat("{")) return [null, "interpolation"];
|
2014-10-05 17:43:05 +00:00
|
|
|
if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false;
|
|
|
|
stream.eatWhile(/[\w\\\-]/);
|
|
|
|
if (stream.match(/^\s*:/, false))
|
|
|
|
return ["variable-2", "variable-definition"];
|
|
|
|
return ["variable-2", "variable"];
|
|
|
|
},
|
|
|
|
"&": function() {
|
|
|
|
return ["atom", "atom"];
|
2012-11-27 18:06:37 +00:00
|
|
|
}
|
|
|
|
},
|
2014-10-05 17:43:05 +00:00
|
|
|
name: "css",
|
|
|
|
helperType: "less"
|
|
|
|
});
|
2012-11-27 18:06:37 +00:00
|
|
|
|
2017-02-08 12:35:49 +00:00
|
|
|
CodeMirror.defineMIME("text/x-gss", {
|
|
|
|
documentTypes: documentTypes,
|
|
|
|
mediaTypes: mediaTypes,
|
|
|
|
mediaFeatures: mediaFeatures,
|
|
|
|
propertyKeywords: propertyKeywords,
|
|
|
|
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
|
|
|
fontProperties: fontProperties,
|
|
|
|
counterDescriptors: counterDescriptors,
|
|
|
|
colorKeywords: colorKeywords,
|
|
|
|
valueKeywords: valueKeywords,
|
|
|
|
supportsAtComponent: true,
|
|
|
|
tokenHooks: {
|
|
|
|
"/": function(stream, state) {
|
|
|
|
if (!stream.eat("*")) return false;
|
|
|
|
state.tokenize = tokenCComment;
|
|
|
|
return tokenCComment(stream, state);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
name: "css",
|
|
|
|
helperType: "gss"
|
|
|
|
});
|
|
|
|
|
2012-11-27 18:06:37 +00:00
|
|
|
});
|