@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
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a pointer sitting over a panel would drop a view.
|
|
3
|
+
*
|
|
4
|
+
* Kept as geometry over a plain rect rather than reading the DOM, because this
|
|
5
|
+
* is the part of drag-and-drop with actual decisions in it — the edge band, the
|
|
6
|
+
* tie-break between two edges, what happens in the middle — and all of it is
|
|
7
|
+
* checkable without rendering anything or synthesising a pointer.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* `center` means "add as a tab in this panel"; an edge means "split this panel
|
|
11
|
+
* and put the view in the new half".
|
|
12
|
+
*
|
|
13
|
+
* The bands are proportional rather than a fixed pixel depth so a narrow panel
|
|
14
|
+
* stays droppable — at a fixed 40px a 100px-wide panel would be all edge and
|
|
15
|
+
* have no centre to drop a tab into. `edgeFraction` is capped below 0.5 for the
|
|
16
|
+
* same reason: at 0.5 the centre vanishes entirely.
|
|
17
|
+
*
|
|
18
|
+
* Corners go to whichever edge the pointer is proportionally deeper into, so
|
|
19
|
+
* the diagonal is the tie-break and neither axis silently wins. **This is a
|
|
20
|
+
* deliberate divergence from dockview**, whose `calculateQuadrantAsPercentage`
|
|
21
|
+
* tests left, right, top, bottom in that order and returns the first hit — so
|
|
22
|
+
* in its top-left corner `left` always wins, however far into the top band the
|
|
23
|
+
* pointer is. Its band is 20% where this defaults to 25%.
|
|
24
|
+
*/
|
|
25
|
+
export function dropZoneAt(rect, x, y, edgeFraction = 0.25) {
|
|
26
|
+
const fraction = Math.min(Math.max(edgeFraction, 0), 0.49);
|
|
27
|
+
if (rect.width <= 0 || rect.height <= 0) {
|
|
28
|
+
return 'center';
|
|
29
|
+
}
|
|
30
|
+
// 0 at the left/top edge, 1 at the right/bottom
|
|
31
|
+
const px = (x - rect.left) / rect.width;
|
|
32
|
+
const py = (y - rect.top) / rect.height;
|
|
33
|
+
// how far into an edge band the pointer is, as a share of that band
|
|
34
|
+
const depths = [
|
|
35
|
+
{ zone: 'left', depth: (fraction - px) / fraction },
|
|
36
|
+
{ zone: 'right', depth: (px - (1 - fraction)) / fraction },
|
|
37
|
+
{ zone: 'top', depth: (fraction - py) / fraction },
|
|
38
|
+
{ zone: 'bottom', depth: (py - (1 - fraction)) / fraction },
|
|
39
|
+
].filter(candidate => candidate.depth > 0);
|
|
40
|
+
if (depths.length === 0) {
|
|
41
|
+
return 'center';
|
|
42
|
+
}
|
|
43
|
+
return depths.reduce((best, candidate) => candidate.depth > best.depth ? candidate : best).zone;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Which gap between tabs a pointer at `x` is nearest — the insertion index a
|
|
47
|
+
* drop there would use, and the x to draw the caret at.
|
|
48
|
+
*
|
|
49
|
+
* The test is each tab's MIDPOINT rather than its edges, so every x belongs to
|
|
50
|
+
* exactly one gap and there is no dead band between tabs where a drop would
|
|
51
|
+
* have to fall back to appending. `rects` are in strip order and `x` is in
|
|
52
|
+
* their coordinate space, whatever that is — this function does not know
|
|
53
|
+
* whether it was handed viewport or panel-relative numbers.
|
|
54
|
+
*
|
|
55
|
+
* An empty strip is index 0, which is the only sensible place for a first tab.
|
|
56
|
+
*/
|
|
57
|
+
export function stripDropAt(rects, x) {
|
|
58
|
+
for (const [i, rect] of rects.entries()) {
|
|
59
|
+
if (x < rect.left + rect.width / 2) {
|
|
60
|
+
return { index: i, left: rect.left };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const last = rects.at(-1);
|
|
64
|
+
return {
|
|
65
|
+
index: rects.length,
|
|
66
|
+
left: last ? last.left + last.width : 0,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* What each zone means, in one table.
|
|
71
|
+
*
|
|
72
|
+
* `split` is the split a drop there asks for — which way the panel divides and
|
|
73
|
+
* whether the new half goes first; `center` is not a split. `rect` is where the
|
|
74
|
+
* indicator is drawn, as CSS percentages of the panel.
|
|
75
|
+
*
|
|
76
|
+
* One table rather than two switches because the pair has to agree: the shaded
|
|
77
|
+
* half IS the half the drop lands in, and that is the whole content of the
|
|
78
|
+
* indicator. Written apart, `right` could shade the left half and nothing would
|
|
79
|
+
* be wrong with either function on its own.
|
|
80
|
+
*/
|
|
81
|
+
const ZONES = {
|
|
82
|
+
left: {
|
|
83
|
+
split: { direction: 'row', before: true },
|
|
84
|
+
rect: { left: '0%', top: '0%', width: '50%', height: '100%' },
|
|
85
|
+
},
|
|
86
|
+
right: {
|
|
87
|
+
split: { direction: 'row', before: false },
|
|
88
|
+
rect: { left: '50%', top: '0%', width: '50%', height: '100%' },
|
|
89
|
+
},
|
|
90
|
+
top: {
|
|
91
|
+
split: { direction: 'column', before: true },
|
|
92
|
+
rect: { left: '0%', top: '0%', width: '100%', height: '50%' },
|
|
93
|
+
},
|
|
94
|
+
bottom: {
|
|
95
|
+
split: { direction: 'column', before: false },
|
|
96
|
+
rect: { left: '0%', top: '50%', width: '100%', height: '50%' },
|
|
97
|
+
},
|
|
98
|
+
center: {
|
|
99
|
+
split: undefined,
|
|
100
|
+
rect: { left: '0%', top: '0%', width: '100%', height: '100%' },
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* The split a drop on `zone` asks for: which way the panel divides, and whether
|
|
105
|
+
* the new half goes first. `center` is not a split.
|
|
106
|
+
*/
|
|
107
|
+
export function splitForZone(zone) {
|
|
108
|
+
return ZONES[zone].split;
|
|
109
|
+
}
|
|
110
|
+
/** Where the drop indicator goes, as CSS percentages of the panel. */
|
|
111
|
+
export function indicatorRect(zone) {
|
|
112
|
+
return ZONES[zone].rect;
|
|
113
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { WorkspaceLayoutMixin, isSessionWithWorkspaceLayout } from './model.ts';
|
|
2
|
+
export { WorkspaceContainer } from './WorkspaceContainer.tsx';
|
|
3
|
+
export { LayoutRenderer } from './LayoutRenderer.tsx';
|
|
4
|
+
export { useLayoutDrag } from './useLayoutDrag.ts';
|
|
5
|
+
export type { WorkspaceLayoutMixinType, WorkspaceLayout } from './model.ts';
|
|
6
|
+
export type { LayoutTree, PanelNode, TabNode, BranchNode, TabHome, } from './tree.ts';
|
|
7
|
+
export type { LayoutSpecNode, PendingMove, TileMode } from './spec.ts';
|
|
8
|
+
export type { DropZone } from './dropZone.ts';
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import type { LayoutSpecNode, PendingMove, TileMode } from './spec.ts';
|
|
2
|
+
import type { LayoutTree, PanelNode, TabHome, TabNode } from './tree.ts';
|
|
3
|
+
import type { IAnyStateTreeNode, Instance } from '@jbrowse/mobx-state-tree';
|
|
4
|
+
export declare function WorkspaceLayoutMixin(): import("@jbrowse/mobx-state-tree").IModelType<{
|
|
5
|
+
layout: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ITypeUnion<import("@jbrowse/mobx-state-tree").ModelCreationType<{
|
|
6
|
+
id: string;
|
|
7
|
+
size: number | undefined;
|
|
8
|
+
tabs: readonly import("@jbrowse/mobx-state-tree").ModelCreationType<{
|
|
9
|
+
id: string;
|
|
10
|
+
viewIds: readonly string[] | undefined;
|
|
11
|
+
title: string | undefined;
|
|
12
|
+
}>[] | undefined;
|
|
13
|
+
activeTabId: string | undefined;
|
|
14
|
+
}> | import("@jbrowse/mobx-state-tree").ModelCreationType<{
|
|
15
|
+
id: string;
|
|
16
|
+
size: number | undefined;
|
|
17
|
+
direction: "column" | "row";
|
|
18
|
+
children: readonly import("@jbrowse/mobx-state-tree").ModelCreationType<{
|
|
19
|
+
id: string;
|
|
20
|
+
size: number | undefined;
|
|
21
|
+
tabs: readonly import("@jbrowse/mobx-state-tree").ModelCreationType<{
|
|
22
|
+
id: string;
|
|
23
|
+
viewIds: readonly string[] | undefined;
|
|
24
|
+
title: string | undefined;
|
|
25
|
+
}>[] | undefined;
|
|
26
|
+
activeTabId: string | undefined;
|
|
27
|
+
}>[] | undefined;
|
|
28
|
+
}>, import("@jbrowse/mobx-state-tree").ModelSnapshotType<{
|
|
29
|
+
id: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
30
|
+
size: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
31
|
+
tabs: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IModelType<{
|
|
32
|
+
id: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
33
|
+
viewIds: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
34
|
+
/** set only by an explicit rename; otherwise the name is derived from views */
|
|
35
|
+
title: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
36
|
+
}, {}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
|
|
37
|
+
activeTabId: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
38
|
+
}> | import("@jbrowse/mobx-state-tree").ModelSnapshotType<{
|
|
39
|
+
id: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
40
|
+
size: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
41
|
+
direction: import("@jbrowse/mobx-state-tree").ISimpleType<"column" | "row">;
|
|
42
|
+
children: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IModelType<{
|
|
43
|
+
id: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
44
|
+
size: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
45
|
+
tabs: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IModelType<{
|
|
46
|
+
id: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
47
|
+
viewIds: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
48
|
+
/** set only by an explicit rename; otherwise the name is derived from views */
|
|
49
|
+
title: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
50
|
+
}, {}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
|
|
51
|
+
activeTabId: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
52
|
+
}, {}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
|
|
53
|
+
}>, import("@jbrowse/mobx-state-tree").ModelInstanceTypeProps<{
|
|
54
|
+
id: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
55
|
+
size: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
56
|
+
tabs: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IModelType<{
|
|
57
|
+
id: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
58
|
+
viewIds: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
59
|
+
/** set only by an explicit rename; otherwise the name is derived from views */
|
|
60
|
+
title: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
61
|
+
}, {}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
|
|
62
|
+
activeTabId: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
63
|
+
}> | import("@jbrowse/mobx-state-tree").ModelInstanceTypeProps<{
|
|
64
|
+
id: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
65
|
+
size: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
66
|
+
direction: import("@jbrowse/mobx-state-tree").ISimpleType<"column" | "row">;
|
|
67
|
+
children: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IModelType<{
|
|
68
|
+
id: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
69
|
+
size: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
70
|
+
tabs: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IModelType<{
|
|
71
|
+
id: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
72
|
+
viewIds: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
73
|
+
/** set only by an explicit rename; otherwise the name is derived from views */
|
|
74
|
+
title: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
75
|
+
}, {}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
|
|
76
|
+
activeTabId: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
77
|
+
}, {}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
|
|
78
|
+
}>>, [undefined]>;
|
|
79
|
+
activePanelId: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
80
|
+
/**
|
|
81
|
+
* Show only this cell, at the size of the whole workspace.
|
|
82
|
+
*
|
|
83
|
+
* Deliberately HERE and not a `maximized` flag on `PanelNode`. On the
|
|
84
|
+
* node it would be inside `tree.ts`, the half that carries the risk and
|
|
85
|
+
* is proven by a randomised operation sequence asserting canonical form
|
|
86
|
+
* after every step — and every operation would then have to say what it
|
|
87
|
+
* does to the flag: a split of a maximized panel, a drag of its last tab
|
|
88
|
+
* out, a normalize that collapses it into its parent. Beside
|
|
89
|
+
* `activePanelId` it is the same class of thing as `activePanelId`,
|
|
90
|
+
* including its failure mode, which `livePanelIds` already repairs.
|
|
91
|
+
*/
|
|
92
|
+
maximizedPanelId: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
93
|
+
}, {
|
|
94
|
+
/**
|
|
95
|
+
* The plain tree the pure functions take.
|
|
96
|
+
*
|
|
97
|
+
* `getSnapshot` is a `keepAlive` computed, so this is cached and
|
|
98
|
+
* referentially stable — which also lets MST's reconcile short-circuit on
|
|
99
|
+
* identity when `apply` writes an untouched subtree back.
|
|
100
|
+
*
|
|
101
|
+
* Uncast on purpose: the models below and the interfaces in `tree.ts` are
|
|
102
|
+
* two spellings of one shape, and this assignment is the only thing that
|
|
103
|
+
* checks they agree.
|
|
104
|
+
*/
|
|
105
|
+
readonly tree: LayoutTree;
|
|
106
|
+
} & {
|
|
107
|
+
readonly panels: PanelNode[];
|
|
108
|
+
readonly tabs: TabNode[];
|
|
109
|
+
hasPanel(panelId: string): boolean;
|
|
110
|
+
findTab(tabId: string): TabHome | undefined;
|
|
111
|
+
tabContainingView(viewId: string): TabHome | undefined;
|
|
112
|
+
panelContainingView(viewId: string): PanelNode | undefined;
|
|
113
|
+
/** The views a tab renders: its members, in `session.views` order. */
|
|
114
|
+
viewIdsForTab(tabId: string, order: string[]): string[];
|
|
115
|
+
/** The tab a panel is showing, or its first. */
|
|
116
|
+
activeTabOf(panelId: string): TabNode | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* What to render: the maximized cell alone, or the whole tree.
|
|
119
|
+
*
|
|
120
|
+
* Sized to 1 rather than handed over as it sits. A pane's `size` is its
|
|
121
|
+
* share of its siblings, and CSS distributes free space by grow factor
|
|
122
|
+
* only up to a total of 1 — so a cell that was a third of a row, alone
|
|
123
|
+
* in the workspace with `flexGrow: 0.33`, draws a third of the window
|
|
124
|
+
* and leaves the rest blank.
|
|
125
|
+
*/
|
|
126
|
+
readonly visibleTree: LayoutTree;
|
|
127
|
+
} & {
|
|
128
|
+
setActivePanelId(panelId: string | undefined): void;
|
|
129
|
+
/**
|
|
130
|
+
* Show one cell at the size of the workspace, or go back.
|
|
131
|
+
*
|
|
132
|
+
* A toggle rather than a pair, because the gesture is a toggle: the
|
|
133
|
+
* strip's double-click and the cell menu's one item both mean "this
|
|
134
|
+
* cell, or not any more". Maximizing a DIFFERENT cell while one is
|
|
135
|
+
* already maximized moves the mode rather than restoring, which is
|
|
136
|
+
* what the menu item on another cell's strip is asking for.
|
|
137
|
+
*
|
|
138
|
+
* Mounts no views that were not mounted — it is the same cell showing
|
|
139
|
+
* the same tab — and unmounts every other cell's, so the WebGL2
|
|
140
|
+
* context ceiling (`agent-docs/reference/GPU_CONTEXT_BUDGET.md`) can
|
|
141
|
+
* only go down. That is the reason it is this and not a `display:
|
|
142
|
+
* none` over a still-mounted workspace.
|
|
143
|
+
*/
|
|
144
|
+
toggleMaximizedPanel(panelId: string): void;
|
|
145
|
+
restorePanels(): void;
|
|
146
|
+
setActiveTab(panelId: string, tabId: string): void;
|
|
147
|
+
renameTab(tabId: string, title: string | undefined): void;
|
|
148
|
+
/** Split a grid cell; the new cell gets one empty tab. */
|
|
149
|
+
splitPanel(panelId: string, direction: 'row' | 'column', before?: any): PanelNode | undefined;
|
|
150
|
+
closePanel(panelId: string): void;
|
|
151
|
+
/** "New empty tab": a tab in an existing cell, showing the launcher. */
|
|
152
|
+
addTab(panelId: string, viewIds?: string[]): TabNode | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* Close a tab, and the cell with it if that was its last.
|
|
155
|
+
*
|
|
156
|
+
* A cell whose tabs are all gone is the state `pruneEmptyPanel` was
|
|
157
|
+
* written for — "dragging the last tab out of a split and leaving a
|
|
158
|
+
* blank half is the one place an empty panel is clearly not what was
|
|
159
|
+
* meant" — and closing that tab arrives at the identical half by a
|
|
160
|
+
* different gesture. It rendered nothing at all, not even the launcher
|
|
161
|
+
* an empty TAB shows, so the only way back out of it was the `+`.
|
|
162
|
+
*
|
|
163
|
+
* `pruneEmptyPanel` carries both guards already: a cell with tabs left
|
|
164
|
+
* stays, and the last cell in the workspace stays whatever happens to
|
|
165
|
+
* it, since there is nowhere for the tree to collapse to.
|
|
166
|
+
*/
|
|
167
|
+
closeTab(tabId: string): void;
|
|
168
|
+
addViewToTab(tabId: string, viewId: string): void;
|
|
169
|
+
/**
|
|
170
|
+
* Drop a dragged tab into an existing panel, as a tab.
|
|
171
|
+
*
|
|
172
|
+
* One action, so the tree never exists in a state where the tab is in
|
|
173
|
+
* both panels or neither. The imperative bridge needed an explicit
|
|
174
|
+
* `runInAction` around the unassign+reassign pair for exactly this, and
|
|
175
|
+
* a comment explaining that without it the reconcile autorun would
|
|
176
|
+
* observe the gap and re-home the view.
|
|
177
|
+
*/
|
|
178
|
+
dropTabInPanel(tabId: string, targetPanelId: string, index?: number): void;
|
|
179
|
+
/** Drop a dragged tab on a panel edge: split, and land in the new half. */
|
|
180
|
+
dropTabInNewSplit(tabId: string, targetPanelId: string, direction: 'row' | 'column', before: boolean): string | undefined;
|
|
181
|
+
setSizes(branchId: string, sizes: number[]): void;
|
|
182
|
+
/**
|
|
183
|
+
* Arrange the workspace as a spec states.
|
|
184
|
+
*
|
|
185
|
+
* The spec is the same shape a session spec's `layout` takes: a leaf's
|
|
186
|
+
* `views` names views by index into `session.views` or by id, so
|
|
187
|
+
* `{ direction: 'horizontal', children: [{ views: [0] }, { views: [1] }] }`
|
|
188
|
+
* means here what it means in a link. A leaf spelled any other way, an
|
|
189
|
+
* index past the end or an id no view has throws rather than arranging
|
|
190
|
+
* nothing — an untyped caller used to collapse the workspace into one
|
|
191
|
+
* blank tab that way.
|
|
192
|
+
*
|
|
193
|
+
* There is no `init` property and no standing request: the spec is
|
|
194
|
+
* converted and *becomes* the layout, here and now. `init` existed only
|
|
195
|
+
* because dockview had to be told, could not be told before it mounted,
|
|
196
|
+
* and had to be told again afterwards — three problems that all came
|
|
197
|
+
* from the layout living somewhere this action could not reach.
|
|
198
|
+
*/
|
|
199
|
+
applyLayoutSpec(spec: LayoutSpecNode): string[];
|
|
200
|
+
/**
|
|
201
|
+
* ViewMenu's "move to new tab": the view leaves its tab for a new one.
|
|
202
|
+
*
|
|
203
|
+
* `allViewIds` is EVERY view in the session, defaulting to the host's
|
|
204
|
+
* own list — homing drops any view the list does not name, so the
|
|
205
|
+
* `[viewId]` default this used to carry unhomed all the others.
|
|
206
|
+
*/
|
|
207
|
+
moveViewToNewTab(viewId: string, allViewIds?: string[]): string | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* ViewMenu's "move to split view": the view leaves for a new cell.
|
|
210
|
+
* `allViewIds` is every view in the session — see `moveViewToNewTab`.
|
|
211
|
+
*/
|
|
212
|
+
moveViewToSplitRight(viewId: string, allViewIds?: string[]): string | undefined;
|
|
213
|
+
homeUnassignedViews(viewIds: string[]): void;
|
|
214
|
+
} & {
|
|
215
|
+
/**
|
|
216
|
+
* Move one view relative to the others. PUBLIC API: an external plugin
|
|
217
|
+
* calls this behind a `'setPendingMove' in session` guard
|
|
218
|
+
* (jbrowse-plugin-protein3d, putting a protein view beside its genome
|
|
219
|
+
* view). It survived the last storage change by being kept as sugar, and
|
|
220
|
+
* it survives this one the same way — a capability-detecting caller
|
|
221
|
+
* cannot tell you it lost a capability.
|
|
222
|
+
*
|
|
223
|
+
* **`allViewIds` is therefore OPTIONAL, and has to stay that way.** The
|
|
224
|
+
* plugin passes the move alone, because that was the whole signature when
|
|
225
|
+
* its call site was written; requiring the second argument threw
|
|
226
|
+
* `undefined.filter` out of a launch the plugin does not wrap, and the
|
|
227
|
+
* figure was again the only thing that noticed. Keeping the NAME is half
|
|
228
|
+
* of not breaking a runtime lookup — the call has to keep working as it
|
|
229
|
+
* is spelled.
|
|
230
|
+
*/
|
|
231
|
+
setPendingMove(move: PendingMove | undefined, allViewIds?: string[]): void;
|
|
232
|
+
/**
|
|
233
|
+
* The whole-workspace re-arrange: every view one cell, in one of four
|
|
234
|
+
* shapes. Restored from the dockview header's four "Global:" commands,
|
|
235
|
+
* which went with that component and were not reimplemented.
|
|
236
|
+
*
|
|
237
|
+
* `allViewIds` is passed in rather than read off the session for the same
|
|
238
|
+
* reason `moveViewToNewTab` takes it: this mixin owns the tree and has no
|
|
239
|
+
* view list of its own. Passing `session.views` order means the
|
|
240
|
+
* arrangement it states is already the order views render in, so unlike a
|
|
241
|
+
* session spec's layout there is nothing for `orderViews` to apply.
|
|
242
|
+
*/
|
|
243
|
+
tileViews(mode: TileMode, allViewIds: string[]): void;
|
|
244
|
+
/**
|
|
245
|
+
* #action
|
|
246
|
+
* Arrange the session's views into panels. Calls `applyLayoutSpec`,
|
|
247
|
+
* turns workspaces mode on for this session (a layout renders nowhere
|
|
248
|
+
* else), and orders `session.views` to the spec's top-to-bottom
|
|
249
|
+
* order, which tabs read their order from. Without the last two steps
|
|
250
|
+
* the layout applies but does not display, or the tabs appear in the
|
|
251
|
+
* wrong order. Leaves take view ids or indexes into `session.views`; a
|
|
252
|
+
* layout that seats no view throws rather than leaving a blank tab. A
|
|
253
|
+
* session spec's `layout` and an agent's live re-layout both call it.
|
|
254
|
+
*/
|
|
255
|
+
layoutViews(spec: LayoutSpecNode): string[];
|
|
256
|
+
}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
|
|
257
|
+
export type WorkspaceLayoutMixinType = ReturnType<typeof WorkspaceLayoutMixin>;
|
|
258
|
+
export interface WorkspaceLayout extends Instance<WorkspaceLayoutMixinType> {
|
|
259
|
+
}
|
|
260
|
+
export declare function isSessionWithWorkspaceLayout(session: IAnyStateTreeNode): session is WorkspaceLayout;
|