@jbrowse/product-core 2.6.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/LICENSE +201 -0
- package/dist/RootModel/BaseRootModel.d.ts +607 -0
- package/dist/RootModel/BaseRootModel.js +101 -0
- package/dist/RootModel/InternetAccounts.d.ts +31 -0
- package/dist/RootModel/InternetAccounts.js +99 -0
- package/dist/RootModel/index.d.ts +2 -0
- package/dist/RootModel/index.js +18 -0
- package/dist/Session/BaseSession.d.ts +99 -0
- package/dist/Session/BaseSession.js +112 -0
- package/dist/Session/Connections.d.ts +174 -0
- package/dist/Session/Connections.js +113 -0
- package/dist/Session/DialogQueue.d.ts +34 -0
- package/dist/Session/DialogQueue.js +55 -0
- package/dist/Session/DrawerWidgets.d.ts +88 -0
- package/dist/Session/DrawerWidgets.js +167 -0
- package/dist/Session/MultipleViews.d.ts +1798 -0
- package/dist/Session/MultipleViews.js +105 -0
- package/dist/Session/ReferenceManagement.d.ts +34 -0
- package/dist/Session/ReferenceManagement.js +91 -0
- package/dist/Session/SessionTracks.d.ts +1866 -0
- package/dist/Session/SessionTracks.js +75 -0
- package/dist/Session/Themes.d.ts +38 -0
- package/dist/Session/Themes.js +64 -0
- package/dist/Session/Tracks.d.ts +1821 -0
- package/dist/Session/Tracks.js +51 -0
- package/dist/Session/index.d.ts +10 -0
- package/dist/Session/index.js +26 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -0
- package/dist/ui/AboutDialog.d.ts +6 -0
- package/dist/ui/AboutDialog.js +20 -0
- package/dist/ui/AboutDialogContents.d.ts +5 -0
- package/dist/ui/AboutDialogContents.js +70 -0
- package/dist/ui/FileInfoPanel.d.ts +5 -0
- package/dist/ui/FileInfoPanel.js +76 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +17 -0
- package/esm/RootModel/BaseRootModel.d.ts +607 -0
- package/esm/RootModel/BaseRootModel.js +93 -0
- package/esm/RootModel/InternetAccounts.d.ts +31 -0
- package/esm/RootModel/InternetAccounts.js +95 -0
- package/esm/RootModel/index.d.ts +2 -0
- package/esm/RootModel/index.js +2 -0
- package/esm/Session/BaseSession.d.ts +99 -0
- package/esm/Session/BaseSession.js +103 -0
- package/esm/Session/Connections.d.ts +174 -0
- package/esm/Session/Connections.js +108 -0
- package/esm/Session/DialogQueue.d.ts +34 -0
- package/esm/Session/DialogQueue.js +50 -0
- package/esm/Session/DrawerWidgets.d.ts +88 -0
- package/esm/Session/DrawerWidgets.js +162 -0
- package/esm/Session/MultipleViews.d.ts +1798 -0
- package/esm/Session/MultipleViews.js +100 -0
- package/esm/Session/ReferenceManagement.d.ts +34 -0
- package/esm/Session/ReferenceManagement.js +86 -0
- package/esm/Session/SessionTracks.d.ts +1866 -0
- package/esm/Session/SessionTracks.js +70 -0
- package/esm/Session/Themes.d.ts +38 -0
- package/esm/Session/Themes.js +59 -0
- package/esm/Session/Tracks.d.ts +1821 -0
- package/esm/Session/Tracks.js +46 -0
- package/esm/Session/index.d.ts +10 -0
- package/esm/Session/index.js +10 -0
- package/esm/index.d.ts +3 -0
- package/esm/index.js +3 -0
- package/esm/ui/AboutDialog.d.ts +6 -0
- package/esm/ui/AboutDialog.js +13 -0
- package/esm/ui/AboutDialogContents.d.ts +5 -0
- package/esm/ui/AboutDialogContents.js +41 -0
- package/esm/ui/FileInfoPanel.d.ts +5 -0
- package/esm/ui/FileInfoPanel.js +47 -0
- package/esm/ui/index.d.ts +1 -0
- package/esm/ui/index.js +1 -0
- package/package.json +66 -0
- package/src/RootModel/BaseRootModel.ts +131 -0
- package/src/RootModel/InternetAccounts.ts +126 -0
- package/src/RootModel/index.ts +2 -0
- package/src/Session/BaseSession.ts +129 -0
- package/src/Session/Connections.ts +145 -0
- package/src/Session/DialogQueue.ts +63 -0
- package/src/Session/DrawerWidgets.ts +222 -0
- package/src/Session/MultipleViews.ts +151 -0
- package/src/Session/ReferenceManagement.ts +134 -0
- package/src/Session/SessionTracks.ts +98 -0
- package/src/Session/Themes.ts +85 -0
- package/src/Session/Tracks.ts +72 -0
- package/src/Session/index.ts +10 -0
- package/src/index.ts +3 -0
- package/src/ui/AboutDialog.tsx +31 -0
- package/src/ui/AboutDialogContents.tsx +88 -0
- package/src/ui/FileInfoPanel.tsx +75 -0
- package/src/ui/index.ts +1 -0
|
@@ -0,0 +1,101 @@
|
|
|
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.isRootModel = exports.BaseRootModelFactory = void 0;
|
|
7
|
+
const assemblyManager_1 = __importDefault(require("@jbrowse/core/assemblyManager"));
|
|
8
|
+
const RpcManager_1 = __importDefault(require("@jbrowse/core/rpc/RpcManager"));
|
|
9
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
10
|
+
const TextSearchManager_1 = __importDefault(require("@jbrowse/core/TextSearch/TextSearchManager"));
|
|
11
|
+
/**
|
|
12
|
+
* #stateModel BaseRootModel
|
|
13
|
+
* #category root
|
|
14
|
+
* factory function for the Base-level root model shared by all products
|
|
15
|
+
*/
|
|
16
|
+
function BaseRootModelFactory({ pluginManager, jbrowseModelType, sessionModelType, assemblyConfigSchema, }) {
|
|
17
|
+
return mobx_state_tree_1.types
|
|
18
|
+
.model('BaseRootModel', {
|
|
19
|
+
/**
|
|
20
|
+
* #property
|
|
21
|
+
* `jbrowse` is a mapping of the config.json into the in-memory state
|
|
22
|
+
* tree
|
|
23
|
+
*/
|
|
24
|
+
jbrowse: jbrowseModelType,
|
|
25
|
+
/**
|
|
26
|
+
* #property
|
|
27
|
+
* `session` encompasses the currently active state of the app, including
|
|
28
|
+
* views open, tracks open in those views, etc.
|
|
29
|
+
*/
|
|
30
|
+
session: mobx_state_tree_1.types.maybe(sessionModelType),
|
|
31
|
+
/**
|
|
32
|
+
* #property
|
|
33
|
+
*/
|
|
34
|
+
sessionPath: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.string, ''),
|
|
35
|
+
/**
|
|
36
|
+
* #property
|
|
37
|
+
*/
|
|
38
|
+
assemblyManager: mobx_state_tree_1.types.optional((0, assemblyManager_1.default)(assemblyConfigSchema, pluginManager), {}),
|
|
39
|
+
})
|
|
40
|
+
.volatile(self => ({
|
|
41
|
+
rpcManager: new RpcManager_1.default(pluginManager, self.jbrowse.configuration.rpc, {
|
|
42
|
+
MainThreadRpcDriver: {},
|
|
43
|
+
}),
|
|
44
|
+
adminMode: false,
|
|
45
|
+
isAssemblyEditing: false,
|
|
46
|
+
error: undefined,
|
|
47
|
+
textSearchManager: new TextSearchManager_1.default(pluginManager),
|
|
48
|
+
pluginManager,
|
|
49
|
+
}))
|
|
50
|
+
.actions(self => ({
|
|
51
|
+
/**
|
|
52
|
+
* #action
|
|
53
|
+
*/
|
|
54
|
+
setError(error) {
|
|
55
|
+
self.error = error;
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* #action
|
|
59
|
+
*/
|
|
60
|
+
setSession(sessionSnapshot) {
|
|
61
|
+
self.session = (0, mobx_state_tree_1.cast)(sessionSnapshot);
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* #action
|
|
65
|
+
*/
|
|
66
|
+
setDefaultSession() {
|
|
67
|
+
this.setSession(self.jbrowse.defaultSession);
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* #action
|
|
71
|
+
*/
|
|
72
|
+
setSessionPath(path) {
|
|
73
|
+
self.sessionPath = path;
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* #action
|
|
77
|
+
*/
|
|
78
|
+
renameCurrentSession(newName) {
|
|
79
|
+
if (self.session) {
|
|
80
|
+
const snapshot = JSON.parse(JSON.stringify((0, mobx_state_tree_1.getSnapshot)(self.session)));
|
|
81
|
+
snapshot.name = newName;
|
|
82
|
+
this.setSession(snapshot);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* #action
|
|
87
|
+
*/
|
|
88
|
+
setAssemblyEditing(flag) {
|
|
89
|
+
self.isAssemblyEditing = flag;
|
|
90
|
+
},
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
exports.BaseRootModelFactory = BaseRootModelFactory;
|
|
94
|
+
/** Type guard for checking if something is a JB root model */
|
|
95
|
+
function isRootModel(thing) {
|
|
96
|
+
return ((0, mobx_state_tree_1.isStateTreeNode)(thing) &&
|
|
97
|
+
'session' in thing &&
|
|
98
|
+
'jbrowse' in thing &&
|
|
99
|
+
'assemblyManager' in thing);
|
|
100
|
+
}
|
|
101
|
+
exports.isRootModel = isRootModel;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
+
import { UriLocation } from '@jbrowse/core/util';
|
|
4
|
+
import { Instance } from 'mobx-state-tree';
|
|
5
|
+
/**
|
|
6
|
+
* #stateModel InternetAccountsMixin
|
|
7
|
+
* #category root
|
|
8
|
+
*/
|
|
9
|
+
export declare function InternetAccountsRootModelMixin(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
10
|
+
/**
|
|
11
|
+
* #property
|
|
12
|
+
*/
|
|
13
|
+
internetAccounts: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyType>;
|
|
14
|
+
}, {
|
|
15
|
+
/**
|
|
16
|
+
* #action
|
|
17
|
+
*/
|
|
18
|
+
initializeInternetAccount(internetAccountConfig: AnyConfigurationModel, initialSnapshot?: {}): any;
|
|
19
|
+
/**
|
|
20
|
+
* #action
|
|
21
|
+
*/
|
|
22
|
+
createEphemeralInternetAccount(internetAccountId: string, initialSnapshot: {} | undefined, url: string): any;
|
|
23
|
+
/**
|
|
24
|
+
* #action
|
|
25
|
+
*/
|
|
26
|
+
findAppropriateInternetAccount(location: UriLocation): any;
|
|
27
|
+
} & {
|
|
28
|
+
afterCreate(): void;
|
|
29
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
30
|
+
export type RootModelWithInternetAccountsType = ReturnType<typeof InternetAccountsRootModelMixin>;
|
|
31
|
+
export type RootModelWithInternetAccounts = Instance<RootModelWithInternetAccountsType>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InternetAccountsRootModelMixin = void 0;
|
|
4
|
+
const mobx_1 = require("mobx");
|
|
5
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
6
|
+
/**
|
|
7
|
+
* #stateModel InternetAccountsMixin
|
|
8
|
+
* #category root
|
|
9
|
+
*/
|
|
10
|
+
function InternetAccountsRootModelMixin(pluginManager) {
|
|
11
|
+
return mobx_state_tree_1.types
|
|
12
|
+
.model({
|
|
13
|
+
/**
|
|
14
|
+
* #property
|
|
15
|
+
*/
|
|
16
|
+
internetAccounts: mobx_state_tree_1.types.array(pluginManager.pluggableMstType('internet account', 'stateModel')),
|
|
17
|
+
})
|
|
18
|
+
.actions(self => ({
|
|
19
|
+
/**
|
|
20
|
+
* #action
|
|
21
|
+
*/
|
|
22
|
+
initializeInternetAccount(internetAccountConfig, initialSnapshot = {}) {
|
|
23
|
+
const internetAccountType = pluginManager.getInternetAccountType(internetAccountConfig.type);
|
|
24
|
+
if (!internetAccountType) {
|
|
25
|
+
throw new Error(`unknown internet account type ${internetAccountConfig.type}`);
|
|
26
|
+
}
|
|
27
|
+
const length = self.internetAccounts.push({
|
|
28
|
+
...initialSnapshot,
|
|
29
|
+
type: internetAccountConfig.type,
|
|
30
|
+
configuration: internetAccountConfig,
|
|
31
|
+
});
|
|
32
|
+
return self.internetAccounts[length - 1];
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* #action
|
|
36
|
+
*/
|
|
37
|
+
createEphemeralInternetAccount(internetAccountId, initialSnapshot = {}, url) {
|
|
38
|
+
let hostUri;
|
|
39
|
+
try {
|
|
40
|
+
hostUri = new URL(url).origin;
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
// ignore
|
|
44
|
+
}
|
|
45
|
+
// id of a custom new internaccount is `${type}-${name}`
|
|
46
|
+
const internetAccountSplit = internetAccountId.split('-');
|
|
47
|
+
const configuration = {
|
|
48
|
+
type: internetAccountSplit[0],
|
|
49
|
+
internetAccountId: internetAccountId,
|
|
50
|
+
name: internetAccountSplit.slice(1).join('-'),
|
|
51
|
+
description: '',
|
|
52
|
+
domains: hostUri ? [hostUri] : [],
|
|
53
|
+
};
|
|
54
|
+
const type = pluginManager.getInternetAccountType(configuration.type);
|
|
55
|
+
const internetAccount = type.stateModel.create({
|
|
56
|
+
...initialSnapshot,
|
|
57
|
+
type: configuration.type,
|
|
58
|
+
configuration,
|
|
59
|
+
});
|
|
60
|
+
self.internetAccounts.push(internetAccount);
|
|
61
|
+
return internetAccount;
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* #action
|
|
65
|
+
*/
|
|
66
|
+
findAppropriateInternetAccount(location) {
|
|
67
|
+
// find the existing account selected from menu
|
|
68
|
+
const selectedId = location.internetAccountId;
|
|
69
|
+
if (selectedId) {
|
|
70
|
+
const selectedAccount = self.internetAccounts.find(account => {
|
|
71
|
+
return account.internetAccountId === selectedId;
|
|
72
|
+
});
|
|
73
|
+
if (selectedAccount) {
|
|
74
|
+
return selectedAccount;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// if no existing account or not found, try to find working account
|
|
78
|
+
for (const account of self.internetAccounts) {
|
|
79
|
+
const handleResult = account.handlesLocation(location);
|
|
80
|
+
if (handleResult) {
|
|
81
|
+
return account;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// if still no existing account, create ephemeral config to use
|
|
85
|
+
return selectedId
|
|
86
|
+
? this.createEphemeralInternetAccount(selectedId, {}, location.uri)
|
|
87
|
+
: null;
|
|
88
|
+
},
|
|
89
|
+
}))
|
|
90
|
+
.actions(self => ({
|
|
91
|
+
afterCreate() {
|
|
92
|
+
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
93
|
+
const { jbrowse } = self;
|
|
94
|
+
jbrowse.internetAccounts.forEach(self.initializeInternetAccount);
|
|
95
|
+
}));
|
|
96
|
+
},
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
exports.InternetAccountsRootModelMixin = InternetAccountsRootModelMixin;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./BaseRootModel"), exports);
|
|
18
|
+
__exportStar(require("./InternetAccounts"), exports);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import { IAnyStateTreeNode, Instance } from 'mobx-state-tree';
|
|
3
|
+
import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
|
|
4
|
+
import type { BaseRootModelType } from '../RootModel/BaseRootModel';
|
|
5
|
+
/**
|
|
6
|
+
* #stateModel BaseSessionModel
|
|
7
|
+
* base session shared by **all** JBrowse products. Be careful what you include
|
|
8
|
+
* here, everything will use it.
|
|
9
|
+
*/
|
|
10
|
+
export declare function BaseSessionModel<ROOT_MODEL_TYPE extends BaseRootModelType, JB_CONFIG_SCHEMA extends AnyConfigurationSchemaType>(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
11
|
+
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
12
|
+
name: import("mobx-state-tree").ISimpleType<string>;
|
|
13
|
+
margin: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
14
|
+
}, {
|
|
15
|
+
/**
|
|
16
|
+
* #volatile
|
|
17
|
+
* this is the globally "selected" object. can be anything. code that
|
|
18
|
+
* wants to deal with this should examine it to see what kind of thing it
|
|
19
|
+
* is.
|
|
20
|
+
*/
|
|
21
|
+
selection: unknown;
|
|
22
|
+
} & {
|
|
23
|
+
readonly root: import("mobx-state-tree").TypeOrStateTreeNodeToStateTreeNode<ROOT_MODEL_TYPE>;
|
|
24
|
+
} & {
|
|
25
|
+
/**
|
|
26
|
+
* #getter
|
|
27
|
+
*/
|
|
28
|
+
readonly jbrowse: any;
|
|
29
|
+
/**
|
|
30
|
+
* #getter
|
|
31
|
+
*/
|
|
32
|
+
readonly rpcManager: import("@jbrowse/core/rpc/RpcManager").default;
|
|
33
|
+
/**
|
|
34
|
+
* #getter
|
|
35
|
+
*/
|
|
36
|
+
readonly configuration: Instance<JB_CONFIG_SCHEMA>;
|
|
37
|
+
/**
|
|
38
|
+
* #getter
|
|
39
|
+
*/
|
|
40
|
+
readonly adminMode: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* #getter
|
|
43
|
+
*/
|
|
44
|
+
readonly textSearchManager: import("@jbrowse/core/util").TextSearchManager;
|
|
45
|
+
} & {
|
|
46
|
+
/**
|
|
47
|
+
* #getter
|
|
48
|
+
*/
|
|
49
|
+
readonly assemblies: ({
|
|
50
|
+
[x: string]: any;
|
|
51
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
52
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
53
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
54
|
+
aliases: {
|
|
55
|
+
type: string;
|
|
56
|
+
defaultValue: never[];
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
sequence: AnyConfigurationSchemaType;
|
|
60
|
+
refNameColors: {
|
|
61
|
+
type: string;
|
|
62
|
+
defaultValue: never[];
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
refNameAliases: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
66
|
+
adapter: import("mobx-state-tree").IAnyModelType;
|
|
67
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
68
|
+
cytobands: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
69
|
+
adapter: import("mobx-state-tree").IAnyModelType;
|
|
70
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
71
|
+
displayName: {
|
|
72
|
+
type: string;
|
|
73
|
+
defaultValue: string;
|
|
74
|
+
description: string; /**
|
|
75
|
+
* #getter
|
|
76
|
+
*/
|
|
77
|
+
};
|
|
78
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "name">>>)[];
|
|
79
|
+
} & {
|
|
80
|
+
/**
|
|
81
|
+
* #action
|
|
82
|
+
* set the global selection, i.e. the globally-selected object. can be a
|
|
83
|
+
* feature, a view, just about anything
|
|
84
|
+
*/
|
|
85
|
+
setSelection(thing: unknown): void;
|
|
86
|
+
/**
|
|
87
|
+
* #action
|
|
88
|
+
* clears the global selection
|
|
89
|
+
*/
|
|
90
|
+
clearSelection(): void;
|
|
91
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
92
|
+
/** Session mixin MST type for the most basic session */
|
|
93
|
+
export type BaseSessionType = ReturnType<typeof BaseSessionModel>;
|
|
94
|
+
/** Instance of the most basic possible session */
|
|
95
|
+
export type BaseSession = Instance<BaseSessionType>;
|
|
96
|
+
/** Type guard for BaseSession */
|
|
97
|
+
export declare function isBaseSession(thing: IAnyStateTreeNode): thing is BaseSession;
|
|
98
|
+
/** Type guard for whether a thing is JBrowse session */
|
|
99
|
+
export declare function isSession(thing: unknown): thing is BaseSession;
|
|
@@ -0,0 +1,112 @@
|
|
|
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.isSession = exports.isBaseSession = exports.BaseSessionModel = void 0;
|
|
7
|
+
const shortid_1 = __importDefault(require("shortid"));
|
|
8
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
9
|
+
/**
|
|
10
|
+
* #stateModel BaseSessionModel
|
|
11
|
+
* base session shared by **all** JBrowse products. Be careful what you include
|
|
12
|
+
* here, everything will use it.
|
|
13
|
+
*/
|
|
14
|
+
function BaseSessionModel(pluginManager) {
|
|
15
|
+
return mobx_state_tree_1.types
|
|
16
|
+
.model({
|
|
17
|
+
/**
|
|
18
|
+
* #property
|
|
19
|
+
*/
|
|
20
|
+
id: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.identifier, (0, shortid_1.default)()),
|
|
21
|
+
/**
|
|
22
|
+
* #property
|
|
23
|
+
*/
|
|
24
|
+
name: mobx_state_tree_1.types.string,
|
|
25
|
+
/**
|
|
26
|
+
* #property
|
|
27
|
+
*/
|
|
28
|
+
margin: 0,
|
|
29
|
+
})
|
|
30
|
+
.volatile(() => ({
|
|
31
|
+
/**
|
|
32
|
+
* #volatile
|
|
33
|
+
* this is the globally "selected" object. can be anything. code that
|
|
34
|
+
* wants to deal with this should examine it to see what kind of thing it
|
|
35
|
+
* is.
|
|
36
|
+
*/
|
|
37
|
+
selection: undefined,
|
|
38
|
+
}))
|
|
39
|
+
.views(self => ({
|
|
40
|
+
get root() {
|
|
41
|
+
return (0, mobx_state_tree_1.getParent)(self);
|
|
42
|
+
},
|
|
43
|
+
}))
|
|
44
|
+
.views(self => ({
|
|
45
|
+
/**
|
|
46
|
+
* #getter
|
|
47
|
+
*/
|
|
48
|
+
get jbrowse() {
|
|
49
|
+
return self.root.jbrowse;
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* #getter
|
|
53
|
+
*/
|
|
54
|
+
get rpcManager() {
|
|
55
|
+
return self.root.rpcManager;
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* #getter
|
|
59
|
+
*/
|
|
60
|
+
get configuration() {
|
|
61
|
+
return this.jbrowse.configuration;
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* #getter
|
|
65
|
+
*/
|
|
66
|
+
get adminMode() {
|
|
67
|
+
return self.root.adminMode;
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* #getter
|
|
71
|
+
*/
|
|
72
|
+
get textSearchManager() {
|
|
73
|
+
return self.root.textSearchManager;
|
|
74
|
+
},
|
|
75
|
+
}))
|
|
76
|
+
.views(self => ({
|
|
77
|
+
/**
|
|
78
|
+
* #getter
|
|
79
|
+
*/
|
|
80
|
+
get assemblies() {
|
|
81
|
+
return self.jbrowse.assemblies;
|
|
82
|
+
},
|
|
83
|
+
}))
|
|
84
|
+
.actions(self => ({
|
|
85
|
+
/**
|
|
86
|
+
* #action
|
|
87
|
+
* set the global selection, i.e. the globally-selected object. can be a
|
|
88
|
+
* feature, a view, just about anything
|
|
89
|
+
*/
|
|
90
|
+
setSelection(thing) {
|
|
91
|
+
self.selection = thing;
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* #action
|
|
95
|
+
* clears the global selection
|
|
96
|
+
*/
|
|
97
|
+
clearSelection() {
|
|
98
|
+
self.selection = undefined;
|
|
99
|
+
},
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
exports.BaseSessionModel = BaseSessionModel;
|
|
103
|
+
/** Type guard for BaseSession */
|
|
104
|
+
function isBaseSession(thing) {
|
|
105
|
+
return 'id' in thing && 'name' in thing && 'root' in thing;
|
|
106
|
+
}
|
|
107
|
+
exports.isBaseSession = isBaseSession;
|
|
108
|
+
/** Type guard for whether a thing is JBrowse session */
|
|
109
|
+
function isSession(thing) {
|
|
110
|
+
return (0, mobx_state_tree_1.isStateTreeNode)(thing) && isBaseSession(thing);
|
|
111
|
+
}
|
|
112
|
+
exports.isSession = isSession;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
+
import { IAnyStateTreeNode, Instance } from 'mobx-state-tree';
|
|
4
|
+
import { BaseConnectionConfigModel } from '@jbrowse/core/pluggableElementTypes/models/baseConnectionConfig';
|
|
5
|
+
/**
|
|
6
|
+
* #stateModel ConnectionManagementSessionMixin
|
|
7
|
+
*/
|
|
8
|
+
export declare function ConnectionManagementSessionMixin(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
9
|
+
/**
|
|
10
|
+
* #property
|
|
11
|
+
*/
|
|
12
|
+
connectionInstances: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
13
|
+
name: import("mobx-state-tree").ISimpleType<string>;
|
|
14
|
+
tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
|
|
15
|
+
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
16
|
+
name: {
|
|
17
|
+
type: string;
|
|
18
|
+
defaultValue: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
assemblyNames: {
|
|
22
|
+
type: string; /**
|
|
23
|
+
* #property
|
|
24
|
+
*/
|
|
25
|
+
defaultValue: never[];
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>;
|
|
29
|
+
}, {
|
|
30
|
+
afterAttach(): void;
|
|
31
|
+
addTrackConf(trackConf: {
|
|
32
|
+
[x: string]: any;
|
|
33
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
34
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
35
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>): any;
|
|
36
|
+
addTrackConfs(trackConfs: ({
|
|
37
|
+
[x: string]: any;
|
|
38
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
39
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
40
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): any[];
|
|
41
|
+
setTrackConfs(trackConfs: ({
|
|
42
|
+
[x: string]: any;
|
|
43
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
44
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
45
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>>;
|
|
46
|
+
clear(): void;
|
|
47
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
48
|
+
}, {
|
|
49
|
+
/**
|
|
50
|
+
* #getter
|
|
51
|
+
*/
|
|
52
|
+
readonly connections: ({
|
|
53
|
+
[x: string]: any;
|
|
54
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
55
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
56
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
57
|
+
name: {
|
|
58
|
+
type: string;
|
|
59
|
+
defaultValue: string;
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
assemblyNames: {
|
|
63
|
+
type: string;
|
|
64
|
+
defaultValue: never[];
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>>)[];
|
|
68
|
+
} & {
|
|
69
|
+
/**
|
|
70
|
+
* #action
|
|
71
|
+
*/
|
|
72
|
+
makeConnection(configuration: AnyConfigurationModel, initialSnapshot?: {}): {
|
|
73
|
+
name: string;
|
|
74
|
+
tracks: import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>>;
|
|
75
|
+
configuration: {
|
|
76
|
+
[x: string]: any;
|
|
77
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
78
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
79
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
80
|
+
name: {
|
|
81
|
+
type: string;
|
|
82
|
+
defaultValue: string;
|
|
83
|
+
description: string;
|
|
84
|
+
};
|
|
85
|
+
assemblyNames: {
|
|
86
|
+
type: string; /**
|
|
87
|
+
* #property
|
|
88
|
+
*/
|
|
89
|
+
defaultValue: never[];
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>>;
|
|
93
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
94
|
+
afterAttach(): void;
|
|
95
|
+
addTrackConf(trackConf: {
|
|
96
|
+
[x: string]: any;
|
|
97
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
98
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
99
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>): any;
|
|
100
|
+
addTrackConfs(trackConfs: ({
|
|
101
|
+
[x: string]: any;
|
|
102
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
103
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
104
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): any[];
|
|
105
|
+
setTrackConfs(trackConfs: ({
|
|
106
|
+
[x: string]: any;
|
|
107
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
108
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
109
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>>;
|
|
110
|
+
clear(): void;
|
|
111
|
+
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
112
|
+
name: import("mobx-state-tree").ISimpleType<string>;
|
|
113
|
+
tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
|
|
114
|
+
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
115
|
+
name: {
|
|
116
|
+
type: string;
|
|
117
|
+
defaultValue: string;
|
|
118
|
+
description: string;
|
|
119
|
+
};
|
|
120
|
+
assemblyNames: {
|
|
121
|
+
type: string; /**
|
|
122
|
+
* #property
|
|
123
|
+
*/
|
|
124
|
+
defaultValue: never[];
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
127
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>;
|
|
128
|
+
}, {
|
|
129
|
+
afterAttach(): void;
|
|
130
|
+
addTrackConf(trackConf: {
|
|
131
|
+
[x: string]: any;
|
|
132
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
133
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
134
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>): any;
|
|
135
|
+
addTrackConfs(trackConfs: ({
|
|
136
|
+
[x: string]: any;
|
|
137
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
138
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
139
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): any[];
|
|
140
|
+
setTrackConfs(trackConfs: ({
|
|
141
|
+
[x: string]: any;
|
|
142
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
143
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
144
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>>;
|
|
145
|
+
clear(): void;
|
|
146
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
147
|
+
/**
|
|
148
|
+
* #action
|
|
149
|
+
*/
|
|
150
|
+
prepareToBreakConnection(configuration: AnyConfigurationModel): (Record<string, number> | (() => void))[] | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* #action
|
|
153
|
+
*/
|
|
154
|
+
breakConnection(configuration: AnyConfigurationModel): void;
|
|
155
|
+
/**
|
|
156
|
+
* #action
|
|
157
|
+
*/
|
|
158
|
+
deleteConnection(configuration: AnyConfigurationModel): any;
|
|
159
|
+
/**
|
|
160
|
+
* #action
|
|
161
|
+
*/
|
|
162
|
+
addConnectionConf(connectionConf: BaseConnectionConfigModel): any;
|
|
163
|
+
/**
|
|
164
|
+
* #action
|
|
165
|
+
*/
|
|
166
|
+
clearConnections(): void;
|
|
167
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
168
|
+
/** Session mixin MST type for a session that has connections */
|
|
169
|
+
export type SessionWithConnectionsType = ReturnType<typeof ConnectionManagementSessionMixin>;
|
|
170
|
+
/** Instance of a session that has connections: `connectionInstances`,
|
|
171
|
+
* `makeConnection()`, etc. */
|
|
172
|
+
export type SessionWithConnections = Instance<SessionWithConnectionsType>;
|
|
173
|
+
/** Type guard for SessionWithConnections */
|
|
174
|
+
export declare function isSessionWithConnections(session: IAnyStateTreeNode): session is SessionWithConnections;
|