@jbrowse/core 2.10.2 → 2.10.3
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/BaseFeatureWidget/configSchema.d.ts +2 -0
- package/BaseFeatureWidget/configSchema.js +6 -0
- package/BaseFeatureWidget/index.d.ts +2 -128
- package/BaseFeatureWidget/index.js +4 -168
- package/BaseFeatureWidget/stateModelFactory.d.ts +126 -0
- package/BaseFeatureWidget/stateModelFactory.js +168 -0
- package/Plugin.d.ts +1 -1
- package/Plugin.js +0 -3
- package/package.json +2 -2
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +3 -2
- package/rpc/BaseRpcDriver.d.ts +3 -3
- package/rpc/WebWorkerRpcDriver.d.ts +2 -3
- package/rpc/WebWorkerRpcDriver.js +1 -1
- package/rpc/methods/CoreRender.d.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/ErrorMessageStackTraceDialog.js +25 -22
- package/util/tracks.js +1 -1
- package/util/types/index.d.ts +0 -4
- package/util/types/index.js +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configSchema = void 0;
|
|
4
|
+
const configuration_1 = require("../configuration");
|
|
5
|
+
const configSchema = (0, configuration_1.ConfigurationSchema)('BaseFeatureWidget', {});
|
|
6
|
+
exports.configSchema = configSchema;
|
|
@@ -1,128 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* #stateModel BaseFeatureWidget
|
|
5
|
-
* displays data about features, allowing configuration callbacks to modify the
|
|
6
|
-
* contents of what is displayed
|
|
7
|
-
*
|
|
8
|
-
* see: formatDetails-\>feature,formatDetails-\>subfeatures
|
|
9
|
-
*/
|
|
10
|
-
export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
11
|
-
/**
|
|
12
|
-
* #property
|
|
13
|
-
*/
|
|
14
|
-
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
15
|
-
/**
|
|
16
|
-
* #property
|
|
17
|
-
*/
|
|
18
|
-
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
19
|
-
/**
|
|
20
|
-
* #property
|
|
21
|
-
*/
|
|
22
|
-
featureData: import("mobx-state-tree").IType<any, any, any>;
|
|
23
|
-
/**
|
|
24
|
-
* #property
|
|
25
|
-
*/
|
|
26
|
-
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
27
|
-
/**
|
|
28
|
-
* #property
|
|
29
|
-
*/
|
|
30
|
-
unformattedFeatureData: import("mobx-state-tree").IType<any, any, any>;
|
|
31
|
-
/**
|
|
32
|
-
* #property
|
|
33
|
-
*/
|
|
34
|
-
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
35
|
-
/**
|
|
36
|
-
* #property
|
|
37
|
-
*/
|
|
38
|
-
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
39
|
-
/**
|
|
40
|
-
* #property
|
|
41
|
-
*/
|
|
42
|
-
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
43
|
-
/**
|
|
44
|
-
* #property
|
|
45
|
-
*/
|
|
46
|
-
trackType: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
47
|
-
/**
|
|
48
|
-
* #property
|
|
49
|
-
*/
|
|
50
|
-
maxDepth: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
51
|
-
}, {
|
|
52
|
-
error: unknown;
|
|
53
|
-
} & {
|
|
54
|
-
/**
|
|
55
|
-
* #action
|
|
56
|
-
*/
|
|
57
|
-
setFeatureData(featureData: Record<string, unknown>): void;
|
|
58
|
-
/**
|
|
59
|
-
* #action
|
|
60
|
-
*/
|
|
61
|
-
clearFeatureData(): void;
|
|
62
|
-
/**
|
|
63
|
-
* #action
|
|
64
|
-
*/
|
|
65
|
-
setFormattedData(feat: Record<string, unknown>): void;
|
|
66
|
-
/**
|
|
67
|
-
* #action
|
|
68
|
-
*/
|
|
69
|
-
setExtra(type?: string, trackId?: string, maxDepth?: number): void;
|
|
70
|
-
/**
|
|
71
|
-
* #action
|
|
72
|
-
*/
|
|
73
|
-
setError(e: unknown): void;
|
|
74
|
-
} & {
|
|
75
|
-
afterCreate(): void;
|
|
76
|
-
}, import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
|
|
77
|
-
/**
|
|
78
|
-
* #property
|
|
79
|
-
*/
|
|
80
|
-
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
81
|
-
/**
|
|
82
|
-
* #property
|
|
83
|
-
*/
|
|
84
|
-
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
85
|
-
/**
|
|
86
|
-
* #property
|
|
87
|
-
*/
|
|
88
|
-
featureData: import("mobx-state-tree").IType<any, any, any>;
|
|
89
|
-
/**
|
|
90
|
-
* #property
|
|
91
|
-
*/
|
|
92
|
-
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
93
|
-
/**
|
|
94
|
-
* #property
|
|
95
|
-
*/
|
|
96
|
-
unformattedFeatureData: import("mobx-state-tree").IType<any, any, any>;
|
|
97
|
-
/**
|
|
98
|
-
* #property
|
|
99
|
-
*/
|
|
100
|
-
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
101
|
-
/**
|
|
102
|
-
* #property
|
|
103
|
-
*/
|
|
104
|
-
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
105
|
-
/**
|
|
106
|
-
* #property
|
|
107
|
-
*/
|
|
108
|
-
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
109
|
-
/**
|
|
110
|
-
* #property
|
|
111
|
-
*/
|
|
112
|
-
trackType: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
113
|
-
/**
|
|
114
|
-
* #property
|
|
115
|
-
*/
|
|
116
|
-
maxDepth: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
117
|
-
}>>, {
|
|
118
|
-
type: "BaseFeatureWidget";
|
|
119
|
-
id: string;
|
|
120
|
-
track: import("mobx-state-tree").ReferenceIdentifier | undefined;
|
|
121
|
-
view: import("mobx-state-tree").ReferenceIdentifier | undefined;
|
|
122
|
-
trackId: string | undefined;
|
|
123
|
-
trackType: string | undefined;
|
|
124
|
-
maxDepth: number | undefined;
|
|
125
|
-
formattedFields: any;
|
|
126
|
-
finalizedFeatureData: any;
|
|
127
|
-
}>;
|
|
128
|
-
export { configSchema, stateModelFactory };
|
|
1
|
+
export { configSchema } from './configSchema';
|
|
2
|
+
export { stateModelFactory } from './stateModelFactory';
|
|
@@ -1,171 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.stateModelFactory = exports.configSchema = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const util_1 = require("../util");
|
|
12
|
-
const mst_1 = require("../util/types/mst");
|
|
13
|
-
const configSchema = (0, configuration_1.ConfigurationSchema)('BaseFeatureWidget', {});
|
|
14
|
-
exports.configSchema = configSchema;
|
|
15
|
-
function formatSubfeatures(obj, depth, parse, currentDepth = 0, returnObj = {}) {
|
|
16
|
-
var _a;
|
|
17
|
-
if (depth <= currentDepth) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
(_a = obj.subfeatures) === null || _a === void 0 ? void 0 : _a.map(sub => {
|
|
21
|
-
formatSubfeatures(sub, depth, parse, currentDepth + 1, returnObj);
|
|
22
|
-
parse(sub);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* #stateModel BaseFeatureWidget
|
|
27
|
-
* displays data about features, allowing configuration callbacks to modify the
|
|
28
|
-
* contents of what is displayed
|
|
29
|
-
*
|
|
30
|
-
* see: formatDetails-\>feature,formatDetails-\>subfeatures
|
|
31
|
-
*/
|
|
32
|
-
function stateModelFactory(pluginManager) {
|
|
33
|
-
return mobx_state_tree_1.types
|
|
34
|
-
.model('BaseFeatureWidget', {
|
|
35
|
-
/**
|
|
36
|
-
* #property
|
|
37
|
-
*/
|
|
38
|
-
id: mst_1.ElementId,
|
|
39
|
-
/**
|
|
40
|
-
* #property
|
|
41
|
-
*/
|
|
42
|
-
type: mobx_state_tree_1.types.literal('BaseFeatureWidget'),
|
|
43
|
-
/**
|
|
44
|
-
* #property
|
|
45
|
-
*/
|
|
46
|
-
featureData: mobx_state_tree_1.types.frozen(),
|
|
47
|
-
/**
|
|
48
|
-
* #property
|
|
49
|
-
*/
|
|
50
|
-
formattedFields: mobx_state_tree_1.types.frozen(),
|
|
51
|
-
/**
|
|
52
|
-
* #property
|
|
53
|
-
*/
|
|
54
|
-
unformattedFeatureData: mobx_state_tree_1.types.frozen(),
|
|
55
|
-
/**
|
|
56
|
-
* #property
|
|
57
|
-
*/
|
|
58
|
-
view: mobx_state_tree_1.types.safeReference(pluginManager.pluggableMstType('view', 'stateModel')),
|
|
59
|
-
/**
|
|
60
|
-
* #property
|
|
61
|
-
*/
|
|
62
|
-
track: mobx_state_tree_1.types.safeReference(pluginManager.pluggableMstType('track', 'stateModel')),
|
|
63
|
-
/**
|
|
64
|
-
* #property
|
|
65
|
-
*/
|
|
66
|
-
trackId: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
|
|
67
|
-
/**
|
|
68
|
-
* #property
|
|
69
|
-
*/
|
|
70
|
-
trackType: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
|
|
71
|
-
/**
|
|
72
|
-
* #property
|
|
73
|
-
*/
|
|
74
|
-
maxDepth: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.number),
|
|
75
|
-
})
|
|
76
|
-
.volatile(() => ({
|
|
77
|
-
error: undefined,
|
|
78
|
-
}))
|
|
79
|
-
.actions(self => ({
|
|
80
|
-
/**
|
|
81
|
-
* #action
|
|
82
|
-
*/
|
|
83
|
-
setFeatureData(featureData) {
|
|
84
|
-
self.unformattedFeatureData = featureData;
|
|
85
|
-
},
|
|
86
|
-
/**
|
|
87
|
-
* #action
|
|
88
|
-
*/
|
|
89
|
-
clearFeatureData() {
|
|
90
|
-
self.featureData = undefined;
|
|
91
|
-
},
|
|
92
|
-
/**
|
|
93
|
-
* #action
|
|
94
|
-
*/
|
|
95
|
-
setFormattedData(feat) {
|
|
96
|
-
self.featureData = feat;
|
|
97
|
-
},
|
|
98
|
-
/**
|
|
99
|
-
* #action
|
|
100
|
-
*/
|
|
101
|
-
setExtra(type, trackId, maxDepth) {
|
|
102
|
-
self.trackId = trackId;
|
|
103
|
-
self.trackType = type;
|
|
104
|
-
self.maxDepth = maxDepth;
|
|
105
|
-
},
|
|
106
|
-
/**
|
|
107
|
-
* #action
|
|
108
|
-
*/
|
|
109
|
-
setError(e) {
|
|
110
|
-
self.error = e;
|
|
111
|
-
},
|
|
112
|
-
}))
|
|
113
|
-
.actions(self => ({
|
|
114
|
-
afterCreate() {
|
|
115
|
-
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
116
|
-
try {
|
|
117
|
-
const { unformattedFeatureData, track } = self;
|
|
118
|
-
const session = (0, util_1.getSession)(self);
|
|
119
|
-
if (track) {
|
|
120
|
-
self.setExtra(track.type, track.configuration.trackId, (0, configuration_1.getConf)(track, ['formatDetails', 'maxDepth']));
|
|
121
|
-
}
|
|
122
|
-
if (unformattedFeatureData) {
|
|
123
|
-
const feature = (0, clone_1.default)(unformattedFeatureData);
|
|
124
|
-
const combine = (arg2, feature) => ({
|
|
125
|
-
...(0, configuration_1.getConf)(session, ['formatDetails', arg2], { feature }),
|
|
126
|
-
...(0, configuration_1.getConf)(track, ['formatDetails', arg2], { feature }),
|
|
127
|
-
});
|
|
128
|
-
if (track) {
|
|
129
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
130
|
-
feature.__jbrowsefmt = combine('feature', feature);
|
|
131
|
-
formatSubfeatures(feature, (0, configuration_1.getConf)(track, ['formatDetails', 'depth']), sub => {
|
|
132
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
133
|
-
sub.__jbrowsefmt = combine('subfeatures', sub);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
self.setFormattedData(feature);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
catch (e) {
|
|
140
|
-
console.error(e);
|
|
141
|
-
self.setError(e);
|
|
142
|
-
}
|
|
143
|
-
}));
|
|
144
|
-
},
|
|
145
|
-
}))
|
|
146
|
-
.preProcessSnapshot(snap => {
|
|
147
|
-
// @ts-expect-error
|
|
148
|
-
const { featureData, finalizedFeatureData, ...rest } = snap;
|
|
149
|
-
return {
|
|
150
|
-
unformattedFeatureData: featureData,
|
|
151
|
-
featureData: finalizedFeatureData,
|
|
152
|
-
...rest,
|
|
153
|
-
};
|
|
154
|
-
})
|
|
155
|
-
.postProcessSnapshot(snap => {
|
|
156
|
-
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
157
|
-
const { unformattedFeatureData, featureData, ...rest } = snap;
|
|
158
|
-
// finalizedFeatureData avoids running formatter twice if loading from
|
|
159
|
-
// snapshot
|
|
160
|
-
return {
|
|
161
|
-
// replacing undefined with null helps with allowing fields to be
|
|
162
|
-
// hidden, setting null is not allowed by jexl so we set it to
|
|
163
|
-
// undefined to hide. see config guide. this replacement happens both
|
|
164
|
-
// here and when displaying the featureData in base feature widget
|
|
165
|
-
finalizedFeatureData: JSON.parse(JSON.stringify(featureData, (_, v) => (v === undefined ? null : v))),
|
|
166
|
-
...rest,
|
|
167
|
-
};
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
exports.default = stateModelFactory;
|
|
171
|
-
exports.stateModelFactory = stateModelFactory;
|
|
4
|
+
var configSchema_1 = require("./configSchema");
|
|
5
|
+
Object.defineProperty(exports, "configSchema", { enumerable: true, get: function () { return configSchema_1.configSchema; } });
|
|
6
|
+
var stateModelFactory_1 = require("./stateModelFactory");
|
|
7
|
+
Object.defineProperty(exports, "stateModelFactory", { enumerable: true, get: function () { return stateModelFactory_1.stateModelFactory; } });
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import PluginManager from '../PluginManager';
|
|
2
|
+
/**
|
|
3
|
+
* #stateModel BaseFeatureWidget
|
|
4
|
+
* displays data about features, allowing configuration callbacks to modify the
|
|
5
|
+
* contents of what is displayed
|
|
6
|
+
*
|
|
7
|
+
* see: formatDetails-\>feature,formatDetails-\>subfeatures
|
|
8
|
+
*/
|
|
9
|
+
export declare function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
10
|
+
/**
|
|
11
|
+
* #property
|
|
12
|
+
*/
|
|
13
|
+
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
14
|
+
/**
|
|
15
|
+
* #property
|
|
16
|
+
*/
|
|
17
|
+
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
18
|
+
/**
|
|
19
|
+
* #property
|
|
20
|
+
*/
|
|
21
|
+
featureData: import("mobx-state-tree").IType<any, any, any>;
|
|
22
|
+
/**
|
|
23
|
+
* #property
|
|
24
|
+
*/
|
|
25
|
+
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
26
|
+
/**
|
|
27
|
+
* #property
|
|
28
|
+
*/
|
|
29
|
+
unformattedFeatureData: import("mobx-state-tree").IType<any, any, any>;
|
|
30
|
+
/**
|
|
31
|
+
* #property
|
|
32
|
+
*/
|
|
33
|
+
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
34
|
+
/**
|
|
35
|
+
* #property
|
|
36
|
+
*/
|
|
37
|
+
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
38
|
+
/**
|
|
39
|
+
* #property
|
|
40
|
+
*/
|
|
41
|
+
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
42
|
+
/**
|
|
43
|
+
* #property
|
|
44
|
+
*/
|
|
45
|
+
trackType: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
46
|
+
/**
|
|
47
|
+
* #property
|
|
48
|
+
*/
|
|
49
|
+
maxDepth: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
50
|
+
}, {
|
|
51
|
+
error: unknown;
|
|
52
|
+
} & {
|
|
53
|
+
/**
|
|
54
|
+
* #action
|
|
55
|
+
*/
|
|
56
|
+
setFeatureData(featureData: Record<string, unknown>): void;
|
|
57
|
+
/**
|
|
58
|
+
* #action
|
|
59
|
+
*/
|
|
60
|
+
clearFeatureData(): void;
|
|
61
|
+
/**
|
|
62
|
+
* #action
|
|
63
|
+
*/
|
|
64
|
+
setFormattedData(feat: Record<string, unknown>): void;
|
|
65
|
+
/**
|
|
66
|
+
* #action
|
|
67
|
+
*/
|
|
68
|
+
setExtra(type?: string, trackId?: string, maxDepth?: number): void;
|
|
69
|
+
/**
|
|
70
|
+
* #action
|
|
71
|
+
*/
|
|
72
|
+
setError(e: unknown): void;
|
|
73
|
+
} & {
|
|
74
|
+
afterCreate(): void;
|
|
75
|
+
}, import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
|
|
76
|
+
/**
|
|
77
|
+
* #property
|
|
78
|
+
*/
|
|
79
|
+
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
80
|
+
/**
|
|
81
|
+
* #property
|
|
82
|
+
*/
|
|
83
|
+
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
84
|
+
/**
|
|
85
|
+
* #property
|
|
86
|
+
*/
|
|
87
|
+
featureData: import("mobx-state-tree").IType<any, any, any>;
|
|
88
|
+
/**
|
|
89
|
+
* #property
|
|
90
|
+
*/
|
|
91
|
+
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
92
|
+
/**
|
|
93
|
+
* #property
|
|
94
|
+
*/
|
|
95
|
+
unformattedFeatureData: import("mobx-state-tree").IType<any, any, any>;
|
|
96
|
+
/**
|
|
97
|
+
* #property
|
|
98
|
+
*/
|
|
99
|
+
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
100
|
+
/**
|
|
101
|
+
* #property
|
|
102
|
+
*/
|
|
103
|
+
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
104
|
+
/**
|
|
105
|
+
* #property
|
|
106
|
+
*/
|
|
107
|
+
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
108
|
+
/**
|
|
109
|
+
* #property
|
|
110
|
+
*/
|
|
111
|
+
trackType: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
112
|
+
/**
|
|
113
|
+
* #property
|
|
114
|
+
*/
|
|
115
|
+
maxDepth: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
116
|
+
}>>, {
|
|
117
|
+
id: string;
|
|
118
|
+
type: "BaseFeatureWidget";
|
|
119
|
+
track: import("mobx-state-tree").ReferenceIdentifier | undefined;
|
|
120
|
+
view: import("mobx-state-tree").ReferenceIdentifier | undefined;
|
|
121
|
+
trackId: string | undefined;
|
|
122
|
+
trackType: string | undefined;
|
|
123
|
+
maxDepth: number | undefined;
|
|
124
|
+
formattedFields: any;
|
|
125
|
+
finalizedFeatureData: any;
|
|
126
|
+
}>;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.stateModelFactory = void 0;
|
|
7
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
8
|
+
const mobx_1 = require("mobx");
|
|
9
|
+
const clone_1 = __importDefault(require("clone"));
|
|
10
|
+
const configuration_1 = require("../configuration");
|
|
11
|
+
const util_1 = require("../util");
|
|
12
|
+
const mst_1 = require("../util/types/mst");
|
|
13
|
+
function formatSubfeatures(obj, depth, parse, currentDepth = 0, returnObj = {}) {
|
|
14
|
+
var _a;
|
|
15
|
+
if (depth <= currentDepth) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
(_a = obj.subfeatures) === null || _a === void 0 ? void 0 : _a.map(sub => {
|
|
19
|
+
formatSubfeatures(sub, depth, parse, currentDepth + 1, returnObj);
|
|
20
|
+
parse(sub);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* #stateModel BaseFeatureWidget
|
|
25
|
+
* displays data about features, allowing configuration callbacks to modify the
|
|
26
|
+
* contents of what is displayed
|
|
27
|
+
*
|
|
28
|
+
* see: formatDetails-\>feature,formatDetails-\>subfeatures
|
|
29
|
+
*/
|
|
30
|
+
function stateModelFactory(pluginManager) {
|
|
31
|
+
return mobx_state_tree_1.types
|
|
32
|
+
.model('BaseFeatureWidget', {
|
|
33
|
+
/**
|
|
34
|
+
* #property
|
|
35
|
+
*/
|
|
36
|
+
id: mst_1.ElementId,
|
|
37
|
+
/**
|
|
38
|
+
* #property
|
|
39
|
+
*/
|
|
40
|
+
type: mobx_state_tree_1.types.literal('BaseFeatureWidget'),
|
|
41
|
+
/**
|
|
42
|
+
* #property
|
|
43
|
+
*/
|
|
44
|
+
featureData: mobx_state_tree_1.types.frozen(),
|
|
45
|
+
/**
|
|
46
|
+
* #property
|
|
47
|
+
*/
|
|
48
|
+
formattedFields: mobx_state_tree_1.types.frozen(),
|
|
49
|
+
/**
|
|
50
|
+
* #property
|
|
51
|
+
*/
|
|
52
|
+
unformattedFeatureData: mobx_state_tree_1.types.frozen(),
|
|
53
|
+
/**
|
|
54
|
+
* #property
|
|
55
|
+
*/
|
|
56
|
+
view: mobx_state_tree_1.types.safeReference(pluginManager.pluggableMstType('view', 'stateModel')),
|
|
57
|
+
/**
|
|
58
|
+
* #property
|
|
59
|
+
*/
|
|
60
|
+
track: mobx_state_tree_1.types.safeReference(pluginManager.pluggableMstType('track', 'stateModel')),
|
|
61
|
+
/**
|
|
62
|
+
* #property
|
|
63
|
+
*/
|
|
64
|
+
trackId: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
|
|
65
|
+
/**
|
|
66
|
+
* #property
|
|
67
|
+
*/
|
|
68
|
+
trackType: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
|
|
69
|
+
/**
|
|
70
|
+
* #property
|
|
71
|
+
*/
|
|
72
|
+
maxDepth: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.number),
|
|
73
|
+
})
|
|
74
|
+
.volatile(() => ({
|
|
75
|
+
error: undefined,
|
|
76
|
+
}))
|
|
77
|
+
.actions(self => ({
|
|
78
|
+
/**
|
|
79
|
+
* #action
|
|
80
|
+
*/
|
|
81
|
+
setFeatureData(featureData) {
|
|
82
|
+
self.unformattedFeatureData = featureData;
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* #action
|
|
86
|
+
*/
|
|
87
|
+
clearFeatureData() {
|
|
88
|
+
self.featureData = undefined;
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* #action
|
|
92
|
+
*/
|
|
93
|
+
setFormattedData(feat) {
|
|
94
|
+
self.featureData = feat;
|
|
95
|
+
},
|
|
96
|
+
/**
|
|
97
|
+
* #action
|
|
98
|
+
*/
|
|
99
|
+
setExtra(type, trackId, maxDepth) {
|
|
100
|
+
self.trackId = trackId;
|
|
101
|
+
self.trackType = type;
|
|
102
|
+
self.maxDepth = maxDepth;
|
|
103
|
+
},
|
|
104
|
+
/**
|
|
105
|
+
* #action
|
|
106
|
+
*/
|
|
107
|
+
setError(e) {
|
|
108
|
+
self.error = e;
|
|
109
|
+
},
|
|
110
|
+
}))
|
|
111
|
+
.actions(self => ({
|
|
112
|
+
afterCreate() {
|
|
113
|
+
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
114
|
+
try {
|
|
115
|
+
const { unformattedFeatureData, track } = self;
|
|
116
|
+
const session = (0, util_1.getSession)(self);
|
|
117
|
+
if (track) {
|
|
118
|
+
self.setExtra(track.type, track.configuration.trackId, (0, configuration_1.getConf)(track, ['formatDetails', 'maxDepth']));
|
|
119
|
+
}
|
|
120
|
+
if (unformattedFeatureData) {
|
|
121
|
+
const feature = (0, clone_1.default)(unformattedFeatureData);
|
|
122
|
+
const combine = (arg2, feature) => ({
|
|
123
|
+
...(0, configuration_1.getConf)(session, ['formatDetails', arg2], { feature }),
|
|
124
|
+
...(0, configuration_1.getConf)(track, ['formatDetails', arg2], { feature }),
|
|
125
|
+
});
|
|
126
|
+
if (track) {
|
|
127
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
128
|
+
feature.__jbrowsefmt = combine('feature', feature);
|
|
129
|
+
formatSubfeatures(feature, (0, configuration_1.getConf)(track, ['formatDetails', 'depth']), sub => {
|
|
130
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
131
|
+
sub.__jbrowsefmt = combine('subfeatures', sub);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
self.setFormattedData(feature);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
console.error(e);
|
|
139
|
+
self.setError(e);
|
|
140
|
+
}
|
|
141
|
+
}));
|
|
142
|
+
},
|
|
143
|
+
}))
|
|
144
|
+
.preProcessSnapshot(snap => {
|
|
145
|
+
// @ts-expect-error
|
|
146
|
+
const { featureData, finalizedFeatureData, ...rest } = snap;
|
|
147
|
+
return {
|
|
148
|
+
unformattedFeatureData: featureData,
|
|
149
|
+
featureData: finalizedFeatureData,
|
|
150
|
+
...rest,
|
|
151
|
+
};
|
|
152
|
+
})
|
|
153
|
+
.postProcessSnapshot(snap => {
|
|
154
|
+
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
155
|
+
const { unformattedFeatureData, featureData, ...rest } = snap;
|
|
156
|
+
// finalizedFeatureData avoids running formatter twice if loading from
|
|
157
|
+
// snapshot
|
|
158
|
+
return {
|
|
159
|
+
// replacing undefined with null helps with allowing fields to be
|
|
160
|
+
// hidden, setting null is not allowed by jexl so we set it to
|
|
161
|
+
// undefined to hide. see config guide. this replacement happens both
|
|
162
|
+
// here and when displaying the featureData in base feature widget
|
|
163
|
+
finalizedFeatureData: JSON.parse(JSON.stringify(featureData, (_, v) => (v === undefined ? null : v))),
|
|
164
|
+
...rest,
|
|
165
|
+
};
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
exports.stateModelFactory = stateModelFactory;
|
package/Plugin.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ export default abstract class Plugin {
|
|
|
9
9
|
version?: string;
|
|
10
10
|
install(_pluginManager: PluginManager): void;
|
|
11
11
|
configure(_pluginManager: PluginManager): void;
|
|
12
|
-
configurationSchema
|
|
12
|
+
configurationSchema?: AnyConfigurationSchemaType;
|
|
13
13
|
}
|
|
14
14
|
export type PluginConstructor = new (...args: unknown[]) => Plugin;
|
package/Plugin.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/core",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.3",
|
|
4
4
|
"description": "JBrowse 2 core libraries used by plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"access": "public",
|
|
73
73
|
"directory": "dist"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "c8fc800cd17decd72b2e971c7a6add3b95214e72"
|
|
76
76
|
}
|
|
@@ -65,8 +65,9 @@ const NewHydrate = (0, mobx_react_1.observer)(function ServerSideRenderedContent
|
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
67
|
}, [html, theme, rest, hydrateFn, RenderingComponent]);
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
return (react_1.default.createElement("div", { "data-testid": "hydrationContainer", ref: ref,
|
|
69
|
+
// eslint-disable-next-line react/no-danger
|
|
70
|
+
dangerouslySetInnerHTML: { __html: html } }));
|
|
70
71
|
});
|
|
71
72
|
const OldHydrate = (0, mobx_react_1.observer)(function ({ theme, html, RenderingComponent, ...rest }) {
|
|
72
73
|
const ref = (0, react_1.useRef)(null);
|
package/rpc/BaseRpcDriver.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { AnyConfigurationModel } from '../configuration';
|
|
|
3
3
|
export interface WorkerHandle {
|
|
4
4
|
status?: string;
|
|
5
5
|
error?: Error;
|
|
6
|
-
on?: (channel: string, callback: (message:
|
|
7
|
-
off?: (channel: string, callback: (message:
|
|
6
|
+
on?: (channel: string, callback: (message: unknown) => void) => void;
|
|
7
|
+
off?: (channel: string, callback: (message: unknown) => void) => void;
|
|
8
8
|
destroy(): void;
|
|
9
9
|
call(functionName: string, args?: unknown, options?: {
|
|
10
10
|
statusCallback?(message: string): void;
|
|
@@ -38,7 +38,7 @@ export default abstract class BaseRpcDriver {
|
|
|
38
38
|
getWorkerPool(): LazyWorker[];
|
|
39
39
|
getWorker(sessionId: string): Promise<WorkerHandle>;
|
|
40
40
|
call(pluginManager: PluginManager, sessionId: string, functionName: string, args: {
|
|
41
|
-
statusCallback?: (message:
|
|
41
|
+
statusCallback?: (message: unknown) => void;
|
|
42
42
|
}, options?: {}): Promise<unknown>;
|
|
43
43
|
}
|
|
44
44
|
export {};
|