@jbrowse/plugin-config 1.5.0 → 1.5.4

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.
@@ -12,7 +12,7 @@ import { ObservableCreate } from '@jbrowse/core/util/rxjs';
12
12
  import { toArray } from 'rxjs/operators';
13
13
  import { openLocation } from '@jbrowse/core/util/io';
14
14
  import { useDebounce, iterMap } from '@jbrowse/core/util';
15
- import { FormControl, InputLabel, FormHelperText, makeStyles, useTheme, Paper, IconButton as IconButton$1, TextField as TextField$1, SvgIcon, List, ListItem, InputAdornment, Card, CardHeader, CardContent, FormControlLabel, Checkbox, MenuItem } from '@material-ui/core';
15
+ import { FormControl, InputLabel, FormHelperText, makeStyles, useTheme, Tooltip, IconButton, Paper, TextField as TextField$1, SvgIcon, List, ListItem, InputAdornment, Card, CardHeader, CardContent, FormControlLabel, Checkbox, MenuItem } from '@material-ui/core';
16
16
  import Editor from 'react-simple-code-editor';
17
17
  import { Light } from 'react-syntax-highlighter';
18
18
  import json from 'react-syntax-highlighter/dist/cjs/languages/hljs/json';
@@ -28,11 +28,6 @@ import DeleteIcon from '@material-ui/icons/Delete';
28
28
  import AddIcon from '@material-ui/icons/Add';
29
29
  import RadioButtonUncheckedIcon from '@material-ui/icons/RadioButtonUnchecked';
30
30
  import { stringToJexlExpression } from '@jbrowse/core/util/jexlStrings';
31
- import FormControl$1 from '@material-ui/core/FormControl';
32
- import FormHelperText$1 from '@material-ui/core/FormHelperText';
33
- import InputLabel$1 from '@material-ui/core/InputLabel';
34
- import Tooltip from '@material-ui/core/Tooltip';
35
- import IconButton from '@material-ui/core/IconButton';
36
31
  import HelpIcon from '@material-ui/icons/Help';
37
32
  import ReactPropTypes from 'prop-types';
38
33
  import TextField from '@material-ui/core/TextField';
@@ -45,14 +40,9 @@ function ownKeys(object, enumerableOnly) {
45
40
 
46
41
  if (Object.getOwnPropertySymbols) {
47
42
  var symbols = Object.getOwnPropertySymbols(object);
48
-
49
- if (enumerableOnly) {
50
- symbols = symbols.filter(function (sym) {
51
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
52
- });
53
- }
54
-
55
- keys.push.apply(keys, symbols);
43
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
44
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
45
+ })), keys.push.apply(keys, symbols);
56
46
  }
57
47
 
58
48
  return keys;
@@ -60,19 +50,12 @@ function ownKeys(object, enumerableOnly) {
60
50
 
61
51
  function _objectSpread2(target) {
62
52
  for (var i = 1; i < arguments.length; i++) {
63
- var source = arguments[i] != null ? arguments[i] : {};
64
-
65
- if (i % 2) {
66
- ownKeys(Object(source), true).forEach(function (key) {
67
- _defineProperty(target, key, source[key]);
68
- });
69
- } else if (Object.getOwnPropertyDescriptors) {
70
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
71
- } else {
72
- ownKeys(Object(source)).forEach(function (key) {
73
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
74
- });
75
- }
53
+ var source = null != arguments[i] ? arguments[i] : {};
54
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
55
+ _defineProperty(target, key, source[key]);
56
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
57
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
58
+ });
76
59
  }
77
60
 
78
61
  return target;
