@jbrowse/core 2.1.7 → 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 +3 -2
- package/BaseFeatureWidget/BaseFeatureDetail.js +43 -28
- package/BaseFeatureWidget/SequenceBox.js +4 -8
- package/BaseFeatureWidget/SequenceFeatureDetails.js +2 -1
- package/Plugin.d.ts +1 -1
- package/PluginLoader.d.ts +2 -2
- package/PluginManager.d.ts +6 -6
- package/ReExports/modules.d.ts +3 -3
- package/assemblyManager/assembly.d.ts +23 -17
- package/assemblyManager/assembly.js +75 -76
- package/assemblyManager/assemblyConfigSchema.d.ts +6 -2
- package/assemblyManager/assemblyConfigSchema.js +39 -2
- package/assemblyManager/assemblyManager.d.ts +76 -214
- package/assemblyManager/assemblyManager.js +17 -39
- package/configuration/configurationSchema.d.ts +2 -2
- package/data_adapters/BaseAdapter.d.ts +2 -2
- package/data_adapters/CytobandAdapter.js +7 -0
- 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 +62 -3
- package/pluggableElementTypes/models/BaseDisplayModel.js +138 -92
- 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/baseConnectionConfig.js +17 -1
- package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +2 -2
- package/pluggableElementTypes/models/baseInternetAccountConfig.js +27 -1
- package/pluggableElementTypes/models/baseTrackConfig.d.ts +5 -2
- package/pluggableElementTypes/models/baseTrackConfig.js +52 -1
- package/pluggableElementTypes/renderers/BoxRendererType.d.ts +2 -2
- package/pluggableElementTypes/renderers/BoxRendererType.js +2 -0
- 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/MainThreadRpcDriver.d.ts +1 -1
- package/rpc/MainThreadRpcDriver.js +2 -2
- package/rpc/RpcManager.d.ts +2 -2
- package/rpc/WebWorkerRpcDriver.d.ts +5 -4
- package/rpc/WebWorkerRpcDriver.js +2 -2
- package/rpc/baseRpcConfig.d.ts +2 -0
- package/rpc/baseRpcConfig.js +18 -0
- package/rpc/configSchema.js +16 -10
- package/rpc/coreRpcMethods.d.ts +14 -14
- package/rpc/coreRpcMethods.js +60 -63
- package/rpc/mainThreadRpcConfig.d.ts +2 -0
- package/rpc/mainThreadRpcConfig.js +19 -0
- package/rpc/remoteAbortSignals.d.ts +1 -1
- package/rpc/webWorkerRpcConfig.d.ts +2 -0
- package/rpc/webWorkerRpcConfig.js +19 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AboutDialog.js +2 -1
- package/ui/App.d.ts +2 -2
- package/ui/App.js +11 -10
- package/ui/AssemblySelector.d.ts +1 -1
- package/ui/AssemblySelector.js +12 -10
- package/ui/DrawerWidget.js +2 -1
- package/ui/EditableTypography.d.ts +4 -4
- package/ui/EditableTypography.js +7 -11
- package/ui/LoadingEllipses.d.ts +7 -0
- package/ui/LoadingEllipses.js +38 -0
- 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/ui/index.d.ts +1 -0
- package/ui/index.js +3 -1
- package/util/Base1DUtils.js +9 -3
- package/util/Base1DViewModel.d.ts +72 -2
- package/util/Base1DViewModel.js +94 -3
- package/util/blockTypes.d.ts +1 -1
- package/util/calculateDynamicBlocks.js +1 -1
- package/util/calculateStaticBlocks.js +1 -1
- package/util/index.d.ts +3 -1
- package/util/index.js +19 -9
- package/util/io/RemoteFileWithRangeCache.d.ts +1 -2
- 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/layouts/GranularRectLayout.d.ts +7 -2
- package/util/layouts/GranularRectLayout.js +29 -45
- package/util/layouts/MultiLayout.d.ts +2 -2
- package/util/layouts/MultiLayout.js +4 -6
- package/util/offscreenCanvasPonyfill.d.ts +2 -2
- package/util/offscreenCanvasUtils.d.ts +1 -1
- package/util/simpleFeature.d.ts +3 -0
- package/util/stats.d.ts +26 -0
- package/util/stats.js +9 -9
- 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
|
@@ -2,28 +2,73 @@ import { Instance } from 'mobx-state-tree';
|
|
|
2
2
|
import { AnyConfigurationSchemaType } from '../../configuration';
|
|
3
3
|
import PluginManager from '../../PluginManager';
|
|
4
4
|
import { MenuItem } from '../../ui';
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* #stateModel BaseTrackModel
|
|
7
|
+
* these MST models only exist for tracks that are *shown*.
|
|
8
|
+
* they should contain only UI state for the track, and have
|
|
9
|
+
* a reference to a track configuration (stored under
|
|
10
|
+
* session.configuration.assemblies.get(assemblyName).tracks).
|
|
11
|
+
* note that multiple displayed tracks could use the same
|
|
12
|
+
* configuration.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createBaseTrackModel(pm: PluginManager, trackType: string, baseTrackConfig: AnyConfigurationSchemaType): import("mobx-state-tree").IModelType<{
|
|
6
15
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
7
16
|
type: import("mobx-state-tree").ISimpleType<string>;
|
|
8
17
|
configuration: import("mobx-state-tree").ITypeUnion<any, any, any>;
|
|
18
|
+
minimized: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
9
19
|
displays: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyType>;
|
|
10
20
|
}, {
|
|
21
|
+
/**
|
|
22
|
+
* #getter
|
|
23
|
+
* determines which webworker to send the track to, currently based on trackId
|
|
24
|
+
*/
|
|
11
25
|
readonly rpcSessionId: any;
|
|
26
|
+
/**
|
|
27
|
+
* #getter
|
|
28
|
+
*/
|
|
12
29
|
readonly name: any;
|
|
30
|
+
/**
|
|
31
|
+
* #getter
|
|
32
|
+
*/
|
|
13
33
|
readonly textSearchAdapter: any;
|
|
14
34
|
/**
|
|
15
|
-
*
|
|
35
|
+
* #getter
|
|
16
36
|
*/
|
|
17
37
|
readonly adapterType: import("..").AdapterType;
|
|
38
|
+
/**
|
|
39
|
+
* #getter
|
|
40
|
+
*/
|
|
18
41
|
readonly viewMenuActions: MenuItem[];
|
|
42
|
+
/**
|
|
43
|
+
* #getter
|
|
44
|
+
*/
|
|
19
45
|
readonly canConfigure: any;
|
|
20
46
|
} & {
|
|
47
|
+
/**
|
|
48
|
+
* #action
|
|
49
|
+
*/
|
|
50
|
+
setMinimized(flag: boolean): void;
|
|
51
|
+
/**
|
|
52
|
+
* #action
|
|
53
|
+
*/
|
|
21
54
|
activateConfigurationUI(): void;
|
|
55
|
+
/**
|
|
56
|
+
* #action
|
|
57
|
+
*/
|
|
22
58
|
showDisplay(displayId: string, initialSnapshot?: {}): void;
|
|
59
|
+
/**
|
|
60
|
+
* #action
|
|
61
|
+
*/
|
|
23
62
|
hideDisplay(displayId: string): number;
|
|
63
|
+
/**
|
|
64
|
+
* #action
|
|
65
|
+
*/
|
|
24
66
|
replaceDisplay(oldId: string, newId: string, initialSnapshot?: {}): void;
|
|
25
67
|
} & {
|
|
68
|
+
/**
|
|
69
|
+
* #method
|
|
70
|
+
*/
|
|
26
71
|
trackMenuItems(): MenuItem[];
|
|
27
72
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
28
|
-
export
|
|
29
|
-
export
|
|
73
|
+
export type BaseTrackStateModel = ReturnType<typeof createBaseTrackModel>;
|
|
74
|
+
export type BaseTrackModel = Instance<BaseTrackStateModel>;
|
|
@@ -7,35 +7,64 @@ const configuration_1 = require("../../configuration");
|
|
|
7
7
|
const util_1 = require("../../util");
|
|
8
8
|
const types_1 = require("../../util/types");
|
|
9
9
|
const mst_1 = require("../../util/types/mst");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
/**
|
|
11
|
+
* #stateModel BaseTrackModel
|
|
12
|
+
* these MST models only exist for tracks that are *shown*.
|
|
13
|
+
* they should contain only UI state for the track, and have
|
|
14
|
+
* a reference to a track configuration (stored under
|
|
15
|
+
* session.configuration.assemblies.get(assemblyName).tracks).
|
|
16
|
+
* note that multiple displayed tracks could use the same
|
|
17
|
+
* configuration.
|
|
18
|
+
*/
|
|
19
|
+
function createBaseTrackModel(pm, trackType, baseTrackConfig) {
|
|
16
20
|
return mobx_state_tree_1.types
|
|
17
21
|
.model(trackType, {
|
|
22
|
+
/**
|
|
23
|
+
* #property
|
|
24
|
+
*/
|
|
18
25
|
id: mst_1.ElementId,
|
|
26
|
+
/**
|
|
27
|
+
* #property
|
|
28
|
+
*/
|
|
19
29
|
type: mobx_state_tree_1.types.literal(trackType),
|
|
30
|
+
/**
|
|
31
|
+
* #property
|
|
32
|
+
*/
|
|
20
33
|
configuration: (0, configuration_1.ConfigurationReference)(baseTrackConfig),
|
|
21
|
-
|
|
34
|
+
/**
|
|
35
|
+
* #property
|
|
36
|
+
*/
|
|
37
|
+
minimized: false,
|
|
38
|
+
/**
|
|
39
|
+
* #property
|
|
40
|
+
*/
|
|
41
|
+
displays: mobx_state_tree_1.types.array(pm.pluggableMstType('display', 'stateModel')),
|
|
22
42
|
})
|
|
23
43
|
.views(self => ({
|
|
44
|
+
/**
|
|
45
|
+
* #getter
|
|
46
|
+
* determines which webworker to send the track to, currently based on trackId
|
|
47
|
+
*/
|
|
24
48
|
get rpcSessionId() {
|
|
25
49
|
return self.configuration.trackId;
|
|
26
50
|
},
|
|
51
|
+
/**
|
|
52
|
+
* #getter
|
|
53
|
+
*/
|
|
27
54
|
get name() {
|
|
28
55
|
return (0, configuration_1.getConf)(self, 'name');
|
|
29
56
|
},
|
|
57
|
+
/**
|
|
58
|
+
* #getter
|
|
59
|
+
*/
|
|
30
60
|
get textSearchAdapter() {
|
|
31
61
|
return (0, configuration_1.getConf)(self, 'textSearchAdapter');
|
|
32
62
|
},
|
|
33
63
|
/**
|
|
34
|
-
*
|
|
64
|
+
* #getter
|
|
35
65
|
*/
|
|
36
66
|
get adapterType() {
|
|
37
67
|
const adapterConfig = (0, configuration_1.getConf)(self, 'adapter');
|
|
38
|
-
const { pluginManager: pm } = (0, util_1.getEnv)(self);
|
|
39
68
|
if (!adapterConfig) {
|
|
40
69
|
throw new Error(`no adapter configuration provided for ${self.type}`);
|
|
41
70
|
}
|
|
@@ -45,13 +74,15 @@ function createBaseTrackModel(pluginManager, trackType, baseTrackConfig) {
|
|
|
45
74
|
}
|
|
46
75
|
return adapterType;
|
|
47
76
|
},
|
|
77
|
+
/**
|
|
78
|
+
* #getter
|
|
79
|
+
*/
|
|
48
80
|
get viewMenuActions() {
|
|
49
|
-
|
|
50
|
-
self.displays.forEach(display => {
|
|
51
|
-
menuItems.push(...display.viewMenuActions);
|
|
52
|
-
});
|
|
53
|
-
return menuItems;
|
|
81
|
+
return self.displays.map(d => d.viewMenuActions).flat();
|
|
54
82
|
},
|
|
83
|
+
/**
|
|
84
|
+
* #getter
|
|
85
|
+
*/
|
|
55
86
|
get canConfigure() {
|
|
56
87
|
const session = (0, util_1.getSession)(self);
|
|
57
88
|
return ((0, types_1.isSessionModelWithConfigEditing)(session) &&
|
|
@@ -64,6 +95,15 @@ function createBaseTrackModel(pluginManager, trackType, baseTrackConfig) {
|
|
|
64
95
|
},
|
|
65
96
|
}))
|
|
66
97
|
.actions(self => ({
|
|
98
|
+
/**
|
|
99
|
+
* #action
|
|
100
|
+
*/
|
|
101
|
+
setMinimized(flag) {
|
|
102
|
+
self.minimized = flag;
|
|
103
|
+
},
|
|
104
|
+
/**
|
|
105
|
+
* #action
|
|
106
|
+
*/
|
|
67
107
|
activateConfigurationUI() {
|
|
68
108
|
const session = (0, util_1.getSession)(self);
|
|
69
109
|
const view = (0, util_1.getContainingView)(self);
|
|
@@ -78,10 +118,13 @@ function createBaseTrackModel(pluginManager, trackType, baseTrackConfig) {
|
|
|
78
118
|
}
|
|
79
119
|
}
|
|
80
120
|
},
|
|
121
|
+
/**
|
|
122
|
+
* #action
|
|
123
|
+
*/
|
|
81
124
|
showDisplay(displayId, initialSnapshot = {}) {
|
|
82
|
-
const schema =
|
|
125
|
+
const schema = pm.pluggableConfigSchemaType('display');
|
|
83
126
|
const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), displayId);
|
|
84
|
-
const displayType =
|
|
127
|
+
const displayType = pm.getDisplayType(conf.type);
|
|
85
128
|
if (!displayType) {
|
|
86
129
|
throw new Error(`unknown display type ${conf.type}`);
|
|
87
130
|
}
|
|
@@ -92,21 +135,27 @@ function createBaseTrackModel(pluginManager, trackType, baseTrackConfig) {
|
|
|
92
135
|
});
|
|
93
136
|
self.displays.push(display);
|
|
94
137
|
},
|
|
138
|
+
/**
|
|
139
|
+
* #action
|
|
140
|
+
*/
|
|
95
141
|
hideDisplay(displayId) {
|
|
96
|
-
const schema =
|
|
142
|
+
const schema = pm.pluggableConfigSchemaType('display');
|
|
97
143
|
const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), displayId);
|
|
98
144
|
const t = self.displays.filter(d => d.configuration === conf);
|
|
99
145
|
(0, mobx_1.transaction)(() => t.forEach(d => self.displays.remove(d)));
|
|
100
146
|
return t.length;
|
|
101
147
|
},
|
|
148
|
+
/**
|
|
149
|
+
* #action
|
|
150
|
+
*/
|
|
102
151
|
replaceDisplay(oldId, newId, initialSnapshot = {}) {
|
|
103
152
|
const idx = self.displays.findIndex(d => d.configuration.displayId === oldId);
|
|
104
153
|
if (idx === -1) {
|
|
105
154
|
throw new Error(`could not find display id ${oldId} to replace`);
|
|
106
155
|
}
|
|
107
|
-
const schema =
|
|
156
|
+
const schema = pm.pluggableConfigSchemaType('display');
|
|
108
157
|
const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), newId);
|
|
109
|
-
const displayType =
|
|
158
|
+
const displayType = pm.getDisplayType(conf.type);
|
|
110
159
|
if (!displayType) {
|
|
111
160
|
throw new Error(`unknown display type ${conf.type}`);
|
|
112
161
|
}
|
|
@@ -118,16 +167,18 @@ function createBaseTrackModel(pluginManager, trackType, baseTrackConfig) {
|
|
|
118
167
|
},
|
|
119
168
|
}))
|
|
120
169
|
.views(self => ({
|
|
170
|
+
/**
|
|
171
|
+
* #method
|
|
172
|
+
*/
|
|
121
173
|
trackMenuItems() {
|
|
122
|
-
const menuItems =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
});
|
|
174
|
+
const menuItems = self.displays
|
|
175
|
+
.map(d => d.trackMenuItems())
|
|
176
|
+
.flat();
|
|
126
177
|
const displayChoices = [];
|
|
127
178
|
const view = (0, util_1.getContainingView)(self);
|
|
128
|
-
const viewType =
|
|
129
|
-
const compatibleDisplayTypes = viewType.displayTypes.map(
|
|
130
|
-
const compatibleDisplays = self.configuration.displays.filter((
|
|
179
|
+
const viewType = pm.getViewType(view.type);
|
|
180
|
+
const compatibleDisplayTypes = viewType.displayTypes.map(d => d.name);
|
|
181
|
+
const compatibleDisplays = self.configuration.displays.filter((d) => compatibleDisplayTypes.includes(d.type));
|
|
131
182
|
const shownId = self.displays[0].configuration.displayId;
|
|
132
183
|
if (compatibleDisplays.length > 1) {
|
|
133
184
|
displayChoices.push({ type: 'divider' }, { type: 'subHeader', label: 'Display types' });
|
|
@@ -3,13 +3,35 @@ import { MenuItem } from '../../ui';
|
|
|
3
3
|
declare const BaseViewModel: import("mobx-state-tree").IModelType<{
|
|
4
4
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
5
5
|
displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
6
|
+
minimized: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
6
7
|
}, {
|
|
7
8
|
width: number;
|
|
8
9
|
} & {
|
|
10
|
+
/**
|
|
11
|
+
* #getter
|
|
12
|
+
*/
|
|
9
13
|
menuItems(): MenuItem[];
|
|
10
14
|
} & {
|
|
15
|
+
/**
|
|
16
|
+
* #action
|
|
17
|
+
*/
|
|
11
18
|
setDisplayName(name: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* #action
|
|
21
|
+
* width is an important attribute of the view model, when it becomes set, it
|
|
22
|
+
* often indicates when the app can start drawing to it. certain views like
|
|
23
|
+
* lgv are strict about this because if it tries to draw before it knows the
|
|
24
|
+
* width it should draw to, it may start fetching data for regions it doesn't
|
|
25
|
+
* need to
|
|
26
|
+
*
|
|
27
|
+
* setWidth is updated by a ResizeObserver generally, the views often need
|
|
28
|
+
* to know how wide they are to properly draw genomic regions
|
|
29
|
+
*/
|
|
12
30
|
setWidth(newWidth: number): void;
|
|
31
|
+
/**
|
|
32
|
+
* #action
|
|
33
|
+
*/
|
|
34
|
+
setMinimized(flag: boolean): void;
|
|
13
35
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
14
36
|
export default BaseViewModel;
|
|
15
37
|
export interface IBaseViewModel extends Instance<typeof BaseViewModel> {
|
|
@@ -2,25 +2,64 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
4
4
|
const mst_1 = require("../../util/types/mst");
|
|
5
|
+
/**
|
|
6
|
+
* #stateModel BaseViewModel
|
|
7
|
+
*/
|
|
8
|
+
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
9
|
const BaseViewModel = mobx_state_tree_1.types
|
|
6
10
|
.model('BaseView', {
|
|
11
|
+
/**
|
|
12
|
+
* #property
|
|
13
|
+
*/
|
|
7
14
|
id: mst_1.ElementId,
|
|
15
|
+
/**
|
|
16
|
+
* #property
|
|
17
|
+
* displayName is displayed in the header of the view, or assembly names
|
|
18
|
+
* being used if none is specified
|
|
19
|
+
*/
|
|
8
20
|
displayName: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
|
|
21
|
+
/**
|
|
22
|
+
* #property
|
|
23
|
+
*/
|
|
24
|
+
minimized: false,
|
|
9
25
|
})
|
|
10
|
-
.volatile((
|
|
26
|
+
.volatile(() => ({
|
|
11
27
|
width: 800,
|
|
12
28
|
}))
|
|
13
|
-
.views((
|
|
29
|
+
.views(() => ({
|
|
30
|
+
/**
|
|
31
|
+
* #getter
|
|
32
|
+
*/
|
|
14
33
|
menuItems() {
|
|
15
34
|
return [];
|
|
16
35
|
},
|
|
17
36
|
}))
|
|
18
37
|
.actions(self => ({
|
|
38
|
+
/**
|
|
39
|
+
* #action
|
|
40
|
+
*/
|
|
19
41
|
setDisplayName(name) {
|
|
20
42
|
self.displayName = name;
|
|
21
43
|
},
|
|
44
|
+
/**
|
|
45
|
+
* #action
|
|
46
|
+
* width is an important attribute of the view model, when it becomes set, it
|
|
47
|
+
* often indicates when the app can start drawing to it. certain views like
|
|
48
|
+
* lgv are strict about this because if it tries to draw before it knows the
|
|
49
|
+
* width it should draw to, it may start fetching data for regions it doesn't
|
|
50
|
+
* need to
|
|
51
|
+
*
|
|
52
|
+
* setWidth is updated by a ResizeObserver generally, the views often need
|
|
53
|
+
* to know how wide they are to properly draw genomic regions
|
|
54
|
+
*/
|
|
22
55
|
setWidth(newWidth) {
|
|
23
56
|
self.width = newWidth;
|
|
24
57
|
},
|
|
58
|
+
/**
|
|
59
|
+
* #action
|
|
60
|
+
*/
|
|
61
|
+
setMinimized(flag) {
|
|
62
|
+
self.minimized = flag;
|
|
63
|
+
},
|
|
25
64
|
}));
|
|
26
65
|
exports.default = BaseViewModel;
|
|
@@ -3,52 +3,92 @@ import { Instance } from 'mobx-state-tree';
|
|
|
3
3
|
import { RemoteFileWithRangeCache } from '../../util/io';
|
|
4
4
|
import { UriLocation, AnyReactComponentType } from '../../util/types';
|
|
5
5
|
export declare const InternetAccount: import("mobx-state-tree").IModelType<{
|
|
6
|
+
/**
|
|
7
|
+
* #property
|
|
8
|
+
*/
|
|
6
9
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
10
|
+
/**
|
|
11
|
+
* #property
|
|
12
|
+
*/
|
|
7
13
|
type: import("mobx-state-tree").ISimpleType<string>;
|
|
8
14
|
}, {
|
|
15
|
+
/**
|
|
16
|
+
* #getter
|
|
17
|
+
*/
|
|
9
18
|
readonly name: string;
|
|
19
|
+
/**
|
|
20
|
+
* #getter
|
|
21
|
+
*/
|
|
10
22
|
readonly description: string;
|
|
23
|
+
/**
|
|
24
|
+
* #getter
|
|
25
|
+
*/
|
|
11
26
|
readonly internetAccountId: string;
|
|
27
|
+
/**
|
|
28
|
+
* #getter
|
|
29
|
+
*/
|
|
12
30
|
readonly authHeader: string;
|
|
31
|
+
/**
|
|
32
|
+
* #getter
|
|
33
|
+
*/
|
|
13
34
|
readonly tokenType: string;
|
|
35
|
+
/**
|
|
36
|
+
* #getter
|
|
37
|
+
*/
|
|
14
38
|
readonly domains: string[];
|
|
15
39
|
/**
|
|
40
|
+
* #getter
|
|
16
41
|
* Can use this to customize what is displayed in fileSelector's toggle box
|
|
17
42
|
*/
|
|
18
43
|
readonly toggleContents: React.ReactNode;
|
|
19
44
|
/**
|
|
45
|
+
* #getter
|
|
20
46
|
* Can use this to customize what the fileSelector. It takes a prop called
|
|
21
47
|
* `setLocation` that should be used to set a UriLocation
|
|
22
48
|
*/
|
|
23
49
|
readonly SelectorComponent: AnyReactComponentType | undefined;
|
|
24
50
|
/**
|
|
51
|
+
* #getter
|
|
25
52
|
* Can use this to add a label to the UrlChooser. Has no effect if a custom
|
|
26
53
|
* SelectorComponent is supplied
|
|
27
54
|
*/
|
|
28
55
|
readonly selectorLabel: string | undefined;
|
|
29
56
|
} & {
|
|
30
57
|
/**
|
|
58
|
+
* #method
|
|
31
59
|
* Determine whether this internetAccount provides credentials for a URL
|
|
32
60
|
* @param location - UriLocation of resource
|
|
33
61
|
* @returns true or false
|
|
34
62
|
*/
|
|
35
63
|
handlesLocation(location: UriLocation): boolean;
|
|
36
64
|
/**
|
|
65
|
+
* #getter
|
|
37
66
|
* The key used to store this internetAccount's token in sessionStorage
|
|
38
67
|
*/
|
|
39
68
|
readonly tokenKey: string;
|
|
40
69
|
} & {
|
|
41
70
|
/**
|
|
71
|
+
* #action
|
|
42
72
|
* Must be implemented by a model extending or composing this one. Pass the
|
|
43
73
|
* user's token to `resolve`.
|
|
44
74
|
* @param resolve - Pass the token to this function
|
|
45
75
|
* @param reject - If there is an error getting the token, call this function
|
|
46
76
|
*/
|
|
47
77
|
getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): void;
|
|
78
|
+
/**
|
|
79
|
+
* #action
|
|
80
|
+
*/
|
|
48
81
|
storeToken(token: string): void;
|
|
82
|
+
/**
|
|
83
|
+
* #action
|
|
84
|
+
*/
|
|
49
85
|
removeToken(): void;
|
|
86
|
+
/**
|
|
87
|
+
* #action
|
|
88
|
+
*/
|
|
50
89
|
retrieveToken(): string | null;
|
|
51
90
|
/**
|
|
91
|
+
* #action
|
|
52
92
|
* This can be used by an internetAccount to validate a token works before
|
|
53
93
|
* it is used. This is run when preAuthorizationInformation is requested, so
|
|
54
94
|
* it can be used to check that a token is valid before sending it to a
|
|
@@ -57,12 +97,13 @@ export declare const InternetAccount: import("mobx-state-tree").IModelType<{
|
|
|
57
97
|
* if the original one was invalid. Should throw an error if a token is
|
|
58
98
|
* invalid.
|
|
59
99
|
* @param token - Auth token
|
|
60
|
-
* @param
|
|
100
|
+
* @param loc - UriLocation of the resource
|
|
61
101
|
* @returns - Valid auth token
|
|
62
102
|
*/
|
|
63
|
-
validateToken(token: string,
|
|
103
|
+
validateToken(token: string, loc: UriLocation): Promise<string>;
|
|
64
104
|
} & {
|
|
65
105
|
/**
|
|
106
|
+
* #action
|
|
66
107
|
* Try to get the token from the location pre-auth, from local storage,
|
|
67
108
|
* or from a previously cached promise. If token is not available, uses
|
|
68
109
|
* `getTokenFromUser`.
|
|
@@ -71,6 +112,9 @@ export declare const InternetAccount: import("mobx-state-tree").IModelType<{
|
|
|
71
112
|
*/
|
|
72
113
|
getToken(location?: UriLocation): Promise<string>;
|
|
73
114
|
} & {
|
|
115
|
+
/**
|
|
116
|
+
* #action
|
|
117
|
+
*/
|
|
74
118
|
addAuthHeaderToInit(init: RequestInit | undefined, token: string): {
|
|
75
119
|
headers: Headers;
|
|
76
120
|
body?: BodyInit | null | undefined;
|
|
@@ -87,6 +131,7 @@ export declare const InternetAccount: import("mobx-state-tree").IModelType<{
|
|
|
87
131
|
window?: null | undefined;
|
|
88
132
|
};
|
|
89
133
|
/**
|
|
134
|
+
* #action
|
|
90
135
|
* Gets the token and returns it along with the information needed to
|
|
91
136
|
* create a new internetAccount.
|
|
92
137
|
* @param location - UriLocation of the resource
|
|
@@ -101,20 +146,22 @@ export declare const InternetAccount: import("mobx-state-tree").IModelType<{
|
|
|
101
146
|
}>;
|
|
102
147
|
} & {
|
|
103
148
|
/**
|
|
149
|
+
* #action
|
|
104
150
|
* Get a fetch method that will add any needed authentication headers to
|
|
105
151
|
* the request before sending it. If location is provided, it will be
|
|
106
152
|
* checked to see if it includes a token in it pre-auth information.
|
|
107
|
-
* @param
|
|
153
|
+
* @param loc - UriLocation of the resource
|
|
108
154
|
* @returns A function that can be used to fetch
|
|
109
155
|
*/
|
|
110
|
-
getFetcher(
|
|
156
|
+
getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
111
157
|
} & {
|
|
112
158
|
/**
|
|
159
|
+
* #action
|
|
113
160
|
* Gets a filehandle that uses a fetch that adds auth headers
|
|
114
161
|
* @param location - UriLocation of the resource
|
|
115
162
|
* @returns A filehandle
|
|
116
163
|
*/
|
|
117
164
|
openLocation(location: UriLocation): RemoteFileWithRangeCache;
|
|
118
165
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
119
|
-
export
|
|
120
|
-
export
|
|
166
|
+
export type BaseInternetAccountStateModel = typeof InternetAccount;
|
|
167
|
+
export type BaseInternetAccountModel = Instance<BaseInternetAccountStateModel>;
|