@jbrowse/plugin-linear-genome-view 2.3.4 → 2.4.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 (271) hide show
  1. package/dist/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +2 -3
  2. package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js +4 -4
  3. package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -1
  4. package/dist/BaseLinearDisplay/components/Block.js +1 -1
  5. package/dist/BaseLinearDisplay/components/Block.js.map +1 -1
  6. package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +11 -11
  7. package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
  8. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +82 -7
  9. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +43 -28
  10. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
  11. package/dist/BaseLinearDisplay/models/configSchema.js +8 -0
  12. package/dist/BaseLinearDisplay/models/configSchema.js.map +1 -1
  13. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +1 -1
  14. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +9 -5
  15. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
  16. package/dist/BaseLinearDisplay/models/util.js +2 -2
  17. package/dist/BaseLinearDisplay/models/util.js.map +1 -1
  18. package/dist/LaunchLinearGenomeView/index.js +1 -1
  19. package/dist/LaunchLinearGenomeView/index.js.map +1 -1
  20. package/dist/LinearBareDisplay/index.d.ts +2 -3
  21. package/dist/LinearBareDisplay/index.js +4 -2
  22. package/dist/LinearBareDisplay/index.js.map +1 -1
  23. package/dist/LinearBareDisplay/model.d.ts +61 -3
  24. package/dist/LinearBasicDisplay/index.d.ts +2 -3
  25. package/dist/LinearBasicDisplay/index.js +4 -2
  26. package/dist/LinearBasicDisplay/index.js.map +1 -1
  27. package/dist/LinearBasicDisplay/model.d.ts +82 -14
  28. package/dist/LinearGenomeView/components/CenterLine.js +2 -2
  29. package/dist/LinearGenomeView/components/CenterLine.js.map +1 -1
  30. package/dist/LinearGenomeView/components/Cytobands.d.ts +118 -0
  31. package/dist/LinearGenomeView/components/Cytobands.js +92 -0
  32. package/dist/LinearGenomeView/components/Cytobands.js.map +1 -0
  33. package/dist/LinearGenomeView/components/ExportSvgDialog.d.ts +1 -1
  34. package/dist/LinearGenomeView/components/ExportSvgDialog.js +24 -3
  35. package/dist/LinearGenomeView/components/ExportSvgDialog.js.map +1 -1
  36. package/dist/LinearGenomeView/components/Gridlines.js +1 -1
  37. package/dist/LinearGenomeView/components/Gridlines.js.map +1 -1
  38. package/dist/LinearGenomeView/components/Header.js +3 -4
  39. package/dist/LinearGenomeView/components/Header.js.map +1 -1
  40. package/dist/LinearGenomeView/components/ImportForm.d.ts +2 -2
  41. package/dist/LinearGenomeView/components/ImportForm.js +15 -19
  42. package/dist/LinearGenomeView/components/ImportForm.js.map +1 -1
  43. package/dist/LinearGenomeView/components/LinearGenomeView.js +1 -1
  44. package/dist/LinearGenomeView/components/MiniControls.js +5 -4
  45. package/dist/LinearGenomeView/components/MiniControls.js.map +1 -1
  46. package/dist/LinearGenomeView/components/OverviewRubberband.d.ts +3 -4
  47. package/dist/LinearGenomeView/components/OverviewRubberband.js +8 -11
  48. package/dist/LinearGenomeView/components/OverviewRubberband.js.map +1 -1
  49. package/dist/LinearGenomeView/components/OverviewScalebar.d.ts +4 -119
  50. package/dist/LinearGenomeView/components/OverviewScalebar.js +19 -103
  51. package/dist/LinearGenomeView/components/OverviewScalebar.js.map +1 -1
  52. package/dist/LinearGenomeView/components/RefNameAutocomplete.d.ts +2 -1
  53. package/dist/LinearGenomeView/components/RefNameAutocomplete.js +35 -31
  54. package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -1
  55. package/dist/LinearGenomeView/components/RubberbandSpan.d.ts +2 -2
  56. package/dist/LinearGenomeView/components/RubberbandSpan.js +4 -18
  57. package/dist/LinearGenomeView/components/RubberbandSpan.js.map +1 -1
  58. package/dist/LinearGenomeView/components/SearchBox.js +3 -3
  59. package/dist/LinearGenomeView/components/SearchBox.js.map +1 -1
  60. package/dist/LinearGenomeView/components/TrackLabel.js +6 -7
  61. package/dist/LinearGenomeView/components/TrackLabel.js.map +1 -1
  62. package/dist/LinearGenomeView/components/TracksContainer.d.ts +2 -3
  63. package/dist/LinearGenomeView/components/TracksContainer.js +9 -8
  64. package/dist/LinearGenomeView/components/TracksContainer.js.map +1 -1
  65. package/dist/LinearGenomeView/components/ZoomControls.js +5 -4
  66. package/dist/LinearGenomeView/components/ZoomControls.js.map +1 -1
  67. package/dist/LinearGenomeView/components/hooks.d.ts +6 -1
  68. package/dist/LinearGenomeView/components/hooks.js +1 -1
  69. package/dist/LinearGenomeView/components/hooks.js.map +1 -1
  70. package/dist/LinearGenomeView/components/util.d.ts +6 -0
  71. package/dist/LinearGenomeView/components/util.js +11 -1
  72. package/dist/LinearGenomeView/components/util.js.map +1 -1
  73. package/dist/LinearGenomeView/index.js +8 -6
  74. package/dist/LinearGenomeView/index.js.map +1 -1
  75. package/dist/LinearGenomeView/model.d.ts +18 -12
  76. package/dist/LinearGenomeView/model.js +31 -34
  77. package/dist/LinearGenomeView/model.js.map +1 -1
  78. package/dist/LinearGenomeView/svgcomponents/SVGBackground.d.ts +6 -0
  79. package/dist/LinearGenomeView/svgcomponents/SVGBackground.js +13 -0
  80. package/dist/LinearGenomeView/svgcomponents/SVGBackground.js.map +1 -0
  81. package/dist/LinearGenomeView/svgcomponents/SVGHeader.d.ts +10 -0
  82. package/dist/LinearGenomeView/svgcomponents/SVGHeader.js +55 -0
  83. package/dist/LinearGenomeView/svgcomponents/SVGHeader.js.map +1 -0
  84. package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.d.ts +12 -0
  85. package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +57 -0
  86. package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js.map +1 -0
  87. package/dist/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +8 -0
  88. package/dist/LinearGenomeView/svgcomponents/SVGRegionSeparators.js +13 -0
  89. package/dist/LinearGenomeView/svgcomponents/SVGRegionSeparators.js.map +1 -0
  90. package/dist/LinearGenomeView/svgcomponents/SVGRuler.d.ts +8 -0
  91. package/dist/LinearGenomeView/svgcomponents/SVGRuler.js +51 -0
  92. package/dist/LinearGenomeView/svgcomponents/SVGRuler.js.map +1 -0
  93. package/dist/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +8 -0
  94. package/dist/LinearGenomeView/svgcomponents/SVGScalebar.js +22 -0
  95. package/dist/LinearGenomeView/svgcomponents/SVGScalebar.js.map +1 -0
  96. package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.d.ts +8 -0
  97. package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.js +16 -0
  98. package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.js.map +1 -0
  99. package/dist/LinearGenomeView/svgcomponents/SVGTracks.d.ts +23 -0
  100. package/dist/LinearGenomeView/svgcomponents/SVGTracks.js +30 -0
  101. package/dist/LinearGenomeView/svgcomponents/SVGTracks.js.map +1 -0
  102. package/dist/LinearGenomeView/util.js +2 -2
  103. package/dist/LinearGenomeView/util.js.map +1 -1
  104. package/dist/index.d.ts +157 -44
  105. package/dist/index.js +21 -13
  106. package/dist/index.js.map +1 -1
  107. package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +2 -3
  108. package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js +2 -3
  109. package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -1
  110. package/esm/BaseLinearDisplay/components/Block.js +1 -1
  111. package/esm/BaseLinearDisplay/components/Block.js.map +1 -1
  112. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +11 -11
  113. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
  114. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +82 -7
  115. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +44 -29
  116. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
  117. package/esm/BaseLinearDisplay/models/configSchema.js +8 -0
  118. package/esm/BaseLinearDisplay/models/configSchema.js.map +1 -1
  119. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +1 -1
  120. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +9 -5
  121. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
  122. package/esm/BaseLinearDisplay/models/util.js +2 -2
  123. package/esm/BaseLinearDisplay/models/util.js.map +1 -1
  124. package/esm/LaunchLinearGenomeView/index.js +1 -1
  125. package/esm/LaunchLinearGenomeView/index.js.map +1 -1
  126. package/esm/LinearBareDisplay/index.d.ts +2 -3
  127. package/esm/LinearBareDisplay/index.js +2 -1
  128. package/esm/LinearBareDisplay/index.js.map +1 -1
  129. package/esm/LinearBareDisplay/model.d.ts +61 -3
  130. package/esm/LinearBasicDisplay/index.d.ts +2 -3
  131. package/esm/LinearBasicDisplay/index.js +2 -1
  132. package/esm/LinearBasicDisplay/index.js.map +1 -1
  133. package/esm/LinearBasicDisplay/model.d.ts +82 -14
  134. package/esm/LinearGenomeView/components/CenterLine.js +2 -2
  135. package/esm/LinearGenomeView/components/CenterLine.js.map +1 -1
  136. package/esm/LinearGenomeView/components/Cytobands.d.ts +118 -0
  137. package/esm/LinearGenomeView/components/Cytobands.js +87 -0
  138. package/esm/LinearGenomeView/components/Cytobands.js.map +1 -0
  139. package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +1 -1
  140. package/esm/LinearGenomeView/components/ExportSvgDialog.js +25 -4
  141. package/esm/LinearGenomeView/components/ExportSvgDialog.js.map +1 -1
  142. package/esm/LinearGenomeView/components/Gridlines.js +1 -1
  143. package/esm/LinearGenomeView/components/Gridlines.js.map +1 -1
  144. package/esm/LinearGenomeView/components/Header.js +5 -6
  145. package/esm/LinearGenomeView/components/Header.js.map +1 -1
  146. package/esm/LinearGenomeView/components/ImportForm.d.ts +2 -2
  147. package/esm/LinearGenomeView/components/ImportForm.js +16 -20
  148. package/esm/LinearGenomeView/components/ImportForm.js.map +1 -1
  149. package/esm/LinearGenomeView/components/LinearGenomeView.js +1 -1
  150. package/esm/LinearGenomeView/components/MiniControls.js +5 -4
  151. package/esm/LinearGenomeView/components/MiniControls.js.map +1 -1
  152. package/esm/LinearGenomeView/components/OverviewRubberband.d.ts +3 -4
  153. package/esm/LinearGenomeView/components/OverviewRubberband.js +8 -11
  154. package/esm/LinearGenomeView/components/OverviewRubberband.js.map +1 -1
  155. package/esm/LinearGenomeView/components/OverviewScalebar.d.ts +4 -119
  156. package/esm/LinearGenomeView/components/OverviewScalebar.js +16 -100
  157. package/esm/LinearGenomeView/components/OverviewScalebar.js.map +1 -1
  158. package/esm/LinearGenomeView/components/RefNameAutocomplete.d.ts +2 -1
  159. package/esm/LinearGenomeView/components/RefNameAutocomplete.js +36 -32
  160. package/esm/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -1
  161. package/esm/LinearGenomeView/components/RubberbandSpan.d.ts +2 -2
  162. package/esm/LinearGenomeView/components/RubberbandSpan.js +5 -20
  163. package/esm/LinearGenomeView/components/RubberbandSpan.js.map +1 -1
  164. package/esm/LinearGenomeView/components/SearchBox.js +3 -3
  165. package/esm/LinearGenomeView/components/SearchBox.js.map +1 -1
  166. package/esm/LinearGenomeView/components/TrackLabel.js +6 -7
  167. package/esm/LinearGenomeView/components/TrackLabel.js.map +1 -1
  168. package/esm/LinearGenomeView/components/TracksContainer.d.ts +2 -3
  169. package/esm/LinearGenomeView/components/TracksContainer.js +9 -8
  170. package/esm/LinearGenomeView/components/TracksContainer.js.map +1 -1
  171. package/esm/LinearGenomeView/components/ZoomControls.js +5 -4
  172. package/esm/LinearGenomeView/components/ZoomControls.js.map +1 -1
  173. package/esm/LinearGenomeView/components/hooks.d.ts +6 -1
  174. package/esm/LinearGenomeView/components/hooks.js +1 -1
  175. package/esm/LinearGenomeView/components/hooks.js.map +1 -1
  176. package/esm/LinearGenomeView/components/util.d.ts +6 -0
  177. package/esm/LinearGenomeView/components/util.js +9 -0
  178. package/esm/LinearGenomeView/components/util.js.map +1 -1
  179. package/esm/LinearGenomeView/index.js +8 -6
  180. package/esm/LinearGenomeView/index.js.map +1 -1
  181. package/esm/LinearGenomeView/model.d.ts +18 -12
  182. package/esm/LinearGenomeView/model.js +24 -28
  183. package/esm/LinearGenomeView/model.js.map +1 -1
  184. package/esm/LinearGenomeView/svgcomponents/SVGBackground.d.ts +6 -0
  185. package/esm/LinearGenomeView/svgcomponents/SVGBackground.js +7 -0
  186. package/esm/LinearGenomeView/svgcomponents/SVGBackground.js.map +1 -0
  187. package/esm/LinearGenomeView/svgcomponents/SVGHeader.d.ts +10 -0
  188. package/esm/LinearGenomeView/svgcomponents/SVGHeader.js +49 -0
  189. package/esm/LinearGenomeView/svgcomponents/SVGHeader.js.map +1 -0
  190. package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.d.ts +12 -0
  191. package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +47 -0
  192. package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js.map +1 -0
  193. package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +8 -0
  194. package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.js +7 -0
  195. package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.js.map +1 -0
  196. package/esm/LinearGenomeView/svgcomponents/SVGRuler.d.ts +8 -0
  197. package/esm/LinearGenomeView/svgcomponents/SVGRuler.js +45 -0
  198. package/esm/LinearGenomeView/svgcomponents/SVGRuler.js.map +1 -0
  199. package/esm/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +8 -0
  200. package/esm/LinearGenomeView/svgcomponents/SVGScalebar.js +16 -0
  201. package/esm/LinearGenomeView/svgcomponents/SVGScalebar.js.map +1 -0
  202. package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.d.ts +8 -0
  203. package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.js +10 -0
  204. package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.js.map +1 -0
  205. package/esm/LinearGenomeView/svgcomponents/SVGTracks.d.ts +23 -0
  206. package/esm/LinearGenomeView/svgcomponents/SVGTracks.js +24 -0
  207. package/esm/LinearGenomeView/svgcomponents/SVGTracks.js.map +1 -0
  208. package/esm/LinearGenomeView/util.js +2 -2
  209. package/esm/LinearGenomeView/util.js.map +1 -1
  210. package/esm/index.d.ts +157 -44
  211. package/esm/index.js +9 -5
  212. package/esm/index.js.map +1 -1
  213. package/package.json +3 -3
  214. package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +4 -3
  215. package/src/BaseLinearDisplay/components/Block.tsx +1 -1
  216. package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +11 -12
  217. package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +55 -40
  218. package/src/BaseLinearDisplay/models/configSchema.ts +8 -0
  219. package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +15 -22
  220. package/src/BaseLinearDisplay/models/util.ts +2 -2
  221. package/src/LaunchLinearGenomeView/index.ts +1 -1
  222. package/src/LinearBareDisplay/index.ts +2 -1
  223. package/src/LinearBasicDisplay/index.ts +2 -1
  224. package/src/LinearGenomeView/components/CenterLine.tsx +2 -2
  225. package/src/LinearGenomeView/components/Cytobands.tsx +154 -0
  226. package/src/LinearGenomeView/components/ExportSvgDialog.tsx +56 -4
  227. package/src/LinearGenomeView/components/Gridlines.tsx +1 -1
  228. package/src/LinearGenomeView/components/Header.tsx +6 -13
  229. package/src/LinearGenomeView/components/ImportForm.tsx +17 -26
  230. package/src/LinearGenomeView/components/LinearGenomeView.test.tsx +8 -11
  231. package/src/LinearGenomeView/components/LinearGenomeView.tsx +1 -1
  232. package/src/LinearGenomeView/components/MiniControls.tsx +6 -7
  233. package/src/LinearGenomeView/components/OverviewRubberband.tsx +40 -49
  234. package/src/LinearGenomeView/components/OverviewScalebar.tsx +222 -385
  235. package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +50 -48
  236. package/src/LinearGenomeView/components/RubberbandSpan.tsx +8 -25
  237. package/src/LinearGenomeView/components/SearchBox.tsx +3 -2
  238. package/src/LinearGenomeView/components/TrackLabel.tsx +76 -76
  239. package/src/LinearGenomeView/components/TracksContainer.tsx +8 -8
  240. package/src/LinearGenomeView/components/ZoomControls.tsx +3 -4
  241. package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.tsx.snap +1230 -1200
  242. package/src/LinearGenomeView/components/hooks.ts +7 -1
  243. package/src/LinearGenomeView/components/util.ts +13 -0
  244. package/src/LinearGenomeView/index.test.ts +12 -13
  245. package/src/LinearGenomeView/index.ts +8 -9
  246. package/src/LinearGenomeView/model.ts +41 -36
  247. package/src/LinearGenomeView/svgcomponents/SVGBackground.tsx +21 -0
  248. package/src/LinearGenomeView/svgcomponents/SVGHeader.tsx +93 -0
  249. package/src/LinearGenomeView/svgcomponents/SVGLinearGenomeView.tsx +114 -0
  250. package/src/LinearGenomeView/svgcomponents/SVGRegionSeparators.tsx +31 -0
  251. package/src/LinearGenomeView/svgcomponents/SVGRuler.tsx +125 -0
  252. package/src/LinearGenomeView/svgcomponents/SVGScalebar.tsx +57 -0
  253. package/src/LinearGenomeView/svgcomponents/SVGTrackLabel.tsx +47 -0
  254. package/src/LinearGenomeView/svgcomponents/SVGTracks.tsx +67 -0
  255. package/src/LinearGenomeView/util.test.ts +7 -4
  256. package/src/LinearGenomeView/util.ts +3 -3
  257. package/src/index.ts +22 -23
  258. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +0 -4
  259. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +0 -141
  260. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js.map +0 -1
  261. package/dist/LinearGenomeView/components/Ruler.d.ts +0 -11
  262. package/dist/LinearGenomeView/components/Ruler.js +0 -39
  263. package/dist/LinearGenomeView/components/Ruler.js.map +0 -1
  264. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +0 -4
  265. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +0 -134
  266. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js.map +0 -1
  267. package/esm/LinearGenomeView/components/Ruler.d.ts +0 -11
  268. package/esm/LinearGenomeView/components/Ruler.js +0 -34
  269. package/esm/LinearGenomeView/components/Ruler.js.map +0 -1
  270. package/src/LinearGenomeView/components/LinearGenomeViewSvg.tsx +0 -307
  271. package/src/LinearGenomeView/components/Ruler.tsx +0 -78
