@jbrowse/app-core 2.6.1 → 2.6.2

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.
@@ -1,64 +0,0 @@
1
- import React, { useState } from 'react'
2
- import {
3
- Button,
4
- FormControl,
5
- MenuItem,
6
- Paper,
7
- Select,
8
- Typography,
9
- } from '@mui/material'
10
- import { observer } from 'mobx-react'
11
- import { makeStyles } from 'tss-react/mui'
12
-
13
- // locals
14
- import { getEnv, SessionWithDrawerWidgets } from '@jbrowse/core/util'
15
-
16
- // ui elements
17
- import { MenuItem as JBMenuItem } from '@jbrowse/core/ui/Menu'
18
- import { SnackbarMessage } from '@jbrowse/core/ui/SnackbarModel'
19
-
20
- type AppSession = SessionWithDrawerWidgets & {
21
- savedSessionNames: string[]
22
- menus: { label: string; menuItems: JBMenuItem[] }[]
23
- renameCurrentSession: (arg: string) => void
24
- snackbarMessages: SnackbarMessage[]
25
- popSnackbarMessage: () => unknown
26
- }
27
-
28
- const useStyles = makeStyles()(theme => ({
29
- selectPaper: {
30
- padding: theme.spacing(4),
31
- },
32
- }))
33
-
34
- const ViewLauncher = observer(({ session }: { session: AppSession }) => {
35
- const { classes } = useStyles()
36
- const { pluginManager } = getEnv(session)
37
- const viewTypes = pluginManager.getElementTypeRecord('view').all()
38
- const [value, setValue] = useState(viewTypes[0]?.name)
39
- return (
40
- <Paper className={classes.selectPaper}>
41
- <Typography>Select a view to launch</Typography>
42
- <FormControl style={{ margin: 2 }}>
43
- <Select value={value} onChange={event => setValue(event.target.value)}>
44
- {viewTypes.map(({ displayName, name }) => (
45
- <MenuItem key={name} value={name}>
46
- {displayName}
47
- </MenuItem>
48
- ))}
49
- </Select>
50
- </FormControl>
51
- <FormControl style={{ margin: 2 }}>
52
- <Button
53
- onClick={() => session.addView(value, {})}
54
- variant="contained"
55
- color="primary"
56
- >
57
- Launch view
58
- </Button>
59
- </FormControl>
60
- </Paper>
61
- )
62
- })
63
-
64
- export default ViewLauncher
@@ -1,54 +0,0 @@
1
- import React from 'react'
2
- import {
3
- SvgIconProps,
4
- IconButtonProps as IconButtonPropsType,
5
- } from '@mui/material'
6
- import { observer } from 'mobx-react'
7
- import { getSession } from '@jbrowse/core/util'
8
- import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton'
9
- import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes/models'
10
-
11
- // icons
12
- import MenuIcon from '@mui/icons-material/Menu'
13
- import ArrowDownward from '@mui/icons-material/ArrowDownward'
14
- import ArrowUpward from '@mui/icons-material/ArrowUpward'
15
-
16
- const ViewMenu = observer(function ({
17
- model,
18
- IconButtonProps,
19
- IconProps,
20
- }: {
21
- model: IBaseViewModel
22
- IconButtonProps?: IconButtonPropsType
23
- IconProps: SvgIconProps
24
- }) {
25
- const { menuItems } = model
26
- const session = getSession(model)
27
-
28
- const items = [
29
- ...(session.views.length > 1
30
- ? [
31
- {
32
- label: 'Move view up',
33
- icon: ArrowUpward,
34
- onClick: () => session.moveViewUp(model.id),
35
- },
36
- {
37
- label: 'Move view down',
38
- icon: ArrowDownward,
39
- onClick: () => session.moveViewDown(model.id),
40
- },
41
- ]
42
- : []),
43
-
44
- // <=1.3.3 didn't use a function, so check as value also
45
- ...((typeof menuItems === 'function' ? menuItems() : menuItems) || []),
46
- ]
47
-
48
- return items.length ? (
49
- <CascadingMenuButton menuItems={items} data-testid="view_menu_icon">
50
- <MenuIcon {...IconProps} fontSize="small" />
51
- </CascadingMenuButton>
52
- ) : null
53
- })
54
- export default ViewMenu
@@ -1,63 +0,0 @@
1
- import React, { Suspense } from 'react'
2
- import { ErrorBoundary } from 'react-error-boundary'
3
- import { observer } from 'mobx-react'
4
-
5
- // locals
6
- import {
7
- getEnv,
8
- AbstractViewModel,
9
- SessionWithDrawerWidgets,
10
- } from '@jbrowse/core/util'
11
- import { SnackbarMessage } from '@jbrowse/core/ui/SnackbarModel'
12
-
13
- // ui elements
14
- import ErrorMessage from '@jbrowse/core/ui/ErrorMessage'
15
- import LoadingEllipses from '@jbrowse/core/ui/LoadingEllipses'
16
- import { MenuItem as JBMenuItem } from '@jbrowse/core/ui/Menu'
17
-
18
- // locals
19
- import ViewContainer from './ViewContainer'
20
-
21
- type AppSession = SessionWithDrawerWidgets & {
22
- savedSessionNames: string[]
23
- menus: { label: string; menuItems: JBMenuItem[] }[]
24
- snackbarMessages: SnackbarMessage[]
25
- renameCurrentSession: (arg: string) => void
26
- popSnackbarMessage: () => unknown
27
- }
28
-
29
- const ViewPanel = observer(function ({
30
- view,
31
- session,
32
- }: {
33
- view: AbstractViewModel
34
- session: AppSession
35
- }) {
36
- const { pluginManager } = getEnv(session)
37
- const viewType = pluginManager.getViewType(view.type)
38
- if (!viewType) {
39
- throw new Error(`unknown view type ${view.type}`)
40
- }
41
- const { ReactComponent } = viewType
42
- return (
43
- <ViewContainer
44
- view={view}
45
- onClose={() => session.removeView(view)}
46
- onMinimize={() => view.setMinimized(!view.minimized)}
47
- >
48
- {!view.minimized ? (
49
- <ErrorBoundary
50
- FallbackComponent={({ error }) => <ErrorMessage error={error} />}
51
- >
52
- <Suspense fallback={<LoadingEllipses variant="h6" />}>
53
- <ReactComponent model={view} session={session} />
54
- </Suspense>
55
- </ErrorBoundary>
56
- ) : (
57
- false
58
- )}
59
- </ViewContainer>
60
- )
61
- })
62
-
63
- export default ViewPanel
@@ -1 +0,0 @@
1
- export * from './App'
package/src/ui/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './App'