@neo4j-cypher/react-codemirror 1.0.3 → 2.0.0-next.0
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.
- package/CHANGELOG.md +7 -0
- package/LICENSE.md +201 -0
- package/README.md +26 -27
- package/dist/cjs/index.cjs +1455 -0
- package/dist/cjs/index.cjs.map +7 -0
- package/dist/esm/index.mjs +1468 -0
- package/dist/esm/index.mjs.map +7 -0
- package/dist/types/CypherEditor.d.ts +118 -0
- package/dist/types/e2e_tests/auto-completion.spec.d.ts +1 -0
- package/dist/types/e2e_tests/e2e-utils.d.ts +12 -0
- package/dist/types/e2e_tests/extra-keybindings.spec.d.ts +1 -0
- package/dist/types/e2e_tests/history-navigation.spec.d.ts +1 -0
- package/dist/types/e2e_tests/mock-data.d.ts +3779 -0
- package/dist/types/e2e_tests/performance-test.spec.d.ts +1 -0
- package/dist/types/e2e_tests/sanity-checks.spec.d.ts +1 -0
- package/dist/types/e2e_tests/syntax-highlighting.spec.d.ts +1 -0
- package/dist/types/e2e_tests/syntax-validation.spec.d.ts +1 -0
- package/dist/types/icons.d.ts +2 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/lang-cypher/ParserAdapter.d.ts +14 -0
- package/dist/types/lang-cypher/autocomplete.d.ts +3 -0
- package/dist/types/lang-cypher/constants.d.ts +31 -0
- package/dist/types/lang-cypher/contants.test.d.ts +1 -0
- package/dist/types/lang-cypher/create-cypher-theme.d.ts +26 -0
- package/dist/types/lang-cypher/lang-cypher.d.ts +7 -0
- package/dist/types/lang-cypher/syntax-validation.d.ts +3 -0
- package/dist/types/lang-cypher/theme-icons.d.ts +7 -0
- package/dist/types/ndl-tokens-copy.d.ts +379 -0
- package/dist/types/ndl-tokens-copy.test.d.ts +1 -0
- package/dist/types/neo4j-setup.d.ts +2 -0
- package/dist/types/repl-mode.d.ts +8 -0
- package/dist/types/themes.d.ts +11 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +60 -34
- package/src/CypherEditor.tsx +316 -0
- package/src/e2e_tests/auto-completion.spec.tsx +232 -0
- package/src/e2e_tests/e2e-utils.ts +75 -0
- package/src/e2e_tests/extra-keybindings.spec.tsx +57 -0
- package/src/e2e_tests/history-navigation.spec.tsx +144 -0
- package/src/e2e_tests/mock-data.ts +4310 -0
- package/src/e2e_tests/performance-test.spec.tsx +71 -0
- package/src/e2e_tests/sanity-checks.spec.tsx +87 -0
- package/src/e2e_tests/syntax-highlighting.spec.tsx +198 -0
- package/src/e2e_tests/syntax-validation.spec.tsx +157 -0
- package/src/icons.ts +87 -0
- package/src/index.ts +5 -0
- package/src/lang-cypher/ParserAdapter.ts +92 -0
- package/src/lang-cypher/autocomplete.ts +65 -0
- package/src/lang-cypher/constants.ts +61 -0
- package/src/lang-cypher/contants.test.ts +104 -0
- package/src/lang-cypher/create-cypher-theme.ts +207 -0
- package/src/lang-cypher/lang-cypher.ts +32 -0
- package/src/lang-cypher/syntax-validation.ts +24 -0
- package/src/lang-cypher/theme-icons.ts +27 -0
- package/src/ndl-tokens-copy.test.ts +11 -0
- package/src/ndl-tokens-copy.ts +379 -0
- package/src/neo4j-setup.tsx +129 -0
- package/src/repl-mode.ts +214 -0
- package/src/themes.ts +130 -0
- package/es/CypherEditor.js +0 -262
- package/es/react-codemirror.js +0 -1
- package/lib/CypherEditor.js +0 -272
- package/lib/react-codemirror.js +0 -13
- package/src/CypherEditor.d.ts +0 -310
- package/src/react-codemirror.d.ts +0 -18
package/src/CypherEditor.d.ts
DELETED
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { Extension, EditorSelection } from "@codemirror/state";
|
|
3
|
-
import type { EditorSupportSchema } from "@neo4j-cypher/editor-support";
|
|
4
|
-
import type {
|
|
5
|
-
PositionAny,
|
|
6
|
-
Theme,
|
|
7
|
-
AutofocusProp,
|
|
8
|
-
EditorCreatedListener,
|
|
9
|
-
AutocompleteChangedListener,
|
|
10
|
-
PositionChangedListener,
|
|
11
|
-
FocusChangedListener,
|
|
12
|
-
ScrollChangedListener,
|
|
13
|
-
SearchChangedListener,
|
|
14
|
-
ValueChangedListener,
|
|
15
|
-
KeyListener,
|
|
16
|
-
LineNumberClickListener,
|
|
17
|
-
LineNumberFormatter,
|
|
18
|
-
SelectionChangedListener
|
|
19
|
-
} from "@neo4j-cypher/codemirror";
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Interface for React Cypher Editor component props
|
|
23
|
-
*/
|
|
24
|
-
export interface CypherEditorProps {
|
|
25
|
-
/**
|
|
26
|
-
* Whether the autocomplete feature is enabled
|
|
27
|
-
*
|
|
28
|
-
* @defaultValue `true`
|
|
29
|
-
*/
|
|
30
|
-
autocomplete?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Whether the autocomplete auto closes whenever the editor loses focus
|
|
33
|
-
*
|
|
34
|
-
* @defaultValue `true`
|
|
35
|
-
*/
|
|
36
|
-
autocompleteCloseOnBlur?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Whether the autocomplete panel is open
|
|
39
|
-
*
|
|
40
|
-
* @remarks
|
|
41
|
-
*
|
|
42
|
-
* Changing this can be used to manually control the autocomplete open state
|
|
43
|
-
*
|
|
44
|
-
* @defaultValue `false`
|
|
45
|
-
*/
|
|
46
|
-
autocompleteOpen?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* The keys that when typed will automatically open the autocomplete menu
|
|
49
|
-
*
|
|
50
|
-
* @defaultValue [".",":","[]","()","{}","[","(","{","$"]
|
|
51
|
-
*/
|
|
52
|
-
autocompleteTriggerStrings?: string[];
|
|
53
|
-
/**
|
|
54
|
-
* Whether the editor should be auto focused on first creation
|
|
55
|
-
*
|
|
56
|
-
* @defaultValue true
|
|
57
|
-
*/
|
|
58
|
-
autofocus?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* setting any of these props will trigger the editor gaining focus
|
|
61
|
-
*
|
|
62
|
-
* @defaultValue ["position", "readOnly", "value"]
|
|
63
|
-
*/
|
|
64
|
-
autofocusProps?: AutofocusProp[];
|
|
65
|
-
/**
|
|
66
|
-
* Whether to show matching brackets in the editor view
|
|
67
|
-
*
|
|
68
|
-
* @defaultValue true
|
|
69
|
-
*/
|
|
70
|
-
bracketMatching?: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Setting any of these props will trigger the editor to clear its undo/redo history
|
|
73
|
-
*
|
|
74
|
-
* @defaultValue ["cypherLanguage"]
|
|
75
|
-
*/
|
|
76
|
-
clearHistoryProps?: AutofocusProp[];
|
|
77
|
-
/**
|
|
78
|
-
* Whether to automatically close brackets or wrap selected text with quotes on quote press
|
|
79
|
-
*
|
|
80
|
-
* @defaultValue true
|
|
81
|
-
*/
|
|
82
|
-
closeBrackets?: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Whether the wide cursor should be shown
|
|
85
|
-
*
|
|
86
|
-
* @defaultValue true
|
|
87
|
-
*/
|
|
88
|
-
cursorWide?: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* Whether or not cypher language extensions are enabled
|
|
91
|
-
*
|
|
92
|
-
* @defaultValue true
|
|
93
|
-
*/
|
|
94
|
-
cypherLanguage?: boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Whether the editor maintains an undo/redo history
|
|
97
|
-
*
|
|
98
|
-
* @defaultValue true
|
|
99
|
-
*/
|
|
100
|
-
history?: boolean;
|
|
101
|
-
/**
|
|
102
|
-
* The indent text to use when tabKey is enabled
|
|
103
|
-
*
|
|
104
|
-
* @defaultValue " "
|
|
105
|
-
*/
|
|
106
|
-
indentUnit?: string;
|
|
107
|
-
/**
|
|
108
|
-
* The formatter for the line numbers of the editor
|
|
109
|
-
*
|
|
110
|
-
* @defaultValue (line, lineCount) => lineCount === 1 ? "$" : line + "";
|
|
111
|
-
*/
|
|
112
|
-
lineNumberFormatter?: LineNumberFormatter;
|
|
113
|
-
/**
|
|
114
|
-
* Whether line numbers are shown to the left of the editor ui
|
|
115
|
-
*
|
|
116
|
-
* @defaultValue true
|
|
117
|
-
*/
|
|
118
|
-
lineNumbers?: boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Whether the editor wraps lines vs using a horizontal scrollbar
|
|
121
|
-
*
|
|
122
|
-
* @defaultValue false
|
|
123
|
-
*/
|
|
124
|
-
lineWrapping?: boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Whether the editor should display lint errors to the user
|
|
127
|
-
*
|
|
128
|
-
* @defaultValue false
|
|
129
|
-
*/
|
|
130
|
-
lint?: boolean;
|
|
131
|
-
/**
|
|
132
|
-
* Whether to run the cypher language parser immediately after every call to set the value
|
|
133
|
-
*
|
|
134
|
-
* @defaultValue true
|
|
135
|
-
*/
|
|
136
|
-
parseOnSetValue?: boolean;
|
|
137
|
-
/**
|
|
138
|
-
* The text to be shown to the user when the editor value is empty
|
|
139
|
-
*/
|
|
140
|
-
placeholder?: string;
|
|
141
|
-
/**
|
|
142
|
-
* The editor cursor position
|
|
143
|
-
*/
|
|
144
|
-
position?: PositionAny;
|
|
145
|
-
/**
|
|
146
|
-
* Whether the editor is read only or the user can edit the editor's value
|
|
147
|
-
*
|
|
148
|
-
* @defaultValue false
|
|
149
|
-
*/
|
|
150
|
-
readOnly?: boolean;
|
|
151
|
-
/**
|
|
152
|
-
* Whether to show the cursor when the editor readOnly is true
|
|
153
|
-
*
|
|
154
|
-
* @defaultValue false
|
|
155
|
-
*/
|
|
156
|
-
readOnlyCursor?: boolean;
|
|
157
|
-
/**
|
|
158
|
-
* The schema making the editor aware of things such as node labels & relationship types & procedures in the current graph database
|
|
159
|
-
*/
|
|
160
|
-
schema?: EditorSupportSchema;
|
|
161
|
-
/**
|
|
162
|
-
* Whether search is enabled
|
|
163
|
-
*
|
|
164
|
-
* @defaultValue true
|
|
165
|
-
*/
|
|
166
|
-
search?: boolean;
|
|
167
|
-
/**
|
|
168
|
-
* The max number of search matches to be included with search changed callbacks
|
|
169
|
-
*
|
|
170
|
-
* @remarks
|
|
171
|
-
*
|
|
172
|
-
* Must be between 0 and 1000, 0 means no searching for matches (better for performance)
|
|
173
|
-
*
|
|
174
|
-
* @defaultValue 0
|
|
175
|
-
*/
|
|
176
|
-
searchMatches?: number;
|
|
177
|
-
/**
|
|
178
|
-
* Whether the search panel is open
|
|
179
|
-
*
|
|
180
|
-
* @remarks
|
|
181
|
-
*
|
|
182
|
-
* Changing this can be used to manually control the search open state
|
|
183
|
-
*
|
|
184
|
-
* @defaultValue `false`
|
|
185
|
-
*/
|
|
186
|
-
searchOpen?: boolean;
|
|
187
|
-
/**
|
|
188
|
-
* The search text for the search panel
|
|
189
|
-
*
|
|
190
|
-
* @remarks
|
|
191
|
-
*
|
|
192
|
-
* Changing this can be used to manually control the search panel text
|
|
193
|
-
*
|
|
194
|
-
* @defaultValue ""
|
|
195
|
-
*/
|
|
196
|
-
searchText?: string;
|
|
197
|
-
/**
|
|
198
|
-
* Whether search is shown at the top of the editor window
|
|
199
|
-
*
|
|
200
|
-
* @defaultValue false
|
|
201
|
-
*/
|
|
202
|
-
searchTop?: boolean;
|
|
203
|
-
/**
|
|
204
|
-
* The editor text selection
|
|
205
|
-
*
|
|
206
|
-
* @defaultValue undefined
|
|
207
|
-
*/
|
|
208
|
-
selection?: EditorSelection;
|
|
209
|
-
/**
|
|
210
|
-
* Whether the tab key is enabled
|
|
211
|
-
*
|
|
212
|
-
* @defaultValue true
|
|
213
|
-
*/
|
|
214
|
-
tabKey?: boolean;
|
|
215
|
-
/**
|
|
216
|
-
* Whether to use the light or dark theme for the editor
|
|
217
|
-
*
|
|
218
|
-
* @defaultValue "light"
|
|
219
|
-
*/
|
|
220
|
-
theme?: Theme;
|
|
221
|
-
/**
|
|
222
|
-
* Whether or not the tooltips use simple absolute position styling (vs trying to stay within bounds)
|
|
223
|
-
*
|
|
224
|
-
* @defaultValue true
|
|
225
|
-
*/
|
|
226
|
-
tooltipAbsolute?: boolean;
|
|
227
|
-
/**
|
|
228
|
-
* The editor text value
|
|
229
|
-
*
|
|
230
|
-
* @defaultValue ""
|
|
231
|
-
*/
|
|
232
|
-
value?: string;
|
|
233
|
-
/**
|
|
234
|
-
* A css class name to be added to the root editor dom element
|
|
235
|
-
*/
|
|
236
|
-
className?: string;
|
|
237
|
-
/**
|
|
238
|
-
* A css class name to be added to the root editor dom element when it is focused
|
|
239
|
-
*/
|
|
240
|
-
focusedClassName?: string;
|
|
241
|
-
/**
|
|
242
|
-
* a style prop to be applied to the root editor dom element
|
|
243
|
-
*/
|
|
244
|
-
style?: React.CSSProperties;
|
|
245
|
-
/**
|
|
246
|
-
* A listener for when the editor api gets created
|
|
247
|
-
*/
|
|
248
|
-
onEditorCreated?: EditorCreatedListener;
|
|
249
|
-
/**
|
|
250
|
-
* A listener for when the editor value changes
|
|
251
|
-
*/
|
|
252
|
-
onValueChanged?: ValueChangedListener;
|
|
253
|
-
/**
|
|
254
|
-
* A listener for when the editor focus changes
|
|
255
|
-
*/
|
|
256
|
-
onFocusChanged?: FocusChangedListener;
|
|
257
|
-
/**
|
|
258
|
-
* A listener for when the editor scroll position changes
|
|
259
|
-
*/
|
|
260
|
-
onScrollChanged?: ScrollChangedListener;
|
|
261
|
-
/**
|
|
262
|
-
* A listener for when the editor cursor position changes
|
|
263
|
-
*/
|
|
264
|
-
onPositionChanged?: PositionChangedListener;
|
|
265
|
-
/**
|
|
266
|
-
* A listener for when the editor autocompletion state changes
|
|
267
|
-
*/
|
|
268
|
-
onAutocompleteChanged?: AutocompleteChangedListener;
|
|
269
|
-
/**
|
|
270
|
-
* A listener for when the editor search state changes
|
|
271
|
-
*/
|
|
272
|
-
onSearchChanged?: SearchChangedListener;
|
|
273
|
-
/**
|
|
274
|
-
* A listener for when the editor text selection changes
|
|
275
|
-
*/
|
|
276
|
-
onSelectionChanged?: SelectionChangedListener;
|
|
277
|
-
/**
|
|
278
|
-
* A listener for when the user clicks an editor line number
|
|
279
|
-
*/
|
|
280
|
-
onLineNumberClick?: LineNumberClickListener;
|
|
281
|
-
/**
|
|
282
|
-
* A listener for when the user performs a key down in the editor
|
|
283
|
-
*/
|
|
284
|
-
onKeyDown?: KeyListener;
|
|
285
|
-
/**
|
|
286
|
-
* A listener for when the user performs a key up in the editor
|
|
287
|
-
*/
|
|
288
|
-
onKeyUp?: KeyListener;
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* The codemirror 6 extensions that should be added to the editor before the cypher language support extensions.
|
|
292
|
-
*
|
|
293
|
-
* @defaultValue undefined
|
|
294
|
-
*/
|
|
295
|
-
preExtensions?: Extension[];
|
|
296
|
-
/**
|
|
297
|
-
* The codemirror 6 extensions that should be added to the editor after the cypher language support extensions.
|
|
298
|
-
*
|
|
299
|
-
* @defaultValue undefined
|
|
300
|
-
*/
|
|
301
|
-
postExtensions?: Extension[];
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Cypher Editor React Component
|
|
306
|
-
*/
|
|
307
|
-
export default class CypherEditor extends React.Component<
|
|
308
|
-
CypherEditorProps,
|
|
309
|
-
any
|
|
310
|
-
> {}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This package provides a React Cypher Editor component
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
*
|
|
6
|
-
* The props for this component are defined by the {@link react-codemirror#CypherEditorProps | CypherEditorProps} interface
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* Here's some example code using the props:
|
|
10
|
-
*
|
|
11
|
-
* ```ts
|
|
12
|
-
* const props = { autocomplete: false };
|
|
13
|
-
* <CypherEditor {...props} />
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @packageDocumentation
|
|
17
|
-
*/
|
|
18
|
-
export { default as CypherEditor, CypherEditorProps } from "./CypherEditor";
|