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.
Files changed (392) hide show
  1. package/README.md +48 -54
  2. package/app/globals.d.ts +1 -1
  3. package/app/missing-types.d.ts +4 -1
  4. package/app/scripts/AddTrackDialog.jsx +11 -4
  5. package/app/scripts/AddTrackPositionMenu.jsx +28 -7
  6. package/app/scripts/Annotations1dTrack.js +90 -251
  7. package/app/scripts/Annotations2dTrack.js +12 -7
  8. package/app/scripts/Autocomplete.jsx +13 -28
  9. package/app/scripts/AxisPixi.js +6 -10
  10. package/app/scripts/BarTrack.js +3 -3
  11. package/app/scripts/BedLikeTrack.js +556 -449
  12. package/app/scripts/Button.jsx +1 -1
  13. package/app/scripts/CNVIntervalTrack.js +1 -1
  14. package/app/scripts/CenterTrack.jsx +8 -7
  15. package/app/scripts/Chromosome2DAnnotations.js +1 -1
  16. package/app/scripts/Chromosome2DLabels.js +1 -1
  17. package/app/scripts/ChromosomeGrid.js +49 -38
  18. package/app/scripts/ChromosomeInfo.js +1 -1
  19. package/app/scripts/CombinedTrack.js +3 -1
  20. package/app/scripts/ConfigTrackMenu.jsx +1 -1
  21. package/app/scripts/ConfigViewMenu.jsx +2 -2
  22. package/app/scripts/ContextMenuContainer.jsx +4 -2
  23. package/app/scripts/ContextMenuItem.jsx +14 -2
  24. package/app/scripts/CrossRule.js +1 -1
  25. package/app/scripts/CustomTrackDialog.jsx +2 -2
  26. package/app/scripts/Dialog.jsx +2 -2
  27. package/app/scripts/DragListeningDiv.jsx +1 -1
  28. package/app/scripts/DraggableDiv.jsx +2 -3
  29. package/app/scripts/ExportLinkDialog.jsx +1 -1
  30. package/app/scripts/FilledLine.js +349 -0
  31. package/app/scripts/GalleryTracks.jsx +77 -78
  32. package/app/scripts/GenomePositionSearchBox.jsx +184 -482
  33. package/app/scripts/HeatmapOptions.jsx +4 -2
  34. package/app/scripts/HeatmapTiledPixiTrack.js +23 -32
  35. package/app/scripts/HiGlassComponent.jsx +515 -444
  36. package/app/scripts/HiGlassComponentContext.js +5 -0
  37. package/app/scripts/Horizontal1dHeatmapTrack.js +1 -1
  38. package/app/scripts/Horizontal2DDomainsTrack.js +1 -1
  39. package/app/scripts/HorizontalChromosomeLabels.js +28 -22
  40. package/app/scripts/HorizontalGeneAnnotationsTrack.js +1 -1
  41. package/app/scripts/HorizontalHeatmapTrack.js +2 -2
  42. package/app/scripts/HorizontalMultivecTrack.js +6 -7
  43. package/app/scripts/HorizontalRule.js +1 -2
  44. package/app/scripts/HorizontalTiled1DPixiTrack.js +4 -4
  45. package/app/scripts/HorizontalTiledPlot.jsx +9 -9
  46. package/app/scripts/LeftTrackModifier.js +4 -0
  47. package/app/scripts/ListWrapper.jsx +1 -2
  48. package/app/scripts/MapboxTilesTrack.js +1 -2
  49. package/app/scripts/Modal.jsx +2 -2
  50. package/app/scripts/MoveableTrack.jsx +10 -12
  51. package/app/scripts/NestedContextMenu.jsx +2 -1
  52. package/app/scripts/OSMTileIdsTrack.js +1 -1
  53. package/app/scripts/OverlayTrack.js +4 -4
  54. package/app/scripts/PixiTrack.js +27 -13
  55. package/app/scripts/PlotTypeChooser.jsx +3 -4
  56. package/app/scripts/SearchField.js +5 -5
  57. package/app/scripts/SeriesListItems.jsx +3 -4
  58. package/app/scripts/SeriesListMenu.jsx +95 -53
  59. package/app/scripts/SeriesListSubmenuMixin.jsx +2 -1
  60. package/app/scripts/SketchInlinePicker.jsx +2 -2
  61. package/app/scripts/SortableList.jsx +1 -1
  62. package/app/scripts/Tiled1DPixiTrack.js +4 -1
  63. package/app/scripts/TiledPixiTrack.js +244 -102
  64. package/app/scripts/TiledPlot.jsx +565 -118
  65. package/app/scripts/TilesetFinder.jsx +12 -4
  66. package/app/scripts/Track.js +1 -1
  67. package/app/scripts/TrackArea.jsx +4 -0
  68. package/app/scripts/TrackControl.jsx +2 -2
  69. package/app/scripts/TrackRenderer.jsx +32 -33
  70. package/app/scripts/ValueIntervalTrack.js +1 -1
  71. package/app/scripts/VerticalRule.js +2 -2
  72. package/app/scripts/VerticalTiledPlot.jsx +7 -7
  73. package/app/scripts/ViewConfigEditor.jsx +1 -1
  74. package/app/scripts/ViewContextMenu.jsx +53 -5
  75. package/app/scripts/ViewHeader.jsx +9 -9
  76. package/app/scripts/ViewportTracker2D.js +1 -1
  77. package/app/scripts/api.js +92 -12
  78. package/app/scripts/configs/available-track-types.js +1 -1
  79. package/app/scripts/configs/index.js +6 -1
  80. package/app/scripts/configs/positions-by-datatype.js +2 -2
  81. package/app/scripts/configs/primitives.js +2 -0
  82. package/app/scripts/configs/themes.js +0 -1
  83. package/app/scripts/configs/tracks-info-by-type.js +11 -8
  84. package/app/scripts/configs/tracks-info.js +3 -2
  85. package/app/scripts/d3-context-menu.js +3 -4
  86. package/app/scripts/data-fetchers/DataFetcher.js +35 -36
  87. package/app/scripts/data-fetchers/genbank-fetcher.js +13 -22
  88. package/app/scripts/data-fetchers/local-tile-fetcher.js +10 -8
  89. package/app/scripts/hglib.jsx +62 -71
  90. package/app/scripts/hocs/with-modal.jsx +32 -10
  91. package/app/scripts/hocs/with-pub-sub.js +12 -3
  92. package/app/scripts/hocs/with-theme.jsx +21 -14
  93. package/app/scripts/icons.jsx +3 -2
  94. package/app/scripts/mixwith.js +2 -2
  95. package/app/scripts/options-info.js +49 -11
  96. package/app/scripts/plugins/get-data-fetcher.js +2 -3
  97. package/app/scripts/services/chrom-info.js +32 -4
  98. package/app/scripts/services/element-resize-listener.js +2 -2
  99. package/app/scripts/services/index.js +0 -1
  100. package/app/scripts/services/tile-proxy.js +368 -285
  101. package/app/scripts/services/worker.js +31 -28
  102. package/app/scripts/test-helpers/index.js +2 -1
  103. package/app/scripts/test-helpers/test-helpers.jsx +157 -69
  104. package/app/scripts/types.ts +118 -47
  105. package/app/scripts/utils/LruCache.js +3 -2
  106. package/app/scripts/utils/assert.js +19 -0
  107. package/app/scripts/utils/background-task-scheduler.js +2 -0
  108. package/app/scripts/utils/color-domain-to-rgba-array.js +13 -3
  109. package/app/scripts/utils/copy-text-to-clipboard.js +36 -0
  110. package/app/scripts/utils/decompress.js +33 -0
  111. package/app/scripts/utils/default-tracks.js +46 -0
  112. package/app/scripts/utils/dict-items.js +1 -0
  113. package/app/scripts/utils/dict-keys.js +1 -0
  114. package/app/scripts/utils/dict-values.js +1 -0
  115. package/app/scripts/utils/expand-combined-tracks.js +11 -7
  116. package/app/scripts/utils/fill-in-min-widths.js +47 -21
  117. package/app/scripts/utils/flatten.js +0 -1
  118. package/app/scripts/utils/get-aggregation-function.js +1 -1
  119. package/app/scripts/utils/get-default-track-for-datatype.js +37 -10
  120. package/app/scripts/utils/get-default-tracks-for-datatype.ts +46 -0
  121. package/app/scripts/utils/get-higlass-components.js +27 -3
  122. package/app/scripts/utils/get-track-position-by-uid.js +8 -1
  123. package/app/scripts/utils/get-xylofon.js +12 -9
  124. package/app/scripts/utils/has-parent.js +5 -5
  125. package/app/scripts/utils/hex-string-to-int.js +1 -1
  126. package/app/scripts/utils/index.js +1 -0
  127. package/app/scripts/utils/interval-tree.js +222 -177
  128. package/app/scripts/utils/load-chrom-infos.js +4 -1
  129. package/app/scripts/utils/pixi-text-to-svg.js +5 -9
  130. package/app/scripts/utils/positioned-tracks-to-all-tracks.js +55 -0
  131. package/app/scripts/utils/range-query-2d.js +3 -3
  132. package/app/scripts/utils/reduce.js +12 -5
  133. package/app/scripts/utils/segments-to-rows.js +14 -11
  134. package/app/scripts/utils/svg-line.js +7 -8
  135. package/app/scripts/utils/type-guards.js +16 -7
  136. package/app/scripts/utils/visit-positioned-tracks.js +9 -4
  137. package/app/styles/AddTrackPositionMenu.module.scss +37 -0
  138. package/app/styles/HiGlass.module.scss +3 -1
  139. package/app/styles/d3-context-menu.css +0 -1
  140. package/app/styles/prism.css +1 -0
  141. package/dist/app/schema.json +525 -0
  142. package/dist/app/scripts/AddTrackDialog.d.ts +64 -0
  143. package/dist/app/scripts/AddTrackPositionMenu.d.ts +5 -0
  144. package/dist/app/scripts/Annotations1dTrack.d.ts +15 -0
  145. package/dist/app/scripts/Annotations2dTrack.d.ts +95 -0
  146. package/dist/app/scripts/ArrowheadDomainsTrack.d.ts +36 -0
  147. package/dist/app/scripts/Autocomplete.d.ts +102 -0
  148. package/dist/app/scripts/AxisPixi.d.ts +25 -0
  149. package/dist/app/scripts/BarTrack.d.ts +28 -0
  150. package/dist/app/scripts/BedLikeTrack.d.ts +84 -0
  151. package/dist/app/scripts/Button.d.ts +3 -0
  152. package/dist/app/scripts/CNVIntervalTrack.d.ts +12 -0
  153. package/dist/app/scripts/CenterTiledPlot.d.ts +3 -0
  154. package/dist/app/scripts/CenterTrack.d.ts +92 -0
  155. package/dist/app/scripts/Chromosome2DAnnotations.d.ts +10 -0
  156. package/dist/app/scripts/Chromosome2DLabels.d.ts +13 -0
  157. package/dist/app/scripts/ChromosomeGrid.d.ts +24 -0
  158. package/dist/app/scripts/ChromosomeInfo.d.ts +14 -0
  159. package/dist/app/scripts/CloseTrackMenu.d.ts +10 -0
  160. package/dist/app/scripts/CombinedTrack.d.ts +32 -0
  161. package/dist/app/scripts/ConfigTrackMenu.d.ts +10 -0
  162. package/dist/app/scripts/ConfigViewMenu.d.ts +34 -0
  163. package/dist/app/scripts/ConfigureSeriesMenu.d.ts +3 -0
  164. package/dist/app/scripts/ContextMenuContainer.d.ts +36 -0
  165. package/dist/app/scripts/ContextMenuItem.d.ts +34 -0
  166. package/dist/app/scripts/Cross.d.ts +3 -0
  167. package/dist/app/scripts/CrossRule.d.ts +24 -0
  168. package/dist/app/scripts/CustomTrackDialog.d.ts +17 -0
  169. package/dist/app/scripts/Dialog.d.ts +5 -0
  170. package/dist/app/scripts/DivergentBarTrack.d.ts +4 -0
  171. package/dist/app/scripts/DragListeningDiv.d.ts +32 -0
  172. package/dist/app/scripts/DraggableDiv.d.ts +63 -0
  173. package/dist/app/scripts/ExportLinkDialog.d.ts +21 -0
  174. package/dist/app/scripts/FilledLine.d.ts +5 -0
  175. package/dist/app/scripts/FixedTrack.d.ts +5 -0
  176. package/dist/app/scripts/GalleryTracks.d.ts +20 -0
  177. package/dist/app/scripts/GenomePositionSearchBox.d.ts +95 -0
  178. package/dist/app/scripts/HeatmapOptions.d.ts +30 -0
  179. package/dist/app/scripts/HeatmapTiledPixiTrack.d.ts +184 -0
  180. package/dist/app/scripts/HiGlassComponent.d.ts +762 -0
  181. package/dist/app/scripts/HiGlassComponentContext.d.ts +3 -0
  182. package/dist/app/scripts/HiGlassTrackComponent.d.ts +37 -0
  183. package/dist/app/scripts/Horizontal1dHeatmapTrack.d.ts +9 -0
  184. package/dist/app/scripts/Horizontal2DDomainsTrack.d.ts +21 -0
  185. package/dist/app/scripts/HorizontalChromosomeLabels.d.ts +47 -0
  186. package/dist/app/scripts/HorizontalGeneAnnotationsTrack.d.ts +25 -0
  187. package/dist/app/scripts/HorizontalHeatmapTrack.d.ts +12 -0
  188. package/dist/app/scripts/HorizontalItem.d.ts +3 -0
  189. package/dist/app/scripts/HorizontalLine1DPixiTrack.d.ts +23 -0
  190. package/dist/app/scripts/HorizontalMultivecTrack.d.ts +50 -0
  191. package/dist/app/scripts/HorizontalPoint1DPixiTrack.d.ts +5 -0
  192. package/dist/app/scripts/HorizontalRule.d.ts +22 -0
  193. package/dist/app/scripts/HorizontalTiled1DPixiTrack.d.ts +26 -0
  194. package/dist/app/scripts/HorizontalTiledPlot.d.ts +49 -0
  195. package/dist/app/scripts/HorizontalTrack.d.ts +6 -0
  196. package/dist/app/scripts/Id2DTiledPixiTrack.d.ts +10 -0
  197. package/dist/app/scripts/IdHorizontal1DTiledPixiTrack.d.ts +6 -0
  198. package/dist/app/scripts/IdVertical1DTiledPixiTrack.d.ts +7 -0
  199. package/dist/app/scripts/LeftAxisTrack.d.ts +9 -0
  200. package/dist/app/scripts/LeftTrackModifier.d.ts +29 -0
  201. package/dist/app/scripts/ListWrapper.d.ts +64 -0
  202. package/dist/app/scripts/MapboxTilesTrack.d.ts +9 -0
  203. package/dist/app/scripts/Modal.d.ts +5 -0
  204. package/dist/app/scripts/MoveableTrack.d.ts +18 -0
  205. package/dist/app/scripts/NestedContextMenu.d.ts +7 -0
  206. package/dist/app/scripts/OSMTileIdsTrack.d.ts +5 -0
  207. package/dist/app/scripts/OSMTilesTrack.d.ts +129 -0
  208. package/dist/app/scripts/OverlayTrack.d.ts +13 -0
  209. package/dist/app/scripts/PixiTrack.d.ts +174 -0
  210. package/dist/app/scripts/PlotTypeChooser.d.ts +25 -0
  211. package/dist/app/scripts/PopupMenu.d.ts +28 -0
  212. package/dist/app/scripts/RasterTilesTrack.d.ts +9 -0
  213. package/dist/app/scripts/RuleMixin.d.ts +2 -0
  214. package/dist/app/scripts/SVGTrack.d.ts +15 -0
  215. package/dist/app/scripts/SearchField.d.ts +13 -0
  216. package/dist/app/scripts/SeriesListItems.d.ts +2 -0
  217. package/dist/app/scripts/SeriesListMenu.d.ts +51 -0
  218. package/dist/app/scripts/SeriesListSubmenuMixin.d.ts +2 -0
  219. package/dist/app/scripts/SketchInlinePicker.d.ts +25 -0
  220. package/dist/app/scripts/SortableList.d.ts +22 -0
  221. package/dist/app/scripts/SquareMarkersTrack.d.ts +22 -0
  222. package/dist/app/scripts/Tiled1DPixiTrack.d.ts +60 -0
  223. package/dist/app/scripts/TiledPixiTrack.d.ts +369 -0
  224. package/dist/app/scripts/TiledPlot.d.ts +313 -0
  225. package/dist/app/scripts/TilesetFinder.d.ts +65 -0
  226. package/dist/app/scripts/TopAxisTrack.d.ts +9 -0
  227. package/dist/app/scripts/Track.d.ts +196 -0
  228. package/dist/app/scripts/TrackArea.d.ts +26 -0
  229. package/dist/app/scripts/TrackControl.d.ts +5 -0
  230. package/dist/app/scripts/TrackRenderer.d.ts +724 -0
  231. package/dist/app/scripts/UnknownPixiTrack.d.ts +7 -0
  232. package/dist/app/scripts/ValueIntervalTrack.d.ts +6 -0
  233. package/dist/app/scripts/VerticalItem.d.ts +3 -0
  234. package/dist/app/scripts/VerticalRule.d.ts +21 -0
  235. package/dist/app/scripts/VerticalTiled1DPixiTrack.d.ts +6 -0
  236. package/dist/app/scripts/VerticalTiledPlot.d.ts +50 -0
  237. package/dist/app/scripts/VerticalTrack.d.ts +6 -0
  238. package/dist/app/scripts/ViewConfigEditor.d.ts +53 -0
  239. package/dist/app/scripts/ViewContextMenu.d.ts +17 -0
  240. package/dist/app/scripts/ViewHeader.d.ts +75 -0
  241. package/dist/app/scripts/ViewportTracker2D.d.ts +17 -0
  242. package/dist/app/scripts/ViewportTracker2DPixi.d.ts +11 -0
  243. package/dist/app/scripts/ViewportTrackerHorizontal.d.ts +17 -0
  244. package/dist/app/scripts/ViewportTrackerVertical.d.ts +17 -0
  245. package/dist/app/scripts/api.d.ts +640 -0
  246. package/dist/app/scripts/configs/available-track-types.d.ts +2 -0
  247. package/dist/app/scripts/configs/colormaps.d.ts +2 -0
  248. package/dist/app/scripts/configs/datatype-to-track-type.d.ts +4 -0
  249. package/dist/app/scripts/configs/default-tracks-for-datatype.d.ts +38 -0
  250. package/dist/app/scripts/configs/dense-data-extrema-config.d.ts +2 -0
  251. package/dist/app/scripts/configs/globals.d.ts +5 -0
  252. package/dist/app/scripts/configs/index.d.ts +16 -0
  253. package/dist/app/scripts/configs/positions-by-datatype.d.ts +2 -0
  254. package/dist/app/scripts/configs/primitives.d.ts +20 -0
  255. package/dist/app/scripts/configs/themes.d.ts +3 -0
  256. package/dist/app/scripts/configs/tracks-info-by-type.d.ts +4 -0
  257. package/dist/app/scripts/configs/tracks-info.d.ts +24 -0
  258. package/dist/app/scripts/d3-context-menu.d.ts +2 -0
  259. package/dist/app/scripts/data-fetchers/DataFetcher.d.ts +151 -0
  260. package/dist/app/scripts/data-fetchers/genbank-fetcher.d.ts +86 -0
  261. package/dist/app/scripts/data-fetchers/index.d.ts +3 -0
  262. package/dist/app/scripts/data-fetchers/local-tile-fetcher.d.ts +47 -0
  263. package/dist/app/scripts/gosling-exports.d.ts +17 -0
  264. package/dist/app/scripts/hglib.d.ts +24 -0
  265. package/dist/app/scripts/hocs/with-modal.d.ts +19 -0
  266. package/dist/app/scripts/hocs/with-pub-sub.d.ts +22 -0
  267. package/dist/app/scripts/hocs/with-theme.d.ts +13 -0
  268. package/dist/app/scripts/icons.d.ts +161 -0
  269. package/dist/app/scripts/mixwith.d.ts +27 -0
  270. package/dist/app/scripts/options-info.d.ts +1355 -0
  271. package/dist/app/scripts/plugins/available-for-plugins.d.ts +2338 -0
  272. package/dist/app/scripts/plugins/get-data-fetcher.d.ts +2 -0
  273. package/dist/app/scripts/plugins/index.d.ts +2 -0
  274. package/dist/app/scripts/services/chrom-info.d.ts +10 -0
  275. package/dist/app/scripts/services/dom-event.d.ts +7 -0
  276. package/dist/app/scripts/services/element-resize-listener.d.ts +5 -0
  277. package/dist/app/scripts/services/index.d.ts +5 -0
  278. package/dist/app/scripts/services/tile-proxy.d.ts +180 -0
  279. package/dist/app/scripts/services/worker.d.ts +157 -0
  280. package/dist/app/scripts/symbol.d.ts +13 -0
  281. package/dist/app/scripts/test-helpers/index.d.ts +1 -0
  282. package/dist/app/scripts/test-helpers/test-helpers.d.ts +33 -0
  283. package/dist/app/scripts/track-utils.d.ts +73 -0
  284. package/dist/app/scripts/types.d.ts +199 -0
  285. package/dist/app/scripts/utils/DenseDataExtrema1D.d.ts +88 -0
  286. package/dist/app/scripts/utils/DenseDataExtrema2D.d.ts +97 -0
  287. package/dist/app/scripts/utils/LruCache.d.ts +44 -0
  288. package/dist/app/scripts/utils/abs-to-chr.d.ts +14 -0
  289. package/dist/app/scripts/utils/accessor-transposition.d.ts +14 -0
  290. package/dist/app/scripts/utils/add-arrays.d.ts +18 -0
  291. package/dist/app/scripts/utils/add-class.d.ts +8 -0
  292. package/dist/app/scripts/utils/add-event-listener-once.d.ts +11 -0
  293. package/dist/app/scripts/utils/assert.d.ts +17 -0
  294. package/dist/app/scripts/utils/background-task-scheduler.d.ts +47 -0
  295. package/dist/app/scripts/utils/base64-to-canvas.d.ts +9 -0
  296. package/dist/app/scripts/utils/chr-to-abs.d.ts +10 -0
  297. package/dist/app/scripts/utils/chrom-info-bisector.d.ts +4 -0
  298. package/dist/app/scripts/utils/clone-event.d.ts +12 -0
  299. package/dist/app/scripts/utils/color-domain-to-rgba-array.d.ts +13 -0
  300. package/dist/app/scripts/utils/color-to-hex.d.ts +9 -0
  301. package/dist/app/scripts/utils/color-to-rgba.d.ts +9 -0
  302. package/dist/app/scripts/utils/copy-text-to-clipboard.d.ts +2 -0
  303. package/dist/app/scripts/utils/data-to-genomic-loci.d.ts +11 -0
  304. package/dist/app/scripts/utils/debounce.d.ts +5 -0
  305. package/dist/app/scripts/utils/dec-to-hex-str.d.ts +8 -0
  306. package/dist/app/scripts/utils/decompress.d.ts +27 -0
  307. package/dist/app/scripts/utils/default-tracks.d.ts +3 -0
  308. package/dist/app/scripts/utils/dict-from-tuples.d.ts +11 -0
  309. package/dist/app/scripts/utils/dict-items.d.ts +18 -0
  310. package/dist/app/scripts/utils/dict-keys.d.ts +10 -0
  311. package/dist/app/scripts/utils/dict-values.d.ts +8 -0
  312. package/dist/app/scripts/utils/download.d.ts +7 -0
  313. package/dist/app/scripts/utils/expand-combined-tracks.d.ts +11 -0
  314. package/dist/app/scripts/utils/fake-pub-sub.d.ts +11 -0
  315. package/dist/app/scripts/utils/fill-in-min-widths.d.ts +44 -0
  316. package/dist/app/scripts/utils/flatten.d.ts +9 -0
  317. package/dist/app/scripts/utils/for-each.d.ts +9 -0
  318. package/dist/app/scripts/utils/forward-event.d.ts +7 -0
  319. package/dist/app/scripts/utils/genome-loci-to-pixels.d.ts +9 -0
  320. package/dist/app/scripts/utils/genomic-range-to-chromosome-chunks.d.ts +21 -0
  321. package/dist/app/scripts/utils/get-aggregation-function.d.ts +10 -0
  322. package/dist/app/scripts/utils/get-default-track-for-datatype.d.ts +21 -0
  323. package/dist/app/scripts/utils/get-default-tracks-for-datatype.d.ts +3 -0
  324. package/dist/app/scripts/utils/get-element-dim.d.ts +7 -0
  325. package/dist/app/scripts/utils/get-higlass-components.d.ts +7 -0
  326. package/dist/app/scripts/utils/get-track-by-uid.d.ts +7 -0
  327. package/dist/app/scripts/utils/get-track-conf-from-hgc.d.ts +10 -0
  328. package/dist/app/scripts/utils/get-track-obj-by-id.d.ts +2 -0
  329. package/dist/app/scripts/utils/get-track-position-by-uid.d.ts +13 -0
  330. package/dist/app/scripts/utils/get-xylofon.d.ts +2 -0
  331. package/dist/app/scripts/utils/gradient.d.ts +14 -0
  332. package/dist/app/scripts/utils/has-class.d.ts +8 -0
  333. package/dist/app/scripts/utils/has-parent.d.ts +9 -0
  334. package/dist/app/scripts/utils/hex-string-to-int.d.ts +14 -0
  335. package/dist/app/scripts/utils/index.d.ts +89 -0
  336. package/dist/app/scripts/utils/interval-tree.d.ts +109 -0
  337. package/dist/app/scripts/utils/into-the-void.d.ts +6 -0
  338. package/dist/app/scripts/utils/is-track-or-child-track.d.ts +7 -0
  339. package/dist/app/scripts/utils/is-track-range-selectable.d.ts +2 -0
  340. package/dist/app/scripts/utils/is-within.d.ts +12 -0
  341. package/dist/app/scripts/utils/lat-to-y.d.ts +9 -0
  342. package/dist/app/scripts/utils/lng-to-x.d.ts +8 -0
  343. package/dist/app/scripts/utils/load-chrom-infos.d.ts +8 -0
  344. package/dist/app/scripts/utils/map.d.ts +13 -0
  345. package/dist/app/scripts/utils/max-non-zero.d.ts +6 -0
  346. package/dist/app/scripts/utils/max.d.ts +10 -0
  347. package/dist/app/scripts/utils/min-non-zero.d.ts +6 -0
  348. package/dist/app/scripts/utils/min.d.ts +10 -0
  349. package/dist/app/scripts/utils/mod.d.ts +9 -0
  350. package/dist/app/scripts/utils/ndarray-assign.d.ts +2 -0
  351. package/dist/app/scripts/utils/ndarray-flatten.d.ts +2 -0
  352. package/dist/app/scripts/utils/ndarray-to-list.d.ts +2 -0
  353. package/dist/app/scripts/utils/numericify-version.d.ts +6 -0
  354. package/dist/app/scripts/utils/obj-vals.d.ts +8 -0
  355. package/dist/app/scripts/utils/or.d.ts +8 -0
  356. package/dist/app/scripts/utils/parse-chromsizes-rows.d.ts +34 -0
  357. package/dist/app/scripts/utils/pixi-text-to-svg.d.ts +2 -0
  358. package/dist/app/scripts/utils/positioned-tracks-to-all-tracks.d.ts +26 -0
  359. package/dist/app/scripts/utils/q.d.ts +18 -0
  360. package/dist/app/scripts/utils/rad-to-deg.d.ts +7 -0
  361. package/dist/app/scripts/utils/range-query-2d.d.ts +17 -0
  362. package/dist/app/scripts/utils/reduce.d.ts +14 -0
  363. package/dist/app/scripts/utils/rel-to-abs-chrom-pos.d.ts +10 -0
  364. package/dist/app/scripts/utils/remove-class.d.ts +7 -0
  365. package/dist/app/scripts/utils/reset-d3-brush-style.d.ts +10 -0
  366. package/dist/app/scripts/utils/rgb-to-hex.d.ts +8 -0
  367. package/dist/app/scripts/utils/scales-center-and-k.d.ts +12 -0
  368. package/dist/app/scripts/utils/scales-to-genome-loci.d.ts +3 -0
  369. package/dist/app/scripts/utils/segments-to-rows.d.ts +15 -0
  370. package/dist/app/scripts/utils/selected-items-to-cum-weights.d.ts +12 -0
  371. package/dist/app/scripts/utils/selected-items-to-size.d.ts +13 -0
  372. package/dist/app/scripts/utils/show-mouse-position.d.ts +54 -0
  373. package/dist/app/scripts/utils/some.d.ts +10 -0
  374. package/dist/app/scripts/utils/sum.d.ts +8 -0
  375. package/dist/app/scripts/utils/svg-line.d.ts +2 -0
  376. package/dist/app/scripts/utils/throttle-and-debounce.d.ts +33 -0
  377. package/dist/app/scripts/utils/tile-to-canvas.d.ts +9 -0
  378. package/dist/app/scripts/utils/timeout.d.ts +3 -0
  379. package/dist/app/scripts/utils/to-void.d.ts +3 -0
  380. package/dist/app/scripts/utils/total-track-pixel-height.d.ts +27 -0
  381. package/dist/app/scripts/utils/trim-trailing-slash.d.ts +7 -0
  382. package/dist/app/scripts/utils/type-guards.d.ts +36 -0
  383. package/dist/app/scripts/utils/value-to-color.d.ts +12 -0
  384. package/dist/app/scripts/utils/visit-positioned-tracks.d.ts +18 -0
  385. package/dist/app/scripts/utils/visit-tracks.d.ts +9 -0
  386. package/dist/esm.html +1 -3
  387. package/dist/hglib.js +86315 -100592
  388. package/dist/hglib.min.js +123 -131
  389. package/dist/higlass.mjs +88861 -103138
  390. package/dist/index.html +1 -3
  391. package/dist/package.json +134 -0
  392. package/package.json +25 -27
