@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
@@ -1,41 +1,69 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getTickDisplayStr, measureText, stripAlpha } from '@jbrowse/core/util';
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SvgClipRect } from '@jbrowse/core/svg/SvgExport';
3
+ import { svgNodeId } from '@jbrowse/core/svg/svgId';
4
+ import { stripAlpha } from '@jbrowse/core/util';
3
5
  import { useTheme } from '@mui/material';
4
- import { makeTicks } from "../util.js";
5
- import SVGRegionSeparators from "./SVGRegionSeparators.js";
6
- function Ruler({ start, end, bpPerPx, reversed = false, major = true, minor = true, hideText = false, widthPx, }) {
7
- const ticks = makeTicks(start, end, bpPerPx, major, minor);
6
+ import { REF_NAME_LABEL_FONT_SIZE, getScalebarRefNameLabels, labelFitsInBlock, refNameLabelFitsInView, tickLabelWidth, } from '../util.js';
7
+ import SVGRegionSeparators from './SVGRegionSeparators.js';
8
+ import { RULER_MAJOR_TICK, RULER_MINOR_TICK, RULER_TICK_FONT_SIZE, getRulerLayout, gridlineTickXs, refNameLabelBaselineY, refNameLabelBoxHeight, vlinePath, } from './util.js';
9
+ // Tick marks and their coordinate labels, read from the same model getters the
10
+ // on-screen Gridlines/ScalebarCoordinateLabels use (gridlineTicks /
11
+ // scalebarLabels), so tick pitch, label text and label placement can't drift
12
+ // from the screen. Both are computed in the staticBlocks frame, which overhangs
13
+ // the viewport, so shift by the view's `staticBlocksTranslateX` and let the
14
+ // caller's clip trim the overhang.
15
+ function Ruler({ model, tickTopY, numbersBaselineY, }) {
8
16
  const theme = useTheme();
9
- const c = stripAlpha(theme.palette.text.secondary);
10
- return (_jsxs(_Fragment, { children: [ticks.map(tick => {
11
- const x = (reversed ? end - tick.base : tick.base - start) / bpPerPx;
12
- return (_jsx("line", { x1: x, x2: x, y1: 0, y2: tick.type === 'major' ? 6 : 4, strokeWidth: 1, stroke: c }, `tick-${tick.base}`));
13
- }), !hideText
14
- ? ticks
15
- .filter(tick => tick.type === 'major')
16
- .filter(tick => {
17
- const x = (reversed ? end - tick.base : tick.base - start) / bpPerPx;
18
- const labelText = getTickDisplayStr(tick.base + 1, bpPerPx);
19
- const labelWidth = measureText(labelText, 11) + 4;
20
- const leftEdge = x - 3;
21
- const rightEdge = leftEdge + labelWidth;
22
- return leftEdge >= 0 && rightEdge <= widthPx;
23
- })
24
- .map(tick => {
25
- const x = (reversed ? end - tick.base : tick.base - start) / bpPerPx;
26
- return (_jsx("text", { x: x - 3, y: 7 + 11, fontSize: 11, fill: c, children: getTickDisplayStr(tick.base + 1, bpPerPx) }, `label-${tick.base}`));
27
- })
28
- : null] }));
17
+ const color = stripAlpha(theme.palette.text.secondary);
18
+ const { scalebarLabels, width } = model;
19
+ const { dx, major, minor } = gridlineTickXs(model);
20
+ // major and minor marks share a stroke and differ only in length, so both
21
+ // collapse into a single path
22
+ const ticks = vlinePath(major, tickTopY, tickTopY + RULER_MAJOR_TICK) +
23
+ vlinePath(minor, tickTopY, tickTopY + RULER_MINOR_TICK);
24
+ return (_jsxs(_Fragment, { children: [_jsx("path", { d: ticks, strokeWidth: 1, stroke: color, fill: "none" }), scalebarLabels
25
+ .filter(({ x, label }) => {
26
+ const w = tickLabelWidth(label);
27
+ return labelFitsInBlock(dx + x - w / 2, w, width);
28
+ })
29
+ .map(({ x, label, key }) => (_jsx("text", { x: dx + x, y: numbersBaselineY, textAnchor: "middle", fontSize: RULER_TICK_FONT_SIZE, fill: color, children: label }, key)))] }));
29
30
  }
30
- export default function SVGRuler({ model, fontSize, }) {
31
- const { dynamicBlocks: { contentBlocks }, offsetPx: viewOffsetPx, bpPerPx, } = model;
32
- const renderRuler = contentBlocks.length < 5;
31
+ // Chromosome/refName labels along the ruler. Reuses the on-screen scalebar's
32
+ // sticky-label logic (getScalebarRefNameLabels) so the exported name stays
33
+ // pinned to the viewport's left edge when a region has scrolled off — otherwise
34
+ // the name renders off-canvas whenever you export a view zoomed into a
35
+ // chromosome interior. No assembly-name prefix here (unlike the on-screen
36
+ // scalebar): the SVG export already draws a standalone assembly-name label
37
+ // above the ruler, so folding it into this one too is redundant.
38
+ //
39
+ // `orientation` is not redundant, and this is the surface that needed it most.
40
+ // A stacked export gives each row SVGRowHeader — assembly name, ruler, refName
41
+ // labels — and no locstring, so a flipped row used to leave the numbers
42
+ // counting down as the only evidence it was flipped. On screen the search box
43
+ // says so; a figure has no search box.
44
+ function SVGRefNameLabels({ model }) {
33
45
  const theme = useTheme();
34
- const c = stripAlpha(theme.palette.text.primary);
35
- return (_jsxs(_Fragment, { children: [_jsx(SVGRegionSeparators, { model: model, height: 30 }), contentBlocks.map(block => {
36
- const { start, end, key, reversed, offsetPx, refName, widthPx } = block;
37
- const offset = offsetPx - viewOffsetPx;
38
- const clipid = `clip-${key}`;
39
- return (_jsxs("g", { children: [_jsx("defs", { children: _jsx("clipPath", { id: clipid, children: _jsx("rect", { x: 0, y: 0, width: widthPx, height: 100 }) }) }), _jsx("g", { transform: `translate(${offset} 0)`, children: _jsxs("g", { clipPath: `url(#${clipid})`, children: [_jsx("text", { x: 4, y: fontSize, fontSize: fontSize, fill: c, children: refName }), _jsx("g", { transform: "translate(0 20)", children: _jsx(Ruler, { hideText: !renderRuler, start: start, end: end, bpPerPx: bpPerPx, reversed: reversed, widthPx: widthPx }) })] }) })] }, key));
40
- })] }));
46
+ const fill = stripAlpha(theme.palette.text.primary);
47
+ const { labels, caption } = getScalebarRefNameLabels({
48
+ blocks: model.staticBlocks.blocks,
49
+ offsetPx: model.offsetPx,
50
+ prefix: undefined,
51
+ orientation: model.displayedRegionsOrientation,
52
+ });
53
+ return (_jsxs(_Fragment, { children: [caption === undefined ? null : (_jsx("text", { x: 0, y: refNameLabelBaselineY, fontSize: REF_NAME_LABEL_FONT_SIZE, fontWeight: "bold", fill: fill, children: caption })), labels
54
+ .filter(label => refNameLabelFitsInView(label, model.width))
55
+ .map(label => (_jsx(SVGRefNameLabel, { label: label, fill: fill, clipId: `reflabel-${svgNodeId(model)}-${label.key}` }, label.key)))] }));
56
+ }
57
+ // One refName label, clipped to the pixels left before its run of regions ends
58
+ // so a long name can't run past what it names — the vector counterpart of the
59
+ // on-screen label's maxWidth + overflow:clip. The clip rect spans the whole
60
+ // label box from its left edge, paddingLeft included, which is the box-sizing
61
+ // the on-screen span states for the same reason.
62
+ function SVGRefNameLabel({ label, fill, clipId, }) {
63
+ const { transform, maxWidth, paddingLeft, text } = label;
64
+ return (_jsx("g", { transform: `translate(${transform} 0)`, children: _jsx(SvgClipRect, { id: clipId, width: maxWidth, height: refNameLabelBoxHeight, children: _jsx("text", { x: paddingLeft, y: refNameLabelBaselineY, fontSize: REF_NAME_LABEL_FONT_SIZE, fontWeight: "bold", fill: fill, children: text }) }) }));
65
+ }
66
+ export default function SVGRuler({ model, rulerHeight, }) {
67
+ const { tickTopY, numbersBaselineY } = getRulerLayout(rulerHeight);
68
+ return (_jsxs(SvgClipRect, { id: `ruler-clip-${svgNodeId(model)}`, width: model.width, height: rulerHeight, children: [_jsx(SVGRegionSeparators, { model: model, height: rulerHeight }), _jsx(Ruler, { model: model, tickTopY: tickTopY, numbersBaselineY: numbersBaselineY }), _jsx(SVGRefNameLabels, { model: model })] }));
41
69
  }
@@ -3,5 +3,5 @@ type LGV = LinearGenomeViewModel;
3
3
  export default function SVGScalebar({ model, fontSize, }: {
4
4
  model: LGV;
5
5
  fontSize: number;
6
- }): import("react/jsx-runtime").JSX.Element;
6
+ }): import("react").JSX.Element;
7
7
  export {};
@@ -1,14 +1,16 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { getBpDisplayStr, stripAlpha } from '@jbrowse/core/util';
3
3
  import { useTheme } from '@mui/material';
4
+ import { SVG_SCALEBAR_CAP } from '../consts.js';
5
+ import { labelBaselineFromTop } from './util.js';
4
6
  export default function SVGScalebar({ model, fontSize, }) {
5
7
  const { offsetPx, dynamicBlocks: { totalWidthPxWithoutBorders: totalWidthPx, totalBp }, } = model;
6
8
  const theme = useTheme();
7
9
  const displayBp = getBpDisplayStr(totalBp);
8
10
  const x0 = Math.max(-offsetPx, 0);
9
11
  const x1 = x0 + totalWidthPx;
10
- const c = stripAlpha(theme.palette.text.secondary);
11
- const x = x0 + (x1 - x0) / 2;
12
- const y = fontSize;
13
- return (_jsxs(_Fragment, { children: [_jsx("line", { x1: x0, x2: x1, y1: 10, y2: 10, stroke: c }), _jsx("line", { x1: x0, x2: x0, y1: 5, y2: 15, stroke: c }), _jsx("line", { x1: x1, x2: x1, y1: 5, y2: 15, stroke: c }), _jsx("text", { x: x, y: y, textAnchor: "middle", dominantBaseline: "hanging", fontSize: fontSize, fill: c, children: displayBp })] }));
12
+ const color = stripAlpha(theme.palette.text.secondary);
13
+ // the bar is drawn on this component's own origin (y=0), with capped ends and
14
+ // the bp label hanging just below; callers translate it to the desired line y
15
+ return (_jsxs(_Fragment, { children: [_jsx("line", { x1: x0, x2: x1, y1: 0, y2: 0, stroke: color }), _jsx("line", { x1: x0, x2: x0, y1: -SVG_SCALEBAR_CAP, y2: SVG_SCALEBAR_CAP, stroke: color }), _jsx("line", { x1: x1, x2: x1, y1: -SVG_SCALEBAR_CAP, y2: SVG_SCALEBAR_CAP, stroke: color }), _jsx("text", { x: (x0 + x1) / 2, y: labelBaselineFromTop(SVG_SCALEBAR_CAP, fontSize), textAnchor: "middle", fontSize: fontSize, fill: color, children: displayBp })] }));
14
16
  }
@@ -1,7 +1,9 @@
1
- export default function SVGTrackLabel({ trackLabels, trackName, fontSize, trackLabelOffset, x, }: {
1
+ import type { TrackLabelMode } from '../types.ts';
2
+ export default function SVGTrackLabel({ trackLabels, trackName, fontSize, textHeight, trackLabelOffset, x, }: {
2
3
  trackName: string;
3
- trackLabels: string;
4
+ trackLabels: TrackLabelMode;
4
5
  fontSize: number;
6
+ textHeight: number;
5
7
  trackLabelOffset: number;
6
8
  x: number;
7
- }): import("react/jsx-runtime").JSX.Element | null;
9
+ }): import("react").JSX.Element | null;
@@ -1,11 +1,47 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { coarseStripHTML, stripAlpha } from '@jbrowse/core/util';
2
+ import { stripAlpha } from '@jbrowse/core/util';
3
3
  import { useTheme } from '@mui/material';
4
- export default function SVGTrackLabel({ trackLabels, trackName, fontSize, trackLabelOffset, x, }) {
4
+ import { TRACK_LABEL_GAP, insetLabelBaselineY, offsetLabelBaselineY, } from './util.js';
5
+ // Where the label sits, per mode. 'left' right-aligns in the gutter
6
+ // trackLabelLeftOffset reserved (hence the shared TRACK_LABEL_GAP); the other
7
+ // modes hang off the leftmost visible content at `x`, either just above the
8
+ // track body ('offset') or inset over it ('overlay').
9
+ //
10
+ // Every mode is placed on its alphabetic baseline (the SVG default, so no
11
+ // dominantBaseline is emitted at all): 'offset' so its descenders land a known
12
+ // distance above the track body — the band it sits in is `textHeight` tall, and
13
+ // offsetLabelBaselineY owns that arithmetic — and 'left'/'overlay' so their
14
+ // ascenders stay inside the track box they align with. 'left' used to be pinned
15
+ // at a hardcoded y=20 on a hanging baseline, which neither scaled with fontSize
16
+ // nor stayed inside a track shorter than ~35px.
17
+ function labelPosition({ trackLabels, trackLabelOffset, textHeight, fontSize, x, }) {
18
+ if (trackLabels === 'left') {
19
+ return {
20
+ x: trackLabelOffset - TRACK_LABEL_GAP,
21
+ y: insetLabelBaselineY(fontSize),
22
+ textAnchor: 'end',
23
+ };
24
+ }
25
+ // the other two are left-aligned, which is the SVG default, so neither emits
26
+ // a textAnchor at all
27
+ if (trackLabels === 'offset') {
28
+ return { x, y: offsetLabelBaselineY(textHeight, fontSize) };
29
+ }
30
+ // inset over the track body, on a baseline far enough down that the ascenders
31
+ // stay inside it (at y=0 they rose into the track above)
32
+ return { x: x + 5, y: insetLabelBaselineY(fontSize) };
33
+ }
34
+ export default function SVGTrackLabel({ trackLabels, trackName, fontSize, textHeight, trackLabelOffset, x, }) {
5
35
  const theme = useTheme();
6
- const fill = stripAlpha(theme.palette.text.primary);
7
- const xoff = trackLabels === 'overlay' ? 5 : 0;
8
- const yoff = trackLabels === 'offset' ? 5 : 0;
9
- const name = coarseStripHTML(trackName);
10
- return trackLabels !== 'none' ? (_jsx("g", { children: trackLabels === 'left' ? (_jsx("text", { x: trackLabelOffset - 40, y: 20, fill: fill, fontSize: fontSize, dominantBaseline: "hanging", textAnchor: "end", children: name })) : (_jsx("text", { x: x + xoff, y: yoff, fill: fill, fontSize: fontSize, dominantBaseline: "hanging", children: name })) })) : null;
36
+ if (trackLabels === 'none') {
37
+ return null;
38
+ }
39
+ const pos = labelPosition({
40
+ trackLabels,
41
+ trackLabelOffset,
42
+ textHeight,
43
+ fontSize,
44
+ x,
45
+ });
46
+ return (_jsx("text", { x: pos.x, y: pos.y, textAnchor: pos.textAnchor, fontSize: fontSize, fill: stripAlpha(theme.palette.text.primary), children: trackName }));
11
47
  }
@@ -1,21 +1,15 @@
1
1
  import type { LinearGenomeViewModel } from '../index.ts';
2
- import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
2
+ import type { TrackLabelMode } from '../types.ts';
3
+ import type { SvgDisplayResult } from './util.ts';
3
4
  type LGV = LinearGenomeViewModel;
4
- interface DisplayResult {
5
- track: {
6
- configuration: AnyConfigurationModel;
7
- displays: {
8
- height: number;
9
- }[];
10
- };
11
- result: string;
12
- }
13
- export default function SVGTracks({ displayResults, model, textHeight, fontSize, trackLabels, trackLabelOffset, }: {
14
- displayResults: DisplayResult[];
5
+ export default function SVGTracks({ displayResults, model, textHeight, fontSize, trackLabels, trackLabelOffset, leftBuffer, legendWidth, }: {
6
+ displayResults: SvgDisplayResult[];
15
7
  model: LGV;
16
8
  textHeight: number;
17
9
  fontSize: number;
18
- trackLabels?: string;
10
+ trackLabels?: TrackLabelMode;
19
11
  trackLabelOffset?: number;
20
- }): import("react/jsx-runtime").JSX.Element;
12
+ leftBuffer?: number;
13
+ legendWidth?: number;
14
+ }): import("react").JSX.Element;
21
15
  export {};
@@ -1,26 +1,21 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SvgClipRect } from '@jbrowse/core/svg/SvgExport';
3
+ import { svgNodeId } from '@jbrowse/core/svg/svgId';
4
+ import { svgTrackName } from '@jbrowse/core/svg/trackNames';
2
5
  import { getSession } from '@jbrowse/core/util';
3
- import { getTrackName } from '@jbrowse/core/util/tracks';
4
- import SVGRegionSeparators from "./SVGRegionSeparators.js";
5
- import SVGTrackLabel from "./SVGTrackLabel.js";
6
- export default function SVGTracks({ displayResults, model, textHeight, fontSize, trackLabels = 'offset', trackLabelOffset = 0, }) {
6
+ import SVGRegionSeparators from './SVGRegionSeparators.js';
7
+ import SVGTrackLabel from './SVGTrackLabel.js';
8
+ import { labelOffset, trackBoxOffsets } from './util.js';
9
+ export default function SVGTracks({ displayResults, model, textHeight, fontSize, trackLabels = 'offset', trackLabelOffset = 0, leftBuffer = 0, legendWidth = 0, }) {
7
10
  const session = getSession(model);
8
- const textOffset = trackLabels === 'offset' ? textHeight : 0;
9
- return (_jsx(_Fragment, { children: displayResults.reduce(({ prevOffset, reactElements }, { track, result }) => {
11
+ const textOffset = labelOffset(trackLabels, textHeight);
12
+ const x = Math.max(-model.offsetPx, 0);
13
+ const offsets = trackBoxOffsets(displayResults.map(r => r.track), textOffset);
14
+ return (_jsx(_Fragment, { children: displayResults.map(({ track, result }, i) => {
10
15
  const conf = track.configuration;
11
- const trackName = getTrackName(conf, session);
16
+ const trackName = svgTrackName(track, session);
12
17
  const display = track.displays[0];
13
- const x = Math.max(-model.offsetPx, 0);
14
- const currOffset = prevOffset + display.height + textOffset;
15
- return {
16
- prevOffset: currOffset,
17
- reactElements: [
18
- ...reactElements,
19
- _jsxs("g", { transform: `translate(0 ${prevOffset})`, children: [_jsxs("g", { transform: `translate(${trackLabelOffset} ${textOffset})`, children: [_jsx(SVGRegionSeparators, { model: model, height: display.height }), result] }), _jsx(SVGTrackLabel, { trackName: trackName, fontSize: fontSize, trackLabels: trackLabels, trackLabelOffset: trackLabelOffset, x: x })] }, conf.trackId),
20
- ],
21
- };
22
- }, {
23
- prevOffset: 0,
24
- reactElements: [],
25
- }).reactElements }));
18
+ const currentOffset = offsets[i];
19
+ return (_jsxs("g", { transform: `translate(0 ${currentOffset})`, children: [_jsx(SvgClipRect, { id: `track-clip-${svgNodeId(model)}-${conf.trackId}`, x: -leftBuffer, y: textOffset, width: model.width + trackLabelOffset + leftBuffer + legendWidth, height: display.height, children: _jsxs("g", { transform: `translate(${trackLabelOffset} ${textOffset})`, children: [result, _jsx(SVGRegionSeparators, { model: model, height: display.height })] }) }), _jsx(SVGTrackLabel, { trackName: trackName, fontSize: fontSize, textHeight: textHeight, trackLabels: trackLabels, trackLabelOffset: trackLabelOffset, x: x })] }, conf.trackId));
20
+ }) }));
26
21
  }
@@ -0,0 +1,18 @@
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
+ import type { TrackLabelMode } from '../types.ts';
3
+ import type { SvgDisplayResult } from './util.ts';
4
+ import type { ReactNode } from 'react';
5
+ export default function SVGView({ view, displayResults, header, fontSize, textHeight, trackLabels, trackLabelOffset, contentTop, tracksHeight, showGridlines, leftBuffer, legendWidth, }: {
6
+ view: LinearGenomeViewModel;
7
+ displayResults: SvgDisplayResult[];
8
+ header: ReactNode;
9
+ fontSize: number;
10
+ textHeight: number;
11
+ trackLabels: TrackLabelMode;
12
+ trackLabelOffset: number;
13
+ contentTop: number;
14
+ tracksHeight: number;
15
+ showGridlines: boolean;
16
+ leftBuffer?: number;
17
+ legendWidth?: number;
18
+ }): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import SVGGridlines from './SVGGridlines.js';
3
+ import SVGHighlightsOverlay from './SVGHighlightsOverlay.js';
4
+ import SVGTracks from './SVGTracks.js';
5
+ // One LGV's worth of exported SVG: a caller-supplied header on top, then
6
+ // optional gridlines, the track bodies, and the highlight layer over them.
7
+ // Shared by all three exports that stack an LGV — the standalone one, and the
8
+ // linear-synteny and breakpoint-split rows — so their per-view layout can't
9
+ // drift. It did drift while the standalone export kept its own copy of these
10
+ // four groups: only that copy widened the per-track clip by `legendWidth`.
11
+ export default function SVGView({ view, displayResults, header, fontSize, textHeight, trackLabels, trackLabelOffset, contentTop, tracksHeight, showGridlines, leftBuffer = 0, legendWidth = 0, }) {
12
+ return (_jsxs(_Fragment, { children: [_jsx("g", { transform: `translate(${trackLabelOffset})`, children: header }), showGridlines ? (_jsx("g", { transform: `translate(${trackLabelOffset} ${contentTop})`, children: _jsx(SVGGridlines, { model: view, height: tracksHeight }) })) : null, _jsx("g", { transform: `translate(0 ${contentTop})`, children: _jsx(SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: view, displayResults: displayResults, trackLabelOffset: trackLabelOffset, leftBuffer: leftBuffer, legendWidth: legendWidth }) }), _jsx("g", { transform: `translate(${trackLabelOffset} ${contentTop})`, children: _jsx(SVGHighlightsOverlay, { model: view, tracksHeight: tracksHeight }) })] }));
13
+ }
@@ -0,0 +1,45 @@
1
+ import type { RefObject } from 'react';
2
+ /**
3
+ * One live figure per view.
4
+ *
5
+ * Every id a figure mints is `<what>-${svgNodeId(view)}`, deterministic so that
6
+ * exporting an unchanged view twice produces the same bytes (see `svgNodeId`).
7
+ * The same property makes two figures of ONE view collide on all of them, and
8
+ * SVG ids are document-global with `url(#…)` resolving to the first match — so
9
+ * the second figure's tracks are clipped by the first figure's rects. With
10
+ * different options on the two (the reason to draw two in the first place) those
11
+ * rects are the wrong size, and it reads as a track drawn unclipped or a
12
+ * highlight band cut short.
13
+ *
14
+ * Deliberately not fixed by scoping the ids per figure. The determinism is load
15
+ * bearing for the file export that shares these components, and a second figure
16
+ * of one view is a thing to do differently rather than a case to support.
17
+ */
18
+ export declare function useOneFigurePerView(view: {
19
+ id: string;
20
+ }): void;
21
+ /**
22
+ * Nothing inside a figure re-renders itself.
23
+ *
24
+ * A figure's track bodies are built once and frozen; its ruler, scalebar and
25
+ * seams re-derive from the model on any render they get. The `memo` in
26
+ * `useViewSvgFigure` is what keeps those in step, and it sits between the figure
27
+ * and its PARENT — it is not between a component inside the figure and MobX. An
28
+ * `observer` in there re-renders on its own subscription and slides across
29
+ * bodies drawn at a moment in the past, which is a rendering bug the picture
30
+ * gives no sign of.
31
+ *
32
+ * Checked as the state rather than the shape, because the shape is not
33
+ * detectable: `observer(f)` on a function component is `memo(f)` with no marker
34
+ * on it, so it cannot be told from a plain `memo`, which is harmless. Watching
35
+ * for the symptom also covers what an enumeration would miss — a plugin's
36
+ * component reached through `LinearGenomeView-HighlightSVGComponent`, an
37
+ * observer a display's `renderSvg` returned, or a subscription that is not
38
+ * MobX's at all.
39
+ *
40
+ * A mutation is only a violation while the snapshot is unchanged. React's own
41
+ * commit for a NEW snapshot mutates this subtree too, so `rendered` moves to
42
+ * that snapshot during the render that precedes the commit and the records are
43
+ * ignored.
44
+ */
45
+ export declare function useFrozenFigureContract(ref: RefObject<SVGSVGElement | null>, snapshot: object): void;
@@ -0,0 +1,130 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { svgNodeId } from '@jbrowse/core/svg/svgId';
3
+ import { contractReportsOn, reportContractViolation, } from '@jbrowse/render-core/contractReports';
4
+ /**
5
+ * Checks that a live SVG figure is being used the way it can work.
6
+ *
7
+ * `useViewSvgFigure` publishes a figure whose two halves are drawn at different
8
+ * moments and only agree by construction, and both ways of breaking that are
9
+ * invisible in the output: the drawing is still a plausible picture of
10
+ * somewhere, just not of one moment or not with its own clips. So the run
11
+ * reports instead, through the `[jbrowse <family> contract]` channel every
12
+ * check in the tree uses — `config/jest/contractGate.js` fails the test that
13
+ * collects one, and ARCHITECTURAL_LIMITS.md §"Ordering is the contract" is the
14
+ * register. `figure` rather than `svg-figure` because the gate's family pattern
15
+ * is `\w+`, which a hyphen is not.
16
+ *
17
+ * Reported and never thrown, as the rest of that family: a figure is chrome a
18
+ * host renders beside its own, and taking the host's tree down over a drawing
19
+ * is worse than the drawing being wrong.
20
+ */
21
+ function report(message) {
22
+ reportContractViolation('figure', message);
23
+ }
24
+ // Live figures per view, keyed the way their SVG ids are. A count rather than a
25
+ // flag: the report belongs on the second mount, and the first has to survive the
26
+ // second unmounting.
27
+ const figuresPerView = new Map();
28
+ /**
29
+ * One live figure per view.
30
+ *
31
+ * Every id a figure mints is `<what>-${svgNodeId(view)}`, deterministic so that
32
+ * exporting an unchanged view twice produces the same bytes (see `svgNodeId`).
33
+ * The same property makes two figures of ONE view collide on all of them, and
34
+ * SVG ids are document-global with `url(#…)` resolving to the first match — so
35
+ * the second figure's tracks are clipped by the first figure's rects. With
36
+ * different options on the two (the reason to draw two in the first place) those
37
+ * rects are the wrong size, and it reads as a track drawn unclipped or a
38
+ * highlight band cut short.
39
+ *
40
+ * Deliberately not fixed by scoping the ids per figure. The determinism is load
41
+ * bearing for the file export that shares these components, and a second figure
42
+ * of one view is a thing to do differently rather than a case to support.
43
+ */
44
+ export function useOneFigurePerView(view) {
45
+ useEffect(() => {
46
+ // captured, not re-derived on cleanup: by then the view may have left the
47
+ // tree, and `svgNodeId` walks it
48
+ const key = svgNodeId(view);
49
+ const live = (figuresPerView.get(key) ?? 0) + 1;
50
+ figuresPerView.set(key, live);
51
+ if (live > 1) {
52
+ report(`${live} live figures of one view are mounted at once. They mint the ` +
53
+ `same SVG ids (ruler-clip-${key}, track-clip-${key}-<trackId>, …), ` +
54
+ `ids are document-global, and url(#…) resolves to the first match — ` +
55
+ `so every figure after the first is clipped by the first one's rects ` +
56
+ `and draws its tracks and highlights at the wrong extent. Render one ` +
57
+ `figure per view.`);
58
+ }
59
+ return () => {
60
+ const left = (figuresPerView.get(key) ?? 1) - 1;
61
+ if (left > 0) {
62
+ figuresPerView.set(key, left);
63
+ }
64
+ else {
65
+ figuresPerView.delete(key);
66
+ }
67
+ };
68
+ }, [view]);
69
+ }
70
+ /**
71
+ * Nothing inside a figure re-renders itself.
72
+ *
73
+ * A figure's track bodies are built once and frozen; its ruler, scalebar and
74
+ * seams re-derive from the model on any render they get. The `memo` in
75
+ * `useViewSvgFigure` is what keeps those in step, and it sits between the figure
76
+ * and its PARENT — it is not between a component inside the figure and MobX. An
77
+ * `observer` in there re-renders on its own subscription and slides across
78
+ * bodies drawn at a moment in the past, which is a rendering bug the picture
79
+ * gives no sign of.
80
+ *
81
+ * Checked as the state rather than the shape, because the shape is not
82
+ * detectable: `observer(f)` on a function component is `memo(f)` with no marker
83
+ * on it, so it cannot be told from a plain `memo`, which is harmless. Watching
84
+ * for the symptom also covers what an enumeration would miss — a plugin's
85
+ * component reached through `LinearGenomeView-HighlightSVGComponent`, an
86
+ * observer a display's `renderSvg` returned, or a subscription that is not
87
+ * MobX's at all.
88
+ *
89
+ * A mutation is only a violation while the snapshot is unchanged. React's own
90
+ * commit for a NEW snapshot mutates this subtree too, so `rendered` moves to
91
+ * that snapshot during the render that precedes the commit and the records are
92
+ * ignored.
93
+ */
94
+ export function useFrozenFigureContract(ref, snapshot) {
95
+ const rendered = useRef(snapshot);
96
+ rendered.current = snapshot;
97
+ useEffect(() => {
98
+ const el = ref.current;
99
+ // the one check here with a cost of its own — a `MutationObserver` over the
100
+ // whole figure subtree — so unlike its neighbour it asks whether the
101
+ // channel is armed rather than running and reporting into it
102
+ if (!contractReportsOn() || !el) {
103
+ return undefined;
104
+ }
105
+ const observer = new MutationObserver(() => {
106
+ if (rendered.current !== snapshot) {
107
+ return;
108
+ }
109
+ // once is the whole message; a drifting subtree mutates every frame
110
+ observer.disconnect();
111
+ report(`a figure redrew part of itself against a snapshot that did not ` +
112
+ `change, so its chrome and its track bodies now describe different ` +
113
+ `moments and a pan slides one across the other. Something inside it ` +
114
+ `is subscribed to the view — most often an observer component a ` +
115
+ `plugin contributed to LinearGenomeView-HighlightSVGComponent, or ` +
116
+ `one a display's renderSvg returned. Nothing inside a figure may be ` +
117
+ `an observer: the memo that freezes it is between the figure and its ` +
118
+ `parent, not between an observer and MobX.`);
119
+ });
120
+ observer.observe(el, {
121
+ subtree: true,
122
+ childList: true,
123
+ attributes: true,
124
+ characterData: true,
125
+ });
126
+ return () => {
127
+ observer.disconnect();
128
+ };
129
+ }, [ref, snapshot]);
130
+ }
@@ -0,0 +1,76 @@
1
+ import type { ExportSvgOptions, TrackLabelMode } from '../types.ts';
2
+ import type { ExportSvgDisplayOptions } from '@jbrowse/display-kit/types';
3
+ import type { ThemeOptions } from '@mui/material';
4
+ import type { ReactNode } from 'react';
5
+ export interface SvgExportTrack {
6
+ minimized: boolean;
7
+ displays: {
8
+ height: number;
9
+ svgLegendWidth?: () => number;
10
+ /**
11
+ * Optional, and the option is the point: SVG export is a substantial extra
12
+ * implementation for a display type, and a third-party plugin that has not
13
+ * written one should cost its own track a place in the figure, not cost
14
+ * everyone in the session the ability to export at all. A display without
15
+ * one is dropped from the export the same way a minimized track is, and
16
+ * `skippedTracks` carries it back out so the user is told which.
17
+ */
18
+ renderSvg?: (opts: ExportSvgDisplayOptions) => Promise<ReactNode>;
19
+ }[];
20
+ }
21
+ export interface ViewTracksSvg<T> {
22
+ /** the tracks that were rendered, in the order they were laid out */
23
+ tracks: T[];
24
+ displayResults: {
25
+ track: T;
26
+ result: ReactNode;
27
+ }[];
28
+ /** total height of the stack, valid only because the renders above resolved */
29
+ tracksHeight: number;
30
+ /** 0 unless `reserveLegendWidth` was asked for */
31
+ legendWidth: number;
32
+ /**
33
+ * Visible tracks left out because their display implements no `renderSvg`.
34
+ * Not an error, but not nothing either — a figure quietly missing a track is
35
+ * its own trap, so callers report these once per export.
36
+ */
37
+ skippedTracks: T[];
38
+ }
39
+ /**
40
+ * One view's worth of exported track bodies: which tracks are in, their
41
+ * rendered SVG, and how tall the stack ends up.
42
+ *
43
+ * It exists to own the two orderings that each of the three view exports got
44
+ * wrong at least once, because neither is visible at a call site that merely
45
+ * lists the same statements in some order:
46
+ *
47
+ * - `legendWidth` is measured **before** the awaits, because it is an input to
48
+ * them: a display draws its legend beside its body or floating over it
49
+ * depending on whether the container reserved room. That is why
50
+ * `svgLegendWidth` is specified as a function of the *settings* and not of
51
+ * the loaded data — see LinearHicDisplay's implementation.
52
+ * - `tracksHeight` is measured **after** them. A display whose height follows
53
+ * its data (grow mode; `LinearMultiRowFeatureDisplay` is `nrow *
54
+ * effectiveRowHeight`) only reaches its final height once `renderSvg`'s
55
+ * readiness wait resolves, and `SVGTracks` re-reads `displays[0].height`
56
+ * later still. Measuring up front sized the canvas for the pre-fetch height
57
+ * and the taller bodies ran off the bottom of the export — and in the
58
+ * breakpoint-split export it also desynced the overlay anchors, resolved
59
+ * after, from the view tops, which weren't.
60
+ *
61
+ * The minimized filter and the track order are here for the same reason: the
62
+ * reserved height, the rendered bodies, the label gutter and (breakpoint-split)
63
+ * the ribbon anchors must all be derived from one list, and pinned tracks are
64
+ * drawn at the top of a view on screen.
65
+ */
66
+ export declare function renderViewTracks<T extends SvgExportTrack>({ view, opts, theme, textHeight, trackLabels, reserveLegendWidth, }: {
67
+ view: {
68
+ pinnedTracks: T[];
69
+ unpinnedTracks: T[];
70
+ };
71
+ opts: ExportSvgOptions;
72
+ theme: ThemeOptions | undefined;
73
+ textHeight: number;
74
+ trackLabels: TrackLabelMode;
75
+ reserveLegendWidth?: boolean;
76
+ }): Promise<ViewTracksSvg<T>>;