higlass 1.11.10 → 1.12.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 (113) hide show
  1. package/README.md +19 -10
  2. package/app/scripts/{AddTrackDialog.js → AddTrackDialog.jsx} +27 -26
  3. package/app/scripts/{AddTrackPositionMenu.js → AddTrackPositionMenu.jsx} +18 -15
  4. package/app/scripts/{Autocomplete.js → Autocomplete.jsx} +1 -0
  5. package/app/scripts/{Button.js → Button.jsx} +7 -6
  6. package/app/scripts/CenterTiledPlot.jsx +7 -0
  7. package/app/scripts/{CenterTrack.js → CenterTrack.jsx} +42 -41
  8. package/app/scripts/ChromosomeGrid.js +8 -16
  9. package/app/scripts/CloseTrackMenu.jsx +27 -0
  10. package/app/scripts/CombinedTrack.js +16 -1
  11. package/app/scripts/{ConfigTrackMenu.js → ConfigTrackMenu.jsx} +12 -12
  12. package/app/scripts/{ConfigViewMenu.js → ConfigViewMenu.jsx} +35 -36
  13. package/app/scripts/{ConfigureSeriesMenu.js → ConfigureSeriesMenu.jsx} +2 -2
  14. package/app/scripts/{ContextMenuContainer.js → ContextMenuContainer.jsx} +5 -7
  15. package/app/scripts/ContextMenuItem.jsx +37 -0
  16. package/app/scripts/Cross.jsx +9 -0
  17. package/app/scripts/CustomTrackDialog.jsx +38 -0
  18. package/app/scripts/DataFetcher.js +6 -6
  19. package/app/scripts/{Dialog.js → Dialog.jsx} +40 -31
  20. package/app/scripts/{DragListeningDiv.js → DragListeningDiv.jsx} +10 -12
  21. package/app/scripts/{DraggableDiv.js → DraggableDiv.jsx} +25 -24
  22. package/app/scripts/{ExportLinkDialog.js → ExportLinkDialog.jsx} +2 -2
  23. package/app/scripts/{FixedTrack.js → FixedTrack.jsx} +0 -0
  24. package/app/scripts/{GalleryTracks.js → GalleryTracks.jsx} +10 -9
  25. package/app/scripts/{GenomePositionSearchBox.js → GenomePositionSearchBox.jsx} +14 -16
  26. package/app/scripts/{HeatmapOptions.js → HeatmapOptions.jsx} +0 -0
  27. package/app/scripts/HeatmapTiledPixiTrack.js +18 -30
  28. package/app/scripts/{HiGlassComponent.js → HiGlassComponent.jsx} +206 -85
  29. package/app/scripts/{HiGlassTrackComponent.js → HiGlassTrackComponent.jsx} +0 -0
  30. package/app/scripts/HorizontalChromosomeLabels.js +3 -6
  31. package/app/scripts/HorizontalHeatmapTrack.js +2 -6
  32. package/app/scripts/{HorizontalItem.js → HorizontalItem.jsx} +0 -0
  33. package/app/scripts/HorizontalRule.js +2 -0
  34. package/app/scripts/{HorizontalTiledPlot.js → HorizontalTiledPlot.jsx} +20 -19
  35. package/app/scripts/{HorizontalTrack.js → HorizontalTrack.jsx} +0 -0
  36. package/app/scripts/LeftTrackModifier.js +8 -0
  37. package/app/scripts/{ListWrapper.js → ListWrapper.jsx} +0 -0
  38. package/app/scripts/{Modal.js → Modal.jsx} +14 -9
  39. package/app/scripts/{MoveableTrack.js → MoveableTrack.jsx} +0 -0
  40. package/app/scripts/{NestedContextMenu.js → NestedContextMenu.jsx} +6 -7
  41. package/app/scripts/OSMTilesTrack.js +2 -6
  42. package/app/scripts/OverlayTrack.js +2 -0
  43. package/app/scripts/{PlotTypeChooser.js → PlotTypeChooser.jsx} +0 -0
  44. package/app/scripts/{PopupMenu.js → PopupMenu.jsx} +1 -1
  45. package/app/scripts/SearchField.js +5 -3
  46. package/app/scripts/{SeriesListItems.js → SeriesListItems.jsx} +6 -6
  47. package/app/scripts/{SeriesListMenu.js → SeriesListMenu.jsx} +29 -32
  48. package/app/scripts/{SeriesListSubmenuMixin.js → SeriesListSubmenuMixin.jsx} +0 -0
  49. package/app/scripts/{SketchInlinePicker.js → SketchInlinePicker.jsx} +0 -0
  50. package/app/scripts/{SortableList.js → SortableList.jsx} +0 -0
  51. package/app/scripts/Tiled1DPixiTrack.js +2 -5
  52. package/app/scripts/TiledPixiTrack.js +3 -1
  53. package/app/scripts/{TiledPlot.js → TiledPlot.jsx} +45 -17
  54. package/app/scripts/{TilesetFinder.js → TilesetFinder.jsx} +7 -7
  55. package/app/scripts/Track.js +17 -1
  56. package/app/scripts/{TrackArea.js → TrackArea.jsx} +0 -0
  57. package/app/scripts/{TrackControl.js → TrackControl.jsx} +44 -50
  58. package/app/scripts/{TrackRenderer.js → TrackRenderer.jsx} +44 -38
  59. package/app/scripts/{VerticalItem.js → VerticalItem.jsx} +0 -0
  60. package/app/scripts/VerticalRule.js +1 -0
  61. package/app/scripts/{VerticalTiledPlot.js → VerticalTiledPlot.jsx} +27 -18
  62. package/app/scripts/{VerticalTrack.js → VerticalTrack.jsx} +0 -0
  63. package/app/scripts/{ViewConfigEditor.js → ViewConfigEditor.jsx} +66 -58
  64. package/app/scripts/{ViewContextMenu.js → ViewContextMenu.jsx} +13 -13
  65. package/app/scripts/{ViewHeader.js → ViewHeader.jsx} +24 -23
  66. package/app/scripts/ViewportTracker2D.js +1 -2
  67. package/app/scripts/ViewportTrackerHorizontal.js +1 -2
  68. package/app/scripts/ViewportTrackerVertical.js +1 -2
  69. package/app/scripts/api.js +17 -10
  70. package/app/scripts/configs/available-for-plugins.js +4 -3
  71. package/app/scripts/configs/index.js +1 -47
  72. package/app/scripts/configs/positions-by-datatype.js +2 -0
  73. package/app/scripts/configs/primitives.js +47 -0
  74. package/app/scripts/configs/tracks-info.js +2 -2
  75. package/app/scripts/d3-context-menu.js +1 -0
  76. package/app/scripts/data-fetchers/get-data-fetcher.js +7 -2
  77. package/app/scripts/{hglib.js → hglib.jsx} +1 -1
  78. package/app/scripts/hocs/{with-modal.js → with-modal.jsx} +0 -0
  79. package/app/scripts/hocs/{with-pub-sub.js → with-pub-sub.jsx} +0 -0
  80. package/app/scripts/hocs/{with-theme.js → with-theme.jsx} +0 -0
  81. package/app/scripts/{icons.js → icons.jsx} +22 -12
  82. package/app/scripts/mixwith.js +2 -0
  83. package/app/scripts/services/tile-proxy.js +1 -5
  84. package/app/scripts/utils/abs-to-chr.js +1 -1
  85. package/app/scripts/utils/dec-to-hex-str.js +1 -1
  86. package/app/scripts/utils/dict-items.js +0 -1
  87. package/app/scripts/utils/dict-keys.js +0 -1
  88. package/app/scripts/utils/dict-values.js +0 -1
  89. package/app/scripts/utils/index.js +1 -0
  90. package/app/scripts/utils/range-query-2d.js +4 -1
  91. package/app/scripts/utils/selected-items-to-size.js +2 -3
  92. package/app/scripts/utils/{test-helpers.js → test-helpers.jsx} +32 -10
  93. package/app/scripts/utils/timeout.js +4 -1
  94. package/app/scripts/utils/value-to-color.js +14 -17
  95. package/app/scripts/worker.js +8 -4
  96. package/app/styles/GenomePositionSearchBox.module.scss +13 -15
  97. package/app/styles/HiGlass.scss +5 -5
  98. package/app/styles/TilesetFinder.css +94 -74
  99. package/app/styles/TrackControl.module.scss +17 -20
  100. package/app/styles/TrackOptions.css +23 -24
  101. package/app/styles/ViewHeader.module.scss +18 -18
  102. package/dist/hglib.css +1724 -0
  103. package/dist/hglib.js +83032 -0
  104. package/dist/hglib.min.js +382 -0
  105. package/dist/index.html +251 -250
  106. package/package.json +57 -117
  107. package/CHANGELOG.md +0 -1411
  108. package/app/index.html +0 -273
  109. package/app/scripts/CenterTiledPlot.js +0 -5
  110. package/app/scripts/CloseTrackMenu.js +0 -25
  111. package/app/scripts/ContextMenuItem.js +0 -35
  112. package/app/scripts/Cross.js +0 -7
  113. package/app/scripts/factories/index.js +0 -1
