higlass 1.13.4 → 1.13.6

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 (139) 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 +3 -3
  5. package/app/scripts/AddTrackPositionMenu.jsx +2 -2
  6. package/app/scripts/Annotations1dTrack.js +1 -1
  7. package/app/scripts/Annotations2dTrack.js +3 -5
  8. package/app/scripts/Autocomplete.jsx +14 -21
  9. package/app/scripts/AxisPixi.js +10 -12
  10. package/app/scripts/BarTrack.js +3 -3
  11. package/app/scripts/BedLikeTrack.js +12 -13
  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 +4 -2
  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 +1 -2
  23. package/app/scripts/ContextMenuItem.jsx +1 -0
  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/GalleryTracks.jsx +77 -78
  31. package/app/scripts/GenomePositionSearchBox.jsx +10 -9
  32. package/app/scripts/HeatmapOptions.jsx +8 -3
  33. package/app/scripts/HeatmapTiledPixiTrack.js +72 -53
  34. package/app/scripts/HiGlassComponent.jsx +75 -98
  35. package/app/scripts/Horizontal1dHeatmapTrack.js +1 -1
  36. package/app/scripts/Horizontal2DDomainsTrack.js +1 -1
  37. package/app/scripts/HorizontalChromosomeLabels.js +28 -22
  38. package/app/scripts/HorizontalGeneAnnotationsTrack.js +1 -1
  39. package/app/scripts/HorizontalHeatmapTrack.js +2 -2
  40. package/app/scripts/HorizontalMultivecTrack.js +6 -7
  41. package/app/scripts/HorizontalRule.js +1 -2
  42. package/app/scripts/HorizontalTiled1DPixiTrack.js +4 -4
  43. package/app/scripts/HorizontalTiledPlot.jsx +9 -9
  44. package/app/scripts/LeftTrackModifier.js +4 -0
  45. package/app/scripts/ListWrapper.jsx +1 -2
  46. package/app/scripts/MapboxTilesTrack.js +4 -4
  47. package/app/scripts/Modal.jsx +2 -2
  48. package/app/scripts/MoveableTrack.jsx +10 -12
  49. package/app/scripts/NestedContextMenu.jsx +2 -1
  50. package/app/scripts/OSMTileIdsTrack.js +1 -1
  51. package/app/scripts/OverlayTrack.js +4 -4
  52. package/app/scripts/PixiTrack.js +58 -17
  53. package/app/scripts/PlotTypeChooser.jsx +3 -4
  54. package/app/scripts/RasterTilesTrack.js +3 -2
  55. package/app/scripts/SearchField.js +5 -5
  56. package/app/scripts/SeriesListItems.jsx +3 -4
  57. package/app/scripts/SeriesListMenu.jsx +81 -11
  58. package/app/scripts/SeriesListSubmenuMixin.jsx +5 -1
  59. package/app/scripts/SketchInlinePicker.jsx +2 -2
  60. package/app/scripts/SortableList.jsx +1 -1
  61. package/app/scripts/Tiled1DPixiTrack.js +5 -1
  62. package/app/scripts/TiledPixiTrack.js +221 -76
  63. package/app/scripts/TiledPlot.jsx +35 -43
  64. package/app/scripts/TilesetFinder.jsx +12 -4
  65. package/app/scripts/Track.js +2 -2
  66. package/app/scripts/TrackArea.jsx +4 -0
  67. package/app/scripts/TrackControl.jsx +2 -2
  68. package/app/scripts/TrackRenderer.jsx +30 -31
  69. package/app/scripts/UnknownPixiTrack.js +1 -1
  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 +4 -4
  75. package/app/scripts/ViewHeader.jsx +6 -7
  76. package/app/scripts/ViewportTracker2D.js +1 -1
  77. package/app/scripts/api.js +5 -6
  78. package/app/scripts/configs/available-track-types.js +1 -1
  79. package/app/scripts/configs/positions-by-datatype.js +2 -2
  80. package/app/scripts/configs/themes.js +0 -1
  81. package/app/scripts/configs/tracks-info-by-type.js +11 -8
  82. package/app/scripts/configs/tracks-info.js +2 -2
  83. package/app/scripts/d3-context-menu.js +3 -4
  84. package/app/scripts/data-fetchers/DataFetcher.js +107 -91
  85. package/app/scripts/data-fetchers/genbank-fetcher.js +6 -10
  86. package/app/scripts/data-fetchers/local-tile-fetcher.js +2 -6
  87. package/app/scripts/gosling-exports.js +29 -0
  88. package/app/scripts/hglib.jsx +3 -1
  89. package/app/scripts/hocs/with-modal.jsx +32 -10
  90. package/app/scripts/hocs/with-pub-sub.js +28 -0
  91. package/app/scripts/hocs/with-theme.jsx +21 -14
  92. package/app/scripts/icons.jsx +3 -2
  93. package/app/scripts/mixwith.js +2 -2
  94. package/app/scripts/plugins/get-data-fetcher.js +2 -3
  95. package/app/scripts/services/chrom-info.js +32 -4
  96. package/app/scripts/services/element-resize-listener.js +2 -2
  97. package/app/scripts/services/index.js +0 -1
  98. package/app/scripts/services/tile-proxy.js +370 -282
  99. package/app/scripts/services/worker.js +36 -34
  100. package/app/scripts/test-helpers/test-helpers.jsx +3 -3
  101. package/app/scripts/types.ts +73 -38
  102. package/app/scripts/utils/DenseDataExtrema1D.js +1 -1
  103. package/app/scripts/utils/DenseDataExtrema2D.js +2 -1
  104. package/app/scripts/utils/LruCache.js +3 -2
  105. package/app/scripts/utils/assert.js +19 -0
  106. package/app/scripts/utils/background-task-scheduler.js +2 -0
  107. package/app/scripts/utils/color-domain-to-rgba-array.js +13 -3
  108. package/app/scripts/utils/color-to-hex.js +1 -1
  109. package/app/scripts/utils/dict-items.js +1 -0
  110. package/app/scripts/utils/dict-keys.js +1 -0
  111. package/app/scripts/utils/dict-values.js +1 -0
  112. package/app/scripts/utils/expand-combined-tracks.js +11 -7
  113. package/app/scripts/utils/fake-pub-sub.js +12 -0
  114. package/app/scripts/utils/fill-in-min-widths.js +47 -21
  115. package/app/scripts/utils/flatten.js +0 -1
  116. package/app/scripts/utils/get-aggregation-function.js +1 -1
  117. package/app/scripts/utils/get-default-track-for-datatype.js +36 -10
  118. package/app/scripts/utils/get-higlass-components.js +27 -3
  119. package/app/scripts/utils/get-track-position-by-uid.js +8 -1
  120. package/app/scripts/utils/get-xylofon.js +12 -9
  121. package/app/scripts/utils/has-parent.js +5 -5
  122. package/app/scripts/utils/hex-string-to-int.js +1 -1
  123. package/app/scripts/utils/interval-tree.js +222 -177
  124. package/app/scripts/utils/load-chrom-infos.js +4 -1
  125. package/app/scripts/utils/pixi-text-to-svg.js +5 -9
  126. package/app/scripts/utils/range-query-2d.js +3 -3
  127. package/app/scripts/utils/reduce.js +12 -5
  128. package/app/scripts/utils/segments-to-rows.js +14 -11
  129. package/app/scripts/utils/show-mouse-position.js +17 -1
  130. package/app/scripts/utils/svg-line.js +7 -8
  131. package/app/scripts/utils/type-guards.js +16 -7
  132. package/app/scripts/utils/visit-positioned-tracks.js +7 -5
  133. package/app/styles/d3-context-menu.css +0 -1
  134. package/app/styles/prism.css +1 -0
  135. package/dist/hglib.js +85885 -85618
  136. package/dist/hglib.min.js +110 -109
  137. package/dist/higlass.mjs +86301 -86034
  138. package/package.json +13 -17
  139. package/app/scripts/hocs/with-pub-sub.jsx +0 -28
