@neo4j-cypher/react-codemirror 2.0.0-next.3 → 2.0.0-next.30

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 (163) hide show
  1. package/CHANGELOG.md +257 -0
  2. package/README.md +3 -2
  3. package/dist/{types → src}/CypherEditor.d.ts +81 -3
  4. package/dist/src/CypherEditor.js +336 -0
  5. package/dist/src/CypherEditor.js.map +1 -0
  6. package/dist/src/CypherEditor.test.js +154 -0
  7. package/dist/src/CypherEditor.test.js.map +1 -0
  8. package/dist/src/constants.d.ts +1 -0
  9. package/dist/src/constants.js +2 -0
  10. package/dist/src/constants.js.map +1 -0
  11. package/dist/src/e2e_tests/autoCompletion.spec.js +332 -0
  12. package/dist/src/e2e_tests/autoCompletion.spec.js.map +1 -0
  13. package/dist/src/e2e_tests/configuration.spec.js +83 -0
  14. package/dist/src/e2e_tests/configuration.spec.js.map +1 -0
  15. package/dist/src/e2e_tests/debounce.spec.js +66 -0
  16. package/dist/src/e2e_tests/debounce.spec.js.map +1 -0
  17. package/dist/{types/e2e_tests/e2e-utils.d.ts → src/e2e_tests/e2eUtils.d.ts} +2 -0
  18. package/dist/src/e2e_tests/e2eUtils.js +79 -0
  19. package/dist/src/e2e_tests/e2eUtils.js.map +1 -0
  20. package/dist/src/e2e_tests/extraKeybindings.spec.js +43 -0
  21. package/dist/src/e2e_tests/extraKeybindings.spec.js.map +1 -0
  22. package/dist/src/e2e_tests/historyNavigation.spec.js +227 -0
  23. package/dist/src/e2e_tests/historyNavigation.spec.js.map +1 -0
  24. package/dist/src/e2e_tests/performanceTest.spec.d.ts +6 -0
  25. package/dist/src/e2e_tests/performanceTest.spec.js +97 -0
  26. package/dist/src/e2e_tests/performanceTest.spec.js.map +1 -0
  27. package/dist/src/e2e_tests/sanityChecks.spec.js +53 -0
  28. package/dist/src/e2e_tests/sanityChecks.spec.js.map +1 -0
  29. package/dist/src/e2e_tests/signatureHelp.spec.js +228 -0
  30. package/dist/src/e2e_tests/signatureHelp.spec.js.map +1 -0
  31. package/dist/src/e2e_tests/snippets.spec.js +62 -0
  32. package/dist/src/e2e_tests/snippets.spec.js.map +1 -0
  33. package/dist/src/e2e_tests/syntaxHighlighting.spec.d.ts +1 -0
  34. package/dist/src/e2e_tests/syntaxHighlighting.spec.js +90 -0
  35. package/dist/src/e2e_tests/syntaxHighlighting.spec.js.map +1 -0
  36. package/dist/src/e2e_tests/syntaxValidation.spec.d.ts +1 -0
  37. package/dist/src/e2e_tests/syntaxValidation.spec.js +126 -0
  38. package/dist/src/e2e_tests/syntaxValidation.spec.js.map +1 -0
  39. package/dist/src/historyNavigation.js +163 -0
  40. package/dist/src/historyNavigation.js.map +1 -0
  41. package/dist/{types → src}/icons.d.ts +1 -1
  42. package/dist/src/icons.js +62 -0
  43. package/dist/src/icons.js.map +1 -0
  44. package/dist/src/index.d.ts +4 -0
  45. package/dist/src/index.js +5 -0
  46. package/dist/src/index.js.map +1 -0
  47. package/dist/src/lang-cypher/autocomplete.d.ts +6 -0
  48. package/dist/src/lang-cypher/autocomplete.js +113 -0
  49. package/dist/src/lang-cypher/autocomplete.js.map +1 -0
  50. package/dist/{types → src}/lang-cypher/constants.d.ts +11 -0
  51. package/dist/src/lang-cypher/constants.js +69 -0
  52. package/dist/src/lang-cypher/constants.js.map +1 -0
  53. package/dist/src/lang-cypher/contants.test.d.ts +1 -0
  54. package/dist/src/lang-cypher/contants.test.js +103 -0
  55. package/dist/src/lang-cypher/contants.test.js.map +1 -0
  56. package/dist/src/lang-cypher/createCypherTheme.js +183 -0
  57. package/dist/src/lang-cypher/createCypherTheme.js.map +1 -0
  58. package/dist/src/lang-cypher/langCypher.d.ts +13 -0
  59. package/dist/src/lang-cypher/langCypher.js +23 -0
  60. package/dist/src/lang-cypher/langCypher.js.map +1 -0
  61. package/dist/src/lang-cypher/lintWorker.mjs +2022 -0
  62. package/dist/src/lang-cypher/parser-adapter.d.ts +19 -0
  63. package/dist/src/lang-cypher/parser-adapter.js +113 -0
  64. package/dist/src/lang-cypher/parser-adapter.js.map +1 -0
  65. package/dist/src/lang-cypher/signatureHelp.d.ts +4 -0
  66. package/dist/src/lang-cypher/signatureHelp.js +109 -0
  67. package/dist/src/lang-cypher/signatureHelp.js.map +1 -0
  68. package/dist/{types/lang-cypher/syntax-validation.d.ts → src/lang-cypher/syntaxValidation.d.ts} +2 -1
  69. package/dist/src/lang-cypher/syntaxValidation.js +57 -0
  70. package/dist/src/lang-cypher/syntaxValidation.js.map +1 -0
  71. package/dist/src/lang-cypher/themeIcons.js +22 -0
  72. package/dist/src/lang-cypher/themeIcons.js.map +1 -0
  73. package/dist/src/lang-cypher/utils.d.ts +2 -0
  74. package/dist/src/lang-cypher/utils.js +10 -0
  75. package/dist/src/lang-cypher/utils.js.map +1 -0
  76. package/dist/src/ndlTokensCopy.d.ts +570 -0
  77. package/dist/src/ndlTokensCopy.js +571 -0
  78. package/dist/src/ndlTokensCopy.js.map +1 -0
  79. package/dist/src/ndlTokensCopy.test.d.ts +1 -0
  80. package/dist/src/ndlTokensCopy.test.js +12 -0
  81. package/dist/src/ndlTokensCopy.test.js.map +1 -0
  82. package/dist/src/neo4jSetup.d.ts +6 -0
  83. package/dist/src/neo4jSetup.js +120 -0
  84. package/dist/src/neo4jSetup.js.map +1 -0
  85. package/dist/src/richClipboardCopier.d.ts +4 -0
  86. package/dist/src/richClipboardCopier.js +78 -0
  87. package/dist/src/richClipboardCopier.js.map +1 -0
  88. package/dist/src/richClipboardCopier.test.d.ts +1 -0
  89. package/dist/src/richClipboardCopier.test.js +53 -0
  90. package/dist/src/richClipboardCopier.test.js.map +1 -0
  91. package/dist/{types → src}/themes.d.ts +1 -1
  92. package/dist/src/themes.js +93 -0
  93. package/dist/src/themes.js.map +1 -0
  94. package/dist/tsconfig.tsbuildinfo +1 -0
  95. package/package.json +43 -41
  96. package/src/CypherEditor.test.tsx +204 -0
  97. package/src/CypherEditor.tsx +316 -42
  98. package/src/constants.ts +1 -0
  99. package/src/e2e_tests/autoCompletion.spec.tsx +571 -0
  100. package/src/e2e_tests/configuration.spec.tsx +111 -0
  101. package/src/e2e_tests/debounce.spec.tsx +106 -0
  102. package/src/e2e_tests/{e2e-utils.ts → e2eUtils.ts} +41 -3
  103. package/src/e2e_tests/{extra-keybindings.spec.tsx → extraKeybindings.spec.tsx} +1 -3
  104. package/src/e2e_tests/{history-navigation.spec.tsx → historyNavigation.spec.tsx} +137 -18
  105. package/src/e2e_tests/performanceTest.spec.tsx +163 -0
  106. package/src/e2e_tests/{sanity-checks.spec.tsx → sanityChecks.spec.tsx} +7 -22
  107. package/src/e2e_tests/signatureHelp.spec.tsx +444 -0
  108. package/src/e2e_tests/snippets.spec.tsx +92 -0
  109. package/src/e2e_tests/{syntax-highlighting.spec.tsx → syntaxHighlighting.spec.tsx} +26 -24
  110. package/src/e2e_tests/syntaxValidation.spec.tsx +259 -0
  111. package/src/{history-navigation.ts → historyNavigation.ts} +1 -1
  112. package/src/icons.ts +3 -0
  113. package/src/index.ts +2 -2
  114. package/src/lang-cypher/autocomplete.ts +99 -18
  115. package/src/lang-cypher/constants.ts +27 -0
  116. package/src/lang-cypher/contants.test.ts +6 -2
  117. package/src/lang-cypher/{create-cypher-theme.ts → createCypherTheme.ts} +45 -2
  118. package/src/lang-cypher/langCypher.ts +42 -0
  119. package/src/lang-cypher/lintWorker.mjs +2022 -0
  120. package/src/lang-cypher/parser-adapter.ts +145 -0
  121. package/src/lang-cypher/signatureHelp.ts +151 -0
  122. package/src/lang-cypher/syntaxValidation.ts +72 -0
  123. package/src/lang-cypher/utils.ts +9 -0
  124. package/src/{ndl-tokens-copy.test.ts → ndlTokensCopy.test.ts} +2 -1
  125. package/src/ndlTokensCopy.ts +570 -0
  126. package/src/{neo4j-setup.tsx → neo4jSetup.tsx} +78 -17
  127. package/src/richClipboardCopier.test.ts +65 -0
  128. package/src/richClipboardCopier.ts +99 -0
  129. package/src/themes.ts +45 -70
  130. package/src/viteEnv.d.ts +1 -0
  131. package/dist/cjs/index.cjs +0 -1440
  132. package/dist/cjs/index.cjs.map +0 -7
  133. package/dist/esm/index.mjs +0 -1463
  134. package/dist/esm/index.mjs.map +0 -7
  135. package/dist/types/e2e_tests/mock-data.d.ts +0 -3779
  136. package/dist/types/index.d.ts +0 -4
  137. package/dist/types/lang-cypher/ParserAdapter.d.ts +0 -14
  138. package/dist/types/lang-cypher/autocomplete.d.ts +0 -3
  139. package/dist/types/lang-cypher/lang-cypher.d.ts +0 -7
  140. package/dist/types/ndl-tokens-copy.d.ts +0 -379
  141. package/dist/types/neo4j-setup.d.ts +0 -2
  142. package/dist/types/tsconfig.tsbuildinfo +0 -1
  143. package/src/e2e_tests/auto-completion.spec.tsx +0 -232
  144. package/src/e2e_tests/mock-data.ts +0 -4310
  145. package/src/e2e_tests/performance-test.spec.tsx +0 -71
  146. package/src/e2e_tests/syntax-validation.spec.tsx +0 -156
  147. package/src/lang-cypher/ParserAdapter.ts +0 -92
  148. package/src/lang-cypher/lang-cypher.ts +0 -32
  149. package/src/lang-cypher/syntax-validation.ts +0 -24
  150. package/src/ndl-tokens-copy.ts +0 -379
  151. /package/dist/{types/e2e_tests/auto-completion.spec.d.ts → src/CypherEditor.test.d.ts} +0 -0
  152. /package/dist/{types/e2e_tests/extra-keybindings.spec.d.ts → src/e2e_tests/autoCompletion.spec.d.ts} +0 -0
  153. /package/dist/{types/e2e_tests/history-navigation.spec.d.ts → src/e2e_tests/configuration.spec.d.ts} +0 -0
  154. /package/dist/{types/e2e_tests/performance-test.spec.d.ts → src/e2e_tests/debounce.spec.d.ts} +0 -0
  155. /package/dist/{types/e2e_tests/sanity-checks.spec.d.ts → src/e2e_tests/extraKeybindings.spec.d.ts} +0 -0
  156. /package/dist/{types/e2e_tests/syntax-highlighting.spec.d.ts → src/e2e_tests/historyNavigation.spec.d.ts} +0 -0
  157. /package/dist/{types/e2e_tests/syntax-validation.spec.d.ts → src/e2e_tests/sanityChecks.spec.d.ts} +0 -0
  158. /package/dist/{types/lang-cypher/contants.test.d.ts → src/e2e_tests/signatureHelp.spec.d.ts} +0 -0
  159. /package/dist/{types/ndl-tokens-copy.test.d.ts → src/e2e_tests/snippets.spec.d.ts} +0 -0
  160. /package/dist/{types/history-navigation.d.ts → src/historyNavigation.d.ts} +0 -0
  161. /package/dist/{types/lang-cypher/create-cypher-theme.d.ts → src/lang-cypher/createCypherTheme.d.ts} +0 -0
  162. /package/dist/{types/lang-cypher/theme-icons.d.ts → src/lang-cypher/themeIcons.d.ts} +0 -0
  163. /package/src/lang-cypher/{theme-icons.ts → themeIcons.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,262 @@
1
1
  # @neo4j-cypher/react-codemirror
2
2
 
3
+ ## 2.0.0-next.30
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [6a2a408]
8
+ - Updated dependencies [20b31b6]
9
+ - Updated dependencies [68d92a8]
10
+ - @neo4j-cypher/lint-worker@1.10.1-next.4
11
+ - @neo4j-cypher/language-support@2.0.0-next.27
12
+
13
+ ## 2.0.0-next.29
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [8e8d7f1]
18
+ - Updated dependencies [808aa73]
19
+ - @neo4j-cypher/language-support@2.0.0-next.26
20
+ - @neo4j-cypher/lint-worker@1.10.1-next.3
21
+
22
+ ## 2.0.0-next.28
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [b1e686e]
27
+ - @neo4j-cypher/language-support@2.0.0-next.25
28
+ - @neo4j-cypher/lint-worker@1.10.1-next.2
29
+
30
+ ## 2.0.0-next.27
31
+
32
+ ### Patch Changes
33
+
34
+ - 86f5c55: adding rich clipboard copier to codemirror
35
+ - 5fdc6dd: Fixes faulty worker termination on big queries
36
+ - Updated dependencies [246d60c]
37
+ - Updated dependencies [8eacddd]
38
+ - Updated dependencies [3a29711]
39
+ - Updated dependencies [b9c0e9d]
40
+ - Updated dependencies [d77e8a1]
41
+ - Updated dependencies [5fdc6dd]
42
+ - Updated dependencies [7183c63]
43
+ - @neo4j-cypher/lint-worker@1.10.1-next.1
44
+ - @neo4j-cypher/language-support@2.0.0-next.24
45
+
46
+ ## 2.0.0-next.26
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies [c065d85]
51
+ - @neo4j-cypher/language-support@2.0.0-next.23
52
+ - @neo4j-cypher/lint-worker@1.10.1-next.0
53
+
54
+ ## 2.0.0-next.25
55
+
56
+ ### Patch Changes
57
+
58
+ - d99368c: Ensures CRLF newlines are handled when setting editor value
59
+ - Updated dependencies [ed65ef3]
60
+ - Updated dependencies [7538cfd]
61
+ - Updated dependencies [c1fa91f]
62
+ - Updated dependencies [039d1c5]
63
+ - Updated dependencies [1ef063e]
64
+ - Updated dependencies [a38255f]
65
+ - Updated dependencies [c4f27c9]
66
+ - @neo4j-cypher/language-support@2.0.0-next.22
67
+ - @neo4j-cypher/lint-worker@0.1.0-next.0
68
+
69
+ ## 2.0.0-next.24
70
+
71
+ ### Patch Changes
72
+
73
+ - 8b03317: resetting z index for cm panels
74
+ - Updated dependencies [4b0ee37]
75
+ - @neo4j-cypher/language-support@2.0.0-next.21
76
+ - @neo4j-cypher/lint-worker@2025.4.1-next.0
77
+
78
+ ## 2.0.0-next.23
79
+
80
+ ### Patch Changes
81
+
82
+ - Updated dependencies [013e4ff]
83
+ - @neo4j-cypher/language-support@2.0.0-next.20
84
+
85
+ ## 2.0.0-next.22
86
+
87
+ ### Patch Changes
88
+
89
+ - 5bfdac2: restructure packages as part of move to pnpm
90
+ - Updated dependencies [88e4930]
91
+ - Updated dependencies [5bfdac2]
92
+ - @neo4j-cypher/language-support@2.0.0-next.19
93
+
94
+ ## 2.0.0-next.21
95
+
96
+ ### Patch Changes
97
+
98
+ - Updated dependencies [1b971aa]
99
+ - Updated dependencies [07ac90f]
100
+ - @neo4j-cypher/language-support@2.0.0-next.18
101
+
102
+ ## 2.0.0-next.20
103
+
104
+ ### Patch Changes
105
+
106
+ - Updated dependencies [bffbb19]
107
+ - Updated dependencies [826d922]
108
+ - Updated dependencies [1caab0c]
109
+ - @neo4j-cypher/language-support@2.0.0-next.17
110
+
111
+ ## 2.0.0-next.19
112
+
113
+ ### Patch Changes
114
+
115
+ - a3e3e50: updating themes to use needle colors
116
+ - Updated dependencies [68f55d4]
117
+ - Updated dependencies [6d00433]
118
+ - Updated dependencies [c01b32a]
119
+ - @neo4j-cypher/language-support@2.0.0-next.16
120
+
121
+ ## 2.0.0-next.18
122
+
123
+ ### Patch Changes
124
+
125
+ - Updated dependencies [50cc73e]
126
+ - Updated dependencies [5ef538d]
127
+ - Updated dependencies [b988d3b]
128
+ - @neo4j-cypher/language-support@2.0.0-next.15
129
+
130
+ ## 2.0.0-next.17
131
+
132
+ ### Patch Changes
133
+
134
+ - 245fb6a: Automatically opens autocompletions after "YIELD "
135
+ - Updated dependencies [8ec797d]
136
+ - Updated dependencies [7aa9c3a]
137
+ - Updated dependencies [2be5469]
138
+ - Updated dependencies [245fb6a]
139
+ - Updated dependencies [c587b81]
140
+ - Updated dependencies [3f8b64f]
141
+ - Updated dependencies [043d766]
142
+ - Updated dependencies [704d1c5]
143
+ - @neo4j-cypher/language-support@2.0.0-next.14
144
+
145
+ ## 2.0.0-next.16
146
+
147
+ ### Patch Changes
148
+
149
+ - Updated dependencies [84a12fc]
150
+ - Updated dependencies [d329252]
151
+ - Updated dependencies [b0e419e]
152
+ - @neo4j-cypher/language-support@2.0.0-next.13
153
+
154
+ ## 2.0.0-next.15
155
+
156
+ ### Patch Changes
157
+
158
+ - adc5b64: using custom light color theme for the cypher editor
159
+ - Updated dependencies [88fbe63]
160
+ - Updated dependencies [22081b0]
161
+ - Updated dependencies [62ac442]
162
+ - @neo4j-cypher/language-support@2.0.0-next.12
163
+
164
+ ## 2.0.0-next.14
165
+
166
+ ### Patch Changes
167
+
168
+ - d85c1e0: Fixes bug with auto-completions
169
+ - Updated dependencies [bccf518]
170
+ - @neo4j-cypher/language-support@2.0.0-next.11
171
+
172
+ ## 2.0.0-next.13
173
+
174
+ ### Patch Changes
175
+
176
+ - Updated dependencies [8760c02]
177
+ - @neo4j-cypher/language-support@2.0.0-next.10
178
+
179
+ ## 2.0.0-next.12
180
+
181
+ ### Patch Changes
182
+
183
+ - dcbe67d: Expose moveFocusOnTab property on the CypherEditor component to conditionally disable tab keymappings
184
+ - e9621c8: Re-export language support from react codemirror
185
+ - Updated dependencies [2e72ac8]
186
+ - @neo4j-cypher/language-support@2.0.0-next.9
187
+
188
+ ## 2.0.0-next.11
189
+
190
+ ### Patch Changes
191
+
192
+ - Updated dependencies [05663bd]
193
+ - @neo4j-cypher/language-support@2.0.0-next.8
194
+
195
+ ## 2.0.0-next.10
196
+
197
+ ### Patch Changes
198
+
199
+ - bb7e9d3: Simplify detection and handling of value prop updates
200
+
201
+ ## 2.0.0-next.9
202
+
203
+ ### Patch Changes
204
+
205
+ - fbd5f7e: allow signature help panel to render below editor when there's not enough space above it
206
+ - 09dfae2: Add an ariaLabel prop to CypherEditor
207
+ - 7154e94: Fix bug causing debouncing to override value
208
+ - 62c152f: execute single line query on enter by default
209
+ - cbfc75e: Fix a bug causing debounced value updates to get cancelled erroneously
210
+ - 04ae35e: Set initial latestDispatchedValue and flush debounced changes onExecute
211
+ Add tests for debounce behaviour
212
+ - Updated dependencies [3661e9d]
213
+ - Updated dependencies [b76af58]
214
+ - Updated dependencies [21699b7]
215
+ - Updated dependencies [6afc0e3]
216
+ - Updated dependencies [39b924d]
217
+ - @neo4j-cypher/language-support@2.0.0-next.7
218
+
219
+ ## 2.0.0-next.8
220
+
221
+ ### Patch Changes
222
+
223
+ - 6cc9022: Adds more props to the CypherEditor component
224
+ - Updated dependencies [e92d8c7]
225
+ - @neo4j-cypher/language-support@2.0.0-next.6
226
+
227
+ ## 2.0.0-next.7
228
+
229
+ ### Patch Changes
230
+
231
+ - Updated dependencies [1f790d0]
232
+ - @neo4j-cypher/language-support@2.0.0-next.5
233
+
234
+ ## 2.0.0-next.6
235
+
236
+ ### Patch Changes
237
+
238
+ - Updated dependencies
239
+ - @neo4j-cypher/language-support@2.0.0-next.4
240
+
241
+ ## 2.0.0-next.5
242
+
243
+ ### Patch Changes
244
+
245
+ - 8cc77c6: Add support for console commands
246
+ - 1e210cb: Moves semantic analysis to a separate worker file
247
+ - Updated dependencies [8cc77c6]
248
+ - Updated dependencies [1e210cb]
249
+ - Updated dependencies [f6d20b2]
250
+ - @neo4j-cypher/language-support@2.0.0-next.3
251
+
252
+ ## 2.0.0-next.4
253
+
254
+ ### Patch Changes
255
+
256
+ - 8de605b: Improved history prop change detection
257
+ - Updated dependencies [17909e3]
258
+ - @neo4j-cypher/language-support@2.0.0-next.2
259
+
3
260
  ## 2.0.0-next.3
4
261
 
5
262
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # React Codemirror
2
2
 
3
- This package can be built with `npm run build` and then published to npm with `npm publish`.
3
+ This package can be built with `pnpm build` and then published to npm with `pnpm publish`.
4
4
 
5
5
  ## Usage
6
6
 
@@ -27,7 +27,8 @@ For a full example, see the [react-codemirror-playground](https://github.com/neo
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
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).
30
+
31
+ 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
32
 
32
33
  ### Completion Icons
33
34
 
@@ -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,7 +22,14 @@ export interface CypherEditorProps {
21
22
  */
22
23
  onExecute?: (cmd: string) => void;
23
24
  /**
24
- * The editor history navigateable via up/down arrow keys. Order newest to oldest.
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
29
+ */
30
+ newLineOnEnter?: boolean;
31
+ /**
32
+ * The editor history navigable via up/down arrow keys. Order newest to oldest.
25
33
  * Add to this list with the `onExecute` callback for REPL style history.
26
34
  */
27
35
  history?: string[];
@@ -38,6 +46,10 @@ export interface CypherEditorProps {
38
46
  * @default false
39
47
  */
40
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;
41
53
  /**
42
54
  * Whether the editor should wrap lines.
43
55
  *
@@ -50,6 +62,20 @@ export interface CypherEditorProps {
50
62
  * @default true
51
63
  */
52
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
+ };
53
79
  /**
54
80
  * The schema to use for autocompletion and linting.
55
81
  *
@@ -77,8 +103,54 @@ export interface CypherEditorProps {
77
103
  * @param {ViewUpdate} viewUpdate - the view update from codemirror
78
104
  */
79
105
  onChange?(value: string, viewUpdate: ViewUpdate): void;
106
+ /**
107
+ * Map of event handlers to add to the editor.
108
+ *
109
+ * Note that the props are compared by reference, meaning object defined inline
110
+ * will cause the editor to re-render (much like the style prop does in this example:
111
+ * <div style={{}} />
112
+ *
113
+ * Memoize the object if you want/need to avoid this.
114
+ *
115
+ * @example
116
+ * // listen to blur events
117
+ * <CypherEditor domEventHandlers={{blur: () => console.log("blur event fired")}} />
118
+ */
119
+ domEventHandlers?: DomEventHandlers;
120
+ /**
121
+ * Placeholder text to display when the editor is empty.
122
+ */
123
+ placeholder?: string;
124
+ /**
125
+ * Whether the editor should show line numbers.
126
+ *
127
+ * @default true
128
+ */
129
+ lineNumbers?: boolean;
130
+ /**
131
+ * Whether the editor is read-only.
132
+ *
133
+ * @default false
134
+ */
135
+ readonly?: boolean;
136
+ /**
137
+ * String value to assign to the aria-label attribute of the editor.
138
+ */
139
+ ariaLabel?: string;
140
+ /**
141
+ * Whether keybindings for inserting indents with the Tab key should be disabled.
142
+ *
143
+ * true will not create keybindings for inserting indents.
144
+ * false will create keybindings for inserting indents.
145
+ *
146
+ * @default false
147
+ */
148
+ moveFocusOnTab?: boolean;
80
149
  }
81
- export declare class CypherEditor extends Component<CypherEditorProps> {
150
+ type CypherEditorState = {
151
+ cypherSupportEnabled: boolean;
152
+ };
153
+ export declare class CypherEditor extends Component<CypherEditorProps, CypherEditorState> {
82
154
  /**
83
155
  * The codemirror editor container.
84
156
  */
@@ -92,6 +164,10 @@ export declare class CypherEditor extends Component<CypherEditorProps> {
92
164
  */
93
165
  editorView: React.MutableRefObject<EditorView>;
94
166
  private schemaRef;
167
+ /**
168
+ * Format Cypher query
169
+ */
170
+ format(): void;
95
171
  /**
96
172
  * Focus the editor
97
173
  */
@@ -106,8 +182,10 @@ export declare class CypherEditor extends Component<CypherEditorProps> {
106
182
  */
107
183
  setValueAndFocus(value?: string): void;
108
184
  static defaultProps: CypherEditorProps;
185
+ private debouncedOnChange;
109
186
  componentDidMount(): void;
110
187
  componentDidUpdate(prevProps: CypherEditorProps): void;
111
188
  componentWillUnmount(): void;
112
189
  render(): React.ReactNode;
113
190
  }
191
+ export {};