@jbrowse/app-core 2.6.3 → 2.7.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.
- package/dist/AppFocus/index.d.ts +13 -0
- package/dist/AppFocus/index.js +24 -0
- package/dist/JBrowseModel/index.d.ts +11 -13
- package/dist/JBrowseModel/index.js +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/ui/App/App.d.ts +4 -4
- package/dist/ui/App/AppFab.d.ts +2 -2
- package/dist/ui/App/AppFab.js +2 -1
- package/dist/ui/App/DialogQueue.d.ts +2 -2
- package/dist/ui/App/DialogQueue.js +2 -1
- package/dist/ui/App/Drawer.d.ts +5 -6
- package/dist/ui/App/Drawer.js +49 -5
- package/dist/ui/App/DrawerHeader.d.ts +4 -4
- package/dist/ui/App/DrawerHeader.js +13 -3
- package/dist/ui/App/DrawerWidget.d.ts +2 -2
- package/dist/ui/App/ViewContainer.d.ts +2 -2
- package/dist/ui/App/ViewContainer.js +28 -3
- package/dist/ui/App/ViewContainerTitle.d.ts +2 -2
- package/dist/ui/App/ViewContainerTitle.js +2 -1
- package/dist/ui/App/ViewMenu.d.ts +1 -1
- package/dist/ui/App/ViewMenu.js +1 -1
- package/esm/AppFocus/index.d.ts +13 -0
- package/esm/AppFocus/index.js +20 -0
- package/esm/JBrowseModel/index.d.ts +11 -13
- package/esm/JBrowseModel/index.js +16 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/ui/App/App.d.ts +4 -4
- package/esm/ui/App/AppFab.d.ts +2 -2
- package/esm/ui/App/AppFab.js +2 -1
- package/esm/ui/App/DialogQueue.d.ts +2 -2
- package/esm/ui/App/DialogQueue.js +2 -1
- package/esm/ui/App/Drawer.d.ts +5 -6
- package/esm/ui/App/Drawer.js +26 -5
- package/esm/ui/App/DrawerHeader.d.ts +4 -4
- package/esm/ui/App/DrawerHeader.js +13 -3
- package/esm/ui/App/DrawerWidget.d.ts +2 -2
- package/esm/ui/App/ViewContainer.d.ts +2 -2
- package/esm/ui/App/ViewContainer.js +29 -4
- package/esm/ui/App/ViewContainerTitle.d.ts +2 -2
- package/esm/ui/App/ViewContainerTitle.js +2 -1
- package/esm/ui/App/ViewMenu.d.ts +1 -1
- package/esm/ui/App/ViewMenu.js +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #stateModel AppFocusMixin
|
|
3
|
+
* #category session
|
|
4
|
+
*/
|
|
5
|
+
export declare function AppFocusMixin(): import("mobx-state-tree").IModelType<{
|
|
6
|
+
/**
|
|
7
|
+
* #property
|
|
8
|
+
* used to keep track of which view is in focus
|
|
9
|
+
*/
|
|
10
|
+
focusedViewId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
11
|
+
}, {
|
|
12
|
+
setFocusedViewId(viewId: string): void;
|
|
13
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppFocusMixin = void 0;
|
|
4
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
|
+
/**
|
|
6
|
+
* #stateModel AppFocusMixin
|
|
7
|
+
* #category session
|
|
8
|
+
*/
|
|
9
|
+
function AppFocusMixin() {
|
|
10
|
+
return mobx_state_tree_1.types
|
|
11
|
+
.model({
|
|
12
|
+
/**
|
|
13
|
+
* #property
|
|
14
|
+
* used to keep track of which view is in focus
|
|
15
|
+
*/
|
|
16
|
+
focusedViewId: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
|
|
17
|
+
})
|
|
18
|
+
.actions(self => ({
|
|
19
|
+
setFocusedViewId(viewId) {
|
|
20
|
+
self.focusedViewId = viewId;
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
exports.AppFocusMixin = AppFocusMixin;
|
|
@@ -15,7 +15,9 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
|
|
|
15
15
|
defaultValue: string;
|
|
16
16
|
};
|
|
17
17
|
drivers: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IMapType<import("mobx-state-tree").ITypeUnion<import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<Record<string, any>>> | undefined, import("mobx-state-tree").ModelSnapshotType<Record<string, any>>, (Partial<import("mobx-state-tree/dist/internal").ExtractCFromProps<Record<string, any>>> & import("mobx-state-tree/dist/internal").NonEmptyObject) | undefined>>, [undefined]>;
|
|
18
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
18
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>; /**
|
|
19
|
+
* #getter
|
|
20
|
+
*/
|
|
19
21
|
highResolutionScaling: {
|
|
20
22
|
type: string;
|
|
21
23
|
defaultValue: number;
|
|
@@ -29,16 +31,12 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
|
|
|
29
31
|
};
|
|
30
32
|
subfeatures: {
|
|
31
33
|
type: string;
|
|
32
|
-
description: string;
|
|
33
|
-
* #getter
|
|
34
|
-
*/
|
|
34
|
+
description: string;
|
|
35
35
|
defaultValue: {};
|
|
36
36
|
contextVariable: string[];
|
|
37
37
|
};
|
|
38
38
|
depth: {
|
|
39
|
-
type: string;
|
|
40
|
-
* #getter
|
|
41
|
-
*/
|
|
39
|
+
type: string;
|
|
42
40
|
defaultValue: number;
|
|
43
41
|
description: string;
|
|
44
42
|
};
|
|
@@ -81,9 +79,7 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
|
|
|
81
79
|
};
|
|
82
80
|
topLevelCategories: {
|
|
83
81
|
type: string;
|
|
84
|
-
defaultValue: boolean;
|
|
85
|
-
* #action
|
|
86
|
-
*/
|
|
82
|
+
defaultValue: boolean;
|
|
87
83
|
};
|
|
88
84
|
subCategories: {
|
|
89
85
|
type: string;
|
|
@@ -96,9 +92,7 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
|
|
|
96
92
|
defaultValue: {};
|
|
97
93
|
};
|
|
98
94
|
extraThemes: {
|
|
99
|
-
type: string;
|
|
100
|
-
* #action
|
|
101
|
-
*/
|
|
95
|
+
type: string;
|
|
102
96
|
defaultValue: {};
|
|
103
97
|
};
|
|
104
98
|
logoPath: {
|
|
@@ -162,6 +156,10 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
|
|
|
162
156
|
* #action
|
|
163
157
|
*/
|
|
164
158
|
removePlugin(pluginDefinition: PluginDefinition): void;
|
|
159
|
+
/**
|
|
160
|
+
* #action
|
|
161
|
+
*/
|
|
162
|
+
setDefaultSessionConf(sessionConf: AnyConfigurationModel): void;
|
|
165
163
|
/**
|
|
166
164
|
* #action
|
|
167
165
|
*/
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.JBrowseModelF = void 0;
|
|
4
4
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
5
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
6
|
+
const mobx_1 = require("mobx");
|
|
6
7
|
// locals
|
|
7
8
|
const JBrowseConfig_1 = require("../JBrowseConfig");
|
|
8
9
|
function JBrowseModelF({ pluginManager, assemblyConfigSchema, }) {
|
|
@@ -109,6 +110,20 @@ function JBrowseModelF({ pluginManager, assemblyConfigSchema, }) {
|
|
|
109
110
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
111
|
(0, mobx_state_tree_1.getParent)(self).setPluginsUpdated(true);
|
|
111
112
|
},
|
|
113
|
+
/**
|
|
114
|
+
* #action
|
|
115
|
+
*/
|
|
116
|
+
setDefaultSessionConf(sessionConf) {
|
|
117
|
+
const newDefault =
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
119
|
+
(0, mobx_state_tree_1.getParent)(self).session.name === sessionConf.name
|
|
120
|
+
? (0, mobx_state_tree_1.getSnapshot)(sessionConf)
|
|
121
|
+
: (0, mobx_1.toJS)(sessionConf);
|
|
122
|
+
if (!newDefault.name) {
|
|
123
|
+
throw new Error(`unable to set default session to ${newDefault.name}`);
|
|
124
|
+
}
|
|
125
|
+
self.defaultSession = (0, mobx_state_tree_1.cast)(newDefault);
|
|
126
|
+
},
|
|
112
127
|
/**
|
|
113
128
|
* #action
|
|
114
129
|
*/
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ui"), exports);
|
|
18
18
|
__exportStar(require("./HistoryManagement"), exports);
|
|
19
|
+
__exportStar(require("./AppFocus"), exports);
|
|
19
20
|
__exportStar(require("./JBrowseConfig"), exports);
|
|
20
21
|
__exportStar(require("./JBrowseModel"), exports);
|
|
21
22
|
__exportStar(require("./Assemblies"), exports);
|
package/dist/ui/App/App.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SessionWithFocusedViewAndDrawerWidgets } from '@jbrowse/core/util';
|
|
3
3
|
import { SnackbarMessage } from '@jbrowse/core/ui/SnackbarModel';
|
|
4
4
|
import { MenuItem as JBMenuItem } from '@jbrowse/core/ui/Menu';
|
|
5
|
-
|
|
5
|
+
interface Props {
|
|
6
6
|
HeaderButtons?: React.ReactElement;
|
|
7
|
-
session:
|
|
7
|
+
session: SessionWithFocusedViewAndDrawerWidgets & {
|
|
8
8
|
savedSessionNames: string[];
|
|
9
9
|
menus: {
|
|
10
10
|
label: string;
|
|
@@ -14,6 +14,6 @@ type Props = {
|
|
|
14
14
|
snackbarMessages: SnackbarMessage[];
|
|
15
15
|
popSnackbarMessage: () => unknown;
|
|
16
16
|
};
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
18
|
declare const App: (props: Props) => React.JSX.Element;
|
|
19
19
|
export { App };
|
package/dist/ui/App/AppFab.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SessionWithDrawerWidgets } from '@jbrowse/core/util';
|
|
3
|
-
declare const
|
|
3
|
+
declare const AppFab: ({ session, }: {
|
|
4
4
|
session: SessionWithDrawerWidgets;
|
|
5
5
|
}) => React.JSX.Element | null;
|
|
6
|
-
export default
|
|
6
|
+
export default AppFab;
|
package/dist/ui/App/AppFab.js
CHANGED
|
@@ -23,10 +23,11 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
|
23
23
|
right: theme.spacing(2),
|
|
24
24
|
},
|
|
25
25
|
}));
|
|
26
|
-
|
|
26
|
+
const AppFab = (0, mobx_react_1.observer)(function ({ session, }) {
|
|
27
27
|
const { minimized, activeWidgets, drawerPosition } = session;
|
|
28
28
|
const { classes } = useStyles();
|
|
29
29
|
return activeWidgets.size > 0 && minimized ? (react_1.default.createElement(material_1.Tooltip, { title: "Open drawer widget" },
|
|
30
30
|
react_1.default.createElement(material_1.Fab, { className: drawerPosition === 'right' ? classes.right : classes.left, color: "primary", "data-testid": "drawer-maximize", onClick: () => session.showWidgetDrawer() },
|
|
31
31
|
react_1.default.createElement(Launch_1.default, null)))) : null;
|
|
32
32
|
});
|
|
33
|
+
exports.default = AppFab;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SessionWithDrawerWidgets } from '@jbrowse/core/util';
|
|
3
|
-
declare const
|
|
3
|
+
declare const DialogQueue: ({ session, }: {
|
|
4
4
|
session: SessionWithDrawerWidgets;
|
|
5
5
|
}) => React.JSX.Element;
|
|
6
|
-
export default
|
|
6
|
+
export default DialogQueue;
|
|
@@ -25,8 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const react_1 = __importStar(require("react"));
|
|
27
27
|
const mobx_react_1 = require("mobx-react");
|
|
28
|
-
|
|
28
|
+
const DialogQueue = (0, mobx_react_1.observer)(function ({ session, }) {
|
|
29
29
|
const { DialogComponent, DialogProps } = session;
|
|
30
30
|
return (react_1.default.createElement(react_1.default.Fragment, null, DialogComponent ? (react_1.default.createElement(react_1.Suspense, { fallback: react_1.default.createElement(react_1.default.Fragment, null) },
|
|
31
31
|
react_1.default.createElement(DialogComponent, { ...DialogProps }))) : null));
|
|
32
32
|
});
|
|
33
|
+
exports.default = DialogQueue;
|
package/dist/ui/App/Drawer.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
declare
|
|
2
|
+
import { SessionWithFocusedViewAndDrawerWidgets } from '@jbrowse/core/util/types';
|
|
3
|
+
declare const Drawer: ({ children, session, }: {
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
-
session:
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
export default _default;
|
|
5
|
+
session: SessionWithFocusedViewAndDrawerWidgets;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
export default Drawer;
|
package/dist/ui/App/Drawer.js
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 =
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
7
30
|
const material_1 = require("@mui/material");
|
|
8
31
|
const mui_1 = require("tss-react/mui");
|
|
9
32
|
const mobx_react_1 = require("mobx-react");
|
|
@@ -23,12 +46,33 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
|
23
46
|
zIndex: theme.zIndex.drawer + 1,
|
|
24
47
|
},
|
|
25
48
|
}));
|
|
26
|
-
|
|
49
|
+
const Drawer = (0, mobx_react_1.observer)(function ({ children, session, }) {
|
|
27
50
|
const { drawerPosition, drawerWidth } = session;
|
|
28
51
|
const { classes } = useStyles();
|
|
29
|
-
|
|
52
|
+
const ref = (0, react_1.useRef)(null);
|
|
53
|
+
(0, react_1.useEffect)(() => {
|
|
54
|
+
function handleSelectView(e) {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
if (e.target instanceof Element) {
|
|
57
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(e.target)) {
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
const visibleWidgetId = (_b = (_a = session.visibleWidget) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.id;
|
|
60
|
+
if (visibleWidgetId) {
|
|
61
|
+
session.setFocusedViewId(visibleWidgetId);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
document.addEventListener('mousedown', handleSelectView);
|
|
67
|
+
document.addEventListener('keydown', handleSelectView);
|
|
68
|
+
return () => {
|
|
69
|
+
document.removeEventListener('mousedown', handleSelectView);
|
|
70
|
+
document.removeEventListener('keydown', handleSelectView);
|
|
71
|
+
};
|
|
72
|
+
}, [ref, session]);
|
|
73
|
+
return (react_1.default.createElement(material_1.Paper, { ref: ref, className: classes.paper, elevation: 16, square: true },
|
|
30
74
|
drawerPosition === 'right' ? (react_1.default.createElement(ResizeHandle_1.default, { onDrag: session.resizeDrawer, className: classes.resizeHandle, vertical: true })) : null,
|
|
31
75
|
children,
|
|
32
76
|
drawerPosition === 'left' ? (react_1.default.createElement(ResizeHandle_1.default, { onDrag: session.resizeDrawer, className: classes.resizeHandle, style: { left: drawerWidth }, vertical: true })) : null));
|
|
33
|
-
}
|
|
34
|
-
exports.default =
|
|
77
|
+
});
|
|
78
|
+
exports.default = Drawer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
declare const
|
|
4
|
-
session:
|
|
2
|
+
import { SessionWithFocusedViewAndDrawerWidgets } from '@jbrowse/core/util/types';
|
|
3
|
+
declare const DrawerHeader: ({ session, setToolbarHeight, }: {
|
|
4
|
+
session: SessionWithFocusedViewAndDrawerWidgets;
|
|
5
5
|
setToolbarHeight: (arg: number) => void;
|
|
6
6
|
}) => React.JSX.Element;
|
|
7
|
-
export default
|
|
7
|
+
export default DrawerHeader;
|
|
@@ -50,13 +50,22 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
|
50
50
|
dropDownIcon: {
|
|
51
51
|
color: theme.palette.secondary.contrastText,
|
|
52
52
|
},
|
|
53
|
-
|
|
53
|
+
headerFocused: {
|
|
54
54
|
background: theme.palette.secondary.main,
|
|
55
55
|
},
|
|
56
|
+
headerUnfocused: {
|
|
57
|
+
background: theme.palette.secondary.dark,
|
|
58
|
+
},
|
|
56
59
|
}));
|
|
57
|
-
|
|
60
|
+
const DrawerHeader = (0, mobx_react_1.observer)(function ({ session, setToolbarHeight, }) {
|
|
61
|
+
var _a, _b;
|
|
58
62
|
const { classes } = useStyles();
|
|
59
|
-
|
|
63
|
+
const focusedViewId = session.focusedViewId;
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
const viewWidgetId = (_b = (_a = session.visibleWidget) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.id;
|
|
66
|
+
return (react_1.default.createElement(material_1.AppBar, { position: "sticky", className: focusedViewId === viewWidgetId
|
|
67
|
+
? classes.headerFocused
|
|
68
|
+
: classes.headerUnfocused, ref: ref => setToolbarHeight((ref === null || ref === void 0 ? void 0 : ref.getBoundingClientRect().height) || 0) },
|
|
60
69
|
react_1.default.createElement(material_1.Toolbar, { disableGutters: true },
|
|
61
70
|
react_1.default.createElement(DrawerWidgetSelector, { session: session }),
|
|
62
71
|
react_1.default.createElement("div", { className: classes.spacer }),
|
|
@@ -112,3 +121,4 @@ const DrawerControls = (0, mobx_react_1.observer)(function ({ session, }) {
|
|
|
112
121
|
setAnchorEl(null);
|
|
113
122
|
} }, option))))));
|
|
114
123
|
});
|
|
124
|
+
exports.default = DrawerHeader;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SessionWithFocusedViewAndDrawerWidgets } from '@jbrowse/core/util/types';
|
|
3
3
|
declare const DrawerWidget: ({ session, }: {
|
|
4
|
-
session:
|
|
4
|
+
session: SessionWithFocusedViewAndDrawerWidgets;
|
|
5
5
|
}) => React.JSX.Element;
|
|
6
6
|
export default DrawerWidget;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
|
-
declare const
|
|
3
|
+
declare const ViewContainer: ({ view, onClose, onMinimize, children, }: {
|
|
4
4
|
view: IBaseViewModel;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
onMinimize: () => void;
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
}) => React.JSX.Element;
|
|
9
|
-
export default
|
|
9
|
+
export default ViewContainer;
|
|
@@ -31,6 +31,7 @@ const material_1 = require("@mui/material");
|
|
|
31
31
|
const mui_1 = require("tss-react/mui");
|
|
32
32
|
const mobx_react_1 = require("mobx-react");
|
|
33
33
|
const util_1 = require("@jbrowse/core/util");
|
|
34
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
34
35
|
// icons
|
|
35
36
|
const Close_1 = __importDefault(require("@mui/icons-material/Close"));
|
|
36
37
|
const Minimize_1 = __importDefault(require("@mui/icons-material/Minimize"));
|
|
@@ -41,7 +42,6 @@ const ViewContainerTitle_1 = __importDefault(require("./ViewContainerTitle"));
|
|
|
41
42
|
const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
42
43
|
viewContainer: {
|
|
43
44
|
overflow: 'hidden',
|
|
44
|
-
background: theme.palette.secondary.main,
|
|
45
45
|
margin: theme.spacing(0.5),
|
|
46
46
|
padding: `0 ${theme.spacing(1)} ${theme.spacing(1)}`,
|
|
47
47
|
},
|
|
@@ -51,19 +51,43 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
|
51
51
|
grow: {
|
|
52
52
|
flexGrow: 1,
|
|
53
53
|
},
|
|
54
|
+
focusedView: {
|
|
55
|
+
background: theme.palette.secondary.main,
|
|
56
|
+
},
|
|
57
|
+
unfocusedView: {
|
|
58
|
+
background: theme.palette.secondary.dark,
|
|
59
|
+
},
|
|
54
60
|
}));
|
|
55
|
-
|
|
61
|
+
const ViewContainer = (0, mobx_react_1.observer)(function ({ view, onClose, onMinimize, children, }) {
|
|
56
62
|
const { classes } = useStyles();
|
|
57
63
|
const theme = (0, material_1.useTheme)();
|
|
58
64
|
const ref = (0, util_1.useWidthSetter)(view, theme.spacing(1));
|
|
59
65
|
const scrollRef = (0, react_1.useRef)(null);
|
|
66
|
+
const session = (0, util_1.getSession)(view);
|
|
60
67
|
// scroll the view into view when first mounted. note: this effect will run
|
|
61
68
|
// only once, because of the empty array second param
|
|
62
69
|
(0, react_1.useEffect)(() => {
|
|
63
70
|
var _a, _b;
|
|
64
71
|
(_b = (_a = scrollRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a, { block: 'center' });
|
|
65
72
|
}, []);
|
|
66
|
-
|
|
73
|
+
(0, react_1.useEffect)(() => {
|
|
74
|
+
function handleSelectView(e) {
|
|
75
|
+
if (e.target instanceof Element) {
|
|
76
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(e.target)) {
|
|
77
|
+
session.setFocusedViewId(view.id);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
document.addEventListener('mousedown', handleSelectView);
|
|
82
|
+
document.addEventListener('keydown', handleSelectView);
|
|
83
|
+
return () => {
|
|
84
|
+
document.removeEventListener('mousedown', handleSelectView);
|
|
85
|
+
document.removeEventListener('keydown', handleSelectView);
|
|
86
|
+
};
|
|
87
|
+
}, [ref, session, view]);
|
|
88
|
+
return (react_1.default.createElement(material_1.Paper, { ref: ref, elevation: 12, className: (0, clsx_1.default)(classes.viewContainer, session.focusedViewId === view.id
|
|
89
|
+
? classes.focusedView
|
|
90
|
+
: classes.unfocusedView) },
|
|
67
91
|
react_1.default.createElement("div", { ref: scrollRef, style: { display: 'flex' } },
|
|
68
92
|
react_1.default.createElement(ViewMenu_1.default, { model: view, IconProps: { className: classes.icon } }),
|
|
69
93
|
react_1.default.createElement("div", { className: classes.grow }),
|
|
@@ -74,3 +98,4 @@ exports.default = (0, mobx_react_1.observer)(function ({ view, onClose, onMinimi
|
|
|
74
98
|
react_1.default.createElement(Close_1.default, { className: classes.icon, fontSize: "small" }))),
|
|
75
99
|
react_1.default.createElement(material_1.Paper, null, children)));
|
|
76
100
|
});
|
|
101
|
+
exports.default = ViewContainer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes';
|
|
3
|
-
declare const
|
|
3
|
+
declare const ViewContainerTitle: ({ view, }: {
|
|
4
4
|
view: IBaseViewModel;
|
|
5
5
|
}) => React.JSX.Element;
|
|
6
|
-
export default
|
|
6
|
+
export default ViewContainerTitle;
|
|
@@ -27,7 +27,7 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
|
27
27
|
backgroundColor: theme.palette.secondary.light,
|
|
28
28
|
},
|
|
29
29
|
}));
|
|
30
|
-
|
|
30
|
+
const ViewContainerTitle = (0, mobx_react_1.observer)(function ({ view, }) {
|
|
31
31
|
var _a;
|
|
32
32
|
const { classes } = useStyles();
|
|
33
33
|
return (react_1.default.createElement(material_1.Tooltip, { title: "Rename view", arrow: true },
|
|
@@ -40,3 +40,4 @@ exports.default = (0, mobx_react_1.observer)(function ViewContainerTitle({ view,
|
|
|
40
40
|
inputFocused: classes.inputFocused,
|
|
41
41
|
} })));
|
|
42
42
|
});
|
|
43
|
+
exports.default = ViewContainerTitle;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SvgIconProps, IconButtonProps as IconButtonPropsType } from '@mui/material';
|
|
3
3
|
import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
4
|
-
declare const ViewMenu: ({ model,
|
|
4
|
+
declare const ViewMenu: ({ model, IconProps, }: {
|
|
5
5
|
model: IBaseViewModel;
|
|
6
6
|
IconButtonProps?: IconButtonPropsType | undefined;
|
|
7
7
|
IconProps: SvgIconProps;
|
package/dist/ui/App/ViewMenu.js
CHANGED
|
@@ -11,7 +11,7 @@ const CascadingMenuButton_1 = __importDefault(require("@jbrowse/core/ui/Cascadin
|
|
|
11
11
|
const Menu_1 = __importDefault(require("@mui/icons-material/Menu"));
|
|
12
12
|
const ArrowDownward_1 = __importDefault(require("@mui/icons-material/ArrowDownward"));
|
|
13
13
|
const ArrowUpward_1 = __importDefault(require("@mui/icons-material/ArrowUpward"));
|
|
14
|
-
const ViewMenu = (0, mobx_react_1.observer)(function ({ model,
|
|
14
|
+
const ViewMenu = (0, mobx_react_1.observer)(function ({ model, IconProps, }) {
|
|
15
15
|
const { menuItems } = model;
|
|
16
16
|
const session = (0, util_1.getSession)(model);
|
|
17
17
|
const items = [
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #stateModel AppFocusMixin
|
|
3
|
+
* #category session
|
|
4
|
+
*/
|
|
5
|
+
export declare function AppFocusMixin(): import("mobx-state-tree").IModelType<{
|
|
6
|
+
/**
|
|
7
|
+
* #property
|
|
8
|
+
* used to keep track of which view is in focus
|
|
9
|
+
*/
|
|
10
|
+
focusedViewId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
11
|
+
}, {
|
|
12
|
+
setFocusedViewId(viewId: string): void;
|
|
13
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { types } from 'mobx-state-tree';
|
|
2
|
+
/**
|
|
3
|
+
* #stateModel AppFocusMixin
|
|
4
|
+
* #category session
|
|
5
|
+
*/
|
|
6
|
+
export function AppFocusMixin() {
|
|
7
|
+
return types
|
|
8
|
+
.model({
|
|
9
|
+
/**
|
|
10
|
+
* #property
|
|
11
|
+
* used to keep track of which view is in focus
|
|
12
|
+
*/
|
|
13
|
+
focusedViewId: types.maybe(types.string),
|
|
14
|
+
})
|
|
15
|
+
.actions(self => ({
|
|
16
|
+
setFocusedViewId(viewId) {
|
|
17
|
+
self.focusedViewId = viewId;
|
|
18
|
+
},
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
@@ -15,7 +15,9 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
|
|
|
15
15
|
defaultValue: string;
|
|
16
16
|
};
|
|
17
17
|
drivers: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IMapType<import("mobx-state-tree").ITypeUnion<import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<Record<string, any>>> | undefined, import("mobx-state-tree").ModelSnapshotType<Record<string, any>>, (Partial<import("mobx-state-tree/dist/internal").ExtractCFromProps<Record<string, any>>> & import("mobx-state-tree/dist/internal").NonEmptyObject) | undefined>>, [undefined]>;
|
|
18
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
18
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>; /**
|
|
19
|
+
* #getter
|
|
20
|
+
*/
|
|
19
21
|
highResolutionScaling: {
|
|
20
22
|
type: string;
|
|
21
23
|
defaultValue: number;
|
|
@@ -29,16 +31,12 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
|
|
|
29
31
|
};
|
|
30
32
|
subfeatures: {
|
|
31
33
|
type: string;
|
|
32
|
-
description: string;
|
|
33
|
-
* #getter
|
|
34
|
-
*/
|
|
34
|
+
description: string;
|
|
35
35
|
defaultValue: {};
|
|
36
36
|
contextVariable: string[];
|
|
37
37
|
};
|
|
38
38
|
depth: {
|
|
39
|
-
type: string;
|
|
40
|
-
* #getter
|
|
41
|
-
*/
|
|
39
|
+
type: string;
|
|
42
40
|
defaultValue: number;
|
|
43
41
|
description: string;
|
|
44
42
|
};
|
|
@@ -81,9 +79,7 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
|
|
|
81
79
|
};
|
|
82
80
|
topLevelCategories: {
|
|
83
81
|
type: string;
|
|
84
|
-
defaultValue: boolean;
|
|
85
|
-
* #action
|
|
86
|
-
*/
|
|
82
|
+
defaultValue: boolean;
|
|
87
83
|
};
|
|
88
84
|
subCategories: {
|
|
89
85
|
type: string;
|
|
@@ -96,9 +92,7 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
|
|
|
96
92
|
defaultValue: {};
|
|
97
93
|
};
|
|
98
94
|
extraThemes: {
|
|
99
|
-
type: string;
|
|
100
|
-
* #action
|
|
101
|
-
*/
|
|
95
|
+
type: string;
|
|
102
96
|
defaultValue: {};
|
|
103
97
|
};
|
|
104
98
|
logoPath: {
|
|
@@ -162,6 +156,10 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
|
|
|
162
156
|
* #action
|
|
163
157
|
*/
|
|
164
158
|
removePlugin(pluginDefinition: PluginDefinition): void;
|
|
159
|
+
/**
|
|
160
|
+
* #action
|
|
161
|
+
*/
|
|
162
|
+
setDefaultSessionConf(sessionConf: AnyConfigurationModel): void;
|
|
165
163
|
/**
|
|
166
164
|
* #action
|
|
167
165
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { cast, getParent } from 'mobx-state-tree';
|
|
1
|
+
import { cast, getParent, getSnapshot } from 'mobx-state-tree';
|
|
2
2
|
import { readConfObject, } from '@jbrowse/core/configuration';
|
|
3
|
+
import { toJS } from 'mobx';
|
|
3
4
|
// locals
|
|
4
5
|
import { JBrowseConfigF } from '../JBrowseConfig';
|
|
5
6
|
export function JBrowseModelF({ pluginManager, assemblyConfigSchema, }) {
|
|
@@ -106,6 +107,20 @@ export function JBrowseModelF({ pluginManager, assemblyConfigSchema, }) {
|
|
|
106
107
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
108
|
getParent(self).setPluginsUpdated(true);
|
|
108
109
|
},
|
|
110
|
+
/**
|
|
111
|
+
* #action
|
|
112
|
+
*/
|
|
113
|
+
setDefaultSessionConf(sessionConf) {
|
|
114
|
+
const newDefault =
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
116
|
+
getParent(self).session.name === sessionConf.name
|
|
117
|
+
? getSnapshot(sessionConf)
|
|
118
|
+
: toJS(sessionConf);
|
|
119
|
+
if (!newDefault.name) {
|
|
120
|
+
throw new Error(`unable to set default session to ${newDefault.name}`);
|
|
121
|
+
}
|
|
122
|
+
self.defaultSession = cast(newDefault);
|
|
123
|
+
},
|
|
109
124
|
/**
|
|
110
125
|
* #action
|
|
111
126
|
*/
|
package/esm/index.d.ts
CHANGED
package/esm/index.js
CHANGED
package/esm/ui/App/App.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SessionWithFocusedViewAndDrawerWidgets } from '@jbrowse/core/util';
|
|
3
3
|
import { SnackbarMessage } from '@jbrowse/core/ui/SnackbarModel';
|
|
4
4
|
import { MenuItem as JBMenuItem } from '@jbrowse/core/ui/Menu';
|
|
5
|
-
|
|
5
|
+
interface Props {
|
|
6
6
|
HeaderButtons?: React.ReactElement;
|
|
7
|
-
session:
|
|
7
|
+
session: SessionWithFocusedViewAndDrawerWidgets & {
|
|
8
8
|
savedSessionNames: string[];
|
|
9
9
|
menus: {
|
|
10
10
|
label: string;
|
|
@@ -14,6 +14,6 @@ type Props = {
|
|
|
14
14
|
snackbarMessages: SnackbarMessage[];
|
|
15
15
|
popSnackbarMessage: () => unknown;
|
|
16
16
|
};
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
18
|
declare const App: (props: Props) => React.JSX.Element;
|
|
19
19
|
export { App };
|
package/esm/ui/App/AppFab.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SessionWithDrawerWidgets } from '@jbrowse/core/util';
|
|
3
|
-
declare const
|
|
3
|
+
declare const AppFab: ({ session, }: {
|
|
4
4
|
session: SessionWithDrawerWidgets;
|
|
5
5
|
}) => React.JSX.Element | null;
|
|
6
|
-
export default
|
|
6
|
+
export default AppFab;
|
package/esm/ui/App/AppFab.js
CHANGED
|
@@ -18,10 +18,11 @@ const useStyles = makeStyles()(theme => ({
|
|
|
18
18
|
right: theme.spacing(2),
|
|
19
19
|
},
|
|
20
20
|
}));
|
|
21
|
-
|
|
21
|
+
const AppFab = observer(function ({ session, }) {
|
|
22
22
|
const { minimized, activeWidgets, drawerPosition } = session;
|
|
23
23
|
const { classes } = useStyles();
|
|
24
24
|
return activeWidgets.size > 0 && minimized ? (React.createElement(Tooltip, { title: "Open drawer widget" },
|
|
25
25
|
React.createElement(Fab, { className: drawerPosition === 'right' ? classes.right : classes.left, color: "primary", "data-testid": "drawer-maximize", onClick: () => session.showWidgetDrawer() },
|
|
26
26
|
React.createElement(LaunchIcon, null)))) : null;
|
|
27
27
|
});
|
|
28
|
+
export default AppFab;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SessionWithDrawerWidgets } from '@jbrowse/core/util';
|
|
3
|
-
declare const
|
|
3
|
+
declare const DialogQueue: ({ session, }: {
|
|
4
4
|
session: SessionWithDrawerWidgets;
|
|
5
5
|
}) => React.JSX.Element;
|
|
6
|
-
export default
|
|
6
|
+
export default DialogQueue;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { Suspense } from 'react';
|
|
2
2
|
import { observer } from 'mobx-react';
|
|
3
|
-
|
|
3
|
+
const DialogQueue = observer(function ({ session, }) {
|
|
4
4
|
const { DialogComponent, DialogProps } = session;
|
|
5
5
|
return (React.createElement(React.Fragment, null, DialogComponent ? (React.createElement(Suspense, { fallback: React.createElement(React.Fragment, null) },
|
|
6
6
|
React.createElement(DialogComponent, { ...DialogProps }))) : null));
|
|
7
7
|
});
|
|
8
|
+
export default DialogQueue;
|
package/esm/ui/App/Drawer.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
declare
|
|
2
|
+
import { SessionWithFocusedViewAndDrawerWidgets } from '@jbrowse/core/util/types';
|
|
3
|
+
declare const Drawer: ({ children, session, }: {
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
-
session:
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
export default _default;
|
|
5
|
+
session: SessionWithFocusedViewAndDrawerWidgets;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
export default Drawer;
|
package/esm/ui/App/Drawer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { Paper } from '@mui/material';
|
|
3
3
|
import { makeStyles } from 'tss-react/mui';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
@@ -18,12 +18,33 @@ const useStyles = makeStyles()(theme => ({
|
|
|
18
18
|
zIndex: theme.zIndex.drawer + 1,
|
|
19
19
|
},
|
|
20
20
|
}));
|
|
21
|
-
|
|
21
|
+
const Drawer = observer(function ({ children, session, }) {
|
|
22
22
|
const { drawerPosition, drawerWidth } = session;
|
|
23
23
|
const { classes } = useStyles();
|
|
24
|
-
|
|
24
|
+
const ref = useRef(null);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
function handleSelectView(e) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
if (e.target instanceof Element) {
|
|
29
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(e.target)) {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
const visibleWidgetId = (_b = (_a = session.visibleWidget) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.id;
|
|
32
|
+
if (visibleWidgetId) {
|
|
33
|
+
session.setFocusedViewId(visibleWidgetId);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
document.addEventListener('mousedown', handleSelectView);
|
|
39
|
+
document.addEventListener('keydown', handleSelectView);
|
|
40
|
+
return () => {
|
|
41
|
+
document.removeEventListener('mousedown', handleSelectView);
|
|
42
|
+
document.removeEventListener('keydown', handleSelectView);
|
|
43
|
+
};
|
|
44
|
+
}, [ref, session]);
|
|
45
|
+
return (React.createElement(Paper, { ref: ref, className: classes.paper, elevation: 16, square: true },
|
|
25
46
|
drawerPosition === 'right' ? (React.createElement(ResizeHandle, { onDrag: session.resizeDrawer, className: classes.resizeHandle, vertical: true })) : null,
|
|
26
47
|
children,
|
|
27
48
|
drawerPosition === 'left' ? (React.createElement(ResizeHandle, { onDrag: session.resizeDrawer, className: classes.resizeHandle, style: { left: drawerWidth }, vertical: true })) : null));
|
|
28
|
-
}
|
|
29
|
-
export default
|
|
49
|
+
});
|
|
50
|
+
export default Drawer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
declare const
|
|
4
|
-
session:
|
|
2
|
+
import { SessionWithFocusedViewAndDrawerWidgets } from '@jbrowse/core/util/types';
|
|
3
|
+
declare const DrawerHeader: ({ session, setToolbarHeight, }: {
|
|
4
|
+
session: SessionWithFocusedViewAndDrawerWidgets;
|
|
5
5
|
setToolbarHeight: (arg: number) => void;
|
|
6
6
|
}) => React.JSX.Element;
|
|
7
|
-
export default
|
|
7
|
+
export default DrawerHeader;
|
|
@@ -22,13 +22,22 @@ const useStyles = makeStyles()(theme => ({
|
|
|
22
22
|
dropDownIcon: {
|
|
23
23
|
color: theme.palette.secondary.contrastText,
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
headerFocused: {
|
|
26
26
|
background: theme.palette.secondary.main,
|
|
27
27
|
},
|
|
28
|
+
headerUnfocused: {
|
|
29
|
+
background: theme.palette.secondary.dark,
|
|
30
|
+
},
|
|
28
31
|
}));
|
|
29
|
-
|
|
32
|
+
const DrawerHeader = observer(function ({ session, setToolbarHeight, }) {
|
|
33
|
+
var _a, _b;
|
|
30
34
|
const { classes } = useStyles();
|
|
31
|
-
|
|
35
|
+
const focusedViewId = session.focusedViewId;
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
const viewWidgetId = (_b = (_a = session.visibleWidget) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.id;
|
|
38
|
+
return (React.createElement(AppBar, { position: "sticky", className: focusedViewId === viewWidgetId
|
|
39
|
+
? classes.headerFocused
|
|
40
|
+
: classes.headerUnfocused, ref: ref => setToolbarHeight((ref === null || ref === void 0 ? void 0 : ref.getBoundingClientRect().height) || 0) },
|
|
32
41
|
React.createElement(Toolbar, { disableGutters: true },
|
|
33
42
|
React.createElement(DrawerWidgetSelector, { session: session }),
|
|
34
43
|
React.createElement("div", { className: classes.spacer }),
|
|
@@ -84,3 +93,4 @@ const DrawerControls = observer(function ({ session, }) {
|
|
|
84
93
|
setAnchorEl(null);
|
|
85
94
|
} }, option))))));
|
|
86
95
|
});
|
|
96
|
+
export default DrawerHeader;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SessionWithFocusedViewAndDrawerWidgets } from '@jbrowse/core/util/types';
|
|
3
3
|
declare const DrawerWidget: ({ session, }: {
|
|
4
|
-
session:
|
|
4
|
+
session: SessionWithFocusedViewAndDrawerWidgets;
|
|
5
5
|
}) => React.JSX.Element;
|
|
6
6
|
export default DrawerWidget;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
|
-
declare const
|
|
3
|
+
declare const ViewContainer: ({ view, onClose, onMinimize, children, }: {
|
|
4
4
|
view: IBaseViewModel;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
onMinimize: () => void;
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
}) => React.JSX.Element;
|
|
9
|
-
export default
|
|
9
|
+
export default ViewContainer;
|
|
@@ -2,7 +2,8 @@ import React, { useEffect, useRef } from 'react';
|
|
|
2
2
|
import { IconButton, Paper, useTheme } from '@mui/material';
|
|
3
3
|
import { makeStyles } from 'tss-react/mui';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
|
-
import { useWidthSetter } from '@jbrowse/core/util';
|
|
5
|
+
import { getSession, useWidthSetter } from '@jbrowse/core/util';
|
|
6
|
+
import clsx from 'clsx';
|
|
6
7
|
// icons
|
|
7
8
|
import CloseIcon from '@mui/icons-material/Close';
|
|
8
9
|
import MinimizeIcon from '@mui/icons-material/Minimize';
|
|
@@ -13,7 +14,6 @@ import ViewContainerTitle from './ViewContainerTitle';
|
|
|
13
14
|
const useStyles = makeStyles()(theme => ({
|
|
14
15
|
viewContainer: {
|
|
15
16
|
overflow: 'hidden',
|
|
16
|
-
background: theme.palette.secondary.main,
|
|
17
17
|
margin: theme.spacing(0.5),
|
|
18
18
|
padding: `0 ${theme.spacing(1)} ${theme.spacing(1)}`,
|
|
19
19
|
},
|
|
@@ -23,19 +23,43 @@ const useStyles = makeStyles()(theme => ({
|
|
|
23
23
|
grow: {
|
|
24
24
|
flexGrow: 1,
|
|
25
25
|
},
|
|
26
|
+
focusedView: {
|
|
27
|
+
background: theme.palette.secondary.main,
|
|
28
|
+
},
|
|
29
|
+
unfocusedView: {
|
|
30
|
+
background: theme.palette.secondary.dark,
|
|
31
|
+
},
|
|
26
32
|
}));
|
|
27
|
-
|
|
33
|
+
const ViewContainer = observer(function ({ view, onClose, onMinimize, children, }) {
|
|
28
34
|
const { classes } = useStyles();
|
|
29
35
|
const theme = useTheme();
|
|
30
36
|
const ref = useWidthSetter(view, theme.spacing(1));
|
|
31
37
|
const scrollRef = useRef(null);
|
|
38
|
+
const session = getSession(view);
|
|
32
39
|
// scroll the view into view when first mounted. note: this effect will run
|
|
33
40
|
// only once, because of the empty array second param
|
|
34
41
|
useEffect(() => {
|
|
35
42
|
var _a, _b;
|
|
36
43
|
(_b = (_a = scrollRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a, { block: 'center' });
|
|
37
44
|
}, []);
|
|
38
|
-
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
function handleSelectView(e) {
|
|
47
|
+
if (e.target instanceof Element) {
|
|
48
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(e.target)) {
|
|
49
|
+
session.setFocusedViewId(view.id);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
document.addEventListener('mousedown', handleSelectView);
|
|
54
|
+
document.addEventListener('keydown', handleSelectView);
|
|
55
|
+
return () => {
|
|
56
|
+
document.removeEventListener('mousedown', handleSelectView);
|
|
57
|
+
document.removeEventListener('keydown', handleSelectView);
|
|
58
|
+
};
|
|
59
|
+
}, [ref, session, view]);
|
|
60
|
+
return (React.createElement(Paper, { ref: ref, elevation: 12, className: clsx(classes.viewContainer, session.focusedViewId === view.id
|
|
61
|
+
? classes.focusedView
|
|
62
|
+
: classes.unfocusedView) },
|
|
39
63
|
React.createElement("div", { ref: scrollRef, style: { display: 'flex' } },
|
|
40
64
|
React.createElement(ViewMenu, { model: view, IconProps: { className: classes.icon } }),
|
|
41
65
|
React.createElement("div", { className: classes.grow }),
|
|
@@ -46,3 +70,4 @@ export default observer(function ({ view, onClose, onMinimize, children, }) {
|
|
|
46
70
|
React.createElement(CloseIcon, { className: classes.icon, fontSize: "small" }))),
|
|
47
71
|
React.createElement(Paper, null, children)));
|
|
48
72
|
});
|
|
73
|
+
export default ViewContainer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes';
|
|
3
|
-
declare const
|
|
3
|
+
declare const ViewContainerTitle: ({ view, }: {
|
|
4
4
|
view: IBaseViewModel;
|
|
5
5
|
}) => React.JSX.Element;
|
|
6
|
-
export default
|
|
6
|
+
export default ViewContainerTitle;
|
|
@@ -22,7 +22,7 @@ const useStyles = makeStyles()(theme => ({
|
|
|
22
22
|
backgroundColor: theme.palette.secondary.light,
|
|
23
23
|
},
|
|
24
24
|
}));
|
|
25
|
-
|
|
25
|
+
const ViewContainerTitle = observer(function ({ view, }) {
|
|
26
26
|
var _a;
|
|
27
27
|
const { classes } = useStyles();
|
|
28
28
|
return (React.createElement(Tooltip, { title: "Rename view", arrow: true },
|
|
@@ -35,3 +35,4 @@ export default observer(function ViewContainerTitle({ view, }) {
|
|
|
35
35
|
inputFocused: classes.inputFocused,
|
|
36
36
|
} })));
|
|
37
37
|
});
|
|
38
|
+
export default ViewContainerTitle;
|
package/esm/ui/App/ViewMenu.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SvgIconProps, IconButtonProps as IconButtonPropsType } from '@mui/material';
|
|
3
3
|
import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
4
|
-
declare const ViewMenu: ({ model,
|
|
4
|
+
declare const ViewMenu: ({ model, IconProps, }: {
|
|
5
5
|
model: IBaseViewModel;
|
|
6
6
|
IconButtonProps?: IconButtonPropsType | undefined;
|
|
7
7
|
IconProps: SvgIconProps;
|
package/esm/ui/App/ViewMenu.js
CHANGED
|
@@ -6,7 +6,7 @@ import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton';
|
|
|
6
6
|
import MenuIcon from '@mui/icons-material/Menu';
|
|
7
7
|
import ArrowDownward from '@mui/icons-material/ArrowDownward';
|
|
8
8
|
import ArrowUpward from '@mui/icons-material/ArrowUpward';
|
|
9
|
-
const ViewMenu = observer(function ({ model,
|
|
9
|
+
const ViewMenu = observer(function ({ model, IconProps, }) {
|
|
10
10
|
const { menuItems } = model;
|
|
11
11
|
const session = getSession(model);
|
|
12
12
|
const items = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/app-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "JBrowse 2 code shared between the 'full featured' apps e.g. jbrowse-web and jbrowse-desktop",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -42,24 +42,24 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@babel/runtime": "^7.16.3",
|
|
45
|
-
"@jbrowse/product-core": "^2.
|
|
45
|
+
"@jbrowse/product-core": "^2.7.1",
|
|
46
46
|
"@mui/icons-material": "^5.0.0",
|
|
47
47
|
"@mui/material": "^5.10.17",
|
|
48
|
+
"clsx": "^2.0.0",
|
|
48
49
|
"copy-to-clipboard": "^3.3.1",
|
|
49
|
-
"react-error-boundary": "^4.0.3"
|
|
50
|
-
"shortid": "^2.2.15"
|
|
50
|
+
"react-error-boundary": "^4.0.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"mobx": "^6.0.0",
|
|
54
|
-
"mobx-react": "^
|
|
54
|
+
"mobx-react": "^9.0.0",
|
|
55
55
|
"mobx-state-tree": "^5.0.0",
|
|
56
|
-
"react": "
|
|
57
|
-
"react-dom": "
|
|
56
|
+
"react": ">=17.0.0",
|
|
57
|
+
"react-dom": ">=17.0.0",
|
|
58
58
|
"rxjs": "^7.0.0",
|
|
59
59
|
"tss-react": "^4.0.0"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "2cda1611eebd12517f2a3cfc1b612face27005d4"
|
|
65
65
|
}
|