@neo4j-cypher/react-codemirror
Advanced tools
Comparing version 2.0.0-canary-bdfe373 to 2.0.0-canary-be94a87
# @neo4j-cypher/react-codemirror | ||
## 2.0.0-next.19 | ||
### Patch Changes | ||
- a3e3e50: updating themes to use needle colors | ||
- Updated dependencies [68f55d4] | ||
- Updated dependencies [6d00433] | ||
- Updated dependencies [c01b32a] | ||
- @neo4j-cypher/language-support@2.0.0-next.16 | ||
## 2.0.0-next.18 | ||
@@ -4,0 +14,0 @@ |
@@ -171,3 +171,3 @@ import { EditorState, Extension } from '@codemirror/state'; | ||
*/ | ||
format(): void; | ||
format(experimentalVersion?: boolean): void; | ||
/** | ||
@@ -174,0 +174,0 @@ * Focus the editor |
@@ -5,3 +5,3 @@ import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { EditorView, keymap, lineNumbers, placeholder, } from '@codemirror/view'; | ||
import { formatQuery, _internalFeatureFlags, } from '@neo4j-cypher/language-support'; | ||
import { formatQuery, formatQueryExperimental, _internalFeatureFlags, } from '@neo4j-cypher/language-support'; | ||
import debounce from 'lodash.debounce'; | ||
@@ -15,13 +15,20 @@ import { Component, createRef } from 'react'; | ||
import { getThemeExtension } from './themes'; | ||
const format = (view) => { | ||
const doc = view.state.doc.toString(); | ||
const { formattedString, newCursorPos } = formatQuery(doc, view.state.selection.main.anchor); | ||
view.dispatch({ | ||
changes: { | ||
from: 0, | ||
to: doc.length, | ||
insert: formattedString, | ||
}, | ||
selection: { anchor: newCursorPos }, | ||
}); | ||
const format = (view, experimental) => { | ||
try { | ||
const doc = view.state.doc.toString(); | ||
const { formattedString, newCursorPos } = experimental | ||
? formatQueryExperimental(doc, view.state.selection.main.anchor) | ||
: formatQuery(doc, view.state.selection.main.anchor); | ||
view.dispatch({ | ||
changes: { | ||
from: 0, | ||
to: doc.length, | ||
insert: formattedString, | ||
}, | ||
selection: { anchor: newCursorPos }, | ||
}); | ||
} | ||
catch (error) { | ||
// Formatting failed, likely because of a syntax error | ||
} | ||
}; | ||
@@ -109,4 +116,4 @@ const executeKeybinding = (onExecute, newLineOnEnter, flush) => { | ||
*/ | ||
format() { | ||
format(this.editorView.current); | ||
format(experimentalVersion = false) { | ||
format(this.editorView.current, experimentalVersion); | ||
} | ||
@@ -113,0 +120,0 @@ /** |
@@ -60,2 +60,34 @@ export declare const tokens: { | ||
}; | ||
code: { | ||
light: { | ||
comment: string; | ||
keyword: string; | ||
keywordLiteral: string; | ||
operator: string; | ||
label: string; | ||
predicateFunction: string; | ||
function: string; | ||
procedure: string; | ||
stringLiteral: string; | ||
numberLiteral: string; | ||
booleanLiteral: string; | ||
paramValue: string; | ||
property: string; | ||
}; | ||
dark: { | ||
comment: string; | ||
keyword: string; | ||
keywordLiteral: string; | ||
operator: string; | ||
label: string; | ||
predicateFunction: string; | ||
function: string; | ||
procedure: string; | ||
stringLiteral: string; | ||
numberLiteral: string; | ||
booleanLiteral: string; | ||
paramValue: string; | ||
property: string; | ||
}; | ||
}; | ||
graph: { | ||
@@ -62,0 +94,0 @@ '1': string; |
@@ -60,2 +60,34 @@ export const tokens = { | ||
}, | ||
code: { | ||
light: { | ||
comment: '#5E636A', | ||
keyword: '#3F7824', | ||
keywordLiteral: '#3F7824', | ||
operator: '#3F7824', | ||
label: '#D43300', | ||
predicateFunction: '#0A6190', | ||
function: '#0A6190', | ||
procedure: '#0A6190', | ||
stringLiteral: '#986400', | ||
numberLiteral: '#754EC8', | ||
booleanLiteral: '#754EC8', | ||
paramValue: '#754EC8', | ||
property: '#730E00', | ||
}, | ||
dark: { | ||
comment: '#959AA1', | ||
keyword: '#FFC450', | ||
keywordLiteral: '#FFC450', | ||
operator: '#FFC450', | ||
label: '#F96746', | ||
predicateFunction: '#8FE3E8', | ||
function: '#8FE3E8', | ||
procedure: '#8FE3E8', | ||
stringLiteral: '#90CB62', | ||
numberLiteral: '#CCB4FF', | ||
booleanLiteral: '#CCB4FF', | ||
paramValue: '#CCB4FF', | ||
property: '#FFAA97', | ||
}, | ||
}, | ||
graph: { | ||
@@ -62,0 +94,0 @@ '1': '#FFDF81', |
@@ -1,2 +0,1 @@ | ||
import { mirage } from 'ayu'; | ||
import { createCypherTheme, } from './lang-cypher/createCypherTheme'; | ||
@@ -25,15 +24,15 @@ import { tokens } from './ndlTokensCopy'; | ||
highlightStyles: { | ||
comment: '#a3a7ae', | ||
keyword: '#008561', | ||
keywordLiteral: '#008561', | ||
label: '#de064e', | ||
predicateFunction: '#0177b8', | ||
function: '#0177b8', | ||
procedure: '#0177b8', | ||
stringLiteral: '#8c6b41', | ||
numberLiteral: '#9a4fcb', | ||
booleanLiteral: '#9a4fcb', | ||
operator: '#008561', | ||
property: '#0055ae', | ||
paramValue: '#9a4fcb', | ||
comment: tokens.palette.code.light.comment, | ||
keyword: tokens.palette.code.light.keyword, | ||
keywordLiteral: tokens.palette.code.light.keywordLiteral, | ||
label: tokens.palette.code.light.label, | ||
predicateFunction: tokens.palette.code.light.predicateFunction, | ||
function: tokens.palette.code.light.function, | ||
procedure: tokens.palette.code.light.procedure, | ||
stringLiteral: tokens.palette.code.light.stringLiteral, | ||
numberLiteral: tokens.palette.code.light.numberLiteral, | ||
booleanLiteral: tokens.palette.code.light.booleanLiteral, | ||
operator: tokens.palette.code.light.operator, | ||
property: tokens.palette.code.light.property, | ||
paramValue: tokens.palette.code.light.paramValue, | ||
}, | ||
@@ -44,8 +43,8 @@ }; | ||
editorSettings: { | ||
background: mirage.editor.bg.hex(), | ||
foreground: mirage.editor.fg.hex(), | ||
gutterForeground: mirage.editor.gutter.normal.hex(), | ||
selection: mirage.editor.selection.active.hex(), | ||
textMatchingSelection: mirage.editor.findMatch.active.hex(), | ||
cursor: '#ffffff', | ||
background: '#242936', | ||
foreground: '#cccac2', | ||
gutterForeground: '#8a919966', | ||
selection: '#409fff40', | ||
textMatchingSelection: '#695380', | ||
cursor: tokens.colors.neutral['10'], | ||
autoCompletionPanel: { | ||
@@ -63,18 +62,15 @@ selectedColor: '#062f4a', | ||
highlightStyles: { | ||
comment: mirage.syntax.comment.hex(), | ||
keyword: mirage.syntax.keyword.hex(), | ||
keywordLiteral: mirage.syntax.keyword.hex(), | ||
label: mirage.syntax.markup.hex(), | ||
predicateFunction: mirage.syntax.func.hex(), | ||
function: mirage.syntax.func.hex(), | ||
procedure: mirage.syntax.func.hex(), | ||
stringLiteral: mirage.syntax.string.hex(), | ||
numberLiteral: mirage.syntax.constant.hex(), | ||
booleanLiteral: mirage.syntax.constant.hex(), | ||
operator: mirage.syntax.operator.hex(), | ||
property: mirage.syntax.tag.hex(), | ||
paramDollar: mirage.syntax.regexp.hex(), | ||
paramValue: mirage.syntax.regexp.hex(), | ||
namespace: mirage.syntax.special.hex(), | ||
consoleCommand: mirage.editor.fg.hex(), | ||
comment: tokens.palette.code.dark.comment, | ||
keyword: tokens.palette.code.dark.keyword, | ||
keywordLiteral: tokens.palette.code.dark.keywordLiteral, | ||
label: tokens.palette.code.dark.label, | ||
predicateFunction: tokens.palette.code.dark.predicateFunction, | ||
function: tokens.palette.code.dark.function, | ||
procedure: tokens.palette.code.dark.procedure, | ||
stringLiteral: tokens.palette.code.dark.stringLiteral, | ||
numberLiteral: tokens.palette.code.dark.numberLiteral, | ||
booleanLiteral: tokens.palette.code.dark.booleanLiteral, | ||
operator: tokens.palette.code.dark.operator, | ||
property: tokens.palette.code.dark.property, | ||
paramValue: tokens.palette.code.dark.paramValue, | ||
}, | ||
@@ -81,0 +77,0 @@ }; |
@@ -20,3 +20,3 @@ { | ||
], | ||
"version": "2.0.0-canary-bdfe373", | ||
"version": "2.0.0-canary-be94a87", | ||
"main": "./dist/index.js", | ||
@@ -55,6 +55,5 @@ "types": "./dist/index.d.ts", | ||
"@lezer/highlight": "^1.1.3", | ||
"@neo4j-cypher/language-support": "2.0.0-canary-bdfe373", | ||
"@neo4j-cypher/language-support": "2.0.0-canary-be94a87", | ||
"@types/prismjs": "^1.26.3", | ||
"@types/workerpool": "^6.4.7", | ||
"ayu": "^8.0.1", | ||
"fastest-levenshtein": "^1.0.16", | ||
@@ -67,3 +66,3 @@ "lodash.debounce": "^4.0.8", | ||
"devDependencies": { | ||
"@neo4j-ndl/base": "^3.0.10", | ||
"@neo4j-ndl/base": "^3.2.10", | ||
"@playwright/experimental-ct-react": "^1.45.3", | ||
@@ -70,0 +69,0 @@ "@playwright/test": "^1.45.3", |
@@ -60,2 +60,34 @@ export const tokens = { | ||
}, | ||
code: { | ||
light: { | ||
comment: '#5E636A', | ||
keyword: '#3F7824', | ||
keywordLiteral: '#3F7824', | ||
operator: '#3F7824', | ||
label: '#D43300', | ||
predicateFunction: '#0A6190', | ||
function: '#0A6190', | ||
procedure: '#0A6190', | ||
stringLiteral: '#986400', | ||
numberLiteral: '#754EC8', | ||
booleanLiteral: '#754EC8', | ||
paramValue: '#754EC8', | ||
property: '#730E00', | ||
}, | ||
dark: { | ||
comment: '#959AA1', | ||
keyword: '#FFC450', | ||
keywordLiteral: '#FFC450', | ||
operator: '#FFC450', | ||
label: '#F96746', | ||
predicateFunction: '#8FE3E8', | ||
function: '#8FE3E8', | ||
procedure: '#8FE3E8', | ||
stringLiteral: '#90CB62', | ||
numberLiteral: '#CCB4FF', | ||
booleanLiteral: '#CCB4FF', | ||
paramValue: '#CCB4FF', | ||
property: '#FFAA97', | ||
}, | ||
}, | ||
graph: { | ||
@@ -62,0 +94,0 @@ '1': '#FFDF81', |
import { Extension } from '@codemirror/state'; | ||
import { mirage } from 'ayu'; | ||
import { | ||
@@ -30,15 +29,15 @@ createCypherTheme, | ||
highlightStyles: { | ||
comment: '#a3a7ae', | ||
keyword: '#008561', | ||
keywordLiteral: '#008561', | ||
label: '#de064e', | ||
predicateFunction: '#0177b8', | ||
function: '#0177b8', | ||
procedure: '#0177b8', | ||
stringLiteral: '#8c6b41', | ||
numberLiteral: '#9a4fcb', | ||
booleanLiteral: '#9a4fcb', | ||
operator: '#008561', | ||
property: '#0055ae', | ||
paramValue: '#9a4fcb', | ||
comment: tokens.palette.code.light.comment, | ||
keyword: tokens.palette.code.light.keyword, | ||
keywordLiteral: tokens.palette.code.light.keywordLiteral, | ||
label: tokens.palette.code.light.label, | ||
predicateFunction: tokens.palette.code.light.predicateFunction, | ||
function: tokens.palette.code.light.function, | ||
procedure: tokens.palette.code.light.procedure, | ||
stringLiteral: tokens.palette.code.light.stringLiteral, | ||
numberLiteral: tokens.palette.code.light.numberLiteral, | ||
booleanLiteral: tokens.palette.code.light.booleanLiteral, | ||
operator: tokens.palette.code.light.operator, | ||
property: tokens.palette.code.light.property, | ||
paramValue: tokens.palette.code.light.paramValue, | ||
}, | ||
@@ -50,8 +49,8 @@ }; | ||
editorSettings: { | ||
background: mirage.editor.bg.hex(), | ||
foreground: mirage.editor.fg.hex(), | ||
gutterForeground: mirage.editor.gutter.normal.hex(), | ||
selection: mirage.editor.selection.active.hex(), | ||
textMatchingSelection: mirage.editor.findMatch.active.hex(), | ||
cursor: '#ffffff', | ||
background: '#242936', | ||
foreground: '#cccac2', | ||
gutterForeground: '#8a919966', | ||
selection: '#409fff40', | ||
textMatchingSelection: '#695380', | ||
cursor: tokens.colors.neutral['10'], | ||
autoCompletionPanel: { | ||
@@ -69,18 +68,15 @@ selectedColor: '#062f4a', | ||
highlightStyles: { | ||
comment: mirage.syntax.comment.hex(), | ||
keyword: mirage.syntax.keyword.hex(), | ||
keywordLiteral: mirage.syntax.keyword.hex(), | ||
label: mirage.syntax.markup.hex(), | ||
predicateFunction: mirage.syntax.func.hex(), | ||
function: mirage.syntax.func.hex(), | ||
procedure: mirage.syntax.func.hex(), | ||
stringLiteral: mirage.syntax.string.hex(), | ||
numberLiteral: mirage.syntax.constant.hex(), | ||
booleanLiteral: mirage.syntax.constant.hex(), | ||
operator: mirage.syntax.operator.hex(), | ||
property: mirage.syntax.tag.hex(), | ||
paramDollar: mirage.syntax.regexp.hex(), | ||
paramValue: mirage.syntax.regexp.hex(), | ||
namespace: mirage.syntax.special.hex(), | ||
consoleCommand: mirage.editor.fg.hex(), | ||
comment: tokens.palette.code.dark.comment, | ||
keyword: tokens.palette.code.dark.keyword, | ||
keywordLiteral: tokens.palette.code.dark.keywordLiteral, | ||
label: tokens.palette.code.dark.label, | ||
predicateFunction: tokens.palette.code.dark.predicateFunction, | ||
function: tokens.palette.code.dark.function, | ||
procedure: tokens.palette.code.dark.procedure, | ||
stringLiteral: tokens.palette.code.dark.stringLiteral, | ||
numberLiteral: tokens.palette.code.dark.numberLiteral, | ||
booleanLiteral: tokens.palette.code.dark.booleanLiteral, | ||
operator: tokens.palette.code.dark.operator, | ||
property: tokens.palette.code.dark.property, | ||
paramValue: tokens.palette.code.dark.paramValue, | ||
}, | ||
@@ -87,0 +83,0 @@ }; |
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
718812
18
9927
+ Added@neo4j-cypher/language-support@2.0.0-canary-be94a87(transitive)
+ Addedheap-js@2.6.0(transitive)
- Removedayu@^8.0.1
- Removed@neo4j-cypher/language-support@2.0.0-canary-bdfe373(transitive)
- Removed@types/chroma-js@2.4.5(transitive)
- Removedayu@8.0.1(transitive)
- Removedchroma-js@2.6.0(transitive)
- Removednonenumerable@1.1.1(transitive)