@jbrowse/plugin-linear-genome-view 1.6.9 → 1.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 (62) hide show
  1. package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js +232 -0
  2. package/dist/BaseLinearDisplay/components/Block.js +86 -0
  3. package/dist/BaseLinearDisplay/components/LinearBlocks.js +110 -0
  4. package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +192 -0
  5. package/dist/BaseLinearDisplay/index.js +41 -0
  6. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +763 -0
  7. package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +24 -0
  8. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +328 -0
  9. package/dist/LinearBareDisplay/configSchema.js +19 -0
  10. package/dist/LinearBareDisplay/index.js +21 -0
  11. package/dist/LinearBareDisplay/index.test.js +33 -0
  12. package/dist/LinearBareDisplay/model.js +44 -0
  13. package/dist/LinearBasicDisplay/components/SetMaxHeight.js +94 -0
  14. package/dist/LinearBasicDisplay/configSchema.js +25 -0
  15. package/dist/LinearBasicDisplay/index.js +23 -0
  16. package/dist/LinearBasicDisplay/model.js +162 -0
  17. package/dist/LinearGenomeView/components/CenterLine.js +80 -0
  18. package/dist/LinearGenomeView/components/ExportSvgDialog.js +137 -0
  19. package/dist/LinearGenomeView/components/Header.js +144 -0
  20. package/dist/LinearGenomeView/components/HelpDialog.js +48 -0
  21. package/dist/LinearGenomeView/components/ImportForm.js +330 -0
  22. package/dist/LinearGenomeView/components/LinearGenomeView.js +129 -0
  23. package/dist/LinearGenomeView/components/LinearGenomeView.test.js +234 -0
  24. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +349 -0
  25. package/dist/LinearGenomeView/components/MiniControls.js +83 -0
  26. package/dist/LinearGenomeView/components/OverviewRubberBand.js +310 -0
  27. package/dist/LinearGenomeView/components/OverviewScaleBar.js +403 -0
  28. package/dist/LinearGenomeView/components/RefNameAutocomplete.js +331 -0
  29. package/dist/LinearGenomeView/components/RubberBand.js +309 -0
  30. package/dist/LinearGenomeView/components/Ruler.js +101 -0
  31. package/dist/LinearGenomeView/components/ScaleBar.js +184 -0
  32. package/dist/LinearGenomeView/components/ScaleBar.test.js +180 -0
  33. package/dist/LinearGenomeView/components/SearchBox.js +201 -0
  34. package/dist/LinearGenomeView/components/SearchResultsDialog.js +159 -0
  35. package/dist/LinearGenomeView/components/SequenceDialog.js +304 -0
  36. package/dist/LinearGenomeView/components/TrackContainer.js +179 -0
  37. package/dist/LinearGenomeView/components/TrackLabel.js +165 -0
  38. package/dist/LinearGenomeView/components/TracksContainer.js +214 -0
  39. package/dist/LinearGenomeView/components/VerticalGuides.js +116 -0
  40. package/dist/LinearGenomeView/components/ZoomControls.js +92 -0
  41. package/dist/LinearGenomeView/components/util.js +16 -0
  42. package/dist/LinearGenomeView/index.js +1418 -0
  43. package/dist/LinearGenomeView/index.test.js +1170 -0
  44. package/dist/LinearGenomeView/util.js +93 -0
  45. package/dist/LinearGenomeView/util.test.js +78 -0
  46. package/dist/index.js +293 -6
  47. package/package.json +4 -8
  48. package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +2 -0
  49. package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +10 -8
  50. package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +1 -1
  51. package/src/LinearBasicDisplay/model.ts +17 -18
  52. package/src/LinearGenomeView/components/Header.tsx +1 -1
  53. package/src/LinearGenomeView/components/ImportForm.tsx +10 -4
  54. package/src/LinearGenomeView/components/LinearGenomeView.test.js +1 -0
  55. package/src/LinearGenomeView/components/OverviewScaleBar.tsx +2 -2
  56. package/src/LinearGenomeView/components/RubberBand.tsx +14 -24
  57. package/src/LinearGenomeView/components/ScaleBar.test.tsx +1 -0
  58. package/src/LinearGenomeView/components/ScaleBar.tsx +3 -6
  59. package/src/LinearGenomeView/components/SequenceDialog.tsx +1 -1
  60. package/src/LinearGenomeView/components/TrackLabel.tsx +1 -1
  61. package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +0 -4
  62. package/src/LinearGenomeView/index.tsx +2 -3
