@neo4j-cypher/react-codemirror 2.0.0-next.1 → 2.0.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +4 -1
  3. package/dist/{types/CypherEditor.d.ts → CypherEditor.d.ts} +69 -8
  4. package/dist/CypherEditor.js +300 -0
  5. package/dist/CypherEditor.js.map +1 -0
  6. package/dist/CypherEditor.test.js +151 -0
  7. package/dist/CypherEditor.test.js.map +1 -0
  8. package/dist/constants.d.ts +1 -0
  9. package/dist/constants.js +2 -0
  10. package/dist/constants.js.map +1 -0
  11. package/dist/e2e_tests/autoCompletion.spec.js +267 -0
  12. package/dist/e2e_tests/autoCompletion.spec.js.map +1 -0
  13. package/dist/e2e_tests/configuration.spec.js +83 -0
  14. package/dist/e2e_tests/configuration.spec.js.map +1 -0
  15. package/dist/e2e_tests/debounce.spec.js +65 -0
  16. package/dist/e2e_tests/debounce.spec.js.map +1 -0
  17. package/dist/e2e_tests/e2eUtils.js +60 -0
  18. package/dist/e2e_tests/e2eUtils.js.map +1 -0
  19. package/dist/e2e_tests/extraKeybindings.spec.js +43 -0
  20. package/dist/e2e_tests/extraKeybindings.spec.js.map +1 -0
  21. package/dist/e2e_tests/historyNavigation.spec.js +227 -0
  22. package/dist/e2e_tests/historyNavigation.spec.js.map +1 -0
  23. package/dist/e2e_tests/performanceTest.spec.d.ts +6 -0
  24. package/dist/e2e_tests/performanceTest.spec.js +96 -0
  25. package/dist/e2e_tests/performanceTest.spec.js.map +1 -0
  26. package/dist/e2e_tests/sanityChecks.spec.js +53 -0
  27. package/dist/e2e_tests/sanityChecks.spec.js.map +1 -0
  28. package/dist/e2e_tests/signatureHelp.spec.js +179 -0
  29. package/dist/e2e_tests/signatureHelp.spec.js.map +1 -0
  30. package/dist/e2e_tests/snippets.spec.js +62 -0
  31. package/dist/e2e_tests/snippets.spec.js.map +1 -0
  32. package/dist/e2e_tests/syntaxHighlighting.spec.d.ts +1 -0
  33. package/dist/e2e_tests/syntaxHighlighting.spec.js +90 -0
  34. package/dist/e2e_tests/syntaxHighlighting.spec.js.map +1 -0
  35. package/dist/e2e_tests/syntaxValidation.spec.d.ts +1 -0
  36. package/dist/e2e_tests/syntaxValidation.spec.js +79 -0
  37. package/dist/e2e_tests/syntaxValidation.spec.js.map +1 -0
  38. package/dist/historyNavigation.d.ts +7 -0
  39. package/dist/historyNavigation.js +163 -0
  40. package/dist/historyNavigation.js.map +1 -0
  41. package/dist/{types/icons.d.ts → icons.d.ts} +1 -1
  42. package/dist/icons.js +62 -0
  43. package/dist/icons.js.map +1 -0
  44. package/dist/index.d.ts +4 -0
  45. package/dist/index.js +5 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/lang-cypher/autocomplete.d.ts +6 -0
  48. package/dist/lang-cypher/autocomplete.js +124 -0
  49. package/dist/lang-cypher/autocomplete.js.map +1 -0
  50. package/dist/{types/lang-cypher → lang-cypher}/constants.d.ts +9 -0
  51. package/dist/lang-cypher/constants.js +65 -0
  52. package/dist/lang-cypher/constants.js.map +1 -0
  53. package/dist/lang-cypher/contants.test.d.ts +1 -0
  54. package/dist/lang-cypher/contants.test.js +103 -0
  55. package/dist/lang-cypher/contants.test.js.map +1 -0
  56. package/dist/lang-cypher/createCypherTheme.js +179 -0
  57. package/dist/lang-cypher/createCypherTheme.js.map +1 -0
  58. package/dist/lang-cypher/langCypher.d.ts +14 -0
  59. package/dist/lang-cypher/langCypher.js +30 -0
  60. package/dist/lang-cypher/langCypher.js.map +1 -0
  61. package/dist/lang-cypher/lintWorker.d.ts +8 -0
  62. package/dist/lang-cypher/lintWorker.js +4 -0
  63. package/dist/lang-cypher/lintWorker.js.map +1 -0
  64. package/dist/lang-cypher/parser-adapter.d.ts +19 -0
  65. package/dist/lang-cypher/parser-adapter.js +113 -0
  66. package/dist/lang-cypher/parser-adapter.js.map +1 -0
  67. package/dist/lang-cypher/signatureHelp.d.ts +4 -0
  68. package/dist/lang-cypher/signatureHelp.js +94 -0
  69. package/dist/lang-cypher/signatureHelp.js.map +1 -0
  70. package/dist/lang-cypher/syntaxValidation.d.ts +5 -0
  71. package/dist/lang-cypher/syntaxValidation.js +69 -0
  72. package/dist/lang-cypher/syntaxValidation.js.map +1 -0
  73. package/dist/lang-cypher/themeIcons.js +22 -0
  74. package/dist/lang-cypher/themeIcons.js.map +1 -0
  75. package/dist/lang-cypher/utils.d.ts +2 -0
  76. package/dist/lang-cypher/utils.js +10 -0
  77. package/dist/lang-cypher/utils.js.map +1 -0
  78. package/dist/ndlTokensCopy.js +380 -0
  79. package/dist/ndlTokensCopy.js.map +1 -0
  80. package/dist/ndlTokensCopy.test.d.ts +1 -0
  81. package/dist/ndlTokensCopy.test.js +12 -0
  82. package/dist/ndlTokensCopy.test.js.map +1 -0
  83. package/dist/neo4jSetup.js +120 -0
  84. package/dist/neo4jSetup.js.map +1 -0
  85. package/dist/{types/themes.d.ts → themes.d.ts} +1 -1
  86. package/dist/themes.js +114 -0
  87. package/dist/themes.js.map +1 -0
  88. package/dist/tsconfig.tsbuildinfo +1 -0
  89. package/package.json +30 -31
  90. package/src/CypherEditor.test.tsx +200 -0
  91. package/src/CypherEditor.tsx +292 -41
  92. package/src/constants.ts +1 -0
  93. package/src/e2e_tests/autoCompletion.spec.tsx +472 -0
  94. package/src/e2e_tests/configuration.spec.tsx +111 -0
  95. package/src/e2e_tests/debounce.spec.tsx +101 -0
  96. package/src/e2e_tests/{e2e-utils.ts → e2eUtils.ts} +11 -1
  97. package/src/e2e_tests/{extra-keybindings.spec.tsx → extraKeybindings.spec.tsx} +1 -3
  98. package/src/e2e_tests/historyNavigation.spec.tsx +315 -0
  99. package/src/e2e_tests/performanceTest.spec.tsx +158 -0
  100. package/src/e2e_tests/{sanity-checks.spec.tsx → sanityChecks.spec.tsx} +7 -22
  101. package/src/e2e_tests/signatureHelp.spec.tsx +380 -0
  102. package/src/e2e_tests/snippets.spec.tsx +92 -0
  103. package/src/e2e_tests/{syntax-highlighting.spec.tsx → syntaxHighlighting.spec.tsx} +1 -3
  104. package/src/e2e_tests/{syntax-validation.spec.tsx → syntaxValidation.spec.tsx} +6 -7
  105. package/src/{repl-mode.ts → historyNavigation.ts} +7 -30
  106. package/src/icons.ts +3 -0
  107. package/src/index.ts +5 -2
  108. package/src/lang-cypher/autocomplete.ts +107 -15
  109. package/src/lang-cypher/constants.ts +23 -0
  110. package/src/lang-cypher/contants.test.ts +6 -2
  111. package/src/lang-cypher/{create-cypher-theme.ts → createCypherTheme.ts} +41 -2
  112. package/src/lang-cypher/langCypher.ts +53 -0
  113. package/src/lang-cypher/lintWorker.ts +14 -0
  114. package/src/lang-cypher/parser-adapter.ts +145 -0
  115. package/src/lang-cypher/signatureHelp.ts +133 -0
  116. package/src/lang-cypher/syntaxValidation.ts +96 -0
  117. package/src/lang-cypher/utils.ts +9 -0
  118. package/src/{ndl-tokens-copy.test.ts → ndlTokensCopy.test.ts} +2 -1
  119. package/src/{neo4j-setup.tsx → neo4jSetup.tsx} +51 -1
  120. package/src/themes.ts +4 -2
  121. package/src/viteEnv.d.ts +1 -0
  122. package/dist/cjs/index.cjs +0 -1443
  123. package/dist/cjs/index.cjs.map +0 -7
  124. package/dist/esm/index.mjs +0 -1466
  125. package/dist/esm/index.mjs.map +0 -7
  126. package/dist/types/e2e_tests/mock-data.d.ts +0 -3779
  127. package/dist/types/index.d.ts +0 -4
  128. package/dist/types/lang-cypher/ParserAdapter.d.ts +0 -14
  129. package/dist/types/lang-cypher/autocomplete.d.ts +0 -3
  130. package/dist/types/lang-cypher/lang-cypher.d.ts +0 -7
  131. package/dist/types/lang-cypher/syntax-validation.d.ts +0 -3
  132. package/dist/types/repl-mode.d.ts +0 -8
  133. package/dist/types/tsconfig.tsbuildinfo +0 -1
  134. package/src/e2e_tests/auto-completion.spec.tsx +0 -232
  135. package/src/e2e_tests/history-navigation.spec.tsx +0 -144
  136. package/src/e2e_tests/mock-data.ts +0 -4310
  137. package/src/e2e_tests/performance-test.spec.tsx +0 -71
  138. package/src/lang-cypher/ParserAdapter.ts +0 -92
  139. package/src/lang-cypher/lang-cypher.ts +0 -32
  140. package/src/lang-cypher/syntax-validation.ts +0 -24
  141. /package/dist/{types/e2e_tests/auto-completion.spec.d.ts → CypherEditor.test.d.ts} +0 -0
  142. /package/dist/{types/e2e_tests/extra-keybindings.spec.d.ts → e2e_tests/autoCompletion.spec.d.ts} +0 -0
  143. /package/dist/{types/e2e_tests/history-navigation.spec.d.ts → e2e_tests/configuration.spec.d.ts} +0 -0
  144. /package/dist/{types/e2e_tests/performance-test.spec.d.ts → e2e_tests/debounce.spec.d.ts} +0 -0
  145. /package/dist/{types/e2e_tests/e2e-utils.d.ts → e2e_tests/e2eUtils.d.ts} +0 -0
  146. /package/dist/{types/e2e_tests/sanity-checks.spec.d.ts → e2e_tests/extraKeybindings.spec.d.ts} +0 -0
  147. /package/dist/{types/e2e_tests/syntax-highlighting.spec.d.ts → e2e_tests/historyNavigation.spec.d.ts} +0 -0
  148. /package/dist/{types/e2e_tests/syntax-validation.spec.d.ts → e2e_tests/sanityChecks.spec.d.ts} +0 -0
  149. /package/dist/{types/lang-cypher/contants.test.d.ts → e2e_tests/signatureHelp.spec.d.ts} +0 -0
  150. /package/dist/{types/ndl-tokens-copy.test.d.ts → e2e_tests/snippets.spec.d.ts} +0 -0
  151. /package/dist/{types/lang-cypher/create-cypher-theme.d.ts → lang-cypher/createCypherTheme.d.ts} +0 -0
  152. /package/dist/{types/lang-cypher/theme-icons.d.ts → lang-cypher/themeIcons.d.ts} +0 -0
  153. /package/dist/{types/ndl-tokens-copy.d.ts → ndlTokensCopy.d.ts} +0 -0
  154. /package/dist/{types/neo4j-setup.d.ts → neo4jSetup.d.ts} +0 -0
  155. /package/src/lang-cypher/{theme-icons.ts → themeIcons.ts} +0 -0
  156. /package/src/{ndl-tokens-copy.ts → ndlTokensCopy.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,84 @@
1
1
  # @neo4j-cypher/react-codemirror
2
2
 
3
+ ## 2.0.0-next.10
4
+
5
+ ### Patch Changes
6
+
7
+ - bb7e9d3: Simplify detection and handling of value prop updates
8
+
9
+ ## 2.0.0-next.9
10
+
11
+ ### Patch Changes
12
+
13
+ - fbd5f7e: allow signature help panel to render below editor when there's not enough space above it
14
+ - 09dfae2: Add an ariaLabel prop to CypherEditor
15
+ - 7154e94: Fix bug causing debouncing to override value
16
+ - 62c152f: execute single line query on enter by default
17
+ - cbfc75e: Fix a bug causing debounced value updates to get cancelled erroneously
18
+ - 04ae35e: Set initial latestDispatchedValue and flush debounced changes onExecute
19
+ Add tests for debounce behaviour
20
+ - Updated dependencies [3661e9d]
21
+ - Updated dependencies [b76af58]
22
+ - Updated dependencies [21699b7]
23
+ - Updated dependencies [6afc0e3]
24
+ - Updated dependencies [39b924d]
25
+ - @neo4j-cypher/language-support@2.0.0-next.7
26
+
27
+ ## 2.0.0-next.8
28
+
29
+ ### Patch Changes
30
+
31
+ - 6cc9022: Adds more props to the CypherEditor component
32
+ - Updated dependencies [e92d8c7]
33
+ - @neo4j-cypher/language-support@2.0.0-next.6
34
+
35
+ ## 2.0.0-next.7
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [1f790d0]
40
+ - @neo4j-cypher/language-support@2.0.0-next.5
41
+
42
+ ## 2.0.0-next.6
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies
47
+ - @neo4j-cypher/language-support@2.0.0-next.4
48
+
49
+ ## 2.0.0-next.5
50
+
51
+ ### Patch Changes
52
+
53
+ - 8cc77c6: Add support for console commands
54
+ - 1e210cb: Moves semantic analysis to a separate worker file
55
+ - Updated dependencies [8cc77c6]
56
+ - Updated dependencies [1e210cb]
57
+ - Updated dependencies [f6d20b2]
58
+ - @neo4j-cypher/language-support@2.0.0-next.3
59
+
60
+ ## 2.0.0-next.4
61
+
62
+ ### Patch Changes
63
+
64
+ - 8de605b: Improved history prop change detection
65
+ - Updated dependencies [17909e3]
66
+ - @neo4j-cypher/language-support@2.0.0-next.2
67
+
68
+ ## 2.0.0-next.3
69
+
70
+ ### Patch Changes
71
+
72
+ - Updated dependencies [a790700]
73
+ - Updated dependencies [08db455]
74
+ - @neo4j-cypher/language-support@2.0.0-next.1
75
+
76
+ ## 2.0.0-next.2
77
+
78
+ ### Patch Changes
79
+
80
+ - 3866e43: Editor history is now a controlled prop
81
+
3
82
  ## 2.0.0-next.1
4
83
 
5
84
  ### Patch Changes
package/README.md CHANGED
@@ -4,7 +4,7 @@ This package can be built with `npm run build` and then published to npm with `n
4
4
 
5
5
  ## Usage
6
6
 
7
- `npm install @neo4j-cypher/reactcodemirror`
7
+ `npm install @neo4j-cypher/react-codemirror@next`
8
8
 
9
9
  ```tsx
10
10
  import { useState } from 'react';
@@ -26,6 +26,9 @@ For a full example, see the [react-codemirror-playground](https://github.com/neo
26
26
 
27
27
  Currently we only support using the codemirror editor via the react wrapper, but we plan to release the codemirror extensions separately as well.
28
28
 
29
+ ## Learning codemirror
30
+ It can take a little time to get into the CodeMirror6 ways of thinking, Trevor Harmon has a [great blog post](https://thetrevorharmon.com/blog/learning-codemirror/) explaining the cm6 "primitives". He also has a demo on how to integrate ANTLR4 with codemirror over [here](https://github.com/thetrevorharmon/zephyr-demo).
31
+
29
32
  ### Completion Icons
30
33
 
31
34
  We use unmodified copies of Visual Studio Code Icons from microsofts repository [here](https://github.com/microsoft/vscode-icons) licensed under creative commons.
@@ -1,7 +1,8 @@
1
1
  import { EditorState, Extension } from '@codemirror/state';
2
2
  import { EditorView, KeyBinding, ViewUpdate } from '@codemirror/view';
3
- import type { DbSchema } from '@neo4j-cypher/language-support';
3
+ import { type DbSchema } from '@neo4j-cypher/language-support';
4
4
  import { Component } from 'react';
5
+ type DomEventHandlers = Parameters<typeof EditorView.domEventHandlers>[0];
5
6
  export interface CypherEditorProps {
6
7
  /**
7
8
  * The prompt to show on single line editors
@@ -21,15 +22,17 @@ export interface CypherEditorProps {
21
22
  */
22
23
  onExecute?: (cmd: string) => void;
23
24
  /**
24
- * Seed the editor history with some initial history entries
25
- * Navigateable via up/down arrow keys
25
+ * If true, pressing enter will add a new line to the editor and cmd/ctrl + enter will execute the query.
26
+ * Otherwise pressing enter on a single line will execute the query.
27
+ *
28
+ * @default false
26
29
  */
27
- initialHistory?: string[];
30
+ newLineOnEnter?: boolean;
28
31
  /**
29
- * Callback when a new history entry is added, useful for keeping track of history
30
- * outside of the editor.
32
+ * The editor history navigable via up/down arrow keys. Order newest to oldest.
33
+ * Add to this list with the `onExecute` callback for REPL style history.
31
34
  */
32
- onNewHistoryEntry?: (historyEntry: string) => void;
35
+ history?: string[];
33
36
  /**
34
37
  * When set to `true` the editor will use the background color of the parent element.
35
38
  *
@@ -43,6 +46,10 @@ export interface CypherEditorProps {
43
46
  * @default false
44
47
  */
45
48
  autofocus?: boolean;
49
+ /**
50
+ * Where to place the cursor in the query. Cannot be enabled at the same time than autofocus
51
+ */
52
+ offset?: number;
46
53
  /**
47
54
  * Whether the editor should wrap lines.
48
55
  *
@@ -55,6 +62,21 @@ export interface CypherEditorProps {
55
62
  * @default true
56
63
  */
57
64
  lint?: boolean;
65
+ /**
66
+ * Whether the signature help tooltip should be shown below the text.
67
+ * If false, it will be shown above.
68
+ *
69
+ * @default true
70
+ */
71
+ showSignatureTooltipBelow?: boolean;
72
+ /**
73
+ * Internal feature flags for the editor. Don't use in production
74
+ *
75
+ */
76
+ featureFlags?: {
77
+ consoleCommands?: boolean;
78
+ signatureInfoOnAutoCompletions?: boolean;
79
+ };
58
80
  /**
59
81
  * The schema to use for autocompletion and linting.
60
82
  *
@@ -82,8 +104,45 @@ export interface CypherEditorProps {
82
104
  * @param {ViewUpdate} viewUpdate - the view update from codemirror
83
105
  */
84
106
  onChange?(value: string, viewUpdate: ViewUpdate): void;
107
+ /**
108
+ * Map of event handlers to add to the editor.
109
+ *
110
+ * Note that the props are compared by reference, meaning object defined inline
111
+ * will cause the editor to re-render (much like the style prop does in this example:
112
+ * <div style={{}} />
113
+ *
114
+ * Memoize the object if you want/need to avoid this.
115
+ *
116
+ * @example
117
+ * // listen to blur events
118
+ * <CypherEditor domEventHandlers={{blur: () => console.log("blur event fired")}} />
119
+ */
120
+ domEventHandlers?: DomEventHandlers;
121
+ /**
122
+ * Placeholder text to display when the editor is empty.
123
+ */
124
+ placeholder?: string;
125
+ /**
126
+ * Whether the editor should show line numbers.
127
+ *
128
+ * @default true
129
+ */
130
+ lineNumbers?: boolean;
131
+ /**
132
+ * Whether the editor is read-only.
133
+ *
134
+ * @default false
135
+ */
136
+ readonly?: boolean;
137
+ /**
138
+ * String value to assign to the aria-label attribute of the editor
139
+ */
140
+ ariaLabel?: string;
85
141
  }
86
- export declare class CypherEditor extends Component<CypherEditorProps> {
142
+ type CypherEditorState = {
143
+ cypherSupportEnabled: boolean;
144
+ };
145
+ export declare class CypherEditor extends Component<CypherEditorProps, CypherEditorState> {
87
146
  /**
88
147
  * The codemirror editor container.
89
148
  */
@@ -111,8 +170,10 @@ export declare class CypherEditor extends Component<CypherEditorProps> {
111
170
  */
112
171
  setValueAndFocus(value?: string): void;
113
172
  static defaultProps: CypherEditorProps;
173
+ private debouncedOnChange;
114
174
  componentDidMount(): void;
115
175
  componentDidUpdate(prevProps: CypherEditorProps): void;
116
176
  componentWillUnmount(): void;
117
177
  render(): React.ReactNode;
118
178
  }
179
+ export {};
@@ -0,0 +1,300 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { insertNewline } from '@codemirror/commands';
3
+ import { Annotation, Compartment, EditorState, } from '@codemirror/state';
4
+ import { EditorView, keymap, lineNumbers, placeholder, } from '@codemirror/view';
5
+ import debounce from 'lodash.debounce';
6
+ import { Component, createRef } from 'react';
7
+ import { DEBOUNCE_TIME } from './constants';
8
+ import { replaceHistory, replMode as historyNavigation, } from './historyNavigation';
9
+ import { cypher } from './lang-cypher/langCypher';
10
+ import { cleanupWorkers } from './lang-cypher/syntaxValidation';
11
+ import { basicNeo4jSetup } from './neo4jSetup';
12
+ import { getThemeExtension } from './themes';
13
+ const executeKeybinding = (onExecute, newLineOnEnter, flush) => {
14
+ const keybindings = {
15
+ 'Shift-Enter': {
16
+ key: 'Shift-Enter',
17
+ run: insertNewline,
18
+ },
19
+ 'Ctrl-Enter': {
20
+ key: 'Ctrl-Enter',
21
+ run: () => true,
22
+ },
23
+ Enter: {
24
+ key: 'Enter',
25
+ run: insertNewline,
26
+ },
27
+ };
28
+ if (onExecute) {
29
+ keybindings['Ctrl-Enter'] = {
30
+ key: 'Ctrl-Enter',
31
+ mac: 'Mod-Enter',
32
+ preventDefault: true,
33
+ run: (view) => {
34
+ const doc = view.state.doc.toString();
35
+ if (doc.trim() !== '') {
36
+ flush?.();
37
+ onExecute(doc);
38
+ }
39
+ return true;
40
+ },
41
+ };
42
+ if (!newLineOnEnter) {
43
+ keybindings['Enter'] = {
44
+ key: 'Enter',
45
+ preventDefault: true,
46
+ run: (view) => {
47
+ const doc = view.state.doc.toString();
48
+ if (doc.includes('\n')) {
49
+ // Returning false means the event will mark the event
50
+ // as not handled and the default behavior will be executed
51
+ return false;
52
+ }
53
+ if (doc.trim() !== '') {
54
+ flush?.();
55
+ onExecute(doc);
56
+ }
57
+ return true;
58
+ },
59
+ };
60
+ }
61
+ }
62
+ return Object.values(keybindings);
63
+ };
64
+ const themeCompartment = new Compartment();
65
+ const keyBindingCompartment = new Compartment();
66
+ const lineNumbersCompartment = new Compartment();
67
+ const readOnlyCompartment = new Compartment();
68
+ const placeholderCompartment = new Compartment();
69
+ const domEventHandlerCompartment = new Compartment();
70
+ const formatLineNumber = (prompt) => (a, state) => {
71
+ if (state.doc.lines === 1 && prompt !== undefined) {
72
+ return prompt;
73
+ }
74
+ return a.toString();
75
+ };
76
+ const ExternalEdit = Annotation.define();
77
+ export class CypherEditor extends Component {
78
+ /**
79
+ * The codemirror editor container.
80
+ */
81
+ editorContainer = createRef();
82
+ /**
83
+ * The codemirror editor state.
84
+ */
85
+ editorState = createRef();
86
+ /**
87
+ * The codemirror editor view.
88
+ */
89
+ editorView = createRef();
90
+ schemaRef = createRef();
91
+ /**
92
+ * Focus the editor
93
+ */
94
+ focus() {
95
+ this.editorView.current?.focus();
96
+ }
97
+ /**
98
+ * Move the cursor to the supplied position.
99
+ * For example, to move the cursor to the end of the editor, use `value.length`
100
+ */
101
+ updateCursorPosition(position) {
102
+ this.editorView.current?.dispatch({
103
+ selection: { anchor: position, head: position },
104
+ });
105
+ }
106
+ /**
107
+ * Externally set the editor value and focus the editor.
108
+ */
109
+ setValueAndFocus(value = '') {
110
+ const currentCmValue = this.editorView.current.state?.doc.toString() ?? '';
111
+ this.editorView.current.dispatch({
112
+ changes: {
113
+ from: 0,
114
+ to: currentCmValue.length,
115
+ insert: value,
116
+ },
117
+ selection: { anchor: value.length, head: value.length },
118
+ });
119
+ this.editorView.current?.focus();
120
+ }
121
+ static defaultProps = {
122
+ lint: true,
123
+ schema: {},
124
+ overrideThemeBackgroundColor: false,
125
+ lineWrap: false,
126
+ showSignatureTooltipBelow: true,
127
+ extraKeybindings: [],
128
+ history: [],
129
+ theme: 'light',
130
+ lineNumbers: true,
131
+ newLineOnEnter: false,
132
+ };
133
+ debouncedOnChange = this.props.onChange
134
+ ? debounce(((value, viewUpdate) => {
135
+ this.props.onChange(value, viewUpdate);
136
+ }), DEBOUNCE_TIME)
137
+ : undefined;
138
+ componentDidMount() {
139
+ const { theme, extraKeybindings, lineWrap, overrideThemeBackgroundColor, schema, lint, showSignatureTooltipBelow, featureFlags, onExecute, newLineOnEnter, } = this.props;
140
+ this.schemaRef.current = {
141
+ schema,
142
+ lint,
143
+ showSignatureTooltipBelow,
144
+ featureFlags: {
145
+ consoleCommands: true,
146
+ ...featureFlags,
147
+ },
148
+ useLightVersion: false,
149
+ setUseLightVersion: (newVal) => {
150
+ if (this.schemaRef.current !== undefined) {
151
+ this.schemaRef.current.useLightVersion = newVal;
152
+ }
153
+ },
154
+ };
155
+ const themeExtension = getThemeExtension(theme, overrideThemeBackgroundColor);
156
+ const changeListener = this.debouncedOnChange
157
+ ? [
158
+ EditorView.updateListener.of((upt) => {
159
+ const wasUserEdit = !upt.transactions.some((tr) => tr.annotation(ExternalEdit));
160
+ if (upt.docChanged && wasUserEdit) {
161
+ const doc = upt.state.doc;
162
+ const value = doc.toString();
163
+ this.debouncedOnChange(value, upt);
164
+ }
165
+ }),
166
+ ]
167
+ : [];
168
+ this.editorState.current = EditorState.create({
169
+ extensions: [
170
+ keyBindingCompartment.of(keymap.of([
171
+ ...executeKeybinding(onExecute, newLineOnEnter, () => this.debouncedOnChange?.flush()),
172
+ ...extraKeybindings,
173
+ ])),
174
+ historyNavigation(this.props),
175
+ basicNeo4jSetup(),
176
+ themeCompartment.of(themeExtension),
177
+ changeListener,
178
+ cypher(this.schemaRef.current),
179
+ lineWrap ? EditorView.lineWrapping : [],
180
+ lineNumbersCompartment.of(this.props.lineNumbers
181
+ ? lineNumbers({ formatNumber: formatLineNumber(this.props.prompt) })
182
+ : []),
183
+ readOnlyCompartment.of(EditorState.readOnly.of(this.props.readonly)),
184
+ placeholderCompartment.of(this.props.placeholder ? placeholder(this.props.placeholder) : []),
185
+ domEventHandlerCompartment.of(this.props.domEventHandlers
186
+ ? EditorView.domEventHandlers(this.props.domEventHandlers)
187
+ : []),
188
+ this.props.ariaLabel
189
+ ? EditorView.contentAttributes.of({
190
+ 'aria-label': this.props.ariaLabel,
191
+ })
192
+ : [],
193
+ ],
194
+ doc: this.props.value,
195
+ });
196
+ this.editorView.current = new EditorView({
197
+ state: this.editorState.current,
198
+ parent: this.editorContainer.current,
199
+ });
200
+ if (this.props.autofocus) {
201
+ this.focus();
202
+ if (this.props.value) {
203
+ this.updateCursorPosition(this.props.value.length);
204
+ }
205
+ }
206
+ else if (this.props.offset) {
207
+ this.updateCursorPosition(this.props.offset);
208
+ }
209
+ }
210
+ componentDidUpdate(prevProps) {
211
+ if (!this.editorView.current) {
212
+ return;
213
+ }
214
+ // Handle externally set value
215
+ const currentCmValue = this.editorView.current.state?.doc.toString() ?? '';
216
+ if (this.props.value !== undefined && // If the component becomes uncontolled, we just leave the value as is
217
+ this.props.value !== prevProps.value && // The value prop has changed, we need to update the editor
218
+ this.props.value !== currentCmValue // No need to dispatch an update if the value is the same
219
+ ) {
220
+ this.editorView.current.dispatch({
221
+ changes: {
222
+ from: 0,
223
+ to: currentCmValue.length,
224
+ insert: this.props.value ?? '',
225
+ },
226
+ annotations: [ExternalEdit.of(true)],
227
+ });
228
+ }
229
+ // Handle theme change
230
+ const didChangeTheme = prevProps.theme !== this.props.theme ||
231
+ prevProps.overrideThemeBackgroundColor !==
232
+ this.props.overrideThemeBackgroundColor;
233
+ if (didChangeTheme) {
234
+ this.editorView.current.dispatch({
235
+ effects: themeCompartment.reconfigure(getThemeExtension(this.props.theme, this.props.overrideThemeBackgroundColor)),
236
+ });
237
+ }
238
+ if (prevProps.lineNumbers !== this.props.lineNumbers ||
239
+ prevProps.prompt !== this.props.prompt) {
240
+ this.editorView.current.dispatch({
241
+ effects: lineNumbersCompartment.reconfigure(this.props.lineNumbers
242
+ ? lineNumbers({ formatNumber: formatLineNumber(this.props.prompt) })
243
+ : []),
244
+ });
245
+ }
246
+ if (prevProps.readonly !== this.props.readonly) {
247
+ this.editorView.current.dispatch({
248
+ effects: readOnlyCompartment.reconfigure(EditorState.readOnly.of(this.props.readonly)),
249
+ });
250
+ }
251
+ if (prevProps.placeholder !== this.props.placeholder) {
252
+ this.editorView.current.dispatch({
253
+ effects: placeholderCompartment.reconfigure(this.props.placeholder ? placeholder(this.props.placeholder) : []),
254
+ });
255
+ }
256
+ if (prevProps.extraKeybindings !== this.props.extraKeybindings ||
257
+ prevProps.onExecute !== this.props.onExecute) {
258
+ this.editorView.current.dispatch({
259
+ effects: keyBindingCompartment.reconfigure(keymap.of([
260
+ ...executeKeybinding(this.props.onExecute, this.props.newLineOnEnter, () => this.debouncedOnChange?.flush()),
261
+ ...this.props.extraKeybindings,
262
+ ])),
263
+ });
264
+ }
265
+ if (prevProps.domEventHandlers !== this.props.domEventHandlers) {
266
+ this.editorView.current.dispatch({
267
+ effects: domEventHandlerCompartment.reconfigure(this.props.domEventHandlers
268
+ ? EditorView.domEventHandlers(this.props.domEventHandlers)
269
+ : []),
270
+ });
271
+ }
272
+ // This component rerenders on every keystroke and comparing the
273
+ // full lists of editor strings on every render could be expensive.
274
+ const didChangeHistoryEstimate = prevProps.history?.length !== this.props.history?.length ||
275
+ prevProps.history?.[0] !== this.props.history?.[0];
276
+ if (didChangeHistoryEstimate) {
277
+ this.editorView.current.dispatch({
278
+ effects: replaceHistory.of(this.props.history ?? []),
279
+ });
280
+ }
281
+ /*
282
+ The cypher configuration is a mutable object that is passed to the cypher language extension.
283
+ Much like how the schema based completions work in the official sql language extension.
284
+ https://github.com/codemirror/lang-sql/blob/4b7b2564dff7cdb1a15f8ccd08142f2cc8a0006f/src/sql.ts#L178C17-L178C18
285
+ */
286
+ this.schemaRef.current.schema = this.props.schema;
287
+ this.schemaRef.current.lint = this.props.lint;
288
+ this.schemaRef.current.featureFlags = this.props.featureFlags;
289
+ }
290
+ componentWillUnmount() {
291
+ this.editorView.current?.destroy();
292
+ cleanupWorkers();
293
+ }
294
+ render() {
295
+ const { className, theme } = this.props;
296
+ const themeClass = typeof theme === 'string' ? `cm-theme-${theme}` : 'cm-theme';
297
+ return (_jsx("div", { ref: this.editorContainer, className: `${themeClass}${className ? ` ${className}` : ''}` }));
298
+ }
299
+ }
300
+ //# sourceMappingURL=CypherEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CypherEditor.js","sourceRoot":"","sources":["../src/CypherEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,UAAU,EACV,WAAW,EACX,WAAW,GAEZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,UAAU,EAEV,MAAM,EACN,WAAW,EACX,WAAW,GAEZ,MAAM,kBAAkB,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