@neo4j-cypher/react-codemirror 2.0.0-next.2 → 2.0.0-next.20

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 (155) hide show
  1. package/CHANGELOG.md +166 -0
  2. package/dist/{types/CypherEditor.d.ts → CypherEditor.d.ts} +82 -3
  3. package/dist/CypherEditor.js +326 -0
  4. package/dist/CypherEditor.js.map +1 -0
  5. package/dist/CypherEditor.test.js +151 -0
  6. package/dist/CypherEditor.test.js.map +1 -0
  7. package/dist/constants.d.ts +1 -0
  8. package/dist/constants.js +2 -0
  9. package/dist/constants.js.map +1 -0
  10. package/dist/e2e_tests/autoCompletion.spec.js +318 -0
  11. package/dist/e2e_tests/autoCompletion.spec.js.map +1 -0
  12. package/dist/e2e_tests/configuration.spec.js +83 -0
  13. package/dist/e2e_tests/configuration.spec.js.map +1 -0
  14. package/dist/e2e_tests/debounce.spec.js +66 -0
  15. package/dist/e2e_tests/debounce.spec.js.map +1 -0
  16. package/dist/{types/e2e_tests/e2e-utils.d.ts → e2e_tests/e2eUtils.d.ts} +1 -0
  17. package/dist/e2e_tests/e2eUtils.js +71 -0
  18. package/dist/e2e_tests/e2eUtils.js.map +1 -0
  19. package/dist/e2e_tests/extraKeybindings.spec.js +43 -0
  20. package/dist/e2e_tests/extraKeybindings.spec.js.map +1 -0
  21. package/dist/e2e_tests/historyNavigation.spec.js +227 -0
  22. package/dist/e2e_tests/historyNavigation.spec.js.map +1 -0
  23. package/dist/e2e_tests/performanceTest.spec.d.ts +6 -0
  24. package/dist/e2e_tests/performanceTest.spec.js +97 -0
  25. package/dist/e2e_tests/performanceTest.spec.js.map +1 -0
  26. package/dist/e2e_tests/sanityChecks.spec.js +53 -0
  27. package/dist/e2e_tests/sanityChecks.spec.js.map +1 -0
  28. package/dist/e2e_tests/signatureHelp.spec.js +228 -0
  29. package/dist/e2e_tests/signatureHelp.spec.js.map +1 -0
  30. package/dist/e2e_tests/snippets.spec.js +62 -0
  31. package/dist/e2e_tests/snippets.spec.js.map +1 -0
  32. package/dist/e2e_tests/syntaxHighlighting.spec.d.ts +1 -0
  33. package/dist/e2e_tests/syntaxHighlighting.spec.js +90 -0
  34. package/dist/e2e_tests/syntaxHighlighting.spec.js.map +1 -0
  35. package/dist/e2e_tests/syntaxValidation.spec.d.ts +1 -0
  36. package/dist/e2e_tests/syntaxValidation.spec.js +116 -0
  37. package/dist/e2e_tests/syntaxValidation.spec.js.map +1 -0
  38. package/dist/historyNavigation.js +163 -0
  39. package/dist/historyNavigation.js.map +1 -0
  40. package/dist/{types/icons.d.ts → icons.d.ts} +1 -1
  41. package/dist/icons.js +62 -0
  42. package/dist/icons.js.map +1 -0
  43. package/dist/index.d.ts +4 -0
  44. package/dist/index.js +5 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/lang-cypher/autocomplete.d.ts +6 -0
  47. package/dist/lang-cypher/autocomplete.js +115 -0
  48. package/dist/lang-cypher/autocomplete.js.map +1 -0
  49. package/dist/{types/lang-cypher → lang-cypher}/constants.d.ts +11 -0
  50. package/dist/lang-cypher/constants.js +69 -0
  51. package/dist/lang-cypher/constants.js.map +1 -0
  52. package/dist/lang-cypher/contants.test.d.ts +1 -0
  53. package/dist/lang-cypher/contants.test.js +103 -0
  54. package/dist/lang-cypher/contants.test.js.map +1 -0
  55. package/dist/lang-cypher/createCypherTheme.js +182 -0
  56. package/dist/lang-cypher/createCypherTheme.js.map +1 -0
  57. package/dist/lang-cypher/langCypher.d.ts +14 -0
  58. package/dist/lang-cypher/langCypher.js +23 -0
  59. package/dist/lang-cypher/langCypher.js.map +1 -0
  60. package/dist/lang-cypher/lintWorker.d.ts +12 -0
  61. package/dist/lang-cypher/lintWorker.js +14 -0
  62. package/dist/lang-cypher/lintWorker.js.map +1 -0
  63. package/dist/lang-cypher/parser-adapter.d.ts +19 -0
  64. package/dist/lang-cypher/parser-adapter.js +113 -0
  65. package/dist/lang-cypher/parser-adapter.js.map +1 -0
  66. package/dist/lang-cypher/signatureHelp.d.ts +4 -0
  67. package/dist/lang-cypher/signatureHelp.js +109 -0
  68. package/dist/lang-cypher/signatureHelp.js.map +1 -0
  69. package/dist/{types/lang-cypher/syntax-validation.d.ts → lang-cypher/syntaxValidation.d.ts} +2 -1
  70. package/dist/lang-cypher/syntaxValidation.js +52 -0
  71. package/dist/lang-cypher/syntaxValidation.js.map +1 -0
  72. package/dist/lang-cypher/themeIcons.js +22 -0
  73. package/dist/lang-cypher/themeIcons.js.map +1 -0
  74. package/dist/lang-cypher/utils.d.ts +2 -0
  75. package/dist/lang-cypher/utils.js +10 -0
  76. package/dist/lang-cypher/utils.js.map +1 -0
  77. package/dist/ndlTokensCopy.d.ts +570 -0
  78. package/dist/ndlTokensCopy.js +571 -0
  79. package/dist/ndlTokensCopy.js.map +1 -0
  80. package/dist/ndlTokensCopy.test.d.ts +1 -0
  81. package/dist/ndlTokensCopy.test.js +12 -0
  82. package/dist/ndlTokensCopy.test.js.map +1 -0
  83. package/dist/neo4jSetup.d.ts +6 -0
  84. package/dist/neo4jSetup.js +120 -0
  85. package/dist/neo4jSetup.js.map +1 -0
  86. package/dist/{types/themes.d.ts → themes.d.ts} +1 -1
  87. package/dist/themes.js +93 -0
  88. package/dist/themes.js.map +1 -0
  89. package/dist/tsconfig.tsbuildinfo +1 -0
  90. package/package.json +32 -34
  91. package/src/CypherEditor.test.tsx +200 -0
  92. package/src/CypherEditor.tsx +311 -41
  93. package/src/constants.ts +1 -0
  94. package/src/e2e_tests/autoCompletion.spec.tsx +546 -0
  95. package/src/e2e_tests/configuration.spec.tsx +111 -0
  96. package/src/e2e_tests/debounce.spec.tsx +106 -0
  97. package/src/e2e_tests/{e2e-utils.ts → e2eUtils.ts} +24 -2
  98. package/src/e2e_tests/{extra-keybindings.spec.tsx → extraKeybindings.spec.tsx} +1 -3
  99. package/src/e2e_tests/{history-navigation.spec.tsx → historyNavigation.spec.tsx} +137 -18
  100. package/src/e2e_tests/performanceTest.spec.tsx +163 -0
  101. package/src/e2e_tests/{sanity-checks.spec.tsx → sanityChecks.spec.tsx} +7 -22
  102. package/src/e2e_tests/signatureHelp.spec.tsx +445 -0
  103. package/src/e2e_tests/snippets.spec.tsx +92 -0
  104. package/src/e2e_tests/{syntax-highlighting.spec.tsx → syntaxHighlighting.spec.tsx} +26 -24
  105. package/src/e2e_tests/{syntax-validation.spec.tsx → syntaxValidation.spec.tsx} +97 -10
  106. package/src/{history-navigation.ts → historyNavigation.ts} +1 -1
  107. package/src/icons.ts +3 -0
  108. package/src/index.ts +2 -2
  109. package/src/lang-cypher/autocomplete.ts +100 -18
  110. package/src/lang-cypher/constants.ts +27 -0
  111. package/src/lang-cypher/contants.test.ts +6 -2
  112. package/src/lang-cypher/{create-cypher-theme.ts → createCypherTheme.ts} +44 -2
  113. package/src/lang-cypher/langCypher.ts +43 -0
  114. package/src/lang-cypher/lintWorker.ts +31 -0
  115. package/src/lang-cypher/parser-adapter.ts +145 -0
  116. package/src/lang-cypher/signatureHelp.ts +151 -0
  117. package/src/lang-cypher/syntaxValidation.ts +66 -0
  118. package/src/lang-cypher/utils.ts +9 -0
  119. package/src/{ndl-tokens-copy.test.ts → ndlTokensCopy.test.ts} +2 -1
  120. package/src/ndlTokensCopy.ts +570 -0
  121. package/src/{neo4j-setup.tsx → neo4jSetup.tsx} +78 -17
  122. package/src/themes.ts +45 -70
  123. package/src/viteEnv.d.ts +1 -0
  124. package/dist/cjs/index.cjs +0 -1440
  125. package/dist/cjs/index.cjs.map +0 -7
  126. package/dist/esm/index.mjs +0 -1463
  127. package/dist/esm/index.mjs.map +0 -7
  128. package/dist/types/e2e_tests/mock-data.d.ts +0 -3779
  129. package/dist/types/index.d.ts +0 -4
  130. package/dist/types/lang-cypher/ParserAdapter.d.ts +0 -14
  131. package/dist/types/lang-cypher/autocomplete.d.ts +0 -3
  132. package/dist/types/lang-cypher/lang-cypher.d.ts +0 -7
  133. package/dist/types/ndl-tokens-copy.d.ts +0 -379
  134. package/dist/types/neo4j-setup.d.ts +0 -2
  135. package/dist/types/tsconfig.tsbuildinfo +0 -1
  136. package/src/e2e_tests/auto-completion.spec.tsx +0 -232
  137. package/src/e2e_tests/mock-data.ts +0 -4310
  138. package/src/e2e_tests/performance-test.spec.tsx +0 -71
  139. package/src/lang-cypher/ParserAdapter.ts +0 -92
  140. package/src/lang-cypher/lang-cypher.ts +0 -32
  141. package/src/lang-cypher/syntax-validation.ts +0 -24
  142. package/src/ndl-tokens-copy.ts +0 -379
  143. /package/dist/{types/e2e_tests/auto-completion.spec.d.ts → CypherEditor.test.d.ts} +0 -0
  144. /package/dist/{types/e2e_tests/extra-keybindings.spec.d.ts → e2e_tests/autoCompletion.spec.d.ts} +0 -0
  145. /package/dist/{types/e2e_tests/history-navigation.spec.d.ts → e2e_tests/configuration.spec.d.ts} +0 -0
  146. /package/dist/{types/e2e_tests/performance-test.spec.d.ts → e2e_tests/debounce.spec.d.ts} +0 -0
  147. /package/dist/{types/e2e_tests/sanity-checks.spec.d.ts → e2e_tests/extraKeybindings.spec.d.ts} +0 -0
  148. /package/dist/{types/e2e_tests/syntax-highlighting.spec.d.ts → e2e_tests/historyNavigation.spec.d.ts} +0 -0
  149. /package/dist/{types/e2e_tests/syntax-validation.spec.d.ts → e2e_tests/sanityChecks.spec.d.ts} +0 -0
  150. /package/dist/{types/lang-cypher/contants.test.d.ts → e2e_tests/signatureHelp.spec.d.ts} +0 -0
  151. /package/dist/{types/ndl-tokens-copy.test.d.ts → e2e_tests/snippets.spec.d.ts} +0 -0
  152. /package/dist/{types/history-navigation.d.ts → historyNavigation.d.ts} +0 -0
  153. /package/dist/{types/lang-cypher/create-cypher-theme.d.ts → lang-cypher/createCypherTheme.d.ts} +0 -0
  154. /package/dist/{types/lang-cypher/theme-icons.d.ts → lang-cypher/themeIcons.d.ts} +0 -0
  155. /package/src/lang-cypher/{theme-icons.ts → themeIcons.ts} +0 -0
