@jbrowse/plugin-linear-genome-view 4.3.0 → 5.0.0-beta.10
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.
- package/esm/FeatureTrack/configSchema.d.ts +202 -71
- package/esm/FeatureTrack/configSchema.js +47 -1
- package/esm/FeatureTrack/index.js +1 -1
- package/esm/LaunchLinearGenomeView/index.d.ts +14 -0
- package/esm/LaunchLinearGenomeView/index.js +6 -12
- package/esm/LinearGenomeView/afterAttach.d.ts +20 -2
- package/esm/LinearGenomeView/afterAttach.js +265 -120
- package/esm/LinearGenomeView/components/CenterLine.d.ts +1 -1
- package/esm/LinearGenomeView/components/CenterLine.js +20 -9
- package/esm/LinearGenomeView/components/ConnectedHoverHighlight.d.ts +7 -0
- package/esm/LinearGenomeView/components/ConnectedHoverHighlight.js +22 -0
- package/esm/LinearGenomeView/components/CrisprGuidePanel.d.ts +3 -0
- package/esm/LinearGenomeView/components/CrisprGuidePanel.js +142 -0
- package/esm/LinearGenomeView/components/Cytobands.d.ts +6 -6
- package/esm/LinearGenomeView/components/Cytobands.js +76 -53
- package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +8 -3
- package/esm/LinearGenomeView/components/ExportSvgDialog.js +15 -67
- package/esm/LinearGenomeView/components/GetSequenceDialog.d.ts +5 -9
- package/esm/LinearGenomeView/components/GetSequenceDialog.js +84 -88
- package/esm/LinearGenomeView/components/Gridlines.d.ts +1 -1
- package/esm/LinearGenomeView/components/Gridlines.js +29 -58
- package/esm/LinearGenomeView/components/Header.d.ts +1 -1
- package/esm/LinearGenomeView/components/Header.js +42 -16
- package/esm/LinearGenomeView/components/HeaderClearHighlightButton.d.ts +21 -0
- package/esm/LinearGenomeView/components/HeaderClearHighlightButton.js +35 -0
- package/esm/LinearGenomeView/components/HeaderPanControls.d.ts +3 -2
- package/esm/LinearGenomeView/components/HeaderPanControls.js +18 -8
- package/esm/LinearGenomeView/components/HeaderRegionWidth.d.ts +1 -1
- package/esm/LinearGenomeView/components/HeaderRegionWidth.js +9 -6
- package/esm/LinearGenomeView/components/HeaderSearchBoxRow.d.ts +6 -0
- package/esm/LinearGenomeView/components/HeaderSearchBoxRow.js +27 -0
- package/esm/LinearGenomeView/components/HeaderSearchBoxes.d.ts +5 -0
- package/esm/LinearGenomeView/components/HeaderSearchBoxes.js +28 -0
- package/esm/LinearGenomeView/components/HeaderTrackSelectorButton.d.ts +3 -2
- package/esm/LinearGenomeView/components/HeaderTrackSelectorButton.js +11 -4
- package/esm/LinearGenomeView/components/HeaderZoomControls.d.ts +3 -2
- package/esm/LinearGenomeView/components/HeaderZoomControls.js +38 -52
- package/esm/LinearGenomeView/components/Highlight.d.ts +1 -1
- package/esm/LinearGenomeView/components/Highlight.js +21 -25
- package/esm/LinearGenomeView/components/HighlightBand.d.ts +3 -2
- package/esm/LinearGenomeView/components/HighlightBand.js +25 -8
- package/esm/LinearGenomeView/components/HighlightChip.d.ts +8 -0
- package/esm/LinearGenomeView/components/HighlightChip.js +13 -0
- package/esm/LinearGenomeView/components/HoverPositionHighlight.d.ts +12 -0
- package/esm/LinearGenomeView/components/HoverPositionHighlight.js +25 -0
- package/esm/LinearGenomeView/components/ImportForm.d.ts +3 -4
- package/esm/LinearGenomeView/components/ImportForm.js +95 -61
- package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +1 -1
- package/esm/LinearGenomeView/components/LinearGenomeView.js +7 -6
- package/esm/LinearGenomeView/components/LinearGenomeViewContainer.d.ts +1 -1
- package/esm/LinearGenomeView/components/LinearGenomeViewContainer.js +88 -30
- package/esm/LinearGenomeView/components/MiniControls.d.ts +1 -1
- package/esm/LinearGenomeView/components/MiniControls.js +14 -10
- package/esm/LinearGenomeView/components/MotifListPanel.d.ts +3 -0
- package/esm/LinearGenomeView/components/MotifListPanel.js +59 -0
- package/esm/LinearGenomeView/components/NavigationAnnouncer.d.ts +32 -0
- package/esm/LinearGenomeView/components/NavigationAnnouncer.js +51 -0
- package/esm/LinearGenomeView/components/NoTracksActiveButton.d.ts +1 -1
- package/esm/LinearGenomeView/components/NoTracksActiveButton.js +1 -1
- package/esm/LinearGenomeView/components/OverviewHighlight.d.ts +2 -4
- package/esm/LinearGenomeView/components/OverviewHighlight.js +23 -44
- package/esm/LinearGenomeView/components/OverviewHighlightBand.d.ts +9 -0
- package/esm/LinearGenomeView/components/OverviewHighlightBand.js +25 -0
- package/esm/LinearGenomeView/components/OverviewRubberband.d.ts +3 -3
- package/esm/LinearGenomeView/components/OverviewRubberband.js +29 -67
- package/esm/LinearGenomeView/components/OverviewRubberbandHoverTooltip.d.ts +4 -5
- package/esm/LinearGenomeView/components/OverviewRubberbandHoverTooltip.js +13 -20
- package/esm/LinearGenomeView/components/OverviewScalebar.d.ts +3 -2
- package/esm/LinearGenomeView/components/OverviewScalebar.js +87 -83
- package/esm/LinearGenomeView/components/OverviewScalebarPolygon.d.ts +19 -5
- package/esm/LinearGenomeView/components/OverviewScalebarPolygon.js +57 -32
- package/esm/LinearGenomeView/components/OverviewScalebarTickLabels.d.ts +4 -5
- package/esm/LinearGenomeView/components/OverviewScalebarTickLabels.js +16 -18
- package/esm/LinearGenomeView/components/PaddingBlocks.d.ts +7 -0
- package/esm/LinearGenomeView/components/PaddingBlocks.js +56 -0
- package/esm/LinearGenomeView/components/RangeSelectOverlay.d.ts +9 -0
- package/esm/LinearGenomeView/components/RangeSelectOverlay.js +19 -0
- package/esm/LinearGenomeView/components/RegionWidthEditorDialog.d.ts +2 -3
- package/esm/LinearGenomeView/components/RegionWidthEditorDialog.js +19 -26
- package/esm/LinearGenomeView/components/ResizeAllTracksHandle.d.ts +5 -0
- package/esm/LinearGenomeView/components/ResizeAllTracksHandle.js +71 -0
- package/esm/LinearGenomeView/components/Rubberband.d.ts +2 -3
- package/esm/LinearGenomeView/components/Rubberband.js +15 -17
- package/esm/LinearGenomeView/components/SVGHighlightBand.d.ts +10 -0
- package/esm/LinearGenomeView/components/SVGHighlightBand.js +8 -0
- package/esm/LinearGenomeView/components/Scalebar.d.ts +2 -6
- package/esm/LinearGenomeView/components/Scalebar.js +20 -22
- package/esm/LinearGenomeView/components/ScalebarCoordinateLabels.d.ts +1 -1
- package/esm/LinearGenomeView/components/ScalebarCoordinateLabels.js +54 -35
- package/esm/LinearGenomeView/components/ScalebarRefNameLabels.d.ts +1 -1
- package/esm/LinearGenomeView/components/ScalebarRefNameLabels.js +157 -126
- package/esm/LinearGenomeView/components/SearchBox.d.ts +22 -2
- package/esm/LinearGenomeView/components/SearchBox.js +61 -68
- package/esm/LinearGenomeView/components/SearchPanelForm.d.ts +9 -0
- package/esm/LinearGenomeView/components/SearchPanelForm.js +18 -0
- package/esm/LinearGenomeView/components/SearchResultsDialog.d.ts +5 -4
- package/esm/LinearGenomeView/components/SearchResultsDialog.js +6 -8
- package/esm/LinearGenomeView/components/SearchResultsTable.d.ts +5 -3
- package/esm/LinearGenomeView/components/SearchResultsTable.js +31 -56
- package/esm/LinearGenomeView/components/SequenceFeatureHoverHighlight.d.ts +5 -0
- package/esm/LinearGenomeView/components/SequenceFeatureHoverHighlight.js +37 -0
- package/esm/LinearGenomeView/components/SequenceFeatureHoverHighlightExtension.d.ts +2 -0
- package/esm/LinearGenomeView/components/SequenceFeatureHoverHighlightExtension.js +5 -0
- package/esm/LinearGenomeView/components/SequencePatternPanel.d.ts +3 -0
- package/esm/LinearGenomeView/components/SequencePatternPanel.js +42 -0
- package/esm/LinearGenomeView/components/SequenceSearchDialog.d.ts +3 -5
- package/esm/LinearGenomeView/components/SequenceSearchDialog.js +31 -53
- package/esm/LinearGenomeView/components/StrandCheckboxes.d.ts +8 -0
- package/esm/LinearGenomeView/components/StrandCheckboxes.js +13 -0
- package/esm/LinearGenomeView/components/TrackContainer.d.ts +1 -1
- package/esm/LinearGenomeView/components/TrackContainer.js +136 -38
- package/esm/LinearGenomeView/components/TrackLabel.d.ts +2 -3
- package/esm/LinearGenomeView/components/TrackLabel.js +20 -26
- package/esm/LinearGenomeView/components/TrackLabelButtons.d.ts +7 -0
- package/esm/LinearGenomeView/components/TrackLabelButtons.js +33 -0
- package/esm/LinearGenomeView/components/TrackLabelDragHandle.d.ts +2 -5
- package/esm/LinearGenomeView/components/TrackLabelDragHandle.js +6 -2
- package/esm/LinearGenomeView/components/TrackLabelMenu.d.ts +1 -1
- package/esm/LinearGenomeView/components/TrackLabelMenu.js +35 -87
- package/esm/LinearGenomeView/components/TrackLabelRefNameWarning.d.ts +22 -0
- package/esm/LinearGenomeView/components/TrackLabelRefNameWarning.js +46 -0
- package/esm/LinearGenomeView/components/TrackRenderingContainer.d.ts +5 -2
- package/esm/LinearGenomeView/components/TrackRenderingContainer.js +66 -24
- package/esm/LinearGenomeView/components/TracksContainer.d.ts +1 -1
- package/esm/LinearGenomeView/components/TracksContainer.js +53 -32
- package/esm/LinearGenomeView/components/VerticalGuide.d.ts +2 -3
- package/esm/LinearGenomeView/components/VerticalGuide.js +6 -26
- package/esm/LinearGenomeView/components/ZoomButton.d.ts +7 -0
- package/esm/LinearGenomeView/components/ZoomButton.js +27 -0
- package/esm/LinearGenomeView/components/ZoomTransform.d.ts +9 -0
- package/esm/LinearGenomeView/components/ZoomTransform.js +37 -0
- package/esm/LinearGenomeView/components/defaultMotifs.d.ts +1 -0
- package/esm/LinearGenomeView/components/defaultMotifs.js +22 -0
- package/esm/LinearGenomeView/components/fetchSequence.d.ts +6 -8
- package/esm/LinearGenomeView/components/fetchSequence.js +17 -9
- package/esm/LinearGenomeView/components/recentLocationsMenu.d.ts +15 -0
- package/esm/LinearGenomeView/components/recentLocationsMenu.js +46 -0
- package/esm/LinearGenomeView/components/searchModes.d.ts +13 -0
- package/esm/LinearGenomeView/components/searchModes.js +22 -0
- package/esm/LinearGenomeView/components/trackLabelMenuItems.d.ts +7 -0
- package/esm/LinearGenomeView/components/trackLabelMenuItems.js +67 -0
- package/esm/LinearGenomeView/components/useRangeSelect.d.ts +9 -67
- package/esm/LinearGenomeView/components/useRangeSelect.js +54 -102
- package/esm/LinearGenomeView/components/useSearchBoxPrefs.d.ts +26 -0
- package/esm/LinearGenomeView/components/useSearchBoxPrefs.js +58 -0
- package/esm/LinearGenomeView/components/useSideScroll.d.ts +17 -3
- package/esm/LinearGenomeView/components/useSideScroll.js +163 -45
- package/esm/LinearGenomeView/components/util.d.ts +24 -6
- package/esm/LinearGenomeView/components/util.js +28 -5
- package/esm/LinearGenomeView/consts.d.ts +9 -2
- package/esm/LinearGenomeView/consts.js +20 -2
- package/esm/LinearGenomeView/containingLgv.d.ts +21 -0
- package/esm/LinearGenomeView/containingLgv.js +23 -0
- package/esm/LinearGenomeView/flyTo.d.ts +38 -0
- package/esm/LinearGenomeView/flyTo.js +135 -0
- package/esm/LinearGenomeView/headerFit.d.ts +29 -0
- package/esm/LinearGenomeView/headerFit.js +72 -0
- package/esm/LinearGenomeView/index.d.ts +28 -3
- package/esm/LinearGenomeView/index.js +13 -7
- package/esm/LinearGenomeView/keyboardHandler.d.ts +9 -0
- package/esm/LinearGenomeView/keyboardHandler.js +25 -1
- package/esm/LinearGenomeView/launchKeys.d.ts +2 -0
- package/esm/LinearGenomeView/launchKeys.js +27 -0
- package/esm/LinearGenomeView/lazyDialogs.d.ts +8 -14
- package/esm/LinearGenomeView/lazyDialogs.js +4 -3
- package/esm/LinearGenomeView/linkedViewSync.d.ts +12 -0
- package/esm/LinearGenomeView/linkedViewSync.js +36 -0
- package/esm/LinearGenomeView/menuItems.d.ts +25 -2
- package/esm/LinearGenomeView/menuItems.js +306 -179
- package/esm/LinearGenomeView/model.d.ts +3363 -164
- package/esm/LinearGenomeView/model.js +2548 -565
- package/esm/LinearGenomeView/sharedScaleContainer.d.ts +18 -0
- package/esm/LinearGenomeView/sharedScaleContainer.js +17 -0
- package/esm/LinearGenomeView/showRegionsWithUndo.d.ts +35 -0
- package/esm/LinearGenomeView/showRegionsWithUndo.js +50 -0
- package/esm/LinearGenomeView/stickyChrome.d.ts +15 -0
- package/esm/LinearGenomeView/stickyChrome.js +26 -0
- package/esm/LinearGenomeView/svgcomponents/SVGGridlines.d.ts +1 -1
- package/esm/LinearGenomeView/svgcomponents/SVGGridlines.js +17 -18
- package/esm/LinearGenomeView/svgcomponents/SVGHeader.d.ts +5 -3
- package/esm/LinearGenomeView/svgcomponents/SVGHeader.js +34 -35
- package/esm/LinearGenomeView/svgcomponents/SVGHighlights.d.ts +5 -0
- package/esm/LinearGenomeView/svgcomponents/SVGHighlights.js +26 -0
- package/esm/LinearGenomeView/svgcomponents/SVGHighlightsOverlay.d.ts +5 -0
- package/esm/LinearGenomeView/svgcomponents/SVGHighlightsOverlay.js +13 -0
- package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.d.ts +1 -3
- package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +73 -41
- package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +1 -1
- package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.js +20 -3
- package/esm/LinearGenomeView/svgcomponents/SVGRowHeader.d.ts +8 -0
- package/esm/LinearGenomeView/svgcomponents/SVGRowHeader.js +36 -0
- package/esm/LinearGenomeView/svgcomponents/SVGRuler.d.ts +3 -3
- package/esm/LinearGenomeView/svgcomponents/SVGRuler.js +66 -39
- package/esm/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +1 -1
- package/esm/LinearGenomeView/svgcomponents/SVGScalebar.js +9 -7
- package/esm/LinearGenomeView/svgcomponents/SVGStackedRow.d.ts +27 -0
- package/esm/LinearGenomeView/svgcomponents/SVGStackedRow.js +12 -0
- package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.d.ts +5 -3
- package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.js +54 -9
- package/esm/LinearGenomeView/svgcomponents/SVGTracks.d.ts +9 -15
- package/esm/LinearGenomeView/svgcomponents/SVGTracks.js +17 -21
- package/esm/LinearGenomeView/svgcomponents/SVGView.d.ts +18 -0
- package/esm/LinearGenomeView/svgcomponents/SVGView.js +13 -0
- package/esm/LinearGenomeView/svgcomponents/figureContract.d.ts +45 -0
- package/esm/LinearGenomeView/svgcomponents/figureContract.js +130 -0
- package/esm/LinearGenomeView/svgcomponents/renderViewTracks.d.ts +76 -0
- package/esm/LinearGenomeView/svgcomponents/renderViewTracks.js +66 -0
- package/esm/LinearGenomeView/svgcomponents/useViewSvgFigure.d.ts +70 -0
- package/esm/LinearGenomeView/svgcomponents/useViewSvgFigure.js +245 -0
- package/esm/LinearGenomeView/svgcomponents/util.d.ts +96 -5
- package/esm/LinearGenomeView/svgcomponents/util.js +242 -4
- package/esm/LinearGenomeView/types.d.ts +20 -37
- package/esm/LinearGenomeView/types.js +1 -0
- package/esm/LinearGenomeView/util.d.ts +347 -12
- package/esm/LinearGenomeView/util.js +577 -62
- package/esm/MultiLevelRubberband/MultiLevelRubberband.d.ts +6 -0
- package/esm/MultiLevelRubberband/MultiLevelRubberband.js +40 -0
- package/esm/MultiLevelRubberband/index.d.ts +4 -0
- package/esm/MultiLevelRubberband/index.js +3 -0
- package/esm/MultiLevelRubberband/menuItems.d.ts +34 -0
- package/esm/MultiLevelRubberband/menuItems.js +52 -0
- package/esm/MultiLevelRubberband/rowLabel.d.ts +22 -0
- package/esm/MultiLevelRubberband/rowLabel.js +27 -0
- package/esm/MultiLevelRubberband/types.d.ts +7 -0
- package/esm/MultiLevelRubberband/useRangeSelect.d.ts +25 -0
- package/esm/MultiLevelRubberband/useRangeSelect.js +120 -0
- package/esm/displayKitTests/perRegionTestEnv.d.ts +1391 -0
- package/esm/displayKitTests/perRegionTestEnv.js +142 -0
- package/esm/index.d.ts +50 -1245
- package/esm/index.js +88 -33
- package/esm/searchUtils.d.ts +62 -12
- package/esm/searchUtils.js +335 -48
- package/esm/shared/RubberbandSpan.d.ts +15 -0
- package/esm/shared/RubberbandSpan.js +34 -0
- package/esm/shared/coordLabels.d.ts +47 -0
- package/esm/shared/coordLabels.js +133 -0
- package/esm/shared/useWindowDrag.d.ts +18 -0
- package/esm/shared/useWindowDrag.js +45 -0
- package/package.json +18 -19
- package/esm/BaseLinearDisplay/SVGLegend.d.ts +0 -6
- package/esm/BaseLinearDisplay/SVGLegend.js +0 -17
- package/esm/BaseLinearDisplay/calculateSvgLegendWidth.d.ts +0 -2
- package/esm/BaseLinearDisplay/calculateSvgLegendWidth.js +0 -11
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +0 -8
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js +0 -53
- package/esm/BaseLinearDisplay/components/Block.d.ts +0 -14
- package/esm/BaseLinearDisplay/components/Block.js +0 -45
- package/esm/BaseLinearDisplay/components/BlockErrorMessage.d.ts +0 -7
- package/esm/BaseLinearDisplay/components/BlockErrorMessage.js +0 -22
- package/esm/BaseLinearDisplay/components/BlockMsg.d.ts +0 -6
- package/esm/BaseLinearDisplay/components/BlockMsg.js +0 -26
- package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/CollapseIntronsDialog.d.ts +0 -9
- package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/CollapseIntronsDialog.js +0 -42
- package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/TranscriptTable.d.ts +0 -11
- package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/TranscriptTable.js +0 -40
- package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/util.d.ts +0 -19
- package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/util.js +0 -45
- package/esm/BaseLinearDisplay/components/FloatingLabels.d.ts +0 -5
- package/esm/BaseLinearDisplay/components/FloatingLabels.js +0 -75
- package/esm/BaseLinearDisplay/components/FloatingLegend.d.ts +0 -8
- package/esm/BaseLinearDisplay/components/FloatingLegend.js +0 -43
- package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +0 -5
- package/esm/BaseLinearDisplay/components/LinearBlocks.js +0 -23
- package/esm/BaseLinearDisplay/components/LoadingOverlay.d.ts +0 -5
- package/esm/BaseLinearDisplay/components/LoadingOverlay.js +0 -49
- package/esm/BaseLinearDisplay/components/MaxHeightReachedIndicator.d.ts +0 -4
- package/esm/BaseLinearDisplay/components/MaxHeightReachedIndicator.js +0 -26
- package/esm/BaseLinearDisplay/components/MenuPage.d.ts +0 -8
- package/esm/BaseLinearDisplay/components/MenuPage.js +0 -24
- package/esm/BaseLinearDisplay/components/NonBlockCanvasDisplayComponent.d.ts +0 -21
- package/esm/BaseLinearDisplay/components/NonBlockCanvasDisplayComponent.js +0 -52
- package/esm/BaseLinearDisplay/components/RenderedBlocks.d.ts +0 -12
- package/esm/BaseLinearDisplay/components/RenderedBlocks.js +0 -22
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.d.ts +0 -12
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +0 -18
- package/esm/BaseLinearDisplay/components/TooLargeMessage.d.ts +0 -10
- package/esm/BaseLinearDisplay/components/TooLargeMessage.js +0 -20
- package/esm/BaseLinearDisplay/components/Tooltip.d.ts +0 -13
- package/esm/BaseLinearDisplay/components/Tooltip.js +0 -22
- package/esm/BaseLinearDisplay/components/types.d.ts +0 -1
- package/esm/BaseLinearDisplay/components/util.d.ts +0 -21
- package/esm/BaseLinearDisplay/components/util.js +0 -107
- package/esm/BaseLinearDisplay/index.d.ts +0 -17
- package/esm/BaseLinearDisplay/index.js +0 -13
- package/esm/BaseLinearDisplay/model.d.ts +0 -1197
- package/esm/BaseLinearDisplay/model.js +0 -432
- package/esm/BaseLinearDisplay/models/FeatureDensityMixin.d.ts +0 -32
- package/esm/BaseLinearDisplay/models/FeatureDensityMixin.js +0 -113
- package/esm/BaseLinearDisplay/models/NonBlockCanvasDisplayMixin.d.ts +0 -26
- package/esm/BaseLinearDisplay/models/NonBlockCanvasDisplayMixin.js +0 -57
- package/esm/BaseLinearDisplay/models/SvgFloatingLabels.d.ts +0 -8
- package/esm/BaseLinearDisplay/models/SvgFloatingLabels.js +0 -19
- package/esm/BaseLinearDisplay/models/TrackHeightMixin.d.ts +0 -11
- package/esm/BaseLinearDisplay/models/TrackHeightMixin.js +0 -31
- package/esm/BaseLinearDisplay/models/autorunFeatureDensityStats.d.ts +0 -2
- package/esm/BaseLinearDisplay/models/autorunFeatureDensityStats.js +0 -29
- package/esm/BaseLinearDisplay/models/configSchema.d.ts +0 -29
- package/esm/BaseLinearDisplay/models/configSchema.js +0 -33
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +0 -98
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +0 -242
- package/esm/BaseLinearDisplay/models/util.d.ts +0 -9
- package/esm/BaseLinearDisplay/models/util.js +0 -43
- package/esm/BaseLinearDisplay/renderSvg.d.ts +0 -3
- package/esm/BaseLinearDisplay/renderSvg.js +0 -63
- package/esm/BaseLinearDisplay/types.d.ts +0 -43
- package/esm/BaseLinearDisplay/types.js +0 -3
- package/esm/BaseLinearDisplay/util.d.ts +0 -16
- package/esm/BaseLinearDisplay/util.js +0 -71
- package/esm/BasicTrack/configSchema.d.ts +0 -85
- package/esm/BasicTrack/configSchema.js +0 -8
- package/esm/BasicTrack/index.d.ts +0 -2
- package/esm/BasicTrack/index.js +0 -12
- package/esm/LinearBareDisplay/configSchema.d.ts +0 -32
- package/esm/LinearBareDisplay/configSchema.js +0 -11
- package/esm/LinearBareDisplay/index.d.ts +0 -4
- package/esm/LinearBareDisplay/index.js +0 -20
- package/esm/LinearBareDisplay/model.d.ts +0 -1196
- package/esm/LinearBareDisplay/model.js +0 -32
- package/esm/LinearBasicDisplay/components/LinearBasicDisplayComponent.d.ts +0 -5
- package/esm/LinearBasicDisplay/components/LinearBasicDisplayComponent.js +0 -9
- package/esm/LinearBasicDisplay/configSchema.d.ts +0 -32
- package/esm/LinearBasicDisplay/configSchema.js +0 -11
- package/esm/LinearBasicDisplay/index.d.ts +0 -4
- package/esm/LinearBasicDisplay/index.js +0 -20
- package/esm/LinearBasicDisplay/model.d.ts +0 -1391
- package/esm/LinearBasicDisplay/model.js +0 -158
- package/esm/LinearFeatureDisplay/components/AddFiltersDialog.d.ts +0 -9
- package/esm/LinearFeatureDisplay/components/AddFiltersDialog.js +0 -58
- package/esm/LinearFeatureDisplay/components/SetMaxHeightDialog.d.ts +0 -8
- package/esm/LinearFeatureDisplay/components/SetMaxHeightDialog.js +0 -26
- package/esm/LinearFeatureDisplay/configSchema.d.ts +0 -32
- package/esm/LinearFeatureDisplay/configSchema.js +0 -11
- package/esm/LinearFeatureDisplay/index.d.ts +0 -3
- package/esm/LinearFeatureDisplay/index.js +0 -2
- package/esm/LinearFeatureDisplay/model.d.ts +0 -1443
- package/esm/LinearFeatureDisplay/model.js +0 -305
- package/esm/LinearGenomeView/SVGErrorBox.d.ts +0 -5
- package/esm/LinearGenomeView/SVGErrorBox.js +0 -4
- package/esm/LinearGenomeView/components/ImportFormRefNameAutocomplete.d.ts +0 -11
- package/esm/LinearGenomeView/components/ImportFormRefNameAutocomplete.js +0 -27
- package/esm/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.d.ts +0 -5
- package/esm/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.js +0 -13
- package/esm/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.d.ts +0 -3
- package/esm/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.js +0 -17
- package/esm/LinearGenomeView/components/RefNameAutocomplete/HelpDialog.d.ts +0 -3
- package/esm/LinearGenomeView/components/RefNameAutocomplete/HelpDialog.js +0 -8
- package/esm/LinearGenomeView/components/RefNameAutocomplete/index.d.ts +0 -16
- package/esm/LinearGenomeView/components/RefNameAutocomplete/index.js +0 -101
- package/esm/LinearGenomeView/components/RefNameAutocomplete/util.d.ts +0 -10
- package/esm/LinearGenomeView/components/RefNameAutocomplete/util.js +0 -45
- package/esm/LinearGenomeView/components/RubberbandSpan.d.ts +0 -15
- package/esm/LinearGenomeView/components/RubberbandSpan.js +0 -32
- package/esm/LinearGenomeView/components/RubberbandTooltip.d.ts +0 -5
- package/esm/LinearGenomeView/components/RubberbandTooltip.js +0 -17
- package/esm/LinearGenomeView/components/TrackLabelContainer.d.ts +0 -8
- package/esm/LinearGenomeView/components/TrackLabelContainer.js +0 -25
- package/esm/LinearGenomeView/components/useWheelScroll.d.ts +0 -7
- package/esm/LinearGenomeView/components/useWheelScroll.js +0 -69
- package/esm/LinearGenomeView/svgExportUtil.d.ts +0 -9
- package/esm/LinearGenomeView/svgExportUtil.js +0 -6
- package/esm/LinearGenomeView/svgcomponents/SVGBackground.d.ts +0 -5
- package/esm/LinearGenomeView/svgcomponents/SVGBackground.js +0 -7
- /package/esm/{BaseLinearDisplay/components → MultiLevelRubberband}/types.js +0 -0
|
@@ -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>>;
|
|
@@ -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, trackLabels, textHeight),
|
|
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,245 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback, useEffect, useRef, useSyncExternalStore, } from 'react';
|
|
3
|
+
import { SvgThemeProviders } from '@jbrowse/core/svg/SvgThemeProviders';
|
|
4
|
+
import { exportMargin } from '@jbrowse/core/svg/constants';
|
|
5
|
+
import { svgNodeId } from '@jbrowse/core/svg/svgId';
|
|
6
|
+
import { svgTrackName } from '@jbrowse/core/svg/trackNames';
|
|
7
|
+
import { getSession } from '@jbrowse/core/util';
|
|
8
|
+
import { useFetch } from '@jbrowse/core/util/useFetch';
|
|
9
|
+
import { getSnapshot, isAlive } from '@jbrowse/mobx-state-tree';
|
|
10
|
+
import { reaction } from 'mobx';
|
|
11
|
+
import SVGStackedRow from './SVGStackedRow.js';
|
|
12
|
+
import { useFrozenFigureContract, useOneFigurePerView, } from './figureContract.js';
|
|
13
|
+
import { renderViewTracks } from './renderViewTracks.js';
|
|
14
|
+
import { defaultTextHeight, getRowHeaderLayout, trackLabelLeftOffset, } from './util.js';
|
|
15
|
+
/**
|
|
16
|
+
* One figure: every visible track rendered to SVG elements, and the geometry
|
|
17
|
+
* that lays them out.
|
|
18
|
+
*
|
|
19
|
+
* `renderViewTracks` owns the two orderings this cannot state for itself — the
|
|
20
|
+
* legend gutter measured before the renders (a display draws its key beside the
|
|
21
|
+
* plot or floating over it depending on whether the container reserved room),
|
|
22
|
+
* the stack height after them (a display whose height follows its data only
|
|
23
|
+
* reaches its final height once its readiness wait resolves). Everything read
|
|
24
|
+
* below is read after the awaits for the same reason.
|
|
25
|
+
*/
|
|
26
|
+
async function renderFigure(view, opts) {
|
|
27
|
+
const { fontSize, rulerHeight, trackLabels, rasterizeLayers, showScalebar } = opts;
|
|
28
|
+
const session = getSession(view);
|
|
29
|
+
const theme = session.getActiveThemeOptions?.(opts.themeName);
|
|
30
|
+
const textHeight = defaultTextHeight(fontSize);
|
|
31
|
+
const { tracks, displayResults, tracksHeight, legendWidth, skippedTracks } = await renderViewTracks({
|
|
32
|
+
view,
|
|
33
|
+
opts: {
|
|
34
|
+
fontSize,
|
|
35
|
+
trackLabels,
|
|
36
|
+
rasterizeLayers,
|
|
37
|
+
themeName: opts.themeName,
|
|
38
|
+
},
|
|
39
|
+
theme,
|
|
40
|
+
textHeight,
|
|
41
|
+
trackLabels,
|
|
42
|
+
// an inline figure has room to give: a legend sits beside the plot rather
|
|
43
|
+
// than over it
|
|
44
|
+
reserveLegendWidth: true,
|
|
45
|
+
});
|
|
46
|
+
// the room the row header needs *above* its own origin — it draws the assembly
|
|
47
|
+
// name and the scalebar at negative y, so the caller reserves the band and
|
|
48
|
+
// translates the view down into it
|
|
49
|
+
const { bandHeight } = getRowHeaderLayout({ fontSize, showScalebar });
|
|
50
|
+
const trackLabelOffset = trackLabelLeftOffset({
|
|
51
|
+
tracks,
|
|
52
|
+
trackLabels,
|
|
53
|
+
fontSize,
|
|
54
|
+
session,
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
...opts,
|
|
58
|
+
displayResults,
|
|
59
|
+
theme,
|
|
60
|
+
width: view.width + opts.margin * 2 + legendWidth + trackLabelOffset,
|
|
61
|
+
height: bandHeight + rulerHeight + tracksHeight + opts.margin,
|
|
62
|
+
bandHeight,
|
|
63
|
+
tracksHeight,
|
|
64
|
+
legendWidth,
|
|
65
|
+
trackLabelOffset,
|
|
66
|
+
textHeight,
|
|
67
|
+
locstring: view.visibleLocStrings,
|
|
68
|
+
skipped: skippedTracks.map(track => svgTrackName(track, session)),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The figure, frozen.
|
|
73
|
+
*
|
|
74
|
+
* `memo` is what keeps the live half of the drawing (the ruler, the scalebar,
|
|
75
|
+
* the seams, all of which re-read the model) from advancing past the frozen half
|
|
76
|
+
* while a redraw is in flight — the snapshot is the only thing that may move it.
|
|
77
|
+
*
|
|
78
|
+
* **It looks redundant in this repo and is not, and the difference is the
|
|
79
|
+
* build.** `babel.config.cjs` runs React Compiler over every component here, so
|
|
80
|
+
* a re-render of this one with an unchanged `snapshot` reuses its whole memoized
|
|
81
|
+
* element tree and the chrome never re-runs — which is why taking the `memo` out
|
|
82
|
+
* fails no test in this repo. What ships is `build:esm`, plain `tsc` with no
|
|
83
|
+
* compiler pass, so a consumer's app re-renders this component on every parent
|
|
84
|
+
* render. Where it matters, this line is the only thing holding the two halves
|
|
85
|
+
* together.
|
|
86
|
+
*
|
|
87
|
+
* The export's theme providers, as the file path mounts them: a host that
|
|
88
|
+
* installs neither would otherwise get JBrowse's default light theme whatever
|
|
89
|
+
* the session is set to.
|
|
90
|
+
*
|
|
91
|
+
* No background rect, unlike a file — that has nothing behind it, and a figure
|
|
92
|
+
* in a page has the page. No `withFreshSvgClipIds` either, and that is the
|
|
93
|
+
* opposite decision from the file path on purpose: the counter is
|
|
94
|
+
* document-global, so restarting it here would reuse ids that a figure already
|
|
95
|
+
* on the page is pointing at. Letting it run is what makes several live figures
|
|
96
|
+
* unique.
|
|
97
|
+
*/
|
|
98
|
+
const FrozenSvgFigure = memo(function FrozenSvgFigure({ view, snapshot, }) {
|
|
99
|
+
const { width, height, margin, theme } = snapshot;
|
|
100
|
+
// it watches for the one thing this component cannot enforce: an observer
|
|
101
|
+
// INSIDE the tree, which the memo above is not between
|
|
102
|
+
const ref = useRef(null);
|
|
103
|
+
useFrozenFigureContract(ref, snapshot);
|
|
104
|
+
return (_jsx(SvgThemeProviders, { theme: theme, children: _jsx("svg", { ref: ref, width: width, height: height, viewBox: `0 0 ${width} ${height}`,
|
|
105
|
+
// It is a vector, so a narrower container scales it rather than
|
|
106
|
+
// clipping it; the height attribute stays, so a box reserved for it
|
|
107
|
+
// does not change size when that happens. Deliberately not a prop:
|
|
108
|
+
// anything passed per-render would have to reach past the memo above,
|
|
109
|
+
// which is the one thing holding the figure's two halves together. A
|
|
110
|
+
// host that wants other sizing wraps this in a box of its own.
|
|
111
|
+
style: { display: 'block', maxWidth: '100%' }, children: _jsx(SVGStackedRow, { view: view, rendered: snapshot, top: snapshot.bandHeight, margin: margin, fontSize: snapshot.fontSize, textHeight: snapshot.textHeight, rulerHeight: snapshot.rulerHeight, trackLabels: snapshot.trackLabels, trackLabelOffset: snapshot.trackLabelOffset, showGridlines: snapshot.showGridlines, legendWidth: snapshot.legendWidth, showScalebar: snapshot.showScalebar }) }) }));
|
|
112
|
+
});
|
|
113
|
+
/**
|
|
114
|
+
* What "the figure is out of date" means, as a string.
|
|
115
|
+
*
|
|
116
|
+
* The settled frame rather than the live one: `coarseVisibleLocStrings` and
|
|
117
|
+
* `coarseBpPerPx` are a 500ms-delayed copy of the view's geometry — the same
|
|
118
|
+
* signal the wiggle and alignments displays refetch on — so a figure redraws
|
|
119
|
+
* when the reader stops rather than once a frame. A redraw walks every visible
|
|
120
|
+
* feature and builds a few thousand DOM nodes; that is the trade an inline
|
|
121
|
+
* figure makes, and it is why the canvas rendering still exists.
|
|
122
|
+
*
|
|
123
|
+
* The rest is everything else a figure is a picture of, and each entry is here
|
|
124
|
+
* because leaving it out is silent: **the tracks**, since `ready` answers a
|
|
125
|
+
* question about regions and is true before a track is instantiated (the first
|
|
126
|
+
* figure then draws a header over nothing, and nothing else ever changes to
|
|
127
|
+
* correct it); **their heights and minimized flags**, since the geometry is
|
|
128
|
+
* derived from them; **the width**, since a resize can widen the canvas without
|
|
129
|
+
* moving the locus; **the theme**, since each display bakes colors into its own
|
|
130
|
+
* bodies, so a figure from the other mode is not stale but unreadable; and **the
|
|
131
|
+
* highlight bands**, which are drawn in the figure and are the one thing in it a
|
|
132
|
+
* reader adds without navigating anywhere.
|
|
133
|
+
*
|
|
134
|
+
* A plugin's own overlay, through `LinearGenomeView-HighlightSVGComponent`, is
|
|
135
|
+
* state this cannot see, so a change to it shows up at the figure's next
|
|
136
|
+
* redraw rather than at once. Subscribing from inside the figure is the thing
|
|
137
|
+
* that must not happen — see the note at the top of the file.
|
|
138
|
+
*/
|
|
139
|
+
function figureKey(view, themeName) {
|
|
140
|
+
// A closed view is not an error, it is a host doing an ordinary thing in an
|
|
141
|
+
// order React cannot help with: the MST node dies on the write, and this
|
|
142
|
+
// reaction re-runs against the corpse before the host's own render takes the
|
|
143
|
+
// figure down. Every read below is then a dead-node read — `track.displays[0]`
|
|
144
|
+
// warns and `track.configuration` comes back undefined, so the key used to
|
|
145
|
+
// throw a TypeError inside the reaction, where MobX swallows it. No key means
|
|
146
|
+
// no figure, which is what a host that closed the view wanted anyway.
|
|
147
|
+
//
|
|
148
|
+
// `view.width` throws by design before the view has been measured. `status`
|
|
149
|
+
// is ready only once it has been AND there are regions to draw — `ready` is
|
|
150
|
+
// also true for a view nothing has told where to look, measured or not
|
|
151
|
+
if (!isAlive(view) || view.status.type !== 'ready') {
|
|
152
|
+
return '';
|
|
153
|
+
}
|
|
154
|
+
const session = getSession(view);
|
|
155
|
+
return JSON.stringify([
|
|
156
|
+
view.coarseVisibleLocStrings,
|
|
157
|
+
view.coarseBpPerPx,
|
|
158
|
+
view.width,
|
|
159
|
+
// the snapshot carries pinned, minimized and the display settings a body
|
|
160
|
+
// bakes in; the effective height is a getter, so it is read beside it
|
|
161
|
+
view.tracks.map(track => [getSnapshot(track), track.displays[0]?.height]),
|
|
162
|
+
session.getActiveThemeOptions?.(themeName),
|
|
163
|
+
session.highlightsVisible ? view.highlights : false,
|
|
164
|
+
session.highlightLabelsVisible,
|
|
165
|
+
]);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Subscribe to that key from outside MobX.
|
|
169
|
+
*
|
|
170
|
+
* `useSyncExternalStore` rather than reading the model in the caller's render,
|
|
171
|
+
* so this works whether or not the calling component is an `observer` — a hook
|
|
172
|
+
* that silently stops redrawing for hosts who did not wrap their component is
|
|
173
|
+
* not a publishable contract. `reaction` rather than `autorun` for once, and for
|
|
174
|
+
* the reason the usual rule is the other way round: `getSnapshot` already
|
|
175
|
+
* supplies the current value, so the subscription only has to report changes.
|
|
176
|
+
*/
|
|
177
|
+
function useFigureKey(view, themeName) {
|
|
178
|
+
return useSyncExternalStore(useCallback((onChange) => reaction(() => figureKey(view, themeName), onChange), [view, themeName]), () => figureKey(view, themeName), () => '');
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* A live SVG figure of a linear genome view, redrawn as the view settles
|
|
182
|
+
* somewhere new.
|
|
183
|
+
*
|
|
184
|
+
* ```tsx
|
|
185
|
+
* const { figure, isLoading, skipped } = useViewSvgFigure(view)
|
|
186
|
+
* return <div>{figure}</div>
|
|
187
|
+
* ```
|
|
188
|
+
*
|
|
189
|
+
* The data is the display's own — whatever it has already fetched for the
|
|
190
|
+
* screen — so a figure costs no requests.
|
|
191
|
+
*
|
|
192
|
+
* `useFetch` under it, which is what discards a redraw that lands after the pan
|
|
193
|
+
* that overtook it. Every change of key clears its data, a pan as much as a
|
|
194
|
+
* theme switch, so `figure` goes undefined for as long as the next one takes to
|
|
195
|
+
* build — which is what `width`/`height` holding the last figure's box is for:
|
|
196
|
+
* the reservation keeps its size while the content is away, instead of
|
|
197
|
+
* collapsing and walking the page.
|
|
198
|
+
*/
|
|
199
|
+
export function useViewSvgFigure(view, { fontSize = 12, rulerHeight = 30, trackLabels = 'offset', showGridlines = true, showScalebar = true, rasterizeLayers = false, margin = exportMargin, themeName, } = {}) {
|
|
200
|
+
const key = useFigureKey(view, themeName);
|
|
201
|
+
useOneFigurePerView(view);
|
|
202
|
+
const opts = {
|
|
203
|
+
fontSize,
|
|
204
|
+
rulerHeight,
|
|
205
|
+
trackLabels,
|
|
206
|
+
showGridlines,
|
|
207
|
+
showScalebar,
|
|
208
|
+
rasterizeLayers,
|
|
209
|
+
margin,
|
|
210
|
+
themeName,
|
|
211
|
+
};
|
|
212
|
+
const { data: snapshot, error, isLoading, } = useFetch(
|
|
213
|
+
// Every option is in the key by value, so an inline options object costs
|
|
214
|
+
// nothing and a changed option redraws. The view's id too: two views can
|
|
215
|
+
// share every other term. A null key is `useFetch`'s own "not yet", which
|
|
216
|
+
// is what an unready view reports.
|
|
217
|
+
key
|
|
218
|
+
? [
|
|
219
|
+
'lgv-svg-figure',
|
|
220
|
+
svgNodeId(view),
|
|
221
|
+
key,
|
|
222
|
+
JSON.stringify(opts),
|
|
223
|
+
]
|
|
224
|
+
: null, () => renderFigure(view, opts));
|
|
225
|
+
// Written in an effect and read during render, which is the order that makes
|
|
226
|
+
// it work: a key change clears `data` on the render where the ref still holds
|
|
227
|
+
// the previous commit's size, so the host's box keeps the height it had rather
|
|
228
|
+
// than collapsing to nothing while the next figure draws.
|
|
229
|
+
const lastSize = useRef(undefined);
|
|
230
|
+
useEffect(() => {
|
|
231
|
+
if (snapshot) {
|
|
232
|
+
lastSize.current = { width: snapshot.width, height: snapshot.height };
|
|
233
|
+
}
|
|
234
|
+
}, [snapshot]);
|
|
235
|
+
const size = snapshot ?? lastSize.current;
|
|
236
|
+
return {
|
|
237
|
+
figure: snapshot ? (_jsx(FrozenSvgFigure, { view: view, snapshot: snapshot })) : undefined,
|
|
238
|
+
width: size?.width,
|
|
239
|
+
height: size?.height,
|
|
240
|
+
locstring: snapshot?.locstring,
|
|
241
|
+
skipped: snapshot?.skipped ?? [],
|
|
242
|
+
error,
|
|
243
|
+
isLoading,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
@@ -1,8 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
prefersOffset?: boolean;
|
|
9
|
+
}[];
|
|
3
10
|
}
|
|
4
|
-
interface
|
|
5
|
-
|
|
11
|
+
export interface SvgDisplayResult {
|
|
12
|
+
track: {
|
|
13
|
+
configuration: AnyConfigurationModel;
|
|
14
|
+
displays: {
|
|
15
|
+
height: number;
|
|
16
|
+
regionTooLarge?: boolean;
|
|
17
|
+
drawsWhenTooLarge?: boolean;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
result: ReactNode;
|
|
6
21
|
}
|
|
7
|
-
export declare
|
|
22
|
+
export declare const trackSpacing = 2;
|
|
23
|
+
export declare function gridlineTickXs(model: {
|
|
24
|
+
staticBlocksTranslateX: number;
|
|
25
|
+
gridlineTicks: {
|
|
26
|
+
major: boolean;
|
|
27
|
+
x: number;
|
|
28
|
+
}[];
|
|
29
|
+
}): {
|
|
30
|
+
dx: number;
|
|
31
|
+
major: number[];
|
|
32
|
+
minor: number[];
|
|
33
|
+
};
|
|
34
|
+
export declare function vlinePath(xs: number[], y1: number, y2: number): string;
|
|
35
|
+
export declare function labelInkHeight(fontSize: number): number;
|
|
36
|
+
/**
|
|
37
|
+
* Baseline y for a label whose ink box should start at `topY` — roughly what
|
|
38
|
+
* `dominantBaseline="hanging"` asks the renderer for, but resolved here.
|
|
39
|
+
*
|
|
40
|
+
* Not a renderer-compatibility workaround (`dominant-baseline` is well
|
|
41
|
+
* supported, and SvgCanvas emits it on every feature label it writes). The
|
|
42
|
+
* point is that this file already *models* the ink box, in LABEL_INK_EM /
|
|
43
|
+
* LABEL_DESCENT_EM, and reserves vertical space from that model —
|
|
44
|
+
* `getHeaderLayout` budgets `labelInkHeight(fontSize)` for the scalebar's bp
|
|
45
|
+
* label, `defaultTextHeight` for an offset track label. A label placed with
|
|
46
|
+
* `hanging` is instead positioned by the renderer's own notion of the font's
|
|
47
|
+
* ascent, so the space reserved and the space used come from two different
|
|
48
|
+
* models that merely happen to agree closely at the sizes we ship. Resolving
|
|
49
|
+
* the baseline from the same constants makes them one model, which is what lets
|
|
50
|
+
* util.test.ts check placement against reservation at all.
|
|
51
|
+
*/
|
|
52
|
+
export declare function labelBaselineFromTop(topY: number, fontSize: number): number;
|
|
53
|
+
export declare function defaultTextHeight(fontSize: number): number;
|
|
54
|
+
export declare function offsetLabelBaselineY(textHeight: number, fontSize: number): number;
|
|
55
|
+
export declare function insetLabelBaselineY(fontSize: number): number;
|
|
56
|
+
export declare function getRowHeaderLayout({ fontSize, showScalebar, }: {
|
|
57
|
+
fontSize: number;
|
|
58
|
+
showScalebar: boolean;
|
|
59
|
+
}): {
|
|
60
|
+
scalebarLineY: number | undefined;
|
|
61
|
+
assemblyLabelBaselineY: number;
|
|
62
|
+
bandHeight: number;
|
|
63
|
+
};
|
|
64
|
+
export type HeaderLayout = ReturnType<typeof getHeaderLayout>;
|
|
65
|
+
export declare function getHeaderLayout({ fontSize, showCytobands, rulerHeight, }: {
|
|
66
|
+
fontSize: number;
|
|
67
|
+
showCytobands: boolean;
|
|
68
|
+
rulerHeight: number;
|
|
69
|
+
}): {
|
|
70
|
+
assemblyLabelBaselineY: number;
|
|
71
|
+
cytobandTop: number;
|
|
72
|
+
scalebarLineY: number;
|
|
73
|
+
rulerTop: number;
|
|
74
|
+
tracksTop: number;
|
|
75
|
+
};
|
|
76
|
+
export declare const RULER_MAJOR_TICK = 5;
|
|
77
|
+
export declare const RULER_MINOR_TICK = 3;
|
|
78
|
+
export declare function getRulerLayout(rulerHeight: number): {
|
|
79
|
+
tickTopY: number;
|
|
80
|
+
numbersBaselineY: number;
|
|
81
|
+
};
|
|
82
|
+
export declare const refNameLabelBoxHeight: number;
|
|
83
|
+
export declare const refNameLabelBaselineY: number;
|
|
84
|
+
export declare function trackLabelMode(track: TrackHeights, trackLabels: TrackLabelMode): TrackLabelMode;
|
|
85
|
+
export declare function labelOffset(track: TrackHeights, trackLabels: TrackLabelMode, textHeight: number): number;
|
|
86
|
+
export declare const TRACK_LABEL_GAP = 40;
|
|
87
|
+
export declare function trackLabelLeftOffset({ tracks, trackLabels, fontSize, fontFamily, session, }: {
|
|
88
|
+
tracks: {
|
|
89
|
+
configuration: AnyConfigurationModel;
|
|
90
|
+
}[];
|
|
91
|
+
trackLabels: TrackLabelMode;
|
|
92
|
+
fontSize: number;
|
|
93
|
+
fontFamily?: string;
|
|
94
|
+
session: TrackCatalog;
|
|
95
|
+
}): number;
|
|
96
|
+
export declare function trackBoxHeight(track: TrackHeights, trackLabels: TrackLabelMode, textHeight: number): number;
|
|
97
|
+
export declare function trackBoxOffsets(tracks: TrackHeights[], trackLabels: TrackLabelMode, textHeight: number): number[];
|
|
98
|
+
export declare function totalHeight(tracks: TrackHeights[], trackLabels: TrackLabelMode, textHeight: number): number;
|
|
8
99
|
export {};
|