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

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 +265 -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
@@ -0,0 +1,570 @@
1
+ export const tokens = {
2
+ transitions: {
3
+ values: {
4
+ properties: {
5
+ default: 'all',
6
+ },
7
+ duration: {
8
+ quick: '100ms',
9
+ slow: '250ms',
10
+ },
11
+ 'timing-function': {
12
+ default: 'cubic-bezier(0.420, 0.000, 0.580, 1.000)',
13
+ },
14
+ },
15
+ stripped: {
16
+ quick: '100ms cubic-bezier(0.420, 0.000, 0.580, 1.000)',
17
+ slow: '250ms cubic-bezier(0.420, 0.000, 0.580, 1.000)',
18
+ },
19
+ full: {
20
+ quick: 'all 100ms cubic-bezier(0.420, 0.000, 0.580, 1.000)',
21
+ slow: 'all 250ms cubic-bezier(0.420, 0.000, 0.580, 1.000)',
22
+ },
23
+ },
24
+ borderRadius: {
25
+ none: '0px',
26
+ sm: '4px',
27
+ md: '6px',
28
+ lg: '8px',
29
+ xl: '10px',
30
+ '1xl': '12px',
31
+ '2xl': '14px',
32
+ '3xl': '16px',
33
+ '4xl': '18px',
34
+ '5xl': '20px',
35
+ full: '9999px',
36
+ },
37
+ breakpoints: {
38
+ xs: '450px',
39
+ sm: '640px',
40
+ md: '768px',
41
+ lg: '1024px',
42
+ xl: '1280px',
43
+ '2xl': '1536px',
44
+ },
45
+ palette: {
46
+ categorical: {
47
+ '1': '#55BDC5',
48
+ '2': '#4D49CB',
49
+ '3': '#DC8B39',
50
+ '4': '#C9458D',
51
+ '5': '#8E8CF3',
52
+ '6': '#78DE7C',
53
+ '7': '#3F80E3',
54
+ '8': '#673FAB',
55
+ '9': '#DBBF40',
56
+ '10': '#BF732D',
57
+ '11': '#478A6E',
58
+ '12': '#ADE86B',
59
+ },
60
+ code: {
61
+ light: {
62
+ comment: '#5E636A',
63
+ keyword: '#3F7824',
64
+ keywordLiteral: '#3F7824',
65
+ operator: '#3F7824',
66
+ label: '#D43300',
67
+ predicateFunction: '#0A6190',
68
+ function: '#0A6190',
69
+ procedure: '#0A6190',
70
+ stringLiteral: '#986400',
71
+ numberLiteral: '#754EC8',
72
+ booleanLiteral: '#754EC8',
73
+ paramValue: '#754EC8',
74
+ property: '#730E00',
75
+ },
76
+ dark: {
77
+ comment: '#959AA1',
78
+ keyword: '#FFC450',
79
+ keywordLiteral: '#FFC450',
80
+ operator: '#FFC450',
81
+ label: '#F96746',
82
+ predicateFunction: '#8FE3E8',
83
+ function: '#8FE3E8',
84
+ procedure: '#8FE3E8',
85
+ stringLiteral: '#90CB62',
86
+ numberLiteral: '#CCB4FF',
87
+ booleanLiteral: '#CCB4FF',
88
+ paramValue: '#CCB4FF',
89
+ property: '#FFAA97',
90
+ },
91
+ },
92
+ graph: {
93
+ '1': '#FFDF81',
94
+ '2': '#C990C0',
95
+ '3': '#F79767',
96
+ '4': '#56C7E4',
97
+ '5': '#F16767',
98
+ '6': '#D8C7AE',
99
+ '7': '#8DCC93',
100
+ '8': '#ECB4C9',
101
+ '9': '#4D8DDA',
102
+ '10': '#FFC354',
103
+ '11': '#DA7294',
104
+ '12': '#579380',
105
+ },
106
+ },
107
+ colors: {
108
+ baltic: {
109
+ '10': '#E7FAFB',
110
+ '15': '#C3F8FB',
111
+ '20': '#8FE3E8',
112
+ '25': '#5CC3C9',
113
+ '30': '#5DB3BF',
114
+ '35': '#51A6B1',
115
+ '40': '#4C99A4',
116
+ '45': '#30839D',
117
+ '50': '#0A6190',
118
+ '55': '#02507B',
119
+ '60': '#014063',
120
+ '65': '#262F31',
121
+ '70': '#081E2B',
122
+ '75': '#041823',
123
+ '80': '#01121C',
124
+ },
125
+ hibiscus: {
126
+ '10': '#FFE9E7',
127
+ '15': '#FFD7D2',
128
+ '20': '#FFAA97',
129
+ '25': '#FF8E6A',
130
+ '30': '#F96746',
131
+ '35': '#E84E2C',
132
+ '40': '#D43300',
133
+ '45': '#BB2D00',
134
+ '50': '#961200',
135
+ '55': '#730E00',
136
+ '60': '#432520',
137
+ '65': '#4E0900',
138
+ '70': '#3F0800',
139
+ '75': '#360700',
140
+ '80': '#280500',
141
+ },
142
+ forest: {
143
+ '10': '#E7FCD7',
144
+ '15': '#BCF194',
145
+ '20': '#90CB62',
146
+ '25': '#80BB53',
147
+ '30': '#6FA646',
148
+ '35': '#5B992B',
149
+ '40': '#4D8622',
150
+ '45': '#3F7824',
151
+ '50': '#296127',
152
+ '55': '#145439',
153
+ '60': '#0C4D31',
154
+ '65': '#0A4324',
155
+ '70': '#262D24',
156
+ '75': '#052618',
157
+ '80': '#021D11',
158
+ },
159
+ lemon: {
160
+ '10': '#FFFAD1',
161
+ '15': '#FFF8BD',
162
+ '20': '#FFF178',
163
+ '25': '#FFE500',
164
+ '30': '#FFD600',
165
+ '35': '#F4C318',
166
+ '40': '#D7AA0A',
167
+ '45': '#B48409',
168
+ '50': '#996E00',
169
+ '55': '#765500',
170
+ '60': '#614600',
171
+ '65': '#4D3700',
172
+ '70': '#312E1A',
173
+ '75': '#2E2100',
174
+ '80': '#251B00',
175
+ },
176
+ lavender: {
177
+ '10': '#F7F3FF',
178
+ '15': '#E9DEFF',
179
+ '20': '#CCB4FF',
180
+ '25': '#B38EFF',
181
+ '30': '#A07BEC',
182
+ '35': '#8C68D9',
183
+ '40': '#754EC8',
184
+ '45': '#5A34AA',
185
+ '50': '#4B2894',
186
+ '55': '#3B1982',
187
+ '60': '#2C2A34',
188
+ '65': '#220954',
189
+ '70': '#170146',
190
+ '75': '#0E002D',
191
+ '80': '#09001C',
192
+ },
193
+ marigold: {
194
+ '10': '#FFF0D2',
195
+ '15': '#FFDE9D',
196
+ '20': '#FFCF72',
197
+ '25': '#FFC450',
198
+ '30': '#FFB422',
199
+ '35': '#FFA901',
200
+ '40': '#EC9C00',
201
+ '45': '#DA9105',
202
+ '50': '#BA7A00',
203
+ '55': '#986400',
204
+ '60': '#795000',
205
+ '65': '#624100',
206
+ '70': '#543800',
207
+ '75': '#422C00',
208
+ '80': '#251900',
209
+ },
210
+ earth: {
211
+ '10': '#FFF7F0',
212
+ '15': '#FDEDDA',
213
+ '20': '#FFE1C5',
214
+ '25': '#F8D1AE',
215
+ '30': '#ECBF96',
216
+ '35': '#E0AE7F',
217
+ '40': '#D19660',
218
+ '45': '#AF7C4D',
219
+ '50': '#8D5D31',
220
+ '55': '#763F18',
221
+ '60': '#66310B',
222
+ '65': '#5B2B09',
223
+ '70': '#481F01',
224
+ '75': '#361700',
225
+ '80': '#220E00',
226
+ },
227
+ neutral: {
228
+ '10': '#FFFFFF',
229
+ '15': '#F5F6F6',
230
+ '20': '#E2E3E5',
231
+ '25': '#CFD1D4',
232
+ '30': '#BBBEC3',
233
+ '35': '#A8ACB2',
234
+ '40': '#959AA1',
235
+ '45': '#818790',
236
+ '50': '#6F757E',
237
+ '55': '#5E636A',
238
+ '60': '#4D5157',
239
+ '65': '#3C3F44',
240
+ '70': '#212325',
241
+ '75': '#1A1B1D',
242
+ '80': '#09090A',
243
+ },
244
+ beige: {
245
+ '10': '#FFFCF4',
246
+ '20': '#FFF7E3',
247
+ '30': '#F2EAD4',
248
+ '40': '#C1B9A0',
249
+ '50': '#999384',
250
+ '60': '#666050',
251
+ '70': '#3F3824',
252
+ },
253
+ highlights: {
254
+ yellow: '#FAFF00',
255
+ periwinkle: '#6A82FF',
256
+ },
257
+ },
258
+ theme: {
259
+ dark: {
260
+ boxShadow: {
261
+ raised: '0px 1px 2px 0px rgba(9, 9, 10, 0.50)',
262
+ overlay: '0px 8px 20px 0px rgba(9, 9, 10, 0.50)',
263
+ },
264
+ palette: {
265
+ neutral: {
266
+ text: {
267
+ weakest: '#818790',
268
+ weaker: '#A8ACB2',
269
+ weak: '#CFD1D4',
270
+ default: '#F5F6F6',
271
+ inverse: '#1A1B1D',
272
+ },
273
+ icon: '#CFD1D4',
274
+ bg: {
275
+ weak: '#212325',
276
+ default: '#1A1B1D',
277
+ strong: '#3C3F44',
278
+ stronger: '#6F757E',
279
+ strongest: '#F5F6F6',
280
+ status: '#A8ACB2',
281
+ 'on-bg-weak': '#818790',
282
+ },
283
+ border: {
284
+ weak: '#3C3F44',
285
+ strong: '#6F757E',
286
+ strongest: '#BBBEC3',
287
+ },
288
+ hover: '#959AA1',
289
+ pressed: '#959AA1',
290
+ },
291
+ primary: {
292
+ text: '#8FE3E8',
293
+ icon: '#8FE3E8',
294
+ bg: {
295
+ weak: '#262F31',
296
+ strong: '#8FE3E8',
297
+ status: '#8FE3E8',
298
+ selected: '#262F31',
299
+ },
300
+ border: {
301
+ strong: '#8FE3E8',
302
+ weak: '#02507B',
303
+ },
304
+ focus: '#5DB3BF',
305
+ hover: {
306
+ weak: '#8FE3E8',
307
+ strong: '#5DB3BF',
308
+ },
309
+ pressed: {
310
+ weak: '#8FE3E8',
311
+ strong: '#4C99A4',
312
+ },
313
+ },
314
+ danger: {
315
+ text: '#FFAA97',
316
+ icon: '#FFAA97',
317
+ bg: {
318
+ strong: '#FFAA97',
319
+ weak: '#432520',
320
+ status: '#FFAA97',
321
+ },
322
+ border: {
323
+ strong: '#FFAA97',
324
+ weak: '#730E00',
325
+ },
326
+ hover: {
327
+ weak: '#FFAA97',
328
+ strong: '#F96746',
329
+ },
330
+ pressed: {
331
+ weak: '#FFAA97',
332
+ strong: '#E84E2C',
333
+ },
334
+ },
335
+ warning: {
336
+ text: '#FFD600',
337
+ icon: '#FFD600',
338
+ bg: {
339
+ strong: '#FFD600',
340
+ weak: '#312E1A',
341
+ status: '#FFD600',
342
+ },
343
+ border: {
344
+ strong: '#FFD600',
345
+ weak: '#765500',
346
+ },
347
+ },
348
+ success: {
349
+ text: '#90CB62',
350
+ icon: '#90CB62',
351
+ bg: {
352
+ strong: '#90CB62',
353
+ weak: '#262D24',
354
+ status: '#90CB62',
355
+ },
356
+ border: {
357
+ strong: '#90CB62',
358
+ weak: '#296127',
359
+ },
360
+ },
361
+ discovery: {
362
+ text: '#CCB4FF',
363
+ icon: '#CCB4FF',
364
+ bg: {
365
+ strong: '#CCB4FF',
366
+ weak: '#2C2A34',
367
+ status: '#CCB4FF',
368
+ },
369
+ border: {
370
+ strong: '#CCB4FF',
371
+ weak: '#4B2894',
372
+ },
373
+ },
374
+ },
375
+ },
376
+ light: {
377
+ boxShadow: {
378
+ raised: '0px 1px 2px 0px rgba(26, 27, 29, 0.18)',
379
+ overlay: '0px 4px 8px 0px rgba(26, 27, 29, 0.12)',
380
+ },
381
+ palette: {
382
+ neutral: {
383
+ text: {
384
+ weakest: '#A8ACB2',
385
+ weaker: '#5E636A',
386
+ weak: '#4D5157',
387
+ default: '#1A1B1D',
388
+ inverse: '#FFFFFF',
389
+ },
390
+ icon: '#4D5157',
391
+ bg: {
392
+ weak: '#FFFFFF',
393
+ default: '#F5F6F6',
394
+ 'on-bg-weak': '#F5F6F6',
395
+ strong: '#E2E3E5',
396
+ stronger: '#A8ACB2',
397
+ strongest: '#3C3F44',
398
+ status: '#A8ACB2',
399
+ },
400
+ border: {
401
+ weak: '#E2E3E5',
402
+ strong: '#BBBEC3',
403
+ strongest: '#6F757E',
404
+ },
405
+ hover: '#6F757E',
406
+ pressed: '#6F757E',
407
+ },
408
+ primary: {
409
+ text: '#0A6190',
410
+ icon: '#0A6190',
411
+ bg: {
412
+ weak: '#E7FAFB',
413
+ strong: '#0A6190',
414
+ status: '#4C99A4',
415
+ selected: '#E7FAFB',
416
+ },
417
+ border: {
418
+ strong: '#0A6190',
419
+ weak: '#8FE3E8',
420
+ },
421
+ focus: '#30839D',
422
+ hover: {
423
+ weak: '#30839D',
424
+ strong: '#02507B',
425
+ },
426
+ pressed: {
427
+ weak: '#30839D',
428
+ strong: '#014063',
429
+ },
430
+ },
431
+ danger: {
432
+ text: '#BB2D00',
433
+ icon: '#BB2D00',
434
+ bg: {
435
+ strong: '#BB2D00',
436
+ weak: '#FFE9E7',
437
+ status: '#E84E2C',
438
+ },
439
+ border: {
440
+ strong: '#BB2D00',
441
+ weak: '#FFAA97',
442
+ },
443
+ hover: {
444
+ weak: '#D43300',
445
+ strong: '#961200',
446
+ },
447
+ pressed: {
448
+ weak: '#D43300',
449
+ strong: '#730E00',
450
+ },
451
+ },
452
+ warning: {
453
+ text: '#765500',
454
+ icon: '#765500',
455
+ bg: {
456
+ strong: '#765500',
457
+ weak: '#FFFAD1',
458
+ status: '#D7AA0A',
459
+ },
460
+ border: {
461
+ strong: '#996E00',
462
+ weak: '#FFD600',
463
+ },
464
+ },
465
+ success: {
466
+ text: '#3F7824',
467
+ icon: '#3F7824',
468
+ bg: {
469
+ strong: '#3F7824',
470
+ weak: '#E7FCD7',
471
+ status: '#5B992B',
472
+ },
473
+ border: {
474
+ strong: '#3F7824',
475
+ weak: '#90CB62',
476
+ },
477
+ },
478
+ discovery: {
479
+ text: '#5A34AA',
480
+ icon: '#5A34AA',
481
+ bg: {
482
+ strong: '#5A34AA',
483
+ weak: '#E9DEFF',
484
+ status: '#754EC8',
485
+ },
486
+ border: {
487
+ strong: '#5A34AA',
488
+ weak: '#B38EFF',
489
+ },
490
+ },
491
+ },
492
+ },
493
+ },
494
+ font: {
495
+ size: {
496
+ h1: '3rem',
497
+ h2: '2.5rem',
498
+ h3: '1.875rem',
499
+ h4: '1.5rem',
500
+ h5: '1.25rem',
501
+ h6: '1rem',
502
+ 'subheading-large': '1.25rem',
503
+ 'subheading-medium': '1rem',
504
+ 'subheading-small': '0.875rem',
505
+ 'body-large': '1rem',
506
+ 'body-medium': '0.875rem',
507
+ 'body-small': '0.75rem',
508
+ code: '0.875rem',
509
+ label: '0.875rem',
510
+ },
511
+ weight: {
512
+ bold: '700',
513
+ semibold: '600',
514
+ normal: '400',
515
+ medium: '500',
516
+ light: '300',
517
+ },
518
+ 'font-family': {
519
+ h1: 'Syne Neo',
520
+ h2: 'Syne Neo',
521
+ h3: 'Public Sans',
522
+ h4: 'Public Sans',
523
+ h5: 'Public Sans',
524
+ h6: 'Public Sans',
525
+ 'subheading-large': 'Public Sans',
526
+ 'subheading-medium': 'Public Sans',
527
+ 'subheading-small': 'Public Sans',
528
+ 'body-large': 'Public Sans',
529
+ 'body-medium': 'Public Sans',
530
+ 'body-small': 'Public Sans',
531
+ code: 'Fira Code',
532
+ label: 'Public Sans',
533
+ },
534
+ },
535
+ space: {
536
+ '0': '0px',
537
+ '1': '1px',
538
+ '2': '2px',
539
+ '3': '4px',
540
+ '4': '8px',
541
+ '5': '12px',
542
+ '6': '16px',
543
+ '7': '24px',
544
+ '8': '32px',
545
+ '9': '48px',
546
+ '10': '64px',
547
+ '11': '96px',
548
+ '12': '128px',
549
+ '13': '320px',
550
+ },
551
+ zIndex: {
552
+ '0': 0,
553
+ '10': 10,
554
+ '20': 20,
555
+ '30': 30,
556
+ '40': 40,
557
+ '50': 50,
558
+ '60': 60,
559
+ deep: -999999,
560
+ auto: 'auto',
561
+ alias: {
562
+ overlay: 10,
563
+ banner: 20,
564
+ blanket: 30,
565
+ popover: 40,
566
+ tooltip: 50,
567
+ modal: 60,
568
+ },
569
+ },
570
+ };
@@ -1,9 +1,14 @@
1
1
  import {
2
2
  acceptCompletion,
3
3
  autocompletion,
4
+ clearSnippet,
4
5
  closeBrackets,
5
6
  closeBracketsKeymap,
7
+ closeCompletion,
6
8
  completionKeymap,
9
+ nextSnippetField,
10
+ prevSnippetField,
11
+ snippetKeymap,
7
12
  } from '@codemirror/autocomplete';
