@jbrowse/app-core 2.6.2 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/AppFocus/index.d.ts +13 -0
  2. package/dist/AppFocus/index.js +24 -0
  3. package/dist/HistoryManagement/index.js +5 -2
  4. package/dist/JBrowseConfig/index.d.ts +29 -18
  5. package/dist/JBrowseConfig/index.js +8 -47
  6. package/dist/JBrowseModel/index.d.ts +34 -7
  7. package/dist/JBrowseModel/index.js +15 -0
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.js +1 -0
  10. package/dist/ui/App/App.d.ts +4 -4
  11. package/dist/ui/App/AppFab.d.ts +2 -2
  12. package/dist/ui/App/AppFab.js +2 -1
  13. package/dist/ui/App/DialogQueue.d.ts +2 -2
  14. package/dist/ui/App/DialogQueue.js +2 -1
  15. package/dist/ui/App/Drawer.d.ts +5 -6
  16. package/dist/ui/App/Drawer.js +49 -5
  17. package/dist/ui/App/DrawerHeader.d.ts +7 -0
  18. package/dist/ui/App/DrawerHeader.js +124 -0
  19. package/dist/ui/App/DrawerWidget.d.ts +2 -2
  20. package/dist/ui/App/DrawerWidget.js +2 -76
  21. package/dist/ui/App/ViewContainer.d.ts +2 -2
  22. package/dist/ui/App/ViewContainer.js +28 -3
  23. package/dist/ui/App/ViewContainerTitle.d.ts +2 -2
  24. package/dist/ui/App/ViewContainerTitle.js +2 -1
  25. package/dist/ui/App/ViewMenu.d.ts +1 -1
  26. package/dist/ui/App/ViewMenu.js +1 -1
  27. package/esm/AppFocus/index.d.ts +13 -0
  28. package/esm/AppFocus/index.js +20 -0
  29. package/esm/HistoryManagement/index.js +5 -2
  30. package/esm/JBrowseConfig/index.d.ts +29 -18
  31. package/esm/JBrowseConfig/index.js +8 -47
  32. package/esm/JBrowseModel/index.d.ts +34 -7
  33. package/esm/JBrowseModel/index.js +16 -1
  34. package/esm/index.d.ts +1 -0
  35. package/esm/index.js +1 -0
  36. package/esm/ui/App/App.d.ts +4 -4
  37. package/esm/ui/App/AppFab.d.ts +2 -2
  38. package/esm/ui/App/AppFab.js +2 -1
  39. package/esm/ui/App/DialogQueue.d.ts +2 -2
  40. package/esm/ui/App/DialogQueue.js +2 -1
  41. package/esm/ui/App/Drawer.d.ts +5 -6
  42. package/esm/ui/App/Drawer.js +26 -5
  43. package/esm/ui/App/DrawerHeader.d.ts +7 -0
  44. package/esm/ui/App/DrawerHeader.js +96 -0
  45. package/esm/ui/App/DrawerWidget.d.ts +2 -2
  46. package/esm/ui/App/DrawerWidget.js +1 -75
  47. package/esm/ui/App/ViewContainer.d.ts +2 -2
  48. package/esm/ui/App/ViewContainer.js +29 -4
  49. package/esm/ui/App/ViewContainerTitle.d.ts +2 -2
  50. package/esm/ui/App/ViewContainerTitle.js +2 -1
  51. package/esm/ui/App/ViewMenu.d.ts +1 -1
  52. package/esm/ui/App/ViewMenu.js +1 -1
  53. package/package.json +8 -8
@@ -28,87 +28,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const react_1 = __importStar(require("react"));
30
30
  const react_error_boundary_1 = require("react-error-boundary");
31
- const material_1 = require("@mui/material");
32
- const mui_1 = require("tss-react/mui");
33
31
  const mobx_react_1 = require("mobx-react");
34
32
  const util_1 = require("@jbrowse/core/util");
35
33
  const LoadingEllipses_1 = __importDefault(require("@jbrowse/core/ui/LoadingEllipses"));
36
34
  const ErrorMessage_1 = __importDefault(require("@jbrowse/core/ui/ErrorMessage"));
37
- // icons
38
- const Delete_1 = __importDefault(require("@mui/icons-material/Delete"));
39
- const Close_1 = __importDefault(require("@mui/icons-material/Close"));
40
- const Minimize_1 = __importDefault(require("@mui/icons-material/Minimize"));
41
- const MoreVert_1 = __importDefault(require("@mui/icons-material/MoreVert"));
42
35
  // locals