package/esm/index.js CHANGED
@@ -3,10 +3,10 @@ import { isAbstractMenuManager } from '@jbrowse/core/util';
3
3
  // icons
4
4
  import LineStyleIcon from '@mui/icons-material/LineStyle';
5
5
  // locals
6
- import { BaseLinearDisplay, BaseLinearDisplayComponent, BlockMsg, baseLinearDisplayConfigSchema, } from './BaseLinearDisplay';
7
- import LinearBareDisplayF, { configSchemaFactory as linearBareDisplayConfigSchemaFactory, } from './LinearBareDisplay';
8
- import LinearGenomeViewF, { renderToSvg, RefNameAutocomplete, SearchBox, ZoomControls, LinearGenomeView, } from './LinearGenomeView';
9
- import LinearBasicDisplayF, { configSchema as linearBasicDisplayConfigSchemaFactory, modelFactory as linearBasicDisplayModelFactory, } from './LinearBasicDisplay';
6
+ import { BaseLinearDisplay, BaseLinearDisplayComponent, baseLinearDisplayConfigSchema, } from './BaseLinearDisplay';
7
+ import LinearBareDisplayF from './LinearBareDisplay';
8
+ import LinearGenomeViewF, { SearchBox, ZoomControls, LinearGenomeView, } from './LinearGenomeView';
9
+ import LinearBasicDisplayF from './LinearBasicDisplay';
10
10
  import FeatureTrackF from './FeatureTrack';