@@ -133,6 +116,9 @@ function _defineProperties(target, props) {
133
116
  function _createClass(Constructor, protoProps, staticProps) {
134
117
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
135
118
  if (staticProps) _defineProperties(Constructor, staticProps);
119
+ Object.defineProperty(Constructor, "prototype", {
120
+ writable: false
121
+ });
136
122
  return Constructor;
137
123
  }
138
124
 
@@ -174,12 +160,15 @@ function _inherits(subClass, superClass) {
174
160
  throw new TypeError("Super expression must either be null or a function");
175
161
  }
176
162
 
177
- subClass.prototype = Object.create(superClass && superClass.prototype, {
178
- constructor: {
179
- value: subClass,
180
- writable: true,
181
- configurable: true
182
- }
163
+ Object.defineProperty(subClass, "prototype", {
164
+ value: Object.create(superClass && superClass.prototype, {
165
+ constructor: {
166
+ value: subClass,
167
+ writable: true,
168
+ configurable: true
169
+ }
170
+ }),
171
+ writable: false
183
172
  });
184
173
  if (superClass) _setPrototypeOf(subClass, superClass);
185
174
  }
@@ -259,7 +248,7 @@ function _superPropBase(object, property) {
259
248
  return object;
260
249
  }
261
250
 
262
- function _get(target, property, receiver) {
251
+ function _get() {
263
252
  if (typeof Reflect !== "undefined" && Reflect.get) {
264
253
  _get = Reflect.get;
265
254
  } else {
@@ -270,14 +259,14 @@ function _get(target, property, receiver) {
270
259
  var desc = Object.getOwnPropertyDescriptor(base, property);
271
260
 
272
261
  if (desc.get) {
273
- return desc.get.call(receiver);
262
+ return desc.get.call(arguments.length < 3 ? target : receiver);
274
263
  }
275
264
 
276
265
  return desc.value;
277
266
  };
278
267
  }
279
268
 
280
- return _get(target, property, receiver || target);
269
+ return _get.apply(this, arguments);
281
270
  }
282
271
 
283
272
  function _slicedToArray(arr, i) {
@@ -1299,7 +1288,9 @@ var FromConfigAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
1299
1288
  }
1300
1289
  }, {
1301
1290
  key: "freeResources",
1302
- value: function freeResources() {}
1291
+ value: function
1292
+ /* { region } */
1293
+ freeResources() {}
1303
1294
  }], [{
1304
1295
  key: "makeFeatures",
1305
1296
  value: function makeFeatures(fdata) {
@@ -1451,7 +1442,9 @@ var FromConfigRegionsAdapter = /*#__PURE__*/function (_BaseAdapter) {
1451
1442
  }()
1452
1443
  }, {
1453
1444
  key: "freeResources",
1454
- value: function freeResources() {}
1445
+ value: function
1446
+ /* { region } */
1447
+ freeResources() {}
1455
1448
  }]);
1456
1449
 
1457
1450
  return FromConfigRegionsAdapter;
@@ -1601,7 +1594,9 @@ var FromConfigSequenceAdapter = /*#__PURE__*/function (_FromConfigAdapter) {
1601
1594
 
1602
1595
  }, {
1603
1596
  key: "freeResources",
1604
- value: function freeResources() {}
1597
+ value: function
1598
+ /* { region } */
1599
+ freeResources() {}
1605
1600
  }]);
1606
1601
 
1607
1602
  return FromConfigSequenceAdapter;
