@jbrowse/app-core 2.10.3 → 2.11.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.
@@ -13,7 +13,7 @@ type AppSession = SessionWithDrawerWidgets & {
13
13
  popSnackbarMessage: () => unknown;
14
14
  };
15
15
  declare const AppToolbar: ({ session, HeaderButtons, }: {
16
- HeaderButtons?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
16
+ HeaderButtons?: React.ReactElement;
17
17
  session: AppSession;
18
18
  }) => React.JSX.Element;
19
19
  export default AppToolbar;
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { SessionWithDrawerWidgets } from '@jbrowse/core/util';
3
3
  declare const DialogQueue: ({ session, }: {
4
4
  session: SessionWithDrawerWidgets;
5
- }) => React.JSX.Element;
5
+ }) => React.JSX.Element | null;
6
6
  export default DialogQueue;
@@ -27,7 +27,7 @@ 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
- return (react_1.default.createElement(react_1.default.Fragment, null, DialogComponent ? (react_1.default.createElement(react_1.Suspense, { fallback: null },
31
- react_1.default.createElement(DialogComponent, { ...DialogProps }))) : null));
30
+ return DialogComponent ? (react_1.default.createElement(react_1.Suspense, { fallback: null },
31
+ react_1.default.createElement(DialogComponent, { ...DialogProps }))) : null;
32
32
  });
33
33
  exports.default = DialogQueue;