11
11
  import BasicTrackF from './BasicTrack';
12
12
  import LaunchLinearGenomeViewF from './LaunchLinearGenomeView';
@@ -43,5 +43,9 @@ export default class LinearGenomeViewPlugin extends Plugin {
43
43
  }
44
44
  }
45
45
  }
46
- export { baseLinearDisplayConfigSchema, linearBareDisplayConfigSchemaFactory, linearBasicDisplayConfigSchemaFactory, linearBasicDisplayModelFactory, renderToSvg, BaseLinearDisplayComponent, BaseLinearDisplay, RefNameAutocomplete, SearchBox, BlockMsg, };
46
+ export { configSchemaFactory as linearBareDisplayConfigSchemaFactory } from './LinearBareDisplay';
47
+ export { BlockMsg, baseLinearDisplayConfigSchema, BaseLinearDisplayComponent, BaseLinearDisplay, } from './BaseLinearDisplay';
48
+ export { RefNameAutocomplete, SearchBox, } from './LinearGenomeView';
49
+ export { renderToSvg, SVGTracks, totalHeight, SVGRuler, } from './LinearGenomeView/svgcomponents/SVGLinearGenomeView';
50
+ export { configSchema as linearBasicDisplayConfigSchemaFactory, modelFactory as linearBasicDisplayModelFactory, } from './LinearBasicDisplay';
47
51
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,sBAAsB,CAAA;AAEzC,OAAO,EAAwB,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAEhF,QAAQ;AACR,OAAO,aAAa,MAAM,+BAA+B,CAAA;AAEzD,SAAS;AACT,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAE1B,QAAQ,EACR,6BAA6B,GAC9B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,kBAAkB,EAAE,EACzB,mBAAmB,IAAI,oCAAoC,GAC5D,MAAM,qBAAqB,CAAA;AAC5B,OAAO,iBAAiB,EAAE,EACxB,WAAW,EAGX,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,gBAAgB,GACjB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,mBAAmB,EAAE,EAC1B,YAAY,IAAI,qCAAqC,EACrD,YAAY,IAAI,8BAA8B,GAC/C,MAAM,sBAAsB,CAAA;AAE7B,OAAO,aAAa,MAAM,gBAAgB,CAAA;AAC1C,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,uBAAuB,MAAM,0BAA0B,CAAA;AAE9D,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,MAAM;IAA1D;;QACE,SAAI,GAAG,wBAAwB,CAAA;QAE/B,YAAO,GAAG;YACR,0BAA0B;YAC1B,iBAAiB;YACjB,6BAA6B;YAC7B,SAAS;YACT,YAAY;YACZ,gBAAgB;SACjB,CAAA;IAsBH,CAAC;IApBC,OAAO,CAAC,aAA4B;QAClC,aAAa,CAAC,aAAa,CAAC,CAAA;QAC5B,WAAW,CAAC,aAAa,CAAC,CAAA;QAC1B,mBAAmB,CAAC,aAAa,CAAC,CAAA;QAClC,iBAAiB,CAAC,aAAa,CAAC,CAAA;QAChC,kBAAkB,CAAC,aAAa,CAAC,CAAA;QACjC,uBAAuB,CAAC,aAAa,CAAC,CAAA;IACxC,CAAC;IAED,SAAS,CAAC,aAA4B;QACpC,IAAI,qBAAqB,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;YAClD,aAAa,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,EAAE;gBAC/C,KAAK,EAAE,oBAAoB;gBAC3B,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE,CAAC,OAA6B,EAAE,EAAE;oBACzC,OAAO,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAA;gBACzC,CAAC;aACF,CAAC,CAAA;SACH;IACH,CAAC;CACF;AAED,OAAO,EACL,6BAA6B,EAC7B,oCAAoC,EACpC,qCAAqC,EACrC,8BAA8B,EAC9B,WAAW,EACX,0BAA0B,EAC1B,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,QAAQ,GACT,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,sBAAsB,CAAA;AAEzC,OAAO,EAAwB,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAEhF,QAAQ;AACR,OAAO,aAAa,MAAM,+BAA+B,CAAA;AAEzD,SAAS;AACT,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,kBAAkB,MAAM,qBAAqB,CAAA;AACpD,OAAO,iBAAiB,EAAE,EACxB,SAAS,EACT,YAAY,EACZ,gBAAgB,GACjB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,mBAAmB,MAAM,sBAAsB,CAAA;AAEtD,OAAO,aAAa,MAAM,gBAAgB,CAAA;AAC1C,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,uBAAuB,MAAM,0BAA0B,CAAA;AAE9D,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,MAAM;IAA1D;;QACE,SAAI,GAAG,wBAAwB,CAAA;QAE/B,YAAO,GAAG;YACR,0BAA0B;YAC1B,iBAAiB;YACjB,6BAA6B;YAC7B,SAAS;YACT,YAAY;YACZ,gBAAgB;SACjB,CAAA;IAsBH,CAAC;IApBC,OAAO,CAAC,aAA4B;QAClC,aAAa,CAAC,aAAa,CAAC,CAAA;QAC5B,WAAW,CAAC,aAAa,CAAC,CAAA;QAC1B,mBAAmB,CAAC,aAAa,CAAC,CAAA;QAClC,iBAAiB,CAAC,aAAa,CAAC,CAAA;QAChC,kBAAkB,CAAC,aAAa,CAAC,CAAA;QACjC,uBAAuB,CAAC,aAAa,CAAC,CAAA;IACxC,CAAC;IAED,SAAS,CAAC,aAA4B;QACpC,IAAI,qBAAqB,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;YAClD,aAAa,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,EAAE;gBAC/C,KAAK,EAAE,oBAAoB;gBAC3B,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE,CAAC,OAA6B,EAAE,EAAE;oBACzC,OAAO,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAA;gBACzC,CAAC;aACF,CAAC,CAAA;SACH;IACH,CAAC;CACF;AAID,OAAO,EAAE,mBAAmB,IAAI,oCAAoC,EAAE,MAAM,qBAAqB,CAAA;AACjG,OAAO,EACL,QAAQ,EACR,6BAA6B,EAC7B,0BAA0B,EAC1B,iBAAiB,GAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAEL,mBAAmB,EAEnB,SAAS,GACV,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,QAAQ,GACT,MAAM,sDAAsD,CAAA;AAC7D,OAAO,EACL,YAAY,IAAI,qCAAqC,EACrD,YAAY,IAAI,8BAA8B,GAC/C,MAAM,sBAAsB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-linear-genome-view",
3
- "version": "2.3.4",
3
+ "version": "2.4.1",
4
4
  "description": "JBrowse 2 linear genome view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -47,7 +47,7 @@
