From 146937a78a09703b468e99caf2555810e0c9723f Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Wed, 6 Dec 2023 11:33:55 +0100 Subject: [PATCH] Upgrade to latest versions of Codemirror and Lezer packages --- package-lock.json | 127 +++++++++++++++++++------------------- package.json | 18 +++--- src/editor/emacs.js | 4 +- src/editor/theme/base.js | 3 + src/editor/theme/dark.js | 8 ++- src/editor/theme/light.js | 8 ++- 6 files changed, 90 insertions(+), 78 deletions(-) diff --git a/package-lock.json b/package-lock.json index aca63b7..9dc539d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,24 +12,24 @@ "electron-log": "^4.4.8" }, "devDependencies": { - "@codemirror/commands": "^6.2.1", + "@codemirror/commands": "^6.3.2", "@codemirror/lang-cpp": "^6.0.2", - "@codemirror/lang-html": "^6.4.0", + "@codemirror/lang-html": "^6.4.7", "@codemirror/lang-java": "^6.0.1", - "@codemirror/lang-javascript": "^6.1.2", + "@codemirror/lang-javascript": "^6.2.1", "@codemirror/lang-json": "^6.0.1", "@codemirror/lang-lezer": "^6.0.1", - "@codemirror/lang-markdown": "^6.0.5", + "@codemirror/lang-markdown": "^6.2.3", "@codemirror/lang-php": "^6.0.1", - "@codemirror/lang-python": "^6.1.1", + "@codemirror/lang-python": "^6.1.3", "@codemirror/lang-rust": "^6.0.1", - "@codemirror/lang-sql": "^6.3.3", + "@codemirror/lang-sql": "^6.5.4", "@codemirror/lang-xml": "^6.0.2", - "@codemirror/language": "^6.4.0", + "@codemirror/language": "^6.9.3", "@codemirror/rangeset": "^0.19.9", - "@codemirror/search": "^6.2.3", + "@codemirror/search": "^6.5.5", "@electron/asar": "^3.2.2", - "@lezer/generator": "^1.2.2", + "@lezer/generator": "^1.5.1", "@rollup/plugin-node-resolve": "^15.0.1", "@vitejs/plugin-vue": "^4.0.0", "codemirror": "^6.0.1", @@ -170,14 +170,14 @@ } }, "node_modules/@codemirror/autocomplete": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.4.0.tgz", - "integrity": "sha512-HLF2PnZAm1s4kGs30EiqKMgD7XsYaQ0XJnMR0rofEWQ5t5D60SfqpDIkIh1ze5tiEbyUWm8+VJ6W1/erVvBMIA==", + "version": "6.11.1", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.11.1.tgz", + "integrity": "sha512-L5UInv8Ffd6BPw0P3EF7JLYAMeEbclY7+6Q11REt8vhih8RuLreKtPy/xk8wPxs4EQgYqzI7cdgpiYwWlbS/ow==", "dev": true, "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", - "@codemirror/view": "^6.6.0", + "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0" }, "peerDependencies": { @@ -188,15 +188,15 @@ } }, "node_modules/@codemirror/commands": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.2.1.tgz", - "integrity": "sha512-FFiNKGuHA5O8uC6IJE5apI5rT9gyjlw4whqy4vlcX0wE/myxL6P1s0upwDhY4HtMWLOwzwsp0ap3bjdQhvfDOA==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.3.2.tgz", + "integrity": "sha512-tjoi4MCWDNxgIpoLZ7+tezdS9OEB6pkiDKhfKx9ReJ/XBcs2G2RXIu+/FxXBlWsPTsz6C9q/r4gjzrsxpcnqCQ==", "dev": true, "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.2.0", "@codemirror/view": "^6.0.0", - "@lezer/common": "^1.0.0" + "@lezer/common": "^1.1.0" } }, "node_modules/@codemirror/lang-cpp": { @@ -222,20 +222,20 @@ } }, "node_modules/@codemirror/lang-html": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@codemirror/lang-html/-/lang-html-6.4.0.tgz", - "integrity": "sha512-HHged0d9AQ/mpjYLTYDVdtI7235dO0COFNgc5uuiGokgjWx3L/sjMSw5aS/Nk7JG++LhsohG5HMNTCuqAq3Tcg==", + "version": "6.4.7", + "resolved": "https://registry.npmjs.org/@codemirror/lang-html/-/lang-html-6.4.7.tgz", + "integrity": "sha512-y9hWSSO41XlcL4uYwWyk0lEgTHcelWWfRuqmvcAmxfCs0HNWZdriWo/EU43S63SxEZpc1Hd50Itw7ktfQvfkUg==", "dev": true, "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/lang-css": "^6.0.0", "@codemirror/lang-javascript": "^6.0.0", - "@codemirror/language": "^6.0.0", + "@codemirror/language": "^6.4.0", "@codemirror/state": "^6.0.0", - "@codemirror/view": "^6.2.2", + "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0", "@lezer/css": "^1.1.0", - "@lezer/html": "^1.1.0" + "@lezer/html": "^1.3.0" } }, "node_modules/@codemirror/lang-java": { @@ -249,16 +249,16 @@ } }, "node_modules/@codemirror/lang-javascript": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/@codemirror/lang-javascript/-/lang-javascript-6.1.2.tgz", - "integrity": "sha512-OcwLfZXdQ1OHrLiIcKCn7MqZ7nx205CMKlhe+vL88pe2ymhT9+2P+QhwkYGxMICj8TDHyp8HFKVwpiisUT7iEQ==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@codemirror/lang-javascript/-/lang-javascript-6.2.1.tgz", + "integrity": "sha512-jlFOXTejVyiQCW3EQwvKH0m99bUYIw40oPmFjSX2VS78yzfe0HELZ+NEo9Yfo1MkGRpGlj3Gnu4rdxV1EnAs5A==", "dev": true, "dependencies": { "@codemirror/autocomplete": "^6.0.0", - "@codemirror/language": "^6.0.0", + "@codemirror/language": "^6.6.0", "@codemirror/lint": "^6.0.0", "@codemirror/state": "^6.0.0", - "@codemirror/view": "^6.0.0", + "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0", "@lezer/javascript": "^1.0.0" } @@ -286,11 +286,12 @@ } }, "node_modules/@codemirror/lang-markdown": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/@codemirror/lang-markdown/-/lang-markdown-6.0.5.tgz", - "integrity": "sha512-qH0THRYc2M7pIJoAp6jstXZkv8ZMVhNaBm7Bs4+0SLHhHlwX53txFy98AcPwrfq0Sh8Zi6RAuj9j/GyL8E1MKw==", + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@codemirror/lang-markdown/-/lang-markdown-6.2.3.tgz", + "integrity": "sha512-wCewRLWpdefWi7uVkHIDiE8+45Fe4buvMDZkihqEom5uRUQrl76Zb13emjeK3W+8pcRgRfAmwelURBbxNEKCIg==", "dev": true, "dependencies": { + "@codemirror/autocomplete": "^6.7.1", "@codemirror/lang-html": "^6.0.0", "@codemirror/language": "^6.3.0", "@codemirror/state": "^6.0.0", @@ -313,14 +314,14 @@ } }, "node_modules/@codemirror/lang-python": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@codemirror/lang-python/-/lang-python-6.1.1.tgz", - "integrity": "sha512-AddGMIKUssUAqaDKoxKWA5GAzy/CVE0eSY7/ANgNzdS1GYBkp6N49XKEyMElkuN04UsZ+bTIQdj+tVV75NMwJw==", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/@codemirror/lang-python/-/lang-python-6.1.3.tgz", + "integrity": "sha512-S9w2Jl74hFlD5nqtUMIaXAq9t5WlM0acCkyuQWUUSvZclk1sV+UfnpFiZzuZSG+hfEaOmxKR5UxY/Uxswn7EhQ==", "dev": true, "dependencies": { "@codemirror/autocomplete": "^6.3.2", - "@codemirror/language": "^6.0.0", - "@lezer/python": "^1.0.0" + "@codemirror/language": "^6.8.0", + "@lezer/python": "^1.1.4" } }, "node_modules/@codemirror/lang-rust": { @@ -334,9 +335,9 @@ } }, "node_modules/@codemirror/lang-sql": { - "version": "6.3.3", - "resolved": "https://registry.npmjs.org/@codemirror/lang-sql/-/lang-sql-6.3.3.tgz", - "integrity": "sha512-VNsHju8500fkiDyDU8jZyGQ8M0iXU0SmfeCoCeAYkACcEFlX63BOT8311pICXyw43VYRbS23w54RgSEQmixGjQ==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/@codemirror/lang-sql/-/lang-sql-6.5.4.tgz", + "integrity": "sha512-5Gq7fYtT/5HbNyIG7a8vYaqOYQU3JbgtBe3+derkrFUXRVcjkf8WVgz++PIbMFAQsOFMDdDR+uiNM8ZRRuXH+w==", "dev": true, "dependencies": { "@codemirror/autocomplete": "^6.0.0", @@ -360,14 +361,14 @@ } }, "node_modules/@codemirror/language": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.4.0.tgz", - "integrity": "sha512-Wzb7GnNj8vnEtbPWiOy9H0m1fBtE28kepQNGLXekU2EEZv43BF865VKITUn+NoV8OpW6gRtvm29YEhqm46927Q==", + "version": "6.9.3", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.9.3.tgz", + "integrity": "sha512-qq48pYzoi6ldYWV/52+Z9Ou6QouVI+8YwvxFbUypI33NbjG2UeRHKENRyhwljTTiOqjQ33FjyZj6EREQ9apAOQ==", "dev": true, "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", - "@lezer/common": "^1.0.0", + "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" @@ -404,9 +405,9 @@ } }, "node_modules/@codemirror/search": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.2.3.tgz", - "integrity": "sha512-V9n9233lopQhB1dyjsBK2Wc1i+8hcCqxl1wQ46c5HWWLePoe4FluV3TGHoZ04rBRlGjNyz9DTmpJErig8UE4jw==", + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.5.5.tgz", + "integrity": "sha512-PIEN3Ke1buPod2EHbJsoQwlbpkz30qGZKcnmH1eihq9+bPQx8gelauUwLYaY4vBOuBAuEhmpDLii4rj/uO0yMA==", "dev": true, "dependencies": { "@codemirror/state": "^6.0.0", @@ -428,13 +429,13 @@ "dev": true }, "node_modules/@codemirror/view": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.7.1.tgz", - "integrity": "sha512-kYtS+uqYw/q/0ytYxpkqE1JVuK5NsbmBklWYhwLFTKO9gVuTdh/kDEeZPKorbqHcJ+P+ucrhcsS1czVweOpT2g==", + "version": "6.22.1", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.22.1.tgz", + "integrity": "sha512-38BRn1nPqZqiHbmWfI8zri23IbRVbmSpSmh1E/Ysvc+lIGGdBC17K8zlK7ZU6fhfy9x4De9Zyj5JQqScPq5DkA==", "dev": true, "dependencies": { "@codemirror/state": "^6.1.4", - "style-mod": "^4.0.0", + "style-mod": "^4.1.0", "w3c-keyname": "^2.2.4" } }, @@ -904,9 +905,9 @@ } }, "node_modules/@lezer/common": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.0.2.tgz", - "integrity": "sha512-SVgiGtMnMnW3ActR8SXgsDhw7a0w0ChHSYAyAUxxrOiJ1OqYWEKk/xJd84tTSPo1mo6DXLObAJALNnd0Hrv7Ng==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.1.1.tgz", + "integrity": "sha512-aAPB9YbvZHqAW+bIwiuuTDGB4DG0sYNRObGLxud8cW7osw1ZQxfDuTZ8KQiqfZ0QJGcR34CvpTMDXEyo/+Htgg==", "dev": true }, "node_modules/@lezer/cpp": { @@ -930,16 +931,16 @@ } }, "node_modules/@lezer/generator": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@lezer/generator/-/generator-1.2.2.tgz", - "integrity": "sha512-O//eH9jTPM1GnbZruuD23xU68Pkuragonn1DEIom4Kt/eJN/QFt7Vzvp1YjV/XBmoUKC+2ySPgrA5fMF9FMM2g==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@lezer/generator/-/generator-1.5.1.tgz", + "integrity": "sha512-vodJv2JPwsFsiBBHE463yBhvUI9TmhIu5duF/8MH304xNS6FyWH/vTyG61pjhERm5f+VBP94co0eiN+afWcvXw==", "dev": true, "dependencies": { "@lezer/common": "^1.0.2", "@lezer/lr": "^1.3.0" }, "bin": { - "lezer-generator": "dist/lezer-generator.cjs" + "lezer-generator": "src/lezer-generator.cjs" } }, "node_modules/@lezer/highlight": { @@ -1032,9 +1033,9 @@ } }, "node_modules/@lezer/python": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@lezer/python/-/python-1.1.1.tgz", - "integrity": "sha512-ArUGh9kvdaOVu6IkSaYUS9WFQeMAFVWKRuZo6vexnxoeCLnxf0Y9DCFEAMMa7W9SQBGYE55OarSpPqSkdOXSCA==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@lezer/python/-/python-1.1.9.tgz", + "integrity": "sha512-8Ua3p8NdICXR6qWvRCnCx5CI1B0DklZGNtRLwOrIS/OHecHIugRHZyr0NsaaQO2H2Nn34EPlRtltXIirLsry5Q==", "dev": true, "dependencies": { "@lezer/highlight": "^1.0.0", @@ -5148,9 +5149,9 @@ } }, "node_modules/style-mod": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.0.0.tgz", - "integrity": "sha512-OPhtyEjyyN9x3nhPsu76f52yUGXiZcgvsrFVtvTkyGRQJ0XK+GPc6ov1z+lRpbeabka+MYEQxOYRnt5nF30aMw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.0.tgz", + "integrity": "sha512-Ca5ib8HrFn+f+0n4N4ScTIA9iTOQ7MaGS1ylHcoVqW9J7w2w8PzN6g9gKmTYgGEBH8e120+RCmhpje6jC5uGWA==", "dev": true }, "node_modules/sumchecker": { diff --git a/package.json b/package.json index 619fc90..0c50cf2 100644 --- a/package.json +++ b/package.json @@ -26,24 +26,24 @@ "build_grammar": "lezer-generator src/editor/lang-heynote/heynote.grammar -o src/editor/lang-heynote/parser.js" }, "devDependencies": { - "@codemirror/commands": "^6.2.1", + "@codemirror/commands": "^6.3.2", "@codemirror/lang-cpp": "^6.0.2", - "@codemirror/lang-html": "^6.4.0", + "@codemirror/lang-html": "^6.4.7", "@codemirror/lang-java": "^6.0.1", - "@codemirror/lang-javascript": "^6.1.2", + "@codemirror/lang-javascript": "^6.2.1", "@codemirror/lang-json": "^6.0.1", "@codemirror/lang-lezer": "^6.0.1", - "@codemirror/lang-markdown": "^6.0.5", + "@codemirror/lang-markdown": "^6.2.3", "@codemirror/lang-php": "^6.0.1", - "@codemirror/lang-python": "^6.1.1", + "@codemirror/lang-python": "^6.1.3", "@codemirror/lang-rust": "^6.0.1", - "@codemirror/lang-sql": "^6.3.3", + "@codemirror/lang-sql": "^6.5.4", "@codemirror/lang-xml": "^6.0.2", - "@codemirror/language": "^6.4.0", + "@codemirror/language": "^6.9.3", "@codemirror/rangeset": "^0.19.9", - "@codemirror/search": "^6.2.3", + "@codemirror/search": "^6.5.5", "@electron/asar": "^3.2.2", - "@lezer/generator": "^1.2.2", + "@lezer/generator": "^1.5.1", "@rollup/plugin-node-resolve": "^15.0.1", "@vitejs/plugin-vue": "^4.0.0", "codemirror": "^6.0.1", diff --git a/src/editor/emacs.js b/src/editor/emacs.js index b8a4413..9310a04 100644 --- a/src/editor/emacs.js +++ b/src/editor/emacs.js @@ -71,8 +71,8 @@ export function emacsKeymap(editor) { ["ArrowRight", emacsMoveCommand(cursorCharRight, selectCharRight)], ["ArrowUp", emacsMoveCommand(cursorLineUp, selectLineUp)], ["ArrowDown", emacsMoveCommand(cursorLineDown, selectLineDown)], - ["Ctrl-ArrowLeft", emacsMoveCommand(cursorGroupLeft, selectGroupLeft)], - ["Ctrl-ArrowRight", emacsMoveCommand(cursorGroupRight, selectGroupRight)], + {key: "Ctrl-ArrowLeft", run: emacsMoveCommand(cursorGroupLeft, selectGroupLeft), shift: selectGroupLeft}, + {key: "Ctrl-ArrowRight", run: emacsMoveCommand(cursorGroupRight, selectGroupRight), shift: selectGroupRight}, ["Ctrl-d", deleteCharForward], ["Ctrl-h", deleteCharBackward], diff --git a/src/editor/theme/base.js b/src/editor/theme/base.js index 9a81644..45b8012 100644 --- a/src/editor/theme/base.js +++ b/src/editor/theme/base.js @@ -80,6 +80,9 @@ export const heynoteBase = EditorView.theme({ height:'19px !important', marginTop:'-2px !important' }, + '.heynote-blocks-layer': { + width: '100%', + }, '.heynote-blocks-layer .block-even, .heynote-blocks-layer .block-odd': { width: '100%', boxSizing: 'content-box', diff --git a/src/editor/theme/dark.js b/src/editor/theme/dark.js index 4fa5ba8..f0589fd 100644 --- a/src/editor/theme/dark.js +++ b/src/editor/theme/dark.js @@ -30,6 +30,7 @@ const lineNumberColor = 'rgba(255,255,255, 0.15)'; const commentColor = '#888d97'; const matchingBracket = 'rgba(255,255,255,0.1)'; const selection = "#0865a9"; +const selectionBlur = "#225377"; const darkTheme = EditorView.theme({ @@ -41,7 +42,12 @@ const darkTheme = EditorView.theme({ caretColor: cursor, }, '.cm-cursor, .cm-dropCursor': { borderLeftColor: cursor }, - '&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': { backgroundColor: selection }, + '.cm-selectionBackground': { + backgroundColor: selectionBlur, + }, + '&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground': { + backgroundColor: selection, + }, '.cm-panels': { backgroundColor: "#474747", color: "#9c9c9c", diff --git a/src/editor/theme/light.js b/src/editor/theme/light.js index b517344..dfbe3ac 100644 --- a/src/editor/theme/light.js +++ b/src/editor/theme/light.js @@ -2,6 +2,8 @@ import { EditorView } from "@codemirror/view"; import { HighlightStyle, syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language'; import { tags } from '@lezer/highlight'; +const selection = "#77baff8c" +const selectionBlur = "#b2c2ca85" const lightTheme = EditorView.theme({ "&": { @@ -42,10 +44,10 @@ const lightTheme = EditorView.theme({ backgroundColor: "rgba(0,0,0, 0.04)", }, ".cm-selectionBackground": { - background: "#b2c2ca85", + background: selectionBlur, }, - "&.cm-focused .cm-selectionBackground": { - background: "#77baff8c", + "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": { + background: selection, }, ".heynote-blocks-layer .block-even": {