@jbrowse/plugin-config 2.0.0 → 2.1.2
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/ConfigurationEditorWidget/components/CallbackEditor.js +49 -57
- package/dist/ConfigurationEditorWidget/components/CallbackEditor.js.map +1 -1
- package/dist/ConfigurationEditorWidget/components/ColorEditor.js +14 -56
- package/dist/ConfigurationEditorWidget/components/ColorEditor.js.map +1 -1
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js +37 -74
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js.map +1 -1
- package/dist/ConfigurationEditorWidget/components/JsonEditor.d.ts +9 -7
- package/dist/ConfigurationEditorWidget/components/JsonEditor.js +42 -43
- package/dist/ConfigurationEditorWidget/components/JsonEditor.js.map +1 -1
- package/dist/ConfigurationEditorWidget/components/SlotEditor.d.ts +7 -5
- package/dist/ConfigurationEditorWidget/components/SlotEditor.js +97 -142
- package/dist/ConfigurationEditorWidget/components/SlotEditor.js.map +1 -1
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js +15 -32
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js.map +1 -1
- package/dist/ConfigurationEditorWidget/components/TypeSelector.js +7 -8
- package/dist/ConfigurationEditorWidget/components/TypeSelector.js.map +1 -1
- package/dist/ConfigurationEditorWidget/index.d.ts +10 -3
- package/dist/ConfigurationEditorWidget/index.js +9 -9
- package/dist/ConfigurationEditorWidget/index.js.map +1 -1
- package/dist/ConfigurationEditorWidget/model.d.ts +3 -2
- package/dist/ConfigurationEditorWidget/model.js +16 -17
- package/dist/ConfigurationEditorWidget/model.js.map +1 -1
- package/dist/FromConfigAdapter/FromConfigAdapter.js +44 -158
- package/dist/FromConfigAdapter/FromConfigAdapter.js.map +1 -1
- package/dist/FromConfigAdapter/FromConfigRegionsAdapter.js +37 -144
- package/dist/FromConfigAdapter/FromConfigRegionsAdapter.js.map +1 -1
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.d.ts +2 -1
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.js +48 -179
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.js.map +1 -1
- package/dist/FromConfigAdapter/configSchema.js +1 -1
- package/dist/FromConfigAdapter/configSchema.js.map +1 -1
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.js +22 -108
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.js.map +1 -1
- package/dist/RefNameAliasAdapter/configSchema.js +1 -1
- package/dist/RefNameAliasAdapter/configSchema.js.map +1 -1
- package/dist/index.js +60 -94
- package/dist/index.js.map +1 -1
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.js +28 -19
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.js.map +1 -1
- package/esm/ConfigurationEditorWidget/components/ColorEditor.js +6 -21
- package/esm/ConfigurationEditorWidget/components/ColorEditor.js.map +1 -1
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js +6 -2
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js.map +1 -1
- package/esm/ConfigurationEditorWidget/components/JsonEditor.d.ts +9 -7
- package/esm/ConfigurationEditorWidget/components/JsonEditor.js +38 -22
- package/esm/ConfigurationEditorWidget/components/JsonEditor.js.map +1 -1
- package/esm/ConfigurationEditorWidget/components/SlotEditor.d.ts +7 -5
- package/esm/ConfigurationEditorWidget/components/SlotEditor.js +33 -27
- package/esm/ConfigurationEditorWidget/components/SlotEditor.js.map +1 -1
- package/esm/ConfigurationEditorWidget/index.d.ts +10 -3
- package/esm/ConfigurationEditorWidget/index.js +4 -3
- package/esm/ConfigurationEditorWidget/index.js.map +1 -1
- package/esm/ConfigurationEditorWidget/model.d.ts +3 -2
- package/esm/ConfigurationEditorWidget/model.js +2 -1
- package/esm/ConfigurationEditorWidget/model.js.map +1 -1
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.d.ts +2 -1
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.js +1 -9
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.js.map +1 -1
- package/package.json +4 -6
- package/src/ConfigurationEditorWidget/components/CallbackEditor.tsx +44 -45
- package/src/ConfigurationEditorWidget/components/ColorEditor.tsx +6 -28
- package/src/ConfigurationEditorWidget/components/{ConfigurationEditor.test.js → ConfigurationEditor.test.tsx} +0 -0
- package/src/ConfigurationEditorWidget/components/ConfigurationEditor.tsx +6 -2
- package/src/ConfigurationEditorWidget/components/JsonEditor.tsx +84 -0
- package/src/ConfigurationEditorWidget/components/SlotEditor.tsx +484 -0
- package/src/ConfigurationEditorWidget/components/__snapshots__/{ConfigurationEditor.test.js.snap → ConfigurationEditor.test.tsx.snap} +186 -167
- package/src/ConfigurationEditorWidget/index.tsx +25 -0
- package/src/ConfigurationEditorWidget/{model.js → model.ts} +4 -2
- package/src/FromConfigAdapter/FromConfigSequenceAdapter.ts +6 -10
- package/dist/ConfigurationEditorWidget/components/CodeEditor.d.ts +0 -5
- package/dist/ConfigurationEditorWidget/components/CodeEditor.js +0 -85
- package/dist/ConfigurationEditorWidget/components/CodeEditor.js.map +0 -1
- package/dist/ConfigurationEditorWidget/components/ColorPicker.d.ts +0 -7
- package/dist/ConfigurationEditorWidget/components/ColorPicker.js +0 -69
- package/dist/ConfigurationEditorWidget/components/ColorPicker.js.map +0 -1
- package/esm/ConfigurationEditorWidget/components/CodeEditor.d.ts +0 -5
- package/esm/ConfigurationEditorWidget/components/CodeEditor.js +0 -42
- package/esm/ConfigurationEditorWidget/components/CodeEditor.js.map +0 -1
- package/esm/ConfigurationEditorWidget/components/ColorPicker.d.ts +0 -7
- package/esm/ConfigurationEditorWidget/components/ColorPicker.js +0 -26
- package/esm/ConfigurationEditorWidget/components/ColorPicker.js.map +0 -1
- package/src/ConfigurationEditorWidget/components/CodeEditor.tsx +0 -59
- package/src/ConfigurationEditorWidget/components/ColorPicker.tsx +0 -43
- package/src/ConfigurationEditorWidget/components/JsonEditor.js +0 -52
- package/src/ConfigurationEditorWidget/components/SlotEditor.js +0 -376
- package/src/ConfigurationEditorWidget/index.js +0 -20
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { observer } from 'mobx-react'
|
|
3
|
+
import { isStateTreeNode, getType } from 'mobx-state-tree'
|
|
4
|
+
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
5
|
+
|
|
6
|
+
export { default as stateModelFactory } from './model'
|
|
7
|
+
export const configSchema = ConfigurationSchema('ConfigurationEditorWidget', {})
|
|
8
|
+
export const HeadingComponent = observer(
|
|
9
|
+
({ model }: { model?: { target: { type: string } } }) => {
|
|
10
|
+
if (model?.target) {
|
|
11
|
+
if (model.target.type) {
|
|
12
|
+
return <>{`${model.target.type} settings`}</>
|
|
13
|
+
}
|
|
14
|
+
if (isStateTreeNode(model.target)) {
|
|
15
|
+
const type = getType(model.target)
|
|
16
|
+
if (type?.name) {
|
|
17
|
+
return (
|
|
18
|
+
<>{`${type.name.replace('ConfigurationSchema', '')} settings`}</>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return <>Settings</>
|
|
24
|
+
},
|
|
25
|
+
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { types } from 'mobx-state-tree'
|
|
2
2
|
import { ElementId } from '@jbrowse/core/util/types/mst'
|
|
3
|
+
import PluginManager from '@jbrowse/core/PluginManager'
|
|
3
4
|
|
|
4
|
-
export default pluginManager =>
|
|
5
|
+
export default (pluginManager: PluginManager) =>
|
|
5
6
|
types
|
|
6
7
|
.model('ConfigurationEditorWidget', {
|
|
7
8
|
id: ElementId,
|
|
@@ -13,7 +14,8 @@ export default pluginManager =>
|
|
|
13
14
|
),
|
|
14
15
|
})
|
|
15
16
|
.actions(self => ({
|
|
16
|
-
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
setTarget(newTarget: any) {
|
|
17
19
|
self.target = newTarget
|
|
18
20
|
},
|
|
19
21
|
}))
|
|
@@ -3,24 +3,20 @@ import { ObservableCreate } from '@jbrowse/core/util/rxjs'
|
|
|
3
3
|
import { NoAssemblyRegion } from '@jbrowse/core/util/types'
|
|
4
4
|
import { toArray } from 'rxjs/operators'
|
|
5
5
|
import FromConfigAdapter from './FromConfigAdapter'
|
|
6
|
+
import { RegionsAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
6
7
|
|
|
7
|
-
export default class FromConfigSequenceAdapter
|
|
8
|
+
export default class FromConfigSequenceAdapter
|
|
9
|
+
extends FromConfigAdapter
|
|
10
|
+
implements RegionsAdapter
|
|
11
|
+
{
|
|
8
12
|
/**
|
|
9
13
|
* Fetch features for a certain region
|
|
10
14
|
* @param region - Region
|
|
11
15
|
* @returns Observable of Feature objects in the region
|
|
12
16
|
*/
|
|
13
17
|
getFeatures(region: NoAssemblyRegion) {
|
|
14
|
-
// TODO: restore commented version below once TSDX supports Rollup v2
|
|
15
|
-
// xref: https://github.com/rollup/rollup/blob/master/CHANGELOG.md#bug-fixes-45
|
|
16
|
-
// return ObservableCreate<Feature>(async observer => {
|
|
17
|
-
// const feats = await super.getFeatures(region).pipe(toArray()).toPromise()
|
|
18
|
-
const superGetFeatures = super.getFeatures
|
|
19
18
|
return ObservableCreate<Feature>(async observer => {
|
|
20
|
-
const feats = await
|
|
21
|
-
.call(this, region)
|
|
22
|
-
.pipe(toArray())
|
|
23
|
-
.toPromise()
|
|
19
|
+
const feats = await super.getFeatures(region).pipe(toArray()).toPromise()
|
|
24
20
|
const feat = feats[0]
|
|
25
21
|
observer.next(
|
|
26
22
|
new SimpleFeature({
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
26
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
27
|
-
if (!m) return o;
|
|
28
|
-
var i = m.call(o), r, ar = [], e;
|
|
29
|
-
try {
|
|
30
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
31
|
-
}
|
|
32
|
-
catch (error) { e = { error: error }; }
|
|
33
|
-
finally {
|
|
34
|
-
try {
|
|
35
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
36
|
-
}
|
|
37
|
-
finally { if (e) throw e.error; }
|
|
38
|
-
}
|
|
39
|
-
return ar;
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var react_1 = __importStar(require("react"));
|
|
43
|
-
var material_1 = require("@mui/material");
|
|
44
|
-
var mui_1 = require("tss-react/mui");
|
|
45
|
-
// fontSize and fontFamily have to match between Editor and SyntaxHighlighter
|
|
46
|
-
var fontSize = '12px';
|
|
47
|
-
// Optimize by using system default fonts: https://css-tricks.com/snippets/css/font-stacks/
|
|
48
|
-
var fontFamily = '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';
|
|
49
|
-
var useStyles = (0, mui_1.makeStyles)()(function (theme) { return ({
|
|
50
|
-
callbackEditor: {
|
|
51
|
-
fontFamily: fontFamily,
|
|
52
|
-
fontSize: fontSize,
|
|
53
|
-
background: theme.palette.background.default,
|
|
54
|
-
overflowX: 'auto',
|
|
55
|
-
marginTop: '16px',
|
|
56
|
-
border: '1px solid rgba(0,0,0,0.42)',
|
|
57
|
-
},
|
|
58
|
-
textAreaFont: {
|
|
59
|
-
fontFamily: fontFamily,
|
|
60
|
-
},
|
|
61
|
-
}); });
|
|
62
|
-
function CodeEditor(_a) {
|
|
63
|
-
var contents = _a.contents, setContents = _a.setContents;
|
|
64
|
-
var classes = useStyles().classes;
|
|
65
|
-
var _b = __read((0, react_1.useState)(), 2), error = _b[0], setCodeError = _b[1];
|
|
66
|
-
var _c = __read((0, react_1.useState)(contents), 2), val = _c[0], setVal = _c[1];
|
|
67
|
-
(0, react_1.useEffect)(function () {
|
|
68
|
-
try {
|
|
69
|
-
JSON.parse(contents);
|
|
70
|
-
setCodeError(undefined);
|
|
71
|
-
setContents(val);
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
console.error({ e: e });
|
|
75
|
-
setCodeError(e);
|
|
76
|
-
}
|
|
77
|
-
}, [val, contents, setContents]);
|
|
78
|
-
return (react_1.default.createElement(material_1.TextField, { className: classes.callbackEditor, value: contents, onChange: function (event) { return setVal(event.target.value); }, style: { background: error ? '#fdd' : undefined }, InputProps: {
|
|
79
|
-
classes: {
|
|
80
|
-
input: classes.textAreaFont,
|
|
81
|
-
},
|
|
82
|
-
} }));
|
|
83
|
-
}
|
|
84
|
-
exports.default = CodeEditor;
|
|
85
|
-
//# sourceMappingURL=CodeEditor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.js","sourceRoot":"","sources":["../../../src/ConfigurationEditorWidget/components/CodeEditor.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAkD;AAClD,0CAAyC;AACzC,qCAA0C;AAE1C,6EAA6E;AAC7E,IAAM,QAAQ,GAAG,MAAM,CAAA;AACvB,2FAA2F;AAC3F,IAAM,UAAU,GACd,sNAAsN,CAAA;AAExN,IAAM,SAAS,GAAG,IAAA,gBAAU,GAAE,CAAC,UAAA,KAAK,IAAI,OAAA,CAAC;IACvC,cAAc,EAAE;QACd,UAAU,YAAA;QACV,QAAQ,UAAA;QACR,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO;QAC5C,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,MAAM;QACjB,MAAM,EAAE,4BAA4B;KACrC;IACD,YAAY,EAAE;QACZ,UAAU,YAAA;KACX;CACF,CAAC,EAZsC,CAYtC,CAAC,CAAA;AAEH,SAAwB,UAAU,CAAC,EAMlC;QALC,QAAQ,cAAA,EACR,WAAW,iBAAA;IAKH,IAAA,OAAO,GAAK,SAAS,EAAE,QAAhB,CAAgB;IACzB,IAAA,KAAA,OAAwB,IAAA,gBAAQ,GAAW,IAAA,EAA1C,KAAK,QAAA,EAAE,YAAY,QAAuB,CAAA;IAC3C,IAAA,KAAA,OAAgB,IAAA,gBAAQ,EAAC,QAAQ,CAAC,IAAA,EAAjC,GAAG,QAAA,EAAE,MAAM,QAAsB,CAAA;IACxC,IAAA,iBAAS,EAAC;QACR,IAAI;YACF,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;YACpB,YAAY,CAAC,SAAS,CAAC,CAAA;YACvB,WAAW,CAAC,GAAG,CAAC,CAAA;SACjB;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,GAAA,EAAE,CAAC,CAAA;YACpB,YAAY,CAAC,CAAC,CAAC,CAAA;SAChB;IACH,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAA;IAEhC,OAAO,CACL,8BAAC,oBAAS,IACR,SAAS,EAAE,OAAO,CAAC,cAAc,EACjC,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,UAAA,KAAK,IAAI,OAAA,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAA1B,CAA0B,EAC7C,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAAE,EACjD,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,KAAK,EAAE,OAAO,CAAC,YAAY;aAC5B;SACF,GACD,CACH,CAAA;AACH,CAAC;AAlCD,6BAkCC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
26
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
27
|
-
if (!m) return o;
|
|
28
|
-
var i = m.call(o), r, ar = [], e;
|
|
29
|
-
try {
|
|
30
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
31
|
-
}
|
|
32
|
-
catch (error) { e = { error: error }; }
|
|
33
|
-
finally {
|
|
34
|
-
try {
|
|
35
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
36
|
-
}
|
|
37
|
-
finally { if (e) throw e.error; }
|
|
38
|
-
}
|
|
39
|
-
return ar;
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.ColorPicker = void 0;
|
|
43
|
-
var react_1 = __importStar(require("react"));
|
|
44
|
-
var mui_1 = require("tss-react/mui");
|
|
45
|
-
var react_color_1 = require("react-color");
|
|
46
|
-
var useStyles = (0, mui_1.makeStyles)()({
|
|
47
|
-
popover: {
|
|
48
|
-
position: 'absolute',
|
|
49
|
-
zIndex: 2,
|
|
50
|
-
},
|
|
51
|
-
cover: {
|
|
52
|
-
position: 'fixed',
|
|
53
|
-
top: 0,
|
|
54
|
-
right: 0,
|
|
55
|
-
bottom: 0,
|
|
56
|
-
left: 0,
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
function ColorPicker(props) {
|
|
60
|
-
var color = props.color, onChange = props.onChange;
|
|
61
|
-
var classes = useStyles().classes;
|
|
62
|
-
var _a = __read((0, react_1.useState)(true), 2), displayColorPicker = _a[0], setDisplayColorPicker = _a[1];
|
|
63
|
-
return (react_1.default.createElement("div", null, displayColorPicker ? (react_1.default.createElement("div", { className: classes.popover },
|
|
64
|
-
react_1.default.createElement("div", { role: "presentation", className: classes.cover, onClick: function () { return setDisplayColorPicker(false); } }),
|
|
65
|
-
react_1.default.createElement(react_color_1.ChromePicker, { color: color, onChange: onChange }))) : null));
|
|
66
|
-
}
|
|
67
|
-
exports.ColorPicker = ColorPicker;
|
|
68
|
-
exports.default = ColorPicker;
|
|
69
|
-
//# sourceMappingURL=ColorPicker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/ConfigurationEditorWidget/components/ColorPicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AACvC,qCAA0C;AAC1C,2CAA8D;AAE9D,IAAM,SAAS,GAAG,IAAA,gBAAU,GAAE,CAAC;IAC7B,OAAO,EAAE;QACP,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,CAAC;KACV;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,OAAO;QACjB,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAA;AAEF,SAAgB,WAAW,CAAC,KAG3B;IACS,IAAA,KAAK,GAAe,KAAK,MAApB,EAAE,QAAQ,GAAK,KAAK,SAAV,CAAU;IACzB,IAAA,OAAO,GAAK,SAAS,EAAE,QAAhB,CAAgB;IACzB,IAAA,KAAA,OAA8C,IAAA,gBAAQ,EAAC,IAAI,CAAC,IAAA,EAA3D,kBAAkB,QAAA,EAAE,qBAAqB,QAAkB,CAAA;IAElE,OAAO,CACL,2CACG,kBAAkB,CAAC,CAAC,CAAC,CACpB,uCAAK,SAAS,EAAE,OAAO,CAAC,OAAO;QAC7B,uCACE,IAAI,EAAC,cAAc,EACnB,SAAS,EAAE,OAAO,CAAC,KAAK,EACxB,OAAO,EAAE,cAAM,OAAA,qBAAqB,CAAC,KAAK,CAAC,EAA5B,CAA4B,GAC3C;QACF,8BAAC,0BAAY,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAC9C,CACP,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAA;AACH,CAAC;AAtBD,kCAsBC;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { TextField } from '@mui/material';
|
|
3
|
-
import { makeStyles } from 'tss-react/mui';
|
|
4
|
-
// fontSize and fontFamily have to match between Editor and SyntaxHighlighter
|
|
5
|
-
const fontSize = '12px';
|
|
6
|
-
// Optimize by using system default fonts: https://css-tricks.com/snippets/css/font-stacks/
|
|
7
|
-
const fontFamily = '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';
|
|
8
|
-
const useStyles = makeStyles()(theme => ({
|
|
9
|
-
callbackEditor: {
|
|
10
|
-
fontFamily,
|
|
11
|
-
fontSize,
|
|
12
|
-
background: theme.palette.background.default,
|
|
13
|
-
overflowX: 'auto',
|
|
14
|
-
marginTop: '16px',
|
|
15
|
-
border: '1px solid rgba(0,0,0,0.42)',
|
|
16
|
-
},
|
|
17
|
-
textAreaFont: {
|
|
18
|
-
fontFamily,
|
|
19
|
-
},
|
|
20
|
-
}));
|
|
21
|
-
export default function CodeEditor({ contents, setContents, }) {
|
|
22
|
-
const { classes } = useStyles();
|
|
23
|
-
const [error, setCodeError] = useState();
|
|
24
|
-
const [val, setVal] = useState(contents);
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
try {
|
|
27
|
-
JSON.parse(contents);
|
|
28
|
-
setCodeError(undefined);
|
|
29
|
-
setContents(val);
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
console.error({ e });
|
|
33
|
-
setCodeError(e);
|
|
34
|
-
}
|
|
35
|
-
}, [val, contents, setContents]);
|
|
36
|
-
return (React.createElement(TextField, { className: classes.callbackEditor, value: contents, onChange: event => setVal(event.target.value), style: { background: error ? '#fdd' : undefined }, InputProps: {
|
|
37
|
-
classes: {
|
|
38
|
-
input: classes.textAreaFont,
|
|
39
|
-
},
|
|
40
|
-
} }));
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=CodeEditor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.js","sourceRoot":"","sources":["../../../src/ConfigurationEditorWidget/components/CodeEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,6EAA6E;AAC7E,MAAM,QAAQ,GAAG,MAAM,CAAA;AACvB,2FAA2F;AAC3F,MAAM,UAAU,GACd,sNAAsN,CAAA;AAExN,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvC,cAAc,EAAE;QACd,UAAU;QACV,QAAQ;QACR,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO;QAC5C,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,MAAM;QACjB,MAAM,EAAE,4BAA4B;KACrC;IACD,YAAY,EAAE;QACZ,UAAU;KACX;CACF,CAAC,CAAC,CAAA;AAEH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,QAAQ,EACR,WAAW,GAIZ;IACC,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAA;IAC/B,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAW,CAAA;IACjD,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACxC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI;YACF,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;YACpB,YAAY,CAAC,SAAS,CAAC,CAAA;YACvB,WAAW,CAAC,GAAG,CAAC,CAAA;SACjB;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;YACpB,YAAY,CAAC,CAAC,CAAC,CAAA;SAChB;IACH,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAA;IAEhC,OAAO,CACL,oBAAC,SAAS,IACR,SAAS,EAAE,OAAO,CAAC,cAAc,EACjC,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAC7C,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAAE,EACjD,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,KAAK,EAAE,OAAO,CAAC,YAAY;aAC5B;SACF,GACD,CACH,CAAA;AACH,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { makeStyles } from 'tss-react/mui';
|
|
3
|
-
import { ChromePicker } from 'react-color';
|
|
4
|
-
const useStyles = makeStyles()({
|
|
5
|
-
popover: {
|
|
6
|
-
position: 'absolute',
|
|
7
|
-
zIndex: 2,
|
|
8
|
-
},
|
|
9
|
-
cover: {
|
|
10
|
-
position: 'fixed',
|
|
11
|
-
top: 0,
|
|
12
|
-
right: 0,
|
|
13
|
-
bottom: 0,
|
|
14
|
-
left: 0,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
export function ColorPicker(props) {
|
|
18
|
-
const { color, onChange } = props;
|
|
19
|
-
const { classes } = useStyles();
|
|
20
|
-
const [displayColorPicker, setDisplayColorPicker] = useState(true);
|
|
21
|
-
return (React.createElement("div", null, displayColorPicker ? (React.createElement("div", { className: classes.popover },
|
|
22
|
-
React.createElement("div", { role: "presentation", className: classes.cover, onClick: () => setDisplayColorPicker(false) }),
|
|
23
|
-
React.createElement(ChromePicker, { color: color, onChange: onChange }))) : null));
|
|
24
|
-
}
|
|
25
|
-
export default ColorPicker;
|
|
26
|
-
//# sourceMappingURL=ColorPicker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/ConfigurationEditorWidget/components/ColorPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAsB,MAAM,aAAa,CAAA;AAE9D,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;IAC7B,OAAO,EAAE;QACP,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,CAAC;KACV;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,OAAO;QACjB,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAA;AAEF,MAAM,UAAU,WAAW,CAAC,KAG3B;IACC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;IACjC,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAA;IAC/B,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;IAElE,OAAO,CACL,iCACG,kBAAkB,CAAC,CAAC,CAAC,CACpB,6BAAK,SAAS,EAAE,OAAO,CAAC,OAAO;QAC7B,6BACE,IAAI,EAAC,cAAc,EACnB,SAAS,EAAE,OAAO,CAAC,KAAK,EACxB,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC,GAC3C;QACF,oBAAC,YAAY,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAC9C,CACP,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAA;AACH,CAAC;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { TextField } from '@mui/material'
|
|
3
|
-
import { makeStyles } from 'tss-react/mui'
|
|
4
|
-
|
|
5
|
-
// fontSize and fontFamily have to match between Editor and SyntaxHighlighter
|
|
6
|
-
const fontSize = '12px'
|
|
7
|
-
// Optimize by using system default fonts: https://css-tricks.com/snippets/css/font-stacks/
|
|
8
|
-
const fontFamily =
|
|
9
|
-
'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'
|
|
10
|
-
|
|
11
|
-
const useStyles = makeStyles()(theme => ({
|
|
12
|
-
callbackEditor: {
|
|
13
|
-
fontFamily,
|
|
14
|
-
fontSize,
|
|
15
|
-
background: theme.palette.background.default,
|
|
16
|
-
overflowX: 'auto',
|
|
17
|
-
marginTop: '16px',
|
|
18
|
-
border: '1px solid rgba(0,0,0,0.42)',
|
|
19
|
-
},
|
|
20
|
-
textAreaFont: {
|
|
21
|
-
fontFamily,
|
|
22
|
-
},
|
|
23
|
-
}))
|
|
24
|
-
|
|
25
|
-
export default function CodeEditor({
|
|
26
|
-
contents,
|
|
27
|
-
setContents,
|
|
28
|
-
}: {
|
|
29
|
-
contents: string
|
|
30
|
-
setContents: (arg: string) => void
|
|
31
|
-
}) {
|
|
32
|
-
const { classes } = useStyles()
|
|
33
|
-
const [error, setCodeError] = useState<unknown>()
|
|
34
|
-
const [val, setVal] = useState(contents)
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
try {
|
|
37
|
-
JSON.parse(contents)
|
|
38
|
-
setCodeError(undefined)
|
|
39
|
-
setContents(val)
|
|
40
|
-
} catch (e) {
|
|
41
|
-
console.error({ e })
|
|
42
|
-
setCodeError(e)
|
|
43
|
-
}
|
|
44
|
-
}, [val, contents, setContents])
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<TextField
|
|
48
|
-
className={classes.callbackEditor}
|
|
49
|
-
value={contents}
|
|
50
|
-
onChange={event => setVal(event.target.value)}
|
|
51
|
-
style={{ background: error ? '#fdd' : undefined }}
|
|
52
|
-
InputProps={{
|
|
53
|
-
classes: {
|
|
54
|
-
input: classes.textAreaFont,
|
|
55
|
-
},
|
|
56
|
-
}}
|
|
57
|
-
/>
|
|
58
|
-
)
|
|
59
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import { makeStyles } from 'tss-react/mui'
|
|
3
|
-
import { ChromePicker, Color, ColorResult } from 'react-color'
|
|
4
|
-
|
|
5
|
-
const useStyles = makeStyles()({
|
|
6
|
-
popover: {
|
|
7
|
-
position: 'absolute',
|
|
8
|
-
zIndex: 2,
|
|
9
|
-
},
|
|
10
|
-
cover: {
|
|
11
|
-
position: 'fixed',
|
|
12
|
-
top: 0,
|
|
13
|
-
right: 0,
|
|
14
|
-
bottom: 0,
|
|
15
|
-
left: 0,
|
|
16
|
-
},
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
export function ColorPicker(props: {
|
|
20
|
-
color: Color
|
|
21
|
-
onChange: (color: ColorResult) => void
|
|
22
|
-
}) {
|
|
23
|
-
const { color, onChange } = props
|
|
24
|
-
const { classes } = useStyles()
|
|
25
|
-
const [displayColorPicker, setDisplayColorPicker] = useState(true)
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div>
|
|
29
|
-
{displayColorPicker ? (
|
|
30
|
-
<div className={classes.popover}>
|
|
31
|
-
<div
|
|
32
|
-
role="presentation"
|
|
33
|
-
className={classes.cover}
|
|
34
|
-
onClick={() => setDisplayColorPicker(false)}
|
|
35
|
-
/>
|
|
36
|
-
<ChromePicker color={color} onChange={onChange} />
|
|
37
|
-
</div>
|
|
38
|
-
) : null}
|
|
39
|
-
</div>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default ColorPicker
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React, { lazy, useEffect, useState } from 'react'
|
|
2
|
-
import { useDebounce } from '@jbrowse/core/util'
|
|
3
|
-
import { FormControl, FormHelperText, InputLabel } from '@mui/material'
|
|
4
|
-
import { makeStyles } from 'tss-react/mui'
|
|
5
|
-
import { observer, PropTypes } from 'mobx-react'
|
|
6
|
-
const useStyles = makeStyles()({
|
|
7
|
-
error: {
|
|
8
|
-
color: 'red',
|
|
9
|
-
fontSize: '0.8em',
|
|
10
|
-
},
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const CodeEditor = lazy(() => import('./CodeEditor'))
|
|
14
|
-
|
|
15
|
-
function JsonEditor({ slot }) {
|
|
16
|
-
const { classes } = useStyles()
|
|
17
|
-
const [contents, setContents] = useState(
|
|
18
|
-
JSON.stringify(slot.value, null, ' '),
|
|
19
|
-
)
|
|
20
|
-
const [error, setError] = useState()
|
|
21
|
-
const debouncedJson = useDebounce(contents, 400)
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
try {
|
|
25
|
-
slot.set(JSON.parse(debouncedJson))
|
|
26
|
-
setError(undefined)
|
|
27
|
-
} catch (e) {
|
|
28
|
-
setError(e.message)
|
|
29
|
-
}
|
|
30
|
-
}, [debouncedJson, slot])
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<>
|
|
34
|
-
{error ? <p className={classes.error}>{error}</p> : null}
|
|
35
|
-
<FormControl error={error}>
|
|
36
|
-
<InputLabel shrink htmlFor="callback-editor">
|
|
37
|
-
{slot.name}
|
|
38
|
-
</InputLabel>
|
|
39
|
-
<React.Suspense fallback={<div />}>
|
|
40
|
-
<CodeEditor contents={contents} setContents={setContents} />
|
|
41
|
-
</React.Suspense>
|
|
42
|
-
<FormHelperText>{slot.description}</FormHelperText>
|
|
43
|
-
</FormControl>
|
|
44
|
-
</>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
JsonEditor.propTypes = {
|
|
49
|
-
slot: PropTypes.objectOrObservableObject.isRequired,
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default observer(JsonEditor)
|