@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.
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.d.ts +5 -10
- package/dist/plugin-config.cjs.development.js +88 -69
- package/dist/plugin-config.cjs.development.js.map +1 -1
- package/dist/plugin-config.cjs.production.min.js +1 -1
- package/dist/plugin-config.cjs.production.min.js.map +1 -1
- package/dist/plugin-config.esm.js +95 -76
- package/dist/plugin-config.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/ConfigurationEditorWidget/components/CallbackEditor.js +8 -6
- package/src/ConfigurationEditorWidget/components/ColorEditor.tsx +1 -1
- package/src/ConfigurationEditorWidget/components/__snapshots__/ConfigurationEditor.test.js.snap +2 -2
- package/src/RefNameAliasAdapter/RefNameAliasAdapter.ts +6 -30
- package/src/index.ts +24 -0
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { BaseRefNameAliasAdapter,
|
|
2
|
-
import { ConfigurationModel } from '@jbrowse/core/configuration/configurationSchema';
|
|
3
|
-
import MyConfigAdapterSchema from './configSchema';
|
|
4
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
5
|
-
import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
1
|
+
import { BaseRefNameAliasAdapter, BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
6
2
|
export default class RefNameAliasAdapter extends BaseAdapter implements BaseRefNameAliasAdapter {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
getRefNameAliases(): Promise<Alias[]>;
|
|
3
|
+
getRefNameAliases(): Promise<{
|
|
4
|
+
refName: string;
|
|
5
|
+
aliases: string[];
|
|
6
|
+
}[]>;
|
|
12
7
|
freeResources(): Promise<void>;
|
|
13
8
|
}
|
|
@@ -35,11 +35,6 @@ var DeleteIcon = _interopDefault(require('@material-ui/icons/Delete'));
|
|
|
35
35
|
var AddIcon = _interopDefault(require('@material-ui/icons/Add'));
|
|
36
36
|
var RadioButtonUncheckedIcon = _interopDefault(require('@material-ui/icons/RadioButtonUnchecked'));
|
|
37
37
|
var jexlStrings = require('@jbrowse/core/util/jexlStrings');
|
|
38
|
-
var FormControl = _interopDefault(require('@material-ui/core/FormControl'));
|
|
39
|
-
var FormHelperText = _interopDefault(require('@material-ui/core/FormHelperText'));
|
|
40
|
-
var InputLabel = _interopDefault(require('@material-ui/core/InputLabel'));
|
|
41
|
-
var Tooltip = _interopDefault(require('@material-ui/core/Tooltip'));
|
|
42
|
-
var IconButton = _interopDefault(require('@material-ui/core/IconButton'));
|
|
43
38
|
var HelpIcon = _interopDefault(require('@material-ui/icons/Help'));
|
|
44
39
|
var ReactPropTypes = _interopDefault(require('prop-types'));
|
|
45
40
|
var TextField = _interopDefault(require('@material-ui/core/TextField'));
|
|
@@ -52,14 +47,9 @@ function ownKeys(object, enumerableOnly) {
|
|
|
52
47
|
|
|
53
48
|
if (Object.getOwnPropertySymbols) {
|
|
54
49
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
keys.push.apply(keys, symbols);
|
|
50
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
51
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
52
|
+
})), keys.push.apply(keys, symbols);
|
|
63
53
|
}
|
|
64
54
|
|
|
65
55
|
return keys;
|
|
@@ -67,19 +57,12 @@ function ownKeys(object, enumerableOnly) {
|
|
|
67
57
|
|
|
68
58
|
function _objectSpread2(target) {
|
|
69
59
|
for (var i = 1; i < arguments.length; i++) {
|
|
70
|
-
var source = arguments[i]
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
77
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
78
|
-
} else {
|
|
79
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
80
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
81
|
-
});
|
|
82
|
-
}
|
|
60
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
61
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
62
|
+
_defineProperty(target, key, source[key]);
|
|
63
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
64
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
65
|
+
});
|
|
83
66
|
}
|
|
84
67
|
|
|
85
68
|
return target;
|
|
@@ -140,6 +123,9 @@ function _defineProperties(target, props) {
|
|
|
140
123
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
141
124
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
142
125
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
126
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
127
|
+
writable: false
|
|
128
|
+
});
|
|
143
129
|
return Constructor;
|
|
144
130
|
}
|
|
145
131
|
|
|
@@ -181,12 +167,15 @@ function _inherits(subClass, superClass) {
|
|
|
181
167
|
throw new TypeError("Super expression must either be null or a function");
|
|
182
168
|
}
|
|
183
169
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
170
|
+
Object.defineProperty(subClass, "prototype", {
|
|
171
|
+
value: Object.create(superClass && superClass.prototype, {
|
|
172
|
+
constructor: {
|
|
173
|
+
value: subClass,
|
|
174
|
+
writable: true,
|
|
175
|
+
configurable: true
|
|
176
|
+
}
|
|
177
|
+
}),
|
|
178
|
+
writable: false
|
|
190
179
|
});
|
|
191
180
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
192
181
|
}
|
|
@@ -266,7 +255,7 @@ function _superPropBase(object, property) {
|
|
|
266
255
|
return object;
|
|
267
256
|
}
|
|
268
257
|
|
|
269
|
-
function _get(
|
|
258
|
+
function _get() {
|
|
270
259
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
271
260
|
_get = Reflect.get;
|
|
272
261
|
} else {
|
|
@@ -277,14 +266,14 @@ function _get(target, property, receiver) {
|
|
|
277
266
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
278
267
|
|
|
279
268
|
if (desc.get) {
|
|
280
|
-
return desc.get.call(receiver);
|
|
269
|
+
return desc.get.call(arguments.length < 3 ? target : receiver);
|
|
281
270
|
}
|
|
282
271
|
|
|
283
272
|
return desc.value;
|
|
284
273
|
};
|
|
285
274
|
}
|
|
286
275
|
|
|
287
|
-
return _get(
|
|
276
|
+
return _get.apply(this, arguments);
|
|
288
277
|
}
|
|
289
278
|
|
|
290
279
|
function _slicedToArray(arr, i) {
|
|
@@ -1306,7 +1295,9 @@ var FromConfigAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1306
1295
|
}
|
|
1307
1296
|
}, {
|
|
1308
1297
|
key: "freeResources",
|
|
1309
|
-
value: function
|
|
1298
|
+
value: function
|
|
1299
|
+
/* { region } */
|
|
1300
|
+
freeResources() {}
|
|
1310
1301
|
}], [{
|
|
1311
1302
|
key: "makeFeatures",
|
|
1312
1303
|
value: function makeFeatures(fdata) {
|
|
@@ -1458,7 +1449,9 @@ var FromConfigRegionsAdapter = /*#__PURE__*/function (_BaseAdapter) {
|
|
|
1458
1449
|
}()
|
|
1459
1450
|
}, {
|
|
1460
1451
|
key: "freeResources",
|
|
1461
|
-
value: function
|
|
1452
|
+
value: function
|
|
1453
|
+
/* { region } */
|
|
1454
|
+
freeResources() {}
|
|
1462
1455
|
}]);
|
|
1463
1456
|
|
|
1464
1457
|
return FromConfigRegionsAdapter;
|
|
@@ -1608,7 +1601,9 @@ var FromConfigSequenceAdapter = /*#__PURE__*/function (_FromConfigAdapter) {
|
|
|
1608
1601
|
|
|
1609
1602
|
}, {
|
|
1610
1603
|
key: "freeResources",
|
|
1611
|
-
value: function
|
|
1604
|
+
value: function
|
|
1605
|
+
/* { region } */
|
|
1606
|
+
freeResources() {}
|
|
1612
1607
|
}]);
|
|
1613
1608
|
|
|
1614
1609
|
return FromConfigSequenceAdapter;
|
|
@@ -1659,30 +1654,35 @@ var RefNameAliasAdapter = /*#__PURE__*/function (_BaseAdapter) {
|
|
|
1659
1654
|
|
|
1660
1655
|
var _super = /*#__PURE__*/_createSuper(RefNameAliasAdapter);
|
|
1661
1656
|
|
|
1662
|
-
function RefNameAliasAdapter(
|
|
1663
|
-
var _this;
|
|
1664
|
-
|
|
1657
|
+
function RefNameAliasAdapter() {
|
|
1665
1658
|
_classCallCheck(this, RefNameAliasAdapter);
|
|
1666
1659
|
|
|
1667
|
-
|
|
1668
|
-
_this.location = io.openLocation(configuration.readConfObject(config, 'location'), _this.pluginManager);
|
|
1669
|
-
_this.promise = _this.downloadResults();
|
|
1670
|
-
return _this;
|
|
1660
|
+
return _super.apply(this, arguments);
|
|
1671
1661
|
}
|
|
1672
1662
|
|
|
1673
1663
|
_createClass(RefNameAliasAdapter, [{
|
|
1674
|
-
key: "
|
|
1664
|
+
key: "getRefNameAliases",
|
|
1675
1665
|
value: function () {
|
|
1676
|
-
var
|
|
1677
|
-
var results;
|
|
1666
|
+
var _getRefNameAliases = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1667
|
+
var loc, results;
|
|
1678
1668
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1679
1669
|
while (1) {
|
|
1680
1670
|
switch (_context.prev = _context.next) {
|
|
1681
1671
|
case 0:
|
|
1682
|
-
|
|
1683
|
-
|
|
1672
|
+
loc = configuration.readConfObject(this.config, 'location');
|
|
1673
|
+
|
|
1674
|
+
if (!(loc.uri === '' || loc.uri === '/path/to/my/aliases.txt')) {
|
|
1675
|
+
_context.next = 3;
|
|
1676
|
+
break;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
return _context.abrupt("return", []);
|
|
1680
|
+
|
|
1681
|
+
case 3:
|
|
1682
|
+
_context.next = 5;
|
|
1683
|
+
return io.openLocation(loc).readFile('utf8');
|
|
1684
1684
|
|
|
1685
|
-
case
|
|
1685
|
+
case 5:
|
|
1686
1686
|
results = _context.sent;
|
|
1687
1687
|
return _context.abrupt("return", results.trim().split('\n').map(function (row) {
|
|
1688
1688
|
var _row$split = row.split('\t'),
|
|
@@ -1696,7 +1696,7 @@ var RefNameAliasAdapter = /*#__PURE__*/function (_BaseAdapter) {
|
|
|
1696
1696
|
};
|
|
1697
1697
|
}));
|
|
1698
1698
|
|
|
1699
|
-
case
|
|
1699
|
+
case 7:
|
|
1700
1700
|
case "end":
|
|
1701
1701
|
return _context.stop();
|
|
1702
1702
|
}
|
|
@@ -1704,17 +1704,12 @@ var RefNameAliasAdapter = /*#__PURE__*/function (_BaseAdapter) {
|
|
|
1704
1704
|
}, _callee, this);
|
|
1705
1705
|
}));
|
|
1706
1706
|
|
|
1707
|
-
function
|
|
1708
|
-
return
|
|
1707
|
+
function getRefNameAliases() {
|
|
1708
|
+
return _getRefNameAliases.apply(this, arguments);
|
|
1709
1709
|
}
|
|
1710
1710
|
|
|
1711
|
-
return
|
|
1711
|
+
return getRefNameAliases;
|
|
1712
1712
|
}()
|
|
1713
|
-
}, {
|
|
1714
|
-
key: "getRefNameAliases",
|
|
1715
|
-
value: function getRefNameAliases() {
|
|
1716
|
-
return this.promise;
|
|
1717
|
-
}
|
|
1718
1713
|
}, {
|
|
1719
1714
|
key: "freeResources",
|
|
1720
1715
|
value: function () {
|
|
@@ -1833,28 +1828,52 @@ var _default = /*#__PURE__*/function (_Plugin) {
|
|
|
1833
1828
|
return new AdapterType({
|
|
1834
1829
|
name: 'FromConfigAdapter',
|
|
1835
1830
|
configSchema: configSchema$1,
|
|
1836
|
-
AdapterClass: FromConfigAdapter
|
|
1831
|
+
AdapterClass: FromConfigAdapter,
|
|
1832
|
+
adapterMetadata: {
|
|
1833
|
+
category: null,
|
|
1834
|
+
hiddenFromGUI: true,
|
|
1835
|
+
displayName: null,
|
|
1836
|
+
description: null
|
|
1837
|
+
}
|
|
1837
1838
|
});
|
|
1838
1839
|
});
|
|
1839
1840
|
pluginManager.addAdapterType(function () {
|
|
1840
1841
|
return new AdapterType({
|
|
1841
1842
|
name: 'FromConfigRegionsAdapter',
|
|
1842
1843
|
configSchema: regionsConfigSchema,
|
|
1843
|
-
AdapterClass: FromConfigRegionsAdapter
|
|
1844
|
+
AdapterClass: FromConfigRegionsAdapter,
|
|
1845
|
+
adapterMetadata: {
|
|
1846
|
+
category: null,
|
|
1847
|
+
hiddenFromGUI: true,
|
|
1848
|
+
displayName: null,
|
|
1849
|
+
description: null
|
|
1850
|
+
}
|
|
1844
1851
|
});
|
|
1845
1852
|
});
|
|
1846
1853
|
pluginManager.addAdapterType(function () {
|
|
1847
1854
|
return new AdapterType({
|
|
1848
1855
|
name: 'FromConfigSequenceAdapter',
|
|
1849
1856
|
configSchema: sequenceConfigSchema,
|
|
1850
|
-
AdapterClass: FromConfigSequenceAdapter
|
|
1857
|
+
AdapterClass: FromConfigSequenceAdapter,
|
|
1858
|
+
adapterMetadata: {
|
|
1859
|
+
category: null,
|
|
1860
|
+
hiddenFromGUI: true,
|
|
1861
|
+
displayName: null,
|
|
1862
|
+
description: null
|
|
1863
|
+
}
|
|
1851
1864
|
});
|
|
1852
1865
|
});
|
|
1853
1866
|
pluginManager.addAdapterType(function () {
|
|
1854
1867
|
return new AdapterType({
|
|
1855
1868
|
name: 'RefNameAliasAdapter',
|
|
1856
1869
|
configSchema: refNameAliasAdapterConfigSchema,
|
|
1857
|
-
AdapterClass: RefNameAliasAdapter
|
|
1870
|
+
AdapterClass: RefNameAliasAdapter,
|
|
1871
|
+
adapterMetadata: {
|
|
1872
|
+
category: null,
|
|
1873
|
+
hiddenFromGUI: true,
|
|
1874
|
+
displayName: null,
|
|
1875
|
+
description: null
|
|
1876
|
+
}
|
|
1858
1877
|
});
|
|
1859
1878
|
});
|
|
1860
1879
|
pluginManager.addWidgetType(function () {
|
|
@@ -1929,7 +1948,7 @@ var fontSize$1 = '12px'; // Optimize by using system default fonts:
|
|
|
1929
1948
|
// https://css-tricks.com/snippets/css/font-stacks/
|
|
1930
1949
|
|
|
1931
1950
|
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';
|
|
1932
|
-
var useStyles$2 = /*#__PURE__*/
|
|
1951
|
+
var useStyles$2 = /*#__PURE__*/core.makeStyles(function (theme) {
|
|
1933
1952
|
return {
|
|
1934
1953
|
callbackEditor: {
|
|
1935
1954
|
marginTop: '16px',
|
|
@@ -1970,7 +1989,7 @@ function CallbackEditor(_ref) {
|
|
|
1970
1989
|
}, [debouncedCode, slot]); // if default value is a callback, will have to remove jexl:
|
|
1971
1990
|
// do this last
|
|
1972
1991
|
|
|
1973
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(FormControl, null, /*#__PURE__*/React__default.createElement(InputLabel, {
|
|
1992
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(core.FormControl, null, /*#__PURE__*/React__default.createElement(core.InputLabel, {
|
|
1974
1993
|
shrink: true,
|
|
1975
1994
|
htmlFor: "callback-editor"
|
|
1976
1995
|
}, slot.name), /*#__PURE__*/React__default.createElement(Editor, {
|
|
@@ -1986,10 +2005,10 @@ function CallbackEditor(_ref) {
|
|
|
1986
2005
|
style: {
|
|
1987
2006
|
background: error ? '#fdd' : undefined
|
|
1988
2007
|
}
|
|
1989
|
-
}), /*#__PURE__*/React__default.createElement(FormHelperText, null, slot.description)), /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
2008
|
+
}), /*#__PURE__*/React__default.createElement(core.FormHelperText, null, slot.description)), /*#__PURE__*/React__default.createElement(core.Tooltip, {
|
|
1990
2009
|
title: /*#__PURE__*/React__default.createElement("div", null, "Callbacks are written in Jexl format. Click to learn more.", /*#__PURE__*/React__default.createElement("br", null), " Names of available context items: ", slot.contextVariable),
|
|
1991
2010
|
arrow: true
|
|
1992
|
-
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
2011
|
+
}, /*#__PURE__*/React__default.createElement(core.IconButton, {
|
|
1993
2012
|
color: "primary",
|
|
1994
2013
|
onClick: function onClick() {
|
|
1995
2014
|
var newWindow = window.open('https://github.com/TomFrost/Jexl', '_blank', 'noopener,noreferrer');
|
|
@@ -2017,7 +2036,7 @@ function serializeColor(color) {
|
|
|
2017
2036
|
g = color.g,
|
|
2018
2037
|
b = color.b,
|
|
2019
2038
|
a = color.a;
|
|
2020
|
-
return "rgb(".concat(r, ",").concat(g, ",").concat(b, ",").concat(a, ")");
|
|
2039
|
+
return a === undefined ? "rgb(".concat(r, ",").concat(g, ",").concat(b, ")") : "rgba(".concat(r, ",").concat(g, ",").concat(b, ",").concat(a, ")");
|
|
2021
2040
|
}
|
|
2022
2041
|
|
|
2023
2042
|
return color;
|