@finos/legend-lego 1.2.71 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. package/lib/code-editor/CodeDiffView.d.ts +3 -1
  2. package/lib/code-editor/CodeDiffView.d.ts.map +1 -1
  3. package/lib/code-editor/CodeDiffView.js +6 -2
  4. package/lib/code-editor/CodeDiffView.js.map +1 -1
  5. package/lib/code-editor/CodeEditor.d.ts +8 -2
  6. package/lib/code-editor/CodeEditor.d.ts.map +1 -1
  7. package/lib/code-editor/CodeEditor.js +42 -4
  8. package/lib/code-editor/CodeEditor.js.map +1 -1
  9. package/lib/code-editor/index.d.ts +0 -5
  10. package/lib/code-editor/index.d.ts.map +1 -1
  11. package/lib/code-editor/index.js +0 -5
  12. package/lib/code-editor/index.js.map +1 -1
  13. package/lib/index.css +1 -1
  14. package/package.json +29 -29
  15. package/src/code-editor/CodeDiffView.tsx +10 -3
  16. package/src/code-editor/CodeEditor.tsx +69 -4
  17. package/src/code-editor/index.ts +0 -6
  18. package/tsconfig.json +1 -15
  19. package/lib/code-editor/CodeEditorTheme.d.ts +0 -41
  20. package/lib/code-editor/CodeEditorTheme.d.ts.map +0 -1
  21. package/lib/code-editor/CodeEditorTheme.js +0 -99
  22. package/lib/code-editor/CodeEditorTheme.js.map +0 -1
  23. package/lib/code-editor/CodeEditorUtils.d.ts +0 -74
  24. package/lib/code-editor/CodeEditorUtils.d.ts.map +0 -1
  25. package/lib/code-editor/CodeEditorUtils.js +0 -203
  26. package/lib/code-editor/CodeEditorUtils.js.map +0 -1
  27. package/lib/code-editor/PureLanguage.d.ts +0 -38
  28. package/lib/code-editor/PureLanguage.d.ts.map +0 -1
  29. package/lib/code-editor/PureLanguage.js +0 -39
  30. package/lib/code-editor/PureLanguage.js.map +0 -1
  31. package/lib/code-editor/PureLanguageCodeEditorSupport.d.ts +0 -71
  32. package/lib/code-editor/PureLanguageCodeEditorSupport.d.ts.map +0 -1
  33. package/lib/code-editor/PureLanguageCodeEditorSupport.js +0 -238
  34. package/lib/code-editor/PureLanguageCodeEditorSupport.js.map +0 -1
  35. package/lib/code-editor/PureLanguageService.d.ts +0 -19
  36. package/lib/code-editor/PureLanguageService.d.ts.map +0 -1
  37. package/lib/code-editor/PureLanguageService.js +0 -373
  38. package/lib/code-editor/PureLanguageService.js.map +0 -1
  39. package/lib/code-editor/themes/Github-Theme-dark-dimmed.json +0 -613
  40. package/lib/code-editor/themes/Github-Theme-dark.json +0 -513
  41. package/lib/code-editor/themes/Github-Theme-light.json +0 -598
  42. package/lib/code-editor/themes/Material-Theme-Darker.json +0 -816
  43. package/lib/code-editor/themes/Material-Theme-Default.json +0 -816
  44. package/lib/code-editor/themes/MonacoEditorThemeUtils.d.ts +0 -31
  45. package/lib/code-editor/themes/MonacoEditorThemeUtils.d.ts.map +0 -1
  46. package/lib/code-editor/themes/MonacoEditorThemeUtils.js +0 -88
  47. package/lib/code-editor/themes/MonacoEditorThemeUtils.js.map +0 -1
  48. package/lib/code-editor/themes/OneDark-Pro-darker.json +0 -2061
  49. package/lib/code-editor/themes/OneDark-Pro.json +0 -2090
  50. package/lib/code-editor/themes/solarized-dark-color-theme.json +0 -398
  51. package/src/code-editor/CodeEditorTheme.ts +0 -151
  52. package/src/code-editor/CodeEditorUtils.ts +0 -336
  53. package/src/code-editor/PureLanguage.ts +0 -42
  54. package/src/code-editor/PureLanguageCodeEditorSupport.ts +0 -341
  55. package/src/code-editor/PureLanguageService.ts +0 -416
  56. package/src/code-editor/themes/Github-Theme-dark-dimmed.json +0 -613
  57. package/src/code-editor/themes/Github-Theme-dark.json +0 -513
  58. package/src/code-editor/themes/Github-Theme-light.json +0 -598
  59. package/src/code-editor/themes/Material-Theme-Darker.json +0 -816
  60. package/src/code-editor/themes/Material-Theme-Default.json +0 -816
  61. package/src/code-editor/themes/MonacoEditorThemeUtils.ts +0 -128
  62. package/src/code-editor/themes/OneDark-Pro-darker.json +0 -2061
  63. package/src/code-editor/themes/OneDark-Pro.json +0 -2090
  64. package/src/code-editor/themes/README.md +0 -8
  65. package/src/code-editor/themes/solarized-dark-color-theme.json +0 -423