@@ -1,4 +1,4 @@
1
- import { scaleLog, scaleLinear } from 'd3-scale';
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[] | number[][]} selectedRows - Row indices, for ordering and filtering rows. Used by the HorizontalMultivecTrack.
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[] | number[][]} selectedRows - Row indices, for ordering and filtering rows. Used by the HorizontalMultivecTrack.
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 {Array<[r: number, g: number, b: number, a: number]>} colorScale
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=} dense - a base64 encoded 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[]} theseTileIds
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
- * @param {string} outUrl
472
- * @param {string} server
473
- * @param {string[]} theseTileIds
474
- * @param {string} authHeader
475
- * @param {(data: Record<string, CompletedTileData<TileResponse>>) => void} done
476
- * @param {Record<string, unknown>} requestBody
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 workerGetTiles(
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
- fetch(outUrl, {
494
+ options.pubSub?.publish('requestSent', url);
495
+ return fetch(url, {
494
496
  credentials: 'same-origin',
495
497
  headers,
496
- ...(requestBody && Object.keys(requestBody).length > 0
498
+ ...(request.body?.length > 0
497
499
  ? {
498
500
  method: 'POST',
499
- body: JSON.stringify(requestBody),
501
+ body: JSON.stringify(request.body),
500
502
  }
501
503
  : {}),
502
504
  })
503
505
  .then((response) => response.json())
504
506
  .then((data) => {
505
- done(tileResponseToData(data, server, theseTileIds));
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,9 +1,10 @@
1
- // @ts-nocheck
2
1
  export {
3
2
  changeOptions,
4
3
  waitForJsonComplete,
5
4
  waitForTilesLoaded,
6
5
  waitForTransitionsFinished,
6
+ waitForScalesStabilized,
7
+ waitForComponentReady,
7
8
  mountHGComponent,
8
9
  mountHGComponentAsync,
9
10
  removeHGComponent,
@@ -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
- * @param hgc enzyme wrapper for a HiGlassComponent
19
- * @param viewUid The view uid
20
- * @param trackUid The track uid
21
- * @param options An object of new options (e.g. { color: 'black'})
22
- * @return nothing
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
- * Parameters
42
- * ----------
43
- * hgc: enzyme wrapper for a HiGlassComponent
39
+ * @param {HiGlassComponent} hgc
44
40
  *
45
- * Returns
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, track.trackId);
45
+ const trackRenderer = getTrackRenderer(hgc, track.viewId);
52
46
 
53
- if (trackRenderer.activeTransitions > 0) return true;
47
+ if (trackRenderer?.activeTransitions) return true;
54
48
  }
55
49
  return false;
56
50
  };
57
51
 
58
52
  /**
59
- * Wait until all transitions have finished before
60
- * calling the callback
53
+ * Waits for multiple elements to appear in the DOM.
61
54
  *
62
- * Arguments
63
- * ---------
64
- * hgc: Enzyme wrapper for a HiGlassComponent
65
- * The componentthat we're waiting on
66
- * tilesLoadedCallback: function
67
- * The callback to call whenever all of the tiles
68
- * have been loaded.
69
- * Returns
70
- * -------
71
- * Nothing
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
- * Parameters
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
- * Arguments
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
- } else if (
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 && trackObj.fetching.size) {
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 {HTMLElement | null} prevDiv A div element to detach and recreate for the component
182
- * @param {import('enzyme').ReactWrapper | null} prevHgc An already mounted
183
- * hgc component
184
- * @param {function} done The callback to call when the component is fully loaded
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
  }