@jbrowse/plugin-linear-genome-view 1.5.1 → 1.5.5

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.
@@ -15,7 +15,7 @@ import Typography from '@material-ui/core/Typography';
15
15
  import MenuOpenIcon from '@material-ui/icons/MenuOpen';
16
16
  import { autorun, when, transaction } from 'mobx';
17
17
  import { getParent, types, cast, isAlive, addDisposer, getEnv, resolveIdentifier, getRoot, getSnapshot } from 'mobx-state-tree';
18
- import { useTheme, makeStyles as makeStyles$1, alpha, Portal, Popover, Typography as Typography$1, Tooltip as Tooltip$1, TextField, Popper, CircularProgress, InputAdornment, Dialog, DialogTitle, IconButton, DialogContent, FormControlLabel, Checkbox, DialogActions, Button as Button$1, Divider, FormGroup, DialogContentText, TableContainer, Paper as Paper$1, Table, TableHead, TableRow, TableCell, TableBody, Container, Grid } from '@material-ui/core';
18
+ import { useTheme, makeStyles as makeStyles$1, alpha, Portal, Popover, Typography as Typography$1, Tooltip as Tooltip$1, TextField, Popper, CircularProgress, InputAdornment, IconButton, Dialog, DialogTitle, DialogContent, FormControlLabel, Checkbox, DialogActions, Button as Button$1, Divider, FormGroup, Container, Grid, TableContainer, Paper as Paper$1, Table, TableHead, TableRow, TableCell, TableBody } from '@material-ui/core';
19
19
  import { Menu, ResizeHandle } from '@jbrowse/core/ui';
20
20
  import { observer, PropTypes } from 'mobx-react';
21
21
  import { usePopper } from 'react-popper';
@@ -43,6 +43,7 @@ import clsx from 'clsx';
43
43
  import BaseResult, { RefSequenceResult } from '@jbrowse/core/TextSearch/BaseResults';
44
44
  import SearchIcon from '@material-ui/icons/Search';
45
45
  import Autocomplete from '@material-ui/lab/Autocomplete';
46
+ import HelpIcon from '@material-ui/icons/Help';
46
47
  import CloseIcon from '@material-ui/icons/Close';
47
48
  import ArrowForwardIcon from '@material-ui/icons/ArrowForward';
48
49
  import ArrowBackIcon from '@material-ui/icons/ArrowBack';
@@ -57,6 +58,7 @@ import { alpha as alpha$2 } from '@material-ui/core/styles/colorManipulator';
57
58
  import Popover$1 from '@material-ui/core/Popover';
58
59
  import Tooltip$2 from '@material-ui/core/Tooltip';
59
60
  import AssemblySelector from '@jbrowse/core/ui/AssemblySelector';
61
+ import ErrorMessage from '@jbrowse/core/ui/ErrorMessage';
60
62
  import ArrowDown from '@material-ui/icons/KeyboardArrowDown';
61
63
  import Menu$1 from '@jbrowse/core/ui/Menu';
62
64
  import copy from 'copy-to-clipboard';
@@ -68,14 +70,9 @@ function ownKeys(object, enumerableOnly) {
68
70
 
69
71
  if (Object.getOwnPropertySymbols) {
70
72
  var symbols = Object.getOwnPropertySymbols(object);
71
-
72
- if (enumerableOnly) {
73
- symbols = symbols.filter(function (sym) {
74
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
75
- });
76
- }
77
-
78
- keys.push.apply(keys, symbols);
73
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
74
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
75
+ })), keys.push.apply(keys, symbols);
79
76
  }
80
77
 
81
78
  return keys;
@@ -83,19 +80,12 @@ function ownKeys(object, enumerableOnly) {
83
80
 
84
81
  function _objectSpread2(target) {
85
82
  for (var i = 1; i < arguments.length; i++) {
86
- var source = arguments[i] != null ? arguments[i] : {};
87
-
88
- if (i % 2) {
89
- ownKeys(Object(source), true).forEach(function (key) {
90
- _defineProperty(target, key, source[key]);
91
- });
92
- } else if (Object.getOwnPropertyDescriptors) {
93
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
94
- } else {
95
- ownKeys(Object(source)).forEach(function (key) {
96
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
97
- });
98
- }
83
+ var source = null != arguments[i] ? arguments[i] : {};
84
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
85
+ _defineProperty(target, key, source[key]);
86
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
87
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
88
+ });
99
89
  }
100
90
 
101
91
  return target;
@@ -104,17 +94,11 @@ function _objectSpread2(target) {
104
94
  function _typeof(obj) {
105
95
  "@babel/helpers - typeof";
106
96
 
107
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
108
- _typeof = function (obj) {
109
- return typeof obj;
110
- };
111
- } else {
112
- _typeof = function (obj) {
113
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
114
- };
115
- }
116
-
117
- return _typeof(obj);
97
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
98
+ return typeof obj;
99
+ } : function (obj) {
100
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
101
+ }, _typeof(obj);
118
102
  }
119
103
 