8
13
  import {
9
14
  defaultKeymap,
@@ -22,11 +27,13 @@ import {
22
27
  import { highlightSelectionMatches, searchKeymap } from '@codemirror/search';
23
28
  import { EditorState, Extension, StateCommand } from '@codemirror/state';
24
29
  import {
30
+ Command,
25
31
  crosshairCursor,
26
32
  drawSelection,
27
33
  dropCursor,
28
34
  EditorView,
29
35
  highlightSpecialChars,
36
+ KeyBinding,
30
37
  keymap,
31
38
  rectangularSelection,
32
39
  } from '@codemirror/view';
@@ -54,8 +61,14 @@ const insertTab: StateCommand = (cmd) => {
54
61
  return true;
55
62
  };
56
63
 
57
- export const basicNeo4jSetup = (): Extension[] => {
58
- const keymaps = [
64
+ type SetupProps = {
65
+ moveFocusOnTab?: boolean;
66
+ };
67
+
68
+ export const basicNeo4jSetup = ({
69
+ moveFocusOnTab = false,
70
+ }: SetupProps): Extension[] => {
71
+ const keymaps: KeyBinding[] = [
59
72
  closeBracketsKeymap,
60
73
  defaultKeymap,
61
74
  searchKeymap,
@@ -63,23 +76,28 @@ export const basicNeo4jSetup = (): Extension[] => {
63
76
  foldKeymap,
64
77
  completionKeymap,
65
78
  lintKeymap,
66
- {
67
- key: 'Tab',
68
- preventDefault: true,
69
- run: acceptCompletion,
70
- },
71
- {
72
- key: 'Tab',
73
- preventDefault: true,
74
- run: insertTab,
75
- },
76
- {
77
- key: 'Shift-Tab',
78
- preventDefault: true,
79
- run: indentLess,
80
- },
81
79
  ].flat();
82
80
 
81
+ if (!moveFocusOnTab) {
82
+ keymaps.push(
83
+ {
84
+ key: 'Tab',
85
+ preventDefault: true,
86
+ run: acceptCompletion,
87
+ },
88
+ {
89
+ key: 'Tab',
90
+ preventDefault: true,
91
+ run: insertTab,
92
+ },
93
+ {
94
+ key: 'Shift-Tab',
95
+ preventDefault: true,
96
+ run: indentLess,
97
+ },
98
+ );
99
+ }
100
+
83
101
  const extensions: Extension[] = [];
84
102
 
85
103
  extensions.push(highlightSpecialChars());
@@ -125,5 +143,48 @@ export const basicNeo4jSetup = (): Extension[] => {
125
143
 
126
144
  extensions.push(keymap.of(keymaps));
127
145
 
146
+ extensions.push(
147
+ snippetKeymap.of([
148
+ {
149
+ key: 'Tab',
150
+ run: acceptCompletionOrGotoNextSnippet,
151
+ shift: acceptCompletionOrGotoPrevSnippet,
152
+ },
153
+ { key: 'Escape', run: closeCompletionsOrClearSnippets },
154
+ ]),
155
+ );
156
+
128
157
  return extensions;
129
158
  };
159
+
160
+ // The logic to check if there's a completion open is surprisingly complex
161
+ // https://github.com/codemirror/autocomplete/blob/5ad2ebc861f2f61cdc943fc087a5bfb756a7d0fa/src/view.ts#L31
162
+ // For example it respects an interaction delay, so we can't just check if the completion is open
163
+ // instead we just run the acceptCompletion command which returns true if a completion was accepted
164
+ // in that case we know that we shouldn't move to the next snippet field
165
+ const acceptCompletionOrGotoNextSnippet: Command = (view: EditorView) => {
166
+ const didCompletion = acceptCompletion(view);
167
+ if (didCompletion) {
168
+ return true;
169
+ }
170
+
171
+ return nextSnippetField(view);
172
+ };
173
+
174
+ const acceptCompletionOrGotoPrevSnippet: Command = (view: EditorView) => {
175
+ const didCompletion = acceptCompletion(view);
176
+ if (didCompletion) {
177
+ return true;
178
+ }
179
+
180
+ return prevSnippetField(view);
181
+ };
182
+
183
+ const closeCompletionsOrClearSnippets: Command = (view: EditorView) => {
184
+ const closedCompletions = closeCompletion(view);
185
+ if (closedCompletions) {
186
+ return true;
187
+ }
188
+
189
+ return clearSnippet(view);
190
+ };