Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codemirror

Package Overview
Dependencies
Maintainers
1
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codemirror - npm Package Compare versions

Comparing version 3.16.0 to 3.17.0

addon/hint/css-hint.js

40

addon/comment/continuecomment.js
(function() {
var modes = ["clike", "css", "javascript"];
for (var i = 0; i < modes.length; ++i)
CodeMirror.extendMode(modes[i], {blockCommentStart: "/*",
blockCommentEnd: "*/",
blockCommentContinue: " * "});
CodeMirror.extendMode(modes[i], {blockCommentContinue: " * "});
function continueComment(cm) {
var pos = cm.getCursor(), token = cm.getTokenAt(pos);
if (token.type != "comment") return CodeMirror.Pass;
var mode = CodeMirror.innerMode(cm.getMode(), token.state).mode;
var space;
if (token.type == "comment" && mode.blockCommentStart && mode.blockCommentContinue) {
var insert;
if (mode.blockCommentStart && mode.blockCommentContinue) {
var end = token.string.indexOf(mode.blockCommentEnd);

@@ -19,6 +18,6 @@ var full = cm.getRange(CodeMirror.Pos(pos.line, 0), CodeMirror.Pos(pos.line, token.end)), found;

} else if (token.string.indexOf(mode.blockCommentStart) == 0) {
space = full.slice(0, token.start);
if (!/^\s*$/.test(space)) {
space = "";
for (var i = 0; i < token.start; ++i) space += " ";
insert = full.slice(0, token.start);
if (!/^\s*$/.test(insert)) {
insert = "";
for (var i = 0; i < token.start; ++i) insert += " ";
}

@@ -28,8 +27,17 @@ } else if ((found = full.indexOf(mode.blockCommentContinue)) != -1 &&

/^\s*$/.test(full.slice(0, found))) {
space = full.slice(0, found);
insert = full.slice(0, found);
}
if (insert != null) insert += mode.blockCommentContinue;
}
if (insert == null && mode.lineComment) {
var line = cm.getLine(pos.line), found = line.indexOf(mode.lineComment);
if (found > -1) {
insert = line.slice(0, found);
if (/\S/.test(insert)) insert = null;
else insert += mode.lineComment + line.slice(found + mode.lineComment.length).match(/^\s*/)[0];
}
}
if (space != null)
cm.replaceSelection("\n" + space + mode.blockCommentContinue, "end");
if (insert != null)
cm.replaceSelection("\n" + insert, "end");
else

@@ -42,6 +50,8 @@ return CodeMirror.Pass;

cm.removeKeyMap("continueComment");
var map = {name: "continueComment"};
map[typeof val == "string" ? val : "Enter"] = continueComment;
cm.addKeyMap(map);
if (val) {
var map = {name: "continueComment"};
map[typeof val == "string" ? val : "Enter"] = continueComment;
cm.addKeyMap(map);
}
});
})();