120
104
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -172,6 +156,9 @@ function _defineProperties(target, props) {
172
156
  function _createClass(Constructor, protoProps, staticProps) {
173
157
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
174
158
  if (staticProps) _defineProperties(Constructor, staticProps);
159
+ Object.defineProperty(Constructor, "prototype", {
160
+ writable: false
161
+ });
175
162
  return Constructor;
176
163
  }
177
164
 
@@ -195,12 +182,15 @@ function _inherits(subClass, superClass) {
195
182
  throw new TypeError("Super expression must either be null or a function");
196
183
  }
197
184
 
198
- subClass.prototype = Object.create(superClass && superClass.prototype, {
199
- constructor: {
200
- value: subClass,
201
- writable: true,
202
- configurable: true
203
- }
185
+ Object.defineProperty(subClass, "prototype", {
186
+ value: Object.create(superClass && superClass.prototype, {
187
+ constructor: {
188
+ value: subClass,
189
+ writable: true,
190
+ configurable: true
191
+ }
192
+ }),
193
+ writable: false
204
194
  });
205
195
  if (superClass) _setPrototypeOf(subClass, superClass);
206
196
  }
@@ -1354,8 +1344,7 @@ var useStyles$2 = /*#__PURE__*/makeStyles$1(function (theme) {
1354
1344
  fontSize: theme.typography.pxToRem(10),
1355
1345
  lineHeight: "".concat(round(14 / 10), "em"),
1356
1346
  maxWidth: 300,
1357
- wordWrap: 'break-word',
1358
- fontWeight: theme.typography.fontWeightMedium
1347
+ wordWrap: 'break-word'
1359
1348
  }
1360
1349
  };
1361
1350
  });
@@ -2510,7 +2499,9 @@ function mathPower(num) {
2510
2499
  return "".concat(mathPower(~~(num / 1000)), ",").concat("00".concat(~~(num % 1000)).substr(-3, 3));
2511
2500
  }
2512
2501
 
