@jbrowse/plugin-config 1.7.11 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ConfigurationEditorWidget/components/CallbackEditor.d.ts +10 -7
- package/dist/ConfigurationEditorWidget/components/CallbackEditor.js +108 -115
- package/dist/ConfigurationEditorWidget/components/CallbackEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/CodeEditor.d.ts +4 -3
- package/dist/ConfigurationEditorWidget/components/CodeEditor.js +78 -73
- package/dist/ConfigurationEditorWidget/components/CodeEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/ColorEditor.d.ts +9 -33
- package/dist/ConfigurationEditorWidget/components/ColorEditor.js +82 -116
- package/dist/ConfigurationEditorWidget/components/ColorEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/ColorPicker.d.ts +0 -7
- package/dist/ConfigurationEditorWidget/components/ColorPicker.js +64 -67
- package/dist/ConfigurationEditorWidget/components/ColorPicker.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.d.ts +7 -3
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js +113 -160
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/JsonEditor.js +74 -75
- package/dist/ConfigurationEditorWidget/components/JsonEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/SlotEditor.d.ts +11 -1
- package/dist/ConfigurationEditorWidget/components/SlotEditor.js +229 -373
- package/dist/ConfigurationEditorWidget/components/SlotEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js +76 -105
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/TypeSelector.d.ts +8 -6
- package/dist/ConfigurationEditorWidget/components/TypeSelector.js +16 -46
- package/dist/ConfigurationEditorWidget/components/TypeSelector.js.map +1 -0
- package/dist/ConfigurationEditorWidget/index.js +25 -42
- package/dist/ConfigurationEditorWidget/index.js.map +1 -0
- package/dist/ConfigurationEditorWidget/model.js +18 -26
- package/dist/ConfigurationEditorWidget/model.js.map +1 -0
- package/dist/FromConfigAdapter/FromConfigAdapter.js +172 -204
- package/dist/FromConfigAdapter/FromConfigAdapter.js.map +1 -0
- package/dist/FromConfigAdapter/FromConfigRegionsAdapter.js +151 -142
- package/dist/FromConfigAdapter/FromConfigRegionsAdapter.js.map +1 -0
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.js +182 -181
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.js.map +1 -0
- package/dist/FromConfigAdapter/configSchema.js +33 -49
- package/dist/FromConfigAdapter/configSchema.js.map +1 -0
- package/dist/FromConfigAdapter/index.js +16 -50
- package/dist/FromConfigAdapter/index.js.map +1 -0
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.js +111 -125
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.js.map +1 -0
- package/dist/RefNameAliasAdapter/configSchema.js +16 -25
- package/dist/RefNameAliasAdapter/configSchema.js.map +1 -0
- package/dist/RefNameAliasAdapter/index.js +10 -22
- package/dist/RefNameAliasAdapter/index.js.map +1 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.js +129 -144
- package/dist/index.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.d.ts +12 -0
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.js +71 -0
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/CodeEditor.d.ts +5 -0
- package/esm/ConfigurationEditorWidget/components/CodeEditor.js +42 -0
- package/esm/ConfigurationEditorWidget/components/CodeEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/ColorEditor.d.ts +20 -0
- package/esm/ConfigurationEditorWidget/components/ColorEditor.js +37 -0
- package/esm/ConfigurationEditorWidget/components/ColorEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/ColorPicker.d.ts +7 -0
- package/esm/ConfigurationEditorWidget/components/ColorPicker.js +26 -0
- package/esm/ConfigurationEditorWidget/components/ColorPicker.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.d.ts +8 -0
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js +83 -0
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/JsonEditor.d.ts +9 -0
- package/esm/ConfigurationEditorWidget/components/JsonEditor.js +39 -0
- package/esm/ConfigurationEditorWidget/components/JsonEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/SlotEditor.d.ts +16 -0
- package/esm/ConfigurationEditorWidget/components/SlotEditor.js +176 -0
- package/esm/ConfigurationEditorWidget/components/SlotEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/StringArrayEditor.d.ts +12 -0
- package/esm/ConfigurationEditorWidget/components/StringArrayEditor.js +36 -0
- package/esm/ConfigurationEditorWidget/components/StringArrayEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/TypeSelector.d.ts +9 -0
- package/esm/ConfigurationEditorWidget/components/TypeSelector.js +12 -0
- package/esm/ConfigurationEditorWidget/components/TypeSelector.js.map +1 -0
- package/esm/ConfigurationEditorWidget/index.d.ts +3 -0
- package/esm/ConfigurationEditorWidget/index.js +20 -0
- package/esm/ConfigurationEditorWidget/index.js.map +1 -0
- package/esm/ConfigurationEditorWidget/model.d.ts +8 -0
- package/esm/ConfigurationEditorWidget/model.js +16 -0
- package/esm/ConfigurationEditorWidget/model.js.map +1 -0
- package/esm/FromConfigAdapter/FromConfigAdapter.d.ts +24 -0
- package/esm/FromConfigAdapter/FromConfigAdapter.js +63 -0
- package/esm/FromConfigAdapter/FromConfigAdapter.js.map +1 -0
- package/esm/FromConfigAdapter/FromConfigRegionsAdapter.d.ts +23 -0
- package/esm/FromConfigAdapter/FromConfigRegionsAdapter.js +50 -0
- package/esm/FromConfigAdapter/FromConfigRegionsAdapter.js.map +1 -0
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.d.ts +25 -0
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.js +73 -0
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.js.map +1 -0
- package/esm/FromConfigAdapter/configSchema.d.ts +3 -0
- package/esm/FromConfigAdapter/configSchema.js +32 -0
- package/esm/FromConfigAdapter/configSchema.js.map +1 -0
- package/esm/FromConfigAdapter/index.d.ts +4 -0
- package/esm/FromConfigAdapter/index.js +5 -0
- package/esm/FromConfigAdapter/index.js.map +1 -0
- package/esm/RefNameAliasAdapter/RefNameAliasAdapter.d.ts +8 -0
- package/esm/RefNameAliasAdapter/RefNameAliasAdapter.js +24 -0
- package/esm/RefNameAliasAdapter/RefNameAliasAdapter.js.map +1 -0
- package/esm/RefNameAliasAdapter/configSchema.d.ts +2 -0
- package/esm/RefNameAliasAdapter/configSchema.js +15 -0
- package/esm/RefNameAliasAdapter/configSchema.js.map +1 -0
- package/esm/RefNameAliasAdapter/index.d.ts +2 -0
- package/esm/RefNameAliasAdapter/index.js +3 -0
- package/esm/RefNameAliasAdapter/index.js.map +1 -0
- package/esm/index.d.ts +18 -0
- package/esm/index.js +72 -0
- package/esm/index.js.map +1 -0
- package/package.json +20 -13
- package/src/ConfigurationEditorWidget/components/{CallbackEditor.js → CallbackEditor.tsx} +36 -21
- package/src/ConfigurationEditorWidget/components/CodeEditor.tsx +59 -0
- package/src/ConfigurationEditorWidget/components/ColorEditor.tsx +8 -33
- package/src/ConfigurationEditorWidget/components/ColorPicker.tsx +4 -13
- package/src/ConfigurationEditorWidget/components/ConfigurationEditor.tsx +169 -0
- package/src/ConfigurationEditorWidget/components/JsonEditor.js +4 -8
- package/src/ConfigurationEditorWidget/components/SlotEditor.js +10 -11
- package/src/ConfigurationEditorWidget/components/StringArrayEditor.tsx +2 -2
- package/src/ConfigurationEditorWidget/components/{TypeSelector.js → TypeSelector.tsx} +15 -7
- package/src/ConfigurationEditorWidget/components/__snapshots__/ConfigurationEditor.test.js.snap +877 -625
- package/src/index.ts +20 -14
- package/dist/ConfigurationEditorWidget/components/ColorEditor.test.js +0 -31
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.test.js +0 -121
- package/dist/FromConfigAdapter/FromConfigAdapter.test.js +0 -100
- package/dist/FromConfigAdapter/FromConfigRegionsAdapter.test.js +0 -200
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.test.js +0 -110
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.test.js +0 -41
- package/dist/index.test.js +0 -41
- package/src/ConfigurationEditorWidget/components/CodeEditor.js +0 -60
- package/src/ConfigurationEditorWidget/components/ConfigurationEditor.js +0 -154
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseAdapter, RegionsAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
+
import { ConfigurationModel } from '@jbrowse/core/configuration/configurationSchema';
|
|
3
|
+
import { configSchema as FromConfigAdapterConfigSchema } from './configSchema';
|
|
4
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
5
|
+
import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
6
|
+
/**
|
|
7
|
+
* Adapter that just returns the features defined in its `features` configuration
|
|
8
|
+
* key, like:
|
|
9
|
+
* `"features": [ { "refName": "ctgA", "start":1, "end":20 }, ... ]`
|
|
10
|
+
*/
|
|
11
|
+
export default class FromConfigRegionsAdapter extends BaseAdapter implements RegionsAdapter {
|
|
12
|
+
private features;
|
|
13
|
+
constructor(config: ConfigurationModel<typeof FromConfigAdapterConfigSchema>, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
|
|
14
|
+
/**
|
|
15
|
+
* Get refName, start, and end for all features after collapsing any overlaps
|
|
16
|
+
*/
|
|
17
|
+
getRegions(): Promise<{
|
|
18
|
+
refName: string;
|
|
19
|
+
start: number;
|
|
20
|
+
end: number;
|
|
21
|
+
}[]>;
|
|
22
|
+
freeResources(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { BaseAdapter, } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
+
import { readConfObject } from '@jbrowse/core/configuration';
|
|
3
|
+
import FromConfigAdapter from './FromConfigAdapter';
|
|
4
|
+
/**
|
|
5
|
+
* Adapter that just returns the features defined in its `features` configuration
|
|
6
|
+
* key, like:
|
|
7
|
+
* `"features": [ { "refName": "ctgA", "start":1, "end":20 }, ... ]`
|
|
8
|
+
*/
|
|
9
|
+
export default class FromConfigRegionsAdapter extends BaseAdapter {
|
|
10
|
+
constructor(config, getSubAdapter, pluginManager) {
|
|
11
|
+
super(config, getSubAdapter, pluginManager);
|
|
12
|
+
const features = readConfObject(config, 'features');
|
|
13
|
+
this.features = FromConfigAdapter.makeFeatures(features || []);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get refName, start, and end for all features after collapsing any overlaps
|
|
17
|
+
*/
|
|
18
|
+
async getRegions() {
|
|
19
|
+
const regions = [];
|
|
20
|
+
// recall: features are stored in this object sorted by start coordinate
|
|
21
|
+
for (const [refName, features] of this.features) {
|
|
22
|
+
let currentRegion;
|
|
23
|
+
for (const feature of features) {
|
|
24
|
+
if (currentRegion &&
|
|
25
|
+
currentRegion.end >= feature.get('start') &&
|
|
26
|
+
currentRegion.start <= feature.get('end')) {
|
|
27
|
+
currentRegion.end = feature.get('end');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
if (currentRegion) {
|
|
31
|
+
regions.push(currentRegion);
|
|
32
|
+
}
|
|
33
|
+
currentRegion = {
|
|
34
|
+
refName,
|
|
35
|
+
start: feature.get('start'),
|
|
36
|
+
end: feature.get('end'),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (currentRegion) {
|
|
41
|
+
regions.push(currentRegion);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// sort the regions by refName
|
|
45
|
+
regions.sort((a, b) => a.refName.localeCompare(b.refName));
|
|
46
|
+
return regions;
|
|
47
|
+
}
|
|
48
|
+
freeResources( /* { region } */) { }
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=FromConfigRegionsAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FromConfigRegionsAdapter.js","sourceRoot":"","sources":["../../src/FromConfigAdapter/FromConfigRegionsAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAEZ,MAAM,yCAAyC,CAAA;AAKhD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAG5D,OAAO,iBAAiB,MAAM,qBAAqB,CAAA;AAInD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,wBACnB,SAAQ,WAAW;IAKnB,YACE,MAAgE,EAChE,aAAiC,EACjC,aAA6B;QAE7B,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,CAAC,CAAA;QAC3C,MAAM,QAAQ,GAAG,cAAc,CAC7B,MAAM,EACN,UAAU,CACkB,CAAA;QAC9B,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC,YAAY,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAA;IAChE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,MAAM,OAAO,GAAG,EAAE,CAAA;QAElB,wEAAwE;QACxE,KAAK,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE;YAC/C,IAAI,aAAa,CAAA;YACjB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;gBAC9B,IACE,aAAa;oBACb,aAAa,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;oBACzC,aAAa,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EACzC;oBACA,aAAa,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;iBACvC;qBAAM;oBACL,IAAI,aAAa,EAAE;wBACjB,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;qBAC5B;oBACD,aAAa,GAAG;wBACd,OAAO;wBACP,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;wBAC3B,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;qBACxB,CAAA;iBACF;aACF;YACD,IAAI,aAAa,EAAE;gBACjB,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;aAC5B;SACF;QAED,8BAA8B;QAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;QAE1D,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,aAAa,EAAC,gBAAgB,IAAS,CAAC;CACzC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
2
|
+
import { NoAssemblyRegion } from '@jbrowse/core/util/types';
|
|
3
|
+
import FromConfigAdapter from './FromConfigAdapter';
|
|
4
|
+
export default class FromConfigSequenceAdapter extends FromConfigAdapter {
|
|
5
|
+
/**
|
|
6
|
+
* Fetch features for a certain region
|
|
7
|
+
* @param region - Region
|
|
8
|
+
* @returns Observable of Feature objects in the region
|
|
9
|
+
*/
|
|
10
|
+
getFeatures(region: NoAssemblyRegion): import("rxjs").Observable<Feature>;
|
|
11
|
+
/**
|
|
12
|
+
* Get refName, start, and end for all features after collapsing any overlaps
|
|
13
|
+
*/
|
|
14
|
+
getRegions(): Promise<{
|
|
15
|
+
refName: string;
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
}[]>;
|
|
19
|
+
/**
|
|
20
|
+
* called to provide a hint that data tied to a certain region
|
|
21
|
+
* will not be needed for the forseeable future and can be purged
|
|
22
|
+
* from caches, etc
|
|
23
|
+
*/
|
|
24
|
+
freeResources(): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import SimpleFeature from '@jbrowse/core/util/simpleFeature';
|
|
2
|
+
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
3
|
+
import { toArray } from 'rxjs/operators';
|
|
4
|
+
import FromConfigAdapter from './FromConfigAdapter';
|
|
5
|
+
export default class FromConfigSequenceAdapter extends FromConfigAdapter {
|
|
6
|
+
/**
|
|
7
|
+
* Fetch features for a certain region
|
|
8
|
+
* @param region - Region
|
|
9
|
+
* @returns Observable of Feature objects in the region
|
|
10
|
+
*/
|
|
11
|
+
getFeatures(region) {
|
|
12
|
+
// TODO: restore commented version below once TSDX supports Rollup v2
|
|
13
|
+
// xref: https://github.com/rollup/rollup/blob/master/CHANGELOG.md#bug-fixes-45
|
|
14
|
+
// return ObservableCreate<Feature>(async observer => {
|
|
15
|
+
// const feats = await super.getFeatures(region).pipe(toArray()).toPromise()
|
|
16
|
+
const superGetFeatures = super.getFeatures;
|
|
17
|
+
return ObservableCreate(async (observer) => {
|
|
18
|
+
const feats = await superGetFeatures
|
|
19
|
+
.call(this, region)
|
|
20
|
+
.pipe(toArray())
|
|
21
|
+
.toPromise();
|
|
22
|
+
const feat = feats[0];
|
|
23
|
+
observer.next(new SimpleFeature({
|
|
24
|
+
...feat.toJSON(),
|
|
25
|
+
uniqueId: `${feat.id()}:${region.start}-${region.end}`,
|
|
26
|
+
end: region.end,
|
|
27
|
+
start: region.start,
|
|
28
|
+
seq: feat
|
|
29
|
+
.get('seq')
|
|
30
|
+
.slice(Math.max(region.start - feat.get('start'), 0), Math.max(region.end - feat.get('start'), 0)),
|
|
31
|
+
}));
|
|
32
|
+
observer.complete();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get refName, start, and end for all features after collapsing any overlaps
|
|
37
|
+
*/
|
|
38
|
+
async getRegions() {
|
|
39
|
+
const regions = [];
|
|
40
|
+
// recall: features are stored in this object sorted by start coordinate
|
|
41
|
+
for (const [refName, features] of this.features) {
|
|
42
|
+
let currentRegion;
|
|
43
|
+
for (const feature of features) {
|
|
44
|
+
if (currentRegion &&
|
|
45
|
+
currentRegion.end >= feature.get('start') &&
|
|
46
|
+
currentRegion.start <= feature.get('end')) {
|
|
47
|
+
currentRegion.end = feature.get('end');
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
if (currentRegion) {
|
|
51
|
+
regions.push(currentRegion);
|
|
52
|
+
}
|
|
53
|
+
currentRegion = {
|
|
54
|
+
refName,
|
|
55
|
+
start: feature.get('start'),
|
|
56
|
+
end: feature.get('end'),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (currentRegion) {
|
|
61
|
+
regions.push(currentRegion);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return regions;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* called to provide a hint that data tied to a certain region
|
|
68
|
+
* will not be needed for the forseeable future and can be purged
|
|
69
|
+
* from caches, etc
|
|
70
|
+
*/
|
|
71
|
+
freeResources( /* { region } */) { }
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=FromConfigSequenceAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FromConfigSequenceAdapter.js","sourceRoot":"","sources":["../../src/FromConfigAdapter/FromConfigSequenceAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,aAA0B,MAAM,kCAAkC,CAAA;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,iBAAiB,MAAM,qBAAqB,CAAA;AAEnD,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,iBAAiB;IACt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aAAa,CAAA;YACjB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;gBAC9B,IACE,aAAa;oBACb,aAAa,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;oBACzC,aAAa,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EACzC;oBACA,aAAa,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;iBACvC;qBAAM;oBACL,IAAI,aAAa,EAAE;wBACjB,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;qBAC5B;oBACD,aAAa,GAAG;wBACd,OAAO;wBACP,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;wBAC3B,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;qBACxB,CAAA;iBACF;aACF;YACD,IAAI,aAAa,EAAE;gBACjB,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;aAC5B;SACF;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;IAED;;;;OAIG;IACH,aAAa,EAAC,gBAAgB,IAAS,CAAC;CACzC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const configSchema: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
|
|
2
|
+
export declare const regionsConfigSchema: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
|
|
3
|
+
export declare const sequenceConfigSchema: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
|
+
export const configSchema = ConfigurationSchema('FromConfigAdapter', {
|
|
3
|
+
features: {
|
|
4
|
+
type: 'frozen',
|
|
5
|
+
defaultValue: [],
|
|
6
|
+
},
|
|
7
|
+
featureClass: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
defaultValue: 'SimpleFeature',
|
|
10
|
+
},
|
|
11
|
+
}, { explicitlyTyped: true, implicitIdentifier: 'adapterId' });
|
|
12
|
+
export const regionsConfigSchema = ConfigurationSchema('FromConfigRegionsAdapter', {
|
|
13
|
+
features: {
|
|
14
|
+
type: 'frozen',
|
|
15
|
+
defaultValue: [],
|
|
16
|
+
},
|
|
17
|
+
featureClass: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
defaultValue: 'SimpleFeature',
|
|
20
|
+
},
|
|
21
|
+
}, { explicitlyTyped: true, implicitIdentifier: 'adapterId' });
|
|
22
|
+
export const sequenceConfigSchema = ConfigurationSchema('FromConfigSequenceAdapter', {
|
|
23
|
+
features: {
|
|
24
|
+
type: 'frozen',
|
|
25
|
+
defaultValue: [],
|
|
26
|
+
},
|
|
27
|
+
featureClass: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
defaultValue: 'SimpleFeature',
|
|
30
|
+
},
|
|
31
|
+
}, { explicitlyTyped: true, implicitIdentifier: 'adapterId' });
|
|
32
|
+
//# sourceMappingURL=configSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configSchema.js","sourceRoot":"","sources":["../../src/FromConfigAdapter/configSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAC7C,mBAAmB,EACnB;IACE,QAAQ,EAAE;QACR,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,EAAE;KACjB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,eAAe;KAC9B;CACF,EACD,EAAE,eAAe,EAAE,IAAI,EAAE,kBAAkB,EAAE,WAAW,EAAE,CAC3D,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CACpD,0BAA0B,EAC1B;IACE,QAAQ,EAAE;QACR,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,EAAE;KACjB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,eAAe;KAC9B;CACF,EACD,EAAE,eAAe,EAAE,IAAI,EAAE,kBAAkB,EAAE,WAAW,EAAE,CAC3D,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CACrD,2BAA2B,EAC3B;IACE,QAAQ,EAAE;QACR,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,EAAE;KACjB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,eAAe;KAC9B;CACF,EACD,EAAE,eAAe,EAAE,IAAI,EAAE,kBAAkB,EAAE,WAAW,EAAE,CAC3D,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as AdapterClass } from './FromConfigAdapter';
|
|
2
|
+
export { default as RegionsAdapterClass } from './FromConfigRegionsAdapter';
|
|
3
|
+
export { default as SequenceAdapterClass } from './FromConfigSequenceAdapter';
|
|
4
|
+
export { configSchema, regionsConfigSchema, sequenceConfigSchema, } from './configSchema';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as AdapterClass } from './FromConfigAdapter';
|
|
2
|
+
export { default as RegionsAdapterClass } from './FromConfigRegionsAdapter';
|
|
3
|
+
export { default as SequenceAdapterClass } from './FromConfigSequenceAdapter';
|
|
4
|
+
export { configSchema, regionsConfigSchema, sequenceConfigSchema, } from './configSchema';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/FromConfigAdapter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAC7E,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseRefNameAliasAdapter, BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
+
export default class RefNameAliasAdapter extends BaseAdapter implements BaseRefNameAliasAdapter {
|
|
3
|
+
getRefNameAliases(): Promise<{
|
|
4
|
+
refName: string;
|
|
5
|
+
aliases: string[];
|
|
6
|
+
}[]>;
|
|
7
|
+
freeResources(): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseAdapter, } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
+
import { openLocation } from '@jbrowse/core/util/io';
|
|
3
|
+
import { readConfObject } from '@jbrowse/core/configuration';
|
|
4
|
+
export default class RefNameAliasAdapter extends BaseAdapter {
|
|
5
|
+
async getRefNameAliases() {
|
|
6
|
+
const loc = readConfObject(this.config, 'location');
|
|
7
|
+
if (loc.uri === '' || loc.uri === '/path/to/my/aliases.txt') {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
const results = await openLocation(loc).readFile('utf8');
|
|
11
|
+
const refColumn = readConfObject(this.config, 'refNameColumn');
|
|
12
|
+
return results
|
|
13
|
+
.trim()
|
|
14
|
+
.split('\n')
|
|
15
|
+
.filter(f => !!f && !f.startsWith('#'))
|
|
16
|
+
.map(row => {
|
|
17
|
+
const aliases = row.split('\t');
|
|
18
|
+
const [refName] = aliases.splice(refColumn, 1);
|
|
19
|
+
return { refName, aliases: aliases.filter(f => !!f.trim()) };
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async freeResources() { }
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=RefNameAliasAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefNameAliasAdapter.js","sourceRoot":"","sources":["../../src/RefNameAliasAdapter/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0,0 +1,15 @@
|
|
|
1
|
+
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
|
+
export default ConfigurationSchema('RefNameAliasAdapter', {
|
|
3
|
+
location: {
|
|
4
|
+
type: 'fileLocation',
|
|
5
|
+
defaultValue: {
|
|
6
|
+
uri: '/path/to/my/aliases.txt',
|
|
7
|
+
locationType: 'UriLocation',
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
refNameColumn: {
|
|
11
|
+
type: 'number',
|
|
12
|
+
defaultValue: 0,
|
|
13
|
+
},
|
|
14
|
+
}, { explicitlyTyped: true });
|
|
15
|
+
//# sourceMappingURL=configSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configSchema.js","sourceRoot":"","sources":["../../src/RefNameAliasAdapter/configSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE,eAAe,mBAAmB,CAChC,qBAAqB,EACrB;IACE,QAAQ,EAAE;QACR,IAAI,EAAE,cAAc;QACpB,YAAY,EAAE;YACZ,GAAG,EAAE,yBAAyB;YAC9B,YAAY,EAAE,aAAa;SAC5B;KACF;IACD,aAAa,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,CAAC;KAChB;CACF,EACD,EAAE,eAAe,EAAE,IAAI,EAAE,CAC1B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/RefNameAliasAdapter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import Plugin from '@jbrowse/core/Plugin';
|
|
3
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
4
|
+
declare const LazyConfigurationEditorComponent: import("react").LazyExoticComponent<({ model }: {
|
|
5
|
+
model: {
|
|
6
|
+
target: {
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
9
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
10
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>;
|
|
11
|
+
};
|
|
12
|
+
}) => JSX.Element>;
|
|
13
|
+
export default class extends Plugin {
|
|
14
|
+
name: string;
|
|
15
|
+
install(pluginManager: PluginManager): void;
|
|
16
|
+
}
|
|
17
|
+
export { default as JsonEditor } from './ConfigurationEditorWidget/components/JsonEditor';
|
|
18
|
+
export { LazyConfigurationEditorComponent as ConfigurationEditor };
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { lazy } from 'react';
|
|
2
|
+
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
3
|
+
import WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType';
|
|
4
|
+
import Plugin from '@jbrowse/core/Plugin';
|
|
5
|
+
import { configSchema as ConfigurationEditorConfigSchema, HeadingComponent as ConfigurationEditorHeadingComponent, stateModelFactory as ConfigurationEditorStateModelFactory, } from './ConfigurationEditorWidget';
|
|
6
|
+
import { configSchema as fromConfigAdapterConfigSchema, regionsConfigSchema as fromConfigRegionsAdapterConfigSchema, sequenceConfigSchema as fromConfigSequenceAdapterConfigSchema, } from './FromConfigAdapter';
|
|
7
|
+
import { configSchema as refNameAliasAdapterConfigSchema } from './RefNameAliasAdapter';
|
|
8
|
+
const LazyConfigurationEditorComponent = lazy(() => import('./ConfigurationEditorWidget/components/ConfigurationEditor'));
|
|
9
|
+
export default class extends Plugin {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.name = 'ConfigurationPlugin';
|
|
13
|
+
}
|
|
14
|
+
install(pluginManager) {
|
|
15
|
+
pluginManager.addAdapterType(() => new AdapterType({
|
|
16
|
+
name: 'FromConfigAdapter',
|
|
17
|
+
configSchema: fromConfigAdapterConfigSchema,
|
|
18
|
+
getAdapterClass: () => import('./FromConfigAdapter/FromConfigAdapter').then(r => r.default),
|
|
19
|
+
adapterMetadata: {
|
|
20
|
+
category: null,
|
|
21
|
+
hiddenFromGUI: true,
|
|
22
|
+
displayName: null,
|
|
23
|
+
description: null,
|
|
24
|
+
},
|
|
25
|
+
}));
|
|
26
|
+
pluginManager.addAdapterType(() => new AdapterType({
|
|
27
|
+
name: 'FromConfigRegionsAdapter',
|
|
28
|
+
configSchema: fromConfigRegionsAdapterConfigSchema,
|
|
29
|
+
getAdapterClass: () => import('./FromConfigAdapter/FromConfigRegionsAdapter').then(r => r.default),
|
|
30
|
+
adapterMetadata: {
|
|
31
|
+
category: null,
|
|
32
|
+
hiddenFromGUI: true,
|
|
33
|
+
displayName: null,
|
|
34
|
+
description: null,
|
|
35
|
+
},
|
|
36
|
+
}));
|
|
37
|
+
pluginManager.addAdapterType(() => new AdapterType({
|
|
38
|
+
name: 'FromConfigSequenceAdapter',
|
|
39
|
+
configSchema: fromConfigSequenceAdapterConfigSchema,
|
|
40
|
+
getAdapterClass: () => import('./FromConfigAdapter/FromConfigSequenceAdapter').then(r => r.default),
|
|
41
|
+
adapterMetadata: {
|
|
42
|
+
category: null,
|
|
43
|
+
hiddenFromGUI: true,
|
|
44
|
+
displayName: null,
|
|
45
|
+
description: null,
|
|
46
|
+
},
|
|
47
|
+
}));
|
|
48
|
+
pluginManager.addAdapterType(() => new AdapterType({
|
|
49
|
+
name: 'RefNameAliasAdapter',
|
|
50
|
+
configSchema: refNameAliasAdapterConfigSchema,
|
|
51
|
+
getAdapterClass: () => import('./RefNameAliasAdapter/RefNameAliasAdapter').then(r => r.default),
|
|
52
|
+
adapterMetadata: {
|
|
53
|
+
category: null,
|
|
54
|
+
hiddenFromGUI: true,
|
|
55
|
+
displayName: null,
|
|
56
|
+
description: null,
|
|
57
|
+
},
|
|
58
|
+
}));
|
|
59
|
+
pluginManager.addWidgetType(() => {
|
|
60
|
+
return new WidgetType({
|
|
61
|
+
name: 'ConfigurationEditorWidget',
|
|
62
|
+
HeadingComponent: ConfigurationEditorHeadingComponent,
|
|
63
|
+
configSchema: ConfigurationEditorConfigSchema,
|
|
64
|
+
stateModel: ConfigurationEditorStateModelFactory(pluginManager),
|
|
65
|
+
ReactComponent: LazyConfigurationEditorComponent,
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export { default as JsonEditor } from './ConfigurationEditorWidget/components/JsonEditor';
|
|
71
|
+
export { LazyConfigurationEditorComponent as ConfigurationEditor };
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAC5B,OAAO,WAAW,MAAM,iDAAiD,CAAA;AACzE,OAAO,UAAU,MAAM,gDAAgD,CAAA;AACvE,OAAO,MAAM,MAAM,sBAAsB,CAAA;AAEzC,OAAO,EACL,YAAY,IAAI,+BAA+B,EAC/C,gBAAgB,IAAI,mCAAmC,EACvD,iBAAiB,IAAI,oCAAoC,GAC1D,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,YAAY,IAAI,6BAA6B,EAC7C,mBAAmB,IAAI,oCAAoC,EAC3D,oBAAoB,IAAI,qCAAqC,GAC9D,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,YAAY,IAAI,+BAA+B,EAAE,MAAM,uBAAuB,CAAA;AAEvF,MAAM,gCAAgC,GAAG,IAAI,CAC3C,GAAG,EAAE,CAAC,MAAM,CAAC,4DAA4D,CAAC,CAC3E,CAAA;AAED,MAAM,C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B,WAAW,EAAE,IAAI;aAClB;SACF,CAAC,CACL,CAAA;QACD,aAAa,CAAC,cAAc,CAC1B,GAAG,EAAE,CACH,IAAI,WAAW,CAAC;YACd,IAAI,EAAE,qBAAqB;YAC3B,YAAY,EAAE,+BAA+B;YAC7C,eAAe,EAAE,GAAG,EAAE,CACpB,MAAM,CAAC,2CAA2C,CAAC,CAAC,IAAI,CACtD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CACf;YACH,eAAe,EAAE;gBACf,QAAQ,EAAE,IAAI;gBACd,aAAa,EAAE,IAAI;gBACnB,WAAW,EAAE,IAAI;gBACjB,WAAW,EAAE,IAAI;aAClB;SACF,CAAC,CACL,CAAA;QAED,aAAa,CAAC,aAAa,CAAC,GAAG,EAAE;YAC/B,OAAO,IAAI,UAAU,CAAC;gBACpB,IAAI,EAAE,2BAA2B;gBACjC,gBAAgB,EAAE,mCAAmC;gBACrD,YAAY,EAAE,+BAA+B;gBAC7C,UAAU,EAAE,oCAAoC,CAAC,aAAa,CAAC;gBAC/D,cAAc,EAAE,gCAAgC;aACjD,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAED,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,mDAAmD,CAAA;AAEzF,OAAO,EAAE,gCAAgC,IAAI,mBAAmB,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "JBrowse 2 config utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -20,38 +20,45 @@
|
|
|
20
20
|
"main": "dist/index.js",
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
|
-
"src"
|
|
23
|
+
"src",
|
|
24
|
+
"esm"
|
|
24
25
|
],
|
|
25
26
|
"scripts": {
|
|
26
|
-
"build": "
|
|
27
|
+
"build": "npm-run-all build:*",
|
|
27
28
|
"test": "cd ../..; jest plugins/config",
|
|
28
29
|
"prepublishOnly": "yarn test",
|
|
29
30
|
"prepack": "yarn build; yarn useDist",
|
|
30
31
|
"postpack": "yarn useSrc",
|
|
31
32
|
"useDist": "node ../../scripts/useDist.js",
|
|
32
33
|
"useSrc": "node ../../scripts/useSrc.js",
|
|
33
|
-
"
|
|
34
|
+
"prebuild": "npm run clean",
|
|
35
|
+
"build:esm": "tsc --build tsconfig.build.esm.json",
|
|
36
|
+
"build:es5": "tsc --build tsconfig.build.es5.json",
|
|
37
|
+
"clean": "rimraf dist esm *.tsbuildinfo"
|
|
34
38
|
},
|
|
35
39
|
"dependencies": {
|
|
36
40
|
"@babel/runtime": "^7.17.9",
|
|
37
|
-
"@
|
|
41
|
+
"@mui/icons-material": "^5.0.1",
|
|
38
42
|
"pluralize": "^8.0.0",
|
|
39
|
-
"react-color": "^2.19.3"
|
|
40
|
-
"react-simple-code-editor": "0.9.3",
|
|
41
|
-
"react-syntax-highlighter": "^14.0.0"
|
|
43
|
+
"react-color": "^2.19.3"
|
|
42
44
|
},
|
|
43
45
|
"peerDependencies": {
|
|
44
46
|
"@jbrowse/core": "^1.0.0",
|
|
45
|
-
"@material
|
|
46
|
-
"mobx
|
|
47
|
-
"mobx-
|
|
47
|
+
"@mui/material": "^5.0.0",
|
|
48
|
+
"mobx": "^6.0.0",
|
|
49
|
+
"mobx-react": "^7.0.0",
|
|
50
|
+
"mobx-state-tree": "^5.0.0",
|
|
48
51
|
"prop-types": "^15.0.0",
|
|
49
52
|
"react": ">=16.8.0",
|
|
50
53
|
"react-dom": ">=16.8.0",
|
|
51
|
-
"rxjs": "^6.0.0"
|
|
54
|
+
"rxjs": "^6.0.0",
|
|
55
|
+
"tss-react": "^3.0.0"
|
|
52
56
|
},
|
|
53
57
|
"publishConfig": {
|
|
54
58
|
"access": "public"
|
|
55
59
|
},
|
|
56
|
-
"
|
|
60
|
+
"distModule": "esm/index.js",
|
|
61
|
+
"srcModule": "src/index.ts",
|
|
62
|
+
"module": "esm/index.js",
|
|
63
|
+
"gitHead": "ecc7f5d47351a5ea04bc00f3a6eb6dfb607342e6"
|
|
57
64
|
}
|
|
@@ -7,35 +7,44 @@ import {
|
|
|
7
7
|
InputLabel,
|
|
8
8
|
Tooltip,
|
|
9
9
|
IconButton,
|
|
10
|
-
|
|
11
|
-
} from '@material
|
|
12
|
-
import
|
|
10
|
+
TextField,
|
|
11
|
+
} from '@mui/material'
|
|
12
|
+
import { makeStyles } from 'tss-react/mui'
|
|
13
|
+
import HelpIcon from '@mui/icons-material/Help'
|
|
13
14
|
import { getEnv } from 'mobx-state-tree'
|
|
14
|
-
import { observer
|
|
15
|
-
import Editor from 'react-simple-code-editor'
|
|
16
|
-
|
|
17
|
-
// fontSize and fontFamily have to match between Editor and SyntaxHighlighter
|
|
18
|
-
const fontSize = '12px'
|
|
15
|
+
import { observer } from 'mobx-react'
|
|
19
16
|
|
|
20
17
|
// Optimize by using system default fonts:
|
|
21
18
|
// https://css-tricks.com/snippets/css/font-stacks/
|
|
22
19
|
const fontFamily =
|
|
23
20
|
'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'
|
|
24
21
|
|
|
25
|
-
const useStyles = makeStyles(theme => ({
|
|
22
|
+
const useStyles = makeStyles()(theme => ({
|
|
26
23
|
callbackEditor: {
|
|
27
24
|
marginTop: '16px',
|
|
28
25
|
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
29
26
|
fontFamily,
|
|
30
|
-
|
|
27
|
+
},
|
|
28
|
+
textAreaFont: {
|
|
29
|
+
fontFamily,
|
|
31
30
|
},
|
|
32
31
|
}))
|
|
33
32
|
|
|
34
|
-
function CallbackEditor({
|
|
35
|
-
|
|
33
|
+
function CallbackEditor({
|
|
34
|
+
slot,
|
|
35
|
+
}: {
|
|
36
|
+
slot: {
|
|
37
|
+
set: (arg: string) => void
|
|
38
|
+
description: string
|
|
39
|
+
name: string
|
|
40
|
+
value: string
|
|
41
|
+
contextVariable: string
|
|
42
|
+
}
|
|
43
|
+
}) {
|
|
44
|
+
const { classes } = useStyles()
|
|
36
45
|
|
|
37
46
|
const [code, setCode] = useState(slot.value)
|
|
38
|
-
const [error, setCodeError] = useState()
|
|
47
|
+
const [error, setCodeError] = useState<unknown>()
|
|
39
48
|
const debouncedCode = useDebounce(code, 400)
|
|
40
49
|
|
|
41
50
|
useEffect(() => {
|
|
@@ -43,12 +52,16 @@ function CallbackEditor({ slot }) {
|
|
|
43
52
|
const jexlDebouncedCode = debouncedCode.startsWith('jexl:')
|
|
44
53
|
? debouncedCode
|
|
45
54
|
: `jexl:${debouncedCode}`
|
|
55
|
+
|
|
56
|
+
if (jexlDebouncedCode === 'jexl:') {
|
|
57
|
+
throw new Error('Empty jexl expression is not valid')
|
|
58
|
+
}
|
|
46
59
|
stringToJexlExpression(
|
|
47
60
|
jexlDebouncedCode,
|
|
48
61
|
getEnv(slot).pluginManager?.jexl,
|
|
49
62
|
)
|
|
50
63
|
slot.set(jexlDebouncedCode)
|
|
51
|
-
setCodeError(
|
|
64
|
+
setCodeError(undefined)
|
|
52
65
|
} catch (e) {
|
|
53
66
|
console.error({ e })
|
|
54
67
|
setCodeError(e)
|
|
@@ -63,13 +76,17 @@ function CallbackEditor({ slot }) {
|
|
|
63
76
|
<InputLabel shrink htmlFor="callback-editor">
|
|
64
77
|
{slot.name}
|
|
65
78
|
</InputLabel>
|
|
66
|
-
<
|
|
79
|
+
<TextField
|
|
80
|
+
multiline
|
|
67
81
|
className={classes.callbackEditor}
|
|
68
82
|
value={code.startsWith('jexl:') ? code.split('jexl:')[1] : code}
|
|
69
|
-
|
|
70
|
-
highlight={newCode => newCode}
|
|
71
|
-
padding={10}
|
|
83
|
+
onChange={event => setCode(event.target.value)}
|
|
72
84
|
style={{ background: error ? '#fdd' : undefined }}
|
|
85
|
+
InputProps={{
|
|
86
|
+
classes: {
|
|
87
|
+
input: classes.textAreaFont,
|
|
88
|
+
},
|
|
89
|
+
}}
|
|
73
90
|
/>
|
|
74
91
|
{error ? (
|
|
75
92
|
<FormHelperText
|
|
@@ -106,7 +123,5 @@ function CallbackEditor({ slot }) {
|
|
|
106
123
|
</>
|
|
107
124
|
)
|
|
108
125
|
}
|
|
109
|
-
|
|
110
|
-
slot: PropTypes.objectOrObservableObject.isRequired,
|
|
111
|
-
}
|
|
126
|
+
|
|
112
127
|
export default observer(CallbackEditor)
|