@jbrowse/plugin-linear-genome-view 2.1.7 → 2.2.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.
Files changed (147) hide show
  1. package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +2 -2
  2. package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +2 -22
  3. package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
  4. package/dist/BaseLinearDisplay/components/Tooltip.d.ts +1 -1
  5. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +149 -4
  6. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +600 -464
  7. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
  8. package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +19 -1
  9. package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -1
  10. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +2 -2
  11. package/dist/BasicTrack/configSchema.d.ts +3 -0
  12. package/dist/BasicTrack/configSchema.js +18 -0
  13. package/dist/BasicTrack/configSchema.js.map +1 -0
  14. package/dist/BasicTrack/index.d.ts +3 -0
  15. package/dist/BasicTrack/index.js +18 -0
  16. package/dist/BasicTrack/index.js.map +1 -0
  17. package/dist/FeatureTrack/configSchema.d.ts +3 -0
  18. package/dist/FeatureTrack/configSchema.js +21 -0
  19. package/dist/FeatureTrack/configSchema.js.map +1 -0
  20. package/dist/FeatureTrack/index.d.ts +3 -0
  21. package/dist/FeatureTrack/index.js +18 -0
  22. package/dist/FeatureTrack/index.js.map +1 -0
  23. package/dist/LinearBareDisplay/configSchema.d.ts +5 -1
  24. package/dist/LinearBareDisplay/configSchema.js +12 -1
  25. package/dist/LinearBareDisplay/configSchema.js.map +1 -1
  26. package/dist/LinearBareDisplay/model.d.ts +16 -0
  27. package/dist/LinearBareDisplay/model.js +16 -0
  28. package/dist/LinearBareDisplay/model.js.map +1 -1
  29. package/dist/LinearBasicDisplay/configSchema.d.ts +5 -1
  30. package/dist/LinearBasicDisplay/configSchema.js +16 -1
  31. package/dist/LinearBasicDisplay/configSchema.js.map +1 -1
  32. package/dist/LinearBasicDisplay/model.d.ts +79 -8
  33. package/dist/LinearBasicDisplay/model.js +167 -111
  34. package/dist/LinearBasicDisplay/model.js.map +1 -1
  35. package/dist/LinearGenomeView/components/CenterLine.d.ts +1 -1
  36. package/dist/LinearGenomeView/components/GetSequenceDialog.d.ts +1 -1
  37. package/dist/LinearGenomeView/components/Gridlines.d.ts +1 -1
  38. package/dist/LinearGenomeView/components/Header.d.ts +1 -1
  39. package/dist/LinearGenomeView/components/ImportForm.d.ts +1 -1
  40. package/dist/LinearGenomeView/components/ImportForm.js +38 -31
  41. package/dist/LinearGenomeView/components/ImportForm.js.map +1 -1
  42. package/dist/LinearGenomeView/components/LinearGenomeView.d.ts +1 -1
  43. package/dist/LinearGenomeView/components/LinearGenomeView.js +2 -24
  44. package/dist/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
  45. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +1 -1
  46. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +7 -5
  47. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -1
  48. package/dist/LinearGenomeView/components/OverviewRubberBand.d.ts +1 -1
  49. package/dist/LinearGenomeView/components/OverviewScaleBar.d.ts +27 -35
  50. package/dist/LinearGenomeView/components/RubberBand.d.ts +1 -1
  51. package/dist/LinearGenomeView/components/ScaleBar.d.ts +1 -1
  52. package/dist/LinearGenomeView/components/TrackContainer.d.ts +1 -1
  53. package/dist/LinearGenomeView/components/TrackContainer.js +12 -9
  54. package/dist/LinearGenomeView/components/TrackContainer.js.map +1 -1
  55. package/dist/LinearGenomeView/components/TrackLabel.js +9 -1
  56. package/dist/LinearGenomeView/components/TrackLabel.js.map +1 -1
  57. package/dist/LinearGenomeView/components/TracksContainer.d.ts +1 -1
  58. package/dist/LinearGenomeView/index.d.ts +273 -18
  59. package/dist/LinearGenomeView/index.js +409 -90
  60. package/dist/LinearGenomeView/index.js.map +1 -1
  61. package/dist/index.d.ts +30 -90
  62. package/dist/index.js +4 -25
  63. package/dist/index.js.map +1 -1
  64. package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +2 -2
  65. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +2 -22
  66. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
  67. package/esm/BaseLinearDisplay/components/Tooltip.d.ts +1 -1
  68. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +149 -4
  69. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +600 -464
  70. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
  71. package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +19 -1
  72. package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -1
  73. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +2 -2
  74. package/esm/BasicTrack/configSchema.d.ts +3 -0
  75. package/esm/BasicTrack/configSchema.js +16 -0
  76. package/esm/BasicTrack/configSchema.js.map +1 -0
  77. package/esm/BasicTrack/index.d.ts +3 -0
  78. package/esm/BasicTrack/index.js +13 -0
  79. package/esm/BasicTrack/index.js.map +1 -0
  80. package/esm/FeatureTrack/configSchema.d.ts +3 -0
  81. package/esm/FeatureTrack/configSchema.js +19 -0
  82. package/esm/FeatureTrack/configSchema.js.map +1 -0
  83. package/esm/FeatureTrack/index.d.ts +3 -0
  84. package/esm/FeatureTrack/index.js +13 -0
  85. package/esm/FeatureTrack/index.js.map +1 -0
  86. package/esm/LinearBareDisplay/configSchema.d.ts +5 -1
  87. package/esm/LinearBareDisplay/configSchema.js +14 -2
  88. package/esm/LinearBareDisplay/configSchema.js.map +1 -1
  89. package/esm/LinearBareDisplay/model.d.ts +16 -0
  90. package/esm/LinearBareDisplay/model.js +16 -0
  91. package/esm/LinearBareDisplay/model.js.map +1 -1
  92. package/esm/LinearBasicDisplay/configSchema.d.ts +5 -1
  93. package/esm/LinearBasicDisplay/configSchema.js +18 -2
  94. package/esm/LinearBasicDisplay/configSchema.js.map +1 -1
  95. package/esm/LinearBasicDisplay/model.d.ts +79 -8
  96. package/esm/LinearBasicDisplay/model.js +167 -111
  97. package/esm/LinearBasicDisplay/model.js.map +1 -1
  98. package/esm/LinearGenomeView/components/CenterLine.d.ts +1 -1
  99. package/esm/LinearGenomeView/components/GetSequenceDialog.d.ts +1 -1
  100. package/esm/LinearGenomeView/components/Gridlines.d.ts +1 -1
  101. package/esm/LinearGenomeView/components/Header.d.ts +1 -1
  102. package/esm/LinearGenomeView/components/ImportForm.d.ts +1 -1
  103. package/esm/LinearGenomeView/components/ImportForm.js +40 -33
  104. package/esm/LinearGenomeView/components/ImportForm.js.map +1 -1
  105. package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +1 -1
  106. package/esm/LinearGenomeView/components/LinearGenomeView.js +3 -25
  107. package/esm/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
  108. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +1 -1
  109. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +7 -5
  110. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -1
  111. package/esm/LinearGenomeView/components/OverviewRubberBand.d.ts +1 -1
  112. package/esm/LinearGenomeView/components/OverviewScaleBar.d.ts +27 -35
  113. package/esm/LinearGenomeView/components/RubberBand.d.ts +1 -1
  114. package/esm/LinearGenomeView/components/ScaleBar.d.ts +1 -1
  115. package/esm/LinearGenomeView/components/TrackContainer.d.ts +1 -1
  116. package/esm/LinearGenomeView/components/TrackContainer.js +13 -10
  117. package/esm/LinearGenomeView/components/TrackContainer.js.map +1 -1
  118. package/esm/LinearGenomeView/components/TrackLabel.js +9 -1
  119. package/esm/LinearGenomeView/components/TrackLabel.js.map +1 -1
  120. package/esm/LinearGenomeView/components/TracksContainer.d.ts +1 -1
  121. package/esm/LinearGenomeView/index.d.ts +273 -18
  122. package/esm/LinearGenomeView/index.js +409 -90
  123. package/esm/LinearGenomeView/index.js.map +1 -1
  124. package/esm/index.d.ts +30 -90
  125. package/esm/index.js +4 -25
  126. package/esm/index.js.map +1 -1
  127. package/package.json +2 -2
  128. package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +2 -24
  129. package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +695 -555
  130. package/src/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.ts +20 -1
  131. package/src/BasicTrack/configSchema.ts +23 -0
  132. package/src/BasicTrack/index.ts +18 -0
  133. package/src/FeatureTrack/configSchema.ts +27 -0
  134. package/src/FeatureTrack/index.ts +21 -0
  135. package/src/LinearBareDisplay/configSchema.ts +15 -2
  136. package/src/LinearBareDisplay/model.ts +16 -0
  137. package/src/LinearBasicDisplay/configSchema.ts +19 -2
  138. package/src/LinearBasicDisplay/model.ts +63 -11
  139. package/src/LinearGenomeView/components/ImportForm.tsx +85 -67
  140. package/src/LinearGenomeView/components/LinearGenomeView.tsx +3 -33
  141. package/src/LinearGenomeView/components/LinearGenomeViewSvg.tsx +21 -18
  142. package/src/LinearGenomeView/components/TrackContainer.tsx +38 -27
  143. package/src/LinearGenomeView/components/TrackLabel.tsx +10 -1
  144. package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.tsx.snap +204 -204
  145. package/src/LinearGenomeView/index.test.ts +33 -26
  146. package/src/LinearGenomeView/index.tsx +471 -133
  147. package/src/index.ts +6 -46