@@ -35,6 +35,7 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
35
35
  paper: {
36
36
  overflowY: 'auto',
37
37
  height: '100%',
38
+ position: 'relative',
38
39
  zIndex: theme.zIndex.drawer,
39
40
  outline: 'none',
40
41
  background: theme.palette.background.default,
@@ -52,11 +53,11 @@ const Drawer = (0, mobx_react_1.observer)(function ({ children, session, }) {
52
53
  const ref = (0, react_1.useRef)(null);
53
54
  (0, react_1.useEffect)(() => {
54
55
  function handleSelectView(e) {
55
- var _a, _b;
56
+ var _a, _b, _c;
56
57
  if (e.target instanceof Element) {
57
- if ((ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(e.target)) {
58
+ if ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
58
59
  // @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
+ const visibleWidgetId = (_c = (_b = session.visibleWidget) === null || _b === void 0 ? void 0 : _b.view) === null || _c === void 0 ? void 0 : _c.id;
60
61
  if (visibleWidgetId) {
61
62
  session.setFocusedViewId(visibleWidgetId);
62
63
  }
@@ -53,8 +53,9 @@ const ViewContainer = (0, mobx_react_1.observer)(function ({ view, onClose, onMi
53
53
  const session = (0, util_1.getSession)(view);
54
54
  (0, react_1.useEffect)(() => {
55
55
  function handleSelectView(e) {
56
+ var _a;
56
57
  if (e.target instanceof Element) {
57
- if ((ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(e.target)) {
58
+ if ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
58
59
  session.setFocusedViewId(view.id);
59
60
  }
60
61
  }
@@ -3,7 +3,7 @@ import { SvgIconProps, IconButtonProps as IconButtonPropsType } from '@mui/mater
3
3
  import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
4
4
  declare const ViewMenu: ({ model, IconButtonProps, IconProps, }: {
5
5
  model: IBaseViewModel;
6
- IconButtonProps?: IconButtonPropsType | undefined;
6
+ IconButtonProps?: IconButtonPropsType;
7
7
  IconProps: SvgIconProps;
8
8
  }) => React.JSX.Element;
9
9
  export default ViewMenu;
@@ -11,8 +11,10 @@ const hooks_1 = require("material-ui-popup-state/hooks");
11
11
  const CascadingMenu_1 = __importDefault(require("@jbrowse/core/ui/CascadingMenu"));
12
12
  // icons
13
13
  const Menu_1 = __importDefault(require("@mui/icons-material/Menu"));
14
- const ArrowDownward_1 = __importDefault(require("@mui/icons-material/ArrowDownward"));
15
- const ArrowUpward_1 = __importDefault(require("@mui/icons-material/ArrowUpward"));
14
+ const KeyboardDoubleArrowDown_1 = __importDefault(require("@mui/icons-material/KeyboardDoubleArrowDown"));
15
+ const KeyboardDoubleArrowUp_1 = __importDefault(require("@mui/icons-material/KeyboardDoubleArrowUp"));
16
+ const KeyboardArrowDown_1 = __importDefault(require("@mui/icons-material/KeyboardArrowDown"));
17
+ const KeyboardArrowUp_1 = __importDefault(require("@mui/icons-material/KeyboardArrowUp"));
16
18
  const ViewMenu = (0, mobx_react_1.observer)(function ({ model, IconButtonProps, IconProps, }) {
17
19
  const { menuItems } = model;
18
20
  const session = (0, util_1.getSession)(model);
@@ -20,33 +22,49 @@ const ViewMenu = (0, mobx_react_1.observer)(function ({ model, IconButtonProps,
20
22
  popupId: 'viewMenu',
21
23
  variant: 'popover',
22
24
  });
23
- const items = [
24
- ...(session.views.length > 1
25
- ? [
26
- {
27
- label: 'Move view up',
28
- icon: ArrowUpward_1.default,
29
- onClick: () => session.moveViewUp(model.id),
30
- },
31
- {
32
- label: 'Move view down',
33
- icon: ArrowDownward_1.default,
34
- onClick: () => session.moveViewDown(model.id),
35
- },
36
- ]
37
- : []),
38
- // <=1.3.3 didn't use a function, so check as value also
39
- ...((typeof menuItems === 'function' ? menuItems() : menuItems) || []),
40
- ];
41
- // note: This does not use CascadingMenuButton on purpose, because there was a confusing bug related to it!
42
- // see https://github.com/GMOD/jbrowse-components/issues/4115
25
+ // note: This does not use CascadingMenuButton on purpose, because there was
26
+ // a confusing bug related to it! see
27
+ // https://github.com/GMOD/jbrowse-components/issues/4115
43
28
  //
44
- // Make sure to test the Breakpoint split view menu checkboxes if you intend to change this
29
+ // Make sure to test the Breakpoint split view menu checkboxes if you
30
+ // intend to change this
45
31
  return (react_1.default.createElement(react_1.default.Fragment, null,
46
32
  react_1.default.createElement(material_1.IconButton, { ...IconButtonProps, ...(0, hooks_1.bindTrigger)(popupState), "data-testid": "view_menu_icon" },
47
33
  react_1.default.createElement(Menu_1.default, { ...IconProps, fontSize: "small" })),
48
- react_1.default.createElement(CascadingMenu_1.default, { ...(0, hooks_1.bindPopover)(popupState), onMenuItemClick: (_event, callback) => {
49
- callback();
50
- }, menuItems: items, popupState: popupState })));
34
+ react_1.default.createElement(CascadingMenu_1.default, { ...(0, hooks_1.bindPopover)(popupState), onMenuItemClick: (_event, callback) => callback(), menuItems: [
35
+ ...(session.views.length > 1
36
+ ? [
37
+ {
38
+ label: 'View order',
39
+ type: 'subMenu',
40
+ subMenu: [
41
+ {
42
+ label: 'Move view to top',
43
+ icon: KeyboardDoubleArrowUp_1.default,
44
+ onClick: () => session.moveViewToTop(model.id),
45
+ },
46
+ {
47
+ label: 'Move view up',
48
+ icon: KeyboardArrowUp_1.default,
49
+ onClick: () => session.moveViewUp(model.id),
50
+ },
51
+ {
52
+ label: 'Move view down',
53
+ icon: KeyboardArrowDown_1.default,
54
+ onClick: () => session.moveViewDown(model.id),
55
+ },
56
+ {
57
+ label: 'Move view to bottom',
58
+ icon: KeyboardDoubleArrowDown_1.default,
59
+ onClick: () => session.moveViewToBottom(model.id),
60
+ },
61
+ ],
62
+ },
63
+ ]
64
+ : []),
65
+ // <=1.3.3 didn't use a function, so check as value also
66
+ ...((typeof menuItems === 'function' ? menuItems() : menuItems) ||
67
+ []),
68
+ ], popupState: popupState })));
51
69
  });
52
70
  exports.default = ViewMenu;
@@ -13,7 +13,7 @@ type AppSession = SessionWithDrawerWidgets & {
13
13
  popSnackbarMessage: () => unknown;
14
14
  };
15
15
  declare const AppToolbar: ({ session, HeaderButtons, }: {
16
- HeaderButtons?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
16
+ HeaderButtons?: React.ReactElement;
17
17
  session: AppSession;
18
18
  }) => React.JSX.Element;
19
19
  export default AppToolbar;
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { SessionWithDrawerWidgets } from '@jbrowse/core/util';
3
3
  declare const DialogQueue: ({ session, }: {
4
4
  session: SessionWithDrawerWidgets;
5
- }) => React.JSX.Element;
5
+ }) => React.JSX.Element | null;
6
6
  export default DialogQueue;
@@ -2,7 +2,7 @@ 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
- return (React.createElement(React.Fragment, null, DialogComponent ? (React.createElement(Suspense, { fallback: null },
6
- React.createElement(DialogComponent, { ...DialogProps }))) : null));
5
+ return DialogComponent ? (React.createElement(Suspense, { fallback: null },
6
+ React.createElement(DialogComponent, { ...DialogProps }))) : null;
7
7
  });
8
8
  export default DialogQueue;
@@ -7,6 +7,7 @@ const useStyles = makeStyles()(theme => ({
7
7
  paper: {
8
8
  overflowY: 'auto',
9
9
  height: '100%',
10
+ position: 'relative',
10
11
  zIndex: theme.zIndex.drawer,
11
12
  outline: 'none',
12
13
  background: theme.palette.background.default,
@@ -24,11 +25,11 @@ const Drawer = observer(function ({ children, session, }) {
24
25
  const ref = useRef(null);
25
26
  useEffect(() => {
26
27
  function handleSelectView(e) {
27
- var _a, _b;
28
+ var _a, _b, _c;
28
29
  if (e.target instanceof Element) {
29
- if ((ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(e.target)) {
30
+ if ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
30
31
  // @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
+ const visibleWidgetId = (_c = (_b = session.visibleWidget) === null || _b === void 0 ? void 0 : _b.view) === null || _c === void 0 ? void 0 : _c.id;
32
33
  if (visibleWidgetId) {
33
34
  session.setFocusedViewId(visibleWidgetId);
34
35
  }
@@ -25,8 +25,9 @@ const ViewContainer = observer(function ({ view, onClose, onMinimize, children,
25
25
  const session = getSession(view);
26
26
  useEffect(() => {
27
27
  function handleSelectView(e) {
28
+ var _a;
28
29
  if (e.target instanceof Element) {
29
- if ((ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(e.target)) {
30
+ if ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
30
31
  session.setFocusedViewId(view.id);
31
32
  }
32
33
  }
@@ -3,7 +3,7 @@ import { SvgIconProps, IconButtonProps as IconButtonPropsType } from '@mui/mater
3
3
  import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
4
4
  declare const ViewMenu: ({ model, IconButtonProps, IconProps, }: {
5
5
  model: IBaseViewModel;
6
- IconButtonProps?: IconButtonPropsType | undefined;
6
+ IconButtonProps?: IconButtonPropsType;
7
7
  IconProps: SvgIconProps;
8
8
  }) => React.JSX.Element;
9
9
  export default ViewMenu;
@@ -6,8 +6,10 @@ import { bindTrigger, bindPopover, usePopupState, } from 'material-ui-popup-stat
6
6
  import CascadingMenu from '@jbrowse/core/ui/CascadingMenu';
7
7
  // icons
8
8
  import MenuIcon from '@mui/icons-material/Menu';
9
- import ArrowDownward from '@mui/icons-material/ArrowDownward';
10
- import ArrowUpward from '@mui/icons-material/ArrowUpward';
9
+ import KeyboardDoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown';
10
+ import KeyboardDoubleArrowUpIcon from '@mui/icons-material/KeyboardDoubleArrowUp';
11
+ import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
12
+ import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
11
13
  const ViewMenu = observer(function ({ model, IconButtonProps, IconProps, }) {
12
14
  const { menuItems } = model;
13
15
  const session = getSession(model);
@@ -15,33 +17,49 @@ const ViewMenu = observer(function ({ model, IconButtonProps, IconProps, }) {
15
17
  popupId: 'viewMenu',
16
18
  variant: 'popover',
17
19
  });
18
- const items = [
19
- ...(session.views.length > 1
20
- ? [
21
- {
22
- label: 'Move view up',
23
- icon: ArrowUpward,
24
- onClick: () => session.moveViewUp(model.id),
25
- },
26
- {
27
- label: 'Move view down',
28
- icon: ArrowDownward,
29
- onClick: () => session.moveViewDown(model.id),
30
- },
31
- ]
32
- : []),
33
- // <=1.3.3 didn't use a function, so check as value also
34
- ...((typeof menuItems === 'function' ? menuItems() : menuItems) || []),
35
- ];
36
- // note: This does not use CascadingMenuButton on purpose, because there was a confusing bug related to it!
37
- // see https://github.com/GMOD/jbrowse-components/issues/4115
20
+ // note: This does not use CascadingMenuButton on purpose, because there was
21
+ // a confusing bug related to it! see
22
+ // https://github.com/GMOD/jbrowse-components/issues/4115
38
23
  //
39
- // Make sure to test the Breakpoint split view menu checkboxes if you intend to change this
24
+ // Make sure to test the Breakpoint split view menu checkboxes if you
25
+ // intend to change this
40
26
  return (React.createElement(React.Fragment, null,
41
27
  React.createElement(IconButton, { ...IconButtonProps, ...bindTrigger(popupState), "data-testid": "view_menu_icon" },
42
28
  React.createElement(MenuIcon, { ...IconProps, fontSize: "small" })),
43
- React.createElement(CascadingMenu, { ...bindPopover(popupState), onMenuItemClick: (_event, callback) => {
44
- callback();
45
- }, menuItems: items, popupState: popupState })));
29
+ React.createElement(CascadingMenu, { ...bindPopover(popupState), onMenuItemClick: (_event, callback) => callback(), menuItems: [
30
+ ...(session.views.length > 1
31
+ ? [
32
+ {
33
+ label: 'View order',
34
+ type: 'subMenu',
35
+ subMenu: [
36
+ {
37
+ label: 'Move view to top',
38
+ icon: KeyboardDoubleArrowUpIcon,
39
+ onClick: () => session.moveViewToTop(model.id),
40
+ },
41
+ {
42
+ label: 'Move view up',
43
+ icon: KeyboardArrowUpIcon,
44
+ onClick: () => session.moveViewUp(model.id),
45
+ },
46
+ {
47
+ label: 'Move view down',
48
+ icon: KeyboardArrowDownIcon,
49
+ onClick: () => session.moveViewDown(model.id),
50
+ },
51
+ {
52
+ label: 'Move view to bottom',
53
+ icon: KeyboardDoubleArrowDownIcon,
54
+ onClick: () => session.moveViewToBottom(model.id),
55
+ },
56
+ ],
57
+ },
58
+ ]
59
+ : []),
60
+ // <=1.3.3 didn't use a function, so check as value also
61
+ ...((typeof menuItems === 'function' ? menuItems() : menuItems) ||
62
+ []),
63
+ ], popupState: popupState })));
46
64
  });
47
65
  export default ViewMenu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/app-core",
3
- "version": "2.10.3",
3
+ "version": "2.11.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,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@babel/runtime": "^7.16.3",
45
- "@jbrowse/product-core": "^2.10.3",
45
+ "@jbrowse/product-core": "^2.11.1",
46
46
  "@mui/icons-material": "^5.0.0",
47
47
  "@mui/material": "^5.10.17",
48
48
  "copy-to-clipboard": "^3.3.1",
@@ -60,5 +60,5 @@
60
60
  "publishConfig": {
61
61
  "access": "public"
62
62
  },
63
- "gitHead": "c8fc800cd17decd72b2e971c7a6add3b95214e72"
63
+ "gitHead": "11b28d66d782eb06f92ccb993108bb6c3c82819e"
64
64
  }