TT2-Play-Area
view release on metacpan or search on metacpan
lib/auto/TT2/Play/Area/public/codemirror/mode/stylus/stylus.js view on Meta::CPAN
if (cx.prev &&
(ch == "}" && (cx.type == "block" || cx.type == "atBlock" || cx.type == "keyframes") ||
ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
ch == "{" && (cx.type == "at"))) {
indent = cx.indent - indentUnit;
} else if (!(/(\})/.test(ch))) {
if (/@|\$|\d/.test(ch) ||
/^\{/.test(textAfter) ||
/^\s*\/(\/|\*)/.test(textAfter) ||
/^\s*\/\*/.test(prevLineFirstWord) ||
/^\s*[\w-\.\[\]\'\"]+\s*(\?|:|\+)?=/i.test(textAfter) ||
/^(\+|-)?[a-z][\w-]*\(/i.test(textAfter) ||
/^return/.test(textAfter) ||
wordIsBlock(lineFirstWord)) {
indent = lineIndent;
} else if (/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(ch) || wordIsTag(lineFirstWord)) {
if (/\,\s*$/.test(prevLineFirstWord)) {
indent = prevLineIndent;
} else if (/^\s+/.test(line) && (/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(prevLineFirstWord) || wordIsTag(prevLineFirstWord))) {
indent = lineIndent <= prevLineIndent ? prevLineIndent : prevLineIndent + indentUnit;
} else {
indent = lineIndent;
}
} else if (!/,\s*$/.test(line) && (wordIsVendorPrefix(lineFirstWord) || wordIsProperty(lineFirstWord))) {
if (wordIsBlock(prevLineFirstWord)) {
indent = lineIndent <= prevLineIndent ? prevLineIndent : prevLineIndent + indentUnit;
} else if (/^\{/.test(prevLineFirstWord)) {
indent = lineIndent <= prevLineIndent ? lineIndent : prevLineIndent + indentUnit;
} else if (wordIsVendorPrefix(prevLineFirstWord) || wordIsProperty(prevLineFirstWord)) {
indent = lineIndent >= prevLineIndent ? prevLineIndent : lineIndent;
} else if (/^(\.|#|:|\[|\*|&|@|\+|\-|>|~|\/)/.test(prevLineFirstWord) ||
/=\s*$/.test(prevLineFirstWord) ||
wordIsTag(prevLineFirstWord) ||
/^\$[\w-\.\[\]\'\"]/.test(prevLineFirstWord)) {
indent = prevLineIndent + indentUnit;
} else {
indent = lineIndent;
}
}
}
return indent;
},
electricChars: "}",
lineComment: "//",
fold: "indent"
};
});
// developer.mozilla.org/en-US/docs/Web/HTML/Element
var tagKeywords_ = ["a","abbr","address","area","article","aside","audio", "b", "base","bdi", "bdo","bgsound","blockquote","body","br","button","canvas","caption","cite", "code","col","colgroup","data","datalist","dd","del","details","dfn","div", "...
// github.com/codemirror/CodeMirror/blob/master/mode/css/css.js
var documentTypes_ = ["domain", "regexp", "url", "url-prefix"];
var mediaTypes_ = ["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"];
var mediaFeatures_ = ["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-rati...
var propertyKeywords_ = ["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","a...
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-i...
var fontProperties_ = ["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"];
var colorKeywords_ = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan"...
var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indi...
var wordOperatorKeywords_ = ["in","and","or","not","is not","is a","is","isnt","defined","if unless"],
blockKeywords_ = ["for","if","else","unless", "from", "to"],
commonAtoms_ = ["null","true","false","href","title","type","not-allowed","readonly","disabled"],
commonDef_ = ["@font-face", "@keyframes", "@media", "@viewport", "@page", "@host", "@supports", "@block", "@css"];
var hintWords = tagKeywords_.concat(documentTypes_,mediaTypes_,mediaFeatures_,
propertyKeywords_,nonStandardPropertyKeywords_,
colorKeywords_,valueKeywords_,fontProperties_,
wordOperatorKeywords_,blockKeywords_,
commonAtoms_,commonDef_);
function wordRegexp(words) {
words = words.sort(function(a,b){return b > a;});
return new RegExp("^((" + words.join(")|(") + "))\\b");
}
function keySet(array) {
var keys = {};
for (var i = 0; i < array.length; ++i) keys[array[i]] = true;
return keys;
}
function escapeRegExp(text) {
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
}
CodeMirror.registerHelper("hintWords", "stylus", hintWords);
CodeMirror.defineMIME("text/x-styl", "stylus");
});
( run in 0.933 second using v1.01-cache-2.11-cpan-7fcb06a456a )