@@ -30,5 +30,5 @@ /**

if (typeof val != "object" || val.whenClosing)
map["'/'"] = function(cm) { return autoCloseTag(cm, '/'); };
map["'/'"] = function(cm) { return autoCloseSlash(cm); };
if (typeof val != "object" || val.whenOpening)
map["'>'"] = function(cm) { return autoCloseTag(cm, '>'); };
map["'>'"] = function(cm) { return autoCloseGT(cm); };
cm.addKeyMap(map);

@@ -45,6 +45,6 @@ } else if (!val && (old != CodeMirror.Init && old)) {

function autoCloseTag(cm, ch) {
function autoCloseGT(cm) {
var pos = cm.getCursor(), tok = cm.getTokenAt(pos);
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
if (inner.mode.name != "xml") return CodeMirror.Pass;
if (inner.mode.name != "xml" || !state.tagName) return CodeMirror.Pass;

@@ -55,29 +55,30 @@ var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html";

if (ch == ">" && state.tagName) {
var tagName = state.tagName;
if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
var lowerTagName = tagName.toLowerCase();
// Don't process the '>' at the end of an end-tag or self-closing tag
if (tok.type == "tag" && state.type == "closeTag" ||
tok.string.indexOf("/") == (tok.string.length - 1) || // match something like <someTagName />
dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1)
return CodeMirror.Pass;
var tagName = state.tagName;
if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
var lowerTagName = tagName.toLowerCase();
// Don't process the '>' at the end of an end-tag or self-closing tag
if (tok.type == "tag" && state.type == "closeTag" ||
tok.string.indexOf("/") == (tok.string.length - 1) || // match something like <someTagName />
dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1)
return CodeMirror.Pass;
var doIndent = indentTags && indexOf(indentTags, lowerTagName) > -1;
var curPos = doIndent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1);
cm.replaceSelection(">" + (doIndent ? "\n\n" : "") + "</" + tagName + ">",
{head: curPos, anchor: curPos});
if (doIndent) {
cm.indentLine(pos.line + 1);
cm.indentLine(pos.line + 2);
}
return;
} else if (ch == "/" && tok.string == "<") {
var tagName = state.context && state.context.tagName;
if (tagName) cm.replaceSelection("/" + tagName + ">", "end");
return;
var doIndent = indentTags && indexOf(indentTags, lowerTagName) > -1;
var curPos = doIndent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1);
cm.replaceSelection(">" + (doIndent ? "\n\n" : "") + "</" + tagName + ">",
{head: curPos, anchor: curPos});
if (doIndent) {
cm.indentLine(pos.line + 1);
cm.indentLine(pos.line + 2);
}
return CodeMirror.Pass;
}
function autoCloseSlash(cm) {
var pos = cm.getCursor(), tok = cm.getTokenAt(pos);
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
if (tok.string.charAt(0) != "<" || inner.mode.name != "xml") return CodeMirror.Pass;
var tagName = state.context && state.context.tagName;
if (tagName) cm.replaceSelection("/" + tagName + ">", "end");
}
function indexOf(collection, elt) {

@@ -84,0 +85,0 @@ if (collection.indexOf) return collection.indexOf(elt);

@@ -11,2 +11,3 @@ (function() {

if (val) {
cm.state.matchBothTags = typeof val == "object" && val.bothTags;
cm.on("cursorActivity", doMatchTags);

@@ -19,6 +20,5 @@ cm.on("viewportChange", maybeUpdateMatch);

function clear(cm) {
if (cm.state.matchedTag) {
cm.state.matchedTag.clear();
cm.state.matchedTag = null;
}
if (cm.state.tagHit) cm.state.tagHit.clear();
if (cm.state.tagOther) cm.state.tagOther.clear();
cm.state.tagHit = cm.state.tagOther = null;
}

@@ -30,2 +30,3 @@

clear(cm);
if (cm.somethingSelected()) return;
var cur = cm.getCursor(), range = cm.getViewport();

@@ -35,5 +36,9 @@ range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to);

if (!match) return;
if (cm.state.matchBothTags) {
var hit = match.at == "open" ? match.open : match.close;
if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"});
}
var other = match.at == "close" ? match.open : match.close;
if (other)
cm.state.matchedTag = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"});
cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"});
else

@@ -40,0 +45,0 @@ cm.state.failedTagMatch = true;

@@ -114,6 +114,6 @@ (function() {

Down: function() {handle.moveFocus(1);},
PageUp: function() {handle.moveFocus(-handle.menuSize());},
PageDown: function() {handle.moveFocus(handle.menuSize());},
PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);},
PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);},
Home: function() {handle.setFocus(0);},
End: function() {handle.setFocus(handle.length);},
End: function() {handle.setFocus(handle.length - 1);},
Enter: handle.pick,

@@ -171,2 +171,3 @@ Tab: handle.pick,

var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
(options.container || document.body).appendChild(hints);
var box = hints.getBoundingClientRect();

@@ -192,6 +193,5 @@ var overlapX = box.right - winW, overlapY = box.bottom - winH;

}
(options.container || document.body).appendChild(hints);
cm.addKeyMap(this.keyMap = buildKeyMap(options, {
moveFocus: function(n) { widget.changeActive(widget.selectedHint + n); },
moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); },
setFocus: function(n) { widget.changeActive(n); },

@@ -256,4 +256,7 @@ menuSize: function() { return widget.screenAmount(); },

changeActive: function(i) {
i = Math.max(0, Math.min(i, this.data.list.length - 1));
changeActive: function(i, avoidWrap) {
if (i >= this.data.list.length)
i = avoidWrap ? this.data.list.length - 1 : 0;
else if (i < 0)
i = avoidWrap ? 0 : this.data.list.length - 1;
if (this.selectedHint == i) return;

@@ -260,0 +263,0 @@ var node = this.hints.childNodes[this.selectedHint];

@@ -115,3 +115,3 @@ (function() {

else
updateLinting(cm, options.getAnnotations(cm.getValue()));
updateLinting(cm, options.getAnnotations(cm.getValue(), options));
}

@@ -118,0 +118,0 @@

@@ -34,5 +34,13 @@ (function() {

this.showDifferences = options.showDifferences !== false;
this.forceUpdate = registerUpdate(this);
setScrollLock(this, true, false);
registerScroll(this);
},
setShowDifferences: function(val) {
val = val !== false;
if (val != this.showDifferences) {
this.showDifferences = val;
this.forceUpdate("full");
}
}

@@ -45,9 +53,19 @@ };

var debounceChange;
function update() {
function update(mode) {
if (mode == "full") {
if (dv.svg) clear(dv.svg);
clear(dv.copyButtons);
clearMarks(dv.edit, edit.marked, dv.classes);
clearMarks(dv.orig, orig.marked, dv.classes);
edit.from = edit.to = orig.from = orig.to = 0;
}
if (dv.diffOutOfDate) {
dv.diff = getDiff(dv.orig.getValue(), dv.edit.getValue());
dv.diffOutOfDate = false;
CodeMirror.signal(dv.edit, "updateDiff", dv.diff);
}
updateMarks(dv.edit, dv.diff, edit, DIFF_INSERT, dv.classes);
updateMarks(dv.orig, dv.diff, orig, DIFF_DELETE, dv.classes);
if (dv.showDifferences) {
updateMarks(dv.edit, dv.diff, edit, DIFF_INSERT, dv.classes);
updateMarks(dv.orig, dv.diff, orig, DIFF_DELETE, dv.classes);
}
drawConnectors(dv);

@@ -59,3 +77,3 @@ }

}
dv.edit.on("change", function() {
function change() {
if (!dv.diffOutOfDate) {

@@ -66,3 +84,5 @@ dv.diffOutOfDate = true;

set(true);
});
}
dv.edit.on("change", change);
dv.orig.on("change", change);
dv.edit.on("viewportChange", set);

@@ -218,2 +238,4 @@ dv.orig.on("viewportChange", set);

function drawConnectors(dv) {
if (!dv.showDifferences) return;
if (dv.svg) {

@@ -330,3 +352,7 @@ clear(dv.svg);

rightOriginal: function() { return this.right && this.right.orig; },
leftOriginal: function() { return this.left && this.left.orig; }
leftOriginal: function() { return this.left && this.left.orig; },
setShowDifferences: function(val) {
if (this.right) this.right.setShowDifferences(val);
if (this.left) this.left.setShowDifferences(val);
}
};

@@ -333,0 +359,0 @@

@@ -128,3 +128,3 @@ /* Just enough of CodeMirror to run runMode under node.js */

var style = mode.token(stream, state);
callback(stream.current(), style, i, stream.start);
callback(stream.current(), style, i, stream.start, state);
stream.start = stream.pos;

@@ -131,0 +131,0 @@ }

@@ -52,3 +52,3 @@ CodeMirror.runMode = function(string, modespec, callback, options) {

var style = mode.token(stream, state);
callback(stream.current(), style, i, stream.start);
callback(stream.current(), style, i, stream.start, state);
stream.start = stream.pos;

@@ -55,0 +55,0 @@ }

@@ -99,3 +99,3 @@ /* Just enough of CodeMirror to run runMode under node.js */

var style = mode.token(stream, state);
callback(stream.current(), style, i, stream.start);
callback(stream.current(), style, i, stream.start, state);
stream.start = stream.pos;

@@ -102,0 +102,0 @@ }

@@ -72,4 +72,4 @@ (function(){

var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
if (reverse ? offsetA >= pos.ch || offsetA != match.length
: offsetA <= pos.ch || offsetA != line.length - match.length)
if (reverse ? offsetA > pos.ch || offsetA != match.length
: offsetA < pos.ch || offsetA != line.length - match.length)
return;

@@ -76,0 +76,0 @@ for (;;) {

@@ -27,3 +27,6 @@ // Glue code between CodeMirror and Tern.

// queries.
// * responseFilter: A function(doc, query, request, error, data) that
// will be applied to the Tern responses before treating them
//
//
// It is possible to run the Tern server in a web worker by specifying

@@ -106,4 +109,12 @@ // these additional options:

request: function(cm, query, c) {
this.server.request(buildRequest(this, findDoc(this, cm.getDoc()), query), c);
request: function (cm, query, c) {
var self = this;
var doc = findDoc(this, cm.getDoc());
var request = buildRequest(this, doc, query);
this.server.request(request, function (error, data) {
if (!error && self.options.responseFilter)
data = self.options.responseFilter(doc, query, request, error, data);
c(error, data);
});
}

@@ -238,8 +249,20 @@ };

if (cm.somethingSelected()) return;
var lex = cm.getTokenAt(cm.getCursor()).state.lexical;
var state = cm.getTokenAt(cm.getCursor()).state;
var inner = CodeMirror.innerMode(cm.getMode(), state);
if (inner.mode.name != "javascript") return;
var lex = inner.state.lexical;
if (lex.info != "call") return;
var ch = lex.column, pos = lex.pos || 0;
for (var line = cm.getCursor().line, e = Math.max(0, line - 9), found = false; line >= e; --line)
if (cm.getLine(line).charAt(ch) == "(") {found = true; break;}
var ch, pos = lex.pos || 0, tabSize = cm.getOption("tabSize");
for (var line = cm.getCursor().line, e = Math.max(0, line - 9), found = false; line >= e; --line) {
var str = cm.getLine(line), extra = 0;
for (var pos = 0;;) {
var tab = str.indexOf("\t", pos);
if (tab == -1) break;
extra += tabSize - (tab + extra) % tabSize - 1;
pos = tab + 1;
}
ch = lex.column - extra;
if (str.charAt(ch) == "(") {found = true; break;}
}
if (!found) return;

@@ -246,0 +269,0 @@

{
"name": "CodeMirror",
"version": "3.16.0",
"version": "3.17.0",
"main": ["lib/codemirror.js", "lib/codemirror.css"],

@@ -5,0 +5,0 @@ "ignore": [

@@ -7,3 +7,3 @@ # How to contribute

## Getting help [^](#how-to-contribute)
## Getting help

@@ -13,3 +13,3 @@ Community discussion, questions, and informal bug reporting is done on the

## Submitting bug reports [^](#how-to-contribute)
## Submitting bug reports

@@ -50,3 +50,3 @@ The preferred way to report bugs is to use the

## Contributing code [^](#how-to-contribute)
## Contributing code

@@ -53,0 +53,0 @@ - Make sure you have a [GitHub Account](https://github.com/signup/free)

@@ -262,3 +262,3 @@ /**

current = stream.current();
if (style === 'variable') {
if (/^\.[\w$]+$/.test(current)) {
return 'variable';

@@ -265,0 +265,0 @@ } else {

@@ -1,8 +0,6 @@

CodeMirror.defineMode("css", function(config) {
return CodeMirror.getMode(config, "text/css");
});
CodeMirror.defineMode("css-base", function(config, parserConfig) {
CodeMirror.defineMode("css", function(config, parserConfig) {
"use strict";
if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
var indentUnit = config.indentUnit,

@@ -42,3 +40,3 @@ hooks = parserConfig.hooks || {},

}
else if (/\d/.test(ch)) {
else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) {
stream.eatWhile(/[\w.%]/);

@@ -281,12 +279,10 @@ return ret("number", "unit");

}
else state.stack.push("(");
}
else if (type == ")") {
if (context == "propertyValue" && state.stack[state.stack.length-2] == "@mediaType(") {
if (context == "propertyValue") {
// In @mediaType( without closing ; after propertyValue
state.stack.pop();
state.stack.pop();
}
else if (context == "@mediaType(") {
state.stack.pop();
}
state.stack.pop();
}

@@ -587,3 +583,3 @@ else if (type == ":" && state.lastToken == "property") state.stack.push("propertyValue");

},
name: "css-base"
name: "css"
});

@@ -599,2 +595,8 @@

hooks: {
":": function(stream) {
if (stream.match(/\s*{/)) {
return [null, "{"];
}
return false;
},
"$": function(stream) {

@@ -627,4 +629,4 @@ stream.match(/^[\w-]+/);

},
name: "css-base"
name: "css"
});
})();

@@ -1,2 +0,2 @@

CodeMirror.defineMode("haskell", function() {
CodeMirror.defineMode("haskell", function(_config, modeConfig) {

@@ -224,2 +224,6 @@ function switchState(source, setState, f) {

var override = modeConfig.overrideKeywords;
if (override) for (var word in override) if (override.hasOwnProperty(word))
wkw[word] = override[word];
return wkw;

@@ -226,0 +230,0 @@ })();

/*
LESS mode - http://www.lesscss.org/
Ported to CodeMirror by Peter Kroon <plakroon@gmail.com>
Report bugs/issues here: https://github.com/marijnh/CodeMirror/issues GitHub: @peterkroon
Report bugs/issues here: https://github.com/marijnh/CodeMirror/issues
GitHub: @peterkroon
*/

@@ -20,8 +21,6 @@

return tokenCComment(stream, state);
}
else if (ch == "<" && stream.eat("!")) {
} else if (ch == "<" && stream.eat("!")) {
state.tokenize = tokenSGMLComment;
return tokenSGMLComment(stream, state);
}
else if (ch == "=") ret(null, "compare");
} else if (ch == "=") ret(null, "compare");
else if (ch == "|" && stream.eat("=")) return ret(null, "compare");

@@ -31,27 +30,23 @@ else if (ch == "\"" || ch == "'") {

return state.tokenize(stream, state);
}
else if (ch == "/") { // e.g.: .png will not be parsed as a class
} else if (ch == "/") { // e.g.: .png will not be parsed as a class
if(stream.eat("/")){
state.tokenize = tokenSComment;
return tokenSComment(stream, state);
}else{
if(type == "string" || type == "(")return ret("string", "string");
if(state.stack[state.stack.length-1] != undefined)return ret(null, ch);
} else {
if(type == "string" || type == "(") return ret("string", "string");
if(state.stack[state.stack.length-1] != undefined) return ret(null, ch);
stream.eatWhile(/[\a-zA-Z0-9\-_.\s]/);
if( /\/|\)|#/.test(stream.peek() || (stream.eatSpace() && stream.peek() == ")")) || stream.eol() )return ret("string", "string"); // let url(/images/logo.png) without quotes return as string
}
}
else if (ch == "!") {
} else if (ch == "!") {
stream.match(/^\s*\w*/);
return ret("keyword", "important");
}
else if (/\d/.test(ch)) {
} else if (/\d/.test(ch)) {
stream.eatWhile(/[\w.%]/);
return ret("number", "unit");
}
else if (/[,+<>*\/]/.test(ch)) {
} else if (/[,+<>*\/]/.test(ch)) {
if(stream.peek() == "=" || type == "a")return ret("string", "string");
if(ch === ",")return ret(null, ch);
return ret(null, "select-op");
}
else if (/[;{}:\[\]()~\|]/.test(ch)) {
} else if (/[;{}:\[\]()~\|]/.test(ch)) {
if(ch == ":"){

@@ -61,3 +56,3 @@ stream.eatWhile(/[a-z\\\-]/);

return ret("tag", "tag");
}else if(stream.peek() == ":"){//::-webkit-search-decoration
} else if(stream.peek() == ":"){//::-webkit-search-decoration
stream.next();

@@ -68,12 +63,11 @@ stream.eatWhile(/[a-z\\\-]/);

return ret(null, ch);
}else{
} else {
return ret(null, ch);
}
}else if(ch == "~"){
} else if(ch == "~"){
if(type == "r")return ret("string", "string");
}else{
} else {
return ret(null, ch);
}
}
else if (ch == ".") {
} else if (ch == ".") {
if(type == "(" || type == "string")return ret("string", "string"); // allow url(../image.png)

@@ -84,4 +78,3 @@ stream.eatWhile(/[\a-zA-Z0-9\-_]/);

return ret("tag", "tag");
}
else if (ch == "#") {
} else if (ch == "#") {
//we don't eat white-space, we want the hex color and or id only

@@ -101,39 +94,37 @@ stream.eatWhile(/[A-Za-z0-9]/);

//we have a valid hex color value, parse as id whenever an element/class is defined after the hex(id) value e.g. #eee aaa || #eee .aaa
else if( /[a-zA-Z\\]/.test(stream.peek()) )return ret("atom", "tag");
else if( /[a-zA-Z\\]/.test(stream.peek()) )return ret("atom", "tag");
//when a hex value is on the end of a line, parse as id
else if(stream.eol())return ret("atom", "tag");
else if(stream.eol())return ret("atom", "tag");
//default
else return ret("number", "unit");
}else{//when not a valid hexvalue in the current stream e.g. #footer
else return ret("number", "unit");
} else {//when not a valid hexvalue in the current stream e.g. #footer
stream.eatWhile(/[\w\\\-]/);
return ret("atom", "tag");
}
}else{//when not a valid hexvalue length
} else {//when not a valid hexvalue length
stream.eatWhile(/[\w\\\-]/);
return ret("atom", "tag");
}
}
else if (ch == "&") {
} else if (ch == "&") {
stream.eatWhile(/[\w\-]/);
return ret(null, ch);
}
else {
} else {
stream.eatWhile(/[\w\\\-_%.{]/);
if(type == "string"){
return ret("string", "string");
}else if(stream.current().match(/(^http$|^https$)/) != null){
} else if(stream.current().match(/(^http$|^https$)/) != null){
stream.eatWhile(/[\w\\\-_%.{:\/]/);
return ret("string", "string");
}else if(stream.peek() == "<" || stream.peek() == ">"){
} else if(stream.peek() == "<" || stream.peek() == ">" || stream.peek() == "+"){
return ret("tag", "tag");
}else if( /\(/.test(stream.peek()) ){
} else if( /\(/.test(stream.peek()) ){
return ret(null, ch);
}else if (stream.peek() == "/" && state.stack[state.stack.length-1] != undefined){ // url(dir/center/image.png)
} else if (stream.peek() == "/" && state.stack[state.stack.length-1] != undefined){ // url(dir/center/image.png)
return ret("string", "string");
}else if( stream.current().match(/\-\d|\-.\d/) ){ // match e.g.: -5px -0.4 etc... only colorize the minus sign
} else if( stream.current().match(/\-\d|\-.\d/) ){ // match e.g.: -5px -0.4 etc... only colorize the minus sign
//commment out these 2 comment if you want the minus sign to be parsed as null -500px
//stream.backUp(stream.current().length-1);
//return ret(null, ch); //console.log( stream.current() );
//return ret(null, ch);
return ret("number", "unit");
}else if( /\/|[\s\)]/.test(stream.peek() || stream.eol() || (stream.eatSpace() && stream.peek() == "/")) && stream.current().indexOf(".") !== -1){
} else if( /\/|[\s\)]/.test(stream.peek() || stream.eol() || (stream.eatSpace() && stream.peek() == "/")) && stream.current().indexOf(".") !== -1){
if(stream.current().substring(stream.current().length-1,stream.current().length) == "{"){

@@ -146,10 +137,11 @@ stream.backUp(1);

return ret("string", "string"); // let url(/images/logo.png) without quotes return as string
}else if( stream.eol() || stream.peek() == "[" || stream.peek() == "#" || type == "tag" ){
} else if( stream.eol() || stream.peek() == "[" || stream.peek() == "#" || type == "tag" ){
if(stream.current().substring(stream.current().length-1,stream.current().length) == "{")stream.backUp(1);
return ret("tag", "tag");
}else if(type == "compare" || type == "a" || type == "("){
} else if(type == "compare" || type == "a" || type == "("){
return ret("string", "string");
}else if(type == "|" || stream.current() == "-" || type == "["){
} else if(type == "|" || stream.current() == "-" || type == "["){
if(type == "|" )return ret("tag", "tag");
return ret(null, ch);
}else if(stream.peek() == ":") {
} else if(stream.peek() == ":") {
stream.next();

@@ -166,7 +158,10 @@ var t_v = stream.peek() == ":" ? true : false;

} else stream.backUp(new_pos-(old_pos-1));
}else{
} else {
stream.backUp(1);
}
if(t_v)return ret("tag", "tag"); else return ret("variable", "variable");
}else{
} else if(state.stack[state.stack.length-1] === "font-family"){
return ret(null, null);
} else {
if(state.stack[state.stack.length-1] === "{" || type === "select-op" || (state.stack[state.stack.length-1] === "rule" && type === ",") )return ret("tag", "tag");
return ret("variable", "variable");

@@ -249,3 +244,5 @@ }

else if (type == "@media") state.stack.push("@media");
else if (context == "{" && type != "comment") state.stack.push("rule");
else if (stream.current() === "font-family") state.stack[state.stack.length-1] = "font-family";
else if (context == "{" && type != "comment" && type !== "tag") state.stack.push("rule");
else if (stream.peek() === ":" && stream.current().match(/@|#/) === null) style = type;
return style;

@@ -256,2 +253,3 @@ },

var n = state.stack.length;
if (/^\}/.test(textAfter))

@@ -258,0 +256,0 @@ n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1;

@@ -16,4 +16,6 @@ CodeMirror.modeInfo = [

{name: 'diff', mime: 'text/x-diff', mode: 'diff'},
{name: 'DTD', mime: 'application/xml-dtd', mode: 'dtd'},
{name: 'ECL', mime: 'text/x-ecl', mode: 'ecl'},
{name: 'Erlang', mime: 'text/x-erlang', mode: 'erlang'},
{name: 'Fortran', mime: 'text/x-fortran', mode: 'fortran'},
{name: 'Gas', mime: 'text/x-gas', mode: 'gas'},

@@ -23,2 +25,3 @@ {name: 'GitHub Flavored Markdown', mime: 'text/x-gfm', mode: 'gfm'},

{name: 'Groovy', mime: 'text/x-groovy', mode: 'groovy'},
{name: 'HAML', mime: 'text/x-haml', mode: 'haml'},
{name: 'Haskell', mime: 'text/x-haskell', mode: 'haskell'},

@@ -45,2 +48,3 @@ {name: 'Haxe', mime: 'text/x-haxe', mode: 'haxe'},

{name: 'OCaml', mime: 'text/x-ocaml', mode: 'ocaml'},
{name: 'Octave', mime: 'text/x-octave', mode: 'octave'},
{name: 'Pascal', mime: 'text/x-pascal', mode: 'pascal'},

@@ -75,2 +79,4 @@ {name: 'Perl', mime: 'text/x-perl', mode: 'perl'},

{name: 'Tiki wiki', mime: 'text/tiki', mode: 'tiki'},
{name: 'TOML', mime: 'text/x-toml', mode: 'toml'},
{name: 'Turtle', mime: 'text/turtle', mode: 'turtle'},
{name: 'VB.NET', mime: 'text/x-vb', mode: 'vb'},

@@ -77,0 +83,0 @@ {name: 'VBScript', mime: 'text/vbscript', mode: 'vbscript'},

@@ -183,3 +183,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {

else return cx.indent + config.indentUnit;
}
},
blockCommentStart: "/*",
blockCommentEnd: "*/",
lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : null
};

@@ -266,3 +270,3 @@ });