43
36
  const Drawer_1 = __importDefault(require("./Drawer"));
44
- const useStyles = (0, mui_1.makeStyles)()(theme => ({
45
- formControl: {
46
- margin: 0,
47
- },
48
- spacer: {
49
- flexGrow: 1,
50
- },
51
- drawerSelect: {
52
- margin: 0,
53
- color: theme.palette.secondary.contrastText,
54
- },
55
- dropDownIcon: {
56
- color: theme.palette.secondary.contrastText,
57
- },
58
- header: {
59
- background: theme.palette.secondary.main,
60
- },
61
- }));
62
- const DrawerHeader = (0, mobx_react_1.observer)(function ({ session, setToolbarHeight, }) {
63
- const { pluginManager } = (0, util_1.getEnv)(session);
64
- const { visibleWidget, activeWidgets, drawerPosition } = session;
65
- const { classes } = useStyles();
66
- const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
67
- return (react_1.default.createElement(material_1.AppBar, { position: "sticky", className: classes.header, ref: ref => setToolbarHeight((ref === null || ref === void 0 ? void 0 : ref.getBoundingClientRect().height) || 0) },
68
- react_1.default.createElement(material_1.Toolbar, { disableGutters: true },
69
- react_1.default.createElement(material_1.FormControl, { className: classes.formControl },
70
- react_1.default.createElement(material_1.Select, { value: visibleWidget === null || visibleWidget === void 0 ? void 0 : visibleWidget.id, "data-testid": "widget-drawer-selects", className: classes.drawerSelect, classes: { icon: classes.dropDownIcon }, renderValue: widgetId => {
71
- const widget = session.activeWidgets.get(widgetId);
72
- if (!widget) {
73
- return (react_1.default.createElement(material_1.Typography, { variant: "h6", color: "inherit" }, "Unknown widget"));
74
- }
75
- const widgetType = pluginManager.getWidgetType(widget.type);
76
- const { HeadingComponent, heading } = widgetType;
77
- return HeadingComponent ? (react_1.default.createElement(HeadingComponent, { model: widget })) : (react_1.default.createElement(material_1.Typography, { variant: "h6", color: "inherit" }, heading));
78
- }, onChange: e => {
79
- const w = session.activeWidgets.get(e.target.value);
80
- if (w) {
81
- session.showWidget(w);
82
- }
83
- else {
84
- session.notify(`Widget not found ${e.target.value}`, 'warning');
85
- }
86
- } }, [...activeWidgets.values()].map(widget => {
87
- const widgetType = pluginManager.getWidgetType(widget.type);
88
- const { HeadingComponent, heading } = widgetType;
89
- return (react_1.default.createElement(material_1.MenuItem, { "data-testid": `widget-drawer-selects-item-${widget.type}`, key: widget.id, value: widget.id },
90
- HeadingComponent ? (react_1.default.createElement(HeadingComponent, { model: widget })) : (react_1.default.createElement(material_1.Typography, { variant: "h6", color: "inherit" }, heading)),
91
- react_1.default.createElement(material_1.IconButton, { "data-testid": `${widget.type}-drawer-delete`, color: "inherit", "aria-label": "Delete", onClick: () => session.hideWidget(widget) },
92
- react_1.default.createElement(Delete_1.default, null))));
93
- }))),
94
- react_1.default.createElement("div", { className: classes.spacer }),
95
- react_1.default.createElement("div", null,
96
- react_1.default.createElement(material_1.IconButton, { "data-testid": "drawer-close", color: "inherit", onClick: event => setAnchorEl(event.currentTarget) },
97
- react_1.default.createElement(MoreVert_1.default, null)),
98
- react_1.default.createElement(material_1.Tooltip, { title: "Minimize drawer" },
99
- react_1.default.createElement(material_1.IconButton, { "data-testid": "drawer-minimize", color: "inherit", onClick: () => {
100
- session.notify(`Drawer minimized, click button on ${drawerPosition} side of screen to re-open`, 'info');
101
- session.minimizeWidgetDrawer();
102
- } },
103
- react_1.default.createElement(Minimize_1.default, null))),
104
- react_1.default.createElement(material_1.Tooltip, { title: "Close drawer" },
105
- react_1.default.createElement(material_1.IconButton, { "data-testid": "drawer-close", color: "inherit", onClick: () => session.hideWidget(visibleWidget) },
106
- react_1.default.createElement(Close_1.default, null))))),
107
- react_1.default.createElement(material_1.Menu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: () => setAnchorEl(null) }, ['left', 'right'].map(option => (react_1.default.createElement(material_1.MenuItem, { key: option, selected: drawerPosition === 'option', onClick: () => {
108
- session.setDrawerPosition(option);
109
- setAnchorEl(null);
110
- } }, option))))));
111
- });
37
+ const DrawerHeader_1 = __importDefault(require("./DrawerHeader"));
112
38
  const DrawerWidget = (0, mobx_react_1.observer)(function ({ session, }) {
113
39
  const { visibleWidget } = session;
114
40
  const { pluginManager } = (0, util_1.getEnv)(session);
@@ -123,7 +49,7 @@ const DrawerWidget = (0, mobx_react_1.observer)(function ({ session, }) {
123
49
  // (the position static/sticky is included in AutoSizer estimates)
124
50
  const [toolbarHeight, setToolbarHeight] = (0, react_1.useState)(0);
125
51
  return (react_1.default.createElement(Drawer_1.default, { session: session },
126
- react_1.default.createElement(DrawerHeader, { session: session, setToolbarHeight: setToolbarHeight }),
52
+ react_1.default.createElement(DrawerHeader_1.default, { session: session, setToolbarHeight: setToolbarHeight }),
127
53
  react_1.default.createElement(react_1.Suspense, { fallback: react_1.default.createElement(LoadingEllipses_1.default, null) },
128
54
  react_1.default.createElement(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ({ error }) => react_1.default.createElement(ErrorMessage_1.default, { error: error }) }, DrawerComponent ? (react_1.default.createElement(react_1.default.Fragment, null,
129
55
  react_1.default.createElement(DrawerComponent, { model: visibleWidget, session: session, toolbarHeight: toolbarHeight }),
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
3
- declare const _default: ({ view, onClose, onMinimize, children, }: {
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 _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
- exports.default = (0, mobx_react_1.observer)(function ({ view, onClose, onMinimize, children, }) {
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
- return (react_1.default.createElement(material_1.Paper, { ref: ref, elevation: 12, className: classes.viewContainer },
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 _default: ({ view, }: {
3
+ declare const ViewContainerTitle: ({ view, }: {
4
4
  view: IBaseViewModel;
5
5
  }) => React.JSX.Element;
6
- export default _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
- exports.default = (0, mobx_react_1.observer)(function ViewContainerTitle({ view, }) {
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, IconButtonProps, IconProps, }: {
4
+ declare const ViewMenu: ({ model, IconProps, }: {
5
5
  model: IBaseViewModel;
6
6
  IconButtonProps?: IconButtonPropsType | undefined;
7
7
  IconProps: SvgIconProps;
@@ -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, IconButtonProps, IconProps, }) {
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
+ }
@@ -17,18 +17,21 @@ export function HistoryManagementMixin() {
17
17
  .actions(self => ({
18
18
  afterCreate() {
19
19
  document.addEventListener('keydown', e => {
20
+ var _a, _b;
20
21
  if (self.history.canRedo &&
21
22
  // ctrl+shift+z or cmd+shift+z
22
23
  (((e.ctrlKey || e.metaKey) && e.shiftKey && e.code === 'KeyZ') ||
23
24
  // ctrl+y
24
- (e.ctrlKey && !e.shiftKey && e.code === 'KeyY'))) {
25
+ (e.ctrlKey && !e.shiftKey && e.code === 'KeyY')) &&
26
+ ((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.tagName.toUpperCase()) !== 'INPUT') {
25
27
  self.history.redo();
26
28
  }
27
29
  if (self.history.canUndo &&
28
30
  // ctrl+z or cmd+z
29
31
  (e.ctrlKey || e.metaKey) &&
30
32
  !e.shiftKey &&
31
- e.code === 'KeyZ') {
33
+ e.code === 'KeyZ' &&
34
+ ((_b = document.activeElement) === null || _b === void 0 ? void 0 : _b.tagName.toUpperCase()) !== 'INPUT') {
32
35
  self.history.undo();
33
36
  }
34
37
  });
@@ -17,9 +17,7 @@ export declare function JBrowseConfigF({ pluginManager, assemblyConfigSchema, }:
17
17
  rpc: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
18
18
  defaultDriver: {
19
19
  type: string;
20
- description: string; /**
21
- * #slot configuration.formatDetails.feature
22
- */
20
+ description: string;
23
21
  defaultValue: string;
24
22
  };
25
23
  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]>;
@@ -32,27 +30,18 @@ export declare function JBrowseConfigF({ pluginManager, assemblyConfigSchema, }:
32
30
  defaultValue: number;
33
31
  };
34
32
  formatDetails: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
35
- /**
36
- * #slot configuration.formatDetails.feature
37
- */
38
33
  feature: {
39
34
  type: string;
40
35
  description: string;
41
36
  defaultValue: {};
42
37
  contextVariable: string[];
43
38
  };
44
- /**
45
- * #slot configuration.formatDetails.subfeatures
46
- */
47
39
  subfeatures: {
48
40
  type: string;
49
41
  description: string;
50
42
  defaultValue: {};
51
43
  contextVariable: string[];
52
44
  };
53
- /**
54
- * #slot configuration.formatDetails.depth
55
- */
56
45
  depth: {
57
46
  type: string;
58
47
  defaultValue: number;
@@ -60,18 +49,12 @@ export declare function JBrowseConfigF({ pluginManager, assemblyConfigSchema, }:
60
49
  };
61
50
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
62
51
  formatAbout: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
63
- /**
64
- * #slot configuration.formatAbout.config
65
- */
66
52
  config: {
67
53
  type: string;
68
54
  description: string;
69
55
  defaultValue: {};
70
56
  contextVariable: string[];
71
57
  };
72
- /**
73
- * #slot configuration.formatAbout.hideUris
74
- */
75
58
  hideUris: {
76
59
  type: string;
77
60
  defaultValue: boolean;
@@ -88,6 +71,34 @@ export declare function JBrowseConfigF({ pluginManager, assemblyConfigSchema, }:
88
71
  type: string;
89
72
  defaultValue: boolean;
90
73
  };
74
+ hierarchical: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
75
+ sort: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
76
+ trackNames: {
77
+ type: string;
78
+ defaultValue: boolean;
79
+ };
80
+ categories: {
81
+ type: string;
82
+ defaultValue: boolean;
83
+ };
84
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
85
+ defaultCollapsed: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
86
+ categoryNames: {
87
+ type: string;
88
+ defaultValue: never[]; /**
89
+ * #slot configuration.highResolutionScaling
90
+ */
91
+ };
92
+ topLevelCategories: {
93
+ type: string;
94
+ defaultValue: boolean;
95
+ };
96
+ subCategories: {
97
+ type: string;
98
+ defaultValue: boolean;
99
+ };
100
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
101
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
91
102
  /**
92
103
  * #slot configuration.theme
93
104
  */
@@ -1,5 +1,6 @@
1
1
  import { ConfigurationSchema, } from '@jbrowse/core/configuration';
2
2
  import RpcManager from '@jbrowse/core/rpc/RpcManager';
3
+ import { FormatAboutConfigSchemaFactory, FormatDetailsConfigSchemaFactory, HierarchicalConfigSchemaFactory, } from '@jbrowse/product-core';
3
4
  import { types } from 'mobx-state-tree';
4
5
  /**
5
6
  * #config JBrowseRootConfig
@@ -20,52 +21,8 @@ export function JBrowseConfigF({ pluginManager, assemblyConfigSchema, }) {
20
21
  type: 'number',
21
22
  defaultValue: 2,
22
23
  },
23
- formatDetails: ConfigurationSchema('FormatDetails', {
24
- /**
25
- * #slot configuration.formatDetails.feature
26
- */
27
- feature: {
28
- type: 'frozen',
29
- description: 'adds extra fields to the feature details',
30
- defaultValue: {},
31
- contextVariable: ['feature'],
32
- },
33
- /**
34
- * #slot configuration.formatDetails.subfeatures
35
- */
36
- subfeatures: {
37
- type: 'frozen',
38
- description: 'adds extra fields to the subfeatures of a feature',
39
- defaultValue: {},
40
- contextVariable: ['feature'],
41
- },
42
- /**
43
- * #slot configuration.formatDetails.depth
44
- */
45
- depth: {
46
- type: 'number',
47
- defaultValue: 2,
48
- description: 'depth to iterate on subfeatures',
49
- },
50
- }),
51
- formatAbout: ConfigurationSchema('FormatAbout', {
52
- /**
53
- * #slot configuration.formatAbout.config
54
- */
55
- config: {
56
- type: 'frozen',
57
- description: 'formats configuration object in about dialog',
58
- defaultValue: {},
59
- contextVariable: ['config'],
60
- },
61
- /**
62
- * #slot configuration.formatAbout.hideUris
63
- */
64
- hideUris: {
65
- type: 'boolean',
66
- defaultValue: false,
67
- },
68
- }),
24
+ formatDetails: FormatDetailsConfigSchemaFactory(),
25
+ formatAbout: FormatAboutConfigSchemaFactory(),
69
26
  /*
70
27
  * #slot configuration.shareURL
71
28
  */
@@ -80,6 +37,7 @@ export function JBrowseConfigF({ pluginManager, assemblyConfigSchema, }) {
80
37
  type: 'boolean',
81
38
  defaultValue: false,
82
39
  },
40
+ hierarchical: HierarchicalConfigSchemaFactory(),
83
41
  /**
84
42
  * #slot configuration.theme
85
43
  */
@@ -90,7 +48,10 @@ export function JBrowseConfigF({ pluginManager, assemblyConfigSchema, }) {
90
48
  /**
91
49
  * #slot configuration.extraThemes
92
50
  */
93
- extraThemes: { type: 'frozen', defaultValue: {} },
51
+ extraThemes: {
52
+ type: 'frozen',
53
+ defaultValue: {},
54
+ },
94
55
  /**
95
56
  * #slot configuration.logoPath
96
57
  */
@@ -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;
@@ -59,11 +61,35 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
59
61
  type: string;
60
62
  defaultValue: boolean;
61
63
  };
64
+ hierarchical: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
65
+ sort: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
66
+ trackNames: {
67
+ type: string;
68
+ defaultValue: boolean;
69
+ };
70
+ categories: {
71
+ type: string;
72
+ defaultValue: boolean;
73
+ };
74
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
75
+ defaultCollapsed: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
76
+ categoryNames: {
77
+ type: string;
78
+ defaultValue: never[];
79
+ };
80
+ topLevelCategories: {
81
+ type: string;
82
+ defaultValue: boolean;
83
+ };
84
+ subCategories: {
85
+ type: string;
86
+ defaultValue: boolean;
87
+ };
88
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
89
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
62
90
  theme: {
63
91
  type: string;
64
- defaultValue: {}; /**
65
- * #action
66
- */
92
+ defaultValue: {};
67
93
  };
68
94
  extraThemes: {
69
95
  type: string;
@@ -71,9 +97,6 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
71
97
  };
72
98
  logoPath: {
73
99
  type: string;
74
- /**
75
- * #action
76
- */
77
100
  defaultValue: {
78
101
  uri: string;
79
102
  locationType: string;
@@ -133,6 +156,10 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
133
156
  * #action
134
157
  */
135
158
  removePlugin(pluginDefinition: PluginDefinition): void;
159
+ /**
160
+ * #action
161
+ */
162
+ setDefaultSessionConf(sessionConf: AnyConfigurationModel): void;
136
163
  /**
137
164
  * #action
138
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
@@ -1,5 +1,6 @@
1
1
  export * from './ui';
2
2
  export * from './HistoryManagement';
3
+ export * from './AppFocus';
3
4
  export * from './JBrowseConfig';
4
5
  export * from './JBrowseModel';
5
6
  export * from './Assemblies';
package/esm/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './ui';
2
2
  export * from './HistoryManagement';
3
+ export * from './AppFocus';
3
4
  export * from './JBrowseConfig';
4
5
  export * from './JBrowseModel';
5
6
  export * from './Assemblies';
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import { SessionWithDrawerWidgets } from '@jbrowse/core/util';
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
- type Props = {
5
+ interface Props {
6
6
  HeaderButtons?: React.ReactElement;
7
- session: SessionWithDrawerWidgets & {
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 };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { SessionWithDrawerWidgets } from '@jbrowse/core/util';
3
- declare const _default: ({ session, }: {
3
+ declare const AppFab: ({ session, }: {
4
4
  session: SessionWithDrawerWidgets;
5
5
  }) => React.JSX.Element | null;
6
- export default _default;
6
+ export default AppFab;
@@ -18,10 +18,11 @@ const useStyles = makeStyles()(theme => ({
18
18
  right: theme.spacing(2),
19
19
  },
20
20
  }));
21
- export default observer(function AppFab({ session, }) {
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 _default: ({ session, }: {
3
+ declare const DialogQueue: ({ session, }: {
4
4
  session: SessionWithDrawerWidgets;
5
5
  }) => React.JSX.Element;
6
- export default _default;
6
+ export default DialogQueue;
@@ -1,7 +1,8 @@
1
1
  import React, { Suspense } from 'react';
2
2
  import { observer } from 'mobx-react';
3
- export default observer(function ({ session, }) {
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;