@jbrowse/core 2.2.0 → 2.2.1
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/BaseFeatureDetail.d.ts +1 -0
- package/BaseFeatureWidget/BaseFeatureDetail.js +43 -28
- package/BaseFeatureWidget/SequenceBox.js +4 -8
- package/Plugin.d.ts +1 -1
- package/PluginLoader.d.ts +2 -2
- package/PluginManager.d.ts +3 -3
- package/assemblyManager/assembly.d.ts +3 -3
- package/assemblyManager/assembly.js +1 -1
- package/configuration/configurationSchema.d.ts +2 -2
- package/data_adapters/BaseAdapter.d.ts +2 -2
- package/data_adapters/dataAdapterCache.d.ts +1 -1
- package/package.json +2 -2
- package/pluggableElementTypes/AdapterType.d.ts +1 -1
- package/pluggableElementTypes/AddTrackWorkflowType.d.ts +2 -2
- package/pluggableElementTypes/RpcMethodType.d.ts +1 -1
- package/pluggableElementTypes/ViewType.d.ts +2 -2
- package/pluggableElementTypes/index.d.ts +2 -2
- package/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +23 -2
- package/pluggableElementTypes/models/BaseConnectionModelFactory.js +24 -2
- package/pluggableElementTypes/models/BaseDisplayModel.d.ts +2 -2
- package/pluggableElementTypes/models/BaseTrackModel.d.ts +49 -4
- package/pluggableElementTypes/models/BaseTrackModel.js +77 -26
- package/pluggableElementTypes/models/BaseViewModel.d.ts +22 -0
- package/pluggableElementTypes/models/BaseViewModel.js +41 -2
- package/pluggableElementTypes/models/InternetAccountModel.d.ts +53 -6
- package/pluggableElementTypes/models/InternetAccountModel.js +57 -6
- package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +2 -2
- package/pluggableElementTypes/models/baseTrackConfig.d.ts +2 -2
- package/pluggableElementTypes/models/baseTrackConfig.js +9 -0
- package/pluggableElementTypes/renderers/BoxRendererType.d.ts +1 -1
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +1 -1
- package/pluggableElementTypes/renderers/RendererType.d.ts +1 -1
- package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +1 -1
- package/pluggableElementTypes/renderers/util/serializableFilterChain.d.ts +2 -2
- package/rpc/RpcManager.d.ts +2 -2
- package/rpc/remoteAbortSignals.d.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/App.d.ts +2 -2
- package/ui/App.js +6 -8
- package/ui/AssemblySelector.d.ts +1 -1
- package/ui/AssemblySelector.js +12 -10
- package/ui/EditableTypography.d.ts +4 -4
- package/ui/EditableTypography.js +7 -11
- package/ui/Logo.d.ts +1 -1
- package/ui/Menu.d.ts +2 -2
- package/ui/Snackbar.d.ts +1 -1
- package/ui/ViewContainer.d.ts +2 -1
- package/ui/ViewContainer.js +34 -22
- package/util/Base1DViewModel.d.ts +72 -2
- package/util/Base1DViewModel.js +94 -3
- package/util/blockTypes.d.ts +1 -1
- package/util/index.d.ts +2 -1
- package/util/index.js +9 -3
- package/util/io/RemoteFileWithRangeCache.js +2 -2
- package/util/io/index.js +3 -3
- package/util/jexl.d.ts +1 -1
- package/util/layouts/BaseLayout.d.ts +1 -1
- package/util/offscreenCanvasPonyfill.d.ts +2 -2
- package/util/offscreenCanvasUtils.d.ts +1 -1
- package/util/tracks.d.ts +2 -2
- package/util/types/index.d.ts +15 -8
- package/util/types/index.js +8 -1
- package/util/types/util.d.ts +5 -5
package/util/Base1DViewModel.js
CHANGED
|
@@ -9,13 +9,37 @@ const mst_1 = require("./types/mst");
|
|
|
9
9
|
const calculateDynamicBlocks_1 = __importDefault(require("./calculateDynamicBlocks"));
|
|
10
10
|
const calculateStaticBlocks_1 = __importDefault(require("./calculateStaticBlocks"));
|
|
11
11
|
const Base1DUtils_1 = require("./Base1DUtils");
|
|
12
|
+
/**
|
|
13
|
+
* #stateModel Base1DView
|
|
14
|
+
* used in non-lgv view representations of a 1d view e.g. the two axes of the
|
|
15
|
+
* dotplot use this
|
|
16
|
+
*/
|
|
17
|
+
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
12
18
|
const Base1DView = mobx_state_tree_1.types
|
|
13
19
|
.model('Base1DView', {
|
|
20
|
+
/**
|
|
21
|
+
* #property
|
|
22
|
+
*/
|
|
14
23
|
id: mst_1.ElementId,
|
|
24
|
+
/**
|
|
25
|
+
* #property
|
|
26
|
+
*/
|
|
15
27
|
displayedRegions: mobx_state_tree_1.types.array(mst_1.Region),
|
|
28
|
+
/**
|
|
29
|
+
* #property
|
|
30
|
+
*/
|
|
16
31
|
bpPerPx: 0,
|
|
32
|
+
/**
|
|
33
|
+
* #property
|
|
34
|
+
*/
|
|
17
35
|
offsetPx: 0,
|
|
36
|
+
/**
|
|
37
|
+
* #property
|
|
38
|
+
*/
|
|
18
39
|
interRegionPaddingWidth: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, 0),
|
|
40
|
+
/**
|
|
41
|
+
* #property
|
|
42
|
+
*/
|
|
19
43
|
minimumBlockWidth: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, 0),
|
|
20
44
|
})
|
|
21
45
|
.volatile(() => ({
|
|
@@ -23,38 +47,65 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
23
47
|
volatileWidth: 0,
|
|
24
48
|
}))
|
|
25
49
|
.actions(self => ({
|
|
50
|
+
/**
|
|
51
|
+
* #action
|
|
52
|
+
*/
|
|
26
53
|
setDisplayedRegions(regions) {
|
|
27
54
|
self.displayedRegions = (0, mobx_state_tree_1.cast)(regions);
|
|
28
55
|
},
|
|
56
|
+
/**
|
|
57
|
+
* #action
|
|
58
|
+
*/
|
|
29
59
|
setBpPerPx(val) {
|
|
30
60
|
self.bpPerPx = val;
|
|
31
61
|
},
|
|
62
|
+
/**
|
|
63
|
+
* #action
|
|
64
|
+
*/
|
|
32
65
|
setVolatileWidth(width) {
|
|
33
66
|
self.volatileWidth = width;
|
|
34
67
|
},
|
|
35
68
|
}))
|
|
36
69
|
.views(self => ({
|
|
70
|
+
/**
|
|
71
|
+
* #getter
|
|
72
|
+
*/
|
|
37
73
|
get width() {
|
|
38
74
|
return self.volatileWidth;
|
|
39
75
|
},
|
|
76
|
+
/**
|
|
77
|
+
* #getter
|
|
78
|
+
*/
|
|
40
79
|
get assemblyNames() {
|
|
41
80
|
return [
|
|
42
81
|
...new Set(self.displayedRegions.map(region => region.assemblyName)),
|
|
43
82
|
];
|
|
44
83
|
},
|
|
84
|
+
/**
|
|
85
|
+
* #getter
|
|
86
|
+
*/
|
|
45
87
|
get displayedRegionsTotalPx() {
|
|
46
88
|
return this.totalBp / self.bpPerPx;
|
|
47
89
|
},
|
|
90
|
+
/**
|
|
91
|
+
* #getter
|
|
92
|
+
*/
|
|
48
93
|
get maxOffset() {
|
|
49
94
|
// objectively determined to keep the linear genome on the main screen
|
|
50
95
|
const leftPadding = 10;
|
|
51
96
|
return this.displayedRegionsTotalPx - leftPadding;
|
|
52
97
|
},
|
|
98
|
+
/**
|
|
99
|
+
* #getter
|
|
100
|
+
*/
|
|
53
101
|
get minOffset() {
|
|
54
102
|
// objectively determined to keep the linear genome on the main screen
|
|
55
103
|
const rightPadding = 30;
|
|
56
104
|
return -this.width + rightPadding;
|
|
57
105
|
},
|
|
106
|
+
/**
|
|
107
|
+
* #getter
|
|
108
|
+
*/
|
|
58
109
|
get totalBp() {
|
|
59
110
|
return self.displayedRegions
|
|
60
111
|
.map(a => a.end - a.start)
|
|
@@ -62,12 +113,21 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
62
113
|
},
|
|
63
114
|
}))
|
|
64
115
|
.views(self => ({
|
|
116
|
+
/**
|
|
117
|
+
* #getter
|
|
118
|
+
*/
|
|
65
119
|
get dynamicBlocks() {
|
|
66
120
|
return (0, calculateDynamicBlocks_1.default)(self);
|
|
67
121
|
},
|
|
122
|
+
/**
|
|
123
|
+
* #getter
|
|
124
|
+
*/
|
|
68
125
|
get staticBlocks() {
|
|
69
126
|
return (0, calculateStaticBlocks_1.default)(self);
|
|
70
127
|
},
|
|
128
|
+
/**
|
|
129
|
+
* #getter
|
|
130
|
+
*/
|
|
71
131
|
get currBp() {
|
|
72
132
|
return this.dynamicBlocks
|
|
73
133
|
.map(a => a.end - a.start)
|
|
@@ -75,30 +135,51 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
75
135
|
},
|
|
76
136
|
}))
|
|
77
137
|
.views(self => ({
|
|
138
|
+
/**
|
|
139
|
+
* #method
|
|
140
|
+
*/
|
|
78
141
|
pxToBp(px) {
|
|
79
142
|
return (0, Base1DUtils_1.pxToBp)(self, px);
|
|
80
143
|
},
|
|
144
|
+
/**
|
|
145
|
+
* #method
|
|
146
|
+
*/
|
|
81
147
|
bpToPx({ refName, coord, regionNumber, }) {
|
|
82
148
|
var _a;
|
|
83
149
|
return (_a = (0, Base1DUtils_1.bpToPx)({ refName, coord, regionNumber, self })) === null || _a === void 0 ? void 0 : _a.offsetPx;
|
|
84
150
|
},
|
|
85
151
|
}))
|
|
86
152
|
.actions(self => ({
|
|
153
|
+
/**
|
|
154
|
+
* #action
|
|
155
|
+
*/
|
|
87
156
|
setFeatures(features) {
|
|
88
157
|
self.features = features;
|
|
89
158
|
},
|
|
90
|
-
|
|
91
|
-
|
|
159
|
+
/**
|
|
160
|
+
* #action
|
|
161
|
+
* this makes a zoomed out view that shows all displayedRegions that makes
|
|
162
|
+
* the overview bar square with the scale bar
|
|
163
|
+
*/
|
|
92
164
|
showAllRegions() {
|
|
93
165
|
self.bpPerPx = self.totalBp / self.width;
|
|
94
166
|
self.offsetPx = 0;
|
|
95
167
|
},
|
|
168
|
+
/**
|
|
169
|
+
* #action
|
|
170
|
+
*/
|
|
96
171
|
zoomOut() {
|
|
97
172
|
this.zoomTo(self.bpPerPx * 2);
|
|
98
173
|
},
|
|
174
|
+
/**
|
|
175
|
+
* #action
|
|
176
|
+
*/
|
|
99
177
|
zoomIn() {
|
|
100
178
|
this.zoomTo(self.bpPerPx / 2);
|
|
101
179
|
},
|
|
180
|
+
/**
|
|
181
|
+
* #action
|
|
182
|
+
*/
|
|
102
183
|
zoomTo(newBpPerPx, offset = self.width / 2) {
|
|
103
184
|
const bpPerPx = newBpPerPx;
|
|
104
185
|
if (bpPerPx === self.bpPerPx) {
|
|
@@ -110,11 +191,17 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
110
191
|
self.offsetPx = (0, index_1.clamp)(Math.round(((self.offsetPx + offset) * oldBpPerPx) / bpPerPx - offset), self.minOffset, self.maxOffset);
|
|
111
192
|
return self.bpPerPx;
|
|
112
193
|
},
|
|
194
|
+
/**
|
|
195
|
+
* #action
|
|
196
|
+
*/
|
|
113
197
|
scrollTo(offsetPx) {
|
|
114
198
|
const newOffsetPx = (0, index_1.clamp)(offsetPx, self.minOffset, self.maxOffset);
|
|
115
199
|
self.offsetPx = newOffsetPx;
|
|
116
200
|
return newOffsetPx;
|
|
117
201
|
},
|
|
202
|
+
/**
|
|
203
|
+
* #action
|
|
204
|
+
*/
|
|
118
205
|
centerAt(coord, refName, regionNumber) {
|
|
119
206
|
if (!refName) {
|
|
120
207
|
return;
|
|
@@ -128,9 +215,12 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
128
215
|
this.scrollTo(Math.round(centerPx - self.width / 2));
|
|
129
216
|
}
|
|
130
217
|
},
|
|
218
|
+
/**
|
|
219
|
+
* #action
|
|
220
|
+
* note: the scroll is clamped to keep the view on the main screen
|
|
221
|
+
*/
|
|
131
222
|
scroll(distance) {
|
|
132
223
|
const oldOffsetPx = self.offsetPx;
|
|
133
|
-
// the scroll is clamped to keep the linear genome on the main screen
|
|
134
224
|
const newOffsetPx = (0, index_1.clamp)(self.offsetPx + distance, self.minOffset, self.maxOffset);
|
|
135
225
|
self.offsetPx = newOffsetPx;
|
|
136
226
|
return newOffsetPx - oldOffsetPx;
|
|
@@ -138,6 +228,7 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
138
228
|
}))
|
|
139
229
|
.actions(self => ({
|
|
140
230
|
/**
|
|
231
|
+
* #action
|
|
141
232
|
* offset is the base-pair-offset in the displayed region, index is the index of the
|
|
142
233
|
* displayed region in the linear genome view
|
|
143
234
|
*
|
package/util/blockTypes.d.ts
CHANGED
package/util/index.d.ts
CHANGED
|
@@ -197,6 +197,7 @@ export declare function renameRegionsIfNeeded<ARGTYPE extends {
|
|
|
197
197
|
})[];
|
|
198
198
|
}>;
|
|
199
199
|
export declare function minmax(a: number, b: number): number[];
|
|
200
|
+
export declare function shorten(name: string, max?: number, short?: number): string;
|
|
200
201
|
export declare function stringify({ refName, coord, oob, }: {
|
|
201
202
|
coord: number;
|
|
202
203
|
refName?: string;
|
|
@@ -297,7 +298,7 @@ interface Block {
|
|
|
297
298
|
export declare function bytesForRegions(regions: Region[], index: {
|
|
298
299
|
blocksForRange: (ref: string, start: number, end: number) => Promise<Block[]>;
|
|
299
300
|
}): Promise<number>;
|
|
300
|
-
export
|
|
301
|
+
export type ViewSnap = {
|
|
301
302
|
bpPerPx: number;
|
|
302
303
|
interRegionPaddingWidth: number;
|
|
303
304
|
minimumBlockWidth: number;
|
package/util/index.js
CHANGED
|
@@ -29,8 +29,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.
|
|
33
|
-
exports.getEnv = exports.measureGridWidth = exports.getStr = exports.getUriLink = exports.useLocalStorage = exports.getLayoutId = exports.getViewParams = exports.getTickDisplayStr = exports.toLocale = exports.getBpDisplayStr = void 0;
|
|
32
|
+
exports.bytesForRegions = exports.objectHash = exports.hashCode = exports.updateStatus = exports.generateCodonTable = exports.defaultCodonTable = exports.defaultStops = exports.defaultStarts = exports.measureText = exports.rIC = exports.blobToDataURL = exports.complement = exports.reverse = exports.revcom = exports.isElectron = exports.stringify = exports.shorten = exports.minmax = exports.renameRegionsIfNeeded = exports.renameRegionIfNeeded = exports.makeAbortableReaction = exports.findLastIndex = exports.iterMap = exports.bpSpanPx = exports.featureSpanPx = exports.cartesianToPolar = exports.polarToCartesian = exports.degToRad = exports.radToDeg = exports.bpToPx = exports.clamp = exports.compareLocStrings = exports.compareLocs = exports.parseLocString = exports.parseLocStringOneBased = exports.assembleLocStringFast = exports.assembleLocString = exports.getContainingDisplay = exports.getContainingTrack = exports.getContainingView = exports.getSession = exports.findParentThatIs = exports.springAnimate = exports.findParentThat = exports.useDebouncedCallback = exports.useDebounce = exports.inProduction = exports.inDevelopment = exports.isFeature = exports.SimpleFeature = void 0;
|
|
33
|
+
exports.getEnv = exports.measureGridWidth = exports.getStr = exports.getUriLink = exports.useLocalStorage = exports.getLayoutId = exports.getViewParams = exports.getTickDisplayStr = exports.toLocale = exports.getBpDisplayStr = exports.supportedIndexingAdapters = void 0;
|
|
34
34
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
35
35
|
const react_1 = require("react");
|
|
36
36
|
const is_object_1 = __importDefault(require("is-object"));
|
|
@@ -651,9 +651,15 @@ function minmax(a, b) {
|
|
|
651
651
|
return [Math.min(a, b), Math.max(a, b)];
|
|
652
652
|
}
|
|
653
653
|
exports.minmax = minmax;
|
|
654
|
+
function shorten(name, max = 70, short = 30) {
|
|
655
|
+
return name.length > max
|
|
656
|
+
? name.slice(0, short) + '...' + name.slice(-short)
|
|
657
|
+
: name;
|
|
658
|
+
}
|
|
659
|
+
exports.shorten = shorten;
|
|
654
660
|
function stringify({ refName, coord, oob, }) {
|
|
655
661
|
return refName
|
|
656
|
-
? `${refName}:${toLocale(coord)}${oob ? ' (out of bounds)' : ''}`
|
|
662
|
+
? `${shorten(refName)}:${toLocale(coord)}${oob ? ' (out of bounds)' : ''}`
|
|
657
663
|
: '';
|
|
658
664
|
}
|
|
659
665
|
exports.stringify = stringify;
|
|
@@ -52,9 +52,9 @@ class RemoteFileWithRangeCache extends generic_filehandle_1.RemoteFile {
|
|
|
52
52
|
const [, start, end] = rangeParse;
|
|
53
53
|
const s = parseInt(start, 10);
|
|
54
54
|
const e = parseInt(end, 10);
|
|
55
|
-
const response = await globalRangeCache.getRange(url, s, e - s + 1, {
|
|
55
|
+
const response = (await globalRangeCache.getRange(url, s, e - s + 1, {
|
|
56
56
|
signal: init && init.signal,
|
|
57
|
-
});
|
|
57
|
+
}));
|
|
58
58
|
const { headers } = response;
|
|
59
59
|
return new Response(response.buffer, { status: 206, headers });
|
|
60
60
|
}
|
package/util/io/index.js
CHANGED
|
@@ -82,7 +82,7 @@ exports.getFetcher = getFetcher;
|
|
|
82
82
|
function getInternetAccount(location, pluginManager) {
|
|
83
83
|
const { rootModel } = pluginManager;
|
|
84
84
|
// If there is an appRootModel, use it to find the internetAccount
|
|
85
|
-
if (rootModel && (0, types_1.
|
|
85
|
+
if (rootModel && (0, types_1.isRootModelWithInternetAccounts)(rootModel)) {
|
|
86
86
|
return rootModel.findAppropriateInternetAccount(location);
|
|
87
87
|
}
|
|
88
88
|
// If there is no appRootModel, but there is pre-auth, create a temporary
|
|
@@ -103,10 +103,10 @@ function getInternetAccount(location, pluginManager) {
|
|
|
103
103
|
// "WWW-Authenticate: Basic" header. This is so downstream code can retry if
|
|
104
104
|
// needed with HTTP Basic authentication included
|
|
105
105
|
async function checkAuthNeededFetch(url, opts) {
|
|
106
|
+
var _a;
|
|
106
107
|
const response = await fetch(url, opts);
|
|
107
108
|
if (response.status === 401) {
|
|
108
|
-
|
|
109
|
-
if (authHeaders && authHeaders.includes('Basic')) {
|
|
109
|
+
if ((_a = response.headers.get('WWW-Authenticate')) === null || _a === void 0 ? void 0 : _a.includes('Basic')) {
|
|
110
110
|
throw new types_1.AuthNeededError('Accessing HTTPBasic resource without authentication', url.toString());
|
|
111
111
|
}
|
|
112
112
|
}
|
package/util/jexl.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type AbstractCanvas = any;
|
|
2
|
+
type AbstractImageBitmap = any;
|
|
3
3
|
export declare let createCanvas: (width: number, height: number) => AbstractCanvas;
|
|
4
4
|
export declare let createImageBitmap: (canvas: AbstractCanvas) => Promise<AbstractImageBitmap>;
|
|
5
5
|
/** the JS class (constructor) for offscreen-generated image bitmap data */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
2
|
+
export type RenderReturn = Record<string, unknown>;
|
|
3
3
|
export declare function renderToAbstractCanvas(width: number, height: number, opts: {
|
|
4
4
|
exportSVG?: {
|
|
5
5
|
rasterizeLayers?: boolean;
|
package/util/tracks.d.ts
CHANGED
|
@@ -54,8 +54,8 @@ export interface AdapterConfig {
|
|
|
54
54
|
type: string;
|
|
55
55
|
[key: string]: unknown;
|
|
56
56
|
}
|
|
57
|
-
export
|
|
58
|
-
export
|
|
57
|
+
export type AdapterGuesser = (file: FileLocation, index?: FileLocation, adapterHint?: string) => AdapterConfig | undefined;
|
|
58
|
+
export type TrackTypeGuesser = (adapterName: string) => string | undefined;
|
|
59
59
|
export declare function getFileName(track: FileLocation): string;
|
|
60
60
|
export declare function guessAdapter(file: FileLocation, index: FileLocation | undefined, adapterHint?: string, model?: IAnyStateTreeNode): AdapterConfig;
|
|
61
61
|
export declare function guessTrackType(adapterType: string, model?: IAnyStateTreeNode): string;
|
package/util/types/index.d.ts
CHANGED
|
@@ -16,12 +16,12 @@ export interface AbstractViewContainer extends IStateTreeNode<IType<any, unknown
|
|
|
16
16
|
addView(typeName: string, initialState?: Record<string, unknown>): AbstractViewModel;
|
|
17
17
|
}
|
|
18
18
|
export declare function isViewContainer(thing: unknown): thing is AbstractViewContainer;
|
|
19
|
-
export
|
|
19
|
+
export type NotificationLevel = 'error' | 'info' | 'warning' | 'success';
|
|
20
20
|
export interface SnackAction {
|
|
21
21
|
name: string;
|
|
22
22
|
onClick: () => void;
|
|
23
23
|
}
|
|
24
|
-
export
|
|
24
|
+
export type AssemblyManager = Instance<ReturnType<typeof assemblyManager>>;
|
|
25
25
|
export type { TextSearchManager };
|
|
26
26
|
export interface BasePlugin {
|
|
27
27
|
version?: string;
|
|
@@ -40,7 +40,7 @@ export interface JBrowsePlugin {
|
|
|
40
40
|
license: string;
|
|
41
41
|
image?: string;
|
|
42
42
|
}
|
|
43
|
-
export
|
|
43
|
+
export type DialogComponentType = React.LazyExoticComponent<React.FC<any>> | React.FC<any>;
|
|
44
44
|
/** minimum interface that all session state models must implement */
|
|
45
45
|
export interface AbstractSessionModel extends AbstractViewContainer {
|
|
46
46
|
drawerPosition?: string;
|
|
@@ -135,7 +135,9 @@ export interface AbstractViewModel {
|
|
|
135
135
|
id: string;
|
|
136
136
|
type: string;
|
|
137
137
|
width: number;
|
|
138
|
+
minimized: boolean;
|
|
138
139
|
setWidth(width: number): void;
|
|
140
|
+
setMinimized(flag: boolean): void;
|
|
139
141
|
displayName: string | undefined;
|
|
140
142
|
setDisplayName: (arg: string) => void;
|
|
141
143
|
menuItems: () => MenuItem[];
|
|
@@ -176,6 +178,11 @@ export interface AppRootModel extends AbstractRootModel {
|
|
|
176
178
|
findAppropriateInternetAccount(location: UriLocation): BaseInternetAccountModel | undefined;
|
|
177
179
|
}
|
|
178
180
|
export declare function isAppRootModel(thing: unknown): thing is AppRootModel;
|
|
181
|
+
export interface RootModelWithInternetAccounts extends AbstractRootModel {
|
|
182
|
+
internetAccounts: BaseInternetAccountModel[];
|
|
183
|
+
findAppropriateInternetAccount(location: UriLocation): BaseInternetAccountModel | undefined;
|
|
184
|
+
}
|
|
185
|
+
export declare function isRootModelWithInternetAccounts(thing: unknown): thing is RootModelWithInternetAccounts;
|
|
179
186
|
/** a root model that manages global menus */
|
|
180
187
|
export interface AbstractMenuManager {
|
|
181
188
|
appendMenu(menuName: string): void;
|
|
@@ -212,14 +219,14 @@ export declare function isAuthNeededException(exception: unknown): exception is
|
|
|
212
219
|
export declare function isRetryException(exception: Error): boolean;
|
|
213
220
|
export interface BlobLocation extends SnapshotIn<typeof MUBlobLocation> {
|
|
214
221
|
}
|
|
215
|
-
export
|
|
216
|
-
export
|
|
222
|
+
export type FileLocation = LocalPathLocation | UriLocation | BlobLocation;
|
|
223
|
+
export type PreUriLocation = {
|
|
217
224
|
uri: string;
|
|
218
225
|
};
|
|
219
|
-
export
|
|
226
|
+
export type PreLocalPathLocation = {
|
|
220
227
|
localPath: string;
|
|
221
228
|
};
|
|
222
|
-
export
|
|
229
|
+
export type PreBlobLocation = {
|
|
223
230
|
blob: File;
|
|
224
231
|
};
|
|
225
|
-
export
|
|
232
|
+
export type PreFileLocation = PreUriLocation | PreLocalPathLocation | PreBlobLocation;
|
package/util/types/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.isRetryException = exports.isAuthNeededException = exports.RetryError = exports.AuthNeededError = exports.isUriLocation = exports.isAbstractMenuManager = exports.isAppRootModel = exports.isTrackViewModel = exports.isDisplayModel = exports.isTrackModel = exports.isViewModel = exports.isSelectionContainer = exports.isSessionWithSessionPlugins = exports.isSessionModelWithConnections = exports.isSessionModelWithWidgets = exports.isSessionWithAddTracks = exports.isSessionModelWithConfigEditing = exports.isSessionModel = exports.isViewContainer = void 0;
|
|
17
|
+
exports.isRetryException = exports.isAuthNeededException = exports.RetryError = exports.AuthNeededError = exports.isUriLocation = exports.isAbstractMenuManager = exports.isRootModelWithInternetAccounts = exports.isAppRootModel = exports.isTrackViewModel = exports.isDisplayModel = exports.isTrackModel = exports.isViewModel = exports.isSelectionContainer = exports.isSessionWithSessionPlugins = exports.isSessionModelWithConnections = exports.isSessionModelWithWidgets = exports.isSessionWithAddTracks = exports.isSessionModelWithConfigEditing = exports.isSessionModel = exports.isViewContainer = void 0;
|
|
18
18
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
19
19
|
__exportStar(require("./util"), exports);
|
|
20
20
|
function isViewContainer(thing) {
|
|
@@ -97,6 +97,13 @@ function isAppRootModel(thing) {
|
|
|
97
97
|
'findAppropriateInternetAccount' in thing);
|
|
98
98
|
}
|
|
99
99
|
exports.isAppRootModel = isAppRootModel;
|
|
100
|
+
function isRootModelWithInternetAccounts(thing) {
|
|
101
|
+
return (typeof thing === 'object' &&
|
|
102
|
+
thing !== null &&
|
|
103
|
+
'internetAccounts' in thing &&
|
|
104
|
+
'findAppropriateInternetAccount' in thing);
|
|
105
|
+
}
|
|
106
|
+
exports.isRootModelWithInternetAccounts = isRootModelWithInternetAccounts;
|
|
100
107
|
function isAbstractMenuManager(thing) {
|
|
101
108
|
return (typeof thing === 'object' &&
|
|
102
109
|
thing !== null &&
|
package/util/types/util.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ import PluginManager from '../../PluginManager';
|
|
|
5
5
|
* Obtain the return type of a constructor function type.
|
|
6
6
|
* Differs from core Typescript InstanceType in that it returns never if not matched.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type InstanceTypeRestrictive<CONSTRUCTOR extends new (...args: any[]) => any> = CONSTRUCTOR extends new (...args: any[]) => infer CLASS ? CLASS : never;
|
|
9
9
|
/** extracts the class type from a factory function that returns a constructor */
|
|
10
|
-
export
|
|
10
|
+
export type ClassReturnedBy<FACT extends (pm: PluginManager) => any> = InstanceTypeRestrictive<ReturnType<FACT>>;
|
|
11
11
|
/** A react component with any props. Consider using something more specific if possible */
|
|
12
|
-
export
|
|
12
|
+
export type AnyReactComponentType = React.ComponentType<any>;
|
|
13
13
|
/** get the type that a predicate asserts */
|
|
14
|
-
export
|
|
14
|
+
export type TypeTestedByPredicate<PREDICATE extends (thing: any) => boolean> = PREDICATE extends (thing: any) => thing is infer TYPE ? TYPE : never;
|
|
15
15
|
/** get the type for an instance of an MST model in a PM factory function */
|
|
16
|
-
export
|
|
16
|
+
export type InstanceOfModelReturnedBy<FACTORY extends (pm: PluginManager) => IAnyModelType> = Instance<ReturnType<FACTORY>>;
|