@@ -1,10 +1,7 @@
1
- // @ts-nocheck
2
1
  /**
3
2
  * Export a PIXI text to an SVG element
4
- *
5
- * param {PIXI.Text} pixiText A PIXI.Text object that we want to create an SVG element for
6
- * returns {Element} A DOM SVG Element with all of the attributes set as to display
7
- * the given text.
3
+ * @param {import('pixi.js').Text} pixiText A PIXI.Text object that we want to create an SVG element for
4
+ * @returns { HTMLElement } A DOM SVG Element with all of the attributes set as to display the given text.
8
5
  */
9
6
  export const pixiTextToSvg = (pixiText) => {
10
7
  const g = document.createElement('g');
@@ -18,11 +15,10 @@ export const pixiTextToSvg = (pixiText) => {
18
15
  t.setAttribute('text-anchor', 'middle');
19
16
  }
20
17
 
21
- t.setAttribute('font-family', pixiText.style.fontFamily);
22
- t.setAttribute('font-size', pixiText.style.fontSize);
18
+ t.setAttribute('font-family', pixiText.style.fontFamily?.toString() ?? '');
19
+ t.setAttribute('font-size', pixiText.style.fontSize?.toString() ?? '');
23
20
  g.setAttribute('transform', `scale(${pixiText.scale.x},1)`);
24
-
25
- t.setAttribute('fill', pixiText.style.fill);
21
+ t.setAttribute('fill', pixiText.style.fill?.toString() ?? '');
26
22
  t.innerHTML = pixiText.text;
27
23
 
28
24
  g.appendChild(t);
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
- import addArrays from './add-arrays';
3
2
  import accessorTransposition from './accessor-transposition';
3
+ import addArrays from './add-arrays';
4
4
 
5
5
  /**
6
6
  * Perform a 2D query on a 1D array
@@ -24,9 +24,9 @@ const rangeQuery2d = (
24
24
  xRange,
25
25
  yRange,
26
26
  mirrored,
27
- /* eslint-disable-next-line default-param-last */
27
+ // biome-ignore lint/style/useDefaultParameterLast:
28
28
  xOff = 0,
29
- /* eslint-disable-next-line default-param-last */
29
+ // biome-ignore lint/style/useDefaultParameterLast:
30
30
  yOff = 0,
31
31
  outList,
32
32
  ) => {
@@ -1,10 +1,17 @@
1
- // @ts-nocheck
2
1
  /**
3
- * Pure functional reducer. Can be used for currying stuff. Check out `flatten.js`.
4
- * @param {function} f Reducer function.
5
- * @return {array} Curried function that accepts an array to be reduced.
2
+ * Pure functional reducer. Can be used for currying stuff.
3
+ *
4
+ * @see {@link ./flatten.js}
5
+ *
6
+ * @template T
7
+ * @template U
8
+ *
9
+ * @param {(previousValue: U, currentValue: T, currentIndex: number, array: Array<T>) => U} callbackfn
10
+ * @param {U} initialValue
11
+ * @return {(x: Array<T>) => U} Curried function that accepts an array to be reduced.
6
12
  */
7
- const reduce = (f) => (x) => Array.prototype.reduce.call(x, f);
13
+ const reduce = (callbackfn, initialValue) => (x) =>
14
+ x.reduce(callbackfn, initialValue);
8
15
 
9
16
  // TODO(Trevor): Not referenced anywhere. Remove?
10
17
  export default reduce;
@@ -1,18 +1,20 @@
1
- // @ts-nocheck
2
- import IntervalTree from './interval-tree';
3
-
1
+ import { IntervalTree } from './interval-tree';
2
+
3
+ /** @typedef {{ from:number, to: number }} Segment */
4
+
5
+ /**
6
+ * Partition a list of segments into an array of rows containing the segments.
7
+ *
8
+ * WARNING: Sorts the `segments` array input _inplace_.
9
+ *
10
+ * @param {Array<Segment>} segments An array of segments (e.g. [{from: 10, to: 20}, {from: 18, to: 30}])
11
+ * @return: {Array<Array<Segment>>} non-overlapping rows of segments
12
+ */
4
13
  function segmentsToRows(segments) {
5
- /**
6
- * Partition a list of segments into an array of
7
- * rows containing the segments.
8
- *
9
- * @param segments: An array of segments (e.g. [{from: 10, to: 20}, {from: 18, to: 30}])
10
- * @return: An array of arrays of segments, representing
11
- * non-overlapping rows of segments
12
- */
13
14
  // sort by the length of each segment
14
15
  segments.sort((a, b) => b.to - b.from - (a.to - a.from));
15
16
 
17
+ /** @type {Array<Array<Segment>>} */
16
18
  const rows = [[]];
17
19
  const rowIts = [new IntervalTree()];
18
20
 
@@ -23,6 +25,7 @@ function segmentsToRows(segments) {
23
25
  for (let j = 0; j < rows.length; j++) {
24
26
  const it = rowIts[j]; // an interval tree
25
27
 
28
+ /** @type {[number, number]} */
26
29
  const toCheck = [+segments[i].from, +segments[i].to];
27
30
  const occluded = it.intersects(toCheck);
28
31
 
@@ -3,7 +3,7 @@ import { globalPubSub } from 'pub-sub-es';
3
3
  import hexStrToInt from './hex-string-to-int';
4
4
 
5
5
  // Configs
6
- import { GLOBALS } from '../configs';
6
+ import GLOBALS from '../configs/globals';
7
7
 
8
8
  const COLOR = 0xaaaaaa;
9
9
  const ALPHA = 1.0;
@@ -119,6 +119,22 @@ const showMousePosition = (
119
119
  y = event.isFrom2dTrack ? event.dataY : event.dataX;
120
120
  }
121
121
 
122
+ // If a track is not 2d and is horizontal, the event.dataY
123
+ // value of the mouse pointer location should not be allowed
124
+ // to impact how other tracks globally render their mouse
125
+ // position (see https://github.com/higlass/higlass/issues/814).
126
+ // Likewise, if a track is not 2d and is vertical, the
127
+ // event.dataX value should not be used by other tracks for
128
+ // position reporting.
129
+
130
+ if (!event.isFrom2dTrack) {
131
+ if (!event.isFromVerticalTrack) {
132
+ y = Number.MIN_SAFE_INTEGER;
133
+ } else {
134
+ x = Number.MIN_SAFE_INTEGER;
135
+ }
136
+ }
137
+
122
138
  // 2d or central tracks are not offset and rather rely on a mask, i.e., the
123
139
  // top left *visible* position is *not* [0,0] but given by `getPosition()`.
124
140
  const offset = is2d ? getPosition() : [0, 0];
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  /**
3
2
  * Generate a SVG line
4
3
  * @param {number} x1 Start X
@@ -6,19 +5,19 @@
6
5
  * @param {number} x2 End X
7
6
  * @param {number} y2 End Y
8
7
  * @param {number} strokeWidth Line width
9
- * @param {number} strokeColor Color HEX string
10
- * @return {object} SVG line object
8
+ * @param {string} strokeColor Color HEX string
9
+ * @return {HTMLElement} SVG line object
11
10
  */
12
11
  export const svgLine = (x1, y1, x2, y2, strokeWidth, strokeColor) => {
13
12
  const line = document.createElement('line');
14
13
 
15
- line.setAttribute('x1', x1);
16
- line.setAttribute('x2', x2);
17
- line.setAttribute('y1', y1);
18
- line.setAttribute('y2', y2);
14
+ line.setAttribute('x1', String(x1));
15
+ line.setAttribute('x2', String(x2));
16
+ line.setAttribute('y1', String(y1));
17
+ line.setAttribute('y2', String(y2));
19
18
 
20
19
  if (strokeWidth) {
21
- line.setAttribute('stroke-width', strokeWidth);
20
+ line.setAttribute('stroke-width', String(strokeWidth));
22
21
  }
23
22
  if (strokeColor) {
24
23
  line.setAttribute('stroke', strokeColor);
@@ -1,9 +1,11 @@
1
+ /** @import * as t from '../types' */
2
+
1
3
  /**
2
- * @param {import('../types').TrackConfig} trackConfig
3
- * @return {trackConfig is import('../types').CombinedTrackConfig}
4
+ * @param {t.TrackConfig} trackConfig
5
+ * @return {trackConfig is t.CombinedTrackConfig}
4
6
  */
5
7
  export function isCombinedTrackConfig(trackConfig) {
6
- return trackConfig.type === 'combined';
8
+ return 'contents' in trackConfig && trackConfig.type === 'combined';
7
9
  }
8
10
 
9
11
  /**
@@ -23,17 +25,24 @@ export function isObject(obj) {
23
25
  }
24
26
 
25
27
  /**
26
- * @param {import('../types').TilesetInfo | undefined} info
27
- * @returns {info is import('../types').LegacyTilesetInfo}
28
+ * @param {t.TilesetInfo | undefined} info
29
+ * @returns {info is t.LegacyTilesetInfo}
28
30
  */
29
31
  export function isLegacyTilesetInfo(info) {
30
32
  return isObject(info) && 'max_width' in info;
31
33
  }
32
34
 
33
35
  /**
34
- * @param {import('../types').TilesetInfo | undefined} info
35
- * @returns {info is import('../types').ResolutionsTilesetInfo}
36
+ * @param {t.TilesetInfo | undefined | { error: string }} info
37
+ * @returns {info is t.ResolutionsTilesetInfo}
36
38
  */
37
39
  export function isResolutionsTilesetInfo(info) {
38
40
  return isObject(info) && 'resolutions' in info;
39
41
  }
42
+ /**
43
+ * @param {t.TilesetInfo | undefined | { error: string }} info
44
+ * @returns {info is t.TilesetInfo}
45
+ */
46
+ export function isTilesetInfo(info) {
47
+ return isObject(info) && !('error' in info);
48
+ }
@@ -1,12 +1,14 @@
1
1
  import visitTracks from './visit-tracks';
2
2
 
3
- /** @typedef {{ [Key in import('../types').TrackPosition]: import('../types').TrackConfig[] }} PositionedTracks
4
- */
3
+ /** @import { TrackConfig, TrackPosition, TrackVisitor } from '../types' */
4
+
5
+ /** @typedef {{ [Key in TrackPosition]?: Array<TrackConfig> }} PositionedTracks */
5
6
 
6
7
  /**
7
8
  * Track visitor for positioned tracks, i.e., tracks with a position.
9
+ *
8
10
  * @param {PositionedTracks} positionedTracks - List of all positioned tracks from the view definition.
9
- * @param {import('../types').TrackVisitor} visitor - Callback function receiving individual tracks.
11
+ * @param {TrackVisitor} visitor - Callback function receiving individual tracks.
10
12
  * @param {boolean} inclCombinedTracks - If `true` recursively visit combined tracks.
11
13
  */
12
14
  const visitPositionedTracks = (
@@ -14,11 +16,11 @@ const visitPositionedTracks = (
14
16
  visitor,
15
17
  inclCombinedTracks = true,
16
18
  ) => {
17
- /** @type {import('../types').TrackConfig[]} */
19
+ /** @type {Array<TrackConfig>} */
18
20
  const allTracks = [];
19
21
 
20
22
  for (const [stringPosition, tracks] of Object.entries(positionedTracks)) {
21
- /** @type {import('../types').TrackPosition} */
23
+ /** @type {TrackPosition} */
22
24
  // @ts-expect-error - Typings for Object#entries don't have strong inference,
23
25
  // might change in the future.
24
26
  const position = stringPosition;
@@ -24,7 +24,6 @@
24
24
 
25
25
  -webkit-touch-callout: none; /* iOS Safari */
26
26
  -webkit-user-select: none; /* Chrome/Safari/Opera */
27
- -khtml-user-select: none; /* Konqueror */
28
27
  -moz-user-select: none; /* Firefox */
29
28
  -ms-user-select: none; /* Internet Explorer/Edge */
30
29
  user-select: none;
@@ -45,6 +45,7 @@ pre[class*="language-"] {
45
45
  }
46
46
 
47
47
  :not(pre) > code[class*="language-"],
48
+ /* biome-ignore lint/suspicious/noEmptyBlock: vendored */
48
49
  pre[class*="language-"] {
49
50
  }
50
51