@@ -1,9 +1,8 @@
1
1
  import React from 'react'
2
2
  import { Button, Paper, Typography } from '@mui/material'
3
3
  import { makeStyles } from 'tss-react/mui'
4
- import { ErrorBoundary } from 'react-error-boundary'
5
4
  import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
6
- import { ErrorMessage } from '@jbrowse/core/ui'
5
+ import { LoadingEllipses } from '@jbrowse/core/ui'
7
6
  import { observer } from 'mobx-react'
8
7
 
9
8
  // locals
@@ -22,26 +21,6 @@ const useStyles = makeStyles()(theme => ({
22
21
  paddingTop: theme.spacing(1),
23
22
  paddingBottom: theme.spacing(1),
24
23
  },
25
- dots: {
26
- '&::after': {
27
- display: 'inline-block',
28
- animation: '$ellipsis 1.5s infinite',
29
- content: '"."',
30
- width: '1em',
31
- textAlign: 'left',
32
- },
33
- },
34
- '@keyframes ellipsis': {
35
- '0%': {
36
- content: '"."',
37
- },
38
- '33%': {
39
- content: '".."',
40
- },
41
- '66%': {
42
- content: '"..."',
43
- },
44
- },
45
24
  }))
46
25
 
47
26
  const LinearGenomeView = observer(({ model }: { model: LGV }) => {
@@ -49,11 +28,7 @@ const LinearGenomeView = observer(({ model }: { model: LGV }) => {
49
28
  const { classes } = useStyles()
50
29
 
51
30
  if (!initialized && !error) {
52
- return (
53
- <Typography className={classes.dots} variant="h5">
54
- Loading
55
- </Typography>
56
- )
31
+ return <LoadingEllipses variant="h5" />
57
32
  }
58
33
  if (!hasDisplayedRegions || error) {
59
34
  return <ImportForm model={model} />
@@ -100,12 +75,7 @@ const LinearGenomeView = observer(({ model }: { model: LGV }) => {
100
75
  </Paper>
101
76
  ) : (
102
77
  tracks.map(track => (
103
- <ErrorBoundary
104
- key={track.id}
105
- FallbackComponent={({ error }) => <ErrorMessage error={error} />}
106
- >
107
- <TrackContainer model={model} track={track} />
108
- </ErrorBoundary>
78
+ <TrackContainer key={track.id} model={model} track={track} />
109
79
  ))
110
80
  )}
111
81
  </TracksContainer>
@@ -263,6 +263,7 @@ function SVGTracks({
263
263
  // render LGV to SVG
264
264
  export async function renderToSvg(model: LGV, opts: ExportSvgOptions) {
265
265
  await when(() => model.initialized)
266
+ const { Wrapper = ({ children }) => <>{children}</> } = opts
266
267
  const { width, tracks, showCytobands } = model
267
268
  const shift = 50
268
269
  const offset =
@@ -282,24 +283,26 @@ export async function renderToSvg(model: LGV, opts: ExportSvgOptions) {
282
283
 
283
284
  // the xlink namespace is used for rendering <image> tag
284
285
  return renderToStaticMarkup(
285
- <svg
286
- width={width}
287
- height={height}
288
- xmlns="http://www.w3.org/2000/svg"
289
- xmlnsXlink="http://www.w3.org/1999/xlink"
290
- viewBox={[0, 0, width + shift * 2, height].toString()}
291
- >
292
- {/* background white */}
293
- <rect width={width + shift * 2} height={height} fill="white" />
286
+ <Wrapper>
287
+ <svg
288
+ width={width}
289
+ height={height}
290
+ xmlns="http://www.w3.org/2000/svg"
291
+ xmlnsXlink="http://www.w3.org/1999/xlink"
292
+ viewBox={[0, 0, width + shift * 2, height].toString()}
293
+ >
294
+ {/* background white */}
295
+ <rect width={width + shift * 2} height={height} fill="white" />
294
296
 
295
- <g stroke="none" transform={`translate(${shift} ${fontSize})`}>
296
- <SVGHeader model={model} />
297
- <SVGTracks
298
- model={model}
299
- displayResults={displayResults}
300
- offset={offset}
301
- />
302
- </g>
303
- </svg>,
297
+ <g stroke="none" transform={`translate(${shift} ${fontSize})`}>
298
+ <SVGHeader model={model} />
299
+ <SVGTracks
300
+ model={model}
301
+ displayResults={displayResults}
302
+ offset={offset}
303
+ />
304
+ </g>
305
+ </svg>
306
+ </Wrapper>,
304
307
  )
305
308
  }
@@ -5,7 +5,8 @@ import { observer } from 'mobx-react'
5
5
  import { isAlive } from 'mobx-state-tree'
6
6
  import { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'
7
7
  import { getConf } from '@jbrowse/core/configuration'
8
- import { ResizeHandle } from '@jbrowse/core/ui'
8
+ import { ResizeHandle, ErrorMessage } from '@jbrowse/core/ui'
9
+ import { ErrorBoundary } from 'react-error-boundary'
9
10
  import { useDebouncedCallback } from '@jbrowse/core/util'
10
11
 
11
12
  // locals
@@ -92,6 +93,7 @@ function TrackContainer({
92
93
  const trackId = getConf(track, 'trackId')
93
94
  const ref = useRef(null)
94
95
  const dimmed = draggingTrackId !== undefined && draggingTrackId !== display.id
96
+ const minimized = track.minimized
95
97
  const debouncedOnDragEnter = useDebouncedCallback(() => {
96
98
  if (isAlive(display) && dimmed) {
97
99
  moveTrack(draggingTrackId, track.id)
@@ -109,36 +111,45 @@ function TrackContainer({
109
111
  return (
110
112
  <Paper className={classes.root} variant="outlined">
111
113
  <TrackContainerLabel model={track} view={model} />
112
- <div
113
- className={classes.trackRenderingContainer}
114
- style={{ height }}
115
- onScroll={event => display.setScrollTop(event.currentTarget.scrollTop)}
116
- onDragEnter={debouncedOnDragEnter}
117
- data-testid={`trackRenderingContainer-${model.id}-${trackId}`}
114
+ <ErrorBoundary
115
+ key={track.id}
116
+ FallbackComponent={({ error }) => <ErrorMessage error={error} />}
118
117
  >
119
118
  <div
120
- ref={ref}
121
- className={classes.renderingComponentContainer}
122
- style={{ transform: `scaleX(${model.scaleFactor})` }}
119
+ className={classes.trackRenderingContainer}
120
+ style={{ height: minimized ? 20 : height }}
121
+ onScroll={evt => display.setScrollTop(evt.currentTarget.scrollTop)}
122
+ onDragEnter={debouncedOnDragEnter}
123
+ data-testid={`trackRenderingContainer-${model.id}-${trackId}`}
123
124
  >
124
- <RenderingComponent
125
- model={display}
126
- onHorizontalScroll={horizontalScroll}
127
- />
128
- </div>
125
+ {!minimized ? (
126
+ <>
127
+ <div
128
+ ref={ref}
129
+ className={classes.renderingComponentContainer}
130
+ style={{ transform: `scaleX(${model.scaleFactor})` }}
131
+ >
132
+ <RenderingComponent
133
+ model={display}
134
+ onHorizontalScroll={horizontalScroll}
135
+ />
136
+ </div>
129
137
 
130
- {DisplayBlurb ? (
131
- <div
132
- style={{
133
- position: 'absolute',
134
- left: 0,
135
- top: display.height - 20,
136
- }}
137
- >
138
- <DisplayBlurb model={display} />
139
- </div>
140
- ) : null}
141
- </div>
138
+ {DisplayBlurb ? (
139
+ <div
140
+ style={{
141
+ position: 'absolute',
142
+ left: 0,
143
+ top: display.height - 20,
144
+ }}
145
+ >
146
+ <DisplayBlurb model={display} />
147
+ </div>
148
+ ) : null}
149
+ </>
150
+ ) : null}
151
+ </div>
152
+ </ErrorBoundary>
142
153
  <div
143
154
  className={classes.overlay}
144
155
  style={{
@@ -18,6 +18,8 @@ import {
18
18
  import MoreVertIcon from '@mui/icons-material/MoreVert'
19
19
  import DragIcon from '@mui/icons-material/DragIndicator'
20
20
  import CloseIcon from '@mui/icons-material/Close'
21
+ import MinimizeIcon from '@mui/icons-material/Minimize'
22
+ import AddIcon from '@mui/icons-material/Add'
21
23
 
22
24
  import { LinearGenomeViewModel } from '..'
23
25
 
@@ -64,6 +66,7 @@ const TrackLabel = React.forwardRef<HTMLDivElement, Props>(
64
66
  const view = getContainingView(track) as LGV
65
67
  const session = getSession(track)
66
68
  const trackConf = track.configuration
69
+ const minimized = track.minimized
67
70
  const trackId = getConf(track, 'trackId')
68
71
  const trackName = getTrackName(trackConf, session)
69
72
 
@@ -73,6 +76,11 @@ const TrackLabel = React.forwardRef<HTMLDivElement, Props>(
73
76
  })
74
77
 
75
78
  const items = [
79
+ {
80
+ label: minimized ? 'Restore track' : 'Minimize track',
81
+ icon: minimized ? AddIcon : MinimizeIcon,
82
+ onClick: () => track.setMinimized(!minimized),
83
+ },
76
84
  ...(session.getTrackActionMenuItems?.(trackConf) || []),
77
85
  ...track.trackMenuItems(),
78
86
  ].sort((a, b) => (b.priority || 0) - (a.priority || 0))
@@ -103,12 +111,13 @@ const TrackLabel = React.forwardRef<HTMLDivElement, Props>(
103
111
  >
104
112
  <CloseIcon fontSize="small" />
105
113
  </IconButton>
114
+
106
115
  <Typography
107
116
  variant="body1"
108
117
  component="span"
109
118
  className={classes.trackName}
110
119
  >
111
- {trackName}
120
+ {trackName + (minimized ? ' (minimized)' : '')}
112
121
  </Typography>
113
122
  <IconButton
114
123
  {...bindTrigger(popupState)}