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
package/app/scripts/types.ts
CHANGED
|
@@ -1,11 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type * as configs from './configs';
|
|
2
|
+
import type { ChromsizeRow } from './utils/parse-chromsizes-rows';
|
|
3
|
+
|
|
4
|
+
export type Theme = typeof configs.THEME_DARK | typeof configs.THEME_LIGHT;
|
|
5
|
+
export type SizeMode =
|
|
6
|
+
| typeof configs.SIZE_MODE_DEFAULT
|
|
7
|
+
| typeof configs.SIZE_MODE_BOUNDED
|
|
8
|
+
| typeof configs.SIZE_MODE_OVERFLOW
|
|
9
|
+
| typeof configs.SIZE_MODE_BOUNDED_OVERFLOW
|
|
10
|
+
| typeof configs.SIZE_MODE_SCROLL;
|
|
11
|
+
|
|
12
|
+
// TODO: Generate from 'schema.json'
|
|
13
|
+
export type HiGlassViewConfig = Record<string, unknown>;
|
|
14
|
+
|
|
15
|
+
/** Additional options for how the {@link HiGlassComponent} is drawn and behaves */
|
|
16
|
+
export interface HiGlassOptions {
|
|
17
|
+
/** An auth token to be included with every tile request. */
|
|
18
|
+
authToken?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the component should be sized to fit within the enclosing div.
|
|
21
|
+
*
|
|
22
|
+
* If `false`, the component will grow as needed to fit the tracks within it.
|
|
23
|
+
*/
|
|
24
|
+
bounded?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the layout be changed.
|
|
27
|
+
*
|
|
28
|
+
* If `false`, the view headers will be hidden. Overrides the `editable` value in the viewconf if specified.
|
|
29
|
+
*/
|
|
30
|
+
editable?: boolean;
|
|
31
|
+
/** A set of default options that will be used for newly added tracks. */
|
|
32
|
+
defaultTrackOptions?: {
|
|
33
|
+
/** Options for all tracks types. */
|
|
34
|
+
all?: Record<string, unknown>;
|
|
35
|
+
/** Options for specific tracks types. */
|
|
36
|
+
trackSpecific?: Record<string, Record<string, unknown>>;
|
|
37
|
+
};
|
|
38
|
+
viewMarginTop?: number;
|
|
39
|
+
viewMarginBottom?: number;
|
|
40
|
+
viewMarginLeft?: number;
|
|
41
|
+
viewMarginRight?: number;
|
|
42
|
+
viewPaddingTop?: number;
|
|
43
|
+
viewPaddingBottom?: number;
|
|
44
|
+
viewPaddingLeft?: number;
|
|
45
|
+
viewPaddingRight?: number;
|
|
46
|
+
theme?: 'dark' | 'light';
|
|
47
|
+
isDarkTheme?: boolean;
|
|
48
|
+
moustTool?: 'select' | 'track-select';
|
|
49
|
+
pluginTracks?: Record<string, unknown>;
|
|
50
|
+
pluginDataFetchers?: Record<string, unknown>;
|
|
51
|
+
pixelPreciseMarginPadding?: boolean;
|
|
52
|
+
sizeMode?: SizeMode;
|
|
53
|
+
renderer?: 'canvas';
|
|
54
|
+
onViewConfLoaded?: () => void;
|
|
55
|
+
cheatCodesEnabled?: boolean;
|
|
56
|
+
rangeSelectionOnAlt?: boolean;
|
|
57
|
+
tracksEditable?: boolean;
|
|
58
|
+
zoomFixed?: boolean;
|
|
59
|
+
containerPaddingX?: number;
|
|
60
|
+
containerPaddingY?: number;
|
|
61
|
+
broadcastMousePositionGlobally?: boolean;
|
|
62
|
+
showGlobalMousePosition?: boolean;
|
|
63
|
+
globalMousePosition?: boolean;
|
|
64
|
+
}
|
|
4
65
|
|
|
5
66
|
export type Scale = import('d3-scale').ScaleContinuousNumeric<number, number>;
|
|
6
67
|
|
|
7
|
-
|
|
8
|
-
|
|
68
|
+
// biome-ignore format: Biome formatting messes up tsc parsing
|
|
69
|
+
export type TrackPosition = typeof import('./configs/primitives').TRACK_LOCATIONS[number];
|
|
9
70
|
|
|
10
71
|
export type ChromInfo<Name extends string = string> = {
|
|
11
72
|
cumPositions: { id?: number; pos: number; chr: Name }[];
|
|
@@ -15,17 +76,19 @@ export type ChromInfo<Name extends string = string> = {
|
|
|
15
76
|
};
|
|
16
77
|
|
|
17
78
|
export type UnknownTrackConfig = {
|
|
18
|
-
uid: string;
|
|
19
|
-
options: Record<string, unknown>;
|
|
20
79
|
type: string;
|
|
21
|
-
|
|
22
|
-
data?: Record<string, unknown>;
|
|
80
|
+
uid: string;
|
|
23
81
|
server: string;
|
|
24
82
|
tilesetUid: string;
|
|
83
|
+
options?: Record<string, unknown>;
|
|
84
|
+
position?: TrackPosition;
|
|
85
|
+
data?: Record<string, unknown>;
|
|
25
86
|
coordSystem?: unknown;
|
|
87
|
+
height?: number;
|
|
88
|
+
width?: number;
|
|
26
89
|
x?: number;
|
|
27
90
|
y?: number;
|
|
28
|
-
chromInfoPath
|
|
91
|
+
chromInfoPath?: string;
|
|
29
92
|
projectionXDomain?: [number, number];
|
|
30
93
|
projectionYDomain?: [number, number];
|
|
31
94
|
registerViewportChanged?: unknown;
|
|
@@ -34,18 +97,20 @@ export type UnknownTrackConfig = {
|
|
|
34
97
|
};
|
|
35
98
|
|
|
36
99
|
export type CombinedTrackConfig = {
|
|
37
|
-
uid: string;
|
|
38
|
-
options: Record<string, unknown>;
|
|
39
|
-
contents: TrackConfig[];
|
|
40
100
|
type: 'combined';
|
|
41
|
-
|
|
101
|
+
contents: Array<UnknownTrackConfig>;
|
|
102
|
+
uid: string;
|
|
103
|
+
server?: string;
|
|
104
|
+
height?: number;
|
|
105
|
+
width?: number;
|
|
106
|
+
tilesetUid?: string;
|
|
107
|
+
options?: Record<string, unknown>;
|
|
108
|
+
position?: TrackPosition;
|
|
42
109
|
data?: Record<string, unknown>;
|
|
43
|
-
server: string;
|
|
44
|
-
tilesetUid: string;
|
|
45
110
|
coordSystem?: unknown;
|
|
46
111
|
x?: number;
|
|
47
112
|
y?: number;
|
|
48
|
-
chromInfoPath
|
|
113
|
+
chromInfoPath?: string;
|
|
49
114
|
projectionXDomain?: [number, number];
|
|
50
115
|
projectionYDomain?: [number, number];
|
|
51
116
|
registerViewportChanged?: unknown;
|
|
@@ -55,26 +120,27 @@ export type CombinedTrackConfig = {
|
|
|
55
120
|
|
|
56
121
|
export type TrackConfig = UnknownTrackConfig | CombinedTrackConfig;
|
|
57
122
|
|
|
58
|
-
export type TrackVisitor =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
};
|
|
123
|
+
export type TrackVisitor = (
|
|
124
|
+
track: TrackConfig,
|
|
125
|
+
position: null | TrackPosition,
|
|
126
|
+
) => void;
|
|
127
|
+
|
|
128
|
+
type ZoomedFunction = (
|
|
129
|
+
xScale: Scale,
|
|
130
|
+
yScale: Scale,
|
|
131
|
+
k?: number,
|
|
132
|
+
x?: number,
|
|
133
|
+
y?: number,
|
|
134
|
+
xPosition?: number,
|
|
135
|
+
yPosition?: number,
|
|
136
|
+
) => void;
|
|
73
137
|
|
|
74
138
|
export interface TrackObject {
|
|
75
139
|
draw(): void;
|
|
76
140
|
rerender(options: unknown): void;
|
|
77
141
|
delayDrawing: boolean;
|
|
142
|
+
flipText?: boolean;
|
|
143
|
+
originalTrack?: TrackObject;
|
|
78
144
|
childTracks?: TrackObject[];
|
|
79
145
|
createdTracks: Record<string, TrackObject>;
|
|
80
146
|
refScalesChanged(x: Scale, y: Scale): void;
|
|
@@ -87,10 +153,11 @@ export interface TrackObject {
|
|
|
87
153
|
remove(): void;
|
|
88
154
|
movedY(extent: number): void;
|
|
89
155
|
zoomedY(yPosition: number, wheelDelta: number): void;
|
|
156
|
+
fetching?: Set<unknown>;
|
|
157
|
+
tilesetInfo?: TilesetInfo;
|
|
158
|
+
chromInfo?: unknown; // TODO
|
|
90
159
|
}
|
|
91
160
|
|
|
92
|
-
export type Theme = typeof THEME_DARK | typeof THEME_LIGHT;
|
|
93
|
-
|
|
94
161
|
/** Minimum information describing a tileset. */
|
|
95
162
|
export type TilesetInfoShared = {
|
|
96
163
|
name: string;
|
|
@@ -101,6 +168,8 @@ export type TilesetInfoShared = {
|
|
|
101
168
|
tile_size?: number;
|
|
102
169
|
max_tile_width?: number;
|
|
103
170
|
transforms?: { name: string; value: string }[];
|
|
171
|
+
chromsizes?: ArrayLike<ChromsizeRow>;
|
|
172
|
+
error?: string;
|
|
104
173
|
};
|
|
105
174
|
|
|
106
175
|
export type LegacyTilesetInfo = TilesetInfoShared & {
|
|
@@ -120,18 +189,18 @@ export type DataConfig = {
|
|
|
120
189
|
filetype?: string;
|
|
121
190
|
coordSystem?: string;
|
|
122
191
|
children?: DataConfig[];
|
|
123
|
-
options
|
|
192
|
+
// biome-ignore lint/suspicious/noExplicitAny: We can't know what the options are
|
|
193
|
+
options?: Record<string, any>;
|
|
124
194
|
type?: string;
|
|
125
195
|
slicePos?: number;
|
|
126
196
|
};
|
|
127
197
|
|
|
128
|
-
export type HandleTilesetInfoFinished =
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
};
|
|
198
|
+
export type HandleTilesetInfoFinished = (
|
|
199
|
+
info: TilesetInfo | null | { error: string },
|
|
200
|
+
tilesetUid?: string,
|
|
201
|
+
) => void;
|
|
133
202
|
|
|
134
|
-
export interface AbstractDataFetcher<TileType> {
|
|
203
|
+
export interface AbstractDataFetcher<TileType, DataConfig> {
|
|
135
204
|
tilesetInfo(
|
|
136
205
|
callback?: HandleTilesetInfoFinished,
|
|
137
206
|
): Promise<TilesetInfo | undefined>;
|
|
@@ -139,23 +208,25 @@ export interface AbstractDataFetcher<TileType> {
|
|
|
139
208
|
receivedTiles: (tiles: Record<string, TileType>) => void,
|
|
140
209
|
tileIds: string[],
|
|
141
210
|
): Promise<Record<string, TileType>>;
|
|
211
|
+
dataConfig: DataConfig;
|
|
142
212
|
}
|
|
143
213
|
|
|
144
214
|
// Tileset API
|
|
145
215
|
|
|
146
|
-
type TilesRequest = {
|
|
216
|
+
export type TilesRequest = {
|
|
147
217
|
id: string;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
options
|
|
218
|
+
tileIds: Array<string>;
|
|
219
|
+
server: string;
|
|
220
|
+
// biome-ignore lint/suspicious/noExplicitAny: We can't know what the options are
|
|
221
|
+
options?: Record<string, any>;
|
|
151
222
|
};
|
|
152
223
|
|
|
153
|
-
type TilesetInfoRequest = {
|
|
224
|
+
export type TilesetInfoRequest = {
|
|
154
225
|
server: string;
|
|
155
226
|
tilesetUid: string;
|
|
156
227
|
};
|
|
157
228
|
|
|
158
|
-
type RegisterTilesetRequest = {
|
|
229
|
+
export type RegisterTilesetRequest = {
|
|
159
230
|
server: string;
|
|
160
231
|
url: string;
|
|
161
232
|
filetype: string;
|
|
@@ -209,14 +209,14 @@ function keys() {
|
|
|
209
209
|
*/
|
|
210
210
|
function forEach(fun, context, desc) {
|
|
211
211
|
let entry;
|
|
212
|
-
|
|
212
|
+
|
|
213
213
|
if (context === true) {
|
|
214
214
|
desc = true;
|
|
215
215
|
context = undefined;
|
|
216
216
|
} else if (typeof context !== 'object') {
|
|
217
217
|
context = this;
|
|
218
218
|
}
|
|
219
|
-
|
|
219
|
+
|
|
220
220
|
if (desc) {
|
|
221
221
|
entry = this.tail;
|
|
222
222
|
while (entry) {
|
|
@@ -244,6 +244,7 @@ function toJSON() {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
/** Returns a String representation */
|
|
247
|
+
// biome-ignore lint/suspicious/noShadowRestrictedNames: Scoped to this module
|
|
247
248
|
function toString() {
|
|
248
249
|
let s = '';
|
|
249
250
|
let entry = this.head;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Make an assertion.
|
|
3
|
+
*
|
|
4
|
+
* Usage
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const value: boolean = Math.random() <= 0.5;
|
|
8
|
+
* assert(value, "value is greater than than 0.5!");
|
|
9
|
+
* value // true
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @param {unknown} expression - The expression to test.
|
|
13
|
+
* @param {string=} msg - The optional message to display if the assertion fails.
|
|
14
|
+
* @returns {asserts expression}
|
|
15
|
+
* @throws an {@link Error} if `expression` is not truthy.
|
|
16
|
+
*/
|
|
17
|
+
export default function assert(expression, msg = '') {
|
|
18
|
+
if (!expression) throw new Error(msg);
|
|
19
|
+
}
|
|
@@ -41,6 +41,7 @@ class BackgroundTaskScheduler {
|
|
|
41
41
|
* @param {string | null=} trackId
|
|
42
42
|
* @return {void}
|
|
43
43
|
*/
|
|
44
|
+
|
|
44
45
|
/**
|
|
45
46
|
* If `taskData` is `null` the `taskHandler` will eventaully be called without any arguments.
|
|
46
47
|
*
|
|
@@ -50,6 +51,7 @@ class BackgroundTaskScheduler {
|
|
|
50
51
|
* @param {string | null=} trackId
|
|
51
52
|
* @return {void}
|
|
52
53
|
*/
|
|
54
|
+
|
|
53
55
|
/**
|
|
54
56
|
* @param {(data: any) => void} taskHandler
|
|
55
57
|
* @param {any} taskData
|
|
@@ -1,24 +1,34 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { scaleLinear } from 'd3-scale';
|
|
3
1
|
import { range } from 'd3-array';
|
|
4
2
|
import { rgb } from 'd3-color';
|
|
3
|
+
import { scaleLinear } from 'd3-scale';
|
|
4
|
+
|
|
5
|
+
/** @typedef {[r: number, g: number, b: number, a: number]} Color */
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Convert a color domain to a 255 element array of [r,g,b,a]
|
|
8
9
|
* values (all from 0 to 255). The last color (255) will always be
|
|
9
10
|
* transparent
|
|
11
|
+
*
|
|
12
|
+
* @param {readonly [start: string, end: string]} colorRange
|
|
13
|
+
* @param {boolean} noTansparent
|
|
14
|
+
* @returns {Array<Color>}
|
|
10
15
|
*/
|
|
11
16
|
const colorDomainToRgbaArray = (colorRange, noTansparent = false) => {
|
|
12
17
|
// we should always have at least two values in the color range
|
|
13
18
|
const domain = colorRange.map((x, i) => i * (255 / (colorRange.length - 1)));
|
|
14
19
|
|
|
15
|
-
const d3Scale = scaleLinear().domain(domain).range(
|
|
20
|
+
const d3Scale = scaleLinear().domain(domain).range(
|
|
21
|
+
// @ts-expect-error - d3-color types aren't correctly inferred here
|
|
22
|
+
colorRange,
|
|
23
|
+
);
|
|
16
24
|
|
|
17
25
|
const fromX = noTansparent ? 255 : 254;
|
|
18
26
|
|
|
27
|
+
/** @type {Array<Color>} */
|
|
19
28
|
const rgbaArray = range(fromX, -1, -1)
|
|
20
29
|
.map(d3Scale)
|
|
21
30
|
.map((x) => {
|
|
31
|
+
// @ts-expect-error - d3-color support 0-1 ranges but not in types
|
|
22
32
|
const r = rgb(x);
|
|
23
33
|
return [r.r, r.g, r.b, r.opacity * 255];
|
|
24
34
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** @param {string} text */
|
|
2
|
+
function fallbackCopyTextToClipboard(text) {
|
|
3
|
+
const textArea = document.createElement('textarea');
|
|
4
|
+
textArea.value = text;
|
|
5
|
+
|
|
6
|
+
// Avoid scrolling to bottom
|
|
7
|
+
textArea.style.top = '0';
|
|
8
|
+
textArea.style.left = '0';
|
|
9
|
+
textArea.style.position = 'fixed';
|
|
10
|
+
|
|
11
|
+
document.body.appendChild(textArea);
|
|
12
|
+
textArea.focus();
|
|
13
|
+
textArea.select();
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
document.execCommand('copy');
|
|
17
|
+
} catch (err) {
|
|
18
|
+
// console.error('Fallback: Oops, unable to copy', err);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
document.body.removeChild(textArea);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** @param {string} text */
|
|
25
|
+
export default function copyTextToClipboard(text) {
|
|
26
|
+
if (!navigator.clipboard) {
|
|
27
|
+
fallbackCopyTextToClipboard(text);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
navigator.clipboard.writeText(text).then(
|
|
31
|
+
() => {},
|
|
32
|
+
(err) => {
|
|
33
|
+
// console.error('Async: Could not copy text: ', err);
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import assert from './assert.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Decompress a compressed data source.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DecompressionStream DecompressionStream API}
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const compressed = new Uint8Array([
|
|
11
|
+
* 0x1f, 0x8b, 0x08, 0x00, 0x1e, 0xc0, 0x7e, 0x67, 0x00, 0x03, 0xf3, 0x48,
|
|
12
|
+
* 0xcd, 0xc9, 0xc9, 0xd7, 0x51, 0x28, 0xcf, 0x2f, 0xca, 0x49, 0x51, 0x04,
|
|
13
|
+
* 0x00, 0xe6, 0xc6, 0xe6, 0xeb, 0x0d, 0x00, 0x00, 0x00
|
|
14
|
+
* ]);
|
|
15
|
+
* console.log(await decompress(compressed, { format: "gzip" }).text()); // "Hello, world!"
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param {BodyInit | Response} data - The compressed data.
|
|
19
|
+
* @param {Object} options
|
|
20
|
+
* @param {CompressionFormat} options.format
|
|
21
|
+
* @param {AbortSignal=} options.signal
|
|
22
|
+
* @returns {Response} A new response for decompressed data.
|
|
23
|
+
*
|
|
24
|
+
* @see {@link https://github.com/manzt/manzt/blob/1380bb/utils/decompress.js source}
|
|
25
|
+
*/
|
|
26
|
+
export default function decompress(data, options) {
|
|
27
|
+
const { format, signal } = options;
|
|
28
|
+
const response = data instanceof Response ? data : new Response(data);
|
|
29
|
+
assert(response.body, 'Response does not include a body.');
|
|
30
|
+
return new Response(
|
|
31
|
+
response.body.pipeThrough(new DecompressionStream(format), { signal }),
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { DEFAULT_TRACKS_FOR_DATATYPE, TRACKS_INFO_BY_TYPE } from '../configs';
|
|
3
|
+
|
|
4
|
+
/** Get the default tracks for a datatype. Uses the known track definitions as
|
|
5
|
+
* well as any extra definitions that may be passed in. */
|
|
6
|
+
export default function getDefaultTracksForDatatype(
|
|
7
|
+
datatype,
|
|
8
|
+
otherDefaultTracks,
|
|
9
|
+
) {
|
|
10
|
+
if (window.higlassTracksByType) {
|
|
11
|
+
// Extend `TRACKS_INFO_BY_TYPE` with the configs of plugin tracks.
|
|
12
|
+
Object.keys(window.higlassTracksByType).forEach((pluginTrackType) => {
|
|
13
|
+
TRACKS_INFO_BY_TYPE[pluginTrackType] =
|
|
14
|
+
window.higlassTracksByType[pluginTrackType].config;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!(datatype in DEFAULT_TRACKS_FOR_DATATYPE) && !otherDefaultTracks) {
|
|
19
|
+
console.warn('unknown data type:', datatype);
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const orientationToPositions = {
|
|
24
|
+
'1d-horizontal': ['top', 'bottom', 'left', 'right'],
|
|
25
|
+
'2d': ['center'],
|
|
26
|
+
'1d-vertical': ['left', 'right'],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const defaultTracks = DEFAULT_TRACKS_FOR_DATATYPE[datatype] || {};
|
|
30
|
+
|
|
31
|
+
if (otherDefaultTracks) {
|
|
32
|
+
for (const trackType of otherDefaultTracks) {
|
|
33
|
+
if (!TRACKS_INFO_BY_TYPE[trackType]) {
|
|
34
|
+
console.warn('unknown track type', trackType);
|
|
35
|
+
} else {
|
|
36
|
+
for (const position of orientationToPositions[
|
|
37
|
+
TRACKS_INFO_BY_TYPE[trackType].orientation
|
|
38
|
+
]) {
|
|
39
|
+
defaultTracks[position] = trackType;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return defaultTracks;
|
|
46
|
+
}
|
|
@@ -13,6 +13,7 @@ export default function dictKeys(dictionary) {
|
|
|
13
13
|
|
|
14
14
|
for (const key in dictionary) {
|
|
15
15
|
// @ts-expect-error - TS inference not good enough to infer the correct type
|
|
16
|
+
// biome-ignore lint/suspicious/noPrototypeBuiltins:
|
|
16
17
|
if (dictionary.hasOwnProperty(key)) {
|
|
17
18
|
keys.push(key);
|
|
18
19
|
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import { isCombinedTrackConfig } from './type-guards';
|
|
2
|
+
|
|
3
|
+
/** @import * as t from '../types' */
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* Go through a list of tracks and expand combined
|
|
4
7
|
* tracks.
|
|
5
8
|
*
|
|
6
|
-
* @param {
|
|
7
|
-
* @returns {
|
|
9
|
+
* @param {Array<t.TrackConfig>} trackList - A list of tracks some of which might be combined
|
|
10
|
+
* @returns {Array<t.UnknownTrackConfig>} A list of tracks without combined
|
|
8
11
|
*/
|
|
9
12
|
const expandCombinedTracks = (trackList) => {
|
|
13
|
+
/** @type {Array<t.UnknownTrackConfig>} */
|
|
10
14
|
let newTracks = [];
|
|
11
15
|
|
|
12
|
-
for (
|
|
13
|
-
if (
|
|
14
|
-
newTracks = newTracks.concat(
|
|
16
|
+
for (const track of trackList) {
|
|
17
|
+
if (isCombinedTrackConfig(track)) {
|
|
18
|
+
newTracks = newTracks.concat(track.contents);
|
|
15
19
|
} else {
|
|
16
|
-
newTracks.push(
|
|
20
|
+
newTracks.push(track);
|
|
17
21
|
}
|
|
18
22
|
}
|
|
19
23
|
|
|
@@ -1,48 +1,73 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// Configs
|
|
3
1
|
import {
|
|
4
2
|
MIN_HORIZONTAL_HEIGHT,
|
|
5
3
|
MIN_VERTICAL_WIDTH,
|
|
6
4
|
TRACKS_INFO_BY_TYPE,
|
|
7
5
|
} from '../configs';
|
|
8
6
|
|
|
7
|
+
/** @import * as t from '../types' */
|
|
8
|
+
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* @typedef CompleteTracks
|
|
11
|
+
* @property {Array<t.TrackConfig>} center
|
|
12
|
+
* @property {Array<t.TrackConfig>} left
|
|
13
|
+
* @property {Array<t.TrackConfig>} right
|
|
14
|
+
* @property {Array<t.TrackConfig>} top
|
|
15
|
+
* @property {Array<t.TrackConfig>} bottom
|
|
16
|
+
* @property {Array<t.TrackConfig>} whole
|
|
17
|
+
* @property {Array<t.TrackConfig>} gallery
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @template {t.TrackPosition} K
|
|
22
|
+
* @template {Array<t.TrackConfig>} T
|
|
23
|
+
* @typedef {Array<T[number] & { width: number }>} WithMinWidth
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* If tracks don't have specified dimensions, add in the known minimums
|
|
28
|
+
*
|
|
29
|
+
* WARNING: Mutates `tracks` argument
|
|
30
|
+
*
|
|
31
|
+
* @template {Partial<CompleteTracks>} T
|
|
32
|
+
* @param {T} tracks
|
|
33
|
+
* @returns {{
|
|
34
|
+
* [K in t.TrackPosition]: K extends keyof T ? T[K] extends undefined ? Array<t.TrackConfig> : T[K] : Array<t.TrackConfig>
|
|
35
|
+
* }}
|
|
12
36
|
*
|
|
13
37
|
* Operates on the tracks stored for this TiledPlot.
|
|
14
38
|
*/
|
|
15
39
|
const fillInMinWidths = (tracks) => {
|
|
16
|
-
|
|
17
|
-
const
|
|
40
|
+
// biome-ignore format: nicer to have as one line
|
|
41
|
+
const horizontalLocations = /** @type {const} */ (['top', 'bottom', 'gallery']);
|
|
42
|
+
const verticalLocations = /** @type {const} */ (['left', 'right', 'gallery']);
|
|
18
43
|
|
|
19
44
|
// first make sure all track types are specified
|
|
20
45
|
// this will make the code later on simpler
|
|
21
|
-
tracks.center
|
|
22
|
-
tracks.left
|
|
23
|
-
tracks.right
|
|
24
|
-
tracks.top
|
|
25
|
-
tracks.bottom
|
|
26
|
-
tracks.whole
|
|
27
|
-
tracks.gallery
|
|
46
|
+
tracks.center ??= [];
|
|
47
|
+
tracks.left ??= [];
|
|
48
|
+
tracks.right ??= [];
|
|
49
|
+
tracks.top ??= [];
|
|
50
|
+
tracks.bottom ??= [];
|
|
51
|
+
tracks.whole ??= [];
|
|
52
|
+
tracks.gallery ??= [];
|
|
28
53
|
|
|
29
54
|
horizontalLocations
|
|
30
55
|
.map((horizontalLocation) => tracks[horizontalLocation])
|
|
31
56
|
.forEach((horizontalTracks) =>
|
|
32
|
-
horizontalTracks.forEach((track) => {
|
|
57
|
+
(horizontalTracks ?? []).forEach((track) => {
|
|
33
58
|
const trackInfo = TRACKS_INFO_BY_TYPE[track.type];
|
|
34
|
-
const defaultOptions =
|
|
59
|
+
const defaultOptions = trackInfo?.defaultOptions || {};
|
|
35
60
|
const options = track.options
|
|
36
61
|
? { ...defaultOptions, ...track.options } // values in track.options take precedence
|
|
37
62
|
: defaultOptions;
|
|
38
63
|
|
|
39
64
|
if (options.minHeight !== undefined && track.height === undefined) {
|
|
65
|
+
// @ts-expect-error - minHeight could be anything that's not undefined
|
|
40
66
|
track.height = options.minHeight;
|
|
41
67
|
}
|
|
42
68
|
|
|
43
69
|
if (track.height === undefined) {
|
|
44
|
-
track.height =
|
|
45
|
-
(trackInfo && trackInfo.defaultHeight) || MIN_HORIZONTAL_HEIGHT;
|
|
70
|
+
track.height = trackInfo?.defaultHeight || MIN_HORIZONTAL_HEIGHT;
|
|
46
71
|
}
|
|
47
72
|
}),
|
|
48
73
|
);
|
|
@@ -50,25 +75,26 @@ const fillInMinWidths = (tracks) => {
|
|
|
50
75
|
verticalLocations
|
|
51
76
|
.map((verticalLocation) => tracks[verticalLocation])
|
|
52
77
|
.forEach((verticalTracks) =>
|
|
53
|
-
verticalTracks.forEach((track) => {
|
|
78
|
+
(verticalTracks ?? []).forEach((track) => {
|
|
54
79
|
const trackInfo = TRACKS_INFO_BY_TYPE[track.type];
|
|
55
|
-
const defaultOptions =
|
|
80
|
+
const defaultOptions = trackInfo?.defaultOptions || {};
|
|
56
81
|
|
|
57
82
|
const options = track.options
|
|
58
83
|
? { ...defaultOptions, ...track.options } // values in track.options take precedence
|
|
59
84
|
: defaultOptions;
|
|
60
85
|
|
|
61
86
|
if (options.minWidth !== undefined && track.width === undefined) {
|
|
87
|
+
// @ts-expect-error - minWidth could be anything that's not undefined
|
|
62
88
|
track.width = options.minWidth;
|
|
63
89
|
}
|
|
64
90
|
|
|
65
91
|
if (track.width === undefined) {
|
|
66
|
-
track.width =
|
|
67
|
-
(trackInfo && trackInfo.defaultWidth) || MIN_VERTICAL_WIDTH;
|
|
92
|
+
track.width = trackInfo?.defaultWidth || MIN_VERTICAL_WIDTH;
|
|
68
93
|
}
|
|
69
94
|
}),
|
|
70
95
|
);
|
|
71
96
|
|
|
97
|
+
// @ts-expect-error - TS cannot infer that we have made the type correctly
|
|
72
98
|
return tracks;
|
|
73
99
|
};
|
|
74
100
|
|