47
47
  "clsx": "^1.0.4",
48
48
  "copy-to-clipboard": "^3.3.1",
49
49
  "file-saver": "^2.0.0",
50
- "material-ui-popup-state": "^3.0.0",
50
+ "material-ui-popup-state": "^5.0.0",
51
51
  "normalize-wheel": "^1.0.1",
52
52
  "react-error-boundary": "^3.0.0",
53
53
  "react-popper": "^2.0.0"
@@ -66,5 +66,5 @@
66
66
  "access": "public"
67
67
  },
68
68
  "module": "esm/index.js",
69
- "gitHead": "98ae48be91ee2371e1b2768a907b4997995e9915"
69
+ "gitHead": "747c50c4edc0184827efa4f8dfc576ca9a72caeb"
70
70
  }
@@ -6,8 +6,7 @@ import { getConf } from '@jbrowse/core/configuration'
6
6
  import { Menu } from '@jbrowse/core/ui'
7
7
 
8
8
  // locals
9
- import Tooltip from './Tooltip'
10
- import BlockMsg from './BlockMsg'
9
+
11
10
  import LinearBlocks from './LinearBlocks'
12
11
  import { BaseLinearDisplayModel } from '../models/BaseLinearDisplayModel'
13
12
 
@@ -113,4 +112,6 @@ const BaseLinearDisplay = observer(function (props: {
113
112
  })
114
113
 
115
114
  export default BaseLinearDisplay
116
- export { Tooltip, BlockMsg }
115
+
116
+ export { default as Tooltip } from './Tooltip'
117
+ export { default as BlockMsg } from './BlockMsg'
@@ -20,7 +20,7 @@ const useStyles = makeStyles()(theme => ({
20
20
  },
21
21
  interRegionPaddingBlock: {
22
22
  minHeight: '100%',
23
- backgroundColor: theme.palette.text.primary,
23
+ backgroundColor: theme.palette.text.disabled,
24
24
  },
25
25
  boundaryPaddingBlock: {
26
26
  minHeight: '100%',
@@ -10,18 +10,17 @@ import RefreshIcon from '@mui/icons-material/Refresh'
10
10
  // locals
11
11
  import BlockMsg from './BlockMsg'
12
12
 
13
- const useStyles = makeStyles()(theme => ({
14
- loading: {
15
- paddingLeft: '0.6em',
16
- backgroundColor: theme.palette.action.disabledBackground,
17
- backgroundImage:
18
- 'repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255,255,255,.5) 5px, rgba(255,255,255,.5) 10px)',
19
- height: '100%',
20
- width: '100%',
21
- pointerEvents: 'none',
22
- textAlign: 'center',
23
- },
24
- }))
13
+ const useStyles = makeStyles()(theme => {
14
+ const bg = theme.palette.action.disabledBackground
15
+ return {
16
+ loading: {
17
+ paddingLeft: '0.6em',
18
+ backgroundColor: theme.palette.background.default,
19
+ backgroundImage: `repeating-linear-gradient(45deg, transparent, transparent 5px, ${bg} 5px, ${bg} 10px)`,
20
+ textAlign: 'center',
21
+ },
22
+ }
23
+ })
25
24
 
26
25
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
26
  const LoadingMessage = observer(({ model }: { model: any }) => {
@@ -13,6 +13,7 @@ import {
13
13
  isSessionModelWithWidgets,
14
14
  isFeature,
15
15
  Feature,
16
+ ReactRendering,
16
17
  } from '@jbrowse/core/util'
17
18
  import { Stats } from '@jbrowse/core/data_adapters/BaseAdapter'
18
19
  import { BaseBlock } from '@jbrowse/core/util/blockTypes'
@@ -33,6 +34,7 @@ import { LinearGenomeViewModel, ExportSvgOptions } from '../../LinearGenomeView'
33
34
  import { Tooltip } from '../components/BaseLinearDisplay'
34
35
  import TooLargeMessage from '../components/TooLargeMessage'
35
36
  import BlockState, { renderBlockData } from './serverSideRenderedBlock'
37
+ import { ThemeOptions } from '@mui/material'
36
38
 
37
39
  type LGV = LinearGenomeViewModel
38
40
 
@@ -55,9 +57,9 @@ type LayoutRecord = [number, number, number, number]
55
57
  function getDisplayStr(totalBytes: number) {
56
58
  let displayBp
57
59
  if (Math.floor(totalBytes / 1000000) > 0) {
58
- displayBp = `${parseFloat((totalBytes / 1000000).toPrecision(3))} Mb`
60
+ displayBp = `${Number.parseFloat((totalBytes / 1000000).toPrecision(3))} Mb`
59
61
  } else if (Math.floor(totalBytes / 1000) > 0) {
60
- displayBp = `${parseFloat((totalBytes / 1000).toPrecision(3))} Kb`
62
+ displayBp = `${Number.parseFloat((totalBytes / 1000).toPrecision(3))} Kb`
61
63
  } else {
62
64
  displayBp = `${Math.floor(totalBytes)} bytes`
63
65
  }
@@ -65,7 +67,6 @@ function getDisplayStr(totalBytes: number) {
65
67
  }
66
68
 
67
69
  const minDisplayHeight = 20
68
- const defaultDisplayHeight = 100
69
70
 
70
71
  /**
71
72
  * #stateModel BaseLinearDisplay
@@ -80,13 +81,12 @@ function stateModelFactory() {
80
81
  /**
81
82
  * #property
82
83
  */
83
- height: types.optional(
84
+ heightPreConfig: types.maybe(
84
85
  types.refinement(
85
86
  'displayHeight',
86
87
  types.number,
87
88
  n => n >= minDisplayHeight,
88
89
  ),
89
- defaultDisplayHeight,
90
90
  ),
91
91
  /**
92
92
  * #property
@@ -113,6 +113,9 @@ function stateModelFactory() {
113
113
  estimatedRegionStats: undefined as undefined | Stats,
114
114
  }))
115
115
  .views(self => ({
116
+ get height() {
117
+ return self.heightPreConfig ?? (getConf(self, 'height') as number)
118
+ },
116
119
  /**
117
120
  * #getter
118
121
  */
@@ -364,11 +367,8 @@ function stateModelFactory() {
364
367
  * #action
365
368
  */
366
369
  setHeight(displayHeight: number) {
367
- if (displayHeight > minDisplayHeight) {
368
- self.height = displayHeight
369
- } else {
370
- self.height = minDisplayHeight
371
- }
370
+ self.heightPreConfig =
371
+ displayHeight > minDisplayHeight ? displayHeight : minDisplayHeight
372
372
  return self.height
373
373
  },
374
374
  /**
@@ -657,7 +657,7 @@ function stateModelFactory() {
657
657
  renderProps() {
658
658
  const view = getContainingView(self) as LGV
659
659
  return {
660
- ...(getParentRenderProps(self) as any),
660
+ ...getParentRenderProps(self),
661
661
  notReady:
662
662
  self.currBpPerPx !== view.bpPerPx || !self.estimatedRegionStats,
663
663
  rpcDriverName: self.rpcDriverName,
@@ -706,14 +706,19 @@ function stateModelFactory() {
706
706
  /**
707
707
  * #method
708
708
  */
709
- async renderSvg(opts: ExportSvgOptions & { overrideHeight: number }) {
709
+ async renderSvg(
710
+ opts: ExportSvgOptions & {
711
+ overrideHeight: number
712
+ theme: ThemeOptions
713
+ },
714
+ ) {
710
715
  const { height, id } = self
711
716
  const { overrideHeight } = opts
712
717
  const view = getContainingView(self) as LGV
713
718
  const { offsetPx: viewOffsetPx, roundedDynamicBlocks, width } = view
714
719
 
715
720
  const renderings = await Promise.all(
716
- roundedDynamicBlocks.map(block => {
721
+ roundedDynamicBlocks.map(async block => {
717
722
  const blockState = BlockState.create({
718
723
  key: block.key,
719
724
  region: block,
@@ -726,34 +731,41 @@ function stateModelFactory() {
726
731
  self.regionCannotBeRendered(block)
727
732
 
728
733
  if (cannotBeRenderedReason) {
729
- return {
730
- reactElement: (
731
- <>
732
- <rect x={0} y={0} width={width} height={20} fill="#aaa" />
733
- <text x={0} y={15}>
734
- {cannotBeRenderedReason}
735
- </text>
736
- </>
737
- ),
738
- }
734
+ return [
735
+ block,
736
+ {
737
+ reactElement: (
738
+ <>
739
+ <rect x={0} y={0} width={width} height={20} fill="#aaa" />
740
+ <text x={0} y={15}>
741
+ {cannotBeRenderedReason}
742
+ </text>
743
+ </>
744
+ ),
745
+ },
746
+ ] as const
739
747
  }
740
748
 
741
749
  const { rpcManager, renderArgs, renderProps, rendererType } =
742
750
  renderBlockData(blockState, self)
743
751
 
744
- return rendererType.renderInClient(rpcManager, {
745
- ...renderArgs,
746
- ...renderProps,
747
- viewParams: getViewParams(self, true),
748
- exportSVG: opts,
749
- })
752
+ return [
753
+ block,
754
+ await rendererType.renderInClient(rpcManager, {
755
+ ...renderArgs,
756
+ ...renderProps,
757
+ viewParams: getViewParams(self, true),
758
+ exportSVG: opts,
759
+ theme: opts.theme || renderProps.theme,
760
+ }),
761
+ ] as const
750
762
  }),
751
763
  )
752
764
 
753
765
  return (
754
766
  <>
755
- {renderings.map((rendering, index) => {
756
- const { offsetPx } = roundedDynamicBlocks[index]
767
+ {renderings.map(([block, rendering], index) => {
768
+ const { offsetPx, widthPx } = block
757
769
  const offset = offsetPx - viewOffsetPx
758
770
  const clipid = getId(id, index)
759
771
 
@@ -764,21 +776,14 @@ function stateModelFactory() {
764
776
  <rect
765
777
  x={0}
766
778
  y={0}
767
- width={width}
779
+ width={widthPx}
768
780
  height={overrideHeight || height}
769
781
  />
770
782
  </clipPath>
771
783
  </defs>
772
784
  <g transform={`translate(${offset} 0)`}>
773
785
  <g clipPath={`url(#${clipid})`}>
774
- {React.isValidElement(rendering.reactElement) ? (
775
- rendering.reactElement
776
- ) : (
777
- <g
778
- /* eslint-disable-next-line react/no-danger */
779
- dangerouslySetInnerHTML={{ __html: rendering.html }}
780
- />
781
- )}
786
+ <ReactRendering rendering={rendering} />
782
787
  </g>
783
788
  </g>
784
789
  </React.Fragment>
@@ -788,6 +793,16 @@ function stateModelFactory() {
788
793
  )
789
794
  },
790
795
  }))
796
+ .preProcessSnapshot(snap => {
797
+ if (!snap) {
798
+ return snap
799
+ }
800
+ // rewrite "height" from older snapshots to "heightPreConfig", this allows
801
+ // us to maintain a height "getter" going forward
802
+ // @ts-expect-error
803
+ const { height, ...rest } = snap
804
+ return { heightPreConfig: height, ...rest }
805
+ })
791
806
  .postProcessSnapshot(self => {
792
807
  // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
793
808
  const r = self as Omit<typeof self, symbol>
@@ -29,6 +29,14 @@ const baseLinearDisplayConfigSchema = ConfigurationSchema(
29
29
  description:
30
30
  "maximum data to attempt to download for a given track, used if adapter doesn't specify one",
31
31
  },
32
+ /**
33
+ * #slot
34
+ */
35
+ height: {
36
+ type: 'number',
37
+ defaultValue: 100,
38
+ description: 'default height for the track',
39
+ },
32
40
  },
33
41
  {
34
42
  /**
@@ -29,6 +29,7 @@ import {
29
29
  getRpcSessionId,
30
30
  } from '@jbrowse/core/util/tracks'
31
31
 
32
+ // locals
32
33
  import ServerSideRenderedBlockContent from '../components/ServerSideRenderedBlockContent'
33
34
 
34
35
  // the MST state of a single server-side-rendered block in a display
@@ -65,7 +66,7 @@ const blockState = types
65
66
  makeAbortableReaction(
66
67
  self as any,
67
68
  renderBlockData,
68
- renderBlockEffect as any, // reaction doesn't expect async here
69
+ renderBlockEffect, // reaction doesn't expect async here
69
70
  {
70
71
  name: `${display.id}/${assembleLocString(self.region)} rendering`,
71
72
  delay: display.renderDelay,
@@ -80,10 +81,11 @@ const blockState = types
80
81
  self.status = message
81
82
  },
82
83
  setLoading(abortController: AbortController) {
83
- if (renderInProgress !== undefined) {
84
- if (!renderInProgress.signal.aborted) {
85
- renderInProgress.abort()
86
- }
84
+ if (
85
+ renderInProgress !== undefined &&
86
+ !renderInProgress.signal.aborted
87
+ ) {
88
+ renderInProgress.abort()
87
89
  }
88
90
  self.filled = false
89
91
  self.message = undefined
@@ -140,7 +142,7 @@ const blockState = types
140
142
  self.renderProps = renderProps
141
143
  renderInProgress = undefined
142
144
  },
143
- setError(error: Error | unknown) {
145
+ setError(error: unknown) {
144
146
  console.error(error)
145
147
  if (renderInProgress && !renderInProgress.signal.aborted) {
146
148
  renderInProgress.abort()
@@ -214,7 +216,7 @@ export function renderBlockData(
214
216
  const regionAsm = self.region.assemblyName
215
217
  if (
216
218
  !assemblyNames.includes(regionAsm) &&
217
- !assemblyNames.find(name => assemblyManager.get(name)?.hasName(regionAsm))
219
+ !assemblyNames.some(name => assemblyManager.get(name)?.hasName(regionAsm))
218
220
  ) {
219
221
  throw new Error(
220
222
  `region assembly (${regionAsm}) does not match track assemblies (${assemblyNames})`,
@@ -260,24 +262,14 @@ export function renderBlockData(
260
262
  }
261
263
  }
262
264
 
263
- interface RenderProps {
264
- displayError: Error
265
- rendererType: any
266
- renderProps: { [key: string]: any }
267
- rpcManager: { call: Function }
268
- cannotBeRenderedReason: string
269
- renderArgs: { [key: string]: any }
270
- }
271
-
272
- interface ErrorProps {
273
- displayError: string
274
- }
275
-
276
265
  async function renderBlockEffect(
277
- props: RenderProps | ErrorProps,
266
+ props: ReturnType<typeof renderBlockData> | undefined,
278
267
  signal: AbortSignal,
279
268
  self: BlockModel,
280
269
  ) {
270
+ if (!props) {
271
+ return
272
+ }
281
273
  const {
282
274
  rendererType,
283
275
  renderProps,
@@ -285,7 +277,7 @@ async function renderBlockEffect(
285
277
  renderArgs,
286
278
  cannotBeRenderedReason,
287
279
  displayError,
288
- } = props as RenderProps
280
+ } = props
289
281
  if (!isAlive(self)) {
290
282
  return undefined
291
283
  }
@@ -315,5 +307,6 @@ async function renderBlockEffect(
315
307
  features,
316
308
  layout,
317
309
  maxHeightReached,
310
+ renderProps,
318
311
  }
319
312
  }
@@ -14,9 +14,9 @@ export interface ErrorProps {
14
14
  export function getDisplayStr(totalBytes: number) {
15
15
  let displayBp
16
16
  if (Math.floor(totalBytes / 1000000) > 0) {
17
- displayBp = `${parseFloat((totalBytes / 1000000).toPrecision(3))} Mb`
17
+ displayBp = `${Number.parseFloat((totalBytes / 1000000).toPrecision(3))} Mb`
18
18
  } else if (Math.floor(totalBytes / 1000) > 0) {
19
- displayBp = `${parseFloat((totalBytes / 1000).toPrecision(3))} Kb`
19
+ displayBp = `${Number.parseFloat((totalBytes / 1000).toPrecision(3))} Kb`
20
20
  } else {
21
21
  displayBp = `${Math.floor(totalBytes)} bytes`
22
22
  }
@@ -7,7 +7,7 @@ type LGV = LinearGenomeViewModel
7
7
  export default (pluginManager: PluginManager) => {
8
8
  pluginManager.addToExtensionPoint(
9
9
  'LaunchView-LinearGenomeView',
10
- // @ts-ignore
10
+ // @ts-expect-error
11
11
  async ({
12
12
  session,
13
13
  assembly,
@@ -20,4 +20,5 @@ export default (pluginManager: PluginManager) => {
20
20
  })
21
21
  }
22
22
 
23
- export { configSchemaFactory, stateModelFactory }
23
+ export { configSchemaFactory } from './configSchema'
24
+ export { stateModelFactory } from './model'
@@ -21,4 +21,5 @@ export default (pluginManager: PluginManager) => {
21
21
  })
22
22
  }
23
23
 
24
- export { modelFactory, configSchema }
24
+ export { default as modelFactory } from './model'
25
+ export { default as configSchema } from './configSchema'
@@ -5,13 +5,13 @@ import { LinearGenomeViewModel } from '..'
5
5
 
6
6
  type LGV = LinearGenomeViewModel
7
7
 
8
- const useStyles = makeStyles()(() => ({
8
+ const useStyles = makeStyles()(theme => ({
9
9
  centerLineContainer: {
10
10
  background: 'transparent',
11
11
  height: '100%',
12
12
  zIndex: 5, // above the track but under menu
13
13
  position: 'absolute',
14
- border: '1px black dashed',
14
+ border: `1px ${theme.palette.action.active} dashed`,
15
15
  borderTop: 'none',
16
16
  borderBottom: 'none',
17
17
  pointerEvents: 'none',
@@ -0,0 +1,154 @@
1
+ import React from 'react'
2
+ import { observer } from 'mobx-react'
3
+
4
+ // core
5
+ import { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel'
6
+ import { ContentBlock } from '@jbrowse/core/util/blockTypes'
7
+ import { Assembly } from '@jbrowse/core/assemblyManager/assembly'
8
+
9
+ // locals
10
+ import { HEADER_OVERVIEW_HEIGHT } from '..'
11
+ import { getCytobands } from './util'
12
+
13
+ // rounded rect from https://stackoverflow.com/a/45889603/2129219
14
+ // prettier-ignore
15
+ function rightRoundedRect(x: number, y: number, width: number, height: number, radius: number) {
16
+ return "M" + x + "," + y
17
+ + "h" + (width - radius)
18
+ + "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius
19
+ + "v" + (height - 2 * radius)
20
+ + "a" + radius + "," + radius + " 0 0 1 " + -radius + "," + radius
21
+ + "h" + (radius - width)
22
+ + "z";
23
+ }
24
+
25
+ // prettier-ignore
26
+ function leftRoundedRect(x: number, y: number, width: number, height: number, radius: number ) {
27
+ return "M" + (x + radius) + "," + y
28
+ + "h" + (width - radius)
29
+ + "v" + height
30
+ + "h" + (radius - width)
31
+ + "a" + radius + "," + radius + " 0 0 1 " + (-radius) + "," + (-radius)
32
+ + "v" + (2 * radius - height)
33
+ + "a" + radius + "," + radius + " 0 0 1 " + radius + "," + (-radius)
34
+ + "z";
35
+ }
36
+
37
+ const colorMap: { [key: string]: string | undefined } = {
38
+ gneg: 'rgb(227,227,227)',
39
+ gpos25: 'rgb(142,142,142)',
40
+ gpos50: 'rgb(85,85,85)',
41
+ gpos100: 'rgb(0,0,0)',
42
+ gpos75: 'rgb(57,57,57)',
43
+ gvar: 'rgb(0,0,0)',
44
+ stalk: 'rgb(127,127,127)',
45
+ acen: '#800',
46
+ }
47
+
48
+ export default observer(function Cytobands({
49
+ overview,
50
+ block,
51
+ assembly,
52
+ }: {
53
+ overview: Base1DViewModel
54
+ assembly?: Assembly
55
+ block: ContentBlock
56
+ }) {
57
+ const { offsetPx, reversed } = block
58
+ const cytobands = getCytobands(assembly, block.refName)
59
+ const coords = cytobands.map(f => {
60
+ const { refName, start, end, type } = f
61
+ return [
62
+ overview.bpToPx({
63
+ refName,
64
+ coord: start,
65
+ }),
66
+ overview.bpToPx({
67
+ refName,
68
+ coord: end,
69
+ }),
70
+ type,
71
+ ]
72
+ })
73
+
74
+ const arr = cytobands || []
75
+ const lcap = reversed ? arr.length - 1 : 0
76
+ const rcap = reversed ? 0 : arr.length - 1
77
+
78
+ let firstCent = true
79
+ return (
80
+ <g transform={`translate(-${offsetPx})`}>
81
+ {coords.map(([start, end, type], index) => {
82
+ const key = `${start}-${end}-${type}`
83
+ if (type === 'acen' && firstCent) {
84
+ firstCent = false
85
+ return (
86
+ <polygon
87
+ key={key}
88
+ points={[
89
+ [start, 0],
90
+ [end, HEADER_OVERVIEW_HEIGHT / 2],
91
+ [start, HEADER_OVERVIEW_HEIGHT],
92
+ ].toString()}
93
+ fill={colorMap[type]}
94
+ />
95
+ )
96
+ }
97
+ if (type === 'acen' && !firstCent) {
98
+ return (
99
+ <polygon
100
+ key={key}
101
+ points={[
102
+ [start, HEADER_OVERVIEW_HEIGHT / 2],
103
+ [end, 0],
104
+ [end, HEADER_OVERVIEW_HEIGHT],
105
+ ].toString()}
106
+ fill={colorMap[type]}
107
+ />
108
+ )
109
+ }
110
+
111
+ if (lcap === index) {
112
+ return (
113
+ <path
114
+ key={key}
115
+ d={leftRoundedRect(
116
+ Math.min(start, end),
117
+ 0,
118
+ Math.abs(end - start),
119
+ HEADER_OVERVIEW_HEIGHT,
120
+ 8,
121
+ )}
122
+ fill={colorMap[type]}
123
+ />
124
+ )
125
+ } else if (rcap === index) {
126
+ return (
127
+ <path
128
+ key={key}
129
+ d={rightRoundedRect(
130
+ Math.min(start, end),
131
+ 0,
132
+ Math.abs(end - start) - 2,
133
+ HEADER_OVERVIEW_HEIGHT,
134
+ 8,
135
+ )}
136
+ fill={colorMap[type]}
137
+ />
138
+ )
139
+ } else {
140
+ return (
141
+ <rect
142
+ key={key}
143
+ x={Math.min(start, end)}
144
+ y={0}
145
+ width={Math.abs(end - start)}
146
+ height={HEADER_OVERVIEW_HEIGHT}
147
+ fill={colorMap[type]}
148
+ />
149
+ )
150
+ }
151
+ })}
152
+ </g>
153
+ )
154
+ })