higlass 1.13.5 → 2.0.0
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/README.md +48 -54
- package/app/globals.d.ts +1 -1
- package/app/missing-types.d.ts +4 -1
- package/app/scripts/AddTrackDialog.jsx +11 -4
- package/app/scripts/AddTrackPositionMenu.jsx +28 -7
- package/app/scripts/Annotations1dTrack.js +90 -251
- package/app/scripts/Annotations2dTrack.js +12 -7
- package/app/scripts/Autocomplete.jsx +13 -28
- package/app/scripts/AxisPixi.js +6 -10
- package/app/scripts/BarTrack.js +3 -3
- package/app/scripts/BedLikeTrack.js +556 -449
- package/app/scripts/Button.jsx +1 -1
- package/app/scripts/CNVIntervalTrack.js +1 -1
- package/app/scripts/CenterTrack.jsx +8 -7
- package/app/scripts/Chromosome2DAnnotations.js +1 -1
- package/app/scripts/Chromosome2DLabels.js +1 -1
- package/app/scripts/ChromosomeGrid.js +49 -38
- package/app/scripts/ChromosomeInfo.js +1 -1
- package/app/scripts/CombinedTrack.js +3 -1
- package/app/scripts/ConfigTrackMenu.jsx +1 -1
- package/app/scripts/ConfigViewMenu.jsx +2 -2
- package/app/scripts/ContextMenuContainer.jsx +4 -2
- package/app/scripts/ContextMenuItem.jsx +14 -2
- package/app/scripts/CrossRule.js +1 -1
- package/app/scripts/CustomTrackDialog.jsx +2 -2
- package/app/scripts/Dialog.jsx +2 -2
- package/app/scripts/DragListeningDiv.jsx +1 -1
- package/app/scripts/DraggableDiv.jsx +2 -3
- package/app/scripts/ExportLinkDialog.jsx +1 -1
- package/app/scripts/FilledLine.js +349 -0
- package/app/scripts/GalleryTracks.jsx +77 -78
- package/app/scripts/GenomePositionSearchBox.jsx +184 -482
- package/app/scripts/HeatmapOptions.jsx +4 -2
- package/app/scripts/HeatmapTiledPixiTrack.js +23 -32
- package/app/scripts/HiGlassComponent.jsx +515 -444
- package/app/scripts/HiGlassComponentContext.js +5 -0
- package/app/scripts/Horizontal1dHeatmapTrack.js +1 -1
- package/app/scripts/Horizontal2DDomainsTrack.js +1 -1
- package/app/scripts/HorizontalChromosomeLabels.js +28 -22
- package/app/scripts/HorizontalGeneAnnotationsTrack.js +1 -1
- package/app/scripts/HorizontalHeatmapTrack.js +2 -2
- package/app/scripts/HorizontalMultivecTrack.js +6 -7
- package/app/scripts/HorizontalRule.js +1 -2
- package/app/scripts/HorizontalTiled1DPixiTrack.js +4 -4
- package/app/scripts/HorizontalTiledPlot.jsx +9 -9
- package/app/scripts/LeftTrackModifier.js +4 -0
- package/app/scripts/ListWrapper.jsx +1 -2
- package/app/scripts/MapboxTilesTrack.js +1 -2
- package/app/scripts/Modal.jsx +2 -2
- package/app/scripts/MoveableTrack.jsx +10 -12
- package/app/scripts/NestedContextMenu.jsx +2 -1
- package/app/scripts/OSMTileIdsTrack.js +1 -1
- package/app/scripts/OverlayTrack.js +4 -4
- package/app/scripts/PixiTrack.js +27 -13
- package/app/scripts/PlotTypeChooser.jsx +3 -4
- package/app/scripts/SearchField.js +5 -5
- package/app/scripts/SeriesListItems.jsx +3 -4
- package/app/scripts/SeriesListMenu.jsx +95 -53
- package/app/scripts/SeriesListSubmenuMixin.jsx +2 -1
- package/app/scripts/SketchInlinePicker.jsx +2 -2
- package/app/scripts/SortableList.jsx +1 -1
- package/app/scripts/Tiled1DPixiTrack.js +4 -1
- package/app/scripts/TiledPixiTrack.js +244 -102
- package/app/scripts/TiledPlot.jsx +565 -118
- package/app/scripts/TilesetFinder.jsx +12 -4
- package/app/scripts/Track.js +1 -1
- package/app/scripts/TrackArea.jsx +4 -0
- package/app/scripts/TrackControl.jsx +2 -2
- package/app/scripts/TrackRenderer.jsx +32 -33
- package/app/scripts/ValueIntervalTrack.js +1 -1
- package/app/scripts/VerticalRule.js +2 -2
- package/app/scripts/VerticalTiledPlot.jsx +7 -7
- package/app/scripts/ViewConfigEditor.jsx +1 -1
- package/app/scripts/ViewContextMenu.jsx +53 -5
- package/app/scripts/ViewHeader.jsx +9 -9
- package/app/scripts/ViewportTracker2D.js +1 -1
- package/app/scripts/api.js +92 -12
- package/app/scripts/configs/available-track-types.js +1 -1
- package/app/scripts/configs/index.js +6 -1
- package/app/scripts/configs/positions-by-datatype.js +2 -2
- package/app/scripts/configs/primitives.js +2 -0
- package/app/scripts/configs/themes.js +0 -1
- package/app/scripts/configs/tracks-info-by-type.js +11 -8
- package/app/scripts/configs/tracks-info.js +3 -2
- package/app/scripts/d3-context-menu.js +3 -4
- package/app/scripts/data-fetchers/DataFetcher.js +35 -36
- package/app/scripts/data-fetchers/genbank-fetcher.js +13 -22
- package/app/scripts/data-fetchers/local-tile-fetcher.js +10 -8
- package/app/scripts/hglib.jsx +62 -71
- package/app/scripts/hocs/with-modal.jsx +32 -10
- package/app/scripts/hocs/with-pub-sub.js +12 -3
- package/app/scripts/hocs/with-theme.jsx +21 -14
- package/app/scripts/icons.jsx +3 -2
- package/app/scripts/mixwith.js +2 -2
- package/app/scripts/options-info.js +49 -11
- package/app/scripts/plugins/get-data-fetcher.js +2 -3
- package/app/scripts/services/chrom-info.js +32 -4
- package/app/scripts/services/element-resize-listener.js +2 -2
- package/app/scripts/services/index.js +0 -1
- package/app/scripts/services/tile-proxy.js +368 -285
- package/app/scripts/services/worker.js +31 -28
- package/app/scripts/test-helpers/index.js +2 -1
- package/app/scripts/test-helpers/test-helpers.jsx +157 -69
- package/app/scripts/types.ts +118 -47
- package/app/scripts/utils/LruCache.js +3 -2
- package/app/scripts/utils/assert.js +19 -0
- package/app/scripts/utils/background-task-scheduler.js +2 -0
- package/app/scripts/utils/color-domain-to-rgba-array.js +13 -3
- package/app/scripts/utils/copy-text-to-clipboard.js +36 -0
- package/app/scripts/utils/decompress.js +33 -0
- package/app/scripts/utils/default-tracks.js +46 -0
- package/app/scripts/utils/dict-items.js +1 -0
- package/app/scripts/utils/dict-keys.js +1 -0
- package/app/scripts/utils/dict-values.js +1 -0
- package/app/scripts/utils/expand-combined-tracks.js +11 -7
- package/app/scripts/utils/fill-in-min-widths.js +47 -21
- package/app/scripts/utils/flatten.js +0 -1
- package/app/scripts/utils/get-aggregation-function.js +1 -1
- package/app/scripts/utils/get-default-track-for-datatype.js +37 -10
- package/app/scripts/utils/get-default-tracks-for-datatype.ts +46 -0
- package/app/scripts/utils/get-higlass-components.js +27 -3
- package/app/scripts/utils/get-track-position-by-uid.js +8 -1
- package/app/scripts/utils/get-xylofon.js +12 -9
- package/app/scripts/utils/has-parent.js +5 -5
- package/app/scripts/utils/hex-string-to-int.js +1 -1
- package/app/scripts/utils/index.js +1 -0
- package/app/scripts/utils/interval-tree.js +222 -177
- package/app/scripts/utils/load-chrom-infos.js +4 -1
- package/app/scripts/utils/pixi-text-to-svg.js +5 -9
- package/app/scripts/utils/positioned-tracks-to-all-tracks.js +55 -0
- package/app/scripts/utils/range-query-2d.js +3 -3
- package/app/scripts/utils/reduce.js +12 -5
- package/app/scripts/utils/segments-to-rows.js +14 -11
- package/app/scripts/utils/svg-line.js +7 -8
- package/app/scripts/utils/type-guards.js +16 -7
- package/app/scripts/utils/visit-positioned-tracks.js +9 -4
- package/app/styles/AddTrackPositionMenu.module.scss +37 -0
- package/app/styles/HiGlass.module.scss +3 -1
- package/app/styles/d3-context-menu.css +0 -1
- package/app/styles/prism.css +1 -0
- package/dist/app/schema.json +525 -0
- package/dist/app/scripts/AddTrackDialog.d.ts +64 -0
- package/dist/app/scripts/AddTrackPositionMenu.d.ts +5 -0
- package/dist/app/scripts/Annotations1dTrack.d.ts +15 -0
- package/dist/app/scripts/Annotations2dTrack.d.ts +95 -0
- package/dist/app/scripts/ArrowheadDomainsTrack.d.ts +36 -0
- package/dist/app/scripts/Autocomplete.d.ts +102 -0
- package/dist/app/scripts/AxisPixi.d.ts +25 -0
- package/dist/app/scripts/BarTrack.d.ts +28 -0
- package/dist/app/scripts/BedLikeTrack.d.ts +84 -0
- package/dist/app/scripts/Button.d.ts +3 -0
- package/dist/app/scripts/CNVIntervalTrack.d.ts +12 -0
- package/dist/app/scripts/CenterTiledPlot.d.ts +3 -0
- package/dist/app/scripts/CenterTrack.d.ts +92 -0
- package/dist/app/scripts/Chromosome2DAnnotations.d.ts +10 -0
- package/dist/app/scripts/Chromosome2DLabels.d.ts +13 -0
- package/dist/app/scripts/ChromosomeGrid.d.ts +24 -0
- package/dist/app/scripts/ChromosomeInfo.d.ts +14 -0
- package/dist/app/scripts/CloseTrackMenu.d.ts +10 -0
- package/dist/app/scripts/CombinedTrack.d.ts +32 -0
- package/dist/app/scripts/ConfigTrackMenu.d.ts +10 -0
- package/dist/app/scripts/ConfigViewMenu.d.ts +34 -0
- package/dist/app/scripts/ConfigureSeriesMenu.d.ts +3 -0
- package/dist/app/scripts/ContextMenuContainer.d.ts +36 -0
- package/dist/app/scripts/ContextMenuItem.d.ts +34 -0
- package/dist/app/scripts/Cross.d.ts +3 -0
- package/dist/app/scripts/CrossRule.d.ts +24 -0
- package/dist/app/scripts/CustomTrackDialog.d.ts +17 -0
- package/dist/app/scripts/Dialog.d.ts +5 -0
- package/dist/app/scripts/DivergentBarTrack.d.ts +4 -0
- package/dist/app/scripts/DragListeningDiv.d.ts +32 -0
- package/dist/app/scripts/DraggableDiv.d.ts +63 -0
- package/dist/app/scripts/ExportLinkDialog.d.ts +21 -0
- package/dist/app/scripts/FilledLine.d.ts +5 -0
- package/dist/app/scripts/FixedTrack.d.ts +5 -0
- package/dist/app/scripts/GalleryTracks.d.ts +20 -0
- package/dist/app/scripts/GenomePositionSearchBox.d.ts +95 -0
- package/dist/app/scripts/HeatmapOptions.d.ts +30 -0
- package/dist/app/scripts/HeatmapTiledPixiTrack.d.ts +184 -0
- package/dist/app/scripts/HiGlassComponent.d.ts +762 -0
- package/dist/app/scripts/HiGlassComponentContext.d.ts +3 -0
- package/dist/app/scripts/HiGlassTrackComponent.d.ts +37 -0
- package/dist/app/scripts/Horizontal1dHeatmapTrack.d.ts +9 -0
- package/dist/app/scripts/Horizontal2DDomainsTrack.d.ts +21 -0
- package/dist/app/scripts/HorizontalChromosomeLabels.d.ts +47 -0
- package/dist/app/scripts/HorizontalGeneAnnotationsTrack.d.ts +25 -0
- package/dist/app/scripts/HorizontalHeatmapTrack.d.ts +12 -0
- package/dist/app/scripts/HorizontalItem.d.ts +3 -0
- package/dist/app/scripts/HorizontalLine1DPixiTrack.d.ts +23 -0
- package/dist/app/scripts/HorizontalMultivecTrack.d.ts +50 -0
- package/dist/app/scripts/HorizontalPoint1DPixiTrack.d.ts +5 -0
- package/dist/app/scripts/HorizontalRule.d.ts +22 -0
- package/dist/app/scripts/HorizontalTiled1DPixiTrack.d.ts +26 -0
- package/dist/app/scripts/HorizontalTiledPlot.d.ts +49 -0
- package/dist/app/scripts/HorizontalTrack.d.ts +6 -0
- package/dist/app/scripts/Id2DTiledPixiTrack.d.ts +10 -0
- package/dist/app/scripts/IdHorizontal1DTiledPixiTrack.d.ts +6 -0
- package/dist/app/scripts/IdVertical1DTiledPixiTrack.d.ts +7 -0
- package/dist/app/scripts/LeftAxisTrack.d.ts +9 -0
- package/dist/app/scripts/LeftTrackModifier.d.ts +29 -0
- package/dist/app/scripts/ListWrapper.d.ts +64 -0
- package/dist/app/scripts/MapboxTilesTrack.d.ts +9 -0
- package/dist/app/scripts/Modal.d.ts +5 -0
- package/dist/app/scripts/MoveableTrack.d.ts +18 -0
- package/dist/app/scripts/NestedContextMenu.d.ts +7 -0
- package/dist/app/scripts/OSMTileIdsTrack.d.ts +5 -0
- package/dist/app/scripts/OSMTilesTrack.d.ts +129 -0
- package/dist/app/scripts/OverlayTrack.d.ts +13 -0
- package/dist/app/scripts/PixiTrack.d.ts +174 -0
- package/dist/app/scripts/PlotTypeChooser.d.ts +25 -0
- package/dist/app/scripts/PopupMenu.d.ts +28 -0
- package/dist/app/scripts/RasterTilesTrack.d.ts +9 -0
- package/dist/app/scripts/RuleMixin.d.ts +2 -0
- package/dist/app/scripts/SVGTrack.d.ts +15 -0
- package/dist/app/scripts/SearchField.d.ts +13 -0
- package/dist/app/scripts/SeriesListItems.d.ts +2 -0
- package/dist/app/scripts/SeriesListMenu.d.ts +51 -0
- package/dist/app/scripts/SeriesListSubmenuMixin.d.ts +2 -0
- package/dist/app/scripts/SketchInlinePicker.d.ts +25 -0
- package/dist/app/scripts/SortableList.d.ts +22 -0
- package/dist/app/scripts/SquareMarkersTrack.d.ts +22 -0
- package/dist/app/scripts/Tiled1DPixiTrack.d.ts +60 -0
- package/dist/app/scripts/TiledPixiTrack.d.ts +369 -0
- package/dist/app/scripts/TiledPlot.d.ts +313 -0
- package/dist/app/scripts/TilesetFinder.d.ts +65 -0
- package/dist/app/scripts/TopAxisTrack.d.ts +9 -0
- package/dist/app/scripts/Track.d.ts +196 -0
- package/dist/app/scripts/TrackArea.d.ts +26 -0
- package/dist/app/scripts/TrackControl.d.ts +5 -0
- package/dist/app/scripts/TrackRenderer.d.ts +724 -0
- package/dist/app/scripts/UnknownPixiTrack.d.ts +7 -0
- package/dist/app/scripts/ValueIntervalTrack.d.ts +6 -0
- package/dist/app/scripts/VerticalItem.d.ts +3 -0
- package/dist/app/scripts/VerticalRule.d.ts +21 -0
- package/dist/app/scripts/VerticalTiled1DPixiTrack.d.ts +6 -0
- package/dist/app/scripts/VerticalTiledPlot.d.ts +50 -0
- package/dist/app/scripts/VerticalTrack.d.ts +6 -0
- package/dist/app/scripts/ViewConfigEditor.d.ts +53 -0
- package/dist/app/scripts/ViewContextMenu.d.ts +17 -0
- package/dist/app/scripts/ViewHeader.d.ts +75 -0
- package/dist/app/scripts/ViewportTracker2D.d.ts +17 -0
- package/dist/app/scripts/ViewportTracker2DPixi.d.ts +11 -0
- package/dist/app/scripts/ViewportTrackerHorizontal.d.ts +17 -0
- package/dist/app/scripts/ViewportTrackerVertical.d.ts +17 -0
- package/dist/app/scripts/api.d.ts +640 -0
- package/dist/app/scripts/configs/available-track-types.d.ts +2 -0
- package/dist/app/scripts/configs/colormaps.d.ts +2 -0
- package/dist/app/scripts/configs/datatype-to-track-type.d.ts +4 -0
- package/dist/app/scripts/configs/default-tracks-for-datatype.d.ts +38 -0
- package/dist/app/scripts/configs/dense-data-extrema-config.d.ts +2 -0
- package/dist/app/scripts/configs/globals.d.ts +5 -0
- package/dist/app/scripts/configs/index.d.ts +16 -0
- package/dist/app/scripts/configs/positions-by-datatype.d.ts +2 -0
- package/dist/app/scripts/configs/primitives.d.ts +20 -0
- package/dist/app/scripts/configs/themes.d.ts +3 -0
- package/dist/app/scripts/configs/tracks-info-by-type.d.ts +4 -0
- package/dist/app/scripts/configs/tracks-info.d.ts +24 -0
- package/dist/app/scripts/d3-context-menu.d.ts +2 -0
- package/dist/app/scripts/data-fetchers/DataFetcher.d.ts +151 -0
- package/dist/app/scripts/data-fetchers/genbank-fetcher.d.ts +86 -0
- package/dist/app/scripts/data-fetchers/index.d.ts +3 -0
- package/dist/app/scripts/data-fetchers/local-tile-fetcher.d.ts +47 -0
- package/dist/app/scripts/gosling-exports.d.ts +17 -0
- package/dist/app/scripts/hglib.d.ts +24 -0
- package/dist/app/scripts/hocs/with-modal.d.ts +19 -0
- package/dist/app/scripts/hocs/with-pub-sub.d.ts +22 -0
- package/dist/app/scripts/hocs/with-theme.d.ts +13 -0
- package/dist/app/scripts/icons.d.ts +161 -0
- package/dist/app/scripts/mixwith.d.ts +27 -0
- package/dist/app/scripts/options-info.d.ts +1355 -0
- package/dist/app/scripts/plugins/available-for-plugins.d.ts +2338 -0
- package/dist/app/scripts/plugins/get-data-fetcher.d.ts +2 -0
- package/dist/app/scripts/plugins/index.d.ts +2 -0
- package/dist/app/scripts/services/chrom-info.d.ts +10 -0
- package/dist/app/scripts/services/dom-event.d.ts +7 -0
- package/dist/app/scripts/services/element-resize-listener.d.ts +5 -0
- package/dist/app/scripts/services/index.d.ts +5 -0
- package/dist/app/scripts/services/tile-proxy.d.ts +180 -0
- package/dist/app/scripts/services/worker.d.ts +157 -0
- package/dist/app/scripts/symbol.d.ts +13 -0
- package/dist/app/scripts/test-helpers/index.d.ts +1 -0
- package/dist/app/scripts/test-helpers/test-helpers.d.ts +33 -0
- package/dist/app/scripts/track-utils.d.ts +73 -0
- package/dist/app/scripts/types.d.ts +199 -0
- package/dist/app/scripts/utils/DenseDataExtrema1D.d.ts +88 -0
- package/dist/app/scripts/utils/DenseDataExtrema2D.d.ts +97 -0
- package/dist/app/scripts/utils/LruCache.d.ts +44 -0
- package/dist/app/scripts/utils/abs-to-chr.d.ts +14 -0
- package/dist/app/scripts/utils/accessor-transposition.d.ts +14 -0
- package/dist/app/scripts/utils/add-arrays.d.ts +18 -0
- package/dist/app/scripts/utils/add-class.d.ts +8 -0
- package/dist/app/scripts/utils/add-event-listener-once.d.ts +11 -0
- package/dist/app/scripts/utils/assert.d.ts +17 -0
- package/dist/app/scripts/utils/background-task-scheduler.d.ts +47 -0
- package/dist/app/scripts/utils/base64-to-canvas.d.ts +9 -0
- package/dist/app/scripts/utils/chr-to-abs.d.ts +10 -0
- package/dist/app/scripts/utils/chrom-info-bisector.d.ts +4 -0
- package/dist/app/scripts/utils/clone-event.d.ts +12 -0
- package/dist/app/scripts/utils/color-domain-to-rgba-array.d.ts +13 -0
- package/dist/app/scripts/utils/color-to-hex.d.ts +9 -0
- package/dist/app/scripts/utils/color-to-rgba.d.ts +9 -0
- package/dist/app/scripts/utils/copy-text-to-clipboard.d.ts +2 -0
- package/dist/app/scripts/utils/data-to-genomic-loci.d.ts +11 -0
- package/dist/app/scripts/utils/debounce.d.ts +5 -0
- package/dist/app/scripts/utils/dec-to-hex-str.d.ts +8 -0
- package/dist/app/scripts/utils/decompress.d.ts +27 -0
- package/dist/app/scripts/utils/default-tracks.d.ts +3 -0
- package/dist/app/scripts/utils/dict-from-tuples.d.ts +11 -0
- package/dist/app/scripts/utils/dict-items.d.ts +18 -0
- package/dist/app/scripts/utils/dict-keys.d.ts +10 -0
- package/dist/app/scripts/utils/dict-values.d.ts +8 -0
- package/dist/app/scripts/utils/download.d.ts +7 -0
- package/dist/app/scripts/utils/expand-combined-tracks.d.ts +11 -0
- package/dist/app/scripts/utils/fake-pub-sub.d.ts +11 -0
- package/dist/app/scripts/utils/fill-in-min-widths.d.ts +44 -0
- package/dist/app/scripts/utils/flatten.d.ts +9 -0
- package/dist/app/scripts/utils/for-each.d.ts +9 -0
- package/dist/app/scripts/utils/forward-event.d.ts +7 -0
- package/dist/app/scripts/utils/genome-loci-to-pixels.d.ts +9 -0
- package/dist/app/scripts/utils/genomic-range-to-chromosome-chunks.d.ts +21 -0
- package/dist/app/scripts/utils/get-aggregation-function.d.ts +10 -0
- package/dist/app/scripts/utils/get-default-track-for-datatype.d.ts +21 -0
- package/dist/app/scripts/utils/get-default-tracks-for-datatype.d.ts +3 -0
- package/dist/app/scripts/utils/get-element-dim.d.ts +7 -0
- package/dist/app/scripts/utils/get-higlass-components.d.ts +7 -0
- package/dist/app/scripts/utils/get-track-by-uid.d.ts +7 -0
- package/dist/app/scripts/utils/get-track-conf-from-hgc.d.ts +10 -0
- package/dist/app/scripts/utils/get-track-obj-by-id.d.ts +2 -0
- package/dist/app/scripts/utils/get-track-position-by-uid.d.ts +13 -0
- package/dist/app/scripts/utils/get-xylofon.d.ts +2 -0
- package/dist/app/scripts/utils/gradient.d.ts +14 -0
- package/dist/app/scripts/utils/has-class.d.ts +8 -0
- package/dist/app/scripts/utils/has-parent.d.ts +9 -0
- package/dist/app/scripts/utils/hex-string-to-int.d.ts +14 -0
- package/dist/app/scripts/utils/index.d.ts +89 -0
- package/dist/app/scripts/utils/interval-tree.d.ts +109 -0
- package/dist/app/scripts/utils/into-the-void.d.ts +6 -0
- package/dist/app/scripts/utils/is-track-or-child-track.d.ts +7 -0
- package/dist/app/scripts/utils/is-track-range-selectable.d.ts +2 -0
- package/dist/app/scripts/utils/is-within.d.ts +12 -0
- package/dist/app/scripts/utils/lat-to-y.d.ts +9 -0
- package/dist/app/scripts/utils/lng-to-x.d.ts +8 -0
- package/dist/app/scripts/utils/load-chrom-infos.d.ts +8 -0
- package/dist/app/scripts/utils/map.d.ts +13 -0
- package/dist/app/scripts/utils/max-non-zero.d.ts +6 -0
- package/dist/app/scripts/utils/max.d.ts +10 -0
- package/dist/app/scripts/utils/min-non-zero.d.ts +6 -0
- package/dist/app/scripts/utils/min.d.ts +10 -0
- package/dist/app/scripts/utils/mod.d.ts +9 -0
- package/dist/app/scripts/utils/ndarray-assign.d.ts +2 -0
- package/dist/app/scripts/utils/ndarray-flatten.d.ts +2 -0
- package/dist/app/scripts/utils/ndarray-to-list.d.ts +2 -0
- package/dist/app/scripts/utils/numericify-version.d.ts +6 -0
- package/dist/app/scripts/utils/obj-vals.d.ts +8 -0
- package/dist/app/scripts/utils/or.d.ts +8 -0
- package/dist/app/scripts/utils/parse-chromsizes-rows.d.ts +34 -0
- package/dist/app/scripts/utils/pixi-text-to-svg.d.ts +2 -0
- package/dist/app/scripts/utils/positioned-tracks-to-all-tracks.d.ts +26 -0
- package/dist/app/scripts/utils/q.d.ts +18 -0
- package/dist/app/scripts/utils/rad-to-deg.d.ts +7 -0
- package/dist/app/scripts/utils/range-query-2d.d.ts +17 -0
- package/dist/app/scripts/utils/reduce.d.ts +14 -0
- package/dist/app/scripts/utils/rel-to-abs-chrom-pos.d.ts +10 -0
- package/dist/app/scripts/utils/remove-class.d.ts +7 -0
- package/dist/app/scripts/utils/reset-d3-brush-style.d.ts +10 -0
- package/dist/app/scripts/utils/rgb-to-hex.d.ts +8 -0
- package/dist/app/scripts/utils/scales-center-and-k.d.ts +12 -0
- package/dist/app/scripts/utils/scales-to-genome-loci.d.ts +3 -0
- package/dist/app/scripts/utils/segments-to-rows.d.ts +15 -0
- package/dist/app/scripts/utils/selected-items-to-cum-weights.d.ts +12 -0
- package/dist/app/scripts/utils/selected-items-to-size.d.ts +13 -0
- package/dist/app/scripts/utils/show-mouse-position.d.ts +54 -0
- package/dist/app/scripts/utils/some.d.ts +10 -0
- package/dist/app/scripts/utils/sum.d.ts +8 -0
- package/dist/app/scripts/utils/svg-line.d.ts +2 -0
- package/dist/app/scripts/utils/throttle-and-debounce.d.ts +33 -0
- package/dist/app/scripts/utils/tile-to-canvas.d.ts +9 -0
- package/dist/app/scripts/utils/timeout.d.ts +3 -0
- package/dist/app/scripts/utils/to-void.d.ts +3 -0
- package/dist/app/scripts/utils/total-track-pixel-height.d.ts +27 -0
- package/dist/app/scripts/utils/trim-trailing-slash.d.ts +7 -0
- package/dist/app/scripts/utils/type-guards.d.ts +36 -0
- package/dist/app/scripts/utils/value-to-color.d.ts +12 -0
- package/dist/app/scripts/utils/visit-positioned-tracks.d.ts +18 -0
- package/dist/app/scripts/utils/visit-tracks.d.ts +9 -0
- package/dist/esm.html +1 -3
- package/dist/hglib.js +86315 -100592
- package/dist/hglib.min.js +123 -131
- package/dist/higlass.mjs +88861 -103138
- package/dist/index.html +1 -3
- package/dist/package.json +134 -0
- package/package.json +25 -27
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { scaleLinear, scaleLog } from 'd3-scale';
|
|
2
2
|
|
|
3
3
|
// utils
|
|
4
4
|
import DenseDataExtrema1D from '../utils/DenseDataExtrema1D';
|
|
@@ -11,9 +11,9 @@ import selectedItemsToSize from '../utils/selected-items-to-size';
|
|
|
11
11
|
* when selectedRowsOptions have been passed to workerSetPix().
|
|
12
12
|
*
|
|
13
13
|
* @param {ArrayLike<number>} data - The (2D) tile data array.
|
|
14
|
-
* @param {[numRows: number, numCols: number]} shape - Array shape (number of rows and columns).
|
|
14
|
+
* @param {readonly [numRows: number, numCols: number]} shape - Array shape (number of rows and columns).
|
|
15
15
|
* @param {(pixDataIndex: number, dataPoint: number) => void} setPixData - The setPixData function created by workerSetPix().
|
|
16
|
-
* @param {number
|
|
16
|
+
* @param {Array<number | Array<number>>} selectedRows - Row indices, for ordering and filtering rows. Used by the HorizontalMultivecTrack.
|
|
17
17
|
* @param {'mean' | 'sum' | 'variance' | 'deviation'} selectedRowsAggregationMode - The aggregation function to use ("mean", "sum", etc).
|
|
18
18
|
* @param {boolean} selectedRowsAggregationWithRelativeHeight - Whether the height of row groups should be relative to the size of the group.
|
|
19
19
|
* @param {'client' | 'server'} selectedRowsAggregationMethod - Where will the aggregation be performed? Possible values: "client", "server".
|
|
@@ -98,7 +98,7 @@ function setPixDataForSelectedRows(
|
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
100
|
* @typedef SelectedRowsOptions
|
|
101
|
-
* @property {number
|
|
101
|
+
* @property {Array<number | Array<number>>} selectedRows - Row indices, for ordering and filtering rows. Used by the HorizontalMultivecTrack.
|
|
102
102
|
* @property {'mean' | 'sum' | 'variance' | 'deviation'} selectedRowsAggregationMode - The aggregation function to use ("mean", "sum", etc).
|
|
103
103
|
* @property {boolean} selectedRowsAggregationWithRelativeHeight - Whether the height of row groups should be relative to the size of the group.
|
|
104
104
|
* @property {'client' | 'server'} selectedRowsAggregationMethod - Where will the aggregation be performed? Possible values: "client", "server".
|
|
@@ -110,15 +110,15 @@ function setPixDataForSelectedRows(
|
|
|
110
110
|
* (and subsequently passed to a PIXI sprite).
|
|
111
111
|
*
|
|
112
112
|
* @param {number} size - `data` parameter length. Often set to a tile's `tile.tileData.dense.length` value.
|
|
113
|
-
* @param {Array<number>} data - The tile data array.
|
|
113
|
+
* @param {Array<number> | Float32Array} data - The tile data array.
|
|
114
114
|
* @param {'log' | 'linear'} valueScaleType 'log' or 'linear'.
|
|
115
115
|
* @param {[number, number]} valueScaleDomain
|
|
116
116
|
* @param {number} pseudocount - The pseudocount is generally the minimum non-zero value and is
|
|
117
117
|
* used so that our log scaling doesn't lead to NaN values.
|
|
118
|
-
* @param {
|
|
118
|
+
* @param {ReadonlyArray<readonly [r: number, g: number, b: number, a: number]>} colorScale
|
|
119
119
|
* @param {boolean} ignoreUpperRight
|
|
120
120
|
* @param {boolean} ignoreLowerLeft
|
|
121
|
-
* @param {[numRows: number, numCols: number] | null} shape - Array `[numRows, numCols]`, used when iterating over a subset of rows,
|
|
121
|
+
* @param {readonly [numRows: number, numCols: number] | null} shape - Array `[numRows, numCols]`, used when iterating over a subset of rows,
|
|
122
122
|
* when one needs to know the width of each column.
|
|
123
123
|
* @param {[r: number, g: number, b: number, a: number] | null} zeroValueColor - The color to use for rendering zero data values, [r, g, b, a].
|
|
124
124
|
* @param {Partial<SelectedRowsOptions> | null} selectedRowsOptions - Rendering options when using a `selectRows` track option.
|
|
@@ -380,7 +380,8 @@ function uint16ArrayToFloat32Array(uint16array) {
|
|
|
380
380
|
|
|
381
381
|
/**
|
|
382
382
|
* @typedef TileResponse
|
|
383
|
-
* @property {string
|
|
383
|
+
* @property {string} [dense] - a base64 encoded string
|
|
384
|
+
* @property {string} [tilePositionId] - The position of the tile
|
|
384
385
|
*/
|
|
385
386
|
|
|
386
387
|
/**
|
|
@@ -391,7 +392,7 @@ function uint16ArrayToFloat32Array(uint16array) {
|
|
|
391
392
|
* @template {TileResponse} T
|
|
392
393
|
* @param {Record<string, T>} inputData
|
|
393
394
|
* @param {string} server
|
|
394
|
-
* @param {string
|
|
395
|
+
* @param {ReadonlyArray<string>} theseTileIds
|
|
395
396
|
*
|
|
396
397
|
* @returns {Record<string, CompletedTileData<T>>}
|
|
397
398
|
*
|
|
@@ -468,41 +469,43 @@ export function tileResponseToData(inputData, server, theseTileIds) {
|
|
|
468
469
|
/**
|
|
469
470
|
* Fetch tiles from the server.
|
|
470
471
|
*
|
|
471
|
-
* @
|
|
472
|
-
*
|
|
473
|
-
* @param {
|
|
474
|
-
* @param {string}
|
|
475
|
-
* @param {
|
|
476
|
-
* @param {Record<string, unknown>}
|
|
472
|
+
* @template {TileResponse} T
|
|
473
|
+
*
|
|
474
|
+
* @param {Object} request
|
|
475
|
+
* @param {string} request.server
|
|
476
|
+
* @param {ReadonlyArray<string>} request.tileIds
|
|
477
|
+
* @param {ReadonlyArray<{ tilesetUid: string, tileIds: Array<string>, options?: Record<string, unknown> }>} request.body
|
|
478
|
+
* @param {Object} options
|
|
479
|
+
* @param {string | null} [options.authHeader]
|
|
480
|
+
* @param {import("pub-sub-es").PubSub} [options.pubSub]
|
|
481
|
+
* @param {string} options.sessionId
|
|
477
482
|
*/
|
|
478
|
-
export function
|
|
479
|
-
outUrl,
|
|
480
|
-
server,
|
|
481
|
-
theseTileIds,
|
|
482
|
-
authHeader,
|
|
483
|
-
done,
|
|
484
|
-
requestBody,
|
|
485
|
-
) {
|
|
483
|
+
export function workerFetchTiles(request, options) {
|
|
486
484
|
/** @type {Record<string, string>} */
|
|
487
485
|
const headers = {
|
|
488
486
|
'content-type': 'application/json',
|
|
489
487
|
};
|
|
490
488
|
|
|
491
|
-
if (authHeader) headers.Authorization = authHeader;
|
|
489
|
+
if (options.authHeader) headers.Authorization = options.authHeader;
|
|
490
|
+
|
|
491
|
+
const renderParams = request.tileIds.map((x) => `d=${x}`).join('&');
|
|
492
|
+
const url = `${request.server}/tiles/?${renderParams}&s=${options.sessionId}`;
|
|
492
493
|
|
|
493
|
-
|
|
494
|
+
options.pubSub?.publish('requestSent', url);
|
|
495
|
+
return fetch(url, {
|
|
494
496
|
credentials: 'same-origin',
|
|
495
497
|
headers,
|
|
496
|
-
...(
|
|
498
|
+
...(request.body?.length > 0
|
|
497
499
|
? {
|
|
498
500
|
method: 'POST',
|
|
499
|
-
body: JSON.stringify(
|
|
501
|
+
body: JSON.stringify(request.body),
|
|
500
502
|
}
|
|
501
503
|
: {}),
|
|
502
504
|
})
|
|
503
505
|
.then((response) => response.json())
|
|
504
506
|
.then((data) => {
|
|
505
|
-
|
|
507
|
+
options.pubSub?.publish('requestReceived', url);
|
|
508
|
+
return tileResponseToData(data, request.server, request.tileIds);
|
|
506
509
|
})
|
|
507
510
|
.catch((err) => console.warn('err:', err));
|
|
508
511
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import ReactDOM from 'react-dom';
|
|
4
3
|
|
|
5
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
6
4
|
import { mount } from 'enzyme';
|
|
7
5
|
|
|
8
6
|
import { requestsInFlight } from '../services';
|
|
@@ -15,11 +13,12 @@ const TILE_LOADING_CHECK_INTERVAL = 100;
|
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* Change the options of a track in higlass
|
|
18
|
-
*
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @
|
|
16
|
+
*
|
|
17
|
+
* @param {import("enzyme").ReactWrapper<{}, {}, HiGlassComponent>} hgc - Enzyme wrapper for a HiGlassComponent
|
|
18
|
+
* @param {string} viewUid - The view uid
|
|
19
|
+
* @param {string} trackUid - The track uid
|
|
20
|
+
* @param {Record<string, unknown>} options - An object of new options (e.g. { color: 'black'})
|
|
21
|
+
* @returns {void}
|
|
23
22
|
*/
|
|
24
23
|
export const changeOptions = (hgc, viewUid, trackUid, options) => {
|
|
25
24
|
for (const { viewId, trackId, track } of hgc.instance().iterateOverTracks()) {
|
|
@@ -35,40 +34,77 @@ export const changeOptions = (hgc, viewUid, trackUid, options) => {
|
|
|
35
34
|
};
|
|
36
35
|
|
|
37
36
|
/**
|
|
38
|
-
* Check if there are any active transitions that we
|
|
39
|
-
* need to wait on
|
|
37
|
+
* Check if there are any active transitions that we need to wait on.
|
|
40
38
|
*
|
|
41
|
-
*
|
|
42
|
-
* ----------
|
|
43
|
-
* hgc: enzyme wrapper for a HiGlassComponent
|
|
39
|
+
* @param {HiGlassComponent} hgc
|
|
44
40
|
*
|
|
45
|
-
*
|
|
46
|
-
* -------
|
|
47
|
-
* True if any of the tracks have active transtions. False otherwise.
|
|
41
|
+
* @returns {boolean} Whether any of the tracks have active transtions.
|
|
48
42
|
*/
|
|
49
43
|
export const areTransitionsActive = (hgc) => {
|
|
50
44
|
for (const track of hgc.iterateOverTracks()) {
|
|
51
|
-
const trackRenderer = getTrackRenderer(hgc, track.viewId
|
|
45
|
+
const trackRenderer = getTrackRenderer(hgc, track.viewId);
|
|
52
46
|
|
|
53
|
-
if (trackRenderer
|
|
47
|
+
if (trackRenderer?.activeTransitions) return true;
|
|
54
48
|
}
|
|
55
49
|
return false;
|
|
56
50
|
};
|
|
57
51
|
|
|
58
52
|
/**
|
|
59
|
-
*
|
|
60
|
-
* calling the callback
|
|
53
|
+
* Waits for multiple elements to appear in the DOM.
|
|
61
54
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
55
|
+
* @param {HTMLElement} parent - The parent element to search within.
|
|
56
|
+
* @param {string[]} selectors - An array of CSS selectors for the elements to wait for.
|
|
57
|
+
* @returns {Promise<Array<HTMLElement>>}
|
|
58
|
+
*/
|
|
59
|
+
const waitForElements = (parent, selectors) => {
|
|
60
|
+
const foundElements = new Map();
|
|
61
|
+
/** @type {PromiseWithResolvers<Array<HTMLElement>>} */
|
|
62
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
63
|
+
|
|
64
|
+
const observer = new MutationObserver((mutations, obs) => {
|
|
65
|
+
selectors.forEach((selector) => {
|
|
66
|
+
if (!foundElements.has(selector)) {
|
|
67
|
+
const element = parent.querySelector(selector);
|
|
68
|
+
if (element) {
|
|
69
|
+
foundElements.set(selector, element);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// If all elements are found, trigger the callback and disconnect
|
|
75
|
+
if (foundElements.size === selectors.length) {
|
|
76
|
+
resolve([...foundElements.values()]); // Pass all elements to the callback
|
|
77
|
+
obs.disconnect();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
observer.observe(parent, {
|
|
82
|
+
childList: true,
|
|
83
|
+
subtree: true,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Initial check in case elements are already present
|
|
87
|
+
selectors.forEach((selector) => {
|
|
88
|
+
const element = parent.querySelector(selector);
|
|
89
|
+
if (element) {
|
|
90
|
+
foundElements.set(selector, element);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
if (foundElements.size === selectors.length) {
|
|
95
|
+
resolve([...foundElements.values()]);
|
|
96
|
+
observer.disconnect();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return promise;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Wait until all transitions have finished before calling the callback
|
|
104
|
+
*
|
|
105
|
+
* @param {HiGlassComponent} hgc
|
|
106
|
+
* @param {() => void} callback A callback to invoke when all tiles have been loaded.
|
|
107
|
+
* @returns {void}
|
|
72
108
|
*/
|
|
73
109
|
export const waitForTransitionsFinished = (hgc, callback) => {
|
|
74
110
|
if (areTransitionsActive(hgc)) {
|
|
@@ -83,12 +119,8 @@ export const waitForTransitionsFinished = (hgc, callback) => {
|
|
|
83
119
|
/**
|
|
84
120
|
* Wait until all open JSON requests are finished
|
|
85
121
|
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* finished: function
|
|
89
|
-
* A callback to call when there's no more JSON requests
|
|
90
|
-
* open
|
|
91
|
-
*
|
|
122
|
+
* @param {() => void} finished - A callback to invoke when there's no more JSON requests open.
|
|
123
|
+
* @returns {void}
|
|
92
124
|
*/
|
|
93
125
|
export const waitForJsonComplete = (finished) => {
|
|
94
126
|
if (requestsInFlight > 0) {
|
|
@@ -102,16 +134,11 @@ export const waitForJsonComplete = (finished) => {
|
|
|
102
134
|
};
|
|
103
135
|
|
|
104
136
|
/**
|
|
105
|
-
* Check if a HiGlassComponent is still waiting on tiles from a remote
|
|
106
|
-
* server.
|
|
137
|
+
* Check if a HiGlassComponent is still waiting on tiles from a remote server.
|
|
107
138
|
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* hgc: enzyme wrapper for a HiGlassComponent
|
|
139
|
+
* @param {HiGlassComponent} hgc
|
|
140
|
+
* @returns {boolean} Whether any of the tracks are wating for tiles.
|
|
111
141
|
*
|
|
112
|
-
* Returns
|
|
113
|
-
* -------
|
|
114
|
-
* True if any of the tracks are waiting for tiles, false otherwise.
|
|
115
142
|
*/
|
|
116
143
|
export const isWaitingOnTiles = (hgc) => {
|
|
117
144
|
for (const track of hgc.iterateOverTracks()) {
|
|
@@ -120,25 +147,27 @@ export const isWaitingOnTiles = (hgc) => {
|
|
|
120
147
|
if (
|
|
121
148
|
!track.track.server &&
|
|
122
149
|
!track.track.tilesetUid &&
|
|
123
|
-
!(track.track.data && track.track.data.type === 'divided')
|
|
150
|
+
!(track.track.data && track.track.data.type === 'divided') &&
|
|
151
|
+
!(track.track.data && track.track.data.type === 'local-tiles')
|
|
124
152
|
) {
|
|
125
153
|
continue;
|
|
126
|
-
}
|
|
154
|
+
}
|
|
155
|
+
if (
|
|
127
156
|
(track.track.data && track.track.data.type === 'divided') ||
|
|
128
|
-
(track.track.server && track.track.tilesetUid)
|
|
157
|
+
(track.track.server && track.track.tilesetUid) ||
|
|
158
|
+
(track.track.data && track.track.data.type === 'local-tiles')
|
|
129
159
|
) {
|
|
160
|
+
if (!trackObj) return true;
|
|
161
|
+
|
|
130
162
|
if (trackObj.originalTrack) {
|
|
131
163
|
trackObj = trackObj.originalTrack;
|
|
132
164
|
}
|
|
133
165
|
|
|
134
166
|
if (!(trackObj.tilesetInfo || trackObj.chromInfo)) {
|
|
135
|
-
// console.warn(
|
|
136
|
-
// `Track uuid:${trackObj.uuid} has no tileset or chromosome info`
|
|
137
|
-
// );
|
|
138
167
|
return true;
|
|
139
168
|
}
|
|
140
169
|
|
|
141
|
-
if (trackObj.fetching
|
|
170
|
+
if (trackObj.fetching?.size) {
|
|
142
171
|
return true;
|
|
143
172
|
}
|
|
144
173
|
} else {
|
|
@@ -149,22 +178,14 @@ export const isWaitingOnTiles = (hgc) => {
|
|
|
149
178
|
return false;
|
|
150
179
|
};
|
|
151
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Wait until all of the tiles in the HiGlassComponent are loaded until calling the callback
|
|
183
|
+
*
|
|
184
|
+
* @param {HiGlassComponent} hgc
|
|
185
|
+
* @param {(value?: unknown) => void} tilesLoadedCallback A callback to invoke whenever all of the tiles have been loaded.
|
|
186
|
+
* @returns {void}
|
|
187
|
+
*/
|
|
152
188
|
export const waitForTilesLoaded = (hgc, tilesLoadedCallback) => {
|
|
153
|
-
/**
|
|
154
|
-
* Wait until all of the tiles in the HiGlassComponent are loaded
|
|
155
|
-
* until calling the callback
|
|
156
|
-
*
|
|
157
|
-
* Arguments
|
|
158
|
-
* ---------
|
|
159
|
-
* hgc: Enzyme wrapper for a HiGlassComponent
|
|
160
|
-
* The componentthat we're waiting on
|
|
161
|
-
* tilesLoadedCallback: function
|
|
162
|
-
* The callback to call whenever all of the tiles
|
|
163
|
-
* have been loaded.
|
|
164
|
-
* Returns
|
|
165
|
-
* -------
|
|
166
|
-
* Nothing
|
|
167
|
-
*/
|
|
168
189
|
if (isWaitingOnTiles(hgc)) {
|
|
169
190
|
setTimeout(() => {
|
|
170
191
|
waitForTilesLoaded(hgc, tilesLoadedCallback);
|
|
@@ -178,10 +199,11 @@ export const waitForTilesLoaded = (hgc, tilesLoadedCallback) => {
|
|
|
178
199
|
/**
|
|
179
200
|
* Mount a new HiGlassComponent and unmount the previously visible one.
|
|
180
201
|
*
|
|
181
|
-
* @param {
|
|
182
|
-
* @param {import(
|
|
183
|
-
*
|
|
184
|
-
* @param {
|
|
202
|
+
* @param {HTMLDivElement | null} prevDiv - A div element to detach and recreate for the component
|
|
203
|
+
* @param {import("enzyme").ReactWrapper<{}, {}, HiGlassComponent> | null} prevHgc
|
|
204
|
+
* @param {Record<string, unknown>} viewConf
|
|
205
|
+
* @param {(value?: unknown) => void} done - The callback to call when the component is fully loaded
|
|
206
|
+
* @param {{ style?: string, bounded?: boolean, extendedDelay?: boolean }} [options]
|
|
185
207
|
*/
|
|
186
208
|
export const mountHGComponent = (
|
|
187
209
|
prevDiv,
|
|
@@ -214,6 +236,7 @@ export const mountHGComponent = (
|
|
|
214
236
|
div.setAttribute('style', style);
|
|
215
237
|
div.setAttribute('id', 'simple-hg-component');
|
|
216
238
|
|
|
239
|
+
/** @type {import("enzyme").ReactWrapper<{}, {}, HiGlassComponent>} */
|
|
217
240
|
const hgc = mount(
|
|
218
241
|
<HiGlassComponent options={{ bounded }} viewConfig={viewConf} />,
|
|
219
242
|
{ attachTo: div },
|
|
@@ -241,6 +264,62 @@ export const mountHGComponent = (
|
|
|
241
264
|
return /** @type {const} */ ([div, hgc]);
|
|
242
265
|
};
|
|
243
266
|
|
|
267
|
+
/** Wait for scales to stop changing.
|
|
268
|
+
*
|
|
269
|
+
* @param {HiGlassComponent} hgc
|
|
270
|
+
* @param {string} viewUid
|
|
271
|
+
* @param {Object} options
|
|
272
|
+
* @param {number} [options.initialWait] - The interval (in milliseconds) that is waited before the first size check.
|
|
273
|
+
* @param {number} [options.timeInterval] - The interval (in milliseconds) between size checks.
|
|
274
|
+
* @param {number} [options.maxTime] - The maximum time (in milliseconds) to wait for stabilization.
|
|
275
|
+
* @returns {Promise<void>}
|
|
276
|
+
*/
|
|
277
|
+
export const waitForScalesStabilized = async (hgc, viewUid, options) => {
|
|
278
|
+
const { initialWait = 500, timeInterval = 100, maxTime = 3000 } = options;
|
|
279
|
+
const xScaleDomain = [0, 0];
|
|
280
|
+
const yScaleDomain = [0, 0];
|
|
281
|
+
|
|
282
|
+
await new Promise((r) => setTimeout(r, initialWait));
|
|
283
|
+
|
|
284
|
+
for (let i = 0; i < maxTime; i += timeInterval) {
|
|
285
|
+
const xScale = hgc.xScales[viewUid];
|
|
286
|
+
const yScale = hgc.yScales[viewUid];
|
|
287
|
+
|
|
288
|
+
if (
|
|
289
|
+
xScaleDomain[0] !== xScale.domain()[0] ||
|
|
290
|
+
xScaleDomain[1] !== xScale.domain()[1] ||
|
|
291
|
+
yScaleDomain[0] !== yScale.domain()[0] ||
|
|
292
|
+
yScaleDomain[1] !== yScale.domain()[1]
|
|
293
|
+
) {
|
|
294
|
+
xScaleDomain[0] = xScale.domain()[0];
|
|
295
|
+
xScaleDomain[1] = xScale.domain()[1];
|
|
296
|
+
yScaleDomain[0] = yScale.domain()[0];
|
|
297
|
+
yScaleDomain[1] = yScale.domain()[1];
|
|
298
|
+
} else {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
await new Promise((r) => setTimeout(r, timeInterval));
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Wait for a HiGlassComponet to be ready at the given element.
|
|
308
|
+
*
|
|
309
|
+
* By ready we mean that a track-renderer-div is present and that its
|
|
310
|
+
* size is not changing any more.
|
|
311
|
+
*
|
|
312
|
+
* @param {HTMLElement} div
|
|
313
|
+
* @returns {Promise<void>}
|
|
314
|
+
*/
|
|
315
|
+
export const waitForComponentReady = async (div) => {
|
|
316
|
+
await waitForElements(div, ['.track-renderer-div']);
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @param {HTMLDivElement} div
|
|
321
|
+
* @returns {void}
|
|
322
|
+
*/
|
|
244
323
|
export const removeHGComponent = (div) => {
|
|
245
324
|
if (!div) return;
|
|
246
325
|
|
|
@@ -250,15 +329,24 @@ export const removeHGComponent = (div) => {
|
|
|
250
329
|
|
|
251
330
|
// ideally the "await-ers" avoid would be promises (rather than polling)
|
|
252
331
|
// and that way `mountHGComponent` would be async by default.
|
|
332
|
+
/**
|
|
333
|
+
* @param {HTMLDivElement | null} prevDiv
|
|
334
|
+
* @param {import("enzyme").ReactWrapper<{}, {}, HiGlassComponent> | null} prevHgc
|
|
335
|
+
* @param {Record<string, unknown>} viewConf
|
|
336
|
+
* @param {{ style?: string, bounded?: boolean, extendedDelay?: boolean }} [options]
|
|
337
|
+
* @returns {Promise<[HTMLDivElement, { instance: () => HiGlassComponent }]>}
|
|
338
|
+
*/
|
|
253
339
|
export async function mountHGComponentAsync(
|
|
254
340
|
prevDiv,
|
|
255
341
|
prevHgc,
|
|
256
342
|
viewConf,
|
|
257
343
|
options,
|
|
258
344
|
) {
|
|
345
|
+
/** @type {ReturnType<typeof mountHGComponent>}*/
|
|
259
346
|
let res;
|
|
260
347
|
await new Promise((resolve) => {
|
|
261
348
|
res = mountHGComponent(prevDiv, prevHgc, viewConf, resolve, options);
|
|
262
349
|
});
|
|
350
|
+
// @ts-expect-error We know it's been resolved
|
|
263
351
|
return res;
|
|
264
352
|
}
|