@@ -16,7 +16,7 @@ import CloseIcon from '@material-ui/icons/Close'
16
16
 
17
17
  // locals
18
18
  import RefNameAutocomplete from './RefNameAutocomplete'
19
- import { LinearGenomeViewModel } from '..'
19
+ import { LinearGenomeViewModel, WIDGET_HEIGHT } from '..'
20
20
  const SearchResultsDialog = lazy(() => import('./SearchResultsDialog'))
21
21
 
22
22
  const useStyles = makeStyles(theme => ({
@@ -26,6 +26,9 @@ const useStyles = makeStyles(theme => ({
26
26
  button: {
27
27
  margin: theme.spacing(2),
28
28
  },
29
+ container: {
30
+ padding: theme.spacing(4),
31
+ },
29
32
  }))
30
33
 
31
34
  type LGV = LinearGenomeViewModel
@@ -119,10 +122,12 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
119
122
  }
120
123
  }
121
124
 
125
+ const height = WIDGET_HEIGHT + 5
126
+
122
127
  // implementation notes:
123
128
  // having this wrapped in a form allows intuitive use of enter key to submit
124
129
  return (
125
- <div>
130
+ <div className={classes.container}>
126
131
  {err ? <ErrorMessage error={err} /> : null}
127
132
  <Container className={classes.importFormContainer}>
128
133
  <form onSubmit={event => event.preventDefault()}>
@@ -140,6 +145,7 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
140
145
  }}
141
146
  session={session}
142
147
  selected={selectedAsm}
148
+ InputProps={{ style: { height } }}
143
149
  />
144
150
  </Grid>
145
151
  <Grid item>
@@ -156,10 +162,11 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
156
162
  minWidth={270}
157
163
  onSelect={option => setOption(option)}
158
164
  TextFieldProps={{
159
- margin: 'normal',
160
165
  variant: 'outlined',
161
166
  helperText:
162
167
  'Enter sequence name, feature name, or location',
168
+ style: { minWidth: '175px' },
169
+ InputProps: { style: { height } },
163
170
  }}
164
171
  />
165
172
  ) : (
@@ -171,7 +178,6 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
171
178
  )
172
179
  ) : null}
173
180
  </Grid>
174
- <Grid item></Grid>
175
181
  <Grid item>
176
182
  <Button
177
183
  type="submit"
@@ -4,6 +4,7 @@ import '@testing-library/jest-dom/extend-expect'
4
4
  import { createTestSession } from '@jbrowse/web/src/rootModel'
5
5
  import 'requestidlecallback-polyfill'
6
6
  import LinearGenomeView from './LinearGenomeView'
7
+ jest.mock('@jbrowse/web/src/makeWorkerInstance', () => () => {})
7
8
 
