@jbrowse/app-core 4.3.0 → 5.0.0-beta.10
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.
- package/esm/AppSession/AppRootModel.d.ts +30 -0
- package/esm/AppSession/AppRootModel.js +1 -0
- package/esm/AppSession/AppSessionMixin.d.ts +1324 -0
- package/esm/AppSession/AppSessionMixin.js +62 -0
- package/esm/AppSession/index.d.ts +2 -0
- package/esm/AppSession/index.js +1 -0
- package/esm/Assemblies/AssembliesMixin.d.ts +294 -0
- package/esm/Assemblies/AssembliesMixin.js +154 -0
- package/esm/Assemblies/index.d.ts +1 -2
- package/esm/Assemblies/index.js +1 -2
- package/esm/HistoryManagement/index.d.ts +11 -0
- package/esm/HistoryManagement/index.js +43 -10
- package/esm/JBrowseConfig/RootConfiguration.d.ts +123 -78
- package/esm/JBrowseConfig/RootConfiguration.js +79 -7
- package/esm/JBrowseConfig/defaultShareUrl.d.ts +1 -0
- package/esm/JBrowseConfig/defaultShareUrl.js +5 -0
- package/esm/JBrowseConfig/index.d.ts +175 -84
- package/esm/JBrowseConfig/index.js +64 -2
- package/esm/JBrowseModel/index.d.ts +175 -97
- package/esm/JBrowseModel/index.js +132 -31
- package/esm/JbApi/index.d.ts +2 -0
- package/esm/JbApi/index.js +1 -0
- package/esm/JbApi/jbApi.d.ts +2767 -0
- package/esm/JbApi/jbApi.js +1383 -0
- package/esm/RootMenu/index.d.ts +69 -3
- package/esm/RootMenu/index.js +96 -61
- package/esm/SessionSpec/index.d.ts +6 -0
- package/esm/SessionSpec/index.js +3 -0
- package/esm/SessionSpec/lgvUrlInit.d.ts +79 -0
- package/esm/SessionSpec/lgvUrlInit.js +161 -0
- package/esm/SessionSpec/loadSessionSpec.d.ts +75 -0
- package/esm/SessionSpec/loadSessionSpec.js +473 -0
- package/esm/SessionSpec/parseSessionSpecUrl.d.ts +7 -0
- package/esm/SessionSpec/parseSessionSpecUrl.js +181 -0
- package/esm/SessionSpec/types.d.ts +37 -0
- package/esm/SessionSpec/types.js +1 -0
- package/esm/WorkspaceLayout/LayoutRenderer.d.ts +24 -0
- package/esm/WorkspaceLayout/LayoutRenderer.js +185 -0
- package/esm/WorkspaceLayout/PanelView.d.ts +13 -0
- package/esm/WorkspaceLayout/PanelView.js +99 -0
- package/esm/WorkspaceLayout/TabStrip.d.ts +14 -0
- package/esm/WorkspaceLayout/TabStrip.js +226 -0
- package/esm/WorkspaceLayout/WorkspaceContainer.d.ts +16 -0
- package/esm/WorkspaceLayout/WorkspaceContainer.js +107 -0
- package/esm/WorkspaceLayout/WorkspacePanelActions.d.ts +24 -0
- package/esm/WorkspaceLayout/WorkspacePanelActions.js +120 -0
- package/esm/WorkspaceLayout/WorkspaceTab.d.ts +27 -0
- package/esm/WorkspaceLayout/WorkspaceTab.js +105 -0
- package/esm/WorkspaceLayout/dockviewTheme.d.ts +69 -0
- package/esm/WorkspaceLayout/dockviewTheme.js +82 -0
- package/esm/WorkspaceLayout/dropZone.d.ts +105 -0
- package/esm/WorkspaceLayout/dropZone.js +113 -0
- package/esm/WorkspaceLayout/index.d.ts +8 -0
- package/esm/WorkspaceLayout/index.js +4 -0
- package/esm/WorkspaceLayout/model.d.ts +260 -0
- package/esm/WorkspaceLayout/model.js +586 -0
- package/esm/WorkspaceLayout/panelChrome.d.ts +19 -0
- package/esm/WorkspaceLayout/panelChrome.js +4 -0
- package/esm/WorkspaceLayout/spec.d.ts +88 -0
- package/esm/WorkspaceLayout/spec.js +226 -0
- package/esm/WorkspaceLayout/splitter.d.ts +25 -0
- package/esm/WorkspaceLayout/splitter.js +37 -0
- package/esm/WorkspaceLayout/tree.d.ts +158 -0
- package/esm/WorkspaceLayout/tree.js +379 -0
- package/esm/WorkspaceLayout/useLayoutDrag.d.ts +34 -0
- package/esm/WorkspaceLayout/useLayoutDrag.js +232 -0
- package/esm/index.d.ts +18 -9
- package/esm/index.js +16 -9
- package/esm/menus.d.ts +55 -68
- package/esm/menus.js +117 -86
- package/esm/queryParams.d.ts +9 -0
- package/esm/queryParams.js +93 -0
- package/esm/sessionModelFactory.d.ts +18 -0
- package/esm/sessionModelFactory.js +1 -0
- package/esm/ui/App/App.d.ts +3 -14
- package/esm/ui/App/App.js +39 -19
- package/esm/ui/App/AppFab.d.ts +12 -3
- package/esm/ui/App/AppFab.js +15 -8
- package/esm/ui/App/AppToolbar.d.ts +2 -14
- package/esm/ui/App/AppToolbar.js +45 -31
- package/esm/ui/App/ClassicViewsContainer.d.ts +4 -10
- package/esm/ui/App/ClassicViewsContainer.js +9 -8
- package/esm/ui/App/DialogQueue.d.ts +17 -1
- package/esm/ui/App/DialogQueue.js +30 -1
- package/esm/ui/App/Drawer.d.ts +1 -1
- package/esm/ui/App/Drawer.js +10 -39
- package/esm/ui/App/DrawerHeader.d.ts +2 -3
- package/esm/ui/App/DrawerHeader.js +24 -11
- package/esm/ui/App/DrawerHeaderHelpButton.d.ts +1 -1
- package/esm/ui/App/DrawerHeaderHelpButton.js +3 -3
- package/esm/ui/App/DrawerHeaderHelpDialog.d.ts +2 -2
- package/esm/ui/App/DrawerHeaderHelpDialog.js +3 -4
- package/esm/ui/App/DrawerWidget.d.ts +1 -1
- package/esm/ui/App/DrawerWidget.js +9 -21
- package/esm/ui/App/JBrowseTabMenu.d.ts +2 -3
- package/esm/ui/App/JBrowseTabMenu.js +24 -5
- package/esm/ui/App/ThemeModeButton.d.ts +12 -0
- package/esm/ui/App/ThemeModeButton.js +34 -0
- package/esm/ui/App/ViewButtons.d.ts +2 -4
- package/esm/ui/App/ViewButtons.js +15 -3
- package/esm/ui/App/ViewContainer.d.ts +3 -2
- package/esm/ui/App/ViewContainer.js +128 -24
- package/esm/ui/App/ViewContainerTitle.d.ts +1 -1
- package/esm/ui/App/ViewContainerTitle.js +21 -11
- package/esm/ui/App/ViewErrorFallback.d.ts +18 -0
- package/esm/ui/App/ViewErrorFallback.js +42 -0
- package/esm/ui/App/ViewHeader.d.ts +3 -4
- package/esm/ui/App/ViewHeader.js +28 -17
- package/esm/ui/App/ViewLauncher.d.ts +2 -8
- package/esm/ui/App/ViewLauncher.js +7 -5
- package/esm/ui/App/ViewMenu.d.ts +3 -5
- package/esm/ui/App/ViewMenu.js +87 -92
- package/esm/ui/App/ViewStack.d.ts +7 -0
- package/esm/ui/App/ViewStack.js +48 -0
- package/esm/ui/App/ViewWrapper.d.ts +15 -1
- package/esm/ui/App/ViewWrapper.js +26 -10
- package/esm/ui/App/ViewsContainer.d.ts +4 -11
- package/esm/ui/App/ViewsContainer.js +6 -9
- package/esm/ui/App/index.d.ts +2 -1
- package/esm/ui/App/index.js +3 -2
- package/esm/ui/App/lazyChunk.d.ts +13 -0
- package/esm/ui/App/lazyChunk.js +91 -0
- package/esm/ui/App/lazyParts.d.ts +32 -0
- package/esm/ui/App/lazyParts.js +8 -0
- package/esm/ui/App/preloadAppShell.d.ts +14 -0
- package/esm/ui/App/preloadAppShell.js +41 -0
- package/esm/ui/App/types.d.ts +17 -3
- package/esm/ui/App/types.js +1 -1
- package/esm/ui/App/useViewVisibility.d.ts +35 -0
- package/esm/ui/App/useViewVisibility.js +88 -0
- package/esm/ui/App/viewTitle.d.ts +12 -0
- package/esm/ui/App/viewTitle.js +17 -0
- package/esm/ui/index.d.ts +1 -1
- package/esm/ui/index.js +1 -1
- package/package.json +12 -17
- package/esm/AppFocus/index.d.ts +0 -5
- package/esm/AppFocus/index.js +0 -12
- package/esm/Assemblies/SessionAssembliesMixin.d.ts +0 -92
- package/esm/Assemblies/SessionAssembliesMixin.js +0 -53
- package/esm/Assemblies/TemporaryAssembliesMixin.d.ts +0 -10
- package/esm/Assemblies/TemporaryAssembliesMixin.js +0 -37
- package/esm/DockviewLayout/index.d.ts +0 -35
- package/esm/DockviewLayout/index.js +0 -111
- package/esm/ui/App/DockviewContext.d.ts +0 -22
- package/esm/ui/App/DockviewContext.js +0 -29
- package/esm/ui/App/DockviewLeftHeaderActions.d.ts +0 -2
- package/esm/ui/App/DockviewLeftHeaderActions.js +0 -58
- package/esm/ui/App/DockviewRightHeaderActions.d.ts +0 -2
- package/esm/ui/App/DockviewRightHeaderActions.js +0 -100
- package/esm/ui/App/DrawerControls.d.ts +0 -5
- package/esm/ui/App/DrawerControls.js +0 -25
- package/esm/ui/App/DrawerWidgetSelector.d.ts +0 -5
- package/esm/ui/App/DrawerWidgetSelector.js +0 -47
- package/esm/ui/App/JBrowseViewPanel.d.ts +0 -8
- package/esm/ui/App/JBrowseViewPanel.js +0 -40
- package/esm/ui/App/JBrowseViewTab.d.ts +0 -8
- package/esm/ui/App/JBrowseViewTab.js +0 -97
- package/esm/ui/App/ModalWidget.d.ts +0 -6
- package/esm/ui/App/ModalWidget.js +0 -48
- package/esm/ui/App/TiledViewsContainer.d.ts +0 -6
- package/esm/ui/App/TiledViewsContainer.js +0 -366
- package/esm/ui/App/copyView.d.ts +0 -1
- package/esm/ui/App/copyView.js +0 -29
- package/esm/ui/App/dockviewUtils.d.ts +0 -46
- package/esm/ui/App/dockviewUtils.js +0 -55
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { makeStyles } from '@jbrowse/core/util/tss-react';
|
|
4
|
-
import { createElementId } from '@jbrowse/core/util/types/mst';
|
|
5
|
-
import { useTheme } from '@mui/material';
|
|
6
|
-
import { DockviewReact } from 'dockview-react';
|
|
7
|
-
import { autorun } from 'mobx';
|
|
8
|
-
import { observer } from 'mobx-react';
|
|
9
|
-
import { DockviewContext, clearPendingMoveAction, peekPendingMoveAction, } from "./DockviewContext.js";
|
|
10
|
-
import DockviewLeftHeaderActions from "./DockviewLeftHeaderActions.js";
|
|
11
|
-
import DockviewRightHeaderActions from "./DockviewRightHeaderActions.js";
|
|
12
|
-
import JBrowseViewPanel from "./JBrowseViewPanel.js";
|
|
13
|
-
import JBrowseViewTab from "./JBrowseViewTab.js";
|
|
14
|
-
import { cleanLayoutForStorage, createPanelConfig, updatePanelParams, } from "./dockviewUtils.js";
|
|
15
|
-
import { isSessionWithDockviewLayout } from "../../DockviewLayout/index.js";
|
|
16
|
-
const useStyles = makeStyles()(() => ({
|
|
17
|
-
container: {
|
|
18
|
-
height: '100%',
|
|
19
|
-
width: '100%',
|
|
20
|
-
gridRow: 'components',
|
|
21
|
-
},
|
|
22
|
-
}));
|
|
23
|
-
function getPanelPosition(group, direction) {
|
|
24
|
-
if (!group) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
if (direction) {
|
|
28
|
-
return { referenceGroup: group, direction };
|
|
29
|
-
}
|
|
30
|
-
return { referenceGroup: group };
|
|
31
|
-
}
|
|
32
|
-
const components = {
|
|
33
|
-
jbrowseView: JBrowseViewPanel,
|
|
34
|
-
};
|
|
35
|
-
const tabComponents = {
|
|
36
|
-
jbrowseTab: JBrowseViewTab,
|
|
37
|
-
};
|
|
38
|
-
const TiledViewsContainer = observer(function TiledViewsContainer({ session, }) {
|
|
39
|
-
const { classes } = useStyles();
|
|
40
|
-
const theme = useTheme();
|
|
41
|
-
const [api, setApi] = useState(null);
|
|
42
|
-
const trackedViewIdsRef = useRef(new Set());
|
|
43
|
-
const rearrangingRef = useRef(false);
|
|
44
|
-
const sessionRef = useRef(session);
|
|
45
|
-
sessionRef.current = session;
|
|
46
|
-
const rearrangePanels = useCallback((arrange) => {
|
|
47
|
-
if (!api) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
rearrangingRef.current = true;
|
|
51
|
-
try {
|
|
52
|
-
arrange(api);
|
|
53
|
-
}
|
|
54
|
-
finally {
|
|
55
|
-
rearrangingRef.current = false;
|
|
56
|
-
}
|
|
57
|
-
}, [api]);
|
|
58
|
-
const addEmptyTab = useCallback((targetGroup) => {
|
|
59
|
-
if (!api) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const panelId = `panel-${createElementId()}`;
|
|
63
|
-
const group = targetGroup ?? api.activeGroup;
|
|
64
|
-
api.addPanel({
|
|
65
|
-
...createPanelConfig(panelId, session, 'New Tab'),
|
|
66
|
-
position: getPanelPosition(group),
|
|
67
|
-
});
|
|
68
|
-
if (isSessionWithDockviewLayout(session)) {
|
|
69
|
-
session.setActivePanelId(panelId);
|
|
70
|
-
}
|
|
71
|
-
}, [api, session]);
|
|
72
|
-
const moveViewToPanel = useCallback((viewId, direction) => {
|
|
73
|
-
if (!api || !isSessionWithDockviewLayout(session)) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
session.removeViewFromPanel(viewId);
|
|
77
|
-
const panelId = `panel-${createElementId()}`;
|
|
78
|
-
api.addPanel({
|
|
79
|
-
...createPanelConfig(panelId, session, 'New Tab'),
|
|
80
|
-
position: getPanelPosition(api.activeGroup, direction),
|
|
81
|
-
});
|
|
82
|
-
session.assignViewToPanel(panelId, viewId);
|
|
83
|
-
session.setActivePanelId(panelId);
|
|
84
|
-
}, [api, session]);
|
|
85
|
-
const moveViewToNewTab = useCallback((viewId) => {
|
|
86
|
-
moveViewToPanel(viewId);
|
|
87
|
-
}, [moveViewToPanel]);
|
|
88
|
-
const moveViewToSplitRight = useCallback((viewId) => {
|
|
89
|
-
moveViewToPanel(viewId, 'right');
|
|
90
|
-
}, [moveViewToPanel]);
|
|
91
|
-
const contextValue = useMemo(() => ({
|
|
92
|
-
api,
|
|
93
|
-
rearrangePanels,
|
|
94
|
-
addEmptyTab,
|
|
95
|
-
moveViewToNewTab,
|
|
96
|
-
moveViewToSplitRight,
|
|
97
|
-
}), [api, rearrangePanels, addEmptyTab, moveViewToNewTab, moveViewToSplitRight]);
|
|
98
|
-
const createInitialPanels = useCallback((dockviewApi) => {
|
|
99
|
-
const session = sessionRef.current;
|
|
100
|
-
const pendingAction = peekPendingMoveAction();
|
|
101
|
-
const initLayout = isSessionWithDockviewLayout(session)
|
|
102
|
-
? session.init
|
|
103
|
-
: undefined;
|
|
104
|
-
if (initLayout && isSessionWithDockviewLayout(session)) {
|
|
105
|
-
trackedViewIdsRef.current.clear();
|
|
106
|
-
let firstPanelId;
|
|
107
|
-
const groupSizes = [];
|
|
108
|
-
function processNode(node, referenceGroup, direction) {
|
|
109
|
-
if (!node) {
|
|
110
|
-
return undefined;
|
|
111
|
-
}
|
|
112
|
-
if (node.viewIds !== undefined) {
|
|
113
|
-
const panelId = `panel-${createElementId()}`;
|
|
114
|
-
if (!firstPanelId) {
|
|
115
|
-
firstPanelId = panelId;
|
|
116
|
-
}
|
|
117
|
-
const position = referenceGroup && direction
|
|
118
|
-
? { referenceGroup, direction }
|
|
119
|
-
: referenceGroup
|
|
120
|
-
? { referenceGroup }
|
|
121
|
-
: undefined;
|
|
122
|
-
dockviewApi.addPanel({
|
|
123
|
-
...createPanelConfig(panelId, session, 'Tab'),
|
|
124
|
-
position,
|
|
125
|
-
});
|
|
126
|
-
for (const viewId of node.viewIds) {
|
|
127
|
-
if (isSessionWithDockviewLayout(session)) {
|
|
128
|
-
session.assignViewToPanel(panelId, viewId);
|
|
129
|
-
}
|
|
130
|
-
trackedViewIdsRef.current.add(viewId);
|
|
131
|
-
}
|
|
132
|
-
const group = dockviewApi.getPanel(panelId)?.group;
|
|
133
|
-
if (group && node.size !== undefined) {
|
|
134
|
-
groupSizes.push({ group, size: node.size });
|
|
135
|
-
}
|
|
136
|
-
return group;
|
|
137
|
-
}
|
|
138
|
-
if (node.children && node.children.length > 0) {
|
|
139
|
-
const dockviewDirection = node.direction === 'horizontal' ? 'right' : 'below';
|
|
140
|
-
let currentGroup = referenceGroup;
|
|
141
|
-
for (let i = 0; i < node.children.length; i++) {
|
|
142
|
-
const child = node.children[i];
|
|
143
|
-
const childDirection = i === 0 ? direction : dockviewDirection;
|
|
144
|
-
const childRef = i === 0 ? referenceGroup : currentGroup;
|
|
145
|
-
const newGroup = processNode(child, childRef, childDirection);
|
|
146
|
-
if (newGroup) {
|
|
147
|
-
currentGroup = newGroup;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return currentGroup;
|
|
151
|
-
}
|
|
152
|
-
return undefined;
|
|
153
|
-
}
|
|
154
|
-
processNode(initLayout, undefined, undefined);
|
|
155
|
-
if (groupSizes.length >= 2 &&
|
|
156
|
-
initLayout.direction &&
|
|
157
|
-
groupSizes.length === initLayout.children?.length) {
|
|
158
|
-
const direction = initLayout.direction;
|
|
159
|
-
requestAnimationFrame(() => {
|
|
160
|
-
const totalSize = groupSizes.reduce((sum, g) => sum + g.size, 0);
|
|
161
|
-
if (totalSize > 0) {
|
|
162
|
-
if (direction === 'horizontal') {
|
|
163
|
-
const containerWidth = dockviewApi.width;
|
|
164
|
-
if (containerWidth > 0) {
|
|
165
|
-
for (const { group, size } of groupSizes) {
|
|
166
|
-
const width = Math.round(containerWidth * (size / totalSize));
|
|
167
|
-
group.api.setSize({ width });
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
const containerHeight = dockviewApi.height;
|
|
173
|
-
if (containerHeight > 0) {
|
|
174
|
-
for (const { group, size } of groupSizes) {
|
|
175
|
-
const height = Math.round(containerHeight * (size / totalSize));
|
|
176
|
-
group.api.setSize({ height });
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
session.setInit(undefined);
|
|
184
|
-
if (firstPanelId) {
|
|
185
|
-
session.setActivePanelId(firstPanelId);
|
|
186
|
-
dockviewApi.getPanel(firstPanelId)?.api.setActive();
|
|
187
|
-
}
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
if (isSessionWithDockviewLayout(session)) {
|
|
191
|
-
for (const panelId of session.panelViewAssignments.keys()) {
|
|
192
|
-
session.removePanel(panelId);
|
|
193
|
-
}
|
|
194
|
-
session.setDockviewLayout(undefined);
|
|
195
|
-
}
|
|
196
|
-
trackedViewIdsRef.current.clear();
|
|
197
|
-
const pendingViewExists = pendingAction && session.views.some(v => v.id === pendingAction.viewId);
|
|
198
|
-
if (pendingViewExists && isSessionWithDockviewLayout(session)) {
|
|
199
|
-
const { type, viewId: pendingViewId } = pendingAction;
|
|
200
|
-
const otherViewIds = session.views
|
|
201
|
-
.map(v => v.id)
|
|
202
|
-
.filter(id => id !== pendingViewId);
|
|
203
|
-
if (otherViewIds.length > 0) {
|
|
204
|
-
const firstPanelId = `panel-${createElementId()}`;
|
|
205
|
-
dockviewApi.addPanel(createPanelConfig(firstPanelId, session));
|
|
206
|
-
for (const viewId of otherViewIds) {
|
|
207
|
-
session.assignViewToPanel(firstPanelId, viewId);
|
|
208
|
-
trackedViewIdsRef.current.add(viewId);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
const pendingPanelId = `panel-${createElementId()}`;
|
|
212
|
-
const direction = type === 'splitRight' ? 'right' : undefined;
|
|
213
|
-
dockviewApi.addPanel({
|
|
214
|
-
...createPanelConfig(pendingPanelId, session, 'New Tab'),
|
|
215
|
-
position: getPanelPosition(dockviewApi.activeGroup, direction),
|
|
216
|
-
});
|
|
217
|
-
session.assignViewToPanel(pendingPanelId, pendingViewId);
|
|
218
|
-
trackedViewIdsRef.current.add(pendingViewId);
|
|
219
|
-
session.setActivePanelId(pendingPanelId);
|
|
220
|
-
clearPendingMoveAction();
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
const panelId = `panel-${createElementId()}`;
|
|
224
|
-
dockviewApi.addPanel(createPanelConfig(panelId, session));
|
|
225
|
-
if (isSessionWithDockviewLayout(session)) {
|
|
226
|
-
session.setActivePanelId(panelId);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}, []);
|
|
230
|
-
const onReady = useCallback((event) => {
|
|
231
|
-
setApi(event.api);
|
|
232
|
-
event.api.onDidActivePanelChange(e => {
|
|
233
|
-
if (e?.id && isSessionWithDockviewLayout(sessionRef.current)) {
|
|
234
|
-
sessionRef.current.setActivePanelId(e.id);
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
event.api.onDidRemovePanel(e => {
|
|
238
|
-
if (rearrangingRef.current) {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
if (isSessionWithDockviewLayout(sessionRef.current)) {
|
|
242
|
-
const viewIds = sessionRef.current.getViewIdsForPanel(e.id);
|
|
243
|
-
for (const viewId of viewIds) {
|
|
244
|
-
const view = sessionRef.current.views.find(v => v.id === viewId);
|
|
245
|
-
if (view) {
|
|
246
|
-
sessionRef.current.removeView(view);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
sessionRef.current.removePanel(e.id);
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
event.api.onDidLayoutChange(() => {
|
|
253
|
-
if (!rearrangingRef.current &&
|
|
254
|
-
isSessionWithDockviewLayout(sessionRef.current)) {
|
|
255
|
-
sessionRef.current.setDockviewLayout(cleanLayoutForStorage(event.api.toJSON()));
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
const hasPendingAction = peekPendingMoveAction() !== null;
|
|
259
|
-
const dockviewSession = isSessionWithDockviewLayout(sessionRef.current)
|
|
260
|
-
? sessionRef.current
|
|
261
|
-
: null;
|
|
262
|
-
const savedLayout = !hasPendingAction && dockviewSession?.dockviewLayout;
|
|
263
|
-
if (savedLayout) {
|
|
264
|
-
try {
|
|
265
|
-
rearrangingRef.current = true;
|
|
266
|
-
event.api.fromJSON(savedLayout);
|
|
267
|
-
updatePanelParams(event.api, dockviewSession);
|
|
268
|
-
for (const viewIds of dockviewSession.panelViewAssignments.values()) {
|
|
269
|
-
for (const viewId of viewIds) {
|
|
270
|
-
trackedViewIdsRef.current.add(viewId);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
if (event.api.panels.length === 0) {
|
|
274
|
-
throw new Error('No panels after fromJSON restore');
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
catch (e) {
|
|
278
|
-
console.error('Failed to restore dockview layout:', e);
|
|
279
|
-
createInitialPanels(event.api);
|
|
280
|
-
}
|
|
281
|
-
finally {
|
|
282
|
-
rearrangingRef.current = false;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
createInitialPanels(event.api);
|
|
287
|
-
}
|
|
288
|
-
}, [createInitialPanels]);
|
|
289
|
-
useEffect(() => {
|
|
290
|
-
const dispose = autorun(() => {
|
|
291
|
-
if (!api) {
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
const { views } = session;
|
|
295
|
-
const currentViewIds = new Set(views.map(v => v.id));
|
|
296
|
-
const trackedIds = trackedViewIdsRef.current;
|
|
297
|
-
for (const view of views) {
|
|
298
|
-
if (!trackedIds.has(view.id)) {
|
|
299
|
-
trackedIds.add(view.id);
|
|
300
|
-
if (isSessionWithDockviewLayout(session)) {
|
|
301
|
-
let activePanelId = session.activePanelId;
|
|
302
|
-
if (!activePanelId || !api.getPanel(activePanelId)) {
|
|
303
|
-
const firstPanel = api.panels[0];
|
|
304
|
-
if (firstPanel) {
|
|
305
|
-
activePanelId = firstPanel.id;
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
activePanelId = `panel-${createElementId()}`;
|
|
309
|
-
api.addPanel(createPanelConfig(activePanelId, session));
|
|
310
|
-
}
|
|
311
|
-
session.setActivePanelId(activePanelId);
|
|
312
|
-
}
|
|
313
|
-
session.assignViewToPanel(activePanelId, view.id);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
for (const id of trackedIds) {
|
|
318
|
-
if (!currentViewIds.has(id)) {
|
|
319
|
-
trackedIds.delete(id);
|
|
320
|
-
if (isSessionWithDockviewLayout(session)) {
|
|
321
|
-
session.removeViewFromPanel(id);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
return dispose;
|
|
327
|
-
}, [session, api]);
|
|
328
|
-
useEffect(() => {
|
|
329
|
-
if (!api || !isSessionWithDockviewLayout(session)) {
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
const dispose = autorun(() => {
|
|
333
|
-
const { dockviewLayout } = session;
|
|
334
|
-
if (!dockviewLayout || rearrangingRef.current) {
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
const currentLayout = cleanLayoutForStorage(api.toJSON());
|
|
338
|
-
if (JSON.stringify(currentLayout) === JSON.stringify(dockviewLayout)) {
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
rearrangingRef.current = true;
|
|
342
|
-
try {
|
|
343
|
-
api.fromJSON(dockviewLayout);
|
|
344
|
-
updatePanelParams(api, sessionRef.current);
|
|
345
|
-
trackedViewIdsRef.current.clear();
|
|
346
|
-
for (const viewIds of session.panelViewAssignments.values()) {
|
|
347
|
-
for (const viewId of viewIds) {
|
|
348
|
-
trackedViewIdsRef.current.add(viewId);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
catch (e) {
|
|
353
|
-
console.error('Failed to restore dockview layout from undo:', e);
|
|
354
|
-
}
|
|
355
|
-
finally {
|
|
356
|
-
rearrangingRef.current = false;
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
return dispose;
|
|
360
|
-
}, [session, api]);
|
|
361
|
-
const themeClass = theme.palette.mode === 'dark'
|
|
362
|
-
? 'dockview-theme-dark'
|
|
363
|
-
: 'dockview-theme-light';
|
|
364
|
-
return (_jsx(DockviewContext.Provider, { value: contextValue, children: _jsx("div", { className: `${classes.container} ${themeClass}`, children: _jsx(DockviewReact, { components: components, tabComponents: tabComponents, leftHeaderActionsComponent: DockviewLeftHeaderActions, rightHeaderActionsComponent: DockviewRightHeaderActions, onReady: onReady }) }) }));
|
|
365
|
-
});
|
|
366
|
-
export default TiledViewsContainer;
|
package/esm/ui/App/copyView.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function renameIds(obj: Record<string, unknown>): Record<string, unknown>;
|
package/esm/ui/App/copyView.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { createElementId } from '@jbrowse/core/util/types/mst';
|
|
2
|
-
export function renameIds(obj) {
|
|
3
|
-
const idMap = new Map();
|
|
4
|
-
function transformIds(value) {
|
|
5
|
-
if (value === null || value === undefined) {
|
|
6
|
-
return value;
|
|
7
|
-
}
|
|
8
|
-
if (Array.isArray(value)) {
|
|
9
|
-
return value.map(transformIds);
|
|
10
|
-
}
|
|
11
|
-
if (typeof value === 'object') {
|
|
12
|
-
const result = {};
|
|
13
|
-
for (const [key, val] of Object.entries(value)) {
|
|
14
|
-
if (key === 'id' && typeof val === 'string') {
|
|
15
|
-
if (!idMap.has(val)) {
|
|
16
|
-
idMap.set(val, createElementId());
|
|
17
|
-
}
|
|
18
|
-
result[key] = `${val}-${idMap.get(val)}`;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
result[key] = transformIds(val);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
return value;
|
|
27
|
-
}
|
|
28
|
-
return transformIds(obj);
|
|
29
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { DockviewSessionType } from './types.ts';
|
|
2
|
-
import type { AbstractViewModel } from '@jbrowse/core/util';
|
|
3
|
-
import type { DockviewApi } from 'dockview-react';
|
|
4
|
-
export declare function getViewsForPanel(panelId: string, session: DockviewSessionType | undefined): AbstractViewModel[];
|
|
5
|
-
export declare function createPanelConfig(panelId: string, session: DockviewSessionType, title?: string): {
|
|
6
|
-
id: string;
|
|
7
|
-
component: "jbrowseView";
|
|
8
|
-
tabComponent: "jbrowseTab";
|
|
9
|
-
title: string;
|
|
10
|
-
params: {
|
|
11
|
-
panelId: string;
|
|
12
|
-
session: DockviewSessionType;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export declare function cleanLayoutForStorage(layout: ReturnType<DockviewApi['toJSON']>): {
|
|
16
|
-
panels: {
|
|
17
|
-
[k: string]: {
|
|
18
|
-
params: {};
|
|
19
|
-
id: string;
|
|
20
|
-
contentComponent?: string;
|
|
21
|
-
tabComponent?: string;
|
|
22
|
-
title?: string;
|
|
23
|
-
renderer?: import("dockview-core").DockviewPanelRenderer;
|
|
24
|
-
minimumWidth?: number;
|
|
25
|
-
minimumHeight?: number;
|
|
26
|
-
maximumWidth?: number;
|
|
27
|
-
maximumHeight?: number;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
grid: {
|
|
31
|
-
root: import("dockview-core").SerializedGridObject<import("dockview-core/dist/cjs/dockview/dockviewGroupPanelModel").GroupPanelViewState>;
|
|
32
|
-
height: number;
|
|
33
|
-
width: number;
|
|
34
|
-
orientation: import("dockview-core").Orientation;
|
|
35
|
-
};
|
|
36
|
-
activeGroup?: string;
|
|
37
|
-
floatingGroups?: import("dockview-core").SerializedFloatingGroup[];
|
|
38
|
-
popoutGroups?: import("dockview-core").SerializedPopoutGroup[];
|
|
39
|
-
};
|
|
40
|
-
export declare function updatePanelParams(api: DockviewApi, session: DockviewSessionType): void;
|
|
41
|
-
export declare function rearrangePanelsWithDirection(api: DockviewApi, getPosition: (idx: number, panelStates: {
|
|
42
|
-
id: string;
|
|
43
|
-
}[]) => {
|
|
44
|
-
referencePanel: string;
|
|
45
|
-
direction: 'right' | 'below' | 'within';
|
|
46
|
-
} | undefined): void;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { isSessionWithDockviewLayout } from "../../DockviewLayout/index.js";
|
|
2
|
-
export function getViewsForPanel(panelId, session) {
|
|
3
|
-
if (!session || !isSessionWithDockviewLayout(session)) {
|
|
4
|
-
return [];
|
|
5
|
-
}
|
|
6
|
-
const viewIds = session.getViewIdsForPanel(panelId);
|
|
7
|
-
return [...viewIds]
|
|
8
|
-
.map(id => session.views.find(v => v.id === id))
|
|
9
|
-
.filter((v) => v !== undefined);
|
|
10
|
-
}
|
|
11
|
-
export function createPanelConfig(panelId, session, title = 'Main') {
|
|
12
|
-
return {
|
|
13
|
-
id: panelId,
|
|
14
|
-
component: 'jbrowseView',
|
|
15
|
-
tabComponent: 'jbrowseTab',
|
|
16
|
-
title,
|
|
17
|
-
params: { panelId, session },
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export function cleanLayoutForStorage(layout) {
|
|
21
|
-
return {
|
|
22
|
-
...layout,
|
|
23
|
-
panels: Object.fromEntries(Object.entries(layout.panels).map(([id, panel]) => [
|
|
24
|
-
id,
|
|
25
|
-
{ ...panel, params: {} },
|
|
26
|
-
])),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export function updatePanelParams(api, session) {
|
|
30
|
-
for (const panel of api.panels) {
|
|
31
|
-
panel.update({ params: { panelId: panel.id, session } });
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export function rearrangePanelsWithDirection(api, getPosition) {
|
|
35
|
-
const panels = api.panels;
|
|
36
|
-
if (panels.length <= 1) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const panelStates = panels.map(p => ({
|
|
40
|
-
id: p.id,
|
|
41
|
-
component: 'jbrowseView',
|
|
42
|
-
tabComponent: 'jbrowseTab',
|
|
43
|
-
title: p.title,
|
|
44
|
-
params: p.params,
|
|
45
|
-
}));
|
|
46
|
-
for (const p of panels) {
|
|
47
|
-
api.removePanel(p);
|
|
48
|
-
}
|
|
49
|
-
for (const [idx, state] of panelStates.entries()) {
|
|
50
|
-
api.addPanel({
|
|
51
|
-
...state,
|
|
52
|
-
position: getPosition(idx, panelStates),
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|