@finos/legend-application 14.0.3 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/lib/__lib__/LegendApplicationDocumentation.d.ts.map +1 -0
  2. package/lib/__lib__/LegendApplicationDocumentation.js.map +1 -0
  3. package/lib/{application → __lib__}/LegendApplicationEvent.d.ts +0 -1
  4. package/lib/__lib__/LegendApplicationEvent.d.ts.map +1 -0
  5. package/lib/{application → __lib__}/LegendApplicationEvent.js +0 -1
  6. package/lib/__lib__/LegendApplicationEvent.js.map +1 -0
  7. package/lib/__lib__/LegendApplicationNavigation.d.ts +19 -0
  8. package/lib/__lib__/LegendApplicationNavigation.d.ts.map +1 -0
  9. package/lib/__lib__/LegendApplicationNavigation.js +20 -0
  10. package/lib/__lib__/LegendApplicationNavigation.js.map +1 -0
  11. package/lib/__lib__/LegendApplicationSetting.d.ts.map +1 -0
  12. package/lib/__lib__/LegendApplicationSetting.js.map +1 -0
  13. package/lib/{application → __lib__}/LegendApplicationTelemetry.d.ts +0 -11
  14. package/lib/__lib__/LegendApplicationTelemetry.d.ts.map +1 -0
  15. package/lib/{application → __lib__}/LegendApplicationTelemetry.js +0 -4
  16. package/lib/__lib__/LegendApplicationTelemetry.js.map +1 -0
  17. package/lib/__lib__/LegendApplicationTheme.d.ts.map +1 -0
  18. package/lib/__lib__/LegendApplicationTheme.js.map +1 -0
  19. package/lib/__test__.d.ts +18 -0
  20. package/lib/__test__.d.ts.map +1 -0
  21. package/lib/__test__.js +18 -0
  22. package/lib/__test__.js.map +1 -0
  23. package/lib/application/LegendApplication.d.ts +7 -4
  24. package/lib/application/LegendApplication.d.ts.map +1 -1
  25. package/lib/application/LegendApplication.js +28 -11
  26. package/lib/application/LegendApplication.js.map +1 -1
  27. package/lib/application/LegendApplicationConfig.d.ts +8 -1
  28. package/lib/application/LegendApplicationConfig.d.ts.map +1 -1
  29. package/lib/application/LegendApplicationConfig.js +6 -2
  30. package/lib/application/LegendApplicationConfig.js.map +1 -1
  31. package/lib/browser.d.ts +19 -0
  32. package/lib/browser.d.ts.map +1 -0
  33. package/lib/browser.js +19 -0
  34. package/lib/browser.js.map +1 -0
  35. package/lib/components/{LegendApplicationComponentFrameworkProvider.d.ts → ApplicationComponentFrameworkProvider.d.ts} +2 -2
  36. package/lib/components/ApplicationComponentFrameworkProvider.d.ts.map +1 -0
  37. package/lib/components/{LegendApplicationComponentFrameworkProvider.js → ApplicationComponentFrameworkProvider.js} +3 -3
  38. package/lib/components/ApplicationComponentFrameworkProvider.js.map +1 -0
  39. package/lib/components/ApplicationFrameworkProvider.d.ts +21 -0
  40. package/lib/components/ApplicationFrameworkProvider.d.ts.map +1 -0
  41. package/lib/components/ApplicationFrameworkProvider.js +39 -0
  42. package/lib/components/ApplicationFrameworkProvider.js.map +1 -0
  43. package/lib/components/{shared/DocumentationLink.d.ts → ApplicationPlatformProvider.d.ts} +4 -10
  44. package/lib/components/ApplicationPlatformProvider.d.ts.map +1 -0
  45. package/lib/components/{WebApplicationNavigatorProviderTestUtils.d.ts → ApplicationPlatformProvider.js} +5 -7
  46. package/lib/components/ApplicationPlatformProvider.js.map +1 -0
  47. package/lib/components/ApplicationStoreProvider.d.ts +3 -4
  48. package/lib/components/ApplicationStoreProvider.d.ts.map +1 -1
  49. package/lib/components/ApplicationStoreProvider.js +6 -23
  50. package/lib/components/ApplicationStoreProvider.js.map +1 -1
  51. package/lib/components/{WebApplicationNavigatorProvider.d.ts → BrowserEnvironmentProvider.d.ts} +3 -4
  52. package/lib/components/BrowserEnvironmentProvider.d.ts.map +1 -0
  53. package/lib/components/BrowserEnvironmentProvider.js +31 -0
  54. package/lib/components/BrowserEnvironmentProvider.js.map +1 -0
  55. package/lib/components/VirtualAssistant.d.ts.map +1 -1
  56. package/lib/components/VirtualAssistant.js +17 -9
  57. package/lib/components/VirtualAssistant.js.map +1 -1
  58. package/lib/components/{shared/FuzzySearchAdvancedConfigMenu.d.ts → __test-utils__/BrowserEnvironmentTestUtils.d.ts} +13 -7
  59. package/lib/components/__test-utils__/BrowserEnvironmentTestUtils.d.ts.map +1 -0
  60. package/lib/components/__test-utils__/BrowserEnvironmentTestUtils.js +42 -0
  61. package/lib/components/__test-utils__/BrowserEnvironmentTestUtils.js.map +1 -0
  62. package/lib/index.css +2 -2
  63. package/lib/index.css.map +1 -1
  64. package/lib/index.d.ts +8 -16
  65. package/lib/index.d.ts.map +1 -1
  66. package/lib/index.js +8 -18
  67. package/lib/index.js.map +1 -1
  68. package/lib/package.json +4 -6
  69. package/lib/stores/{shared/PackageableElementOption.d.ts → ApplicationConfig.d.ts} +6 -7
  70. package/lib/stores/ApplicationConfig.d.ts.map +1 -0
  71. package/lib/stores/ApplicationConfig.js +21 -0
  72. package/lib/stores/ApplicationConfig.js.map +1 -0
  73. package/lib/stores/ApplicationNavigationContextService.js +1 -1
  74. package/lib/stores/ApplicationNavigationContextService.js.map +1 -1
  75. package/lib/stores/ApplicationStore.d.ts +4 -8
  76. package/lib/stores/ApplicationStore.d.ts.map +1 -1
  77. package/lib/stores/ApplicationStore.js +14 -14
  78. package/lib/stores/ApplicationStore.js.map +1 -1
  79. package/lib/stores/AssistantService.d.ts +3 -3
  80. package/lib/stores/AssistantService.d.ts.map +1 -1
  81. package/lib/stores/AssistantService.js +18 -10
  82. package/lib/stores/AssistantService.js.map +1 -1
  83. package/lib/stores/CommandService.js +1 -1
  84. package/lib/stores/CommandService.js.map +1 -1
  85. package/lib/stores/Core_LegendApplicationPlugin.d.ts.map +1 -1
  86. package/lib/stores/Core_LegendApplicationPlugin.js +2 -52
  87. package/lib/stores/Core_LegendApplicationPlugin.js.map +1 -1
  88. package/lib/stores/DocumentationService.d.ts +1 -1
  89. package/lib/stores/DocumentationService.d.ts.map +1 -1
  90. package/lib/stores/DocumentationService.js +4 -5
  91. package/lib/stores/DocumentationService.js.map +1 -1
  92. package/lib/stores/LayoutService.js +3 -3
  93. package/lib/stores/LayoutService.js.map +1 -1
  94. package/lib/stores/LegendApplicationPlugin.d.ts +1 -15
  95. package/lib/stores/LegendApplicationPlugin.d.ts.map +1 -1
  96. package/lib/stores/LegendApplicationPlugin.js +0 -5
  97. package/lib/stores/LegendApplicationPlugin.js.map +1 -1
  98. package/lib/stores/SettingService.d.ts +1 -0
  99. package/lib/stores/SettingService.d.ts.map +1 -1
  100. package/lib/stores/SettingService.js +1 -1
  101. package/lib/stores/SettingService.js.map +1 -1
  102. package/lib/stores/__test-utils__/ApplicationStoreTestUtils.d.ts +18 -0
  103. package/lib/stores/__test-utils__/ApplicationStoreTestUtils.d.ts.map +1 -0
  104. package/lib/stores/__test-utils__/ApplicationStoreTestUtils.js +21 -0
  105. package/lib/stores/__test-utils__/ApplicationStoreTestUtils.js.map +1 -0
  106. package/lib/stores/navigation/BrowserNavigator.d.ts +64 -0
  107. package/lib/stores/navigation/BrowserNavigator.d.ts.map +1 -0
  108. package/lib/stores/navigation/{WebApplicationNavigator.js → BrowserNavigator.js} +22 -3
  109. package/lib/stores/navigation/BrowserNavigator.js.map +1 -0
  110. package/lib/stores/navigation/{WebApplicationNavigator.d.ts → DefaultNavigator.d.ts} +3 -12
  111. package/lib/stores/navigation/DefaultNavigator.d.ts.map +1 -0
  112. package/lib/stores/navigation/DefaultNavigator.js +74 -0
  113. package/lib/stores/navigation/DefaultNavigator.js.map +1 -0
  114. package/lib/stores/navigation/NavigationService.d.ts +7 -0
  115. package/lib/stores/navigation/NavigationService.d.ts.map +1 -1
  116. package/lib/stores/navigation/NavigationService.js.map +1 -1
  117. package/lib/stores/platform/ApplicationPlatform.d.ts +24 -0
  118. package/lib/stores/platform/ApplicationPlatform.d.ts.map +1 -0
  119. package/lib/stores/platform/ApplicationPlatform.js +25 -0
  120. package/lib/stores/platform/ApplicationPlatform.js.map +1 -0
  121. package/lib/stores/platform/BrowserPlatform.d.ts +29 -0
  122. package/lib/stores/platform/BrowserPlatform.d.ts.map +1 -0
  123. package/lib/stores/platform/BrowserPlatform.js +39 -0
  124. package/lib/stores/platform/BrowserPlatform.js.map +1 -0
  125. package/lib/stores/storage/StorageService.d.ts +5 -2
  126. package/lib/stores/storage/StorageService.d.ts.map +1 -1
  127. package/lib/stores/storage/StorageService.js +20 -10
  128. package/lib/stores/storage/StorageService.js.map +1 -1
  129. package/lib/stores/terminal/XTerm.d.ts.map +1 -1
  130. package/lib/stores/terminal/XTerm.js +5 -5
  131. package/lib/stores/terminal/XTerm.js.map +1 -1
  132. package/package.json +7 -9
  133. package/src/{application → __lib__}/LegendApplicationEvent.ts +1 -1
  134. package/{lib/stores/shared/PackageableElementOption.js → src/__lib__/LegendApplicationNavigation.ts} +4 -5
  135. package/src/{application → __lib__}/LegendApplicationTelemetry.ts +0 -24
  136. package/src/{components.ts → __test__.ts} +2 -7
  137. package/src/application/LegendApplication.ts +45 -16
  138. package/src/application/LegendApplicationConfig.ts +13 -2
  139. package/src/browser.ts +19 -0
  140. package/src/components/{LegendApplicationComponentFrameworkProvider.tsx → ApplicationComponentFrameworkProvider.tsx} +2 -2
  141. package/src/components/ApplicationFrameworkProvider.tsx +47 -0
  142. package/src/components/ApplicationPlatformProvider.tsx +29 -0
  143. package/src/components/ApplicationStoreProvider.tsx +8 -33
  144. package/src/components/BrowserEnvironmentProvider.tsx +48 -0
  145. package/src/components/VirtualAssistant.tsx +53 -11
  146. package/src/components/__test-utils__/BrowserEnvironmentTestUtils.tsx +63 -0
  147. package/src/index.ts +12 -24
  148. package/src/stores/ApplicationConfig.ts +22 -0
  149. package/src/stores/ApplicationNavigationContextService.ts +1 -1
  150. package/src/stores/ApplicationStore.ts +18 -19
  151. package/src/stores/AssistantService.ts +20 -9
  152. package/src/stores/CommandService.ts +1 -1
  153. package/src/stores/Core_LegendApplicationPlugin.ts +2 -78
  154. package/src/stores/DocumentationService.ts +4 -5
  155. package/src/stores/LayoutService.ts +3 -3
  156. package/src/stores/LegendApplicationPlugin.ts +1 -21
  157. package/src/stores/SettingService.ts +2 -1
  158. package/src/stores/__test-utils__/ApplicationStoreTestUtils.ts +24 -0
  159. package/src/stores/navigation/{WebApplicationNavigator.ts → BrowserNavigator.ts} +41 -2
  160. package/src/stores/navigation/DefaultNavigator.ts +150 -0
  161. package/src/stores/navigation/NavigationService.ts +8 -0
  162. package/src/stores/{shared/PackageableElementOption.ts → platform/ApplicationPlatform.ts} +14 -11
  163. package/src/stores/platform/BrowserPlatform.ts +54 -0
  164. package/src/stores/storage/StorageService.ts +32 -14
  165. package/src/stores/terminal/XTerm.ts +8 -5
  166. package/tsconfig.json +19 -23
  167. package/lib/application/LegendApplicationDocumentation.d.ts.map +0 -1
  168. package/lib/application/LegendApplicationDocumentation.js.map +0 -1
  169. package/lib/application/LegendApplicationEvent.d.ts.map +0 -1
  170. package/lib/application/LegendApplicationEvent.js.map +0 -1
  171. package/lib/application/LegendApplicationSetting.d.ts.map +0 -1
  172. package/lib/application/LegendApplicationSetting.js.map +0 -1
  173. package/lib/application/LegendApplicationTelemetry.d.ts.map +0 -1
  174. package/lib/application/LegendApplicationTelemetry.js.map +0 -1
  175. package/lib/application/LegendApplicationTheme.d.ts.map +0 -1
  176. package/lib/application/LegendApplicationTheme.js.map +0 -1
  177. package/lib/components/ApplicationStoreProviderTestUtils.d.ts +0 -31
  178. package/lib/components/ApplicationStoreProviderTestUtils.d.ts.map +0 -1
  179. package/lib/components/ApplicationStoreProviderTestUtils.js +0 -32
  180. package/lib/components/ApplicationStoreProviderTestUtils.js.map +0 -1
  181. package/lib/components/LegendApplicationComponentFrameworkProvider.d.ts.map +0 -1
  182. package/lib/components/LegendApplicationComponentFrameworkProvider.js.map +0 -1
  183. package/lib/components/WebApplicationNavigatorProvider.d.ts.map +0 -1
  184. package/lib/components/WebApplicationNavigatorProvider.js +0 -29
  185. package/lib/components/WebApplicationNavigatorProvider.js.map +0 -1
  186. package/lib/components/WebApplicationNavigatorProviderTestUtils.d.ts.map +0 -1
  187. package/lib/components/WebApplicationNavigatorProviderTestUtils.js +0 -28
  188. package/lib/components/WebApplicationNavigatorProviderTestUtils.js.map +0 -1
  189. package/lib/components/shared/DocumentationLink.d.ts.map +0 -1
  190. package/lib/components/shared/DocumentationLink.js +0 -53
  191. package/lib/components/shared/DocumentationLink.js.map +0 -1
  192. package/lib/components/shared/FuzzySearchAdvancedConfigMenu.d.ts.map +0 -1
  193. package/lib/components/shared/FuzzySearchAdvancedConfigMenu.js +0 -37
  194. package/lib/components/shared/FuzzySearchAdvancedConfigMenu.js.map +0 -1
  195. package/lib/components/shared/PackageableElementOptionLabel.d.ts +0 -22
  196. package/lib/components/shared/PackageableElementOptionLabel.d.ts.map +0 -1
  197. package/lib/components/shared/PackageableElementOptionLabel.js +0 -46
  198. package/lib/components/shared/PackageableElementOptionLabel.js.map +0 -1
  199. package/lib/components/shared/TabManager.d.ts +0 -24
  200. package/lib/components/shared/TabManager.d.ts.map +0 -1
  201. package/lib/components/shared/TabManager.js +0 -117
  202. package/lib/components/shared/TabManager.js.map +0 -1
  203. package/lib/components.d.ts +0 -21
  204. package/lib/components.d.ts.map +0 -1
  205. package/lib/components.js +0 -21
  206. package/lib/components.js.map +0 -1
  207. package/lib/const.d.ts +0 -35
  208. package/lib/const.d.ts.map +0 -1
  209. package/lib/const.js +0 -39
  210. package/lib/const.js.map +0 -1
  211. package/lib/stores/ApplicationStoreTestUtils.d.ts +0 -41
  212. package/lib/stores/ApplicationStoreTestUtils.d.ts.map +0 -1
  213. package/lib/stores/ApplicationStoreTestUtils.js +0 -70
  214. package/lib/stores/ApplicationStoreTestUtils.js.map +0 -1
  215. package/lib/stores/navigation/WebApplicationNavigator.d.ts.map +0 -1
  216. package/lib/stores/navigation/WebApplicationNavigator.js.map +0 -1
  217. package/lib/stores/navigation/WebApplicationRouter.d.ts +0 -22
  218. package/lib/stores/navigation/WebApplicationRouter.d.ts.map +0 -1
  219. package/lib/stores/navigation/WebApplicationRouter.js +0 -25
  220. package/lib/stores/navigation/WebApplicationRouter.js.map +0 -1
  221. package/lib/stores/pure-language/PureLanguageCodeEditorSupport.d.ts +0 -70
  222. package/lib/stores/pure-language/PureLanguageCodeEditorSupport.d.ts.map +0 -1
  223. package/lib/stores/pure-language/PureLanguageCodeEditorSupport.js +0 -237
  224. package/lib/stores/pure-language/PureLanguageCodeEditorSupport.js.map +0 -1
  225. package/lib/stores/pure-language/PureLanguageSupport.d.ts +0 -39
  226. package/lib/stores/pure-language/PureLanguageSupport.d.ts.map +0 -1
  227. package/lib/stores/pure-language/PureLanguageSupport.js +0 -437
  228. package/lib/stores/pure-language/PureLanguageSupport.js.map +0 -1
  229. package/lib/stores/shared/FuzzySearchAdvancedConfigState.d.ts +0 -30
  230. package/lib/stores/shared/FuzzySearchAdvancedConfigState.d.ts.map +0 -1
  231. package/lib/stores/shared/FuzzySearchAdvancedConfigState.js +0 -59
  232. package/lib/stores/shared/FuzzySearchAdvancedConfigState.js.map +0 -1
  233. package/lib/stores/shared/PackageableElementOption.d.ts.map +0 -1
  234. package/lib/stores/shared/PackageableElementOption.js.map +0 -1
  235. package/lib/stores/shared/TabManagerState.d.ts +0 -40
  236. package/lib/stores/shared/TabManagerState.d.ts.map +0 -1
  237. package/lib/stores/shared/TabManagerState.js +0 -93
  238. package/lib/stores/shared/TabManagerState.js.map +0 -1
  239. package/src/components/ApplicationStoreProviderTestUtils.tsx +0 -59
  240. package/src/components/WebApplicationNavigatorProvider.tsx +0 -46
  241. package/src/components/WebApplicationNavigatorProviderTestUtils.tsx +0 -37
  242. package/src/components/shared/DocumentationLink.tsx +0 -87
  243. package/src/components/shared/FuzzySearchAdvancedConfigMenu.tsx +0 -73
  244. package/src/components/shared/PackageableElementOptionLabel.tsx +0 -85
  245. package/src/components/shared/TabManager.tsx +0 -288
  246. package/src/const.ts +0 -40
  247. package/src/stores/ApplicationStoreTestUtils.ts +0 -107
  248. package/src/stores/navigation/WebApplicationRouter.ts +0 -49
  249. package/src/stores/pure-language/PureLanguageCodeEditorSupport.ts +0 -338
  250. package/src/stores/pure-language/PureLanguageSupport.ts +0 -498
  251. package/src/stores/shared/FuzzySearchAdvancedConfigState.ts +0 -65
  252. package/src/stores/shared/TabManagerState.ts +0 -124
  253. /package/lib/{application → __lib__}/LegendApplicationDocumentation.d.ts +0 -0
  254. /package/lib/{application → __lib__}/LegendApplicationDocumentation.js +0 -0
  255. /package/lib/{application → __lib__}/LegendApplicationSetting.d.ts +0 -0
  256. /package/lib/{application → __lib__}/LegendApplicationSetting.js +0 -0
  257. /package/lib/{application → __lib__}/LegendApplicationTheme.d.ts +0 -0
  258. /package/lib/{application → __lib__}/LegendApplicationTheme.js +0 -0
  259. /package/src/{application → __lib__}/LegendApplicationDocumentation.ts +0 -0
  260. /package/src/{application → __lib__}/LegendApplicationSetting.ts +0 -0
  261. /package/src/{application → __lib__}/LegendApplicationTheme.ts +0 -0
@@ -1,498 +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
-
17
- /* eslint-disable prefer-named-capture-group */
18
- import {
19
- PARSER_SECTION_MARKER,
20
- PURE_ELEMENT_NAME,
21
- PURE_CONNECTION_NAME,
22
- PURE_PARSER,
23
- } from '@finos/legend-graph';
24
- import {
25
- editor as monacoEditorAPI,
26
- languages as monacoLanguagesAPI,
27
- } from 'monaco-editor';
28
- import { CODE_EDITOR_LANGUAGE, CODE_EDITOR_THEME } from '../../const.js';
29
-
30
- /**
31
- * The postfix to be added to all token types, i.e. identifier.pure, number.pure, etc.
32
- */
33
- const PURE_GRAMMAR_TOKEN_POSTFIX = '.pure';
34
-
35
- export enum PURE_GRAMMAR_TOKEN {
36
- WHITESPACE = '',
37
-
38
- KEYWORD = 'keyword',
39
- IDENTIFIER = 'identifier',
40
- OPERATOR = 'operator',
41
- DELIMITER = 'delimiter',
42
-
43
- PARSER = 'parser',
44
- NUMBER = 'number',
45
- DATE = 'date',
46
- COLOR = 'color',
47
- PACKAGE = 'package',
48
- STRING = 'string',
49
- COMMENT = 'comment',
50
-
51
- LANGUAGE_STRUCT = 'language-struct',
52
- MULTIPLICITY = 'multiplicity',
53
- GENERICS = 'generics',
54
- PROPERTY = 'property',
55
- PARAMETER = 'property',
56
- VARIABLE = 'variable',
57
- TYPE = 'type',
58
-
59
- INVALID = 'invalid',
60
- }
61
-
62
- const theme: monacoEditorAPI.IStandaloneThemeData = {
63
- base: 'vs-dark', // can also be vs-dark or hc-black
64
- inherit: true, // can also be false to completely replace the builtin rules
65
- colors: {},
66
- rules: [
67
- // NOTE: unfortunately, `monaco-editor` only accepts HEX values, not CSS variables
68
- { token: PURE_GRAMMAR_TOKEN.IDENTIFIER, foreground: 'dcdcaa' },
69
- { token: PURE_GRAMMAR_TOKEN.NUMBER, foreground: 'b5cea8' },
70
- { token: PURE_GRAMMAR_TOKEN.DATE, foreground: 'b5cea8' },
71
- { token: PURE_GRAMMAR_TOKEN.COLOR, foreground: 'b5cea8' },
72
- { token: PURE_GRAMMAR_TOKEN.PACKAGE, foreground: '808080' },
73
- { token: PURE_GRAMMAR_TOKEN.PARSER, foreground: 'c586c0' },
74
- { token: PURE_GRAMMAR_TOKEN.LANGUAGE_STRUCT, foreground: 'c586c0' },
75
- { token: PURE_GRAMMAR_TOKEN.MULTIPLICITY, foreground: '2d796b' },
76
- { token: PURE_GRAMMAR_TOKEN.GENERICS, foreground: '2d796b' },
77
- { token: PURE_GRAMMAR_TOKEN.PROPERTY, foreground: '9cdcfe' },
78
- { token: PURE_GRAMMAR_TOKEN.PARAMETER, foreground: '9cdcfe' },
79
- { token: PURE_GRAMMAR_TOKEN.VARIABLE, foreground: '4fc1ff' },
80
- { token: PURE_GRAMMAR_TOKEN.TYPE, foreground: '3dc9b0' },
81
- { token: `${PURE_GRAMMAR_TOKEN.STRING}.escape`, foreground: 'd7ba7d' },
82
- ],
83
- };
84
-
85
- // Taken from `monaco-languages` configuration for Java in order to do propert brace matching
86
- // See https://github.com/microsoft/monaco-languages/blob/master/src/java/java.ts
87
- const configuration: monacoLanguagesAPI.LanguageConfiguration = {
88
- // NOTE: Pure identifier includes $ but not in the first position (as that is parsed as a variable)
89
- wordPattern:
90
- /(-?\d*\.\d\w*)|([^`~!@#%^$&*()\-=+[{\]}\\|;:'",.<>/?\s][^`~!@#%^&*()\-=+[{\]}\\|;:'",.<>/?\s]*)/,
91
- comments: {
92
- lineComment: '//',
93
- blockComment: ['/*', '*/'],
94
- },
95
- brackets: [
96
- ['{', '}'],
97
- ['[', ']'],
98
- ['(', ')'],
99
- ],
100
- autoClosingPairs: [
101
- { open: '{', close: '}' },
102
- { open: '[', close: ']' },
103
- { open: '(', close: ')' },
104
- { open: '"', close: '"' },
105
- { open: "'", close: "'" },
106
- ],
107
- surroundingPairs: [
108
- { open: '{', close: '}' },
109
- { open: '[', close: ']' },
110
- { open: '(', close: ')' },
111
- { open: '"', close: '"' },
112
- { open: "'", close: "'" },
113
- { open: '<', close: '>' },
114
- { open: '<<', close: '>>' },
115
- ],
116
- folding: {
117
- markers: {
118
- start: new RegExp('^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))'),
119
- end: new RegExp('^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))'),
120
- },
121
- },
122
- };
123
-
124
- /**
125
- * Create new monarch definition to support syntax-highlighting
126
- * See https://microsoft.github.io/monaco-editor/monarch.html
127
- *
128
- * The way SQL monarch definition is organized is good and worth learning from
129
- * See https://github.com/microsoft/monaco-languages/blob/master/src/sql/sql.ts
130
- *
131
- * NOTE: using `monarch` only allows fairly very basic syntax-highlighting
132
- * to actually do full AST analysis, we might need something more serious like
133
- * using TextMate grammar which is used by VSCode itself
134
- * See https://github.com/microsoft/monaco-editor#faq
135
- * See https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide
136
- */
137
- const generateLanguageMonarch = (
138
- extraKeywords: string[],
139
- extraParsers: string[],
140
- ): monacoLanguagesAPI.IMonarchLanguage =>
141
- // TODO: complete syntax-highlighter for core features like constraint, derived properties, etc.
142
- // TODO: add syntax highlighting for modules/plugins (come up with a plugin mechanism to do this).
143
- ({
144
- defaultToken: 'invalid',
145
- tokenPostfix: PURE_GRAMMAR_TOKEN_POSTFIX,
146
-
147
- keywords: [
148
- ...extraKeywords,
149
- // relational
150
- 'Schema',
151
- 'Table',
152
- 'Join',
153
- 'View',
154
- 'primaryKey',
155
- 'groupBy',
156
- 'mainTable',
157
- // native
158
- 'let',
159
- 'extends',
160
- 'true',
161
- 'false',
162
- 'projects',
163
- // elements
164
- PURE_ELEMENT_NAME.CLASS,
165
- PURE_ELEMENT_NAME.ASSOCIATION,
166
- PURE_ELEMENT_NAME.ENUMERATION,
167
- PURE_ELEMENT_NAME.MEASURE,
168
- PURE_ELEMENT_NAME.PROFILE,
169
- PURE_ELEMENT_NAME.FUNCTION,
170
- PURE_ELEMENT_NAME.MAPPING,
171
- PURE_ELEMENT_NAME.RUNTIME,
172
- PURE_ELEMENT_NAME.CONNECTION,
173
- PURE_ELEMENT_NAME.FILE_GENERATION,
174
- PURE_ELEMENT_NAME.GENERATION_SPECIFICATION,
175
- PURE_ELEMENT_NAME.DATA_ELEMENT,
176
- // connections
177
- PURE_CONNECTION_NAME.JSON_MODEL_CONNECTION,
178
- PURE_CONNECTION_NAME.MODEL_CHAIN_CONNECTION,
179
- PURE_CONNECTION_NAME.XML_MODEL_CONNECTION,
180
- // mapping
181
- 'include',
182
- 'EnumerationMapping',
183
- 'Pure',
184
- 'AssociationMapping',
185
- 'XStore',
186
- 'AggregationAware',
187
- /**
188
- * @modularize
189
- * See https://github.com/finos/legend-studio/issues/65
190
- */
191
- PURE_ELEMENT_NAME.SERVICE,
192
- PURE_ELEMENT_NAME.FLAT_DATA,
193
- PURE_ELEMENT_NAME.DATABASE,
194
- PURE_CONNECTION_NAME.FLAT_DATA_CONNECTION,
195
- PURE_CONNECTION_NAME.RELATIONAL_DATABASE_CONNECTION,
196
- 'Relational',
197
- ],
198
-
199
- operators: [
200
- '=',
201
- '>',
202
- '<',
203
- '!',
204
- '~',
205
- '?',
206
- ':',
207
- '==',
208
- '<=',
209
- '>=',
210
- '&&',
211
- '||',
212
- '++',
213
- '--',
214
- '+',
215
- '-',
216
- '*',
217
- '/',
218
- '&',
219
- '|',
220
- '^',
221
- '%',
222
- '->',
223
- '#{',
224
- '}#',
225
- '@',
226
- '<<',
227
- '>>',
228
- ],
229
-
230
- languageStructs: ['import', 'native'],
231
-
232
- parsers: (
233
- [
234
- PURE_PARSER.PURE,
235
- PURE_PARSER.CONNECTION,
236
- PURE_PARSER.RUNTIME,
237
- PURE_PARSER.MAPPING,
238
- PURE_PARSER.SERVICE,
239
- PURE_PARSER.FLATDATA,
240
- PURE_PARSER.RELATIONAL,
241
- PURE_PARSER.GENERATION_SPECIFICATION,
242
- PURE_PARSER.FILE_GENERATION_SPECIFICATION,
243
- PURE_PARSER.DATA,
244
- ] as string[]
245
- )
246
- .concat(extraParsers)
247
- .map((parser) => `${PARSER_SECTION_MARKER}${parser}`),
248
-
249
- // common regular expressions to be used in tokenizer
250
- identifier: /[a-zA-Z_$][\w$]*/,
251
- symbols: /[=><!~?:&|+\-*/^%#@]+/,
252
- escapes:
253
- /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
254
- digits: /\d+(_+\d+)*/,
255
- octaldigits: /[0-7]+(_+[0-7]+)*/,
256
- binarydigits: /[0-1]+(_+[0-1]+)*/,
257
- hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,
258
- multiplicity: /\[(?:[a-zA-Z0-9]+(?:\.\.(?:[a-zA-Z0-9]+|\*|))?|\*)\]/,
259
- package: /(?:[\w_]+::)+/,
260
- // NOTE: generics is a little tricky because in order to do it right, we have to
261
- // do some sort of bracket matching, but we just can use a simple tokenizer here
262
- // so to account for cases like `<Nil,Any|*>)->` `Function<{T[1]->Boolean[1]}>[1]`
263
- // we have to make sure the content does not contain any `:` or `.` characters
264
- // in order to avoid the accidental greedy match with inputs like
265
- // `function doSomething<T>(a: Function<T[1]->Boolean[1]>)`
266
- // nor we want to make sure the last character of the content is not `-` to avoid
267
- // accidentally matching `->` as the end of the generics
268
- generics: /(?:(?:<\w+>)|(?:<[^:.@^()]+[^-]>))/,
269
- date: /%-?\d+(?:-\d+(?:-\d+(?:T(?:\d+(?::\d+(?::\d+(?:.\d+)?)?)?)(?:[+-][0-9]{4})?)))/,
270
- time: /%\d+(?::\d+(?::\d+(?:.\d+)?)?)?/,
271
-
272
- tokenizer: {
273
- root: [
274
- // NOTE: since `monaco-editor` Monarch is only meant for tokenizing
275
- // and the need to highlight Pure syntax is more than just token-based,
276
- // but semantic/syntax-based we have to create these complex rules.
277
- // the things to note here is these are not meant to match multilines
278
- // and they must be placed before identifier rules since token matching
279
- // is run in order
280
- // See https://github.com/microsoft/monaco-editor/issues/316#issuecomment-273555698
281
- // See https://github.com/microsoft/monaco-editor/issues/571#issuecomment-342555050
282
- // See https://microsoft.github.io/monaco-editor/monarch.html
283
- { include: '@pure' },
284
-
285
- { include: '@date' },
286
- { include: '@color' },
287
-
288
- // parser markers
289
- [
290
- // NOTE: any leading whitespace to the section header is considered invalid syntax
291
- /^\s*###[\w]+/,
292
- {
293
- cases: {
294
- '@parsers': PURE_GRAMMAR_TOKEN.PARSER,
295
- '@default': PURE_GRAMMAR_TOKEN.INVALID,
296
- },
297
- },
298
- ],
299
-
300
- // identifiers and keywords
301
- [
302
- /(@identifier)/,
303
- {
304
- cases: {
305
- '@languageStructs': PURE_GRAMMAR_TOKEN.LANGUAGE_STRUCT,
306
- '@keywords': `${PURE_GRAMMAR_TOKEN.KEYWORD}.$0`,
307
- // function descriptor
308
- '([a-zA-Z_$][\\w$]*)_((\\w+_(([a-zA-Z0-9]+)|(\\$[a-zA-Z0-9]+_[a-zA-Z0-9]+\\$)))__)*(\\w+_(([a-zA-Z0-9]+)|(\\$[a-zA-Z0-9]+_[a-zA-Z0-9]+\\$)))_':
309
- PURE_GRAMMAR_TOKEN.TYPE,
310
- '@default': PURE_GRAMMAR_TOKEN.IDENTIFIER,
311
- },
312
- },
313
- ],
314
-
315
- // whitespace
316
- { include: '@whitespace' },
317
-
318
- // delimiters and operators
319
- [/[{}()[\]]/, '@brackets'],
320
- [/[<>](?!@symbols)/, '@brackets'],
321
- [
322
- /@symbols/,
323
- {
324
- cases: {
325
- '@operators': PURE_GRAMMAR_TOKEN.OPERATOR,
326
- '@default': PURE_GRAMMAR_TOKEN.IDENTIFIER,
327
- },
328
- },
329
- ],
330
-
331
- { include: '@number' },
332
-
333
- // delimiter: after number because of .\d floats
334
- [/[;,.]/, PURE_GRAMMAR_TOKEN.DELIMITER],
335
-
336
- // strings
337
- // NOTE: including non-teminated string so as people type ', we can start showing them that they're working on a string
338
- [/'([^'\\]|\\.)*$/, `${PURE_GRAMMAR_TOKEN.STRING}.invalid`],
339
- [/'/, PURE_GRAMMAR_TOKEN.STRING, '@string'],
340
-
341
- { include: '@characters' },
342
- ],
343
-
344
- pure: [
345
- // type
346
- [/(@package\*)/, [PURE_GRAMMAR_TOKEN.PACKAGE]], // import path
347
- [
348
- /(@package?)(@identifier)(@generics?)(\s*)(@multiplicity)/,
349
- [
350
- PURE_GRAMMAR_TOKEN.PACKAGE,
351
- PURE_GRAMMAR_TOKEN.TYPE,
352
- PURE_GRAMMAR_TOKEN.GENERICS,
353
- PURE_GRAMMAR_TOKEN.WHITESPACE,
354
- PURE_GRAMMAR_TOKEN.MULTIPLICITY,
355
- ],
356
- ],
357
- [
358
- /(@package)(@identifier)(@generics?)/,
359
- [
360
- PURE_GRAMMAR_TOKEN.PACKAGE,
361
- PURE_GRAMMAR_TOKEN.TYPE,
362
- PURE_GRAMMAR_TOKEN.GENERICS,
363
- ],
364
- ],
365
-
366
- // special operators that uses type (e.g. constructor, cast)
367
- [
368
- /([@^])(\s*)(@package?)(@identifier)(@generics?)(@multiplicity?)/,
369
- [
370
- `${PURE_GRAMMAR_TOKEN.TYPE}.operator`,
371
- PURE_GRAMMAR_TOKEN.WHITESPACE,
372
- PURE_GRAMMAR_TOKEN.PACKAGE,
373
- PURE_GRAMMAR_TOKEN.TYPE,
374
- PURE_GRAMMAR_TOKEN.GENERICS,
375
- PURE_GRAMMAR_TOKEN.MULTIPLICITY,
376
- ],
377
- ],
378
-
379
- // property / parameter
380
- [
381
- /(\.\s*)(@identifier)/,
382
- [PURE_GRAMMAR_TOKEN.DELIMITER, PURE_GRAMMAR_TOKEN.PROPERTY],
383
- ],
384
- [
385
- /(@identifier)(\s*=)/,
386
- [PURE_GRAMMAR_TOKEN.PROPERTY, PURE_GRAMMAR_TOKEN.OPERATOR],
387
- ],
388
- [
389
- /(@identifier)(\.)(@identifier)/,
390
- [
391
- PURE_GRAMMAR_TOKEN.TYPE,
392
- PURE_GRAMMAR_TOKEN.OPERATOR,
393
- PURE_GRAMMAR_TOKEN.PROPERTY,
394
- ],
395
- ], // could be: property chain, profile tag, and stereotype
396
- [
397
- /(@identifier)(\s*:)/,
398
- [PURE_GRAMMAR_TOKEN.PARAMETER, PURE_GRAMMAR_TOKEN.OPERATOR],
399
- ],
400
-
401
- // variables
402
- [
403
- /(let)(\s+)(@identifier)(\s*=)/,
404
- [
405
- PURE_GRAMMAR_TOKEN.KEYWORD,
406
- PURE_GRAMMAR_TOKEN.WHITESPACE,
407
- PURE_GRAMMAR_TOKEN.VARIABLE,
408
- PURE_GRAMMAR_TOKEN.OPERATOR,
409
- ],
410
- ],
411
- [/(\$@identifier)/, [`${PURE_GRAMMAR_TOKEN.VARIABLE}.reference`]],
412
- ],
413
-
414
- date: [
415
- [/(%latest)/, [`${PURE_GRAMMAR_TOKEN.DATE}.latest`]],
416
- [/(@date)/, [PURE_GRAMMAR_TOKEN.DATE]],
417
- [/(@time)/, [`${PURE_GRAMMAR_TOKEN.DATE}.time`]],
418
- ],
419
-
420
- color: [[/(#[0-9a-fA-F]{6})/, [PURE_GRAMMAR_TOKEN.COLOR]]],
421
-
422
- number: [
423
- [
424
- /(@digits)[eE]([-+]?(@digits))?[fFdD]?/,
425
- `${PURE_GRAMMAR_TOKEN.NUMBER}.float`,
426
- ],
427
- [
428
- /(@digits)\.(@digits)([eE][-+]?(@digits))?[fFdD]?/,
429
- `${PURE_GRAMMAR_TOKEN.NUMBER}.float`,
430
- ],
431
- [/0[xX](@hexdigits)[Ll]?/, `${PURE_GRAMMAR_TOKEN.NUMBER}.hex`],
432
- [/0(@octaldigits)[Ll]?/, `${PURE_GRAMMAR_TOKEN.NUMBER}.octal`],
433
- [/0[bB](@binarydigits)[Ll]?/, `${PURE_GRAMMAR_TOKEN.NUMBER}.binary`],
434
- [/(@digits)[fFdD]/, `${PURE_GRAMMAR_TOKEN.NUMBER}.float`],
435
- [/(@digits)[lL]?/, PURE_GRAMMAR_TOKEN.NUMBER],
436
- ],
437
-
438
- whitespace: [
439
- [/[ \t\r\n]+/, PURE_GRAMMAR_TOKEN.WHITESPACE],
440
- [/\/\*\*(?!\/)/, `${PURE_GRAMMAR_TOKEN.COMMENT}.doc`, '@doc'],
441
- [/\/\*/, PURE_GRAMMAR_TOKEN.COMMENT, '@comment'],
442
- [/\/\/.*$/, PURE_GRAMMAR_TOKEN.COMMENT],
443
- ],
444
-
445
- comment: [
446
- [/[^/*]+/, PURE_GRAMMAR_TOKEN.COMMENT],
447
- // [/\/\*/, PURE_GRAMMAR_TOKEN.COMMENT, '@push' ], // nested comment not allowed :-(
448
- // [/\/\*/, ${PURE_GRAMMAR_TOKEN.COMMENT}.invalid` ], // this breaks block comments in the shape of /* //*/
449
- [/\*\//, PURE_GRAMMAR_TOKEN.COMMENT, '@pop'],
450
- [/[/*]/, PURE_GRAMMAR_TOKEN.COMMENT],
451
- ],
452
-
453
- // Identical copy of comment above, except for the addition of .doc
454
- doc: [
455
- [/[^/*]+/, `${PURE_GRAMMAR_TOKEN.COMMENT}.doc`],
456
- // [/\/\*/, `${PURE_GRAMMAR_TOKEN.COMMENT}.doc`, '@push' ], // nested comment not allowed :-(
457
- [/\/\*/, `${PURE_GRAMMAR_TOKEN.COMMENT}.doc.invalid`],
458
- [/\*\//, `${PURE_GRAMMAR_TOKEN.COMMENT}.doc`, '@pop'],
459
- [/[/*]/, `${PURE_GRAMMAR_TOKEN.COMMENT}.doc`],
460
- ],
461
-
462
- string: [
463
- [/[^\\']+/, PURE_GRAMMAR_TOKEN.STRING],
464
- [/@escapes/, `${PURE_GRAMMAR_TOKEN.STRING}.escape`],
465
- [/\\./, `${PURE_GRAMMAR_TOKEN.STRING}.escape.invalid`],
466
- [/'/, PURE_GRAMMAR_TOKEN.STRING, '@pop'],
467
- ],
468
-
469
- characters: [
470
- [/'[^\\']'/, PURE_GRAMMAR_TOKEN.STRING],
471
- [
472
- /(')(@escapes)(')/,
473
- [
474
- PURE_GRAMMAR_TOKEN.STRING,
475
- `${PURE_GRAMMAR_TOKEN.STRING}.escape`,
476
- PURE_GRAMMAR_TOKEN.STRING,
477
- ],
478
- ],
479
- [/'/, `${PURE_GRAMMAR_TOKEN.STRING}.invalid`],
480
- ],
481
- },
482
- } as monacoLanguagesAPI.IMonarchLanguage);
483
-
484
- export const setupPureLanguageService = (
485
- extraKeywords: string[],
486
- extraParserKeywords: string[],
487
- ): void => {
488
- monacoEditorAPI.defineTheme(CODE_EDITOR_THEME.LEGEND, theme);
489
- monacoLanguagesAPI.register({ id: CODE_EDITOR_LANGUAGE.PURE });
490
- monacoLanguagesAPI.setLanguageConfiguration(
491
- CODE_EDITOR_LANGUAGE.PURE,
492
- configuration,
493
- );
494
- monacoLanguagesAPI.setMonarchTokensProvider(
495
- CODE_EDITOR_LANGUAGE.PURE,
496
- generateLanguageMonarch(extraKeywords, extraParserKeywords),
497
- );
498
- };
@@ -1,65 +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
-
17
- import { action, computed, makeObservable, observable } from 'mobx';
18
-
19
- export enum ADVANCED_FUZZY_SEARCH_MODE {
20
- STANDARD = 'standard',
21
- INCLUDE = 'include match',
22
- EXACT = 'exact match',
23
- INVERSE = 'excludes exact match',
24
- }
25
-
26
- export class FuzzySearchAdvancedConfigState {
27
- currentMode = ADVANCED_FUZZY_SEARCH_MODE.STANDARD;
28
- onSearchModeChange: () => void;
29
-
30
- constructor(onSearchModeChange: () => void) {
31
- makeObservable(this, {
32
- currentMode: observable,
33
- isAdvancedSearchActive: computed,
34
- setCurrentMode: action,
35
- });
36
-
37
- this.onSearchModeChange = onSearchModeChange;
38
- }
39
-
40
- get isAdvancedSearchActive(): boolean {
41
- return this.currentMode !== ADVANCED_FUZZY_SEARCH_MODE.STANDARD;
42
- }
43
-
44
- generateSearchText(val: string): string {
45
- switch (this.currentMode) {
46
- case ADVANCED_FUZZY_SEARCH_MODE.INCLUDE: {
47
- return `'"${val}"`;
48
- }
49
- case ADVANCED_FUZZY_SEARCH_MODE.EXACT: {
50
- return `="${val}"`;
51
- }
52
- case ADVANCED_FUZZY_SEARCH_MODE.INVERSE: {
53
- return `!"${val}"`;
54
- }
55
- default: {
56
- return val;
57
- }
58
- }
59
- }
60
-
61
- setCurrentMode(val: ADVANCED_FUZZY_SEARCH_MODE): void {
62
- this.currentMode = val;
63
- this.onSearchModeChange();
64
- }
65
- }
@@ -1,124 +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
-
17
- import {
18
- assertNonNullable,
19
- assertTrue,
20
- swapEntry,
21
- uuid,
22
- } from '@finos/legend-shared';
23
- import { action, makeObservable, observable } from 'mobx';
24
-
25
- export abstract class TabState {
26
- readonly uuid = uuid();
27
-
28
- abstract get label(): string;
29
-
30
- get description(): string | undefined {
31
- return undefined;
32
- }
33
-
34
- match(tab: TabState): boolean {
35
- return this === tab;
36
- }
37
-
38
- onOpen(): void {
39
- // do nothing
40
- }
41
-
42
- onClose(): void {
43
- // do nothing
44
- }
45
- }
46
-
47
- export abstract class TabManagerState {
48
- currentTab?: TabState | undefined;
49
- tabs: TabState[] = [];
50
-
51
- constructor() {
52
- makeObservable(this, {
53
- currentTab: observable,
54
- tabs: observable,
55
- setCurrentTab: action,
56
- closeTab: action,
57
- closeAllTabs: action,
58
- closeAllOtherTabs: action,
59
- openTab: action,
60
- swapTabs: action,
61
- });
62
- }
63
-
64
- setCurrentTab(val: TabState | undefined): void {
65
- this.currentTab = val;
66
- }
67
-
68
- closeAllOtherTabs(tab: TabState): void {
69
- assertNonNullable(
70
- this.tabs.find((e) => e === tab),
71
- 'Specified tab should be currently opened',
72
- );
73
- this.setCurrentTab(tab);
74
- this.tabs = [tab];
75
- }
76
-
77
- closeAllTabs(): void {
78
- this.setCurrentTab(undefined);
79
- this.tabs = [];
80
- }
81
-
82
- swapTabs(tab1: TabState, tab2: TabState): void {
83
- swapEntry(this.tabs, tab1, tab2);
84
- }
85
-
86
- /**
87
- * The unique drag and drop type
88
- * See https://react-dnd.github.io/react-dnd/docs/overview#items-and-types
89
- */
90
- abstract get dndType(): string;
91
-
92
- openTab(tab: TabState): void {
93
- const existingTab = this.tabs.find((t) => t.match(tab));
94
- if (!existingTab) {
95
- if (this.currentTab) {
96
- const currIndex = this.tabs.findIndex((e) => e === this.currentTab);
97
- this.tabs.splice(currIndex + 1, 0, tab);
98
- } else {
99
- this.tabs.push(tab);
100
- }
101
- }
102
- this.setCurrentTab(tab);
103
-
104
- tab.onOpen();
105
- }
106
-
107
- closeTab(tab: TabState): void {
108
- const tabIndex = this.tabs.findIndex((t) => t.match(tab));
109
- assertTrue(tabIndex !== -1, `Can't close a tab which is not opened`);
110
- this.tabs.splice(tabIndex, 1);
111
- if (this.currentTab === tab) {
112
- if (this.tabs.length) {
113
- const openIndex = tabIndex - 1;
114
- this.setCurrentTab(
115
- openIndex >= 0 ? this.tabs[openIndex] : this.tabs[0],
116
- );
117
- } else {
118
- this.setCurrentTab(undefined);
119
- }
120
- }
121
-
122
- tab.onClose();
123
- }
124
- }