package/src/themes.ts CHANGED
@@ -1,37 +1,18 @@
1
1
  import { Extension } from '@codemirror/state';
2
- import { light, mirage } from 'ayu';
3
2
  import {
4
3
  createCypherTheme,
5
4
  ThemeOptions,
6
- } from './lang-cypher/create-cypher-theme';
7
- import { tokens } from './ndl-tokens-copy';
8
-
9
- /* ndl exports most tokens as hex colors but some tokens are exported as rgb colors, in the form of "10, 20, 30"
10
- This should be fixed in version 2 of ndl.
11
- Meanwhile we can use this function */
12
- const convertToHex = (color: string) => {
13
- if (color.startsWith('#')) {
14
- return color;
15
- }
16
-
17
- const rgb = color.match(/\d+/g);
18
- if (!rgb) {
19
- return color;
20
- }
21
- const [r, g, b] = rgb;
22
- return `#${Number(r).toString(16)}${Number(g).toString(16)}${Number(
23
- b,
24
- ).toString(16)}`;
25
- };
5
+ } from './lang-cypher/createCypherTheme';
6
+ import { tokens } from './ndlTokensCopy';
26
7
 
27
8
  export const lightThemeConstants: ThemeOptions = {
28
9
  dark: false,
29
10
  editorSettings: {
30
- background: light.editor.bg.hex(),
31
- foreground: light.editor.fg.hex(),
32
- gutterForeground: light.editor.gutter.normal.hex(),
33
- selection: light.editor.selection.active.hex(),
34
- textMatchingSelection: light.editor.findMatch.active.hex(),
11
+ background: '#FEFEFE',
12
+ foreground: '#545454',
13
+ gutterForeground: '#a3a7ae',
14
+ selection: tokens.colors.neutral['20'],
15
+ textMatchingSelection: tokens.colors.lavender['15'],
35
16
  cursor: '#000000',
36
17
  autoCompletionPanel: {
37
18
  selectedColor: '#cce2ff',
@@ -39,68 +20,62 @@ export const lightThemeConstants: ThemeOptions = {
39
20
  backgroundColor: '#F3F4F5',
40
21
  },
41
22
  searchPanel: {
42
- background: tokens.palette.light.neutral.bg.default,
43
- text: tokens.palette.light.neutral.text.default,
44
- buttonHoverBackground: tokens.palette.light.neutral.bg.strong,
23
+ background: '#FEFEFE',
24
+ text: '#545454',
25
+ buttonHoverBackground: tokens.theme.light.palette.neutral.bg.strong,
45
26
  },
46
27
  },
47
28
  highlightStyles: {
48
- comment: light.syntax.comment.hex(),
49
- keyword: light.syntax.keyword.hex(),
50
- keywordLiteral: light.syntax.keyword.hex(),
51
- label: light.syntax.markup.hex(),
52
- predicateFunction: light.syntax.func.hex(),
53
- function: light.syntax.func.hex(),
54
- procedure: light.syntax.func.hex(),
55
- stringLiteral: light.syntax.string.hex(),
56
- numberLiteral: light.syntax.constant.hex(),
57
- booleanLiteral: light.syntax.constant.hex(),
58
- operator: light.syntax.operator.hex(),
59
- property: light.syntax.tag.hex(),
60
- paramDollar: light.syntax.regexp.hex(),
61
- paramValue: light.syntax.regexp.hex(),
62
- namespace: light.syntax.special.hex(),
29
+ comment: tokens.palette.code.light.comment,
30
+ keyword: tokens.palette.code.light.keyword,
31
+ keywordLiteral: tokens.palette.code.light.keywordLiteral,
32
+ label: tokens.palette.code.light.label,
33
+ predicateFunction: tokens.palette.code.light.predicateFunction,
34
+ function: tokens.palette.code.light.function,
35
+ procedure: tokens.palette.code.light.procedure,
36
+ stringLiteral: tokens.palette.code.light.stringLiteral,
37
+ numberLiteral: tokens.palette.code.light.numberLiteral,
38
+ booleanLiteral: tokens.palette.code.light.booleanLiteral,
39
+ operator: tokens.palette.code.light.operator,
40
+ property: tokens.palette.code.light.property,
41
+ paramValue: tokens.palette.code.light.paramValue,
63
42
  },
64
43
  };
65
44
 
66
45
  export const darkThemeConstants: ThemeOptions = {
67
46
  dark: true,
68
47
  editorSettings: {
69
- background: mirage.editor.bg.hex(),
70
- foreground: mirage.editor.fg.hex(),
71
- gutterForeground: mirage.editor.gutter.normal.hex(),
72
- selection: mirage.editor.selection.active.hex(),
73
- textMatchingSelection: mirage.editor.findMatch.active.hex(),
74
- cursor: '#ffffff',
48
+ background: '#242936',
49
+ foreground: '#cccac2',
50
+ gutterForeground: '#8a919966',
51
+ selection: '#409fff40',
52
+ textMatchingSelection: '#695380',
53
+ cursor: tokens.colors.neutral['10'],
75
54
  autoCompletionPanel: {
76
55
  selectedColor: '#062f4a',
77
56
  matchingTextColor: '#0097fb',
78
57
  backgroundColor: '#1C212B',
79
58
  },
80
59
  searchPanel: {
81
- background: convertToHex(tokens.palette.dark.neutral.bg.default),
82
- text: convertToHex(tokens.palette.dark.neutral.text.default),
83
- buttonHoverBackground: convertToHex(
84
- tokens.palette.dark.neutral.bg.strong,
85
- ),
60
+ background: tokens.theme.dark.palette.neutral.bg.default,
61
+ text: tokens.theme.dark.palette.neutral.text.default,
62
+ buttonHoverBackground: tokens.theme.dark.palette.neutral.bg.strong,
86
63
  },
87
64
  },
88
65
  highlightStyles: {
89
- comment: mirage.syntax.comment.hex(),
90
- keyword: mirage.syntax.keyword.hex(),
91
- keywordLiteral: mirage.syntax.keyword.hex(),
92
- label: mirage.syntax.markup.hex(),
93
- predicateFunction: mirage.syntax.func.hex(),
94
- function: mirage.syntax.func.hex(),
95
- procedure: mirage.syntax.func.hex(),
96
- stringLiteral: mirage.syntax.string.hex(),
97
- numberLiteral: mirage.syntax.constant.hex(),
98
- booleanLiteral: mirage.syntax.constant.hex(),
99
- operator: mirage.syntax.operator.hex(),
100
- property: mirage.syntax.tag.hex(),
101
- paramDollar: mirage.syntax.regexp.hex(),
102
- paramValue: mirage.syntax.regexp.hex(),
103
- namespace: mirage.syntax.special.hex(),
66
+ comment: tokens.palette.code.dark.comment,
67
+ keyword: tokens.palette.code.dark.keyword,
68
+ keywordLiteral: tokens.palette.code.dark.keywordLiteral,
69
+ label: tokens.palette.code.dark.label,
70
+ predicateFunction: tokens.palette.code.dark.predicateFunction,
71
+ function: tokens.palette.code.dark.function,
72
+ procedure: tokens.palette.code.dark.procedure,
73
+ stringLiteral: tokens.palette.code.dark.stringLiteral,
74
+ numberLiteral: tokens.palette.code.dark.numberLiteral,
75
+ booleanLiteral: tokens.palette.code.dark.booleanLiteral,
76
+ operator: tokens.palette.code.dark.operator,
77
+ property: tokens.palette.code.dark.property,
78
+ paramValue: tokens.palette.code.dark.paramValue,
104
79
  },
105
80
  };
106
81
 
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />