diff --git a/package-lock.json b/package-lock.json index 6693b7ae..f71d8ada 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.5.17", "license": "GPL-3.0-only", "dependencies": { - "codemirror": "5.59.4", + "codemirror": "5.60.0", "db-to-cloud": "^0.6.0", "jsonlint": "^1.6.3", "less-bundle": "github:openstyles/less-bundle#v0.1.0", @@ -2361,9 +2361,9 @@ } }, "node_modules/codemirror": { - "version": "5.59.4", - "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.59.4.tgz", - "integrity": "sha512-achw5JBgx8QPcACDDn+EUUXmCYzx/zxEtOGXyjvLEvYY8GleUrnfm5D+Zb+UjShHggXKDT9AXrbkBZX6a0YSQg==" + "version": "5.60.0", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.60.0.tgz", + "integrity": "sha512-AEL7LhFOlxPlCL8IdTcJDblJm8yrAGib7I+DErJPdZd4l6imx8IMgKK3RblVgBQqz3TZJR4oknQ03bz+uNjBYA==" }, "node_modules/collection-visit": { "version": "1.0.0", @@ -13933,9 +13933,9 @@ } }, "codemirror": { - "version": "5.59.4", - "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.59.4.tgz", - "integrity": "sha512-achw5JBgx8QPcACDDn+EUUXmCYzx/zxEtOGXyjvLEvYY8GleUrnfm5D+Zb+UjShHggXKDT9AXrbkBZX6a0YSQg==" + "version": "5.60.0", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.60.0.tgz", + "integrity": "sha512-AEL7LhFOlxPlCL8IdTcJDblJm8yrAGib7I+DErJPdZd4l6imx8IMgKK3RblVgBQqz3TZJR4oknQ03bz+uNjBYA==" }, "collection-visit": { "version": "1.0.0", diff --git a/package.json b/package.json index 73886a86..81c2810b 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "repository": "openstyles/stylus", "author": "Stylus Team", "dependencies": { - "codemirror": "5.59.4", + "codemirror": "5.60.0", "db-to-cloud": "^0.6.0", "jsonlint": "^1.6.3", "less-bundle": "github:openstyles/less-bundle#v0.1.0", diff --git a/vendor/codemirror/README.md b/vendor/codemirror/README.md index 35ddb69c..09500369 100644 --- a/vendor/codemirror/README.md +++ b/vendor/codemirror/README.md @@ -1,4 +1,4 @@ -## codemirror v5.59.4 +## codemirror v5.60.0 Following files are copied from npm (node_modules): diff --git a/vendor/codemirror/addon/hint/show-hint.js b/vendor/codemirror/addon/hint/show-hint.js index a9f2ded1..bfe7d3a3 100644 --- a/vendor/codemirror/addon/hint/show-hint.js +++ b/vendor/codemirror/addon/hint/show-hint.js @@ -360,7 +360,7 @@ close: function() { if (this.completion.widget != this) return; this.completion.widget = null; - this.hints.parentNode.removeChild(this.hints); + if (this.hints.parentNode) this.hints.parentNode.removeChild(this.hints); this.completion.cm.removeKeyMap(this.keyMap); var cm = this.completion.cm; diff --git a/vendor/codemirror/keymap/sublime.js b/vendor/codemirror/keymap/sublime.js index 7edf172e..0c9a63e0 100644 --- a/vendor/codemirror/keymap/sublime.js +++ b/vendor/codemirror/keymap/sublime.js @@ -339,7 +339,7 @@ }; - function sortLines(cm, caseSensitive) { + function sortLines(cm, caseSensitive, direction) { if (cm.isReadOnly()) return CodeMirror.Pass var ranges = cm.listSelections(), toSort = [], selected; for (var i = 0; i < ranges.length; i++) { @@ -361,12 +361,12 @@ var start = Pos(from, 0), end = Pos(to); var lines = cm.getRange(start, end, false); if (caseSensitive) - lines.sort(); + lines.sort(function(a, b) { return a < b ? -direction : a == b ? 0 : direction; }); else lines.sort(function(a, b) { var au = a.toUpperCase(), bu = b.toUpperCase(); if (au != bu) { a = au; b = bu; } - return a < b ? -1 : a == b ? 0 : 1; + return a < b ? -direction : a == b ? 0 : direction; }); cm.replaceRange(lines, start, end); if (selected) ranges.push({anchor: start, head: Pos(to + 1, 0)}); @@ -375,8 +375,10 @@ }); } - cmds.sortLines = function(cm) { sortLines(cm, true); }; - cmds.sortLinesInsensitive = function(cm) { sortLines(cm, false); }; + cmds.sortLines = function(cm) { sortLines(cm, true, 1); }; + cmds.reverseSortLines = function(cm) { sortLines(cm, true, -1); }; + cmds.sortLinesInsensitive = function(cm) { sortLines(cm, false, 1); }; + cmds.reverseSortLinesInsensitive = function(cm) { sortLines(cm, false, -1); }; cmds.nextBookmark = function(cm) { var marks = cm.state.sublimeBookmarks; @@ -609,7 +611,9 @@ "Cmd-J": "joinLines", "Shift-Cmd-D": "duplicateLine", "F5": "sortLines", + "Shift-F5": "reverseSortLines", "Cmd-F5": "sortLinesInsensitive", + "Shift-Cmd-F5": "reverseSortLinesInsensitive", "F2": "nextBookmark", "Shift-F2": "prevBookmark", "Cmd-F2": "toggleBookmark", @@ -671,7 +675,9 @@ "Ctrl-J": "joinLines", "Shift-Ctrl-D": "duplicateLine", "F9": "sortLines", + "Shift-F9": "reverseSortLines", "Ctrl-F9": "sortLinesInsensitive", + "Shift-Ctrl-F9": "reverseSortLinesInsensitive", "F2": "nextBookmark", "Shift-F2": "prevBookmark", "Ctrl-F2": "toggleBookmark", diff --git a/vendor/codemirror/lib/codemirror.js b/vendor/codemirror/lib/codemirror.js index 1f313cff..055963b0 100644 --- a/vendor/codemirror/lib/codemirror.js +++ b/vendor/codemirror/lib/codemirror.js @@ -6181,7 +6181,7 @@ var out = []; for (var i = 0; i < ranges.length; i++) { out[i] = new Range(clipPos(this, ranges[i].anchor), - clipPos(this, ranges[i].head)); } + clipPos(this, ranges[i].head || ranges[i].anchor)); } if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); } setSelection(this, normalizeSelection(this.cm, out, primary), options); }), @@ -8766,6 +8766,7 @@ var input = this, cm = input.cm; var div = input.div = display.lineDiv; + div.contentEditable = true; disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize); function belongsToInput(e) { @@ -9793,7 +9794,7 @@ addLegacyProps(CodeMirror); - CodeMirror.version = "5.59.3"; + CodeMirror.version = "5.60.0"; return CodeMirror; diff --git a/vendor/codemirror/mode/javascript/javascript.js b/vendor/codemirror/mode/javascript/javascript.js index 04739562..a42f23d0 100644 --- a/vendor/codemirror/mode/javascript/javascript.js +++ b/vendor/codemirror/mode/javascript/javascript.js @@ -218,7 +218,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { // Parser - var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true}; + var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, + "regexp": true, "this": true, "import": true, "jsonld-keyword": true}; function JSLexical(indented, column, type, align, prev, info) { this.indented = indented; @@ -441,7 +442,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == "{") return contCommasep(objprop, "}", null, maybeop); if (type == "quasi") return pass(quasi, maybeop); if (type == "new") return cont(maybeTarget(noComma)); - if (type == "import") return cont(expression); return cont(); } function maybeexpression(type) { @@ -605,7 +605,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { } } function typeexpr(type, value) { - if (value == "keyof" || value == "typeof" || value == "infer") { + if (value == "keyof" || value == "typeof" || value == "infer" || value == "readonly") { cx.marked = "keyword" return cont(value == "typeof" ? expressionNoComma : typeexpr) } @@ -802,6 +802,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { function afterImport(type) { if (type == "string") return cont(); if (type == "(") return pass(expression); + if (type == ".") return pass(maybeoperatorComma); return pass(importSpec, maybeMoreImports, maybeFrom); } function importSpec(type, value) {