From 3d94c641b3d726515d85aa6e2fc211fd92dcd253 Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 13 Aug 2020 20:58:09 +0300 Subject: [PATCH] CodeMirror 5.56 + csslint update (#1014) * CodeMirror 5.56 * csslint: Overscroll Behavior L1 (ED 2020-01-16) * don't list rare/obsolete/future/existing css props --- edit/codemirror-default.js | 75 +------------------ package-lock.json | 6 +- package.json | 2 +- vendor-overwrites/csslint/parserlib.js | 7 ++ vendor/codemirror/README.md | 2 +- vendor/codemirror/addon/hint/show-hint.js | 12 +-- vendor/codemirror/keymap/vim.js | 2 +- vendor/codemirror/lib/codemirror.js | 12 +-- .../codemirror/mode/javascript/javascript.js | 3 +- 9 files changed, 29 insertions(+), 92 deletions(-) diff --git a/edit/codemirror-default.js b/edit/codemirror-default.js index 63ec2423..6d97573d 100644 --- a/edit/codemirror-default.js +++ b/edit/codemirror-default.js @@ -105,92 +105,19 @@ } Object.assign(CodeMirror.mimeModes['text/css'].propertyKeywords, { - // CSS Backgrounds and Borders Module L4 'background-position-x': true, 'background-position-y': true, - - // CSS Logical Properties and Values L1 - 'block-size': true, - 'border-block-color': true, - 'border-block-end': true, - 'border-block-end-color': true, - 'border-block-end-style': true, - 'border-block-end-width': true, - 'border-block-start': true, - 'border-block-start-color': true, - 'border-block-start-style': true, - 'border-block-start-width': true, - 'border-block-style': true, - 'border-block-width': true, - 'border-inline-color': true, - 'border-inline-end': true, - 'border-inline-end-color': true, - 'border-inline-end-style': true, - 'border-inline-end-width': true, - 'border-inline-start': true, - 'border-inline-start-color': true, - 'border-inline-start-style': true, - 'border-inline-start-width': true, - 'border-inline-style': true, - 'border-inline-width': true, - 'inline-size': true, - 'inset': true, - 'inset-block': true, - 'inset-block-end': true, - 'inset-block-start': true, - 'inset-inline': true, - 'inset-inline-end': true, - 'inset-inline-start': true, - 'margin-block': true, - 'margin-block-end': true, - 'margin-block-start': true, - 'margin-inline': true, - 'margin-inline-end': true, - 'margin-inline-start': true, - 'max-block-size': true, - 'max-inline-size': true, - 'min-block-size': true, - 'min-inline-size': true, - 'padding-block': true, - 'padding-block-end': true, - 'padding-block-start': true, - 'padding-inline': true, - 'padding-inline-end': true, - 'padding-inline-start': true, - 'text-align-all': true, - 'contain': true, 'mask-image': true, 'mix-blend-mode': true, + 'overscroll-behavior': true, 'rotate': true, 'isolation': true, - 'zoom': true, - - // https://www.w3.org/TR/css-round-display-1/ - 'border-boundary': true, - 'shape': true, - 'shape-inside': true, - 'viewport-fit': true, - - // nonstandard https://compat.spec.whatwg.org/ - 'box-reflect': true, - 'text-fill-color': true, - 'text-stroke': true, - 'text-stroke-color': true, - 'text-stroke-width': true, - // end - }); - Object.assign(CodeMirror.mimeModes['text/css'].valueKeywords, { - 'isolate': true, - 'rect': true, - 'recto': true, - 'verso': true, }); Object.assign(CodeMirror.mimeModes['text/css'].colorKeywords, { 'darkgrey': true, 'darkslategrey': true, 'dimgrey': true, - 'grey': true, 'lightgrey': true, 'lightslategrey': true, 'slategrey': true, diff --git a/package-lock.json b/package-lock.json index e5542949..466000f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1917,9 +1917,9 @@ "dev": true }, "codemirror": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.54.0.tgz", - "integrity": "sha512-Pgf3surv4zvw+KaW3doUU7pGjF0BPU8/sj7eglWJjzni46U/DDW8pu3nZY0QgQKUcICDXRkq8jZmq0y6KhxM3Q==" + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.56.0.tgz", + "integrity": "sha512-MfKVmYgifXjQpLSgpETuih7A7WTTIsxvKfSLGseTY5+qt0E1UD1wblZGM6WLenORo8sgmf+3X+WTe2WF7mufyw==" }, "collection-visit": { "version": "1.0.0", diff --git a/package.json b/package.json index 40cf1e24..f79dceca 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "repository": "openstyles/stylus", "author": "Stylus Team", "dependencies": { - "codemirror": "^5.54.0", + "codemirror": "^5.56.0", "db-to-cloud": "^0.4.5", "jsonlint": "^1.6.3", "less-bundle": "github:openstyles/less-bundle#v0.1.0", diff --git a/vendor-overwrites/csslint/parserlib.js b/vendor-overwrites/csslint/parserlib.js index 3bbcad0a..480aef97 100644 --- a/vendor-overwrites/csslint/parserlib.js +++ b/vendor-overwrites/csslint/parserlib.js @@ -514,6 +514,11 @@ self.parserlib = (() => { 'overflow-wrap': 'normal | break-word | anywhere', 'overflow-x': '', 'overflow-y': '', + 'overscroll-behavior': '{1,2}', + 'overscroll-behavior-block': '', + 'overscroll-behavior-inline': '', + 'overscroll-behavior-x': '', + 'overscroll-behavior-y': '', // P 'padding': '{1,4}', @@ -1062,6 +1067,8 @@ self.parserlib = (() => { '': '[ | ] {2} [ / ]? | ' + '[ | ] , #{2} [ , ]?', + '': 'contain | none | auto', + '': 'inset? && [ {2,4} && ? ]', '': 'linear | | | frames()', diff --git a/vendor/codemirror/README.md b/vendor/codemirror/README.md index 6351e86e..2e35ecfa 100644 --- a/vendor/codemirror/README.md +++ b/vendor/codemirror/README.md @@ -1,4 +1,4 @@ -## codemirror v5.54.0 +## codemirror v5.56.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 c55deab3..cd0d6a7b 100644 --- a/vendor/codemirror/addon/hint/show-hint.js +++ b/vendor/codemirror/addon/hint/show-hint.js @@ -379,12 +379,14 @@ }, scrollToActive: function() { - var node = this.hints.childNodes[this.selectedHint] + var margin = this.completion.options.scrollMargin || 0; + var node1 = this.hints.childNodes[Math.max(0, this.selectedHint - margin)]; + var node2 = this.hints.childNodes[Math.min(this.data.list.length - 1, this.selectedHint + margin)]; var firstNode = this.hints.firstChild; - if (node.offsetTop < this.hints.scrollTop) - this.hints.scrollTop = node.offsetTop - firstNode.offsetTop; - else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight) - this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + firstNode.offsetTop; + if (node1.offsetTop < this.hints.scrollTop) + this.hints.scrollTop = node1.offsetTop - firstNode.offsetTop; + else if (node2.offsetTop + node2.offsetHeight > this.hints.scrollTop + this.hints.clientHeight) + this.hints.scrollTop = node2.offsetTop + node2.offsetHeight - this.hints.clientHeight + firstNode.offsetTop; }, screenAmount: function() { diff --git a/vendor/codemirror/keymap/vim.js b/vendor/codemirror/keymap/vim.js index b5be59cc..bca6d46d 100644 --- a/vendor/codemirror/keymap/vim.js +++ b/vendor/codemirror/keymap/vim.js @@ -3203,7 +3203,7 @@ vim.visualMode = false; vim.visualLine = false; vim.visualBlock = false; - CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); + if (!vim.insertMode) CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); clearFakeCursor(vim); } diff --git a/vendor/codemirror/lib/codemirror.js b/vendor/codemirror/lib/codemirror.js index b6eaa723..06f0f868 100644 --- a/vendor/codemirror/lib/codemirror.js +++ b/vendor/codemirror/lib/codemirror.js @@ -2960,7 +2960,7 @@ var x, y, space = display.lineSpace.getBoundingClientRect(); // Fails unpredictably on IE[67] when mouse is dragged around quickly. try { x = e.clientX - space.left; y = e.clientY - space.top; } - catch (e) { return null } + catch (e$1) { return null } var coords = coordsChar(cm, x, y), line; if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) { var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length; @@ -6545,7 +6545,7 @@ cm.display.input.focus(); } } - catch(e){} + catch(e$1){} } } @@ -7597,7 +7597,7 @@ mY = e.touches[0].clientY; } else { try { mX = e.clientX; mY = e.clientY; } - catch(e) { return false } + catch(e$1) { return false } } if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false } if (prevent) { e_preventDefault(e); } @@ -7697,7 +7697,7 @@ for (var i = newBreaks.length - 1; i >= 0; i--) { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); } }); - option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) { + option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) { cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g"); if (old != Init) { cm.refresh(); } }); @@ -8117,7 +8117,7 @@ { from = Pos(from.line, from.ch - deleted); } else if (cm.state.overwrite && !paste) // Handle overwrite { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); } - else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted) + else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == textLines.join("\n")) { from = to = Pos(from.line, 0); } } var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines, @@ -9771,7 +9771,7 @@ addLegacyProps(CodeMirror); - CodeMirror.version = "5.54.0"; + CodeMirror.version = "5.56.0"; return CodeMirror; diff --git a/vendor/codemirror/mode/javascript/javascript.js b/vendor/codemirror/mode/javascript/javascript.js index c6577630..9c751d23 100644 --- a/vendor/codemirror/mode/javascript/javascript.js +++ b/vendor/codemirror/mode/javascript/javascript.js @@ -103,7 +103,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { return ret("meta", "meta"); } else if (ch == "#" && stream.eatWhile(wordRE)) { return ret("variable", "property") - } else if (ch == "<" && stream.match("!--") || ch == "-" && stream.match("->")) { + } else if (ch == "<" && stream.match("!--") || + (ch == "-" && stream.match("->") && !/\S/.test(stream.string.slice(0, stream.start)))) { stream.skipToEnd() return ret("comment", "comment") } else if (isOperatorChar.test(ch)) {