@@ -1652,30 +1647,35 @@ var RefNameAliasAdapter = /*#__PURE__*/function (_BaseAdapter) {
1652
1647
 
1653
1648
  var _super = /*#__PURE__*/_createSuper(RefNameAliasAdapter);
1654
1649
 
1655
- function RefNameAliasAdapter(config, getSubAdapter, pluginManager) {
1656
- var _this;
1657
-
1650
+ function RefNameAliasAdapter() {
1658
1651
  _classCallCheck(this, RefNameAliasAdapter);
1659
1652
 
1660
- _this = _super.call(this, config, getSubAdapter, pluginManager);
1661
- _this.location = openLocation(readConfObject(config, 'location'), _this.pluginManager);
1662
- _this.promise = _this.downloadResults();
1663
- return _this;
1653
+ return _super.apply(this, arguments);
1664
1654
  }
1665
1655
 
1666
1656
  _createClass(RefNameAliasAdapter, [{
1667
- key: "downloadResults",
1657
+ key: "getRefNameAliases",
1668
1658
  value: function () {
1669
- var _downloadResults = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1670
- var results;
1659
+ var _getRefNameAliases = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1660
+ var loc, results;
1671
1661
  return runtime_1.wrap(function _callee$(_context) {
1672
1662
  while (1) {
1673
1663
  switch (_context.prev = _context.next) {
1674
1664
  case 0:
1675
- _context.next = 2;
1676
- return this.location.readFile('utf8');
1665
+ loc = readConfObject(this.config, 'location');
1666
+
1667
+ if (!(loc.uri === '' || loc.uri === '/path/to/my/aliases.txt')) {
1668
+ _context.next = 3;
1669
+ break;
1670
+ }
1671
+
1672
+ return _context.abrupt("return", []);
1673
+
1674
+ case 3:
1675
+ _context.next = 5;
1676
+ return openLocation(loc).readFile('utf8');
1677
1677
 
1678
- case 2:
1678
+ case 5:
1679
1679
  results = _context.sent;
1680
1680
  return _context.abrupt("return", results.trim().split('\n').map(function (row) {
1681
1681
  var _row$split = row.split('\t'),
@@ -1689,7 +1689,7 @@ var RefNameAliasAdapter = /*#__PURE__*/function (_BaseAdapter) {
1689
1689
  };
1690
1690
  }));
1691
1691
 
1692
- case 4:
1692
+ case 7:
1693
1693
  case "end":
1694
1694
  return _context.stop();
1695
1695
  }
@@ -1697,17 +1697,12 @@ var RefNameAliasAdapter = /*#__PURE__*/function (_BaseAdapter) {
1697
1697
  }, _callee, this);
1698
1698
  }));
1699
1699
 
1700
- function downloadResults() {
1701
- return _downloadResults.apply(this, arguments);
1700
+ function getRefNameAliases() {
1701
+ return _getRefNameAliases.apply(this, arguments);
1702
1702
  }
1703
1703
 
1704
- return downloadResults;
1704
+ return getRefNameAliases;
1705
1705
  }()
1706
- }, {
1707
- key: "getRefNameAliases",
1708
- value: function getRefNameAliases() {
1709
- return this.promise;
1710
- }
1711
1706
  }, {
1712
1707
  key: "freeResources",
1713
1708
  value: function () {
@@ -1826,28 +1821,52 @@ var _default = /*#__PURE__*/function (_Plugin) {
1826
1821
  return new AdapterType({
1827
1822
  name: 'FromConfigAdapter',
1828
1823
  configSchema: configSchema$1,
1829
- AdapterClass: FromConfigAdapter
1824
+ AdapterClass: FromConfigAdapter,
1825
+ adapterMetadata: {
1826
+ category: null,
1827
+ hiddenFromGUI: true,
1828
+ displayName: null,
1829
+ description: null
1830
+ }
1830
1831
  });
1831
1832
  });
1832
1833
  pluginManager.addAdapterType(function () {
1833
1834
  return new AdapterType({
1834
1835
  name: 'FromConfigRegionsAdapter',
1835
1836
  configSchema: regionsConfigSchema,
1836
- AdapterClass: FromConfigRegionsAdapter
1837
+ AdapterClass: FromConfigRegionsAdapter,
1838
+ adapterMetadata: {
1839
+ category: null,
1840
+ hiddenFromGUI: true,
1841
+ displayName: null,
1842
+ description: null
1843
+ }
1837
1844
  });
1838
1845
  });
1839
1846
  pluginManager.addAdapterType(function () {
1840
1847
  return new AdapterType({
1841
1848
  name: 'FromConfigSequenceAdapter',
1842
1849
  configSchema: sequenceConfigSchema,
1843
- AdapterClass: FromConfigSequenceAdapter
1850
+ AdapterClass: FromConfigSequenceAdapter,
1851
+ adapterMetadata: {
1852
+ category: null,
1853
+ hiddenFromGUI: true,
1854
+ displayName: null,
1855
+ description: null
1856
+ }
1844
1857
  });
1845
1858
  });
1846
1859
  pluginManager.addAdapterType(function () {
1847
1860
  return new AdapterType({
1848
1861
  name: 'RefNameAliasAdapter',
1849
1862
  configSchema: refNameAliasAdapterConfigSchema,
1850
- AdapterClass: RefNameAliasAdapter
1863
+ AdapterClass: RefNameAliasAdapter,
1864
+ adapterMetadata: {
1865
+ category: null,
1866
+ hiddenFromGUI: true,
1867
+ displayName: null,
1868
+ description: null
1869
+ }
1851
1870
  });
1852
1871
  });
1853
1872
  pluginManager.addWidgetType(function () {
@@ -1922,7 +1941,7 @@ var fontSize$1 = '12px'; // Optimize by using system default fonts:
1922
1941
  // https://css-tricks.com/snippets/css/font-stacks/
1923
1942
 
1924
1943
  var fontFamily$1 = 'Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace';
1925
- var useStyles$2 = /*#__PURE__*/makeStyles$1(function (theme) {
1944
+ var useStyles$2 = /*#__PURE__*/makeStyles(function (theme) {
1926
1945
  return {
1927
1946
  callbackEditor: {
1928
1947
  marginTop: '16px',
@@ -1963,7 +1982,7 @@ function CallbackEditor(_ref) {
1963
1982
  }, [debouncedCode, slot]); // if default value is a callback, will have to remove jexl:
1964
1983
  // do this last
1965
1984
 
1966
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormControl$1, null, /*#__PURE__*/React.createElement(InputLabel$1, {
1985
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormControl, null, /*#__PURE__*/React.createElement(InputLabel, {
1967
1986
  shrink: true,
1968
1987
  htmlFor: "callback-editor"
1969
1988
  }, slot.name), /*#__PURE__*/React.createElement(Editor, {
@@ -1979,7 +1998,7 @@ function CallbackEditor(_ref) {
1979
1998
  style: {
1980
1999
  background: error ? '#fdd' : undefined
1981
2000
  }
1982
- }), /*#__PURE__*/React.createElement(FormHelperText$1, null, slot.description)), /*#__PURE__*/React.createElement(Tooltip, {
2001
+ }), /*#__PURE__*/React.createElement(FormHelperText, null, slot.description)), /*#__PURE__*/React.createElement(Tooltip, {
1983
2002
  title: /*#__PURE__*/React.createElement("div", null, "Callbacks are written in Jexl format. Click to learn more.", /*#__PURE__*/React.createElement("br", null), " Names of available context items: ", slot.contextVariable),
1984
2003
  arrow: true
1985
2004
  }, /*#__PURE__*/React.createElement(IconButton, {
@@ -2010,7 +2029,7 @@ function serializeColor(color) {
2010
2029
  g = color.g,
2011
2030
  b = color.b,
2012
2031
  a = color.a;
2013
- return "rgb(".concat(r, ",").concat(g, ",").concat(b, ",").concat(a, ")");
2032
+ return a === undefined ? "rgb(".concat(r, ",").concat(g, ",").concat(b, ")") : "rgba(".concat(r, ",").concat(g, ",").concat(b, ",").concat(a, ")");
2014
2033
  }
2015
2034
 
2016
2035
  return color;
@@ -2145,7 +2164,7 @@ var StringArrayEditor = /*#__PURE__*/observer(function (_ref3) {
2145
2164
  InputProps: {
2146
2165
  endAdornment: /*#__PURE__*/React.createElement(InputAdornment, {
2147
2166
  position: "end"
2148
- }, /*#__PURE__*/React.createElement(IconButton$1, {
2167
+ }, /*#__PURE__*/React.createElement(IconButton, {
2149
2168
  color: "secondary",
2150
2169
  onClick: function onClick() {
2151
2170
  return slot.removeAtIndex(idx);
@@ -2164,7 +2183,7 @@ var StringArrayEditor = /*#__PURE__*/observer(function (_ref3) {
2164
2183
  InputProps: {
2165
2184
  endAdornment: /*#__PURE__*/React.createElement(InputAdornment, {
2166
2185
  position: "end"
2167
- }, /*#__PURE__*/React.createElement(IconButton$1, {
2186
+ }, /*#__PURE__*/React.createElement(IconButton, {
2168
2187
  onClick: function onClick() {
2169
2188
  slot.add(value);
2170
2189
  setValue('');
@@ -2203,7 +2222,7 @@ var StringArrayMapEditor = /*#__PURE__*/observer(function (_ref4) {
2203
2222
  className: classes.card
2204
2223
  }, /*#__PURE__*/React.createElement(CardHeader, {
2205
2224
  title: key,
2206
- action: /*#__PURE__*/React.createElement(IconButton$1, {
2225
+ action: /*#__PURE__*/React.createElement(IconButton, {
2207
2226
  color: "secondary",
2208
2227
  onClick: function onClick() {
2209
2228
  return slot.remove(key);
@@ -2239,7 +2258,7 @@ var StringArrayMapEditor = /*#__PURE__*/observer(function (_ref4) {
2239
2258
  InputProps: {
2240
2259
  endAdornment: /*#__PURE__*/React.createElement(InputAdornment, {
2241
2260
  position: "end"
2242
- }, /*#__PURE__*/React.createElement(IconButton$1, {
2261
+ }, /*#__PURE__*/React.createElement(IconButton, {
2243
2262
  disabled: value === '',
2244
2263
  onClick: function onClick() {
2245
2264
  slot.add(value, []);
@@ -2271,7 +2290,7 @@ var NumberMapEditor = /*#__PURE__*/observer(function (_ref7) {
2271
2290
  className: classes.card
2272
2291
  }, /*#__PURE__*/React.createElement(CardHeader, {
2273
2292
  title: key,
2274
- action: /*#__PURE__*/React.createElement(IconButton$1, {
2293
+ action: /*#__PURE__*/React.createElement(IconButton, {
2275
2294
  color: "secondary",
2276
2295
  onClick: function onClick() {
2277
2296
  return slot.remove(key);
@@ -2300,7 +2319,7 @@ var NumberMapEditor = /*#__PURE__*/observer(function (_ref7) {
2300
2319
  InputProps: {
2301
2320
  endAdornment: /*#__PURE__*/React.createElement(InputAdornment, {
2302
2321
  position: "end"
2303
- }, /*#__PURE__*/React.createElement(IconButton$1, {
2322
+ }, /*#__PURE__*/React.createElement(IconButton, {
2304
2323
  disabled: value === '',
2305
2324
  onClick: function onClick() {
2306
2325
  slot.add(value, 0);
@@ -2476,7 +2495,7 @@ var SlotEditor = /*#__PURE__*/observer(function (_ref15) {
2476
2495
  slotSchema: slotSchema
2477
2496
  })), /*#__PURE__*/React.createElement("div", {
2478
2497
  className: classes.slotModeSwitch
2479
- }, slot.contextVariable.length ? /*#__PURE__*/React.createElement(IconButton$1, {
2498
+ }, slot.contextVariable.length ? /*#__PURE__*/React.createElement(IconButton, {
2480
2499
  className: classes.slotModeIcon,
2481
2500
  onClick: function onClick() {
2482
2501
  return slot.isCallback ? slot.convertToValue() : slot.convertToCallback();