8
9
  const assemblyConf = {
9
10
  name: 'volMyt1',
@@ -138,7 +138,7 @@ type LGV = LinearGenomeViewModel
138
138
 
139
139
  // rounded rect from https://stackoverflow.com/a/45889603/2129219
140
140
  // prettier-ignore
141
- function rightRoundedRect(x:number, y:number, width:number, height:number, radius:number) {
141
+ function rightRoundedRect(x: number, y: number, width: number, height: number, radius: number) {
142
142
  return "M" + x + "," + y
143
143
  + "h" + (width - radius)
144
144
  + "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius
@@ -149,7 +149,7 @@ function rightRoundedRect(x:number, y:number, width:number, height:number, radiu
149
149
  }
150
150
 
151
151
  // prettier-ignore
152
- function leftRoundedRect(x:number, y:number, width:number, height:number, radius:number ) {
152
+ function leftRoundedRect(x: number, y: number, width: number, height: number, radius: number ) {
153
153
  return "M" + (x + radius) + "," + y
154
154
  + "h" + (width - radius)
155
155
  + "v" + height
@@ -1,18 +1,17 @@
1
1
  import React, { useRef, useEffect, useState } from 'react'
2
- import ReactPropTypes from 'prop-types'
3
- import { observer, PropTypes as MobxPropTypes } from 'mobx-react'
4
- import { Instance } from 'mobx-state-tree'
5
- // material ui
6
- import { alpha } from '@material-ui/core/styles/colorManipulator'
7
- import { makeStyles } from '@material-ui/core/styles'
8
- import Popover from '@material-ui/core/Popover'
9
- import Tooltip from '@material-ui/core/Tooltip'
10
- import Typography from '@material-ui/core/Typography'
2
+ import { observer } from 'mobx-react'
3
+ import {
4
+ Popover,
5
+ Tooltip,
6
+ Typography,
7
+ makeStyles,
8
+ alpha,
9
+ } from '@material-ui/core'
11
10
  import { stringify } from '@jbrowse/core/util'
12
11
  import { Menu } from '@jbrowse/core/ui'
13
- import { LinearGenomeViewStateModel, BpOffset } from '..'
12
+ import { LinearGenomeViewModel } from '..'
14
13
 
15
- type LGV = Instance<LinearGenomeViewStateModel>
14
+ type LGV = LinearGenomeViewModel
16
15
 
17
16
  const useStyles = makeStyles(theme => {
18
17
  const background = theme.palette.tertiary
@@ -139,11 +138,11 @@ function RubberBand({
139
138
  clientX,
140
139
  clientY,
141
140
  })
142
- const { leftOffset, rightOffset } = computeOffsets(offsetX) as {
143
- leftOffset: BpOffset
144
- rightOffset: BpOffset
141
+ const args = computeOffsets(offsetX)
142
+ if (args) {
143
+ const { leftOffset, rightOffset } = args
144
+ setOffsets(leftOffset, rightOffset)
145
145
  }
146
- setOffsets(leftOffset, rightOffset)
147
146
  setGuideX(undefined)
148
147
  }
149
148
  }
@@ -313,13 +312,4 @@ function RubberBand({
313
312
  )
314
313
  }
315
314
 
316
- RubberBand.propTypes = {
317
- model: MobxPropTypes.objectOrObservableObject.isRequired,
318
- ControlComponent: ReactPropTypes.node,
319
- }
320
-
321
- RubberBand.defaultProps = {
322
- ControlComponent: <div />,
323
- }
324
-
325
315
  export default observer(RubberBand)
@@ -3,6 +3,7 @@ import React from 'react'
3
3
  import { render } from '@testing-library/react'
4
4
  import { createTestSession } from '@jbrowse/web/src/rootModel'
5
5
  import ScaleBar from './ScaleBar'
6
+ jest.mock('@jbrowse/web/src/makeWorkerInstance', () => () => {})
6
7
 
7
8
  describe('ScaleBar genome view component', () => {
8
9
  it('renders two regions', () => {
@@ -1,16 +1,13 @@
1
+ import { Paper, Typography, makeStyles } from '@material-ui/core'
1
2
  import {
2
3
  ContentBlock,
3
4
  ElidedBlock,
4
5
  InterRegionPaddingBlock,
5
6
  } from '@jbrowse/core/util/blockTypes'
6
- import Paper from '@material-ui/core/Paper'
7
- import Typography from '@material-ui/core/Typography'
8
- import { makeStyles } from '@material-ui/core/styles'
9
7
  import clsx from 'clsx'
10
8
  import { observer } from 'mobx-react'
11
- import { Instance } from 'mobx-state-tree'
12
9
  import React from 'react'
13
- import { LinearGenomeViewStateModel } from '..'
10
+ import { LinearGenomeViewModel } from '..'
14
11
  import {
15
12
  ContentBlock as ContentBlockComponent,
16
13
  ElidedBlock as ElidedBlockComponent,
@@ -18,7 +15,7 @@ import {
18
15
  } from '../../BaseLinearDisplay/components/Block'
19
16
  import { makeTicks } from '../util'
20
17
 
21
- type LGV = Instance<LinearGenomeViewStateModel>
18
+ type LGV = LinearGenomeViewModel
22
19
 
23
20
  const useStyles = makeStyles(theme => ({
24
21
  scaleBarContainer: {
@@ -213,7 +213,7 @@ function SequenceDialog({
213
213
  data-testid="rubberband-sequence"
214
214
  variant="outlined"
215
215
  multiline
216
- rows={5}
216
+ minRows={5}
217
217
  disabled={sequenceTooLarge}
218
218
  className={classes.dialogContent}
219
219
  fullWidth
@@ -103,7 +103,7 @@ const TrackLabel = React.forwardRef(
103
103
  }
104
104
 
105
105
  const items = [
106
- ...session.getTrackActionMenuItems?.(trackConf),
106
+ ...(session.getTrackActionMenuItems?.(trackConf) || []),
107
107
  ...track.trackMenuItems(),
108
108
  ].sort((a, b) => (b.priority || 0) - (a.priority || 0))
109
109
 
@@ -1444,7 +1444,6 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
1444
1444
  style="width: 100px;"
1445
1445
  >
1446
1446
  <svg
1447
- class="SvgFeatureRendering"
1448
1447
  data-testid="svgfeatures"
1449
1448
  height="100"
1450
1449
  width="100"
@@ -1459,7 +1458,6 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
1459
1458
  style="width: 1000px;"
1460
1459
  >
1461
1460
  <svg
1462
- class="SvgFeatureRendering"
1463
1461
  data-testid="svgfeatures"
1464
1462
  height="100"
1465
1463
  width="1000"
@@ -1589,7 +1587,6 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
1589
1587
  style="width: 100px;"
1590
1588
  >
1591
1589
  <svg
1592
- class="SvgFeatureRendering"
1593
1590
  data-testid="svgfeatures"
1594
1591
  height="100"
1595
1592
  width="100"
@@ -1604,7 +1601,6 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
1604
1601
  style="width: 1000px;"
1605
1602
  >
1606
1603
  <svg
1607
- class="SvgFeatureRendering"
1608
1604
  data-testid="svgfeatures"
1609
1605
  height="100"
1610
1606
  width="1000"
@@ -2,7 +2,7 @@ import { getConf, AnyConfigurationModel } from '@jbrowse/core/configuration'
2
2
  import { BaseViewModel } from '@jbrowse/core/pluggableElementTypes/models'
3
3
  import { Region } from '@jbrowse/core/util/types'
4
4
  import { ElementId, Region as MUIRegion } from '@jbrowse/core/util/types/mst'
5
- import { MenuItem } from '@jbrowse/core/ui'
5
+ import { MenuItem, ReturnToImportFormDialog } from '@jbrowse/core/ui'
6
6
  import {
7
7
  assembleLocString,
8
8
  clamp,
@@ -52,7 +52,6 @@ import { renderToSvg } from './components/LinearGenomeViewSvg'
52
52
  import RefNameAutocomplete from './components/RefNameAutocomplete'
53
53
  import SearchBox from './components/SearchBox'
54
54
  import ExportSvgDlg from './components/ExportSvgDialog'
55
- import { ReturnToImportFormDialog } from '@jbrowse/core/ui'
56
55
 
57
56
  export interface BpOffset {
58
57
  refName?: string
@@ -100,8 +99,8 @@ export const HEADER_OVERVIEW_HEIGHT = 20
100
99
  export const SCALE_BAR_HEIGHT = 17
101
100
  export const RESIZE_HANDLE_HEIGHT = 3
102
101
  export const INTER_REGION_PADDING_WIDTH = 2
103
- export const WIDGET_HEIGHT = 32
104
102
  export const SPACING = 7
103
+ export const WIDGET_HEIGHT = 32
105
104
 
106
105
  function localStorageGetItem(item: string) {
107
106
  return typeof localStorage !== 'undefined'