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,11 +1,72 @@
1
- /* eslint-disable */
2
-
3
- import type { THEME_DARK, THEME_LIGHT } from './configs';
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
- export type TrackPosition =
8
- typeof import('./configs/primitives').TRACK_LOCATIONS[number];
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
- position: TrackPosition;
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: string;
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
- position: TrackPosition;
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: string;
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
- (track: TrackConfig, position: null | TrackPosition): void;
60
- };
61
-
62
- type ZoomedFunction = {
63
- (
64
- xScale: Scale,
65
- yScale: Scale,
66
- k?: number,
67
- x?: number,
68
- y?: number,
69
- xPosition?: number,
70
- yPosition?: number,
71
- ): void;
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?: unknown;
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
- (info: null): void;
130
- (info: TilesetInfo, tilesetUid?: string): void;
131
- (error: { error: string }): void;
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
- server?: string;
149
- tileIds: string[];
150
- options?: unknown;
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
- /* eslint-disable no-param-reassign */
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
- /* eslint-enable */
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(colorRange);
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
+ }
@@ -19,6 +19,7 @@ const dictItems = (dictionary) => {
19
19
  const keyValues = [];
20
20
 
21
21
  for (const key in dictionary) {
22
+ // biome-ignore lint/suspicious/noPrototypeBuiltins:
22
23
  if (dictionary.hasOwnProperty(key)) {
23
24
  keyValues.push([key, dictionary[key]]);
24
25
  }
@@ -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
  }
@@ -10,6 +10,7 @@ export default function dictValues(dictionary) {
10
10
  const values = [];
11
11
 
12
12
  for (const key in dictionary) {
13
+ // biome-ignore lint/suspicious/noPrototypeBuiltins:
13
14
  if (dictionary.hasOwnProperty(key)) {
14
15
  values.push(dictionary[key]);
15
16
  }
@@ -1,19 +1,23 @@
1
- // @ts-nocheck
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 {list} tracks: A list of tracks some of which might be combined
7
- * @returns {list} tracks: A list of tracks without combined
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 (let i = 0; i < trackList.length; i++) {
13
- if (trackList[i].contents) {
14
- newTracks = newTracks.concat(trackList[i].contents);
16
+ for (const track of trackList) {
17
+ if (isCombinedTrackConfig(track)) {
18
+ newTracks = newTracks.concat(track.contents);
15
19
  } else {
16
- newTracks.push(trackList[i]);
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
- * If tracks don't have specified dimensions, add in the known
11
- * minimums
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
- const horizontalLocations = ['top', 'bottom', 'gallery'];
17
- const verticalLocations = ['left', 'right', 'gallery'];
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 = tracks.center || [];
22
- tracks.left = tracks.left || [];
23
- tracks.right = tracks.right || [];
24
- tracks.top = tracks.top || [];
25
- tracks.bottom = tracks.bottom || [];
26
- tracks.whole = tracks.whole || [];
27
- tracks.gallery = 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 = (trackInfo && trackInfo.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 = (trackInfo && trackInfo.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
 
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import reduce from './reduce';
3
2
 
4
3
  /**
@@ -1,4 +1,4 @@
1
- import { mean, sum, variance, deviation } from 'd3-array';
1
+ import { deviation, mean, sum, variance } from 'd3-array';
2
2
 
3
3
  /** @typedef {(values: number[]) => number | undefined} Aggregation */
4
4