@jbrowse/plugin-linear-genome-view 4.3.0 → 5.0.0-beta.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.
Files changed (357) hide show
  1. package/esm/FeatureTrack/configSchema.d.ts +104 -65
  2. package/esm/FeatureTrack/configSchema.js +47 -1
  3. package/esm/FeatureTrack/index.js +1 -1
  4. package/esm/LaunchLinearGenomeView/index.d.ts +14 -0
  5. package/esm/LaunchLinearGenomeView/index.js +6 -12
  6. package/esm/LinearGenomeView/afterAttach.d.ts +20 -2
  7. package/esm/LinearGenomeView/afterAttach.js +250 -121
  8. package/esm/LinearGenomeView/components/CenterLine.d.ts +1 -1
  9. package/esm/LinearGenomeView/components/CenterLine.js +16 -7
  10. package/esm/LinearGenomeView/components/ConnectedHoverHighlight.d.ts +7 -0
  11. package/esm/LinearGenomeView/components/ConnectedHoverHighlight.js +22 -0
  12. package/esm/LinearGenomeView/components/CrisprGuidePanel.d.ts +3 -0
  13. package/esm/LinearGenomeView/components/CrisprGuidePanel.js +144 -0
  14. package/esm/LinearGenomeView/components/Cytobands.d.ts +6 -6
  15. package/esm/LinearGenomeView/components/Cytobands.js +76 -53
  16. package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +7 -3
  17. package/esm/LinearGenomeView/components/ExportSvgDialog.js +11 -67
  18. package/esm/LinearGenomeView/components/GetSequenceDialog.d.ts +5 -9
  19. package/esm/LinearGenomeView/components/GetSequenceDialog.js +84 -88
  20. package/esm/LinearGenomeView/components/Gridlines.d.ts +1 -1
  21. package/esm/LinearGenomeView/components/Gridlines.js +29 -58
  22. package/esm/LinearGenomeView/components/Header.d.ts +1 -1
  23. package/esm/LinearGenomeView/components/Header.js +32 -16
  24. package/esm/LinearGenomeView/components/HeaderClearHighlightButton.d.ts +21 -0
  25. package/esm/LinearGenomeView/components/HeaderClearHighlightButton.js +35 -0
  26. package/esm/LinearGenomeView/components/HeaderPanControls.d.ts +3 -2
  27. package/esm/LinearGenomeView/components/HeaderPanControls.js +16 -7
  28. package/esm/LinearGenomeView/components/HeaderRegionWidth.d.ts +1 -1
  29. package/esm/LinearGenomeView/components/HeaderRegionWidth.js +9 -6
  30. package/esm/LinearGenomeView/components/HeaderSearchBoxRow.d.ts +6 -0
  31. package/esm/LinearGenomeView/components/HeaderSearchBoxRow.js +27 -0
  32. package/esm/LinearGenomeView/components/HeaderSearchBoxes.d.ts +5 -0
  33. package/esm/LinearGenomeView/components/HeaderSearchBoxes.js +28 -0
  34. package/esm/LinearGenomeView/components/HeaderTrackSelectorButton.d.ts +3 -2
  35. package/esm/LinearGenomeView/components/HeaderTrackSelectorButton.js +11 -4
  36. package/esm/LinearGenomeView/components/HeaderZoomControls.d.ts +3 -2
  37. package/esm/LinearGenomeView/components/HeaderZoomControls.js +67 -51
  38. package/esm/LinearGenomeView/components/Highlight.d.ts +1 -1
  39. package/esm/LinearGenomeView/components/Highlight.js +19 -23
  40. package/esm/LinearGenomeView/components/HighlightBand.d.ts +3 -2
  41. package/esm/LinearGenomeView/components/HighlightBand.js +25 -8
  42. package/esm/LinearGenomeView/components/HighlightChip.d.ts +9 -0
  43. package/esm/LinearGenomeView/components/HighlightChip.js +15 -0
  44. package/esm/LinearGenomeView/components/HoverPositionHighlight.d.ts +12 -0
  45. package/esm/LinearGenomeView/components/HoverPositionHighlight.js +25 -0
  46. package/esm/LinearGenomeView/components/ImportForm.d.ts +3 -4
  47. package/esm/LinearGenomeView/components/ImportForm.js +95 -61
  48. package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +1 -1
  49. package/esm/LinearGenomeView/components/LinearGenomeView.js +6 -5
  50. package/esm/LinearGenomeView/components/LinearGenomeViewContainer.d.ts +1 -1
  51. package/esm/LinearGenomeView/components/LinearGenomeViewContainer.js +89 -30
  52. package/esm/LinearGenomeView/components/MiniControls.d.ts +1 -1
  53. package/esm/LinearGenomeView/components/MiniControls.js +13 -10
  54. package/esm/LinearGenomeView/components/MotifListPanel.d.ts +3 -0
  55. package/esm/LinearGenomeView/components/MotifListPanel.js +59 -0
  56. package/esm/LinearGenomeView/components/NavigationAnnouncer.d.ts +32 -0
  57. package/esm/LinearGenomeView/components/NavigationAnnouncer.js +51 -0
  58. package/esm/LinearGenomeView/components/NoTracksActiveButton.d.ts +1 -1
  59. package/esm/LinearGenomeView/components/NoTracksActiveButton.js +1 -1
  60. package/esm/LinearGenomeView/components/OverviewHighlight.d.ts +2 -4
  61. package/esm/LinearGenomeView/components/OverviewHighlight.js +23 -44
  62. package/esm/LinearGenomeView/components/OverviewHighlightBand.d.ts +9 -0
  63. package/esm/LinearGenomeView/components/OverviewHighlightBand.js +26 -0
  64. package/esm/LinearGenomeView/components/OverviewRubberband.d.ts +3 -3
  65. package/esm/LinearGenomeView/components/OverviewRubberband.js +44 -57
  66. package/esm/LinearGenomeView/components/OverviewRubberbandHoverTooltip.d.ts +4 -5
  67. package/esm/LinearGenomeView/components/OverviewRubberbandHoverTooltip.js +13 -20
  68. package/esm/LinearGenomeView/components/OverviewScalebar.d.ts +3 -2
  69. package/esm/LinearGenomeView/components/OverviewScalebar.js +84 -79
  70. package/esm/LinearGenomeView/components/OverviewScalebarPolygon.d.ts +19 -5
  71. package/esm/LinearGenomeView/components/OverviewScalebarPolygon.js +55 -32
  72. package/esm/LinearGenomeView/components/OverviewScalebarTickLabels.d.ts +4 -5
  73. package/esm/LinearGenomeView/components/OverviewScalebarTickLabels.js +16 -18
  74. package/esm/LinearGenomeView/components/PaddingBlocks.d.ts +7 -0
  75. package/esm/LinearGenomeView/components/PaddingBlocks.js +61 -0
  76. package/esm/LinearGenomeView/components/RangeSelectOverlay.d.ts +9 -0
  77. package/esm/LinearGenomeView/components/RangeSelectOverlay.js +20 -0
  78. package/esm/LinearGenomeView/components/RegionWidthEditorDialog.d.ts +2 -3
  79. package/esm/LinearGenomeView/components/RegionWidthEditorDialog.js +19 -26
  80. package/esm/LinearGenomeView/components/Rubberband.d.ts +1 -1
  81. package/esm/LinearGenomeView/components/Rubberband.js +13 -16
  82. package/esm/LinearGenomeView/components/SVGHighlightBand.d.ts +10 -0
  83. package/esm/LinearGenomeView/components/SVGHighlightBand.js +9 -0
  84. package/esm/LinearGenomeView/components/Scalebar.d.ts +2 -2
  85. package/esm/LinearGenomeView/components/Scalebar.js +16 -21
  86. package/esm/LinearGenomeView/components/ScalebarCoordinateLabels.d.ts +1 -1
  87. package/esm/LinearGenomeView/components/ScalebarCoordinateLabels.js +54 -35
  88. package/esm/LinearGenomeView/components/ScalebarRefNameLabels.d.ts +1 -1
  89. package/esm/LinearGenomeView/components/ScalebarRefNameLabels.js +142 -126
  90. package/esm/LinearGenomeView/components/SearchBox.d.ts +22 -2
  91. package/esm/LinearGenomeView/components/SearchBox.js +58 -66
  92. package/esm/LinearGenomeView/components/SearchPanelForm.d.ts +9 -0
  93. package/esm/LinearGenomeView/components/SearchPanelForm.js +18 -0
  94. package/esm/LinearGenomeView/components/SearchResultsDialog.d.ts +3 -3
  95. package/esm/LinearGenomeView/components/SearchResultsDialog.js +5 -7
  96. package/esm/LinearGenomeView/components/SearchResultsTable.d.ts +4 -3
  97. package/esm/LinearGenomeView/components/SearchResultsTable.js +45 -53
  98. package/esm/LinearGenomeView/components/SequenceFeatureHoverHighlight.d.ts +5 -0
  99. package/esm/LinearGenomeView/components/SequenceFeatureHoverHighlight.js +37 -0
  100. package/esm/LinearGenomeView/components/SequenceFeatureHoverHighlightExtension.d.ts +2 -0
  101. package/esm/LinearGenomeView/components/SequenceFeatureHoverHighlightExtension.js +5 -0
  102. package/esm/LinearGenomeView/components/SequencePatternPanel.d.ts +3 -0
  103. package/esm/LinearGenomeView/components/SequencePatternPanel.js +42 -0
  104. package/esm/LinearGenomeView/components/SequenceSearchDialog.d.ts +2 -2
  105. package/esm/LinearGenomeView/components/SequenceSearchDialog.js +31 -53
  106. package/esm/LinearGenomeView/components/StrandCheckboxes.d.ts +8 -0
  107. package/esm/LinearGenomeView/components/StrandCheckboxes.js +13 -0
  108. package/esm/LinearGenomeView/components/TrackContainer.d.ts +1 -1
  109. package/esm/LinearGenomeView/components/TrackContainer.js +83 -39
  110. package/esm/LinearGenomeView/components/TrackLabel.d.ts +2 -3
  111. package/esm/LinearGenomeView/components/TrackLabel.js +11 -24
  112. package/esm/LinearGenomeView/components/TrackLabelButtons.d.ts +7 -0
  113. package/esm/LinearGenomeView/components/TrackLabelButtons.js +33 -0
  114. package/esm/LinearGenomeView/components/TrackLabelDragHandle.d.ts +2 -5
  115. package/esm/LinearGenomeView/components/TrackLabelDragHandle.js +6 -2
  116. package/esm/LinearGenomeView/components/TrackLabelMenu.d.ts +1 -1
  117. package/esm/LinearGenomeView/components/TrackLabelMenu.js +32 -85
  118. package/esm/LinearGenomeView/components/TrackLabelRefNameWarning.d.ts +22 -0
  119. package/esm/LinearGenomeView/components/TrackLabelRefNameWarning.js +46 -0
  120. package/esm/LinearGenomeView/components/TrackRenderingContainer.d.ts +1 -1
  121. package/esm/LinearGenomeView/components/TrackRenderingContainer.js +72 -18
  122. package/esm/LinearGenomeView/components/TracksContainer.d.ts +1 -1
  123. package/esm/LinearGenomeView/components/TracksContainer.js +65 -32
  124. package/esm/LinearGenomeView/components/VerticalGuide.d.ts +1 -1
  125. package/esm/LinearGenomeView/components/VerticalGuide.js +6 -13
  126. package/esm/LinearGenomeView/components/ZoomButton.d.ts +7 -0
  127. package/esm/LinearGenomeView/components/ZoomButton.js +27 -0
  128. package/esm/LinearGenomeView/components/ZoomTransform.d.ts +9 -0
  129. package/esm/LinearGenomeView/components/ZoomTransform.js +37 -0
  130. package/esm/LinearGenomeView/components/defaultMotifs.d.ts +1 -0
  131. package/esm/LinearGenomeView/components/defaultMotifs.js +22 -0
  132. package/esm/LinearGenomeView/components/fetchSequence.d.ts +7 -8
  133. package/esm/LinearGenomeView/components/fetchSequence.js +17 -9
  134. package/esm/LinearGenomeView/components/recentLocationsMenu.d.ts +15 -0
  135. package/esm/LinearGenomeView/components/recentLocationsMenu.js +36 -0
  136. package/esm/LinearGenomeView/components/searchModes.d.ts +13 -0
  137. package/esm/LinearGenomeView/components/searchModes.js +22 -0
  138. package/esm/LinearGenomeView/components/trackLabelMenuItems.d.ts +7 -0
  139. package/esm/LinearGenomeView/components/trackLabelMenuItems.js +67 -0
  140. package/esm/LinearGenomeView/components/useRangeSelect.d.ts +11 -66
  141. package/esm/LinearGenomeView/components/useRangeSelect.js +82 -91
  142. package/esm/LinearGenomeView/components/useSearchBoxPrefs.d.ts +26 -0
  143. package/esm/LinearGenomeView/components/useSearchBoxPrefs.js +58 -0
  144. package/esm/LinearGenomeView/components/useSideScroll.d.ts +1 -1
  145. package/esm/LinearGenomeView/components/useSideScroll.js +87 -19
  146. package/esm/LinearGenomeView/components/util.d.ts +20 -6
  147. package/esm/LinearGenomeView/components/util.js +27 -6
  148. package/esm/LinearGenomeView/consts.d.ts +7 -2
  149. package/esm/LinearGenomeView/consts.js +18 -2
  150. package/esm/LinearGenomeView/flyTo.d.ts +38 -0
  151. package/esm/LinearGenomeView/flyTo.js +135 -0
  152. package/esm/LinearGenomeView/headerFit.d.ts +27 -0
  153. package/esm/LinearGenomeView/headerFit.js +59 -0
  154. package/esm/LinearGenomeView/index.d.ts +32 -2
  155. package/esm/LinearGenomeView/index.js +16 -6
  156. package/esm/LinearGenomeView/initKeys.d.ts +12 -0
  157. package/esm/LinearGenomeView/initKeys.js +68 -0
  158. package/esm/LinearGenomeView/keyboardHandler.d.ts +7 -0
  159. package/esm/LinearGenomeView/keyboardHandler.js +10 -0
  160. package/esm/LinearGenomeView/launchKeys.d.ts +2 -0
  161. package/esm/LinearGenomeView/launchKeys.js +23 -0
  162. package/esm/LinearGenomeView/lazyDialogs.d.ts +7 -11
  163. package/esm/LinearGenomeView/lazyDialogs.js +3 -3
  164. package/esm/LinearGenomeView/linkedViewSync.d.ts +20 -0
  165. package/esm/LinearGenomeView/linkedViewSync.js +58 -0
  166. package/esm/LinearGenomeView/menuItems.d.ts +27 -2
  167. package/esm/LinearGenomeView/menuItems.js +137 -101
  168. package/esm/LinearGenomeView/model.d.ts +3238 -136
  169. package/esm/LinearGenomeView/model.js +2425 -528
  170. package/esm/LinearGenomeView/sharedScaleContainer.d.ts +18 -0
  171. package/esm/LinearGenomeView/sharedScaleContainer.js +17 -0
  172. package/esm/LinearGenomeView/showRegionsWithUndo.d.ts +35 -0
  173. package/esm/LinearGenomeView/showRegionsWithUndo.js +44 -0
  174. package/esm/LinearGenomeView/stickyChrome.d.ts +19 -0
  175. package/esm/LinearGenomeView/stickyChrome.js +30 -0
  176. package/esm/LinearGenomeView/svgcomponents/SVGGridlines.d.ts +1 -1
  177. package/esm/LinearGenomeView/svgcomponents/SVGGridlines.js +15 -16
  178. package/esm/LinearGenomeView/svgcomponents/SVGHeader.d.ts +2 -3
  179. package/esm/LinearGenomeView/svgcomponents/SVGHeader.js +45 -33
  180. package/esm/LinearGenomeView/svgcomponents/SVGHighlights.d.ts +5 -0
  181. package/esm/LinearGenomeView/svgcomponents/SVGHighlights.js +26 -0
  182. package/esm/LinearGenomeView/svgcomponents/SVGHighlightsOverlay.d.ts +5 -0
  183. package/esm/LinearGenomeView/svgcomponents/SVGHighlightsOverlay.js +13 -0
  184. package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.d.ts +1 -3
  185. package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +77 -41
  186. package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +1 -1
  187. package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.js +23 -3
  188. package/esm/LinearGenomeView/svgcomponents/SVGRowHeader.d.ts +8 -0
  189. package/esm/LinearGenomeView/svgcomponents/SVGRowHeader.js +37 -0
  190. package/esm/LinearGenomeView/svgcomponents/SVGRuler.d.ts +3 -3
  191. package/esm/LinearGenomeView/svgcomponents/SVGRuler.js +64 -36
  192. package/esm/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +1 -1
  193. package/esm/LinearGenomeView/svgcomponents/SVGScalebar.js +7 -5
  194. package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.d.ts +5 -3
  195. package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.js +43 -7
  196. package/esm/LinearGenomeView/svgcomponents/SVGTracks.d.ts +8 -14
  197. package/esm/LinearGenomeView/svgcomponents/SVGTracks.js +16 -21
  198. package/esm/LinearGenomeView/svgcomponents/SVGView.d.ts +18 -0
  199. package/esm/LinearGenomeView/svgcomponents/SVGView.js +13 -0
  200. package/esm/LinearGenomeView/svgcomponents/figureContract.d.ts +45 -0
  201. package/esm/LinearGenomeView/svgcomponents/figureContract.js +130 -0
  202. package/esm/LinearGenomeView/svgcomponents/renderViewTracks.d.ts +76 -0
  203. package/esm/LinearGenomeView/svgcomponents/renderViewTracks.js +66 -0
  204. package/esm/LinearGenomeView/svgcomponents/useViewSvgFigure.d.ts +70 -0
  205. package/esm/LinearGenomeView/svgcomponents/useViewSvgFigure.js +263 -0
  206. package/esm/LinearGenomeView/svgcomponents/util.d.ts +92 -5
  207. package/esm/LinearGenomeView/svgcomponents/util.js +236 -3
  208. package/esm/LinearGenomeView/types.d.ts +17 -31
  209. package/esm/LinearGenomeView/types.js +1 -0
  210. package/esm/LinearGenomeView/util.d.ts +332 -12
  211. package/esm/LinearGenomeView/util.js +606 -62
  212. package/esm/MultiLevelRubberband/MultiLevelRubberband.d.ts +6 -0
  213. package/esm/MultiLevelRubberband/MultiLevelRubberband.js +37 -0
  214. package/esm/MultiLevelRubberband/VerticalGuide.d.ts +6 -0
  215. package/esm/MultiLevelRubberband/VerticalGuide.js +21 -0
  216. package/esm/MultiLevelRubberband/index.d.ts +2 -0
  217. package/esm/MultiLevelRubberband/index.js +1 -0
  218. package/esm/MultiLevelRubberband/types.d.ts +6 -0
  219. package/esm/MultiLevelRubberband/useRangeSelect.d.ts +24 -0
  220. package/esm/MultiLevelRubberband/useRangeSelect.js +136 -0
  221. package/esm/displayKitTests/perRegionTestEnv.d.ts +1286 -0
  222. package/esm/displayKitTests/perRegionTestEnv.js +138 -0
  223. package/esm/index.d.ts +122 -1235
  224. package/esm/index.js +101 -24
  225. package/esm/lazyPluginExports.d.ts +23 -0
  226. package/esm/lazyPluginExports.js +36 -0
  227. package/esm/searchUtils.d.ts +55 -11
  228. package/esm/searchUtils.js +342 -45
  229. package/esm/shared/RubberbandSpan.d.ts +15 -0
  230. package/esm/shared/RubberbandSpan.js +33 -0
  231. package/esm/shared/coordLabels.d.ts +40 -0
  232. package/esm/shared/coordLabels.js +119 -0
  233. package/package.json +18 -19
  234. package/esm/BaseLinearDisplay/SVGLegend.d.ts +0 -6
  235. package/esm/BaseLinearDisplay/SVGLegend.js +0 -17
  236. package/esm/BaseLinearDisplay/calculateSvgLegendWidth.d.ts +0 -2
  237. package/esm/BaseLinearDisplay/calculateSvgLegendWidth.js +0 -11
  238. package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +0 -8
  239. package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js +0 -53
  240. package/esm/BaseLinearDisplay/components/Block.d.ts +0 -14
  241. package/esm/BaseLinearDisplay/components/Block.js +0 -45
  242. package/esm/BaseLinearDisplay/components/BlockErrorMessage.d.ts +0 -7
  243. package/esm/BaseLinearDisplay/components/BlockErrorMessage.js +0 -22
  244. package/esm/BaseLinearDisplay/components/BlockMsg.d.ts +0 -6
  245. package/esm/BaseLinearDisplay/components/BlockMsg.js +0 -26
  246. package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/CollapseIntronsDialog.d.ts +0 -9
  247. package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/CollapseIntronsDialog.js +0 -42
  248. package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/TranscriptTable.d.ts +0 -11
  249. package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/TranscriptTable.js +0 -40
  250. package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/util.d.ts +0 -19
  251. package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/util.js +0 -45
  252. package/esm/BaseLinearDisplay/components/FloatingLabels.d.ts +0 -5
  253. package/esm/BaseLinearDisplay/components/FloatingLabels.js +0 -75
  254. package/esm/BaseLinearDisplay/components/FloatingLegend.d.ts +0 -8
  255. package/esm/BaseLinearDisplay/components/FloatingLegend.js +0 -43
  256. package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +0 -5
  257. package/esm/BaseLinearDisplay/components/LinearBlocks.js +0 -23
  258. package/esm/BaseLinearDisplay/components/LoadingOverlay.d.ts +0 -5
  259. package/esm/BaseLinearDisplay/components/LoadingOverlay.js +0 -49
  260. package/esm/BaseLinearDisplay/components/MaxHeightReachedIndicator.d.ts +0 -4
  261. package/esm/BaseLinearDisplay/components/MaxHeightReachedIndicator.js +0 -26
  262. package/esm/BaseLinearDisplay/components/MenuPage.d.ts +0 -8
  263. package/esm/BaseLinearDisplay/components/MenuPage.js +0 -24
  264. package/esm/BaseLinearDisplay/components/NonBlockCanvasDisplayComponent.d.ts +0 -21
  265. package/esm/BaseLinearDisplay/components/NonBlockCanvasDisplayComponent.js +0 -52
  266. package/esm/BaseLinearDisplay/components/RenderedBlocks.d.ts +0 -12
  267. package/esm/BaseLinearDisplay/components/RenderedBlocks.js +0 -22
  268. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.d.ts +0 -12
  269. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +0 -18
  270. package/esm/BaseLinearDisplay/components/TooLargeMessage.d.ts +0 -10
  271. package/esm/BaseLinearDisplay/components/TooLargeMessage.js +0 -20
  272. package/esm/BaseLinearDisplay/components/Tooltip.d.ts +0 -13
  273. package/esm/BaseLinearDisplay/components/Tooltip.js +0 -22
  274. package/esm/BaseLinearDisplay/components/types.d.ts +0 -1
  275. package/esm/BaseLinearDisplay/components/util.d.ts +0 -21
  276. package/esm/BaseLinearDisplay/components/util.js +0 -107
  277. package/esm/BaseLinearDisplay/index.d.ts +0 -17
  278. package/esm/BaseLinearDisplay/index.js +0 -13
  279. package/esm/BaseLinearDisplay/model.d.ts +0 -1197
  280. package/esm/BaseLinearDisplay/model.js +0 -432
  281. package/esm/BaseLinearDisplay/models/FeatureDensityMixin.d.ts +0 -32
  282. package/esm/BaseLinearDisplay/models/FeatureDensityMixin.js +0 -113
  283. package/esm/BaseLinearDisplay/models/NonBlockCanvasDisplayMixin.d.ts +0 -26
  284. package/esm/BaseLinearDisplay/models/NonBlockCanvasDisplayMixin.js +0 -57
  285. package/esm/BaseLinearDisplay/models/SvgFloatingLabels.d.ts +0 -8
  286. package/esm/BaseLinearDisplay/models/SvgFloatingLabels.js +0 -19
  287. package/esm/BaseLinearDisplay/models/TrackHeightMixin.d.ts +0 -11
  288. package/esm/BaseLinearDisplay/models/TrackHeightMixin.js +0 -31
  289. package/esm/BaseLinearDisplay/models/autorunFeatureDensityStats.d.ts +0 -2
  290. package/esm/BaseLinearDisplay/models/autorunFeatureDensityStats.js +0 -29
  291. package/esm/BaseLinearDisplay/models/configSchema.d.ts +0 -29
  292. package/esm/BaseLinearDisplay/models/configSchema.js +0 -33
  293. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +0 -98
  294. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +0 -242
  295. package/esm/BaseLinearDisplay/models/util.d.ts +0 -9
  296. package/esm/BaseLinearDisplay/models/util.js +0 -43
  297. package/esm/BaseLinearDisplay/renderSvg.d.ts +0 -3
  298. package/esm/BaseLinearDisplay/renderSvg.js +0 -63
  299. package/esm/BaseLinearDisplay/types.d.ts +0 -43
  300. package/esm/BaseLinearDisplay/types.js +0 -3
  301. package/esm/BaseLinearDisplay/util.d.ts +0 -16
  302. package/esm/BaseLinearDisplay/util.js +0 -71
  303. package/esm/BasicTrack/configSchema.d.ts +0 -85
  304. package/esm/BasicTrack/configSchema.js +0 -8
  305. package/esm/BasicTrack/index.d.ts +0 -2
  306. package/esm/BasicTrack/index.js +0 -12
  307. package/esm/LinearBareDisplay/configSchema.d.ts +0 -32
  308. package/esm/LinearBareDisplay/configSchema.js +0 -11
  309. package/esm/LinearBareDisplay/index.d.ts +0 -4
  310. package/esm/LinearBareDisplay/index.js +0 -20
  311. package/esm/LinearBareDisplay/model.d.ts +0 -1196
  312. package/esm/LinearBareDisplay/model.js +0 -32
  313. package/esm/LinearBasicDisplay/components/LinearBasicDisplayComponent.d.ts +0 -5
  314. package/esm/LinearBasicDisplay/components/LinearBasicDisplayComponent.js +0 -9
  315. package/esm/LinearBasicDisplay/configSchema.d.ts +0 -32
  316. package/esm/LinearBasicDisplay/configSchema.js +0 -11
  317. package/esm/LinearBasicDisplay/index.d.ts +0 -4
  318. package/esm/LinearBasicDisplay/index.js +0 -20
  319. package/esm/LinearBasicDisplay/model.d.ts +0 -1391
  320. package/esm/LinearBasicDisplay/model.js +0 -158
  321. package/esm/LinearFeatureDisplay/components/AddFiltersDialog.d.ts +0 -9
  322. package/esm/LinearFeatureDisplay/components/AddFiltersDialog.js +0 -58
  323. package/esm/LinearFeatureDisplay/components/SetMaxHeightDialog.d.ts +0 -8
  324. package/esm/LinearFeatureDisplay/components/SetMaxHeightDialog.js +0 -26
  325. package/esm/LinearFeatureDisplay/configSchema.d.ts +0 -32
  326. package/esm/LinearFeatureDisplay/configSchema.js +0 -11
  327. package/esm/LinearFeatureDisplay/index.d.ts +0 -3
  328. package/esm/LinearFeatureDisplay/index.js +0 -2
  329. package/esm/LinearFeatureDisplay/model.d.ts +0 -1443
  330. package/esm/LinearFeatureDisplay/model.js +0 -305
  331. package/esm/LinearGenomeView/SVGErrorBox.d.ts +0 -5
  332. package/esm/LinearGenomeView/SVGErrorBox.js +0 -4
  333. package/esm/LinearGenomeView/components/ImportFormRefNameAutocomplete.d.ts +0 -11
  334. package/esm/LinearGenomeView/components/ImportFormRefNameAutocomplete.js +0 -27
  335. package/esm/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.d.ts +0 -5
  336. package/esm/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.js +0 -13
  337. package/esm/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.d.ts +0 -3
  338. package/esm/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.js +0 -17
  339. package/esm/LinearGenomeView/components/RefNameAutocomplete/HelpDialog.d.ts +0 -3
  340. package/esm/LinearGenomeView/components/RefNameAutocomplete/HelpDialog.js +0 -8
  341. package/esm/LinearGenomeView/components/RefNameAutocomplete/index.d.ts +0 -16
  342. package/esm/LinearGenomeView/components/RefNameAutocomplete/index.js +0 -101
  343. package/esm/LinearGenomeView/components/RefNameAutocomplete/util.d.ts +0 -10
  344. package/esm/LinearGenomeView/components/RefNameAutocomplete/util.js +0 -45
  345. package/esm/LinearGenomeView/components/RubberbandSpan.d.ts +0 -15
  346. package/esm/LinearGenomeView/components/RubberbandSpan.js +0 -32
  347. package/esm/LinearGenomeView/components/RubberbandTooltip.d.ts +0 -5
  348. package/esm/LinearGenomeView/components/RubberbandTooltip.js +0 -17
  349. package/esm/LinearGenomeView/components/TrackLabelContainer.d.ts +0 -8
  350. package/esm/LinearGenomeView/components/TrackLabelContainer.js +0 -25
  351. package/esm/LinearGenomeView/components/useWheelScroll.d.ts +0 -7
  352. package/esm/LinearGenomeView/components/useWheelScroll.js +0 -69
  353. package/esm/LinearGenomeView/svgExportUtil.d.ts +0 -9
  354. package/esm/LinearGenomeView/svgExportUtil.js +0 -6
  355. package/esm/LinearGenomeView/svgcomponents/SVGBackground.d.ts +0 -5
  356. package/esm/LinearGenomeView/svgcomponents/SVGBackground.js +0 -7
  357. /package/esm/{BaseLinearDisplay/components → MultiLevelRubberband}/types.js +0 -0
@@ -0,0 +1,66 @@
1
+ import { awaitSvgRenders } from '@jbrowse/core/svg/svgReady';
2
+ import { max } from '@jbrowse/core/util';
3
+ import { totalHeight } from './util.js';
4
+ /**
5
+ * One view's worth of exported track bodies: which tracks are in, their
6
+ * rendered SVG, and how tall the stack ends up.
7
+ *
8
+ * It exists to own the two orderings that each of the three view exports got
9
+ * wrong at least once, because neither is visible at a call site that merely
10
+ * lists the same statements in some order:
11
+ *
12
+ * - `legendWidth` is measured **before** the awaits, because it is an input to
13
+ * them: a display draws its legend beside its body or floating over it
14
+ * depending on whether the container reserved room. That is why
15
+ * `svgLegendWidth` is specified as a function of the *settings* and not of
16
+ * the loaded data — see LinearHicDisplay's implementation.
17
+ * - `tracksHeight` is measured **after** them. A display whose height follows
18
+ * its data (grow mode; `LinearMultiRowFeatureDisplay` is `nrow *
19
+ * effectiveRowHeight`) only reaches its final height once `renderSvg`'s
20
+ * readiness wait resolves, and `SVGTracks` re-reads `displays[0].height`
21
+ * later still. Measuring up front sized the canvas for the pre-fetch height
22
+ * and the taller bodies ran off the bottom of the export — and in the
23
+ * breakpoint-split export it also desynced the overlay anchors, resolved
24
+ * after, from the view tops, which weren't.
25
+ *
26
+ * The minimized filter and the track order are here for the same reason: the
27
+ * reserved height, the rendered bodies, the label gutter and (breakpoint-split)
28
+ * the ribbon anchors must all be derived from one list, and pinned tracks are
29
+ * drawn at the top of a view on screen.
30
+ */
31
+ export async function renderViewTracks({ view, opts, theme, textHeight, trackLabels, reserveLegendWidth = false, }) {
32
+ // Partitioned before anything is measured, so a skipped track reserves no
33
+ // height and takes no place in the label gutter — the alternative is a figure
34
+ // with a labelled empty band where the track would have been. One pass, so
35
+ // the test for "can this render" is written once and the two lists cannot
36
+ // disagree about a track.
37
+ const tracks = [];
38
+ const skippedTracks = [];
39
+ for (const track of [...view.pinnedTracks, ...view.unpinnedTracks]) {
40
+ if (!track.minimized) {
41
+ ;
42
+ (track.displays[0]?.renderSvg ? tracks : skippedTracks).push(track);
43
+ }
44
+ }
45
+ const legendWidth = reserveLegendWidth
46
+ ? max(tracks.map(track => track.displays[0].svgLegendWidth?.() ?? 0), 0)
47
+ : 0;
48
+ // `awaitSvgRenders` over `Promise.all`: a track whose data won't load fails
49
+ // the export, and a view with three broken tracks should say so once rather
50
+ // than name whichever rejected first
51
+ const displayResults = await awaitSvgRenders(tracks.map(async (track) => ({
52
+ track,
53
+ result: await track.displays[0].renderSvg({
54
+ ...opts,
55
+ theme,
56
+ legendWidth,
57
+ }),
58
+ })));
59
+ return {
60
+ tracks,
61
+ displayResults,
62
+ tracksHeight: totalHeight(tracks, textHeight, trackLabels),
63
+ legendWidth,
64
+ skippedTracks,
65
+ };
66
+ }
@@ -0,0 +1,70 @@
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
+ import type { TrackLabelMode } from '../types.ts';
3
+ import type React from 'react';
4
+ /** What a figure's shape is, where JBrowse has no opinion of its own. */
5
+ export interface ViewSvgFigureOptions {
6
+ fontSize?: number;
7
+ rulerHeight?: number;
8
+ trackLabels?: TrackLabelMode;
9
+ showGridlines?: boolean;
10
+ /** the capped bar labelled with the span, above the ruler */
11
+ showScalebar?: boolean;
12
+ /**
13
+ * Paint each display's heavy layer to a canvas and embed a PNG instead of
14
+ * emitting vector elements. The point of an inline figure is usually the
15
+ * opposite, but a hundred-thousand-read pileup is a lot of DOM.
16
+ */
17
+ rasterizeLayers?: boolean;
18
+ /** gutter on each side, for content drawn outside the genome area */
19
+ margin?: number;
20
+ /** a named theme, as the export dialog's picker passes */
21
+ themeName?: string;
22
+ }
23
+ export interface ViewSvgFigureResult {
24
+ /**
25
+ * The figure, ready to render. Frozen against the snapshot it was built from
26
+ * (see the note above), so re-rendering the component that holds it cannot
27
+ * make its chrome disagree with its track bodies.
28
+ */
29
+ figure: React.ReactNode;
30
+ /**
31
+ * Dimensions of the figure, for a host reserving its space — of the *last*
32
+ * one drawn while a redraw is in flight, since a reservation that went
33
+ * undefined between figures would collapse the box and walk the page.
34
+ */
35
+ width: number | undefined;
36
+ height: number | undefined;
37
+ /** the locus it is a picture of, for a caption */
38
+ locstring: string | undefined;
39
+ /**
40
+ * Names of visible tracks left out, because their display type implements no
41
+ * `renderSvg`. Not an error — a third-party display that has skipped a
42
+ * substantial extra implementation should cost its own track a place in the
43
+ * figure rather than cost the whole export — but not nothing either, since a
44
+ * figure quietly one track short is indistinguishable afterwards from a figure
45
+ * of a view that had one fewer. Say it somewhere.
46
+ */
47
+ skipped: string[];
48
+ error: unknown;
49
+ isLoading: boolean;
50
+ }
51
+ /**
52
+ * A live SVG figure of a linear genome view, redrawn as the view settles
53
+ * somewhere new.
54
+ *
55
+ * ```tsx
56
+ * const { figure, isLoading, skipped } = useViewSvgFigure(view)
57
+ * return <div>{figure}</div>
58
+ * ```
59
+ *
60
+ * The data is the display's own — whatever it has already fetched for the
61
+ * screen — so a figure costs no requests.
62
+ *
63
+ * `useFetch` under it, which is what discards a redraw that lands after the pan
64
+ * that overtook it. Every change of key clears its data, a pan as much as a
65
+ * theme switch, so `figure` goes undefined for as long as the next one takes to
66
+ * build — which is what `width`/`height` holding the last figure's box is for:
67
+ * the reservation keeps its size while the content is away, instead of
68
+ * collapsing and walking the page.
69
+ */
70
+ export declare function useViewSvgFigure(view: LinearGenomeViewModel, { fontSize, rulerHeight, trackLabels, showGridlines, showScalebar, rasterizeLayers, margin, themeName, }?: ViewSvgFigureOptions): ViewSvgFigureResult;
@@ -0,0 +1,263 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo, useCallback, useEffect, useRef, useSyncExternalStore, } from 'react';
3
+ import { exportMargin } from '@jbrowse/core/svg/constants';
4
+ import { svgTrackName } from '@jbrowse/core/svg/trackNames';
5
+ import { StyleThemeProvider } from '@jbrowse/core/ui/PaletteContext';
6
+ import { resolveStyleTheme } from '@jbrowse/core/ui/styleTheme';
7
+ import { createJBrowseTheme } from '@jbrowse/core/ui/theme';
8
+ import { getSession } from '@jbrowse/core/util';
9
+ import { useFetch } from '@jbrowse/core/util/useFetch';
10
+ import { isAlive } from '@jbrowse/mobx-state-tree';
11
+ import { ThemeProvider } from '@mui/material';
12
+ import { reaction } from 'mobx';
13
+ import SVGRowHeader from './SVGRowHeader.js';
14
+ import SVGView from './SVGView.js';
15
+ import { useFrozenFigureContract, useOneFigurePerView, } from './figureContract.js';
16
+ import { renderViewTracks } from './renderViewTracks.js';
17
+ import { defaultTextHeight, getRowHeaderLayout, trackLabelLeftOffset, } from './util.js';
18
+ /**
19
+ * One figure: every visible track rendered to SVG elements, and the geometry
20
+ * that lays them out.
21
+ *
22
+ * `renderViewTracks` owns the two orderings this cannot state for itself — the
23
+ * legend gutter measured before the renders (a display draws its key beside the
24
+ * plot or floating over it depending on whether the container reserved room),
25
+ * the stack height after them (a display whose height follows its data only
26
+ * reaches its final height once its readiness wait resolves). Everything read
27
+ * below is read after the awaits for the same reason.
28
+ */
29
+ async function renderFigure(view, opts) {
30
+ const { fontSize, rulerHeight, trackLabels, rasterizeLayers, showScalebar } = opts;
31
+ const session = getSession(view);
32
+ const theme = session.getActiveThemeOptions?.(opts.themeName);
33
+ const textHeight = defaultTextHeight(fontSize);
34
+ const { tracks, displayResults, tracksHeight, legendWidth, skippedTracks } = await renderViewTracks({
35
+ view,
36
+ opts: {
37
+ fontSize,
38
+ trackLabels,
39
+ rasterizeLayers,
40
+ themeName: opts.themeName,
41
+ },
42
+ theme,
43
+ textHeight,
44
+ trackLabels,
45
+ // an inline figure has room to give: a legend sits beside the plot rather
46
+ // than over it
47
+ reserveLegendWidth: true,
48
+ });
49
+ // the room the row header needs *above* its own origin — it draws the assembly
50
+ // name and the scalebar at negative y, so the caller reserves the band and
51
+ // translates the view down into it
52
+ const { bandHeight } = getRowHeaderLayout({ fontSize, showScalebar });
53
+ const trackLabelOffset = trackLabelLeftOffset({
54
+ tracks,
55
+ trackLabels,
56
+ fontSize,
57
+ session,
58
+ });
59
+ return {
60
+ ...opts,
61
+ displayResults,
62
+ theme,
63
+ width: view.width + opts.margin * 2 + legendWidth + trackLabelOffset,
64
+ height: bandHeight + rulerHeight + tracksHeight + opts.margin,
65
+ bandHeight,
66
+ tracksHeight,
67
+ legendWidth,
68
+ trackLabelOffset,
69
+ textHeight,
70
+ locstring: view.visibleLocStrings,
71
+ skipped: skippedTracks.map(track => svgTrackName(track, session)),
72
+ };
73
+ }
74
+ /**
75
+ * The figure, frozen.
76
+ *
77
+ * `memo` is what keeps the live half of the drawing (the ruler, the scalebar,
78
+ * the seams, all of which re-read the model) from advancing past the frozen half
79
+ * while a redraw is in flight — the snapshot is the only thing that may move it.
80
+ *
81
+ * **It looks redundant in this repo and is not, and the difference is the
82
+ * build.** `babel.config.cjs` runs React Compiler over every component here, so
83
+ * a re-render of this one with an unchanged `snapshot` reuses its whole memoized
84
+ * element tree and the chrome never re-runs — which is why taking the `memo` out
85
+ * fails no test in this repo. What ships is `build:esm`, plain `tsc` with no
86
+ * compiler pass, so a consumer's app re-renders this component on every parent
87
+ * render. Where it matters, this line is the only thing holding the two halves
88
+ * together.
89
+ *
90
+ * Both providers, as `wrapSvgExport` mounts for the file path, and for the same
91
+ * reason: the chrome takes its colors from the Material UI theme and a
92
+ * `makeStyles` component would take its own from the style theme, so a figure
93
+ * mounted in a host that installs neither would otherwise draw itself in
94
+ * JBrowse's *default light* theme whatever the session is set to.
95
+ *
96
+ * No background rect, unlike a file — that has nothing behind it, and a figure
97
+ * in a page has the page. No `resetSvgClipIds` either, and that is the opposite
98
+ * decision from the file path on purpose: the counter is document-global, so
99
+ * resetting it here would renumber ids that a figure already on the page is
100
+ * pointing at. Letting it run is what makes several live figures unique.
101
+ */
102
+ const FrozenSvgFigure = memo(function FrozenSvgFigure({ view, snapshot, }) {
103
+ const { width, height, margin, theme } = snapshot;
104
+ // it watches for the one thing this component cannot enforce: an observer
105
+ // INSIDE the tree, which the memo above is not between
106
+ const ref = useRef(null);
107
+ useFrozenFigureContract(ref, snapshot);
108
+ return (_jsx(ThemeProvider, { theme: createJBrowseTheme(theme), children: _jsx(StyleThemeProvider, { theme: resolveStyleTheme({ configTheme: theme }), children: _jsx("svg", { ref: ref, width: width, height: height, viewBox: `0 0 ${width} ${height}`,
109
+ // It is a vector, so a narrower container scales it rather than
110
+ // clipping it; the height attribute stays, so a box reserved for it
111
+ // does not change size when that happens. Deliberately not a prop:
112
+ // anything passed per-render would have to reach past the memo above,
113
+ // which is the one thing holding the figure's two halves together. A
114
+ // host that wants other sizing wraps this in a box of its own.
115
+ style: { display: 'block', maxWidth: '100%' }, children: _jsx("g", { transform: `translate(${margin} ${snapshot.bandHeight})`, children: _jsx(SVGView, { view: view, displayResults: snapshot.displayResults, header: _jsx(SVGRowHeader, { view: view, fontSize: snapshot.fontSize, rulerHeight: snapshot.rulerHeight, showScalebar: snapshot.showScalebar }), fontSize: snapshot.fontSize, textHeight: snapshot.textHeight, trackLabels: snapshot.trackLabels, trackLabelOffset: snapshot.trackLabelOffset,
116
+ // the row header is exactly the ruler, so the bodies start at its
117
+ // height
118
+ contentTop: snapshot.rulerHeight, tracksHeight: snapshot.tracksHeight, showGridlines: snapshot.showGridlines,
119
+ // the left gutter the per-track clip may bleed into, so content
120
+ // drawn left of zero — a wiggle's y-axis — survives
121
+ leftBuffer: snapshot.margin, legendWidth: snapshot.legendWidth }) }) }) }) }));
122
+ });
123
+ /**
124
+ * What "the figure is out of date" means, as a string.
125
+ *
126
+ * The settled frame rather than the live one: `coarseVisibleLocStrings` and
127
+ * `coarseBpPerPx` are a 500ms-delayed copy of the view's geometry — the same
128
+ * signal the wiggle and alignments displays refetch on — so a figure redraws
129
+ * when the reader stops rather than once a frame. A redraw walks every visible
130
+ * feature and builds a few thousand DOM nodes; that is the trade an inline
131
+ * figure makes, and it is why the canvas rendering still exists.
132
+ *
133
+ * The rest is everything else a figure is a picture of, and each entry is here
134
+ * because leaving it out is silent: **the tracks**, since `ready` answers a
135
+ * question about regions and is true before a track is instantiated (the first
136
+ * figure then draws a header over nothing, and nothing else ever changes to
137
+ * correct it); **their heights and minimized flags**, since the geometry is
138
+ * derived from them; **the width**, since a resize can widen the canvas without
139
+ * moving the locus; **the theme**, since each display bakes colors into its own
140
+ * bodies, so a figure from the other mode is not stale but unreadable; and **the
141
+ * highlight bands**, which are drawn in the figure and are the one thing in it a
142
+ * reader adds without navigating anywhere.
143
+ *
144
+ * A plugin's own overlay (grid-bookmark's bookmarks, through
145
+ * `LinearGenomeView-HighlightSVGComponent`) is state this cannot see, so a
146
+ * bookmark added under a drawn figure shows up at its next redraw rather than at
147
+ * once. Subscribing from inside the figure is the thing that must not happen —
148
+ * see the note at the top of the file.
149
+ */
150
+ function figureKey(view, themeName) {
151
+ // A closed view is not an error, it is a host doing an ordinary thing in an
152
+ // order React cannot help with: the MST node dies on the write, and this
153
+ // reaction re-runs against the corpse before the host's own render takes the
154
+ // figure down. Every read below is then a dead-node read — `track.displays[0]`
155
+ // warns and `track.configuration` comes back undefined, so the key used to
156
+ // throw a TypeError inside the reaction, where MobX swallows it. No key means
157
+ // no figure, which is what a host that closed the view wanted anyway.
158
+ //
159
+ // `view.width` throws by design before the view has been measured, and
160
+ // `ready` is the gate that says it has been — and that there are regions to
161
+ // draw, which is the second async step `initialized` does not cover
162
+ if (!isAlive(view) || !view.ready) {
163
+ return '';
164
+ }
165
+ const session = getSession(view);
166
+ return JSON.stringify([
167
+ view.coarseVisibleLocStrings,
168
+ view.coarseBpPerPx,
169
+ view.width,
170
+ view.tracks.map(track => [
171
+ track.configuration.trackId,
172
+ track.minimized,
173
+ track.displays[0]?.height,
174
+ ]),
175
+ session.getActiveThemeOptions?.(themeName),
176
+ session.highlightsVisible ? view.highlight : false,
177
+ view.labelsVisible,
178
+ ]);
179
+ }
180
+ /**
181
+ * Subscribe to that key from outside MobX.
182
+ *
183
+ * `useSyncExternalStore` rather than reading the model in the caller's render,
184
+ * so this works whether or not the calling component is an `observer` — a hook
185
+ * that silently stops redrawing for hosts who did not wrap their component is
186
+ * not a publishable contract. `reaction` rather than `autorun` for once, and for
187
+ * the reason the usual rule is the other way round: `getSnapshot` already
188
+ * supplies the current value, so the subscription only has to report changes.
189
+ */
190
+ function useFigureKey(view, themeName) {
191
+ return useSyncExternalStore(useCallback((onChange) => reaction(() => figureKey(view, themeName), onChange), [view, themeName]), () => figureKey(view, themeName), () => '');
192
+ }
193
+ /**
194
+ * A live SVG figure of a linear genome view, redrawn as the view settles
195
+ * somewhere new.
196
+ *
197
+ * ```tsx
198
+ * const { figure, isLoading, skipped } = useViewSvgFigure(view)
199
+ * return <div>{figure}</div>
200
+ * ```
201
+ *
202
+ * The data is the display's own — whatever it has already fetched for the
203
+ * screen — so a figure costs no requests.
204
+ *
205
+ * `useFetch` under it, which is what discards a redraw that lands after the pan
206
+ * that overtook it. Every change of key clears its data, a pan as much as a
207
+ * theme switch, so `figure` goes undefined for as long as the next one takes to
208
+ * build — which is what `width`/`height` holding the last figure's box is for:
209
+ * the reservation keeps its size while the content is away, instead of
210
+ * collapsing and walking the page.
211
+ */
212
+ export function useViewSvgFigure(view, { fontSize = 12, rulerHeight = 30, trackLabels = 'offset', showGridlines = true, showScalebar = true, rasterizeLayers = false, margin = exportMargin, themeName, } = {}) {
213
+ const key = useFigureKey(view, themeName);
214
+ useOneFigurePerView(view);
215
+ const { data: snapshot, error, isLoading, } = useFetch(
216
+ // Every option is in the key by value, so an inline options object costs
217
+ // nothing and a changed option redraws. A null key is `useFetch`'s own "not
218
+ // yet", which is what an unready view reports.
219
+ key
220
+ ? [
221
+ 'lgv-svg-figure',
222
+ key,
223
+ JSON.stringify([
224
+ fontSize,
225
+ rulerHeight,
226
+ trackLabels,
227
+ showGridlines,
228
+ showScalebar,
229
+ rasterizeLayers,
230
+ margin,
231
+ ]),
232
+ ]
233
+ : null, () => renderFigure(view, {
234
+ fontSize,
235
+ rulerHeight,
236
+ trackLabels,
237
+ showGridlines,
238
+ showScalebar,
239
+ rasterizeLayers,
240
+ margin,
241
+ themeName,
242
+ }));
243
+ // Written in an effect and read during render, which is the order that makes
244
+ // it work: a key change clears `data` on the render where the ref still holds
245
+ // the previous commit's size, so the host's box keeps the height it had rather
246
+ // than collapsing to nothing while the next figure draws.
247
+ const lastSize = useRef(undefined);
248
+ useEffect(() => {
249
+ if (snapshot) {
250
+ lastSize.current = { width: snapshot.width, height: snapshot.height };
251
+ }
252
+ }, [snapshot]);
253
+ const size = snapshot ?? lastSize.current;
254
+ return {
255
+ figure: snapshot ? (_jsx(FrozenSvgFigure, { view: view, snapshot: snapshot })) : undefined,
256
+ width: size?.width,
257
+ height: size?.height,
258
+ locstring: snapshot?.locstring,
259
+ skipped: snapshot?.skipped ?? [],
260
+ error,
261
+ isLoading,
262
+ };
263
+ }
@@ -1,8 +1,95 @@
1
- interface Display {
2
- height: number;
1
+ import type { TrackLabelMode } from '../types.ts';
2
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
+ import type { TrackCatalog } from '@jbrowse/core/util';
4
+ import type { ReactNode } from 'react';
5
+ interface TrackHeights {
6
+ displays: {
7
+ height: number;
8
+ }[];
3
9
  }
4
- interface Track {
5
- displays: Display[];
10
+ export interface SvgDisplayResult {
11
+ track: {
12
+ configuration: AnyConfigurationModel;
13
+ displays: {
14
+ height: number;
15
+ }[];
16
+ };
17
+ result: ReactNode;
6
18
  }
7
- export declare function totalHeight(tracks: Track[], textHeight: number, trackLabels: string): number;
19
+ export declare const trackSpacing = 2;
20
+ export declare function gridlineTickXs(model: {
21
+ staticBlocksTranslateX: number;
22
+ gridlineTicks: {
23
+ major: boolean;
24
+ x: number;
25
+ }[];
26
+ }): {
27
+ dx: number;
28
+ major: number[];
29
+ minor: number[];
30
+ };
31
+ export declare function vlinePath(xs: number[], y1: number, y2: number): string;
32
+ export declare function labelInkHeight(fontSize: number): number;
33
+ /**
34
+ * Baseline y for a label whose ink box should start at `topY` — roughly what
35
+ * `dominantBaseline="hanging"` asks the renderer for, but resolved here.
36
+ *
37
+ * Not a renderer-compatibility workaround (`dominant-baseline` is well
38
+ * supported, and SvgCanvas emits it on every feature label it writes). The
39
+ * point is that this file already *models* the ink box, in LABEL_INK_EM /
40
+ * LABEL_DESCENT_EM, and reserves vertical space from that model —
41
+ * `getHeaderLayout` budgets `labelInkHeight(fontSize)` for the scalebar's bp
42
+ * label, `defaultTextHeight` for an offset track label. A label placed with
43
+ * `hanging` is instead positioned by the renderer's own notion of the font's
44
+ * ascent, so the space reserved and the space used come from two different
45
+ * models that merely happen to agree closely at the sizes we ship. Resolving
46
+ * the baseline from the same constants makes them one model, which is what lets
47
+ * util.test.ts check placement against reservation at all.
48
+ */
49
+ export declare function labelBaselineFromTop(topY: number, fontSize: number): number;
50
+ export declare function defaultTextHeight(fontSize: number): number;
51
+ export declare function offsetLabelBaselineY(textHeight: number, fontSize: number): number;
52
+ export declare function insetLabelBaselineY(fontSize: number): number;
53
+ export declare function getRowHeaderLayout({ fontSize, showScalebar, }: {
54
+ fontSize: number;
55
+ showScalebar: boolean;
56
+ }): {
57
+ scalebarLineY: number | undefined;
58
+ assemblyLabelBaselineY: number;
59
+ bandHeight: number;
60
+ };
61
+ export declare function getHeaderLayout({ fontSize, showCytobands, rulerHeight, }: {
62
+ fontSize: number;
63
+ showCytobands: boolean;
64
+ rulerHeight: number;
65
+ }): {
66
+ assemblyLabelBaselineY: number;
67
+ cytobandTop: number;
68
+ scalebarLineY: number;
69
+ rulerTop: number;
70
+ tracksTop: number;
71
+ };
72
+ export declare const RULER_MAJOR_TICK = 5;
73
+ export declare const RULER_MINOR_TICK = 3;
74
+ export declare const RULER_TICK_FONT_SIZE = 11;
75
+ export declare function getRulerLayout(rulerHeight: number): {
76
+ tickTopY: number;
77
+ numbersBaselineY: number;
78
+ };
79
+ export declare const refNameLabelBoxHeight: number;
80
+ export declare const refNameLabelBaselineY: number;
81
+ export declare function labelOffset(trackLabels: TrackLabelMode, textHeight: number): number;
82
+ export declare const TRACK_LABEL_GAP = 40;
83
+ export declare function trackLabelLeftOffset({ tracks, trackLabels, fontSize, fontFamily, session, }: {
84
+ tracks: {
85
+ configuration: AnyConfigurationModel;
86
+ }[];
87
+ trackLabels: TrackLabelMode;
88
+ fontSize: number;
89
+ fontFamily?: string;
90
+ session: TrackCatalog;
91
+ }): number;
92
+ export declare function trackBoxHeight(track: TrackHeights, textOffset: number): number;
93
+ export declare function trackBoxOffsets(tracks: TrackHeights[], textOffset: number): number[];
94
+ export declare function totalHeight(tracks: TrackHeights[], textHeight: number, trackLabels: TrackLabelMode): number;
8
95
  export {};