@@ -4,6 +4,7 @@ import Editor from 'react-simple-code-editor';
4
4
  import { highlight, languages } from 'prismjs/components/prism-core';
5
5
  import 'prismjs/components/prism-json';
6
6
  import Ajv from 'ajv';
7
+ import clsx from 'clsx';
7
8
 
8
9
  import schema from '../schema.json';
9
10
  import Button from './Button';
@@ -12,7 +13,7 @@ import withModal from './hocs/with-modal';
12
13
  import withPubSub from './hocs/with-pub-sub';
13
14
  import { timeout } from './utils';
14
15
 
15
- import '../styles/ViewConfigEditor.module.scss';
16
+ import classes from '../styles/ViewConfigEditor.module.scss';
16
17
 
17
18
  class ViewConfigEditor extends React.Component {
18
19
  constructor(props) {
@@ -48,7 +49,10 @@ class ViewConfigEditor extends React.Component {
48
49
  this.editor._input.focus();
49
50
  this.editor._input.setSelectionRange(0, 0);
50
51
  await timeout(0);
51
- this.editorWrap.scrollTop = 0;
52
+
53
+ if (this.editorWrap) {
54
+ this.editorWrap.scrollTop = 0;
55
+ }
52
56
  }
53
57
  }
54
58
 
@@ -149,7 +153,9 @@ class ViewConfigEditor extends React.Component {
149
153
  const key = `${i}-${d.msg}`;
150
154
  return (
151
155
  <tr key={key}>
152
- <td styleName={`title ${d.type}`}>{`[${i}] ${d.type}`}</td>
156
+ <td
157
+ className={clsx(classes.title, classes[d.type])}
158
+ >{`[${i}] ${d.type}`}</td>
153
159
  <td>
154
160
  <pre>{d.msg}</pre>
155
161
  </td>
@@ -169,69 +175,71 @@ class ViewConfigEditor extends React.Component {
169
175
  onOkay={this.handleSubmitBound}
170
176
  title="Edit View Config"
171
177
  >
172
- <header styleName="view-config-editor-header">
173
- <Button
174
- onBlur={this.showBound}
175
- onMouseDown={this.hideBound}
176
- onMouseOut={this.showBound}
177
- onMouseUp={this.showBound}
178
- >
179
- Hide While Mousedown
180
- </Button>
181
- <Button
182
- onClick={() => {
183
- this.props.onChange(this.state.code);
184
- }}
185
- shortcut="⌘+S"
186
- >
187
- Save
188
- </Button>
189
- </header>
190
- <div
191
- ref={(c) => {
192
- this.editorWrap = c;
193
- }}
194
- styleName="view-config-editor"
195
- >
196
- <Editor
178
+ <>
179
+ <header className={classes['view-config-editor-header']}>
180
+ <Button
181
+ onBlur={this.showBound}
182
+ onMouseDown={this.hideBound}
183
+ onMouseOut={this.showBound}
184
+ onMouseUp={this.showBound}
185
+ >
186
+ Hide While Mousedown
187
+ </Button>
188
+ <Button
189
+ onClick={() => {
190
+ this.props.onChange(this.state.code);
191
+ }}
192
+ shortcut="⌘+S"
193
+ >
194
+ Save
195
+ </Button>
196
+ </header>
197
+ <div
197
198
  ref={(c) => {
198
- this.editor = c;
199
- }}
200
- highlight={(code) => highlight(code, languages.json)}
201
- onValueChange={this.handleChangeBound}
202
- padding={10}
203
- style={{
204
- fontFamily: '"Fira code", "Fira Mono", monospace',
205
- fontSize: 'inherit',
199
+ this.editorWrap = c;
206
200
  }}
207
- value={this.state.code}
208
- />
209
- </div>
210
- <div
211
- style={{
212
- height: this.state.showLog ? '50%' : '30px',
213
- }}
214
- styleName="view-config-log"
215
- >
216
- <div
217
- onClick={() => this.toggleLogBound()}
218
- styleName="view-config-log-header"
201
+ className={classes['view-config-editor']}
219
202
  >
220
- {`Log Messages (${
221
- this.state.logMsgs.filter((d) => d.type !== 'Success').length
222
- })`}
203
+ <Editor
204
+ ref={(c) => {
205
+ this.editor = c;
206
+ }}
207
+ highlight={(code) => highlight(code, languages.json)}
208
+ onValueChange={this.handleChangeBound}
209
+ padding={10}
210
+ style={{
211
+ fontFamily: '"Fira code", "Fira Mono", monospace',
212
+ fontSize: 'inherit',
213
+ }}
214
+ value={this.state.code}
215
+ />
223
216
  </div>
224
217
  <div
218
+ className={classes['view-config-log']}
225
219
  style={{
226
- padding: this.state.showLog ? '10px' : 0,
220
+ height: this.state.showLog ? '50%' : '30px',
227
221
  }}
228
- styleName="view-config-log-msg"
229
222
  >
230
- <table>
231
- <tbody>{logMessages}</tbody>
232
- </table>
223
+ <div
224
+ className={classes['view-config-log-header']}
225
+ onClick={() => this.toggleLogBound()}
226
+ >
227
+ {`Log Messages (${
228
+ this.state.logMsgs.filter((d) => d.type !== 'Success').length
229
+ })`}
230
+ </div>
231
+ <div
232
+ className={classes['view-config-log-msg']}
233
+ style={{
234
+ padding: this.state.showLog ? '10px' : 0,
235
+ }}
236
+ >
237
+ <table>
238
+ <tbody>{logMessages}</tbody>
239
+ </table>
240
+ </div>
233
241
  </div>
234
- </div>
242
+ </>
235
243
  </Dialog>
236
244
  );
237
245
  }
@@ -243,7 +251,7 @@ ViewConfigEditor.propTypes = {
243
251
  onChange: PropTypes.func.isRequired,
244
252
  onSave: PropTypes.func.isRequired,
245
253
  pubSub: PropTypes.object.isRequired,
246
- viewConfig: PropTypes.object.isRequired,
254
+ viewConfig: PropTypes.string.isRequired,
247
255
  };
248
256
 
249
257
  export default withPubSub(withModal(ViewConfigEditor));
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import clsx from 'clsx';
3
4
  import { mix } from './mixwith';
4
5
 
5
6
  import { expandCombinedTracks } from './utils';
@@ -12,7 +13,7 @@ import SeriesListSubmenuMixin from './SeriesListSubmenuMixin';
12
13
  import { THEME_DARK } from './configs';
13
14
 
14
15
  // Styles
15
- import '../styles/ContextMenu.module.scss';
16
+ import classes from '../styles/ContextMenu.module.scss';
16
17
 
17
18
  class ViewContextMenu extends mix(ContextMenuContainer).with(
18
19
  SeriesListSubmenuMixin,
@@ -34,28 +35,27 @@ class ViewContextMenu extends mix(ContextMenuContainer).with(
34
35
  )
35
36
  : null;
36
37
 
37
- let styleNames = 'context-menu';
38
- if (this.props.theme === THEME_DARK) styleNames += ' context-menu-dark';
39
-
40
38
  return (
41
39
  <div
42
40
  ref={(c) => {
43
41
  this.div = c;
44
42
  }}
43
+ className={clsx(classes['context-menu'], {
44
+ [classes['context-menu-dark']]: this.props.theme === THEME_DARK,
45
+ })}
45
46
  data-menu-type="ViewContextMenu"
46
47
  style={{
47
48
  left: this.state.left,
48
49
  top: this.state.top,
49
50
  }}
50
- styleName={styleNames}
51
51
  >
52
52
  {customItemsWrapped}
53
53
 
54
- {customItemsWrapped && <hr styleName="context-menu-hr" />}
54
+ {customItemsWrapped && <hr className={classes['context-menu-hr']} />}
55
55
 
56
56
  {seriesItems}
57
57
 
58
- {seriesItems && <hr styleName="context-menu-hr" />}
58
+ {seriesItems && <hr className={classes['context-menu-hr']} />}
59
59
 
60
60
  <ContextMenuItem
61
61
  onClick={() =>
@@ -67,7 +67,7 @@ class ViewContextMenu extends mix(ContextMenuContainer).with(
67
67
  }
68
68
  onMouseEnter={(e) => this.handleOtherMouseEnter(e)}
69
69
  >
70
- {'Add Horizontal Rule'}
70
+ Add Horizontal Rule
71
71
  </ContextMenuItem>
72
72
 
73
73
  <ContextMenuItem
@@ -80,7 +80,7 @@ class ViewContextMenu extends mix(ContextMenuContainer).with(
80
80
  }
81
81
  onMouseEnter={(e) => this.handleOtherMouseEnter(e)}
82
82
  >
83
- {'Add Vertical Rule'}
83
+ Add Vertical Rule
84
84
  </ContextMenuItem>
85
85
 
86
86
  <ContextMenuItem
@@ -94,17 +94,17 @@ class ViewContextMenu extends mix(ContextMenuContainer).with(
94
94
  }
95
95
  onMouseEnter={(e) => this.handleOtherMouseEnter(e)}
96
96
  >
97
- {'Add Cross Rule'}
97
+ Add Cross Rule
98
98
  </ContextMenuItem>
99
99
 
100
- <hr styleName="context-menu-hr" />
100
+ <hr className={classes['context-menu-hr']} />
101
101
 
102
102
  {this.hasMatrixTrack(this.props.tracks) && (
103
103
  <ContextMenuItem
104
104
  onClick={this.handleAddHorizontalSection.bind(this)}
105
105
  onMouseEnter={(e) => this.handleOtherMouseEnter(e)}
106
106
  >
107
- {'Add Horizontal Cross Section'}
107
+ Add Horizontal Cross Section
108
108
  </ContextMenuItem>
109
109
  )}
110
110
  {this.hasMatrixTrack(this.props.tracks) && (
@@ -112,7 +112,7 @@ class ViewContextMenu extends mix(ContextMenuContainer).with(
112
112
  onClick={this.handleAddVerticalSection.bind(this)}
113
113
  onMouseEnter={(e) => this.handleOtherMouseEnter(e)}
114
114
  >
115
- {'Add Vertical Cross Section'}
115
+ Add Vertical Cross Section
116
116
  </ContextMenuItem>
117
117
  )}
118
118
 
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import clsx from 'clsx';
3
4
 
4
5
  import PopupMenu from './PopupMenu';
5
6
  import ContextMenuContainer from './ContextMenuContainer';
@@ -18,7 +19,7 @@ import {
18
19
  } from './configs';
19
20
 
20
21
  // Styles
21
- import '../styles/ViewHeader.module.scss';
22
+ import classes from '../styles/ViewHeader.module.scss';
22
23
 
23
24
  class ViewHeader extends React.Component {
24
25
  constructor(props) {
@@ -36,9 +37,8 @@ class ViewHeader extends React.Component {
36
37
  width: -1,
37
38
  };
38
39
 
39
- this.handleTrackPositionChosenBound = this.handleTrackPositionChosen.bind(
40
- this,
41
- );
40
+ this.handleTrackPositionChosenBound =
41
+ this.handleTrackPositionChosen.bind(this);
42
42
  }
43
43
 
44
44
  componentDidMount() {
@@ -217,37 +217,38 @@ class ViewHeader extends React.Component {
217
217
  },
218
218
  );
219
219
 
220
- let className = this.state.isFocused
221
- ? 'multitrack-header-focus'
222
- : 'multitrack-header';
220
+ const className = clsx(
221
+ this.state.isFocused
222
+ ? classes['multitrack-header-focus']
223
+ : classes['multitrack-header'],
224
+ {
225
+ [classes['multitrack-header-dark']]: this.props.theme === THEME_DARK,
226
+ },
227
+ );
223
228
 
224
229
  const classNameIcon =
225
230
  this.state.width <= VIEW_HEADER_MED_WIDTH_SEARCH_BAR
226
- ? 'multitrack-header-icon-squeazed'
227
- : 'multitrack-header-icon';
228
-
229
- if (this.props.theme === THEME_DARK) {
230
- className += ' multitrack-header-dark';
231
- }
231
+ ? classes['multitrack-header-icon-squeazed']
232
+ : classes['multitrack-header-icon'];
232
233
 
233
234
  return (
234
235
  <div
235
236
  ref={(c) => {
236
237
  this.el = c;
237
238
  }}
238
- styleName={className}
239
+ className={className}
239
240
  >
240
- <div styleName="multitrack-header-left">
241
+ <div className={classes['multitrack-header-left']}>
241
242
  {this.props.mouseTool === MOUSE_TOOL_SELECT && (
242
243
  <svg
243
- styleName={`mouse-tool-selection ${classNameIcon}`}
244
+ className={clsx(classes['mouse-tool-selection'], classNameIcon)}
244
245
  title="Selection tool active"
245
246
  >
246
247
  <use xlinkHref="#select" />
247
248
  </svg>
248
249
  )}
249
250
  <div
250
- styleName="multitrack-header-grabber"
251
+ className={classes['multitrack-header-grabber']}
251
252
  title="Drag to move the view"
252
253
  >
253
254
  <div />
@@ -255,14 +256,14 @@ class ViewHeader extends React.Component {
255
256
  <div />
256
257
  </div>
257
258
  {this.state.width > VIEW_HEADER_MIN_WIDTH_SEARCH_BAR && (
258
- <div styleName="multitrack-header-search">
259
+ <div className={classes['multitrack-header-search']}>
259
260
  {this.props.isGenomePositionSearchBoxVisible &&
260
261
  GenomePositionSearchBox}
261
262
  </div>
262
263
  )}
263
264
  </div>
264
- <nav styleName="multitrack-header-nav-list">
265
- <svg onClick={this.props.onAddView} styleName={classNameIcon}>
265
+ <nav className={classes['multitrack-header-nav-list']}>
266
+ <svg className={classNameIcon} onClick={this.props.onAddView}>
266
267
  <title>Add new view (clone this view)</title>
267
268
  <use xlinkHref="#copy" />
268
269
  </svg>
@@ -271,8 +272,8 @@ class ViewHeader extends React.Component {
271
272
  ref={(c) => {
272
273
  this.configImg = c;
273
274
  }}
275
+ className={classNameIcon}
274
276
  onClick={() => this.handleConfigMenuOpened(this.props.viewUid)}
275
- styleName={classNameIcon}
276
277
  >
277
278
  <title>Configure this view</title>
278
279
  <use xlinkHref="#cog" />
@@ -282,16 +283,16 @@ class ViewHeader extends React.Component {
282
283
  ref={(c) => {
283
284
  this.plusImg = c;
284
285
  }}
286
+ className={classNameIcon}
285
287
  onClick={() =>
286
288
  this.handleAddTrackPositionMenuOpened(this.props.viewUid)
287
289
  }
288
- styleName={classNameIcon}
289
290
  >
290
291
  <title>Add Track</title>
291
292
  <use xlinkHref="#plus" />
292
293
  </svg>
293
294
 
294
- <svg onClick={this.props.onCloseView} styleName={classNameIcon}>
295
+ <svg className={classNameIcon} onClick={this.props.onCloseView}>
295
296
  <title>Close View</title>
296
297
  <use xlinkHref="#cross" />
297
298
  </svg>
@@ -1,6 +1,5 @@
1
1
  import slugid from 'slugid';
2
2
  import { brush } from 'd3-brush';
3
- import { event } from 'd3-selection';
4
3
 
5
4
  import SVGTrack from './SVGTrack';
6
5
 
@@ -62,7 +61,7 @@ class ViewportTracker2D extends SVGTrack {
62
61
  this.draw();
63
62
  }
64
63
 
65
- brushed() {
64
+ brushed(event) {
66
65
  /**
67
66
  * Should only be called on active brushing, not in response to the
68
67
  * draw event
@@ -1,5 +1,4 @@
1
1
  import { brushX } from 'd3-brush';
2
- import { event } from 'd3-selection';
3
2
  import slugid from 'slugid';
4
3
 
5
4
  import SVGTrack from './SVGTrack';
@@ -58,7 +57,7 @@ class ViewportTrackerHorizontal extends SVGTrack {
58
57
  this.draw();
59
58
  }
60
59
 
61
- brushed() {
60
+ brushed(event) {
62
61
  /**
63
62
  * Should only be called on active brushing, not in response to the
64
63
  * draw event
@@ -1,5 +1,4 @@
1
1
  import { brushY } from 'd3-brush';
2
- import { event } from 'd3-selection';
3
2
  import slugid from 'slugid';
4
3
 
5
4
  import SVGTrack from './SVGTrack';
@@ -57,7 +56,7 @@ class ViewportTrackerVertical extends SVGTrack {
57
56
  this.draw();
58
57
  }
59
58
 
60
- brushed() {
59
+ brushed(event) {
61
60
  /**
62
61
  * Should only be called on active brushing, not in response to the
63
62
  * draw event
@@ -10,6 +10,8 @@ import { getTrackObjectFromHGC } from './utils';
10
10
 
11
11
  import { MOUSE_TOOL_MOVE, MOUSE_TOOL_SELECT } from './configs';
12
12
 
13
+ import { version } from '../../package.json';
14
+
13
15
  const forceUpdate = (self) => {
14
16
  self.setState(self.state);
15
17
  };
@@ -41,10 +43,7 @@ const createApi = function api(context, pubSub) {
41
43
  * @return {string} Version number
42
44
  */
43
45
  get version() {
44
- // Note, `VERSION` is exposed by webpack across the entire app. I.e.,
45
- // it's globally available within the build but not outside. See
46
- // `plugins` in `webpack.config.js`
47
- return VERSION;
46
+ return version;
48
47
  },
49
48
 
50
49
  /**
@@ -735,6 +734,7 @@ const createApi = function api(context, pubSub) {
735
734
  * hgv.off('mouseMoveZoom', mmz);
736
735
  * hgv.off('wheel', wheelListener);
737
736
  * hgv.off('createSVG');
737
+ * hgv.off('click');
738
738
  * hgv.off('geneSearch', geneSearchListener);
739
739
  */
740
740
  off(event, listenerId, viewId) {
@@ -797,15 +797,22 @@ const createApi = function api(context, pubSub) {
797
797
  *
798
798
  * **Event types**
799
799
  *
800
- * ``click``: Returns clicked objects. (Currently only clicks on 1D annotations are captured.)
800
+ * ``click``: Returns a list of objects for each track that is below the click event.
801
801
  *
802
802
  * .. code-block:: javascript
803
803
  *
804
- * {
805
- * type: 'annotation',
806
- * event: { ... },
807
- * payload: [230000000, 561000000]
808
- * }
804
+ * [
805
+ * {
806
+ * event: {
807
+ * type: 'annotation',
808
+ * event: { ... },
809
+ * payload: [230000000, 561000000]
810
+ * },
811
+ * trackType: '1d-annotation',
812
+ * trackUid: 'xyz',
813
+ * viewUid: 'abc'
814
+ * }
815
+ * ]
809
816
  *
810
817
  * ``cursorLocation:`` Returns an object describing the location under the cursor
811
818
  *
@@ -82,7 +82,7 @@ import ViewportTrackerVertical from '../ViewportTrackerVertical';
82
82
  // Factories
83
83
  import ContextMenuItem from '../ContextMenuItem';
84
84
  import DataFetcher from '../DataFetcher';
85
- import LruCache from '../factories';
85
+ import LruCache from '../factories/LruCache';
86
86
 
87
87
  // Services
88
88
  import * as services from '../services';
@@ -96,6 +96,8 @@ import GBKDataFetcher from '../data-fetchers/genbank-fetcher';
96
96
  import LocalDataFetcher from '../data-fetchers/local-tile-fetcher';
97
97
  import getDataFetcher from '../data-fetchers/get-data-fetcher';
98
98
 
99
+ import { version } from '../../../package.json';
100
+
99
101
  const libraries = {
100
102
  d3Array,
101
103
  d3Axis,
@@ -196,6 +198,5 @@ export default {
196
198
  services,
197
199
  utils,
198
200
  configs,
199
- // Defined globally by webpack.
200
- VERSION,
201
+ VERSION: version,
201
202
  };
@@ -1,52 +1,6 @@
1
1
  /* ------------------------------- Primitives ------------------------------- */
2
2
 
3
- export const DEFAULT_VIEW_MARGIN = 0;
4
-
5
- export const DEFAULT_VIEW_PADDING = 5;
6
-
7
- export const DEFAULT_CONTAINER_PADDING_X = 10;
8
-
9
- export const DEFAULT_CONTAINER_PADDING_Y = 10;
10
-
11
- export const MAX_CLICK_DELAY = 300;
12
-
13
- export const MOUSE_TOOL_MOVE = 'move';
14
-
15
- export const MOUSE_TOOL_SELECT = 'select';
16
-
17
- export const TILE_FETCH_DEBOUNCE = 100;
18
-
19
- // Number of milliseconds zoom-related actions (e.g., tile loading) are debounced
20
- export const ZOOM_DEBOUNCE = 10;
21
-
22
- // the length of time to keep refreshing the view after a drag event
23
- export const SHORT_DRAG_TIMEOUT = 110;
24
-
25
- export const LONG_DRAG_TIMEOUT = 3000;
26
-
27
- export const LOCATION_LISTENER_PREFIX = 'locationListenerPrefix';
28
-
29
- export const ZOOM_TRANSITION_DURATION = 1000;
30
-
31
- export const DEFAULT_SERVER = 'http://higlass.io/api/v1';
32
-
33
- export const VIEW_HEADER_MED_WIDTH_SEARCH_BAR = 400;
34
-
35
- export const VIEW_HEADER_MIN_WIDTH_SEARCH_BAR = 300;
36
-
37
- export const TRACK_LOCATIONS = [
38
- 'top',
39
- 'left',
40
- 'right',
41
- 'bottom',
42
- 'center',
43
- 'whole',
44
- 'gallery',
45
- ];
46
-
47
- export const MIN_HORIZONTAL_HEIGHT = 20;
48
-
49
- export const MIN_VERTICAL_WIDTH = 20;
3
+ export * from './primitives';
50
4
 
51
5
  /* --------------------------------- Themes -------------------------------- */
52
6
 
@@ -2,6 +2,8 @@ import { TRACKS_INFO } from '.';
2
2
 
3
3
  export const POSITIONS_BY_DATATYPE = TRACKS_INFO.reduce(
4
4
  (positionsByDatatype, track) => {
5
+ // TODO: Found by eslint. This loop never iterates?
6
+ /* eslint-disable-next-line no-unreachable-loop */
5
7
  for (let i = 0; i < track.datatype.length; i++) {
6
8
  const datatype = track.datatype[i];
7
9
 
@@ -0,0 +1,47 @@
1
+ export const DEFAULT_VIEW_MARGIN = 0;
2
+
3
+ export const DEFAULT_VIEW_PADDING = 5;
4
+
5
+ export const DEFAULT_CONTAINER_PADDING_X = 10;
6
+
7
+ export const DEFAULT_CONTAINER_PADDING_Y = 10;
8
+
9
+ export const MAX_CLICK_DELAY = 300;
10
+
11
+ export const MOUSE_TOOL_MOVE = 'move';
12
+
13
+ export const MOUSE_TOOL_SELECT = 'select';
14
+
15
+ export const TILE_FETCH_DEBOUNCE = 100;
16
+
17
+ // Number of milliseconds zoom-related actions (e.g., tile loading) are debounced
18
+ export const ZOOM_DEBOUNCE = 10;
19
+
20
+ // the length of time to keep refreshing the view after a drag event
21
+ export const SHORT_DRAG_TIMEOUT = 110;
22
+
23
+ export const LONG_DRAG_TIMEOUT = 3000;
24
+
25
+ export const LOCATION_LISTENER_PREFIX = 'locationListenerPrefix';
26
+
27
+ export const ZOOM_TRANSITION_DURATION = 1000;
28
+
29
+ export const DEFAULT_SERVER = 'http://higlass.io/api/v1';
30
+
31
+ export const VIEW_HEADER_MED_WIDTH_SEARCH_BAR = 400;
32
+
33
+ export const VIEW_HEADER_MIN_WIDTH_SEARCH_BAR = 300;
34
+
35
+ export const TRACK_LOCATIONS = [
36
+ 'top',
37
+ 'left',
38
+ 'right',
39
+ 'bottom',
40
+ 'center',
41
+ 'whole',
42
+ 'gallery',
43
+ ];
44
+
45
+ export const MIN_HORIZONTAL_HEIGHT = 20;
46
+
47
+ export const MIN_VERTICAL_WIDTH = 20;
@@ -74,9 +74,9 @@ const mapbox = {
74
74
 
75
75
  export const TRACKS_INFO = [
76
76
  osm,
77
- Object.assign({}, osm, { type: 'osm' }),
77
+ { ...osm, type: 'osm' },
78
78
  mapbox,
79
- Object.assign({}, mapbox, { type: 'mapbox' }),
79
+ { ...mapbox, type: 'mapbox' },
80
80
  {
81
81
  type: 'left-axis',
82
82
  datatype: ['axis'],
@@ -71,6 +71,7 @@ function contextMenu(menu, optsIn) {
71
71
  return function onContextMenu(
72
72
  data,
73
73
  index,
74
+ /* eslint-disable-next-line default-param-last */
74
75
  pMouseUp = false,
75
76
  clickAwayFunc,
76
77
  useMouse = false,