2513
- var useStyles$4 = /*#__PURE__*/makeStyles(function () {
2502
+ var useStyles$4 = /*#__PURE__*/makeStyles(function
2503
+ /* theme */
2504
+ () {
2514
2505
  return {
2515
2506
  majorTickLabel: {
2516
2507
  fontSize: '11px'
@@ -2693,7 +2684,7 @@ function OverviewRubberBand(_ref2) {
2693
2684
 
2694
2685
 
2695
2686
  if (controlsRef.current && startX !== undefined && currentX === undefined) {
2696
- var clickedAt = overview.pxToBp(startX);
2687
+ var clickedAt = overview.pxToBp(startX - cytobandOffset);
2697
2688
  model.centerAt(Math.round(clickedAt.coord), clickedAt.refName, clickedAt.index);
2698
2689
  }
2699
2690
 
@@ -2897,7 +2888,7 @@ var useStyles$6 = /*#__PURE__*/makeStyles$1(function (theme) {
2897
2888
  height: HEADER_OVERVIEW_HEIGHT,
2898
2889
  pointerEvents: 'none',
2899
2890
  zIndex: 100,
2900
- border: '1px solid red'
2891
+ border: '1px solid'
2901
2892
  },
2902
2893
  overview: {
2903
2894
  height: HEADER_BAR_HEIGHT,
@@ -3141,6 +3132,8 @@ var ScaleBar = /*#__PURE__*/observer(function (_ref6) {
3141
3132
  var lastOverviewPx = overview.bpToPx(_objectSpread2(_objectSpread2({}, last), {}, {
3142
3133
  coord: last.reversed ? last.start : last.end
3143
3134
  })) || 0;
3135
+ var color = showCytobands ? '#f00' : scaleBarColor;
3136
+ var transparency = showCytobands ? 0.1 : 0.3;
3144
3137
  return /*#__PURE__*/React.createElement("div", {
3145
3138
  className: classes.scaleBar
3146
3139
  }, /*#__PURE__*/React.createElement("div", {
@@ -3148,7 +3141,8 @@ var ScaleBar = /*#__PURE__*/observer(function (_ref6) {
3148
3141
  style: {
3149
3142
  width: lastOverviewPx - firstOverviewPx,
3150
3143
  left: firstOverviewPx + cytobandOffset,
3151
- background: showCytobands ? undefined : alpha(scaleBarColor, 0.3)
3144
+ background: alpha(color, transparency),
3145
+ borderColor: color
3152
3146
  }
3153
3147
  }), overviewVisibleRegions.map(function (block, idx) {
3154
3148
  return !(block instanceof ContentBlock$1) ? /*#__PURE__*/React.createElement("div", {
@@ -3366,7 +3360,7 @@ var SVGHeader = function SVGHeader(_ref3) {
3366
3360
  block: block
3367
3361
  }), /*#__PURE__*/React.createElement("rect", {
3368
3362
  stroke: "red",
3369
- fill: "none",
3363
+ fill: "rgb(255,0,0,0.1)",
3370
3364
  width: Math.max(lastOverviewPx - firstOverviewPx, 0.5),
3371
3365
  height: HEADER_OVERVIEW_HEIGHT - 1,
3372
3366
  x: firstOverviewPx,
@@ -3541,6 +3535,9 @@ function dedupe() {
3541
3535
  });
3542
3536
  }
3543
3537
 
3538
+ var HelpDialog = /*#__PURE__*/lazy(function () {
3539
+ return Promise.resolve().then(function () { return HelpDialog$2; });
3540
+ }); // the logic of this method is to only apply a filter to RefSequenceResults
3544
3541
  // because they do not have a matchedObject. the trix search results already
3545
3542
  // filter so don't need re-filtering
3546
3543
 
@@ -3572,6 +3569,8 @@ function RefNameAutocomplete(_ref) {
3572
3569
  style = _ref.style,
3573
3570
  fetchResults = _ref.fetchResults,
3574
3571
  value = _ref.value,
3572
+ _ref$minWidth = _ref.minWidth,
3573
+ minWidth = _ref$minWidth === void 0 ? 200 : _ref$minWidth,
3575
3574
  _ref$TextFieldProps = _ref.TextFieldProps,
3576
3575
  TextFieldProps = _ref$TextFieldProps === void 0 ? {} : _ref$TextFieldProps;
3577
3576
  var session = getSession(model);
@@ -3587,20 +3586,25 @@ function RefNameAutocomplete(_ref) {
3587
3586
  loaded = _useState4[0],
3588
3587
  setLoaded = _useState4[1];
3589
3588
 
3590
- var _useState5 = useState(''),
3589
+ var _useState5 = useState(false),
3591
3590
  _useState6 = _slicedToArray(_useState5, 2),
3592
- currentSearch = _useState6[0],
3593
- setCurrentSearch = _useState6[1];
3591
+ isHelpDialogDisplayed = _useState6[0],
3592
+ setHelpDialogDisplayed = _useState6[1];
3594
3593
 
3595
3594
  var _useState7 = useState(''),
3596
3595
  _useState8 = _slicedToArray(_useState7, 2),
3597
- inputValue = _useState8[0],
3598
- setInputValue = _useState8[1];
3596
+ currentSearch = _useState8[0],
3597
+ setCurrentSearch = _useState8[1];
3599
3598
 
3600
- var _useState9 = useState(),
3599
+ var _useState9 = useState(''),
3601
3600
  _useState10 = _slicedToArray(_useState9, 2),
3602
- searchOptions = _useState10[0],
3603
- setSearchOptions = _useState10[1];
3601
+ inputValue = _useState10[0],
3602
+ setInputValue = _useState10[1];
3603
+
3604
+ var _useState11 = useState(),
3605
+ _useState12 = _slicedToArray(_useState11, 2),
3606
+ searchOptions = _useState12[0],
3607
+ setSearchOptions = _useState12[1];
3604
3608
 
3605
3609
  var debouncedSearch = useDebounce(currentSearch, 300);
3606
3610
  var coarseVisibleLocStrings = model.coarseVisibleLocStrings,
@@ -3680,12 +3684,13 @@ function RefNameAutocomplete(_ref) {
3680
3684
  active = false;
3681
3685
  };
3682
3686
  }, [assemblyName, fetchResults, debouncedSearch, session, model]);
3683
- var inputBoxVal = coarseVisibleLocStrings || value || ''; // heuristic, text width + icon width, minimum 200
3687
+ var inputBoxVal = coarseVisibleLocStrings || value || ''; // heuristic, text width + icon width
3688
+ // + 45 accomodates help icon and search icon
3684
3689
 
3685
- var width = Math.min(Math.max(measureText(inputBoxVal, 16) + 25, 200), 550); // notes on implementation:
3690
+ var width = Math.min(Math.max(measureText(inputBoxVal, 16) + 45, minWidth), 550); // notes on implementation:
3686
3691
  // The selectOnFocus setting helps highlight the field when clicked
3687
3692
 
3688
- return /*#__PURE__*/React.createElement(Autocomplete, {
3693
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Autocomplete, {
3689
3694
  id: "refNameAutocomplete-".concat(model.id),
3690
3695
  "data-testid": "autocomplete",
3691
3696
  disableListWrap: true,
@@ -3769,7 +3774,11 @@ function RefNameAutocomplete(_ref) {
3769
3774
  style: {
3770
3775
  marginRight: 7
3771
3776
  }
3772
- }, /*#__PURE__*/React.createElement(SearchIcon, null)), params.InputProps.endAdornment)
3777
+ }, /*#__PURE__*/React.createElement(SearchIcon, null), /*#__PURE__*/React.createElement(IconButton, {
3778
+ onClick: function onClick() {
3779
+ return setHelpDialogDisplayed(true);
3780
+ }
3781
+ }, /*#__PURE__*/React.createElement(HelpIcon, null))), params.InputProps.endAdornment)
3773
3782
  }),
3774
3783
  placeholder: "Search for location",
3775
3784
  onChange: function onChange(e) {
@@ -3792,7 +3801,11 @@ function RefNameAutocomplete(_ref) {
3792
3801
  getOptionLabel: function getOptionLabel(option) {
3793
3802
  return (typeof option === 'string' ? option : option.result.getLabel()) || '';
3794
3803
  }
3795
- });
3804
+ }), isHelpDialogDisplayed ? /*#__PURE__*/React.createElement(HelpDialog, {
3805
+ handleClose: function handleClose() {
3806
+ return setHelpDialogDisplayed(false);
3807
+ }
3808
+ }) : null);
3796
3809
  }
3797
3810
 
3798
3811
  var RefNameAutocomplete$1 = /*#__PURE__*/observer(RefNameAutocomplete);
@@ -5299,158 +5312,10 @@ function TracksContainer(_ref) {
5299
5312
 
5300
5313
  var TracksContainer$1 = /*#__PURE__*/observer(TracksContainer);
5301
5314
 
5302
- var useStyles$i = /*#__PURE__*/makeStyles(function (theme) {
5303
- return {
5304
- dialogContent: {
5305
- width: '80em'
5306
- },
5307
- closeButton: {
5308
- position: 'absolute',
5309
- right: theme.spacing(1),
5310
- top: theme.spacing(1),
5311
- color: theme.palette.grey[500]
5312
- }
5313
- };
5315
+ var SearchResultsDialog = /*#__PURE__*/lazy(function () {
5316
+ return Promise.resolve().then(function () { return SearchResultsDialog$2; });
5314
5317
  });
5315
- function SearchResultsDialog(_ref) {
5316
- var _model$searchResults;
5317
-
5318
- var model = _ref.model,
5319
- optAssemblyName = _ref.optAssemblyName,
5320
- handleClose = _ref.handleClose;
5321
- var classes = useStyles$i();
5322
- var session = getSession(model);
5323
-
5324
- var _getEnv = getEnv(session),
5325
- pluginManager = _getEnv.pluginManager;
5326
-
5327
- var assemblyManager = session.assemblyManager;
5328
- var assemblyName = optAssemblyName;
5329
-
5330
- if (model.displayedRegions.length > 0) {
5331
- var _model$displayedRegio;
5332
-
5333
- assemblyName = (_model$displayedRegio = model.displayedRegions[0]) === null || _model$displayedRegio === void 0 ? void 0 : _model$displayedRegio.assemblyName;
5334
- }
5335
-
5336
- if (!assemblyName) {
5337
- throw new Error("Assembly name not found");
5338
- }
5339
-
5340
- var assembly = assemblyManager.get(assemblyName);
5341
-
5342
- if (!assembly) {
5343
- throw new Error("assembly ".concat(assemblyName, " not found"));
5344
- }
5345
-
5346
- if (!assembly.regions) {
5347
- throw new Error("assembly ".concat(assemblyName, " regions not loaded"));
5348
- }
5349
-
5350
- var assemblyRegions = assembly.regions;
5351
-
5352
- function handleClick(location) {
5353
- try {
5354
- var newRegion = assemblyRegions.find(function (region) {
5355
- return location === region.refName;
5356
- });
5357
-
5358
- if (newRegion) {
5359
- model.setDisplayedRegions([newRegion]); // we use showAllRegions after setDisplayedRegions to make the entire
5360
- // region visible, xref #1703
5361
-
5362
- model.showAllRegions();
5363
- } else {
5364
- model.navToLocString(location, assemblyName);
5365
- }
5366
- } catch (e) {
5367
- console.warn(e);
5368
- session.notify("".concat(e), 'warning');
5369
- }
5370
- }
5371
-
5372
- function getTrackName(trackId) {
5373
- if (trackId) {
5374
- var trackConfigSchema = pluginManager.pluggableConfigSchemaType('track');
5375
- var configuration = resolveIdentifier(trackConfigSchema, getRoot(model), trackId);
5376
-
5377
- if (configuration) {
5378
- var _configuration$name;
5379
-
5380
- return (_configuration$name = configuration.name) === null || _configuration$name === void 0 ? void 0 : _configuration$name.value;
5381
- }
5382
- }
5383
-
5384
- return '';
5385
- }
5386
-
5387
- return /*#__PURE__*/React.createElement(Dialog, {
5388
- open: true,
5389
- maxWidth: "xl",
5390
- onClose: handleClose
5391
- }, /*#__PURE__*/React.createElement(DialogTitle, {
5392
- id: "search-results-dialog"
5393
- }, "Search Results", handleClose ? /*#__PURE__*/React.createElement(IconButton, {
5394
- "data-testid": "close-resultsDialog",
5395
- className: classes.closeButton,
5396
- onClick: function onClick() {
5397
- handleClose();
5398
- }
5399
- }, /*#__PURE__*/React.createElement(CloseIcon, null)) : null), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DialogContent, null, ((_model$searchResults = model.searchResults) === null || _model$searchResults === void 0 ? void 0 : _model$searchResults.length) === 0 || model.searchResults === undefined ? /*#__PURE__*/React.createElement(Typography$1, null, "No results found for ", /*#__PURE__*/React.createElement("b", null, model.searchQuery)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DialogContentText, {
5400
- id: "alert-dialog-slide-description"
5401
- }, "Showing results for ", /*#__PURE__*/React.createElement("b", null, model.searchQuery)), /*#__PURE__*/React.createElement(TableContainer, {
5402
- component: Paper$1
5403
- }, /*#__PURE__*/React.createElement(Table, null, /*#__PURE__*/React.createElement(TableHead, null, /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, null, "Name"), /*#__PURE__*/React.createElement(TableCell, {
5404
- align: "right"
5405
- }, "Location"), /*#__PURE__*/React.createElement(TableCell, {
5406
- align: "right"
5407
- }, "Track"), /*#__PURE__*/React.createElement(TableCell, {
5408
- align: "right"
5409
- }))), /*#__PURE__*/React.createElement(TableBody, null, model.searchResults.map(function (result, index) {
5410
- return /*#__PURE__*/React.createElement(TableRow, {
5411
- key: "".concat(result.getLabel(), "-").concat(index)
5412
- }, /*#__PURE__*/React.createElement(TableCell, {
5413
- component: "th",
5414
- scope: "row"
5415
- }, result.getLabel()), /*#__PURE__*/React.createElement(TableCell, {
5416
- align: "right"
5417
- }, result.getLocation()), /*#__PURE__*/React.createElement(TableCell, {
5418
- align: "right"
5419
- }, getTrackName(result.getTrackId()) || 'N/A'), /*#__PURE__*/React.createElement(TableCell, {
5420
- align: "right"
5421
- }, /*#__PURE__*/React.createElement(Button$1, {
5422
- onClick: function onClick() {
5423
- handleClick(result.getLocation());
5424
- handleClose();
5425
- },
5426
- color: "primary",
5427
- variant: "contained"
5428
- }, "Go to location")), /*#__PURE__*/React.createElement(TableCell, {
5429
- align: "right"
5430
- }, /*#__PURE__*/React.createElement(Button$1, {
5431
- onClick: function onClick() {
5432
- handleClick(result.getLocation());
5433
- var resultTrackId = result.getTrackId();
5434
-
5435
- if (resultTrackId) {
5436
- model.showTrack(resultTrackId);
5437
- }
5438
-
5439
- handleClose();
5440
- },
5441
- disabled: !getTrackName(result.getTrackId()),
5442
- color: "primary",
5443
- variant: "contained"
5444
- }, "Show Track")));
5445
- })))))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button$1, {
5446
- onClick: function onClick() {
5447
- handleClose();
5448
- },
5449
- color: "primary"
5450
- }, "Cancel")));
5451
- }
5452
-
5453
- var useStyles$j = /*#__PURE__*/makeStyles$1(function (theme) {
5318
+ var useStyles$i = /*#__PURE__*/makeStyles$1(function (theme) {
5454
5319
  return {
5455
5320
  importFormContainer: {
5456
5321
  padding: theme.spacing(2)
@@ -5460,18 +5325,11 @@ var useStyles$j = /*#__PURE__*/makeStyles$1(function (theme) {
5460
5325
  }
5461
5326
  };
5462
5327
  });
5463
- var ErrorDisplay = /*#__PURE__*/observer(function (_ref) {
5464
- var error = _ref.error;
5465
- return /*#__PURE__*/React.createElement(Typography$1, {
5466
- variant: "h6",
5467
- color: "error"
5468
- }, "".concat(error));
5469
- });
5470
- var ImportForm = /*#__PURE__*/observer(function (_ref2) {
5328
+ var ImportForm = /*#__PURE__*/observer(function (_ref) {
5471
5329
  var _regions$;
5472
5330
 
5473
- var model = _ref2.model;
5474
- var classes = useStyles$j();
5331
+ var model = _ref.model;
5332
+ var classes = useStyles$i();
5475
5333
  var session = getSession(model);
5476
5334
  var assemblyNames = session.assemblyNames,
5477
5335
  assemblyManager = session.assemblyManager,
@@ -5510,14 +5368,11 @@ var ImportForm = /*#__PURE__*/observer(function (_ref2) {
5510
5368
 
5511
5369
  function fetchResults(_x, _x2) {
5512
5370
  return _fetchResults.apply(this, arguments);
5513
- }
5514
- /**
5515
- * gets a string as input, or use stored option results from previous query,
5516
- * then re-query and
5517
- * 1) if it has multiple results: pop a dialog
5518
- * 2) if it's a single result navigate to it
5519
- * 3) else assume it's a locstring and navigate to it
5520
- */
5371
+ } // gets a string as input, or use stored option results from previous query,
5372
+ // then re-query and
5373
+ // 1) if it has multiple results: pop a dialog
5374
+ // 2) if it's a single result navigate to it
5375
+ // 3) else assume it's a locstring and navigate to it
5521
5376
 
5522
5377
 
5523
5378
  function _fetchResults() {
@@ -5643,13 +5498,13 @@ var ImportForm = /*#__PURE__*/observer(function (_ref2) {
5643
5498
  return _handleSelectedRegion.apply(this, arguments);
5644
5499
  }
5645
5500
 
5646
- return /*#__PURE__*/React.createElement("div", null, err ? /*#__PURE__*/React.createElement(ErrorDisplay, {
5501
+ return /*#__PURE__*/React.createElement("div", null, err ? /*#__PURE__*/React.createElement(ErrorMessage, {
5647
5502
  error: err
5648
5503
  }) : null, /*#__PURE__*/React.createElement(Container, {
5649
5504
  className: classes.importFormContainer
5650
5505
  }, /*#__PURE__*/React.createElement("form", {
5651
5506
  onSubmit: function onSubmit(event) {
5652
- event.preventDefault();
5507
+ return event.preventDefault();
5653
5508
  }
5654
5509
  }, /*#__PURE__*/React.createElement(Grid, {
5655
5510
  container: true,
@@ -5667,20 +5522,24 @@ var ImportForm = /*#__PURE__*/observer(function (_ref2) {
5667
5522
  selected: selectedAsm
5668
5523
  })), /*#__PURE__*/React.createElement(Grid, {
5669
5524
  item: true
5670
- }, selectedAsm ? err ? /*#__PURE__*/React.createElement(Typography$1, {
5671
- color: "error"
5672
- }, "X") : selectedRegion && model.volatileWidth ? /*#__PURE__*/React.createElement(RefNameAutocomplete$1, {
5525
+ }, selectedAsm ? err ? /*#__PURE__*/React.createElement(CloseIcon, {
5526
+ style: {
5527
+ color: 'red'
5528
+ }
5529
+ }) : selectedRegion ? /*#__PURE__*/React.createElement(RefNameAutocomplete$1, {
5673
5530
  fetchResults: fetchResults,
5674
5531
  model: model,
5675
5532
  assemblyName: assemblyError ? undefined : selectedAsm,
5676
5533
  value: selectedRegion,
5534
+ // note: minWidth 270 accomodates full width of helperText
5535
+ minWidth: 270,
5677
5536
  onSelect: function onSelect(option) {
5678
5537
  return setOption(option);
5679
5538
  },
5680
5539
  TextFieldProps: {
5681
5540
  margin: 'normal',
5682
5541
  variant: 'outlined',
5683
- helperText: 'Enter a sequence or location'
5542
+ helperText: 'Enter sequence name, feature name, or location'
5684
5543
  }
5685
5544
  }) : /*#__PURE__*/React.createElement(CircularProgress, {
5686
5545
  role: "progressbar",
@@ -5688,6 +5547,8 @@ var ImportForm = /*#__PURE__*/observer(function (_ref2) {
5688
5547
  disableShrink: true
5689
5548
  }) : null), /*#__PURE__*/React.createElement(Grid, {
5690
5549
  item: true
5550
+ }), /*#__PURE__*/React.createElement(Grid, {
5551
+ item: true
5691
5552
  }, /*#__PURE__*/React.createElement(Button$1, {
5692
5553
  type: "submit",
5693
5554
  disabled: !selectedRegion,
@@ -5768,7 +5629,7 @@ var MiniControls = /*#__PURE__*/observer(function (props) {
5768
5629
  }));
5769
5630
  });
5770
5631
 
5771
- var useStyles$k = /*#__PURE__*/makeStyles$1(function (theme) {
5632
+ var useStyles$j = /*#__PURE__*/makeStyles$1(function (theme) {
5772
5633
  return {
5773
5634
  loadingMessage: {
5774
5635
  padding: theme.spacing(5)
@@ -5864,7 +5725,7 @@ function _fetchSequence() {
5864
5725
  function SequenceDialog(_ref) {
5865
5726
  var model = _ref.model,
5866
5727
  handleClose = _ref.handleClose;
5867
- var classes = useStyles$k();
5728
+ var classes = useStyles$j();
5868
5729
  var session = getSession(model);
5869
5730
 
5870
5731
  var _useState = useState(),
@@ -6029,6 +5890,150 @@ function SequenceDialog(_ref) {
6029
5890
 
6030
5891
  var SequenceDialog$1 = /*#__PURE__*/observer(SequenceDialog);
6031
5892
 
5893
+ var useStyles$k = /*#__PURE__*/makeStyles$1(function (theme) {
5894
+ return {
5895
+ dialogContent: {
5896
+ width: '80em'
5897
+ },
5898
+ closeButton: {
5899
+ position: 'absolute',
5900
+ right: theme.spacing(1),
5901
+ top: theme.spacing(1),
5902
+ color: theme.palette.grey[500]
5903
+ }
5904
+ };
5905
+ });
5906
+ function SearchResultsDialog$1(_ref) {
5907
+ var _model$searchResults;
5908
+
5909
+ var model = _ref.model,
5910
+ optAssemblyName = _ref.optAssemblyName,
5911
+ handleClose = _ref.handleClose;
5912
+ var classes = useStyles$k();
5913
+ var session = getSession(model);
5914
+
5915
+ var _getEnv = getEnv(session),
5916
+ pluginManager = _getEnv.pluginManager;
5917
+
5918
+ var assemblyManager = session.assemblyManager;
5919
+ var assemblyName = optAssemblyName;
5920
+
5921
+ if (model.displayedRegions.length > 0) {
5922
+ var _model$displayedRegio;
5923
+
5924
+ assemblyName = (_model$displayedRegio = model.displayedRegions[0]) === null || _model$displayedRegio === void 0 ? void 0 : _model$displayedRegio.assemblyName;
5925
+ }
5926
+
5927
+ if (!assemblyName) {
5928
+ throw new Error("Assembly name not found");
5929
+ }
5930
+
5931
+ var assembly = assemblyManager.get(assemblyName);
5932
+
5933
+ if (!assembly) {
5934
+ throw new Error("assembly ".concat(assemblyName, " not found"));
5935
+ }
5936
+
5937
+ if (!assembly.regions) {
5938
+ throw new Error("assembly ".concat(assemblyName, " regions not loaded"));
5939
+ }
5940
+
5941
+ var assemblyRegions = assembly.regions;
5942
+
5943
+ function handleClick(location) {
5944
+ try {
5945
+ var newRegion = assemblyRegions.find(function (region) {
5946
+ return location === region.refName;
5947
+ });
5948
+
5949
+ if (newRegion) {
5950
+ model.setDisplayedRegions([newRegion]); // we use showAllRegions after setDisplayedRegions to make the entire
5951
+ // region visible, xref #1703
5952
+
5953
+ model.showAllRegions();
5954
+ } else {
5955
+ model.navToLocString(location, assemblyName);
5956
+ }
5957
+ } catch (e) {
5958
+ console.warn(e);
5959
+ session.notify("".concat(e), 'warning');
5960
+ }
5961
+ }
5962
+
5963
+ function getTrackName(trackId) {
5964
+ if (trackId) {
5965
+ var trackConfigSchema = pluginManager.pluggableConfigSchemaType('track');
5966
+ var configuration = resolveIdentifier(trackConfigSchema, getRoot(model), trackId);
5967
+
5968
+ if (configuration) {
5969
+ var _configuration$name;
5970
+
5971
+ return (_configuration$name = configuration.name) === null || _configuration$name === void 0 ? void 0 : _configuration$name.value;
5972
+ }
5973
+ }
5974
+
5975
+ return '';
5976
+ }
5977
+
5978
+ return /*#__PURE__*/React.createElement(Dialog, {
5979
+ open: true,
5980
+ maxWidth: "xl",
5981
+ onClose: handleClose
5982
+ }, /*#__PURE__*/React.createElement(DialogTitle, null, "Search results", handleClose ? /*#__PURE__*/React.createElement(IconButton, {
5983
+ "data-testid": "close-resultsDialog",
5984
+ className: classes.closeButton,
5985
+ onClick: function onClick() {
5986
+ handleClose();
5987
+ }
5988
+ }, /*#__PURE__*/React.createElement(CloseIcon, null)) : null), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DialogContent, null, !((_model$searchResults = model.searchResults) !== null && _model$searchResults !== void 0 && _model$searchResults.length) ? /*#__PURE__*/React.createElement(Typography$1, null, "No results found for ", /*#__PURE__*/React.createElement("b", null, model.searchQuery)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography$1, null, "Showing results for ", /*#__PURE__*/React.createElement("b", null, model.searchQuery)), /*#__PURE__*/React.createElement(TableContainer, {
5989
+ component: Paper$1
5990
+ }, /*#__PURE__*/React.createElement(Table, null, /*#__PURE__*/React.createElement(TableHead, null, /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, null, "Name"), /*#__PURE__*/React.createElement(TableCell, {
5991
+ align: "right"
5992
+ }, "Location"), /*#__PURE__*/React.createElement(TableCell, {
5993
+ align: "right"
5994
+ }, "Track"), /*#__PURE__*/React.createElement(TableCell, {
5995
+ align: "right"
5996
+ }))), /*#__PURE__*/React.createElement(TableBody, null, model.searchResults.map(function (result) {
5997
+ return /*#__PURE__*/React.createElement(TableRow, {
5998
+ key: "".concat(result.getId())
5999
+ }, /*#__PURE__*/React.createElement(TableCell, {
6000
+ component: "th",
6001
+ scope: "row"
6002
+ }, result.getLabel()), /*#__PURE__*/React.createElement(TableCell, {
6003
+ align: "right"
6004
+ }, result.getLocation()), /*#__PURE__*/React.createElement(TableCell, {
6005
+ align: "right"
6006
+ }, getTrackName(result.getTrackId()) || 'N/A'), /*#__PURE__*/React.createElement(TableCell, {
6007
+ align: "right"
6008
+ }, /*#__PURE__*/React.createElement(Button$1, {
6009
+ onClick: function onClick() {
6010
+ handleClick(result.getLocation());
6011
+ var resultTrackId = result.getTrackId();
6012
+
6013
+ if (resultTrackId) {
6014
+ model.showTrack(resultTrackId);
6015
+ }
6016
+
6017
+ handleClose();
6018
+ },
6019
+ disabled: !getTrackName(result.getTrackId()),
6020
+ color: "primary",
6021
+ variant: "contained"
6022
+ }, "Go")));
6023
+ })))))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button$1, {
6024
+ onClick: function onClick() {
6025
+ return handleClose();
6026
+ },
6027
+ color: "primary"
6028
+ }, "Cancel")));
6029
+ }
6030
+
6031
+ var SearchResultsDialog$2 = {
6032
+ __proto__: null,
6033
+ useStyles: useStyles$k,
6034
+ 'default': SearchResultsDialog$1
6035
+ };
6036
+
6032
6037
  var useStyles$l = /*#__PURE__*/makeStyles$1(function (theme) {
6033
6038
  return {
6034
6039
  note: {
@@ -6089,7 +6094,7 @@ var LinearGenomeView = /*#__PURE__*/observer(function (_ref) {
6089
6094
  handleClose: function handleClose() {
6090
6095
  model.setSequenceDialogOpen(false);
6091
6096
  }
6092
- }) : null, model.isSearchDialogDisplayed ? /*#__PURE__*/React.createElement(SearchResultsDialog, {
6097
+ }) : null, model.isSearchDialogDisplayed ? /*#__PURE__*/React.createElement(SearchResultsDialog$1, {
6093
6098
  model: model,
6094
6099
  handleClose: function handleClose() {
6095
6100
  model.setSearchResults(undefined, undefined);
@@ -7192,7 +7197,8 @@ function stateModelFactory$1(pluginManager) {
7192
7197
  self.zoomTo(self.bpPerPx);
7193
7198
 
7194
7199
  if ( // already zoomed all the way in
7195
- targetBpPerPx < self.bpPerPx && self.bpPerPx === self.minBpPerPx || targetBpPerPx > self.bpPerPx && self.bpPerPx === self.maxBpPerPx) {
7200
+ targetBpPerPx < self.bpPerPx && self.bpPerPx === self.minBpPerPx || // already zoomed all the way out
7201
+ targetBpPerPx > self.bpPerPx && self.bpPerPx === self.maxBpPerPx) {
7196
7202
  return;
7197
7203
  }
7198
7204
 
@@ -7721,6 +7727,43 @@ var LinearGenomeViewPlugin = /*#__PURE__*/function (_Plugin) {
7721
7727
  }(Plugin);
7722
7728
 
7723
7729
  var useStyles$m = /*#__PURE__*/makeStyles$1(function (theme) {
7730
+ return {
7731
+ closeButton: {
7732
+ position: 'absolute',
7733
+ right: theme.spacing(1),
7734
+ top: theme.spacing(1),
7735
+ color: theme.palette.grey[500]
7736
+ }
7737
+ };
7738
+ });
7739
+ function HelpDialog$1(_ref) {
7740
+ var handleClose = _ref.handleClose;
7741
+ var classes = useStyles$m();
7742
+ return /*#__PURE__*/React.createElement(Dialog, {
7743
+ open: true,
7744
+ maxWidth: "xl",
7745
+ onClose: handleClose
7746
+ }, /*#__PURE__*/React.createElement(DialogTitle, null, "Using the search box", handleClose ? /*#__PURE__*/React.createElement(IconButton, {
7747
+ "data-testid": "close-resultsDialog",
7748
+ className: classes.closeButton,
7749
+ onClick: function onClick() {
7750
+ handleClose();
7751
+ }
7752
+ }, /*#__PURE__*/React.createElement(CloseIcon, null)) : null), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DialogContent, null, /*#__PURE__*/React.createElement("h3", null, "Searching"), /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, "Jump to a feature or reference sequence by typing its name in the location box and pressing Enter."), /*#__PURE__*/React.createElement("li", null, "Jump to a specific region by typing the region into the location box as: ", /*#__PURE__*/React.createElement("code", null, "ref:start..end"), " or ", /*#__PURE__*/React.createElement("code", null, "ref:start-end"), ". Commas are allowed in the start and end coordinates.")), /*#__PURE__*/React.createElement("h3", null, "Example Searches"), /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "BRCA"), " - searches for the feature named BRCA"), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "chr4"), " - jumps to chromosome 4"), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "chr4:79,500,000..80,000,000"), " - jumps the region on chromosome 4 between 79.5Mb and 80Mb."))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button$1, {
7753
+ onClick: function onClick() {
7754
+ return handleClose();
7755
+ },
7756
+ color: "primary"
7757
+ }, "Close")));
7758
+ }
7759
+
7760
+ var HelpDialog$2 = {
7761
+ __proto__: null,
7762
+ useStyles: useStyles$m,
7763
+ 'default': HelpDialog$1
7764
+ };
7765
+
7766
+ var useStyles$n = /*#__PURE__*/makeStyles$1(function (theme) {
7724
7767
  return {
7725
7768
  root: {
7726
7769
  width: 500
@@ -7740,7 +7783,7 @@ var useStyles$m = /*#__PURE__*/makeStyles$1(function (theme) {
7740
7783
  function SetMaxHeightDlg$1(props) {
7741
7784
  var model = props.model,
7742
7785
  handleClose = props.handleClose;
7743
- var classes = useStyles$m();
7786
+ var classes = useStyles$n();
7744
7787
  var _model$maxHeight = model.maxHeight,
7745
7788
  maxHeight = _model$maxHeight === void 0 ? '' : _model$maxHeight;
7746
7789