@neo4j-cypher/react-codemirror 2.0.0-next.4 → 2.0.0-next.40
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 +350 -0
- package/README.md +3 -2
- package/dist/src/CypherEditor.d.ts +243 -0
- package/dist/src/CypherEditor.js +513 -0
- package/dist/src/CypherEditor.js.map +1 -0
- package/dist/src/CypherEditor.test.js +154 -0
- package/dist/src/CypherEditor.test.js.map +1 -0
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/constants.js +2 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/diffView.d.ts +13 -0
- package/dist/src/diffView.js +11 -0
- package/dist/src/diffView.js.map +1 -0
- package/dist/src/e2e_tests/autoCompletion.spec.js +335 -0
- package/dist/src/e2e_tests/autoCompletion.spec.js.map +1 -0
- package/dist/src/e2e_tests/configuration.spec.js +83 -0
- package/dist/src/e2e_tests/configuration.spec.js.map +1 -0
- package/dist/src/e2e_tests/debounce.spec.js +66 -0
- package/dist/src/e2e_tests/debounce.spec.js.map +1 -0
- package/dist/{types/e2e_tests/e2e-utils.d.ts → src/e2e_tests/e2eUtils.d.ts} +2 -0
- package/dist/src/e2e_tests/e2eUtils.js +79 -0
- package/dist/src/e2e_tests/e2eUtils.js.map +1 -0
- package/dist/src/e2e_tests/extraKeybindings.spec.js +43 -0
- package/dist/src/e2e_tests/extraKeybindings.spec.js.map +1 -0
- package/dist/src/e2e_tests/historyNavigation.spec.js +227 -0
- package/dist/src/e2e_tests/historyNavigation.spec.js.map +1 -0
- package/dist/src/e2e_tests/performanceTest.spec.d.ts +6 -0
- package/dist/src/e2e_tests/performanceTest.spec.js +97 -0
- package/dist/src/e2e_tests/performanceTest.spec.js.map +1 -0
- package/dist/src/e2e_tests/sanityChecks.spec.js +64 -0
- package/dist/src/e2e_tests/sanityChecks.spec.js.map +1 -0
- package/dist/src/e2e_tests/signatureHelp.spec.js +227 -0
- package/dist/src/e2e_tests/signatureHelp.spec.js.map +1 -0
- package/dist/src/e2e_tests/snippets.spec.js +14 -0
- package/dist/src/e2e_tests/snippets.spec.js.map +1 -0
- package/dist/src/e2e_tests/syntaxHighlighting.spec.d.ts +1 -0
- package/dist/src/e2e_tests/syntaxHighlighting.spec.js +90 -0
- package/dist/src/e2e_tests/syntaxHighlighting.spec.js.map +1 -0
- package/dist/src/e2e_tests/syntaxValidation.spec.d.ts +1 -0
- package/dist/src/e2e_tests/syntaxValidation.spec.js +129 -0
- package/dist/src/e2e_tests/syntaxValidation.spec.js.map +1 -0
- package/dist/src/editorActions.d.ts +17 -0
- package/dist/src/editorActions.js +194 -0
- package/dist/src/editorActions.js.map +1 -0
- package/dist/src/historyNavigation.js +163 -0
- package/dist/src/historyNavigation.js.map +1 -0
- package/dist/src/hostCallbacks.d.ts +9 -0
- package/dist/src/hostCallbacks.js +2 -0
- package/dist/src/hostCallbacks.js.map +1 -0
- package/dist/{types → src}/icons.d.ts +1 -1
- package/dist/src/icons.js +62 -0
- package/dist/src/icons.js.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/inlinePanel.d.ts +27 -0
- package/dist/src/inlinePanel.js +86 -0
- package/dist/src/inlinePanel.js.map +1 -0
- package/dist/src/lang-cypher/autocomplete.d.ts +6 -0
- package/dist/src/lang-cypher/autocomplete.js +116 -0
- package/dist/src/lang-cypher/autocomplete.js.map +1 -0
- package/dist/{types → src}/lang-cypher/constants.d.ts +13 -0
- package/dist/src/lang-cypher/constants.js +74 -0
- package/dist/src/lang-cypher/constants.js.map +1 -0
- package/dist/src/lang-cypher/contants.test.d.ts +1 -0
- package/dist/src/lang-cypher/contants.test.js +103 -0
- package/dist/src/lang-cypher/contants.test.js.map +1 -0
- package/dist/{types/lang-cypher/create-cypher-theme.d.ts → src/lang-cypher/createCypherTheme.d.ts} +12 -1
- package/dist/src/lang-cypher/createCypherTheme.js +202 -0
- package/dist/src/lang-cypher/createCypherTheme.js.map +1 -0
- package/dist/src/lang-cypher/langCypher.d.ts +14 -0
- package/dist/src/lang-cypher/langCypher.js +23 -0
- package/dist/src/lang-cypher/langCypher.js.map +1 -0
- package/dist/src/lang-cypher/lintWorker.mjs +2035 -0
- package/dist/src/lang-cypher/parser-adapter.d.ts +19 -0
- package/dist/src/lang-cypher/parser-adapter.js +112 -0
- package/dist/src/lang-cypher/parser-adapter.js.map +1 -0
- package/dist/src/lang-cypher/signatureHelp.d.ts +4 -0
- package/dist/src/lang-cypher/signatureHelp.js +108 -0
- package/dist/src/lang-cypher/signatureHelp.js.map +1 -0
- package/dist/{types/lang-cypher/syntax-validation.d.ts → src/lang-cypher/syntaxValidation.d.ts} +2 -1
- package/dist/src/lang-cypher/syntaxValidation.js +60 -0
- package/dist/src/lang-cypher/syntaxValidation.js.map +1 -0
- package/dist/src/lang-cypher/themeIcons.js +22 -0
- package/dist/src/lang-cypher/themeIcons.js.map +1 -0
- package/dist/src/lang-cypher/utils.d.ts +2 -0
- package/dist/src/lang-cypher/utils.js +10 -0
- package/dist/src/lang-cypher/utils.js.map +1 -0
- package/dist/src/ndlTokensCopy.d.ts +570 -0
- package/dist/src/ndlTokensCopy.js +571 -0
- package/dist/src/ndlTokensCopy.js.map +1 -0
- package/dist/src/ndlTokensCopy.test.d.ts +1 -0
- package/dist/src/ndlTokensCopy.test.js +12 -0
- package/dist/src/ndlTokensCopy.test.js.map +1 -0
- package/dist/src/neo4jSetup.d.ts +6 -0
- package/dist/src/neo4jSetup.js +120 -0
- package/dist/src/neo4jSetup.js.map +1 -0
- package/dist/src/richClipboardCopier.d.ts +4 -0
- package/dist/src/richClipboardCopier.js +78 -0
- package/dist/src/richClipboardCopier.js.map +1 -0
- package/dist/src/richClipboardCopier.test.d.ts +1 -0
- package/dist/src/richClipboardCopier.test.js +53 -0
- package/dist/src/richClipboardCopier.test.js.map +1 -0
- package/dist/src/themes.d.ts +5 -0
- package/dist/src/themes.js +107 -0
- package/dist/src/themes.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +62 -62
- package/src/CypherEditor.test.tsx +203 -0
- package/src/CypherEditor.tsx +584 -48
- package/src/constants.ts +1 -0
- package/src/diffView.ts +24 -0
- package/src/e2e_tests/autoCompletion.spec.tsx +577 -0
- package/src/e2e_tests/configuration.spec.tsx +111 -0
- package/src/e2e_tests/debounce.spec.tsx +102 -0
- package/src/e2e_tests/{e2e-utils.ts → e2eUtils.ts} +41 -3
- package/src/e2e_tests/{extra-keybindings.spec.tsx → extraKeybindings.spec.tsx} +1 -3
- package/src/e2e_tests/{history-navigation.spec.tsx → historyNavigation.spec.tsx} +137 -18
- package/src/e2e_tests/performanceTest.spec.tsx +163 -0
- package/src/e2e_tests/{sanity-checks.spec.tsx → sanityChecks.spec.tsx} +28 -20
- package/src/e2e_tests/signatureHelp.spec.tsx +443 -0
- package/src/e2e_tests/snippets.spec.tsx +19 -0
- package/src/e2e_tests/{syntax-highlighting.spec.tsx → syntaxHighlighting.spec.tsx} +26 -24
- package/src/e2e_tests/syntaxValidation.spec.tsx +252 -0
- package/src/editorActions.ts +253 -0
- package/src/{history-navigation.ts → historyNavigation.ts} +1 -1
- package/src/hostCallbacks.ts +9 -0
- package/src/icons.ts +3 -0
- package/src/index.ts +4 -2
- package/src/inlinePanel.ts +140 -0
- package/src/lang-cypher/autocomplete.ts +98 -18
- package/src/lang-cypher/constants.ts +32 -0
- package/src/lang-cypher/contants.test.ts +7 -3
- package/src/lang-cypher/{create-cypher-theme.ts → createCypherTheme.ts} +85 -23
- package/src/lang-cypher/langCypher.ts +46 -0
- package/src/lang-cypher/lintWorker.mjs +2035 -0
- package/src/lang-cypher/parser-adapter.ts +145 -0
- package/src/lang-cypher/signatureHelp.ts +154 -0
- package/src/lang-cypher/syntaxValidation.ts +76 -0
- package/src/lang-cypher/utils.ts +9 -0
- package/src/{ndl-tokens-copy.test.ts → ndlTokensCopy.test.ts} +2 -1
- package/src/ndlTokensCopy.ts +570 -0
- package/src/{neo4j-setup.tsx → neo4jSetup.tsx} +78 -17
- package/src/richClipboardCopier.test.ts +65 -0
- package/src/richClipboardCopier.ts +99 -0
- package/src/themes.ts +61 -69
- package/src/viteEnv.d.ts +1 -0
- package/dist/cjs/index.cjs +0 -1441
- package/dist/cjs/index.cjs.map +0 -7
- package/dist/esm/index.mjs +0 -1464
- package/dist/esm/index.mjs.map +0 -7
- package/dist/types/CypherEditor.d.ts +0 -113
- package/dist/types/e2e_tests/mock-data.d.ts +0 -3779
- package/dist/types/index.d.ts +0 -4
- package/dist/types/lang-cypher/ParserAdapter.d.ts +0 -14
- package/dist/types/lang-cypher/autocomplete.d.ts +0 -3
- package/dist/types/lang-cypher/lang-cypher.d.ts +0 -7
- package/dist/types/ndl-tokens-copy.d.ts +0 -379
- package/dist/types/neo4j-setup.d.ts +0 -2
- package/dist/types/themes.d.ts +0 -11
- package/dist/types/tsconfig.tsbuildinfo +0 -1
- package/src/e2e_tests/auto-completion.spec.tsx +0 -232
- package/src/e2e_tests/mock-data.ts +0 -4310
- package/src/e2e_tests/performance-test.spec.tsx +0 -71
- package/src/e2e_tests/syntax-validation.spec.tsx +0 -156
- package/src/lang-cypher/ParserAdapter.ts +0 -92
- package/src/lang-cypher/lang-cypher.ts +0 -32
- package/src/lang-cypher/syntax-validation.ts +0 -24
- package/src/ndl-tokens-copy.ts +0 -379
- /package/dist/{types/e2e_tests/auto-completion.spec.d.ts → src/CypherEditor.test.d.ts} +0 -0
- /package/dist/{types/e2e_tests/extra-keybindings.spec.d.ts → src/e2e_tests/autoCompletion.spec.d.ts} +0 -0
- /package/dist/{types/e2e_tests/history-navigation.spec.d.ts → src/e2e_tests/configuration.spec.d.ts} +0 -0
- /package/dist/{types/e2e_tests/performance-test.spec.d.ts → src/e2e_tests/debounce.spec.d.ts} +0 -0
- /package/dist/{types/e2e_tests/sanity-checks.spec.d.ts → src/e2e_tests/extraKeybindings.spec.d.ts} +0 -0
- /package/dist/{types/e2e_tests/syntax-highlighting.spec.d.ts → src/e2e_tests/historyNavigation.spec.d.ts} +0 -0
- /package/dist/{types/e2e_tests/syntax-validation.spec.d.ts → src/e2e_tests/sanityChecks.spec.d.ts} +0 -0
- /package/dist/{types/lang-cypher/contants.test.d.ts → src/e2e_tests/signatureHelp.spec.d.ts} +0 -0
- /package/dist/{types/ndl-tokens-copy.test.d.ts → src/e2e_tests/snippets.spec.d.ts} +0 -0
- /package/dist/{types/history-navigation.d.ts → src/historyNavigation.d.ts} +0 -0
- /package/dist/{types/lang-cypher/theme-icons.d.ts → src/lang-cypher/themeIcons.d.ts} +0 -0
- /package/src/lang-cypher/{theme-icons.ts → themeIcons.ts} +0 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { testData } from '@neo4j-cypher/language-support';
|
|
2
|
+
import { expect, test } from '@playwright/experimental-ct-react';
|
|
3
|
+
import { CypherEditor } from '../CypherEditor';
|
|
4
|
+
import { CypherEditorPage } from './e2eUtils';
|
|
5
|
+
|
|
6
|
+
test.use({ viewport: { width: 1000, height: 500 } });
|
|
7
|
+
test('Prop lint set to false disables syntax validation', async ({
|
|
8
|
+
page,
|
|
9
|
+
mount,
|
|
10
|
+
}) => {
|
|
11
|
+
const query = 'METCH (n) RETURN n';
|
|
12
|
+
|
|
13
|
+
await mount(<CypherEditor value={query} lint={false} />);
|
|
14
|
+
|
|
15
|
+
await expect(page.locator('.cm-lintRange-error').last()).not.toBeVisible({
|
|
16
|
+
timeout: 10000,
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('Can turn linting back on', async ({ page, mount }) => {
|
|
21
|
+
const editorPage = new CypherEditorPage(page);
|
|
22
|
+
const query = 'METCH (n) RETURN n';
|
|
23
|
+
|
|
24
|
+
const component = await mount(<CypherEditor value={query} lint={false} />);
|
|
25
|
+
|
|
26
|
+
await expect(page.locator('.cm-lintRange-error').last()).not.toBeVisible({
|
|
27
|
+
timeout: 10000,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
await component.update(<CypherEditor value={query} lint={true} />);
|
|
31
|
+
|
|
32
|
+
await editorPage.getEditor().fill('METCH (n) RETURN n');
|
|
33
|
+
|
|
34
|
+
await editorPage.checkErrorMessage(
|
|
35
|
+
'METCH',
|
|
36
|
+
`Invalid input 'METCH': expected 'ALTER', 'ORDER BY', 'CALL', 'USING PERIODIC COMMIT', 'CREATE', 'LOAD CSV', 'START DATABASE', 'STOP DATABASE', 'DEALLOCATE', 'DELETE', 'DENY', 'DETACH', 'DROP', 'DRYRUN', 'FINISH', 'FOREACH', 'GRANT', 'INSERT', 'LIMIT', 'MATCH', 'MERGE', 'NODETACH', 'OFFSET', 'OPTIONAL', 'REALLOCATE', 'REMOVE', 'RENAME', 'RETURN', 'REVOKE', 'ENABLE SERVER', 'SET', 'SHOW', 'SKIP', 'TERMINATE', 'UNWIND', 'USE' or 'WITH'`,
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('Syntactic errors are surfaced', async ({ page, mount }) => {
|
|
41
|
+
const editorPage = new CypherEditorPage(page);
|
|
42
|
+
const query = 'METCH (n) RETURN n';
|
|
43
|
+
|
|
44
|
+
await mount(<CypherEditor value={query} />);
|
|
45
|
+
|
|
46
|
+
await editorPage.checkErrorMessage(
|
|
47
|
+
'METCH',
|
|
48
|
+
`Invalid input 'METCH': expected 'ALTER', 'ORDER BY', 'CALL', 'USING PERIODIC COMMIT', 'CREATE', 'LOAD CSV', 'START DATABASE', 'STOP DATABASE', 'DEALLOCATE', 'DELETE', 'DENY', 'DETACH', 'DROP', 'DRYRUN', 'FINISH', 'FOREACH', 'GRANT', 'INSERT', 'LIMIT', 'MATCH', 'MERGE', 'NODETACH', 'OFFSET', 'OPTIONAL', 'REALLOCATE', 'REMOVE', 'RENAME', 'RETURN', 'REVOKE', 'ENABLE SERVER', 'SET', 'SHOW', 'SKIP', 'TERMINATE', 'UNWIND', 'USE' or 'WITH'`,
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('Does not trigger syntax errors for backticked parameters in parameter creation', async ({
|
|
53
|
+
page,
|
|
54
|
+
mount,
|
|
55
|
+
}) => {
|
|
56
|
+
const editorPage = new CypherEditorPage(page);
|
|
57
|
+
|
|
58
|
+
const query = ':param x => "abc"';
|
|
59
|
+
await mount(<CypherEditor value={query} />);
|
|
60
|
+
|
|
61
|
+
await editorPage.checkNoNotificationMessage('error');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('Errors for undefined labels are surfaced', async ({ page, mount }) => {
|
|
65
|
+
const editorPage = new CypherEditorPage(page);
|
|
66
|
+
const query = 'MATCH (n: Person) RETURN n';
|
|
67
|
+
|
|
68
|
+
await mount(
|
|
69
|
+
<CypherEditor
|
|
70
|
+
value={query}
|
|
71
|
+
schema={{ labels: ['Movie'], relationshipTypes: [] }}
|
|
72
|
+
/>,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
await editorPage.checkWarningMessage(
|
|
76
|
+
'Person',
|
|
77
|
+
"Label Person is not present in the database. Make sure you didn't misspell it or that it is available when you run this statement in your application",
|
|
78
|
+
);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('Errors for multiline undefined labels are highlighted correctly', async ({
|
|
82
|
+
page,
|
|
83
|
+
mount,
|
|
84
|
+
}) => {
|
|
85
|
+
const editorPage = new CypherEditorPage(page);
|
|
86
|
+
const query = `MATCH (n:\`Foo
|
|
87
|
+
Bar\`) RETURN n`;
|
|
88
|
+
const expectedMsg = `Label \`Foo
|
|
89
|
+
Bar\` is not present in the database. Make sure you didn't misspell it or that it is available when you run this statement in your application`;
|
|
90
|
+
|
|
91
|
+
await mount(
|
|
92
|
+
<CypherEditor
|
|
93
|
+
value={query}
|
|
94
|
+
schema={{ labels: ['Movie'], relationshipTypes: [] }}
|
|
95
|
+
/>,
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
await editorPage.checkWarningMessage('`Foo', expectedMsg);
|
|
99
|
+
await editorPage.checkWarningMessage('Bar`', expectedMsg);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('Semantic errors work in firefox', async ({
|
|
103
|
+
browserName,
|
|
104
|
+
page,
|
|
105
|
+
mount,
|
|
106
|
+
}) => {
|
|
107
|
+
test.skip(browserName !== 'firefox');
|
|
108
|
+
const editorPage = new CypherEditorPage(page);
|
|
109
|
+
const query = 'MATCH (n:OperationalPoint)--(m:OperationalPoint) RETURN s,m,n';
|
|
110
|
+
|
|
111
|
+
await mount(<CypherEditor value={query} schema={testData.mockSchema} />);
|
|
112
|
+
|
|
113
|
+
await editorPage.checkErrorMessage('s,m,n', 'Variable `s` not defined');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('Semantic errors are surfaced when there are no syntactic errors', async ({
|
|
117
|
+
page,
|
|
118
|
+
mount,
|
|
119
|
+
}) => {
|
|
120
|
+
const editorPage = new CypherEditorPage(page);
|
|
121
|
+
const query = 'MATCH (n) RETURN m';
|
|
122
|
+
|
|
123
|
+
await mount(<CypherEditor value={query} />);
|
|
124
|
+
|
|
125
|
+
await editorPage.checkErrorMessage('m', 'Variable `m` not defined');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('Semantic errors are correctly accumulated', async ({ page, mount }) => {
|
|
129
|
+
const editorPage = new CypherEditorPage(page);
|
|
130
|
+
const query = 'CALL { MATCH (n) } IN TRANSACTIONS OF -1 ROWS';
|
|
131
|
+
|
|
132
|
+
await mount(<CypherEditor value={query} />);
|
|
133
|
+
|
|
134
|
+
await editorPage.checkErrorMessage(
|
|
135
|
+
'-1',
|
|
136
|
+
"Invalid input. '-1' is not a valid value. Must be a positive integer.",
|
|
137
|
+
);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test('Multiline errors are correctly placed', async ({ page, mount }) => {
|
|
141
|
+
const editorPage = new CypherEditorPage(page);
|
|
142
|
+
const query = `CALL {
|
|
143
|
+
MATCH (n)
|
|
144
|
+
} IN TRANSACTIONS
|
|
145
|
+
OF -1 ROWS`;
|
|
146
|
+
|
|
147
|
+
await mount(<CypherEditor value={query} />);
|
|
148
|
+
|
|
149
|
+
await editorPage.checkErrorMessage(
|
|
150
|
+
'-1',
|
|
151
|
+
"Invalid input. '-1' is not a valid value. Must be a positive integer.",
|
|
152
|
+
);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test('Validation errors are correctly overlapped', async ({ page, mount }) => {
|
|
156
|
+
const editorPage = new CypherEditorPage(page);
|
|
157
|
+
const query = `CALL { MATCH (n)
|
|
158
|
+
RETURN n
|
|
159
|
+
} IN TRANSACTIONS
|
|
160
|
+
OF -1 ROWS`;
|
|
161
|
+
|
|
162
|
+
await mount(<CypherEditor value={query} />);
|
|
163
|
+
|
|
164
|
+
await editorPage.checkErrorMessage(
|
|
165
|
+
'-1',
|
|
166
|
+
"Invalid input. '-1' is not a valid value. Must be a positive integer.",
|
|
167
|
+
);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
test('Syntax highlighting works as expected with multiple separate linting messages', async ({
|
|
171
|
+
page,
|
|
172
|
+
mount,
|
|
173
|
+
}) => {
|
|
174
|
+
const editorPage = new CypherEditorPage(page);
|
|
175
|
+
const query = `MATCH (n)--(m) CALL (n) {RETURN id(n) AS b} RETURN apoc.create.uuid(), a`;
|
|
176
|
+
|
|
177
|
+
await mount(<CypherEditor value={query} schema={testData.mockSchema} />);
|
|
178
|
+
await expect(
|
|
179
|
+
editorPage.page.locator('.cm-deprecated-element').last(),
|
|
180
|
+
).toBeVisible({
|
|
181
|
+
timeout: 10000,
|
|
182
|
+
});
|
|
183
|
+
await editorPage.checkWarningMessage('id', 'Function id is deprecated.');
|
|
184
|
+
await editorPage.checkWarningMessage(
|
|
185
|
+
'id',
|
|
186
|
+
`The query used a deprecated function. ('id' has been replaced by 'elementId or consider using an application-generated id')`,
|
|
187
|
+
);
|
|
188
|
+
await editorPage.checkWarningMessage(
|
|
189
|
+
'apoc.create.uuid',
|
|
190
|
+
'Function apoc.create.uuid is deprecated. Alternative: Neo4j randomUUID() function',
|
|
191
|
+
);
|
|
192
|
+
await editorPage.checkErrorMessage('a', 'Variable `a` not defined');
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test('Strikethroughs are shown for deprecated functions', async ({
|
|
196
|
+
page,
|
|
197
|
+
mount,
|
|
198
|
+
}) => {
|
|
199
|
+
const editorPage = new CypherEditorPage(page);
|
|
200
|
+
const query = `RETURN id(1)`;
|
|
201
|
+
|
|
202
|
+
await mount(<CypherEditor value={query} schema={testData.mockSchema} />);
|
|
203
|
+
await expect(
|
|
204
|
+
editorPage.page.locator('.cm-deprecated-element').last(),
|
|
205
|
+
).toBeVisible({
|
|
206
|
+
timeout: 10000,
|
|
207
|
+
});
|
|
208
|
+
await editorPage.checkWarningMessage('id', 'Function id is deprecated.');
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
test('Strikethroughs are shown for deprecated procedures', async ({
|
|
212
|
+
page,
|
|
213
|
+
mount,
|
|
214
|
+
}) => {
|
|
215
|
+
const editorPage = new CypherEditorPage(page);
|
|
216
|
+
const query = `CALL apoc.create.uuids(5)`;
|
|
217
|
+
|
|
218
|
+
await mount(<CypherEditor value={query} schema={testData.mockSchema} />);
|
|
219
|
+
await expect(
|
|
220
|
+
editorPage.page.locator('.cm-deprecated-element').last(),
|
|
221
|
+
).toBeVisible({
|
|
222
|
+
timeout: 10000,
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
await editorPage.checkWarningMessage(
|
|
226
|
+
'apoc.create.uuids',
|
|
227
|
+
"Procedure apoc.create.uuids is deprecated. Alternative: Neo4j's randomUUID() function can be used as a replacement, for example: `UNWIND range(0,$count) AS row RETURN row, randomUUID() AS uuid`",
|
|
228
|
+
);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test('Syntax validation depends on the Cypher version', async ({
|
|
232
|
+
page,
|
|
233
|
+
mount,
|
|
234
|
+
}) => {
|
|
235
|
+
await mount(<CypherEditor schema={testData.mockSchema} />);
|
|
236
|
+
|
|
237
|
+
const editorPage = new CypherEditorPage(page);
|
|
238
|
+
const textField = page.getByRole('textbox');
|
|
239
|
+
await textField.fill('CYPHER 5 CALL apoc.create.uuids(5)');
|
|
240
|
+
|
|
241
|
+
await editorPage.checkWarningMessage(
|
|
242
|
+
'apoc.create.uuids',
|
|
243
|
+
"Procedure apoc.create.uuids is deprecated. Alternative: Neo4j's randomUUID() function can be used as a replacement, for example: `UNWIND range(0,$count) AS row RETURN row, randomUUID() AS uuid`",
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
await textField.fill('CYPHER 25 CALL apoc.create.uuids(5)');
|
|
247
|
+
|
|
248
|
+
await editorPage.checkErrorMessage(
|
|
249
|
+
'apoc.create.uuids',
|
|
250
|
+
`Procedure apoc.create.uuids is not present in the database. Make sure you didn't misspell it or that it is available when you run this statement in your application`,
|
|
251
|
+
);
|
|
252
|
+
});
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { StateEffect, StateField, type Extension } from '@codemirror/state';
|
|
2
|
+
import {
|
|
3
|
+
Decoration,
|
|
4
|
+
EditorView,
|
|
5
|
+
ViewPlugin,
|
|
6
|
+
type ViewUpdate,
|
|
7
|
+
WidgetType,
|
|
8
|
+
} from '@codemirror/view';
|
|
9
|
+
import type { HostPortalCallbacks } from './hostCallbacks';
|
|
10
|
+
|
|
11
|
+
/** Lifecycle callbacks for the editor action buttons. See {@link HostPortalCallbacks}. */
|
|
12
|
+
export type EditorActionsCallbacks = HostPortalCallbacks;
|
|
13
|
+
|
|
14
|
+
export type EditorActionsController = {
|
|
15
|
+
/** CodeMirror extension to register on the editor. */
|
|
16
|
+
extension: Extension;
|
|
17
|
+
/**
|
|
18
|
+
* Drive the action buttons from the host's state: pass callbacks to mount
|
|
19
|
+
* them, or `null` to unmount. Returns the effect for the host to dispatch.
|
|
20
|
+
*
|
|
21
|
+
* Visibility is purely a function of whether callbacks exist — there's no
|
|
22
|
+
* separate show/hide toggle.
|
|
23
|
+
*/
|
|
24
|
+
set: (callbacks: EditorActionsCallbacks | null) => StateEffect<boolean>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Renders a host-provided cluster of action buttons at the top-right corner
|
|
29
|
+
* of the editor.
|
|
30
|
+
*
|
|
31
|
+
* The cluster is split into two cooperating pieces so it can both reserve
|
|
32
|
+
* space *and* stay pinned — which a single element can't do (reserving needs
|
|
33
|
+
* to be in flow, pinning needs to be out of it):
|
|
34
|
+
*
|
|
35
|
+
* - A **spacer**: an empty, floated inline widget at the very start of the
|
|
36
|
+
* document. Being in flow, it makes the first line's text wrap around it —
|
|
37
|
+
* and because it's a float, the browser handles arbitrary cluster heights.
|
|
38
|
+
* It carries no content; it only reserves the footprint.
|
|
39
|
+
* - An **overlay**: the real, host-rendered buttons in a container pinned
|
|
40
|
+
* `absolute` on the editor element (which does not scroll). It never moves
|
|
41
|
+
* when the document grows, when an inline panel opens above the first line,
|
|
42
|
+
* or when the content scrolls — content simply scrolls behind it.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
const SPACER_BOTTOM_GAP = 2;
|
|
46
|
+
const SPACER_LEFT_GAP = 4;
|
|
47
|
+
|
|
48
|
+
export function createEditorActionsController(): EditorActionsController {
|
|
49
|
+
const setActiveEffect = StateEffect.define<boolean>();
|
|
50
|
+
|
|
51
|
+
let callbacksRef: EditorActionsCallbacks | null = null;
|
|
52
|
+
|
|
53
|
+
const activeField = StateField.define<boolean>({
|
|
54
|
+
create: () => false,
|
|
55
|
+
update(active, transaction) {
|
|
56
|
+
for (const effect of transaction.effects) {
|
|
57
|
+
if (effect.is(setActiveEffect)) {
|
|
58
|
+
active = effect.value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return active;
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
class SpacerWidget extends WidgetType {
|
|
66
|
+
toDOM(): HTMLElement {
|
|
67
|
+
const spacer = document.createElement('div');
|
|
68
|
+
spacer.className = 'cm-editor-actions-spacer';
|
|
69
|
+
spacer.setAttribute('aria-hidden', 'true');
|
|
70
|
+
return spacer;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
eq(): boolean {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
ignoreEvent(): boolean {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const spacer = EditorView.decorations.compute(
|
|
83
|
+
['doc', activeField],
|
|
84
|
+
(state) => {
|
|
85
|
+
if (!state.field(activeField)) {
|
|
86
|
+
return Decoration.none;
|
|
87
|
+
}
|
|
88
|
+
return Decoration.set([
|
|
89
|
+
Decoration.widget({
|
|
90
|
+
widget: new SpacerWidget(),
|
|
91
|
+
side: -1,
|
|
92
|
+
}).range(0),
|
|
93
|
+
]);
|
|
94
|
+
},
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
const overlay = ViewPlugin.fromClass(
|
|
98
|
+
class {
|
|
99
|
+
private dom: HTMLElement | null = null;
|
|
100
|
+
private resizeObserver: ResizeObserver | null = null;
|
|
101
|
+
private mounted: EditorActionsCallbacks | null = null;
|
|
102
|
+
|
|
103
|
+
constructor(view: EditorView) {
|
|
104
|
+
if (view.state.field(activeField)) {
|
|
105
|
+
this.mount(view);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
update(update: ViewUpdate): void {
|
|
110
|
+
const isActive = update.state.field(activeField);
|
|
111
|
+
if (isActive && !this.dom) {
|
|
112
|
+
this.mount(update.view);
|
|
113
|
+
} else if (!isActive && this.dom) {
|
|
114
|
+
this.unmount();
|
|
115
|
+
} else if (
|
|
116
|
+
this.dom &&
|
|
117
|
+
(update.geometryChanged ||
|
|
118
|
+
update.docChanged ||
|
|
119
|
+
update.viewportChanged)
|
|
120
|
+
) {
|
|
121
|
+
this.align(update.view);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
destroy(): void {
|
|
126
|
+
this.unmount();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
private mount(view: EditorView): void {
|
|
130
|
+
const container = document.createElement('div');
|
|
131
|
+
container.className = 'cm-editor-actions';
|
|
132
|
+
view.dom.appendChild(container);
|
|
133
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
134
|
+
view.dom.style.setProperty(
|
|
135
|
+
'--cm-editor-actions-width',
|
|
136
|
+
`${container.offsetWidth}px`,
|
|
137
|
+
);
|
|
138
|
+
view.dom.style.setProperty(
|
|
139
|
+
'--cm-editor-actions-height',
|
|
140
|
+
`${container.offsetHeight}px`,
|
|
141
|
+
);
|
|
142
|
+
view.dom.style.setProperty(
|
|
143
|
+
'--cm-editor-actions-content-min-height',
|
|
144
|
+
`${container.offsetHeight + SPACER_BOTTOM_GAP}px`,
|
|
145
|
+
);
|
|
146
|
+
this.align(view);
|
|
147
|
+
});
|
|
148
|
+
this.resizeObserver.observe(container);
|
|
149
|
+
this.dom = container;
|
|
150
|
+
this.mounted = callbacksRef;
|
|
151
|
+
callbacksRef?.onMount(container);
|
|
152
|
+
this.align(view);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
private align(view: EditorView): void {
|
|
156
|
+
view.requestMeasure<{ top: number; right: number } | null>({
|
|
157
|
+
read: () => {
|
|
158
|
+
if (!this.dom) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
const editorRect = view.dom.getBoundingClientRect();
|
|
162
|
+
const spacer = view.dom.querySelector('.cm-editor-actions-spacer');
|
|
163
|
+
let topClient: number;
|
|
164
|
+
let rightClient: number;
|
|
165
|
+
if (spacer) {
|
|
166
|
+
const rect = spacer.getBoundingClientRect();
|
|
167
|
+
topClient = rect.top;
|
|
168
|
+
rightClient = rect.right;
|
|
169
|
+
} else {
|
|
170
|
+
const rect = view.contentDOM.getBoundingClientRect();
|
|
171
|
+
const style = window.getComputedStyle(view.contentDOM);
|
|
172
|
+
topClient = rect.top + (parseFloat(style.paddingTop) || 0);
|
|
173
|
+
rightClient = rect.right - (parseFloat(style.paddingRight) || 0);
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
top: topClient - editorRect.top + view.scrollDOM.scrollTop,
|
|
177
|
+
right: editorRect.right - rightClient - view.scrollDOM.scrollLeft,
|
|
178
|
+
};
|
|
179
|
+
},
|
|
180
|
+
write: (pos) => {
|
|
181
|
+
if (!pos || !this.dom) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
view.dom.style.setProperty(
|
|
185
|
+
'--cm-editor-actions-top',
|
|
186
|
+
`${pos.top}px`,
|
|
187
|
+
);
|
|
188
|
+
view.dom.style.setProperty(
|
|
189
|
+
'--cm-editor-actions-right',
|
|
190
|
+
`${pos.right}px`,
|
|
191
|
+
);
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
private unmount(): void {
|
|
197
|
+
if (!this.dom) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
this.resizeObserver?.disconnect();
|
|
201
|
+
this.resizeObserver = null;
|
|
202
|
+
this.mounted?.onUnmount();
|
|
203
|
+
this.mounted = null;
|
|
204
|
+
const root = this.dom?.parentElement;
|
|
205
|
+
if (root) {
|
|
206
|
+
root.style.removeProperty('--cm-editor-actions-width');
|
|
207
|
+
root.style.removeProperty('--cm-editor-actions-height');
|
|
208
|
+
root.style.removeProperty('--cm-editor-actions-content-min-height');
|
|
209
|
+
root.style.removeProperty('--cm-editor-actions-top');
|
|
210
|
+
root.style.removeProperty('--cm-editor-actions-right');
|
|
211
|
+
}
|
|
212
|
+
this.dom?.remove();
|
|
213
|
+
this.dom = null;
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
const theme = EditorView.theme({
|
|
219
|
+
'.cm-content': {
|
|
220
|
+
minHeight: 'var(--cm-editor-actions-content-min-height, 0px)',
|
|
221
|
+
},
|
|
222
|
+
'.cm-editor-actions-spacer': {
|
|
223
|
+
float: 'right',
|
|
224
|
+
boxSizing: 'content-box',
|
|
225
|
+
width: 'var(--cm-editor-actions-width, 0px)',
|
|
226
|
+
height: 'var(--cm-editor-actions-height, 0px)',
|
|
227
|
+
paddingLeft: `${SPACER_LEFT_GAP}px`,
|
|
228
|
+
paddingBottom: `${SPACER_BOTTOM_GAP}px`,
|
|
229
|
+
userSelect: 'none',
|
|
230
|
+
WebkitUserSelect: 'none',
|
|
231
|
+
pointerEvents: 'none',
|
|
232
|
+
},
|
|
233
|
+
'.cm-placeholder': {
|
|
234
|
+
display: 'inline',
|
|
235
|
+
},
|
|
236
|
+
'.cm-editor-actions': {
|
|
237
|
+
position: 'absolute',
|
|
238
|
+
top: 'var(--cm-editor-actions-top, 0px)',
|
|
239
|
+
right: 'var(--cm-editor-actions-right, 0px)',
|
|
240
|
+
zIndex: '2',
|
|
241
|
+
userSelect: 'none',
|
|
242
|
+
WebkitUserSelect: 'none',
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
return {
|
|
247
|
+
extension: [activeField, spacer, overlay, theme],
|
|
248
|
+
set: (callbacks) => {
|
|
249
|
+
callbacksRef = callbacks;
|
|
250
|
+
return setActiveEffect.of(callbacks !== null);
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
}
|
|
@@ -97,7 +97,7 @@ function navigateHistory(view: EditorView, direction: HistoryNavigation) {
|
|
|
97
97
|
view.dispatch(
|
|
98
98
|
view.state.update({
|
|
99
99
|
effects: moveInHistory.of(direction),
|
|
100
|
-
selection: { anchor: view.state.doc.length },
|
|
100
|
+
selection: { anchor: direction === 'BACK' ? 0 : view.state.doc.length },
|
|
101
101
|
}),
|
|
102
102
|
);
|
|
103
103
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lifecycle callbacks for host-rendered overlay content (inline panels, editor
|
|
3
|
+
* action buttons, …). The host renders into the provided DOM container (e.g.
|
|
4
|
+
* via React `createPortal`) and is expected to clean up on unmount.
|
|
5
|
+
*/
|
|
6
|
+
export type HostPortalCallbacks = {
|
|
7
|
+
onMount: (container: HTMLElement) => void;
|
|
8
|
+
onUnmount: () => void;
|
|
9
|
+
};
|
package/src/icons.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type CompletionItemIcons =
|
|
|
23
23
|
| 'Struct'
|
|
24
24
|
| 'Event'
|
|
25
25
|
| 'Operator'
|
|
26
|
+
| 'Console'
|
|
26
27
|
| 'TypeParameter';
|
|
27
28
|
|
|
28
29
|
export function getIconForType(iconTypeString = 'Text', isDarkTheme = false) {
|
|
@@ -51,6 +52,7 @@ export function getIconForType(iconTypeString = 'Text', isDarkTheme = false) {
|
|
|
51
52
|
Struct: `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M2.00024 2L1.00024 3V6L2.00024 7H14.0002L15.0002 6V3L14.0002 2H2.00024ZM2.00024 3H3.00024H13.0002H14.0002V4V5V6H13.0002H3.00024H2.00024V5V4V3ZM1.00024 10L2.00024 9H5.00024L6.00024 10V13L5.00024 14H2.00024L1.00024 13V10ZM3.00024 10H2.00024V11V12V13H3.00024H4.00024H5.00024V12V11V10H4.00024H3.00024ZM10.0002 10L11.0002 9H14.0002L15.0002 10V13L14.0002 14H11.0002L10.0002 13V10ZM12.0002 10H11.0002V11V12V13H12.0002H13.0002H14.0002V12V11V10H13.0002H12.0002Z" fill="#424242"/> </svg>`,
|
|
52
53
|
Event: `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M7.41379 1.55996L8.31177 1H11.6059L12.4243 2.57465L10.2358 6H12.0176L12.7365 7.69512L5.61967 15L4.01699 13.837L6.11967 10H4.89822L4.00024 8.55996L7.41379 1.55996ZM7.78058 9L4.90078 14.3049L12.0176 7H8.31177L11.6059 2H8.31177L4.89822 9H7.78058Z" fill="#D67E00"/> </svg>`,
|
|
53
54
|
Operator: `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M2.87313 1.10023C3.20793 1.23579 3.4757 1.498 3.61826 1.82988C3.69056 1.99959 3.72699 2.18242 3.72526 2.36688C3.72642 2.54999 3.69 2.7314 3.61826 2.89988C3.51324 3.14567 3.33807 3.35503 3.11466 3.50177C2.89126 3.64851 2.62955 3.72612 2.36226 3.72488C2.17948 3.72592 1.99842 3.68951 1.83026 3.61788C1.58322 3.51406 1.37252 3.33932 1.22478 3.11575C1.07704 2.89219 0.99891 2.62984 1.00026 2.36188C0.999374 2.17921 1.03543 1.99825 1.10626 1.82988C1.24362 1.50314 1.50353 1.24323 1.83026 1.10588C2.16357 0.966692 2.53834 0.964661 2.87313 1.10023ZM2.57526 2.86488C2.70564 2.80913 2.80951 2.70526 2.86526 2.57488C2.89314 2.50838 2.90742 2.43698 2.90726 2.36488C2.90838 2.2654 2.88239 2.1675 2.8321 2.08167C2.7818 1.99584 2.70909 1.92531 2.62176 1.87767C2.53443 1.83002 2.43577 1.80705 2.33638 1.81121C2.23698 1.81537 2.1406 1.8465 2.05755 1.90128C1.97451 1.95606 1.90794 2.03241 1.865 2.12215C1.82205 2.21188 1.80434 2.31161 1.81376 2.41065C1.82319 2.50968 1.85939 2.60428 1.9185 2.6843C1.9776 2.76433 2.05738 2.82675 2.14926 2.86488C2.28574 2.92089 2.43878 2.92089 2.57526 2.86488ZM6.43019 1.1095L1.10992 6.42977L1.79581 7.11567L7.11608 1.7954L6.43019 1.1095ZM11.5002 8.99999H12.5002V11.5H15.0002V12.5H12.5002V15H11.5002V12.5H9.00024V11.5H11.5002V8.99999ZM5.76801 9.52509L6.47512 10.2322L4.70735 12L6.47512 13.7677L5.76801 14.4748L4.00024 12.7071L2.23248 14.4748L1.52537 13.7677L3.29314 12L1.52537 10.2322L2.23248 9.52509L4.00024 11.2929L5.76801 9.52509ZM7.11826 5.32988C7.01466 5.08268 6.83997 4.87183 6.61636 4.72406C6.39275 4.57629 6.13028 4.49826 5.86226 4.49988C5.6796 4.49899 5.49864 4.53505 5.33026 4.60588C5.00353 4.74323 4.74362 5.00314 4.60626 5.32988C4.53612 5.49478 4.49922 5.67191 4.49766 5.8511C4.4961 6.0303 4.52992 6.20804 4.59718 6.37414C4.66443 6.54024 4.76381 6.69143 4.88961 6.81906C5.0154 6.94669 5.16515 7.04823 5.33026 7.11788C5.49892 7.18848 5.67993 7.22484 5.86276 7.22484C6.0456 7.22484 6.22661 7.18848 6.39526 7.11788C6.64225 7.01388 6.85295 6.83913 7.00082 6.61563C7.1487 6.39213 7.22713 6.12987 7.22626 5.86188C7.22679 5.67905 7.19005 5.49803 7.11826 5.32988ZM6.36526 6.07488C6.3379 6.13937 6.29854 6.19808 6.24926 6.24788C6.19932 6.29724 6.14066 6.33691 6.07626 6.36488C6.00878 6.39297 5.93635 6.40725 5.86326 6.40688C5.79015 6.40744 5.71769 6.39315 5.65026 6.36488C5.58565 6.33729 5.52693 6.29757 5.47726 6.24788C5.42715 6.19856 5.38738 6.13975 5.36026 6.07488C5.30425 5.9384 5.30425 5.78536 5.36026 5.64888C5.41561 5.51846 5.51965 5.41477 5.65026 5.35988C5.71761 5.33126 5.79008 5.31663 5.86326 5.31688C5.93642 5.31685 6.00884 5.33147 6.07626 5.35988C6.14062 5.38749 6.19928 5.42682 6.24926 5.47588C6.2981 5.52603 6.33741 5.58465 6.36526 5.64888C6.39364 5.7163 6.40827 5.78872 6.40827 5.86188C6.40827 5.93503 6.39364 6.00745 6.36526 6.07488ZM14.0002 3H10.0002V4H14.0002V3Z" fill="#424242"/> </svg>`,
|
|
55
|
+
Console: `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M1.00024 1H15.0002V15H1.00024V1ZM2.00024 14H14.0002V2H2.00024V14ZM4.00032 5.70709L4.70743 4.99999L8.24296 8.53552L7.53585 9.24263L7.53583 9.2426L4.70735 12.0711L4.00024 11.364L6.82872 8.53549L4.00032 5.70709Z" fill="#424242"/> </svg>`,
|
|
54
56
|
TypeParameter: `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M11.0003 6H10.0003V5.5C10.0003 5.22386 9.7764 5 9.50026 5H8.47926V10.5C8.47926 10.7761 8.70312 11 8.97926 11H9.47926V12H6.47926V11H6.97926C7.2554 11 7.47926 10.7761 7.47926 10.5V5H6.50026C6.22412 5 6.00026 5.22386 6.00026 5.5V6H5.00026V4H11.0003V6ZM13.9145 8.0481L12.4522 6.58581L13.1593 5.87871L14.9751 7.69454V8.40165L13.2074 10.1694L12.5003 9.46231L13.9145 8.0481ZM3.54835 9.4623L2.08605 8.00002L3.50026 6.58581L2.79316 5.8787L1.02539 7.64647V8.35357L2.84124 10.1694L3.54835 9.4623Z" fill="#424242"/> </svg>`,
|
|
55
57
|
};
|
|
56
58
|
|
|
@@ -79,6 +81,7 @@ export function getIconForType(iconTypeString = 'Text', isDarkTheme = false) {
|
|
|
79
81
|
Struct: `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M2 2L1 3V6L2 7H14L15 6V3L14 2H2ZM2 3H3H13H14V4V5V6H13H3H2V5V4V3ZM1 10L2 9H5L6 10V13L5 14H2L1 13V10ZM3 10H2V11V12V13H3H4H5V12V11V10H4H3ZM10 10L11 9H14L15 10V13L14 14H11L10 13V10ZM12 10H11V11V12V13H12H13H14V12V11V10H13H12Z" fill="#C5C5C5"/> </svg>`,
|
|
80
82
|
Event: `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M7.41354 1.55996L8.31152 1H11.6056L12.424 2.57465L10.2356 6H12.0174L12.7363 7.69512L5.61943 15L4.01675 13.837L6.11943 10H4.89798L4 8.55996L7.41354 1.55996ZM7.78033 9L4.90054 14.3049L12.0174 7H8.31152L11.6056 2H8.31152L4.89798 9H7.78033Z" fill="#EE9D28"/> </svg>`,
|
|
81
83
|
Operator: `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M2.87289 1.10023C3.20768 1.23579 3.47545 1.498 3.61802 1.82988C3.69032 1.99959 3.72675 2.18242 3.72502 2.36688C3.72617 2.54999 3.68975 2.7314 3.61802 2.89988C3.51299 3.14567 3.33782 3.35503 3.11442 3.50177C2.89102 3.64851 2.6293 3.72612 2.36202 3.72488C2.17924 3.72592 1.99818 3.68951 1.83002 3.61788C1.58298 3.51406 1.37227 3.33932 1.22453 3.11575C1.0768 2.89219 0.998666 2.62984 1.00002 2.36188C0.99913 2.17921 1.03519 1.99825 1.10602 1.82988C1.24337 1.50314 1.50328 1.24323 1.83002 1.10588C2.16332 0.966692 2.53809 0.964661 2.87289 1.10023ZM2.57502 2.86488C2.7054 2.80913 2.80927 2.70526 2.86502 2.57488C2.8929 2.50838 2.90718 2.43698 2.90702 2.36488C2.90813 2.2654 2.88215 2.1675 2.83185 2.08167C2.78156 1.99584 2.70884 1.92531 2.62151 1.87767C2.53418 1.83002 2.43553 1.80705 2.33614 1.81121C2.23674 1.81537 2.14035 1.8465 2.05731 1.90128C1.97426 1.95606 1.9077 2.03241 1.86475 2.12215C1.8218 2.21188 1.80409 2.31161 1.81352 2.41065C1.82294 2.50968 1.85915 2.60428 1.91825 2.6843C1.97736 2.76433 2.05713 2.82675 2.14902 2.86488C2.28549 2.92089 2.43854 2.92089 2.57502 2.86488ZM6.42995 1.1095L1.10967 6.42977L1.79557 7.11567L7.11584 1.7954L6.42995 1.1095ZM11.5 8.99999H12.5V11.5H15V12.5H12.5V15H11.5V12.5H9V11.5H11.5V8.99999ZM5.76777 9.52509L6.47487 10.2322L4.70711 12L6.47487 13.7677L5.76777 14.4748L4 12.7071L2.23223 14.4748L1.52513 13.7677L3.29289 12L1.52513 10.2322L2.23223 9.52509L4 11.2929L5.76777 9.52509ZM7.11802 5.32988C7.01442 5.08268 6.83973 4.87183 6.61612 4.72406C6.3925 4.57629 6.13004 4.49826 5.86202 4.49988C5.67935 4.49899 5.49839 4.53505 5.33002 4.60588C5.00328 4.74323 4.74337 5.00314 4.60602 5.32988C4.53588 5.49478 4.49897 5.67191 4.49741 5.8511C4.49586 6.0303 4.52967 6.20804 4.59693 6.37414C4.66419 6.54024 4.76356 6.69143 4.88936 6.81906C5.01516 6.94669 5.1649 7.04823 5.33002 7.11788C5.49867 7.18848 5.67968 7.22484 5.86252 7.22484C6.04535 7.22484 6.22636 7.18848 6.39502 7.11788C6.64201 7.01388 6.8527 6.83913 7.00058 6.61563C7.14845 6.39213 7.22689 6.12987 7.22602 5.86188C7.22655 5.67905 7.1898 5.49803 7.11802 5.32988ZM6.36502 6.07488C6.33766 6.13937 6.29829 6.19808 6.24902 6.24788C6.19908 6.29724 6.14042 6.33691 6.07602 6.36488C6.00854 6.39297 5.93611 6.40725 5.86302 6.40688C5.78991 6.40744 5.71744 6.39315 5.65002 6.36488C5.58541 6.33729 5.52668 6.29757 5.47702 6.24788C5.42691 6.19856 5.38713 6.13975 5.36002 6.07488C5.30401 5.9384 5.30401 5.78536 5.36002 5.64888C5.41536 5.51846 5.51941 5.41477 5.65002 5.35988C5.71737 5.33126 5.78984 5.31663 5.86302 5.31688C5.93618 5.31685 6.0086 5.33147 6.07602 5.35988C6.14037 5.38749 6.19904 5.42682 6.24902 5.47588C6.29786 5.52603 6.33717 5.58465 6.36502 5.64888C6.3934 5.7163 6.40802 5.78872 6.40802 5.86188C6.40802 5.93503 6.3934 6.00745 6.36502 6.07488ZM14 3H10V4H14V3Z" fill="#C5C5C5"/> </svg>`,
|
|
84
|
+
Console: `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M1 1H15V15H1V1ZM2 14H14V2H2V14ZM4.00008 5.70709L4.70718 4.99999L8.24272 8.53552L7.53561 9.24263L7.53558 9.2426L4.70711 12.0711L4 11.364L6.82848 8.53549L4.00008 5.70709Z" fill="#C5C5C5"/> </svg>`,
|
|
82
85
|
TypeParameter: `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M11 6H10V5.5C10 5.22386 9.77616 5 9.50001 5H8.47902V10.5C8.47902 10.7761 8.70288 11 8.97902 11H9.47902V12H6.47902V11H6.97902C7.25516 11 7.47902 10.7761 7.47902 10.5V5H6.50001C6.22387 5 6.00001 5.22386 6.00001 5.5V6H5.00001V4H11V6ZM13.9142 8.0481L12.4519 6.58581L13.159 5.87871L14.9749 7.69454V8.40165L13.2071 10.1694L12.5 9.46231L13.9142 8.0481ZM3.5481 9.4623L2.08581 8.00002L3.50002 6.58581L2.79291 5.8787L1.02515 7.64647V8.35357L2.841 10.1694L3.5481 9.4623Z" fill="#C5C5C5"/> </svg>`,
|
|
83
86
|
};
|
|
84
87
|
const iconType = iconTypeString as CompletionItemIcons;
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * as LanguageSupport from '@neo4j-cypher/language-support';
|
|
2
2
|
export { CypherEditor } from './CypherEditor';
|
|
3
|
-
export {
|
|
3
|
+
export type { InlinePanelProps } from './CypherEditor';
|
|
4
|
+
export type { DiffProps } from './diffView';
|
|
5
|
+
export { cypher } from './lang-cypher/langCypher';
|
|
4
6
|
export { darkThemeConstants, lightThemeConstants } from './themes';
|