@@ -13,7 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { CODE_EDITOR_LANGUAGE } from './CodeEditorUtils.js';
16
+ import { editor as monacoEditorAPI } from 'monaco-editor';
17
+ import { CODE_EDITOR_LANGUAGE } from '@finos/legend-code-editor';
18
+ export declare const disposeDiffCodeEditor: (editor: monacoEditorAPI.IStandaloneDiffEditor) => void;
17
19
  export declare const CodeDiffView: ((props: {
18
20
  language: CODE_EDITOR_LANGUAGE;
19
21
  from?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"CodeDiffView.d.ts","sourceRoot":"","sources":["../../src/code-editor/CodeDiffView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAeH,OAAO,EACL,oBAAoB,EAGrB,MAAM,sBAAsB,CAAC;AAG9B,eAAO,MAAM,YAAY,WACf;IACN,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzB;;CAiDF,CAAC;AAaF,eAAO,MAAM,YAAY,WACf;IACN,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,EAAE,CAAC,EAAE,OAAO,CAAC;IACb;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;;CAWF,CAAC"}
1
+ {"version":3,"file":"CodeDiffView.d.ts","sourceRoot":"","sources":["../../src/code-editor/CodeDiffView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAW1D,OAAO,EACL,oBAAoB,EAGrB,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,qBAAqB,WACxB,eAAe,CAAC,qBAAqB,KAC5C,IAIF,CAAC;AAEF,eAAO,MAAM,YAAY,WACf;IACN,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzB;;CAiDF,CAAC;AAaF,eAAO,MAAM,YAAY,WACf;IACN,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,EAAE,CAAC,EAAE,OAAO,CAAC;IACb;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;;CAWF,CAAC"}
@@ -19,8 +19,12 @@ import { observer } from 'mobx-react-lite';
19
19
  import { editor as monacoEditorAPI } from 'monaco-editor';
20
20
  import { DEFAULT_TAB_SIZE, useApplicationStore, } from '@finos/legend-application';
21
21
  import { isString, stringifyLosslessJSON, tryToFormatJSONString, tryToFormatLosslessJSONString, } from '@finos/legend-shared';
22
- import { CODE_EDITOR_LANGUAGE, disposeDiffCodeEditor, getBaseCodeEditorOptions, } from './CodeEditorUtils.js';
23
- import { CODE_EDITOR_THEME } from './CodeEditorTheme.js';
22
+ import { CODE_EDITOR_LANGUAGE, CODE_EDITOR_THEME, getBaseCodeEditorOptions, } from '@finos/legend-code-editor';
23
+ export const disposeDiffCodeEditor = (editor) => {
24
+ editor.dispose();
25
+ editor.getOriginalEditor().getModel()?.dispose();
26
+ editor.getModifiedEditor().getModel()?.dispose();
27
+ };
24
28
  export const CodeDiffView = observer((props) => {
25
29
  const { from, to, language } = props;
26
30
  const applicationStore = useApplicationStore();
@@ -1 +1 @@
1
- {"version":3,"file":"CodeDiffView.js","sourceRoot":"","sources":["../../src/code-editor/CodeDiffView.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,M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,MAAM,CAAC,CACT,CAAC;IAEF,OAAO,CACL,cAAK,SAAS,EAAC,wBAAwB,YACrC,cAAK,SAAS,EAAC,mBAAmB,EAAC,GAAG,EAAE,SAAS,GAAI,GACjD,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,KAAc,EAAE,QAAiB,EAAU,EAAE,CACxE,KAAK;IACH,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QACf,CAAC,CAAC,QAAQ;YACR,CAAC,CAAC,6BAA6B,CAAC,KAAK,CAAC;YACtC,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC;QAChC,CAAC,CAAC,QAAQ;YACR,CAAC,CAAC,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,gBAAgB,CAAC;YAC3D,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,gBAAgB,CAAC;IACxD,CAAC,CAAC,EAAE,CAAC;AAET,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAClC,CAAC,KAOA,EAAE,EAAE;IACH,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAErC,OAAO,CACL,KAAC,YAAY,IACX,QAAQ,EAAE,oBAAoB,CAAC,IAAI,EACnC,IAAI,EAAE,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,EAClD,EAAE,EAAE,mBAAmB,CAAC,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,GAC9C,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -14,9 +14,15 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { editor as monacoEditorAPI } from 'monaco-editor';
17
- import { type CODE_EDITOR_LANGUAGE } from './CodeEditorUtils.js';
18
- import { CODE_EDITOR_THEME } from './CodeEditorTheme.js';
17
+ import { type CODE_EDITOR_LANGUAGE, CODE_EDITOR_THEME } from '@finos/legend-code-editor';
18
+ import { type GenericLegendApplicationStore } from '@finos/legend-application';
19
19
  import type { CompilationError, ParserError } from '@finos/legend-graph';
20
+ export declare const configureCodeEditorComponent: (applicationStore: GenericLegendApplicationStore) => Promise<void>;
21
+ /**
22
+ * Normally `monaco-editor` worker disposes after 5 minutes staying idle, but we fasten
23
+ * this pace just in case the usage of the editor causes memory-leak somehow
24
+ */
25
+ export declare const disposeCodeEditor: (editor: monacoEditorAPI.IStandaloneCodeEditor) => void;
20
26
  export declare const CodeEditor: React.FC<{
21
27
  inputValue: string;
22
28
  isReadOnly?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../src/code-editor/CodeEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAoB,MAAM,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAML,KAAK,oBAAoB,EAG1B,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEzE,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,WAAW,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,S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AAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAClD,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,kBAAkB,CAAC,EACf,CAAC,eAAe,CAAC,cAAc,GAAG,eAAe,CAAC,oBAAoB,CAAC,GACvE,SAAS,CAAC;IACd,KAAK,CAAC,EAAE,WAAW,GAAG,gBAAgB,GAAG,SAAS,CAAC;CACpD,CAyKA,CAAC"}
@@ -15,11 +15,49 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
15
  * limitations under the License.
16
16
  */
17
17
  import { useState, useRef, useEffect } from 'react';
18
- import { editor as monacoEditorAPI } from 'monaco-editor';
19
- import { disposeCodeEditor, getBaseCodeEditorOptions, resetLineNumberGutterWidth, getCodeEditorValue, normalizeLineEnding, setErrorMarkers, clearMarkers, } from './CodeEditorUtils.js';
20
- import { DEFAULT_TAB_SIZE, useApplicationStore, } from '@finos/legend-application';
21
- import { CODE_EDITOR_THEME } from './CodeEditorTheme.js';
18
+ import { editor as monacoEditorAPI, KeyCode, KeyMod, } from 'monaco-editor';
19
+ import { getBaseCodeEditorOptions, resetLineNumberGutterWidth, getCodeEditorValue, normalizeLineEnding, setErrorMarkers, clearMarkers, CODE_EDITOR_THEME, configureCodeEditor, } from '@finos/legend-code-editor';
20
+ import { DEFAULT_TAB_SIZE, useApplicationStore, APPLICATION_EVENT, DEFAULT_MONOSPACED_FONT_FAMILY, } from '@finos/legend-application';
22
21
  import { clsx, WordWrapIcon } from '@finos/legend-art';
22
+ import { LogEvent } from '@finos/legend-shared';
23
+ export const configureCodeEditorComponent = async (applicationStore) => {
24
+ await configureCodeEditor(DEFAULT_MONOSPACED_FONT_FAMILY, (error) => applicationStore.logService.error(LogEvent.create(APPLICATION_EVENT.APPLICATION_SETUP__FAILURE), error.message));
25
+ // override native hotkeys supported by monaco-editor
26
+ // here we map these keys to a dummy command that would just dispatch the key combination
27
+ // to the application keyboard shortcut service, effectively bypassing the command associated
28
+ // with the native keybinding
29
+ const OVERRIDE_DEFAULT_KEYBINDING_COMMAND = 'legend.code-editor.override-default-keybinding';
30
+ monacoEditorAPI.registerCommand(OVERRIDE_DEFAULT_KEYBINDING_COMMAND, (accessor, ...args) => {
31
+ applicationStore.keyboardShortcutsService.dispatch(args[0]);
32
+ });
33
+ const hotkeyMapping = [
34
+ [KeyCode.F1, 'F1'], // show command center
35
+ [KeyCode.F8, 'F8'], // show error
36
+ [KeyCode.F9, 'F9'], // toggle debugger breakpoint
37
+ [KeyMod.WinCtrl | KeyCode.KeyG, 'Control+KeyG'], // go-to line command
38
+ [KeyMod.WinCtrl | KeyCode.KeyB, 'Control+KeyB'], // cursor move (core command)
39
+ [KeyMod.WinCtrl | KeyCode.KeyO, 'Control+KeyO'], // cursor move (core command)
40
+ [KeyMod.WinCtrl | KeyCode.KeyD, 'Control+KeyD'], // cursor move (core command)
41
+ [KeyMod.WinCtrl | KeyCode.KeyP, 'Control+KeyP'], // cursor move (core command)
42
+ [KeyMod.Shift | KeyCode.F10, 'Shift+F10'], // show editor context menu
43
+ [KeyMod.WinCtrl | KeyCode.F2, 'Control+F2'], // change all instances
44
+ [KeyMod.WinCtrl | KeyCode.F12, 'Control+F12'], // go-to definition
45
+ ];
46
+ monacoEditorAPI.addKeybindingRules(hotkeyMapping.map(([nativeCodeEditorKeyBinding, keyCombination]) => ({
47
+ keybinding: nativeCodeEditorKeyBinding,
48
+ command: OVERRIDE_DEFAULT_KEYBINDING_COMMAND,
49
+ commandArgs: keyCombination,
50
+ })));
51
+ };
52
+ /**
53
+ * Normally `monaco-editor` worker disposes after 5 minutes staying idle, but we fasten
54
+ * this pace just in case the usage of the editor causes memory-leak somehow
55
+ */
56
+ export const disposeCodeEditor = (editor) => {
57
+ editor.dispose();
58
+ // NOTE: just to be sure, we dispose the model after disposing the editor
59
+ editor.getModel()?.dispose();
60
+ };
23
61
  export const CodeEditor = (props) => {
24
62
  const { inputValue, updateInput, lightTheme, language, isReadOnly, hideMinimap, hideGutter, hidePadding, hideActionBar, lineToScroll, extraEditorOptions, error, } = props;
25
63
  const applicationStore = useApplicationStore();
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditor.js","sourceRoot":"","sources":["../../src/code-editor/CodeEditor.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAoB,MAAM,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EAEnB,eAAe,EACf,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGvD,MAAM,CAAC,MAAM,UAAU,GAelB,CAAC,KAAK,EAAE,EAAE;IACb,MAAM,EACJ,UAAU,EACV,WAAW,EACX,UAAU,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,KAAK,GACN,GAAG,KAAK,CAAC;IACV,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,EAEjC,CAAC;IACJ,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,oCAAoC,GAAG,MAAM,CACjD,SAAS,CACV,CAAC;IAEF;;;;;;;OAOG;IACH,MAAM,KAAK,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,YAAY,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AAK,SAAS,EAAC,mBAAmB,EAAC,GAAG,EAAE,YAAY,GAAI,GACpD,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -13,11 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { setupPureLanguageService } from './PureLanguageService.js';
17
- export { PURE_GRAMMAR_TOKEN } from './PureLanguage.js';
18
- export * from './PureLanguageCodeEditorSupport.js';
19
16
  export * from './CodeEditor.js';
20
- export * from './CodeEditorUtils.js';
21
- export * from './CodeEditorTheme.js';
22
17
  export * from './CodeDiffView.js';
23
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/code-editor/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,cAAc,oCAAoC,CAAC;AAEnD,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/code-editor/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
@@ -13,11 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { setupPureLanguageService } from './PureLanguageService.js';
17
- export { PURE_GRAMMAR_TOKEN } from './PureLanguage.js';
18
- export * from './PureLanguageCodeEditorSupport.js';
19
16
  export * from './CodeEditor.js';
20
- export * from './CodeEditorUtils.js';
21
- export * from './CodeEditorTheme.js';
22
17
  export * from './CodeDiffView.js';
23
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/code-editor/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,cAAc,oCAAoC,CAAC;AAEnD,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/code-editor/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
package/lib/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /** @license @finos/legend-lego v1.2.71
1
+ /** @license @finos/legend-lego v2.0.0
2
2
  * Copyright (c) 2020-present, Goldman Sachs
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@finos/legend-lego",
3
- "version": "1.2.71",
4
- "description": "Legend shared advanced application components and building blocks",
3
+ "version": "2.0.0",
4
+ "description": "Legend code editor support",
5
5
  "keywords": [
6
6
  "legend",
7
- "component",
8
- "shared-component"
7
+ "code-editor"
9
8
  ],
10
9
  "homepage": "https://github.com/finos/legend-studio/tree/master/packages/legend-lego",
11
10
  "bugs": {
@@ -47,45 +46,46 @@
47
46
  "test:watch": "jest --watch"
48
47
  },
49
48
  "dependencies": {
50
- "@ag-grid-community/client-side-row-model": "32.2.0",
51
- "@ag-grid-community/core": "32.2.0",
52
- "@ag-grid-community/csv-export": "32.2.0",
53
- "@ag-grid-community/react": "32.2.0",
54
- "@ag-grid-community/styles": "32.2.0",
55
- "@ag-grid-enterprise/clipboard": "32.2.0",
56
- "@ag-grid-enterprise/column-tool-panel": "32.2.0",
57
- "@ag-grid-enterprise/core": "32.2.0",
58
- "@ag-grid-enterprise/excel-export": "32.2.0",
59
- "@ag-grid-enterprise/filter-tool-panel": "32.2.0",
60
- "@ag-grid-enterprise/menu": "32.2.0",
61
- "@ag-grid-enterprise/range-selection": "32.2.0",
62
- "@ag-grid-enterprise/row-grouping": "32.2.0",
63
- "@ag-grid-enterprise/server-side-row-model": "32.2.0",
64
- "@ag-grid-enterprise/side-bar": "32.2.0",
65
- "@ag-grid-enterprise/status-bar": "32.2.0",
66
- "@finos/legend-application": "15.1.31",
67
- "@finos/legend-art": "7.1.58",
68
- "@finos/legend-graph": "31.10.32",
69
- "@finos/legend-shared": "10.0.55",
49
+ "@ag-grid-community/client-side-row-model": "32.2.1",
50
+ "@ag-grid-community/core": "32.2.1",
51
+ "@ag-grid-community/csv-export": "32.2.1",
52
+ "@ag-grid-community/react": "32.2.1",
53
+ "@ag-grid-community/styles": "32.2.1",
54
+ "@ag-grid-enterprise/clipboard": "32.2.1",
55
+ "@ag-grid-enterprise/column-tool-panel": "32.2.1",
56
+ "@ag-grid-enterprise/core": "32.2.1",
57
+ "@ag-grid-enterprise/excel-export": "32.2.1",
58
+ "@ag-grid-enterprise/filter-tool-panel": "32.2.1",
59
+ "@ag-grid-enterprise/menu": "32.2.1",
60
+ "@ag-grid-enterprise/range-selection": "32.2.1",
61
+ "@ag-grid-enterprise/row-grouping": "32.2.1",
62
+ "@ag-grid-enterprise/server-side-row-model": "32.2.1",
63
+ "@ag-grid-enterprise/side-bar": "32.2.1",
64
+ "@ag-grid-enterprise/status-bar": "32.2.1",
65
+ "@finos/legend-application": "16.0.0",
66
+ "@finos/legend-art": "7.1.59",
67
+ "@finos/legend-code-editor": "2.0.0",
68
+ "@finos/legend-graph": "31.10.34",
69
+ "@finos/legend-shared": "10.0.56",
70
70
  "@types/css-font-loading-module": "0.0.13",
71
- "@types/react": "18.3.7",
71
+ "@types/react": "18.3.9",
72
72
  "@types/react-dom": "18.3.0",
73
- "mobx": "6.13.2",
73
+ "mobx": "6.13.3",
74
74
  "mobx-react-lite": "4.0.7",
75
- "monaco-editor": "0.51.0",
75
+ "monaco-editor": "0.52.0",
76
76
  "react": "18.3.1",
77
77
  "react-dnd": "16.0.1",
78
78
  "react-dom": "18.3.1"
79
79
  },
80
80
  "devDependencies": {
81
- "@finos/legend-dev-utils": "2.1.21",
81
+ "@finos/legend-dev-utils": "2.1.23",
82
82
  "@jest/globals": "29.7.0",
83
83
  "cross-env": "7.0.3",
84
84
  "eslint": "8.57.1",
85
85
  "jest": "29.7.0",
86
86
  "npm-run-all": "4.1.5",
87
87
  "rimraf": "6.0.1",
88
- "sass": "1.79.1",
88
+ "sass": "1.79.3",
89
89
  "typescript": "5.6.2"
90
90
  },
91
91
  "peerDependencies": {
@@ -29,10 +29,17 @@ import {
29
29
  } from '@finos/legend-shared';
30
30
  import {
31
31
  CODE_EDITOR_LANGUAGE,
32
- disposeDiffCodeEditor,
32
+ CODE_EDITOR_THEME,
33
33
  getBaseCodeEditorOptions,
34
- } from './CodeEditorUtils.js';
35
- import { CODE_EDITOR_THEME } from './CodeEditorTheme.js';
34
+ } from '@finos/legend-code-editor';
35
+
36
+ export const disposeDiffCodeEditor = (
37
+ editor: monacoEditorAPI.IStandaloneDiffEditor,
38
+ ): void => {
39
+ editor.dispose();
40
+ editor.getOriginalEditor().getModel()?.dispose();
41
+ editor.getModifiedEditor().getModel()?.dispose();
42
+ };
36
43
 
37
44
  export const CodeDiffView = observer(
38
45
  (props: {
@@ -15,9 +15,13 @@
15
15
  */
16
16
 
17
17
  import { useState, useRef, useEffect } from 'react';
18
- import { type IDisposable, editor as monacoEditorAPI } from 'monaco-editor';
19
18
  import {
20
- disposeCodeEditor,
19
+ type IDisposable,
20
+ editor as monacoEditorAPI,
21
+ KeyCode,
22
+ KeyMod,
23
+ } from 'monaco-editor';
24
+ import {
21
25
  getBaseCodeEditorOptions,
22
26
  resetLineNumberGutterWidth,
23
27
  getCodeEditorValue,
@@ -25,14 +29,75 @@ import {
25
29
  type CODE_EDITOR_LANGUAGE,
26
30
  setErrorMarkers,
27
31
  clearMarkers,
28
- } from './CodeEditorUtils.js';
32
+ CODE_EDITOR_THEME,
33
+ configureCodeEditor,
34
+ } from '@finos/legend-code-editor';
29
35
  import {
30
36
  DEFAULT_TAB_SIZE,
31
37
  useApplicationStore,
38
+ APPLICATION_EVENT,
39
+ DEFAULT_MONOSPACED_FONT_FAMILY,
40
+ type GenericLegendApplicationStore,
32
41
  } from '@finos/legend-application';
33
- import { CODE_EDITOR_THEME } from './CodeEditorTheme.js';
34
42
  import { clsx, WordWrapIcon } from '@finos/legend-art';
35
43
  import type { CompilationError, ParserError } from '@finos/legend-graph';
44
+ import { LogEvent } from '@finos/legend-shared';
45
+
46
+ export const configureCodeEditorComponent = async (
47
+ applicationStore: GenericLegendApplicationStore,
48
+ ): Promise<void> => {
49
+ await configureCodeEditor(DEFAULT_MONOSPACED_FONT_FAMILY, (error) =>
50
+ applicationStore.logService.error(
51
+ LogEvent.create(APPLICATION_EVENT.APPLICATION_SETUP__FAILURE),
52
+ error.message,
53
+ ),
54
+ );
55
+
56
+ // override native hotkeys supported by monaco-editor
57
+ // here we map these keys to a dummy command that would just dispatch the key combination
58
+ // to the application keyboard shortcut service, effectively bypassing the command associated
59
+ // with the native keybinding
60
+ const OVERRIDE_DEFAULT_KEYBINDING_COMMAND =
61
+ 'legend.code-editor.override-default-keybinding';
62
+ monacoEditorAPI.registerCommand(
63
+ OVERRIDE_DEFAULT_KEYBINDING_COMMAND,
64
+ (accessor, ...args) => {
65
+ applicationStore.keyboardShortcutsService.dispatch(args[0]);
66
+ },
67
+ );
68
+ const hotkeyMapping: [number, string][] = [
69
+ [KeyCode.F1, 'F1'], // show command center
70
+ [KeyCode.F8, 'F8'], // show error
71
+ [KeyCode.F9, 'F9'], // toggle debugger breakpoint
72
+ [KeyMod.WinCtrl | KeyCode.KeyG, 'Control+KeyG'], // go-to line command
73
+ [KeyMod.WinCtrl | KeyCode.KeyB, 'Control+KeyB'], // cursor move (core command)
74
+ [KeyMod.WinCtrl | KeyCode.KeyO, 'Control+KeyO'], // cursor move (core command)
75
+ [KeyMod.WinCtrl | KeyCode.KeyD, 'Control+KeyD'], // cursor move (core command)
76
+ [KeyMod.WinCtrl | KeyCode.KeyP, 'Control+KeyP'], // cursor move (core command)
77
+ [KeyMod.Shift | KeyCode.F10, 'Shift+F10'], // show editor context menu
78
+ [KeyMod.WinCtrl | KeyCode.F2, 'Control+F2'], // change all instances
79
+ [KeyMod.WinCtrl | KeyCode.F12, 'Control+F12'], // go-to definition
80
+ ];
81
+ monacoEditorAPI.addKeybindingRules(
82
+ hotkeyMapping.map(([nativeCodeEditorKeyBinding, keyCombination]) => ({
83
+ keybinding: nativeCodeEditorKeyBinding,
84
+ command: OVERRIDE_DEFAULT_KEYBINDING_COMMAND,
85
+ commandArgs: keyCombination,
86
+ })),
87
+ );
88
+ };
89
+
90
+ /**
91
+ * Normally `monaco-editor` worker disposes after 5 minutes staying idle, but we fasten
92
+ * this pace just in case the usage of the editor causes memory-leak somehow
93
+ */
94
+ export const disposeCodeEditor = (
95
+ editor: monacoEditorAPI.IStandaloneCodeEditor,
96
+ ): void => {
97
+ editor.dispose();
98
+ // NOTE: just to be sure, we dispose the model after disposing the editor
99
+ editor.getModel()?.dispose();
100
+ };
36
101
 
37
102
  export const CodeEditor: React.FC<{
38
103
  inputValue: string;
@@ -14,11 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- export { setupPureLanguageService } from './PureLanguageService.js';
18
- export { PURE_GRAMMAR_TOKEN } from './PureLanguage.js';
19
- export * from './PureLanguageCodeEditorSupport.js';
20
-
21
17
  export * from './CodeEditor.js';
22
- export * from './CodeEditorUtils.js';
23
- export * from './CodeEditorTheme.js';
24
18
  export * from './CodeDiffView.js';
package/tsconfig.json CHANGED
@@ -46,15 +46,9 @@
46
46
  "files": [
47
47
  "./src/application/TabManagerState.ts",
48
48
  "./src/application/index.ts",
49
- "./src/code-editor/CodeEditorTheme.ts",
50
- "./src/code-editor/CodeEditorUtils.ts",
51
- "./src/code-editor/PureLanguage.ts",
52
- "./src/code-editor/PureLanguageCodeEditorSupport.ts",
53
- "./src/code-editor/PureLanguageService.ts",
54
49
  "./src/code-editor/__test__.ts",
55
50
  "./src/code-editor/index.ts",
56
51
  "./src/code-editor/__test-utils__/MockedMonacoEditor.ts",
57
- "./src/code-editor/themes/MonacoEditorThemeUtils.ts",
58
52
  "./src/data-grid/index.ts",
59
53
  "./src/graph-editor/index.ts",
60
54
  "./src/application/ActivityBar.tsx",
@@ -68,15 +62,7 @@
68
62
  "./src/code-editor/__test-utils__/MonacoEditorMockUtils.tsx",
69
63
  "./src/data-grid/DataGrid.tsx",
70
64
  "./src/graph-editor/ElementIconUtils.tsx",
71
- "./src/graph-editor/PackageableElementOption.tsx",
72
- "./src/code-editor/themes/Github-Theme-dark-dimmed.json",
73
- "./src/code-editor/themes/Github-Theme-dark.json",
74
- "./src/code-editor/themes/Github-Theme-light.json",
75
- "./src/code-editor/themes/Material-Theme-Darker.json",
76
- "./src/code-editor/themes/Material-Theme-Default.json",
77
- "./src/code-editor/themes/OneDark-Pro-darker.json",
78
- "./src/code-editor/themes/OneDark-Pro.json",
79
- "./src/code-editor/themes/solarized-dark-color-theme.json"
65
+ "./src/graph-editor/PackageableElementOption.tsx"
80
66
  ],
81
67
  "include": [
82
68
  "src/**/*.ts",
@@ -1,41 +0,0 @@
1
- /**
2
- * Copyright (c) 2020-present, Goldman Sachs
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { editor as monacoEditorAPI } from 'monaco-editor';
17
- export declare enum CODE_EDITOR_THEME {
18
- DEFAULT_DARK = "default-dark",
19
- GITHUB_LIGHT = "github-light",
20
- GITHUB_DARK = "github-dark",
21
- GITHUB_DARK_DIMMED = "github-dark-dimmed",
22
- SOLARIZED_DARK = "solarized-dark",
23
- ONE_DARK_PRO = "one-dark-pro",
24
- ONE_DARK_PRO_DARKER = "one-dark-pro-darker",
25
- MATERIAL_DEFAULT = "material-default",
26
- MATERIAL_DARKER = "material-darker",
27
- BUILT_IN__VSCODE_LIGHT = "vs",
28
- BUILT_IN__VSCODE_DARK = "vs-dark",
29
- BUILT_IN__VSCODE_HC_BLACK = "hc-black",
30
- BUILT_IN__VSCODE_HC_LIGHT = "hc-light"
31
- }
32
- export declare const DEFAULT_DARK_THEME: monacoEditorAPI.IStandaloneThemeData;
33
- export declare const SOLARIZED_DARK_THEME: monacoEditorAPI.IStandaloneThemeData;
34
- export declare const GITHUB_DARK_THEME: monacoEditorAPI.IStandaloneThemeData;
35
- export declare const GITHUB_LIGHT_THEME: monacoEditorAPI.IStandaloneThemeData;
36
- export declare const GITHUB_DARK_DIMMED_THEME: monacoEditorAPI.IStandaloneThemeData;
37
- export declare const MATERIAL_DEFAULT_THEME: monacoEditorAPI.IStandaloneThemeData;
38
- export declare const MATERIAL_DARKER_THEME: monacoEditorAPI.IStandaloneThemeData;
39
- export declare const ONE_DARK_PRO_THEME: monacoEditorAPI.IStandaloneThemeData;
40
- export declare const ONE_DARK_PRO_DARKER_THEME: monacoEditorAPI.IStandaloneThemeData;
41
- //# sourceMappingURL=CodeEditorTheme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CodeEditorTheme.d.ts","sourceRoot":"","sources":["../../src/code-editor/CodeEditorTheme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AA6B/D,oBAAY,iBAAiB;IAC3B,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,kBAAkB,uBAAuB;IACzC,cAAc,mBAAmB;IACjC,YAAY,iBAAiB;IAC7B,mBAAmB,wBAAwB;IAC3C,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IAInC,sBAAsB,OAAO;IAC7B,qBAAqB,YAAY;IACjC,yBAAyB,aAAa;IACtC,yBAAyB,aAAa;CACvC;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAAC,oBAYhD,CAAC;AAEF,eAAO,MAAM,oBAAoB,sCAKhC,CAAC;AAEF,eAAO,MAAM,iBAAiB,sCAK7B,CAAC;AAEF,eAAO,MAAM,kBAAkB,sCAsB9B,CAAC;AAEF,eAAO,MAAM,wBAAwB,sCAKpC,CAAC;AAEF,eAAO,MAAM,sBAAsB,sCAKlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,sCAKjC,CAAC;AAEF,eAAO,MAAM,kBAAkB,sCAK9B,CAAC;AAEF,eAAO,MAAM,yBAAyB,sCAKrC,CAAC"}
@@ -1,99 +0,0 @@
1
- /**
2
- * Copyright (c) 2020-present, Goldman Sachs
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { PURE_GRAMMAR_TOKEN } from './PureLanguage.js';
17
- import { buildCodeEditorTheme } from './themes/MonacoEditorThemeUtils.js';
18
- import SOLARIZED_DARK_THEME_DATA from './themes/solarized-dark-color-theme.json' with { type: 'json' };
19
- import GITHUB_DARK_THEME_DATA from './themes/Github-Theme-dark.json' with { type: 'json' };
20
- import GITHUB_DARK_DIMMED_THEME_DATA from './themes/Github-Theme-dark-dimmed.json' with { type: 'json' };
21
- import GITHUB_LIGHT_THEME_DATA from './themes/Github-Theme-light.json' with { type: 'json' };
22
- import MATERIAL_DEFAULT_THEME_DATA from './themes/Material-Theme-Default.json' with { type: 'json' };
23
- import MATERIAL_DARKER_THEME_DATA from './themes/Material-Theme-Darker.json' with { type: 'json' };
24
- import ONE_DARK_PRO_THEME_DATA from './themes/OneDark-Pro.json' with { type: 'json' };
25
- import ONE_DARK_PRO_DARKER_THEME_DATA from './themes/OneDark-Pro-darker.json' with { type: 'json' };
26
- const BASE_PURE_LANGUAGE_COLOR_TOKENS = [
27
- // NOTE: `monaco-editor` only accepts HEX values, not CSS variables
28
- { token: PURE_GRAMMAR_TOKEN.IDENTIFIER, foreground: 'dcdcaa' },
29
- { token: PURE_GRAMMAR_TOKEN.NUMBER, foreground: 'b5cea8' },
30
- { token: PURE_GRAMMAR_TOKEN.DATE, foreground: 'b5cea8' },
31
- { token: PURE_GRAMMAR_TOKEN.COLOR, foreground: 'b5cea8' },
32
- { token: PURE_GRAMMAR_TOKEN.PACKAGE, foreground: '808080' },
33
- { token: PURE_GRAMMAR_TOKEN.PARSER, foreground: 'c586c0' },
34
- { token: PURE_GRAMMAR_TOKEN.LANGUAGE_STRUCT, foreground: 'c586c0' },
35
- { token: PURE_GRAMMAR_TOKEN.MULTIPLICITY, foreground: '2d796b' },
36
- { token: PURE_GRAMMAR_TOKEN.GENERICS, foreground: '2d796b' },
37
- { token: PURE_GRAMMAR_TOKEN.PROPERTY, foreground: '9cdcfe' },
38
- { token: PURE_GRAMMAR_TOKEN.PARAMETER, foreground: '9cdcfe' },
39
- { token: PURE_GRAMMAR_TOKEN.VARIABLE, foreground: '4fc1ff' },
40
- { token: PURE_GRAMMAR_TOKEN.TYPE, foreground: '3dc9b0' },
41
- { token: `${PURE_GRAMMAR_TOKEN.STRING}.escape`, foreground: 'd7ba7d' },
42
- ];
43
- export var CODE_EDITOR_THEME;
44
- (function (CODE_EDITOR_THEME) {
45
- CODE_EDITOR_THEME["DEFAULT_DARK"] = "default-dark";
46
- CODE_EDITOR_THEME["GITHUB_LIGHT"] = "github-light";
47
- CODE_EDITOR_THEME["GITHUB_DARK"] = "github-dark";
48
- CODE_EDITOR_THEME["GITHUB_DARK_DIMMED"] = "github-dark-dimmed";
49
- CODE_EDITOR_THEME["SOLARIZED_DARK"] = "solarized-dark";
50
- CODE_EDITOR_THEME["ONE_DARK_PRO"] = "one-dark-pro";
51
- CODE_EDITOR_THEME["ONE_DARK_PRO_DARKER"] = "one-dark-pro-darker";
52
- CODE_EDITOR_THEME["MATERIAL_DEFAULT"] = "material-default";
53
- CODE_EDITOR_THEME["MATERIAL_DARKER"] = "material-darker";
54
- // default themes in Monaco editor
55
- // See https://github.com/microsoft/vscode/blob/main/src/vs/editor/standalone/common/themes.ts
56
- CODE_EDITOR_THEME["BUILT_IN__VSCODE_LIGHT"] = "vs";
57
- CODE_EDITOR_THEME["BUILT_IN__VSCODE_DARK"] = "vs-dark";
58
- CODE_EDITOR_THEME["BUILT_IN__VSCODE_HC_BLACK"] = "hc-black";
59
- CODE_EDITOR_THEME["BUILT_IN__VSCODE_HC_LIGHT"] = "hc-light";
60
- })(CODE_EDITOR_THEME || (CODE_EDITOR_THEME = {}));
61
- export const DEFAULT_DARK_THEME = {
62
- base: 'vs-dark',
63
- inherit: true,
64
- colors: {},
65
- rules: [
66
- ...BASE_PURE_LANGUAGE_COLOR_TOKENS,
67
- // NOTE: correct a problem with syntax highlighting of string in SQL
68
- { token: 'string.sql', foreground: 'ce9178' },
69
- { token: 'white.sql', foreground: 'd4d4d4' },
70
- { token: 'identifier.sql', foreground: 'd4d4d4' },
71
- { token: 'operator.sql', foreground: 'd4d4d4' },
72
- ],
73
- };
74
- export const SOLARIZED_DARK_THEME = buildCodeEditorTheme(SOLARIZED_DARK_THEME_DATA, CODE_EDITOR_THEME.BUILT_IN__VSCODE_DARK, {}, []);
75
- export const GITHUB_DARK_THEME = buildCodeEditorTheme(GITHUB_DARK_THEME_DATA, CODE_EDITOR_THEME.BUILT_IN__VSCODE_DARK, {}, []);
76
- export const GITHUB_LIGHT_THEME = buildCodeEditorTheme(GITHUB_LIGHT_THEME_DATA, CODE_EDITOR_THEME.BUILT_IN__VSCODE_LIGHT, {}, [
77
- // NOTE: `monaco-editor` only accepts HEX values, not CSS variables
78
- // { token: PURE_GRAMMAR_TOKEN.IDENTIFIER, foreground: '000000' },
79
- // { token: PURE_GRAMMAR_TOKEN.NUMBER, foreground: 'b5cea8' },
80
- // { token: PURE_GRAMMAR_TOKEN.DATE, foreground: 'b5cea8' },
81
- // { token: PURE_GRAMMAR_TOKEN.COLOR, foreground: 'b5cea8' },
82
- // { token: PURE_GRAMMAR_TOKEN.PACKAGE, foreground: '808080' },
83
- // { token: PURE_GRAMMAR_TOKEN.PARSER, foreground: 'c586c0' },
84
- // { token: PURE_GRAMMAR_TOKEN.LANGUAGE_STRUCT, foreground: 'c586c0' },
85
- // { token: PURE_GRAMMAR_TOKEN.MULTIPLICITY, foreground: '2d796b' },
86
- // { token: PURE_GRAMMAR_TOKEN.GENERICS, foreground: '2d796b' },
87
- // { token: PURE_GRAMMAR_TOKEN.PROPERTY, foreground: '9cdcfe' },
88
- // { token: PURE_GRAMMAR_TOKEN.PARAMETER, foreground: '9cdcfe' },
89
- // { token: PURE_GRAMMAR_TOKEN.VARIABLE, foreground: '4fc1ff' },
90
- // { token: PURE_GRAMMAR_TOKEN.TYPE, foreground: '3dc9b0' },
91
- // { token: `${PURE_GRAMMAR_TOKEN.STRING}.escape`, foreground: 'd7ba7d' },
92
- // TODO: handle SQL formatting like in dark theme?
93
- ]);
94
- export const GITHUB_DARK_DIMMED_THEME = buildCodeEditorTheme(GITHUB_DARK_DIMMED_THEME_DATA, CODE_EDITOR_THEME.BUILT_IN__VSCODE_DARK, {}, []);
95
- export const MATERIAL_DEFAULT_THEME = buildCodeEditorTheme(MATERIAL_DEFAULT_THEME_DATA, CODE_EDITOR_THEME.BUILT_IN__VSCODE_DARK, {}, []);
96
- export const MATERIAL_DARKER_THEME = buildCodeEditorTheme(MATERIAL_DARKER_THEME_DATA, CODE_EDITOR_THEME.BUILT_IN__VSCODE_DARK, {}, []);
97
- export const ONE_DARK_PRO_THEME = buildCodeEditorTheme(ONE_DARK_PRO_THEME_DATA, CODE_EDITOR_THEME.BUILT_IN__VSCODE_DARK, {}, []);
98
- export const ONE_DARK_PRO_DARKER_THEME = buildCodeEditorTheme(ONE_DARK_PRO_DARKER_THEME_DATA, CODE_EDITOR_THEME.BUILT_IN__VSCODE_DARK, {}, []);
99
- //# sourceMappingURL=CodeEditorTheme.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CodeEditorTheme.js","sourceRoot":"","sources":["../../src/code-editor/CodeEditorTheme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,yBAAyB,MAAM,0CAA0C,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACvG,OAAO,sBAAsB,MAAM,iCAAiC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC3F,OAAO,6BAA6B,MAAM,wCAAwC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACzG,OAAO,uBAAuB,MAAM,kCAAkC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC7F,OAAO,2BAA2B,MAAM,sCAAsC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACrG,OAAO,0BAA0B,MAAM,qCAAqC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACnG,OAAO,uBAAuB,MAAM,2BAA2B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACtF,OAAO,8BAA8B,MAAM,kCAAkC,C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