keywords: set(sqlKeywords + "accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
builtin: set("bool boolean bit blob decimal double enum float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),
builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),
atoms: set("false true null unknown"),

@@ -283,3 +287,3 @@ operatorChars: /^[*+\-%<>!=&|^]/,

keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
builtin: set("bool boolean bit blob decimal double enum float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),
builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),
atoms: set("false true null unknown"),

@@ -315,4 +319,3 @@ operatorChars: /^[*+\-%<>!=&|^]/,

keywords: set("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),
functions: set("abs acos add_months ascii asin atan atan2 average bfilename ceil chartorowid chr concat convert cos cosh count decode deref dual dump dup_val_on_index empty error exp false floor found glb greatest hextoraw initcap instr instrb isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mod months_between new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null nvl others power rawtohex reftohex round rowcount rowidtochar rpad rtrim sign sin sinh soundex sqlcode sqlerrm sqrt stddev substr substrb sum sysdate tan tanh to_char to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid upper user userenv variance vsize"),
builtin: set("bfile blob character clob dec float int integer mlslabel natural naturaln nchar nclob number numeric nvarchar2 real rowtype signtype smallint string varchar varchar2"),
builtin: set("bfile blob character clob dec float int integer mlslabel natural naturaln nchar nclob number numeric nvarchar2 real rowtype signtype smallint string varchar varchar2 abs acos add_months ascii asin atan atan2 average bfilename ceil chartorowid chr concat convert cos cosh count decode deref dual dump dup_val_on_index empty error exp false floor found glb greatest hextoraw initcap instr instrb isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mod months_between new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null nvl others power rawtohex reftohex round rowcount rowidtochar rpad rtrim sign sin sinh soundex sqlcode sqlerrm sqrt stddev substr substrb sum sysdate tan tanh to_char to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid upper user userenv variance vsize"),
operatorChars: /^[*+\-%<>!=~]/,

@@ -319,0 +322,0 @@ dateSQL: set("date time timestamp"),

{
"name": "codemirror",
"version":"3.16.0",
"version":"3.17.0",
"main": "lib/codemirror.js",

@@ -5,0 +5,0 @@ "description": "In-browser code editing made bearable",

var Pos = CodeMirror.Pos;
CodeMirror.defaults.rtlMoveVisually = true;
function forEach(arr, f) {

@@ -532,6 +534,6 @@ for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);

add(true);
eq(base1, cm.cursorCoords(Pos(0, 1)).left);
is(Math.abs(base1 - cm.cursorCoords(Pos(0, 1)).left) < .1);
while (m = ms.pop()) m.clear();
add(false);
eq(base4, cm.cursorCoords(Pos(0, 1)).left);
is(Math.abs(base4 - cm.cursorCoords(Pos(0, 1)).left) < .1);
}, {value: "abcdefg"});

@@ -1163,3 +1165,3 @@

});
}, {rtlMoveVisually: true});
});

@@ -1345,2 +1347,3 @@ // Verify that updating a line clears its bidi ordering

m = atom(1, 1, 3, 8);
cm.setCursor(Pos(0, 0));
cm.setCursor(Pos(2, 0));

@@ -1544,1 +1547,20 @@ eqPos(cm.getCursor(), Pos(3, 8));

});
testCM("lineStyleFromMode", function(cm) {
CodeMirror.defineMode("test_mode", function() {
return {token: function(stream) {
if (stream.match(/^\[[^\]]*\]/)) return "line-brackets";
if (stream.match(/^\([^\]]*\)/)) return "line-background-parens";
stream.match(/^\s+|^\S+/);
}};
});
cm.setOption("mode", "test_mode");
var bracketElts = byClassName(cm.getWrapperElement(), "brackets");
eq(bracketElts.length, 1);
eq(bracketElts[0].nodeName, "PRE");
is(!/brackets.*brackets/.test(bracketElts[0].className));
var parenElts = byClassName(cm.getWrapperElement(), "parens");
eq(parenElts.length, 1);
eq(parenElts[0].nodeName, "DIV");
is(!/parens.*parens/.test(parenElts[0].className));
}, {value: "line1: [br] [br]\nline2: (par) (par)\nline3: nothing"});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc