@finos/legend-application 14.0.4 → 15.0.1

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,288 +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
- ChevronDownIcon,
19
- clsx,
20
- ContextMenu,
21
- DragPreviewLayer,
22
- DropdownMenu,
23
- MenuContent,
24
- MenuContentItem,
25
- PanelEntryDropZonePlaceholder,
26
- TimesIcon,
27
- useDragPreviewLayer,
28
- } from '@finos/legend-art';
29
- import { observer } from 'mobx-react-lite';
30
- import { useRef, useCallback } from 'react';
31
- import { type DropTargetMonitor, useDrop, useDrag } from 'react-dnd';
32
- import type {
33
- TabManagerState,
34
- TabState,
35
- } from '../../stores/shared/TabManagerState.js';
36
-
37
- type TabDragSource = {
38
- tab: TabState;
39
- };
40
-
41
- const horizontalToVerticalScroll: React.WheelEventHandler = (event) => {
42
- // if scrolling is more horizontal than vertical, there's nothing much to do, the OS should handle it just fine
43
- // else, intercept
44
- if (Math.abs(event.deltaY) <= Math.abs(event.deltaX)) {
45
- return;
46
- }
47
- event.stopPropagation();
48
- let deltaX;
49
- // NOTE: only convert horizontal to vertical scroll when the scroll causes more horizontal than vertical displacement
50
- // let the direction of `deltaY` be the direction of the scroll, i.e.
51
- // - if we scroll upward, that translate to a left scroll
52
- // - if we scroll downward, that translates to a right scroll
53
- if (event.deltaY === 0) {
54
- deltaX = event.deltaY;
55
- } else if (event.deltaY < 0) {
56
- deltaX = -Math.abs(event.deltaY);
57
- } else {
58
- deltaX = Math.abs(event.deltaY);
59
- }
60
- event.currentTarget.scrollBy(deltaX, 0);
61
- };
62
-
63
- const TabContextMenu = observer(
64
- (props: { tabState: TabState; managerTabState: TabManagerState }) => {
65
- const { tabState, managerTabState } = props;
66
- const close = (): void => managerTabState.closeTab(tabState);
67
- const closeOthers = (): void => managerTabState.closeAllOtherTabs(tabState);
68
- const closeAll = (): void => managerTabState.closeAllTabs();
69
-
70
- return (
71
- <MenuContent>
72
- <MenuContentItem onClick={close}>Close</MenuContentItem>
73
- <MenuContentItem
74
- disabled={managerTabState.tabs.length < 2}
75
- onClick={closeOthers}
76
- >
77
- Close Others
78
- </MenuContentItem>
79
- <MenuContentItem onClick={closeAll}>Close All</MenuContentItem>
80
- </MenuContent>
81
- );
82
- },
83
- );
84
-
85
- const Tab = observer(
86
- (props: {
87
- tabState: TabState;
88
- tabManagerState: TabManagerState;
89
- tabRenderer?: ((editorState: TabState) => React.ReactNode) | undefined;
90
- }) => {
91
- const ref = useRef<HTMLDivElement>(null);
92
- const { tabManagerState, tabState, tabRenderer } = props;
93
-
94
- // Drag and Drop
95
- const handleHover = useCallback(
96
- (item: TabDragSource, monitor: DropTargetMonitor): void => {
97
- const draggingTab = item.tab;
98
- const hoveredTab = tabState;
99
-
100
- const dragIndex = tabManagerState.tabs.findIndex(
101
- (e) => e === draggingTab,
102
- );
103
- const hoverIndex = tabManagerState.tabs.findIndex(
104
- (e) => e === hoveredTab,
105
- );
106
-
107
- const hoverBoundingReact = ref.current?.getBoundingClientRect();
108
- const distanceThreshold =
109
- ((hoverBoundingReact?.left ?? 0) - (hoverBoundingReact?.right ?? 0)) /
110
- 2;
111
- const dragDistance =
112
- (monitor.getClientOffset()?.x ?? 0) -
113
- (hoverBoundingReact?.right ?? 0);
114
- if (dragIndex < hoverIndex && dragDistance < distanceThreshold) {
115
- return;
116
- }
117
- if (dragIndex > hoverIndex && dragDistance > distanceThreshold) {
118
- return;
119
- }
120
-
121
- tabManagerState.swapTabs(draggingTab, hoveredTab);
122
- },
123
- [tabManagerState, tabState],
124
- );
125
-
126
- const closeTabOnMiddleClick =
127
- (currTab: TabState): React.MouseEventHandler =>
128
- (event): void => {
129
- if (event.nativeEvent.button === 1) {
130
- tabManagerState.closeTab(currTab);
131
- }
132
- };
133
-
134
- const [{ isBeingDraggedEditorPanel }, dropConnector] = useDrop<
135
- TabDragSource,
136
- void,
137
- { isBeingDraggedEditorPanel: TabState | undefined }
138
- >(
139
- () => ({
140
- accept: [tabManagerState.dndType],
141
- hover: (item, monitor) => handleHover(item, monitor),
142
- collect: (
143
- monitor,
144
- ): {
145
- isBeingDraggedEditorPanel: TabState | undefined;
146
- } => ({
147
- isBeingDraggedEditorPanel: monitor.getItem<TabDragSource | null>()
148
- ?.tab,
149
- }),
150
- }),
151
- [handleHover],
152
- );
153
- const isBeingDragged = tabState === isBeingDraggedEditorPanel;
154
-
155
- const [, dragConnector, dragPreviewConnector] = useDrag<TabDragSource>(
156
- () => ({
157
- type: tabManagerState.dndType,
158
- item: () => ({
159
- tab: tabState,
160
- }),
161
- }),
162
- [tabState, tabManagerState],
163
- );
164
- dragConnector(dropConnector(ref));
165
- useDragPreviewLayer(dragPreviewConnector);
166
-
167
- return (
168
- <div
169
- ref={ref}
170
- className={clsx('tab-manager__tab', {
171
- 'tab-manager__tab--active': tabState === tabManagerState.currentTab,
172
- 'tab-manager__tab--dragged': isBeingDragged,
173
- })}
174
- onMouseUp={closeTabOnMiddleClick(tabState)}
175
- >
176
- <PanelEntryDropZonePlaceholder
177
- showPlaceholder={false}
178
- className="tab-manager__tab__dnd__placeholder"
179
- >
180
- <ContextMenu
181
- content={
182
- <TabContextMenu
183
- tabState={tabState}
184
- managerTabState={tabManagerState}
185
- />
186
- }
187
- className="tab-manager__tab__content"
188
- >
189
- <button
190
- className="tab-manager__tab__label"
191
- tabIndex={-1}
192
- onClick={() => tabManagerState.openTab(tabState)}
193
- title={tabState.description}
194
- >
195
- {tabRenderer?.(tabState) ?? tabState.label}
196
- </button>
197
- <button
198
- className="tab-manager__tab__close-btn"
199
- onClick={() => tabManagerState.closeTab(tabState)}
200
- tabIndex={-1}
201
- title="Close"
202
- >
203
- <TimesIcon />
204
- </button>
205
- </ContextMenu>
206
- </PanelEntryDropZonePlaceholder>
207
- </div>
208
- );
209
- },
210
- );
211
-
212
- const TabMenu = observer((props: { managerTabState: TabManagerState }) => {
213
- const { managerTabState } = props;
214
- return (
215
- <DropdownMenu
216
- className="tab-manager__menu__toggler"
217
- title="Show All Tabs"
218
- content={
219
- <MenuContent className="tab-manager__menu">
220
- {managerTabState.tabs.map((tabState) => (
221
- <MenuContentItem
222
- key={tabState.uuid}
223
- className={clsx('tab-manager__menu__item', {
224
- 'tab-manager__menu__item--active':
225
- tabState === managerTabState.currentTab,
226
- })}
227
- onClick={() => managerTabState.openTab(tabState)}
228
- >
229
- <div className="tab-manager__menu__item__label">
230
- {tabState.label}
231
- </div>
232
- <div
233
- className="tab-manager__menu__item__close-btn"
234
- onClick={(event) => {
235
- // NOTE: prevent default action of dropdown menu
236
- event.stopPropagation();
237
- managerTabState.closeTab(tabState);
238
- }}
239
- tabIndex={-1}
240
- title="Close"
241
- >
242
- <TimesIcon />
243
- </div>
244
- </MenuContentItem>
245
- ))}
246
- </MenuContent>
247
- }
248
- menuProps={{
249
- anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
250
- transformOrigin: { vertical: 'top', horizontal: 'right' },
251
- }}
252
- >
253
- <ChevronDownIcon />
254
- </DropdownMenu>
255
- );
256
- });
257
-
258
- export const TabManager = observer(
259
- (props: {
260
- tabManagerState: TabManagerState;
261
- tabRenderer?: ((editorState: TabState) => React.ReactNode) | undefined;
262
- }) => {
263
- const { tabManagerState, tabRenderer } = props;
264
-
265
- return (
266
- <div className="tab-manager">
267
- <div
268
- className="tab-manager__content"
269
- onWheel={horizontalToVerticalScroll}
270
- >
271
- {tabManagerState.tabs.map((tab) => (
272
- <Tab
273
- key={tab.uuid}
274
- tabState={tab}
275
- tabManagerState={tabManagerState}
276
- tabRenderer={tabRenderer}
277
- />
278
- ))}
279
- <DragPreviewLayer
280
- labelGetter={(item: TabDragSource): string => item.tab.label}
281
- types={[tabManagerState.dndType]}
282
- />
283
- </div>
284
- <TabMenu managerTabState={tabManagerState} />
285
- </div>
286
- );
287
- },
288
- );
package/src/const.ts DELETED
@@ -1,40 +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
- export const TAB_SIZE = 2;
18
- export const DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH = 2;
19
- export const DEFAULT_TYPEAHEAD_SEARCH_LIMIT = 10;
20
-
21
- export const MONOSPACED_FONT_FAMILY = 'Roboto Mono';
22
-
23
- // TODO: to be moved to `@finos/legend-lego`
24
- export enum CODE_EDITOR_THEME {
25
- LEGEND = 'legend',
26
- TEMPORARY__VSCODE_LIGHT = 'vs',
27
- }
28
-
29
- // TODO: to be moved to `@finos/legend-lego`
30
- export enum CODE_EDITOR_LANGUAGE {
31
- TEXT = 'plaintext',
32
- PURE = 'pure',
33
- JSON = 'json',
34
- JAVA = 'java',
35
- MARKDOWN = 'markdown',
36
- SQL = 'sql',
37
- XML = 'xml',
38
- YAML = 'yaml',
39
- GRAPHQL = 'graphql',
40
- }
@@ -1,107 +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 { ApplicationStore } from './ApplicationStore.js';
18
- import { createBrowserHistory } from 'history';
19
- import { WebApplicationNavigator } from './navigation/WebApplicationNavigator.js';
20
- import { LegendApplicationConfig } from '../application/LegendApplicationConfig.js';
21
- import { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';
22
- import type { LegendApplicationPlugin } from './LegendApplicationPlugin.js';
23
- import type {
24
- GraphManagerPluginManager,
25
- PureGraphManagerPlugin,
26
- PureGraphPlugin,
27
- PureProtocolProcessorPlugin,
28
- } from '@finos/legend-graph';
29
-
30
- export const TEST_DATA__applicationVersion = {
31
- buildTime: '2001-01-01T00:00:00-0000',
32
- version: 'test-version',
33
- commitSHA: 'test-commit-id',
34
- };
35
-
36
- class TEST__LegendApplicationConfig extends LegendApplicationConfig {}
37
-
38
- export const TEST__getGenericApplicationConfig = (
39
- extraConfigData = {},
40
- ): LegendApplicationConfig => {
41
- const config = new TEST__LegendApplicationConfig({
42
- configData: {
43
- env: 'TEST',
44
- appName: 'TEST',
45
- ...extraConfigData,
46
- },
47
- versionData: TEST_DATA__applicationVersion,
48
- baseUrl: '/query/',
49
- });
50
- return config;
51
- };
52
-
53
- export const TEST__getTestApplicationStore = <
54
- T extends LegendApplicationConfig,
55
- V extends LegendApplicationPluginManager<LegendApplicationPlugin>,
56
- >(
57
- config: T,
58
- pluginManager: V,
59
- ): ApplicationStore<T, V> =>
60
- new ApplicationStore(
61
- config,
62
- new WebApplicationNavigator(createBrowserHistory()),
63
- pluginManager,
64
- );
65
-
66
- export class TEST__LegendApplicationPluginManager
67
- extends LegendApplicationPluginManager<LegendApplicationPlugin>
68
- implements GraphManagerPluginManager
69
- {
70
- private pureProtocolProcessorPlugins: PureProtocolProcessorPlugin[] = [];
71
- private pureGraphManagerPlugins: PureGraphManagerPlugin[] = [];
72
- private pureGraphPlugins: PureGraphPlugin[] = [];
73
-
74
- private constructor() {
75
- super();
76
- }
77
-
78
- static create(): TEST__LegendApplicationPluginManager {
79
- return new TEST__LegendApplicationPluginManager();
80
- }
81
-
82
- registerPureProtocolProcessorPlugin(
83
- plugin: PureProtocolProcessorPlugin,
84
- ): void {
85
- this.pureProtocolProcessorPlugins.push(plugin);
86
- }
87
-
88
- registerPureGraphManagerPlugin(plugin: PureGraphManagerPlugin): void {
89
- this.pureGraphManagerPlugins.push(plugin);
90
- }
91
-
92
- registerPureGraphPlugin(plugin: PureGraphPlugin): void {
93
- this.pureGraphPlugins.push(plugin);
94
- }
95
-
96
- getPureGraphManagerPlugins(): PureGraphManagerPlugin[] {
97
- return [...this.pureGraphManagerPlugins];
98
- }
99
-
100
- getPureProtocolProcessorPlugins(): PureProtocolProcessorPlugin[] {
101
- return [...this.pureProtocolProcessorPlugins];
102
- }
103
-
104
- getPureGraphPlugins(): PureGraphPlugin[] {
105
- return [...this.pureGraphPlugins];
106
- }
107
- }
@@ -1,49 +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
- Router,
19
- Route,
20
- Switch,
21
- Redirect,
22
- matchPath,
23
- generatePath,
24
- MemoryRouter,
25
- useParams,
26
- useLocation,
27
- } from 'react-router';
28
- import {
29
- NAVIGATION_ZONE_PREFIX,
30
- type NavigationZone,
31
- } from './NavigationService.js';
32
-
33
- export { BrowserRouter } from 'react-router-dom';
34
- export {
35
- Router,
36
- Route,
37
- Switch,
38
- Redirect,
39
- useParams,
40
- matchPath,
41
- generatePath,
42
- MemoryRouter,
43
- };
44
- export { createMemoryHistory } from 'history';
45
-
46
- export const useNavigationZone = (): NavigationZone => {
47
- const location = useLocation() as { hash: string }; // TODO: this is a temporary hack until we upgrade react-router
48
- return location.hash.substring(NAVIGATION_ZONE_PREFIX.length);
49
- };