@jbrowse/app-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/Assemblies/SessionAssembliesMixin.d.ts +72 -0
- package/dist/Assemblies/SessionAssembliesMixin.js +44 -0
- package/dist/Assemblies/TemporaryAssembliesMixin.d.ts +22 -0
- package/dist/Assemblies/TemporaryAssembliesMixin.js +45 -0
- package/dist/Assemblies/index.d.ts +2 -0
- package/dist/Assemblies/index.js +18 -0
- package/dist/HistoryManagement/index.d.ts +30 -0
- package/dist/HistoryManagement/index.js +54 -0
- package/dist/JBrowseConfig/index.d.ts +158 -0
- package/dist/JBrowseConfig/index.js +155 -0
- package/dist/JBrowseModel/index.d.ts +144 -0
- package/dist/JBrowseModel/index.js +132 -0
- package/dist/RootMenu/index.d.ts +68 -0
- package/dist/RootMenu/index.js +142 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +22 -0
- package/dist/ui/App/App.d.ts +19 -0
- package/dist/ui/App/App.js +95 -0
- package/dist/ui/App/AppFab.d.ts +6 -0
- package/dist/ui/App/AppFab.js +32 -0
- package/dist/ui/App/AppToolbar.d.ts +19 -0
- package/dist/ui/App/AppToolbar.js +54 -0
- package/dist/ui/App/DialogQueue.d.ts +6 -0
- package/dist/ui/App/DialogQueue.js +32 -0
- package/dist/ui/App/Drawer.d.ts +8 -0
- package/dist/ui/App/Drawer.js +34 -0
- package/dist/ui/App/DrawerWidget.d.ts +6 -0
- package/dist/ui/App/DrawerWidget.js +132 -0
- package/dist/ui/App/ViewContainer.d.ts +9 -0
- package/dist/ui/App/ViewContainer.js +76 -0
- package/dist/ui/App/ViewContainerTitle.d.ts +6 -0
- package/dist/ui/App/ViewContainerTitle.js +42 -0
- package/dist/ui/App/ViewLauncher.d.ts +18 -0
- package/dist/ui/App/ViewLauncher.js +50 -0
- package/dist/ui/App/ViewMenu.d.ts +9 -0
- package/dist/ui/App/ViewMenu.js +38 -0
- package/dist/ui/App/ViewPanel.d.ts +19 -0
- package/dist/ui/App/ViewPanel.js +50 -0
- package/dist/ui/App/index.d.ts +1 -0
- package/dist/ui/App/index.js +17 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +17 -0
- package/esm/Assemblies/SessionAssembliesMixin.d.ts +72 -0
- package/esm/Assemblies/SessionAssembliesMixin.js +40 -0
- package/esm/Assemblies/TemporaryAssembliesMixin.d.ts +22 -0
- package/esm/Assemblies/TemporaryAssembliesMixin.js +41 -0
- package/esm/Assemblies/index.d.ts +2 -0
- package/esm/Assemblies/index.js +2 -0
- package/esm/HistoryManagement/index.d.ts +30 -0
- package/esm/HistoryManagement/index.js +47 -0
- package/esm/JBrowseConfig/index.d.ts +158 -0
- package/esm/JBrowseConfig/index.js +148 -0
- package/esm/JBrowseModel/index.d.ts +144 -0
- package/esm/JBrowseModel/index.js +128 -0
- package/esm/RootMenu/index.d.ts +68 -0
- package/esm/RootMenu/index.js +138 -0
- package/esm/index.d.ts +6 -0
- package/esm/index.js +6 -0
- package/esm/ui/App/App.d.ts +19 -0
- package/esm/ui/App/App.js +66 -0
- package/esm/ui/App/AppFab.d.ts +6 -0
- package/esm/ui/App/AppFab.js +27 -0
- package/esm/ui/App/AppToolbar.d.ts +19 -0
- package/esm/ui/App/AppToolbar.js +49 -0
- package/esm/ui/App/DialogQueue.d.ts +6 -0
- package/esm/ui/App/DialogQueue.js +7 -0
- package/esm/ui/App/Drawer.d.ts +8 -0
- package/esm/ui/App/Drawer.js +29 -0
- package/esm/ui/App/DrawerWidget.d.ts +6 -0
- package/esm/ui/App/DrawerWidget.js +104 -0
- package/esm/ui/App/ViewContainer.d.ts +9 -0
- package/esm/ui/App/ViewContainer.js +48 -0
- package/esm/ui/App/ViewContainerTitle.d.ts +6 -0
- package/esm/ui/App/ViewContainerTitle.js +37 -0
- package/esm/ui/App/ViewLauncher.d.ts +18 -0
- package/esm/ui/App/ViewLauncher.js +25 -0
- package/esm/ui/App/ViewMenu.d.ts +9 -0
- package/esm/ui/App/ViewMenu.js +33 -0
- package/esm/ui/App/ViewPanel.d.ts +19 -0
- package/esm/ui/App/ViewPanel.js +22 -0
- package/esm/ui/App/index.d.ts +1 -0
- package/esm/ui/App/index.js +1 -0
- package/esm/ui/index.d.ts +1 -0
- package/esm/ui/index.js +1 -0
- package/package.json +66 -0
- package/src/Assemblies/SessionAssembliesMixin.ts +50 -0
- package/src/Assemblies/TemporaryAssembliesMixin.ts +51 -0
- package/src/Assemblies/index.ts +2 -0
- package/src/HistoryManagement/index.ts +56 -0
- package/src/JBrowseConfig/index.ts +173 -0
- package/src/JBrowseModel/index.ts +150 -0
- package/src/RootMenu/index.ts +157 -0
- package/src/index.ts +6 -0
- package/src/ui/App/App.tsx +117 -0
- package/src/ui/App/AppFab.tsx +45 -0
- package/src/ui/App/AppToolbar.tsx +89 -0
- package/src/ui/App/DialogQueue.tsx +22 -0
- package/src/ui/App/Drawer.tsx +56 -0
- package/src/ui/App/DrawerWidget.tsx +238 -0
- package/src/ui/App/ViewContainer.tsx +76 -0
- package/src/ui/App/ViewContainerTitle.tsx +55 -0
- package/src/ui/App/ViewLauncher.tsx +64 -0
- package/src/ui/App/ViewMenu.tsx +54 -0
- package/src/ui/App/ViewPanel.tsx +63 -0
- package/src/ui/App/index.ts +1 -0
- package/src/ui/index.ts +1 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { ConfigurationSchema, } from '@jbrowse/core/configuration';
|
|
2
|
+
import RpcManager from '@jbrowse/core/rpc/RpcManager';
|
|
3
|
+
import { types } from 'mobx-state-tree';
|
|
4
|
+
/**
|
|
5
|
+
* #config JBrowseRootConfig
|
|
6
|
+
* #category root
|
|
7
|
+
* configuration in a config.json/file.jbrowse
|
|
8
|
+
*/
|
|
9
|
+
export function JBrowseConfigF({ pluginManager, assemblyConfigSchema, }) {
|
|
10
|
+
return types.model('JBrowseConfig', {
|
|
11
|
+
configuration: ConfigurationSchema('Root', {
|
|
12
|
+
/**
|
|
13
|
+
* #slot configuration.rpc
|
|
14
|
+
*/
|
|
15
|
+
rpc: RpcManager.configSchema,
|
|
16
|
+
/**
|
|
17
|
+
* #slot configuration.highResolutionScaling
|
|
18
|
+
*/
|
|
19
|
+
highResolutionScaling: {
|
|
20
|
+
type: 'number',
|
|
21
|
+
defaultValue: 2,
|
|
22
|
+
},
|
|
23
|
+
formatDetails: ConfigurationSchema('FormatDetails', {
|
|
24
|
+
/**
|
|
25
|
+
* #slot configuration.formatDetails.feature
|
|
26
|
+
*/
|
|
27
|
+
feature: {
|
|
28
|
+
type: 'frozen',
|
|
29
|
+
description: 'adds extra fields to the feature details',
|
|
30
|
+
defaultValue: {},
|
|
31
|
+
contextVariable: ['feature'],
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* #slot configuration.formatDetails.subfeatures
|
|
35
|
+
*/
|
|
36
|
+
subfeatures: {
|
|
37
|
+
type: 'frozen',
|
|
38
|
+
description: 'adds extra fields to the subfeatures of a feature',
|
|
39
|
+
defaultValue: {},
|
|
40
|
+
contextVariable: ['feature'],
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* #slot configuration.formatDetails.depth
|
|
44
|
+
*/
|
|
45
|
+
depth: {
|
|
46
|
+
type: 'number',
|
|
47
|
+
defaultValue: 2,
|
|
48
|
+
description: 'depth to iterate on subfeatures',
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
formatAbout: ConfigurationSchema('FormatAbout', {
|
|
52
|
+
/**
|
|
53
|
+
* #slot configuration.formatAbout.config
|
|
54
|
+
*/
|
|
55
|
+
config: {
|
|
56
|
+
type: 'frozen',
|
|
57
|
+
description: 'formats configuration object in about dialog',
|
|
58
|
+
defaultValue: {},
|
|
59
|
+
contextVariable: ['config'],
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* #slot configuration.formatAbout.hideUris
|
|
63
|
+
*/
|
|
64
|
+
hideUris: {
|
|
65
|
+
type: 'boolean',
|
|
66
|
+
defaultValue: false,
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
/*
|
|
70
|
+
* #slot configuration.shareURL
|
|
71
|
+
*/
|
|
72
|
+
shareURL: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
defaultValue: 'https://share.jbrowse.org/api/v1/',
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* #slot configuration.disableAnalytics
|
|
78
|
+
*/
|
|
79
|
+
disableAnalytics: {
|
|
80
|
+
type: 'boolean',
|
|
81
|
+
defaultValue: false,
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* #slot configuration.theme
|
|
85
|
+
*/
|
|
86
|
+
theme: {
|
|
87
|
+
type: 'frozen',
|
|
88
|
+
defaultValue: {},
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* #slot configuration.extraThemes
|
|
92
|
+
*/
|
|
93
|
+
extraThemes: { type: 'frozen', defaultValue: {} },
|
|
94
|
+
/**
|
|
95
|
+
* #slot configuration.logoPath
|
|
96
|
+
*/
|
|
97
|
+
logoPath: {
|
|
98
|
+
type: 'fileLocation',
|
|
99
|
+
defaultValue: { uri: '', locationType: 'UriLocation' },
|
|
100
|
+
},
|
|
101
|
+
...pluginManager.pluginConfigurationSchemas(),
|
|
102
|
+
}),
|
|
103
|
+
/**
|
|
104
|
+
* #slot
|
|
105
|
+
* defines plugins of the format
|
|
106
|
+
* ```typescript
|
|
107
|
+
* type PluginDefinition=
|
|
108
|
+
* { umdUrl: string, name:string } |
|
|
109
|
+
* { url: string, name: string } |
|
|
110
|
+
* { esmUrl: string } |
|
|
111
|
+
* { cjsUrl: string } |
|
|
112
|
+
* { umdLoc: { uri: string } } |
|
|
113
|
+
* { esmLoc: { uri: string } } |
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
plugins: types.array(types.frozen()),
|
|
117
|
+
/**
|
|
118
|
+
* #slot
|
|
119
|
+
* configuration of the assemblies in the instance, see BaseAssembly
|
|
120
|
+
*/
|
|
121
|
+
assemblies: types.array(assemblyConfigSchema),
|
|
122
|
+
/**
|
|
123
|
+
* #slot
|
|
124
|
+
* track configuration is an array of track config schemas. multiple
|
|
125
|
+
* instances of a track can exist that use the same configuration
|
|
126
|
+
*/
|
|
127
|
+
tracks: types.array(pluginManager.pluggableConfigSchemaType('track')),
|
|
128
|
+
/**
|
|
129
|
+
* #slot
|
|
130
|
+
* configuration for internet accounts, see InternetAccounts
|
|
131
|
+
*/
|
|
132
|
+
internetAccounts: types.array(pluginManager.pluggableConfigSchemaType('internet account')),
|
|
133
|
+
/**
|
|
134
|
+
* #slot
|
|
135
|
+
*/
|
|
136
|
+
aggregateTextSearchAdapters: types.array(pluginManager.pluggableConfigSchemaType('text search adapter')),
|
|
137
|
+
/**
|
|
138
|
+
* #slot
|
|
139
|
+
*/
|
|
140
|
+
connections: types.array(pluginManager.pluggableConfigSchemaType('connection')),
|
|
141
|
+
/**
|
|
142
|
+
* #slot
|
|
143
|
+
*/
|
|
144
|
+
defaultSession: types.optional(types.frozen(), {
|
|
145
|
+
name: `New Session`,
|
|
146
|
+
}),
|
|
147
|
+
});
|
|
148
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import { BaseAssemblyConfigSchema } from '@jbrowse/core/assemblyManager';
|
|
3
|
+
import RpcManager from '@jbrowse/core/rpc/RpcManager';
|
|
4
|
+
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
5
|
+
import { PluginDefinition } from '@jbrowse/core/PluginLoader';
|
|
6
|
+
export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }: {
|
|
7
|
+
pluginManager: PluginManager;
|
|
8
|
+
assemblyConfigSchema: BaseAssemblyConfigSchema;
|
|
9
|
+
}): import("mobx-state-tree").IModelType<{
|
|
10
|
+
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
11
|
+
rpc: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
12
|
+
defaultDriver: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
defaultValue: string;
|
|
16
|
+
};
|
|
17
|
+
drivers: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IMapType<import("mobx-state-tree").ITypeUnion<import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<Record<string, any>>> | undefined, import("mobx-state-tree").ModelSnapshotType<Record<string, any>>, (Partial<import("mobx-state-tree/dist/internal").ExtractCFromProps<Record<string, any>>> & import("mobx-state-tree/dist/internal").NonEmptyObject) | undefined>>, [undefined]>;
|
|
18
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
19
|
+
highResolutionScaling: {
|
|
20
|
+
type: string;
|
|
21
|
+
defaultValue: number;
|
|
22
|
+
};
|
|
23
|
+
formatDetails: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
24
|
+
feature: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
defaultValue: {};
|
|
28
|
+
contextVariable: string[];
|
|
29
|
+
};
|
|
30
|
+
subfeatures: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
defaultValue: {};
|
|
34
|
+
contextVariable: string[];
|
|
35
|
+
};
|
|
36
|
+
depth: {
|
|
37
|
+
type: string;
|
|
38
|
+
defaultValue: number;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
42
|
+
formatAbout: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
43
|
+
config: {
|
|
44
|
+
type: string;
|
|
45
|
+
description: string;
|
|
46
|
+
defaultValue: {};
|
|
47
|
+
contextVariable: string[];
|
|
48
|
+
};
|
|
49
|
+
hideUris: {
|
|
50
|
+
type: string;
|
|
51
|
+
defaultValue: boolean;
|
|
52
|
+
};
|
|
53
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
54
|
+
shareURL: {
|
|
55
|
+
type: string;
|
|
56
|
+
defaultValue: string;
|
|
57
|
+
};
|
|
58
|
+
disableAnalytics: {
|
|
59
|
+
type: string;
|
|
60
|
+
defaultValue: boolean;
|
|
61
|
+
};
|
|
62
|
+
theme: {
|
|
63
|
+
type: string;
|
|
64
|
+
defaultValue: {}; /**
|
|
65
|
+
* #action
|
|
66
|
+
*/
|
|
67
|
+
};
|
|
68
|
+
extraThemes: {
|
|
69
|
+
type: string;
|
|
70
|
+
defaultValue: {};
|
|
71
|
+
};
|
|
72
|
+
logoPath: {
|
|
73
|
+
type: string;
|
|
74
|
+
/**
|
|
75
|
+
* #action
|
|
76
|
+
*/
|
|
77
|
+
defaultValue: {
|
|
78
|
+
uri: string;
|
|
79
|
+
locationType: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
83
|
+
plugins: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<PluginDefinition, PluginDefinition, PluginDefinition>>;
|
|
84
|
+
assemblies: import("mobx-state-tree").IArrayType<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>;
|
|
85
|
+
tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
|
|
86
|
+
internetAccounts: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
|
|
87
|
+
aggregateTextSearchAdapters: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
|
|
88
|
+
connections: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
|
|
89
|
+
defaultSession: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
90
|
+
}, {
|
|
91
|
+
/**
|
|
92
|
+
* #getter
|
|
93
|
+
*/
|
|
94
|
+
readonly assemblyNames: string[];
|
|
95
|
+
/**
|
|
96
|
+
* #getter
|
|
97
|
+
*/
|
|
98
|
+
readonly rpcManager: RpcManager;
|
|
99
|
+
} & {
|
|
100
|
+
/**
|
|
101
|
+
* #action
|
|
102
|
+
*/
|
|
103
|
+
addAssemblyConf(conf: AnyConfigurationModel): {
|
|
104
|
+
[x: string]: any;
|
|
105
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
106
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
107
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>;
|
|
108
|
+
/**
|
|
109
|
+
* #action
|
|
110
|
+
*/
|
|
111
|
+
removeAssemblyConf(assemblyName: string): void;
|
|
112
|
+
/**
|
|
113
|
+
* #action
|
|
114
|
+
*/
|
|
115
|
+
addTrackConf(trackConf: AnyConfigurationModel): any;
|
|
116
|
+
/**
|
|
117
|
+
* #action
|
|
118
|
+
*/
|
|
119
|
+
addConnectionConf(connectionConf: AnyConfigurationModel): any;
|
|
120
|
+
/**
|
|
121
|
+
* #action
|
|
122
|
+
*/
|
|
123
|
+
deleteConnectionConf(configuration: AnyConfigurationModel): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* #action
|
|
126
|
+
*/
|
|
127
|
+
deleteTrackConf(trackConf: AnyConfigurationModel): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* #action
|
|
130
|
+
*/
|
|
131
|
+
addPlugin(pluginDefinition: PluginDefinition): void;
|
|
132
|
+
/**
|
|
133
|
+
* #action
|
|
134
|
+
*/
|
|
135
|
+
removePlugin(pluginDefinition: PluginDefinition): void;
|
|
136
|
+
/**
|
|
137
|
+
* #action
|
|
138
|
+
*/
|
|
139
|
+
addInternetAccountConf(internetAccountConf: AnyConfigurationModel): any;
|
|
140
|
+
/**
|
|
141
|
+
* #action
|
|
142
|
+
*/
|
|
143
|
+
deleteInternetAccountConf(configuration: AnyConfigurationModel): boolean;
|
|
144
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { cast, getParent } from 'mobx-state-tree';
|
|
2
|
+
import { readConfObject, } from '@jbrowse/core/configuration';
|
|
3
|
+
// locals
|
|
4
|
+
import { JBrowseConfigF } from '../JBrowseConfig';
|
|
5
|
+
export function JBrowseModelF({ pluginManager, assemblyConfigSchema, }) {
|
|
6
|
+
return JBrowseConfigF({ pluginManager, assemblyConfigSchema })
|
|
7
|
+
.views(self => ({
|
|
8
|
+
/**
|
|
9
|
+
* #getter
|
|
10
|
+
*/
|
|
11
|
+
get assemblyNames() {
|
|
12
|
+
return self.assemblies.map(assembly => readConfObject(assembly, 'name'));
|
|
13
|
+
},
|
|
14
|
+
/**
|
|
15
|
+
* #getter
|
|
16
|
+
*/
|
|
17
|
+
get rpcManager() {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
return getParent(self).rpcManager;
|
|
20
|
+
},
|
|
21
|
+
}))
|
|
22
|
+
.actions(self => ({
|
|
23
|
+
/**
|
|
24
|
+
* #action
|
|
25
|
+
*/
|
|
26
|
+
addAssemblyConf(conf) {
|
|
27
|
+
const { name } = conf;
|
|
28
|
+
if (!name) {
|
|
29
|
+
throw new Error('Can\'t add assembly with no "name"');
|
|
30
|
+
}
|
|
31
|
+
if (self.assemblyNames.includes(name)) {
|
|
32
|
+
throw new Error(`Can't add assembly with name "${name}", an assembly with that name already exists`);
|
|
33
|
+
}
|
|
34
|
+
const length = self.assemblies.push({
|
|
35
|
+
...conf,
|
|
36
|
+
sequence: {
|
|
37
|
+
type: 'ReferenceSequenceTrack',
|
|
38
|
+
trackId: `${name}-${Date.now()}`,
|
|
39
|
+
...conf.sequence,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
return self.assemblies[length - 1];
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* #action
|
|
46
|
+
*/
|
|
47
|
+
removeAssemblyConf(assemblyName) {
|
|
48
|
+
const toRemove = self.assemblies.find(a => a.name === assemblyName);
|
|
49
|
+
if (toRemove) {
|
|
50
|
+
self.assemblies.remove(toRemove);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* #action
|
|
55
|
+
*/
|
|
56
|
+
addTrackConf(trackConf) {
|
|
57
|
+
const { type } = trackConf;
|
|
58
|
+
if (!type) {
|
|
59
|
+
throw new Error(`unknown track type ${type}`);
|
|
60
|
+
}
|
|
61
|
+
const length = self.tracks.push(trackConf);
|
|
62
|
+
return self.tracks[length - 1];
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* #action
|
|
66
|
+
*/
|
|
67
|
+
addConnectionConf(connectionConf) {
|
|
68
|
+
const { type } = connectionConf;
|
|
69
|
+
if (!type) {
|
|
70
|
+
throw new Error(`unknown connection type ${type}`);
|
|
71
|
+
}
|
|
72
|
+
const length = self.connections.push(connectionConf);
|
|
73
|
+
return self.connections[length - 1];
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* #action
|
|
77
|
+
*/
|
|
78
|
+
deleteConnectionConf(configuration) {
|
|
79
|
+
const elt = self.connections.find(conn => conn.id === configuration.id);
|
|
80
|
+
return self.connections.remove(elt);
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* #action
|
|
84
|
+
*/
|
|
85
|
+
deleteTrackConf(trackConf) {
|
|
86
|
+
const elt = self.tracks.find(t => t.trackId === trackConf.trackId);
|
|
87
|
+
return self.tracks.remove(elt);
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* #action
|
|
91
|
+
*/
|
|
92
|
+
addPlugin(pluginDefinition) {
|
|
93
|
+
self.plugins.push(pluginDefinition);
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
+
const rootModel = getParent(self);
|
|
96
|
+
rootModel.setPluginsUpdated(true);
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* #action
|
|
100
|
+
*/
|
|
101
|
+
removePlugin(pluginDefinition) {
|
|
102
|
+
self.plugins = cast(self.plugins.filter(plugin => plugin.url !== pluginDefinition.url ||
|
|
103
|
+
plugin.umdUrl !== pluginDefinition.umdUrl ||
|
|
104
|
+
plugin.cjsUrl !== pluginDefinition.cjsUrl ||
|
|
105
|
+
plugin.esmUrl !== pluginDefinition.esmUrl));
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
|
+
getParent(self).setPluginsUpdated(true);
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* #action
|
|
111
|
+
*/
|
|
112
|
+
addInternetAccountConf(internetAccountConf) {
|
|
113
|
+
const { type } = internetAccountConf;
|
|
114
|
+
if (!type) {
|
|
115
|
+
throw new Error(`unknown internetAccount type ${type}`);
|
|
116
|
+
}
|
|
117
|
+
const length = self.internetAccounts.push(internetAccountConf);
|
|
118
|
+
return self.internetAccounts[length - 1];
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* #action
|
|
122
|
+
*/
|
|
123
|
+
deleteInternetAccountConf(configuration) {
|
|
124
|
+
const elt = self.internetAccounts.find(a => a.id === configuration.id);
|
|
125
|
+
return self.internetAccounts.remove(elt);
|
|
126
|
+
},
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { MenuItem } from '@jbrowse/core/ui/Menu';
|
|
2
|
+
export interface Menu {
|
|
3
|
+
label: string;
|
|
4
|
+
menuItems: MenuItem[];
|
|
5
|
+
}
|
|
6
|
+
export declare function RootAppMenuMixin(): import("mobx-state-tree").IModelType<{}, {
|
|
7
|
+
/**
|
|
8
|
+
* #action
|
|
9
|
+
*/
|
|
10
|
+
setMenus(newMenus: Menu[]): void;
|
|
11
|
+
/**
|
|
12
|
+
* #action
|
|
13
|
+
* Add a top-level menu
|
|
14
|
+
* @param menuName - Name of the menu to insert.
|
|
15
|
+
* @returns The new length of the top-level menus array
|
|
16
|
+
*/
|
|
17
|
+
appendMenu(menuName: string): number;
|
|
18
|
+
/**
|
|
19
|
+
* #action
|
|
20
|
+
* Insert a top-level menu
|
|
21
|
+
* @param menuName - Name of the menu to insert.
|
|
22
|
+
* @param position - Position to insert menu. If negative, counts from th
|
|
23
|
+
* end, e.g. `insertMenu('My Menu', -1)` will insert the menu as the
|
|
24
|
+
* second-to-last one.
|
|
25
|
+
* @returns The new length of the top-level menus array
|
|
26
|
+
*/
|
|
27
|
+
insertMenu(menuName: string, position: number): number;
|
|
28
|
+
/**
|
|
29
|
+
* #action
|
|
30
|
+
* Add a menu item to a top-level menu
|
|
31
|
+
* @param menuName - Name of the top-level menu to append to.
|
|
32
|
+
* @param menuItem - Menu item to append.
|
|
33
|
+
* @returns The new length of the menu
|
|
34
|
+
*/
|
|
35
|
+
appendToMenu(menuName: string, menuItem: MenuItem): number;
|
|
36
|
+
/**
|
|
37
|
+
* #action
|
|
38
|
+
* Insert a menu item into a top-level menu
|
|
39
|
+
* @param menuName - Name of the top-level menu to insert into
|
|
40
|
+
* @param menuItem - Menu item to insert
|
|
41
|
+
* @param position - Position to insert menu item. If negative, counts
|
|
42
|
+
* from the end, e.g. `insertMenu('My Menu', -1)` will insert the menu as
|
|
43
|
+
* the second-to-last one.
|
|
44
|
+
* @returns The new length of the menu
|
|
45
|
+
*/
|
|
46
|
+
insertInMenu(menuName: string, menuItem: MenuItem, position: number): number;
|
|
47
|
+
/**
|
|
48
|
+
* #action
|
|
49
|
+
* Add a menu item to a sub-menu
|
|
50
|
+
* @param menuPath - Path to the sub-menu to add to, starting with the
|
|
51
|
+
* top-level menu (e.g. `['File', 'Insert']`).
|
|
52
|
+
* @param menuItem - Menu item to append.
|
|
53
|
+
* @returns The new length of the sub-menu
|
|
54
|
+
*/
|
|
55
|
+
appendToSubMenu(menuPath: string[], menuItem: MenuItem): number;
|
|
56
|
+
/**
|
|
57
|
+
* #action
|
|
58
|
+
* Insert a menu item into a sub-menu
|
|
59
|
+
* @param menuPath - Path to the sub-menu to add to, starting with the
|
|
60
|
+
* top-level menu (e.g. `['File', 'Insert']`).
|
|
61
|
+
* @param menuItem - Menu item to insert.
|
|
62
|
+
* @param position - Position to insert menu item. If negative, counts
|
|
63
|
+
* from the end, e.g. `insertMenu('My Menu', -1)` will insert the menu as
|
|
64
|
+
* the second-to-last one.
|
|
65
|
+
* @returns The new length of the sub-menu
|
|
66
|
+
*/
|
|
67
|
+
insertInSubMenu(menuPath: string[], menuItem: MenuItem, position: number): number;
|
|
68
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { types } from 'mobx-state-tree';
|
|
2
|
+
export function RootAppMenuMixin() {
|
|
3
|
+
return types.model({}).actions(s => {
|
|
4
|
+
const self = s;
|
|
5
|
+
return {
|
|
6
|
+
/**
|
|
7
|
+
* #action
|
|
8
|
+
*/
|
|
9
|
+
setMenus(newMenus) {
|
|
10
|
+
self.menus = newMenus;
|
|
11
|
+
},
|
|
12
|
+
/**
|
|
13
|
+
* #action
|
|
14
|
+
* Add a top-level menu
|
|
15
|
+
* @param menuName - Name of the menu to insert.
|
|
16
|
+
* @returns The new length of the top-level menus array
|
|
17
|
+
*/
|
|
18
|
+
appendMenu(menuName) {
|
|
19
|
+
return self.menus.push({ label: menuName, menuItems: [] });
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* #action
|
|
23
|
+
* Insert a top-level menu
|
|
24
|
+
* @param menuName - Name of the menu to insert.
|
|
25
|
+
* @param position - Position to insert menu. If negative, counts from th
|
|
26
|
+
* end, e.g. `insertMenu('My Menu', -1)` will insert the menu as the
|
|
27
|
+
* second-to-last one.
|
|
28
|
+
* @returns The new length of the top-level menus array
|
|
29
|
+
*/
|
|
30
|
+
insertMenu(menuName, position) {
|
|
31
|
+
self.menus.splice((position < 0 ? self.menus.length : 0) + position, 0, {
|
|
32
|
+
label: menuName,
|
|
33
|
+
menuItems: [],
|
|
34
|
+
});
|
|
35
|
+
return self.menus.length;
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* #action
|
|
39
|
+
* Add a menu item to a top-level menu
|
|
40
|
+
* @param menuName - Name of the top-level menu to append to.
|
|
41
|
+
* @param menuItem - Menu item to append.
|
|
42
|
+
* @returns The new length of the menu
|
|
43
|
+
*/
|
|
44
|
+
appendToMenu(menuName, menuItem) {
|
|
45
|
+
const menu = self.menus.find(m => m.label === menuName);
|
|
46
|
+
if (!menu) {
|
|
47
|
+
self.menus.push({ label: menuName, menuItems: [menuItem] });
|
|
48
|
+
return 1;
|
|
49
|
+
}
|
|
50
|
+
return menu.menuItems.push(menuItem);
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* #action
|
|
54
|
+
* Insert a menu item into a top-level menu
|
|
55
|
+
* @param menuName - Name of the top-level menu to insert into
|
|
56
|
+
* @param menuItem - Menu item to insert
|
|
57
|
+
* @param position - Position to insert menu item. If negative, counts
|
|
58
|
+
* from the end, e.g. `insertMenu('My Menu', -1)` will insert the menu as
|
|
59
|
+
* the second-to-last one.
|
|
60
|
+
* @returns The new length of the menu
|
|
61
|
+
*/
|
|
62
|
+
insertInMenu(menuName, menuItem, position) {
|
|
63
|
+
const menu = self.menus.find(m => m.label === menuName);
|
|
64
|
+
if (!menu) {
|
|
65
|
+
self.menus.push({ label: menuName, menuItems: [menuItem] });
|
|
66
|
+
return 1;
|
|
67
|
+
}
|
|
68
|
+
const insertPosition = position < 0 ? menu.menuItems.length + position : position;
|
|
69
|
+
menu.menuItems.splice(insertPosition, 0, menuItem);
|
|
70
|
+
return menu.menuItems.length;
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* #action
|
|
74
|
+
* Add a menu item to a sub-menu
|
|
75
|
+
* @param menuPath - Path to the sub-menu to add to, starting with the
|
|
76
|
+
* top-level menu (e.g. `['File', 'Insert']`).
|
|
77
|
+
* @param menuItem - Menu item to append.
|
|
78
|
+
* @returns The new length of the sub-menu
|
|
79
|
+
*/
|
|
80
|
+
appendToSubMenu(menuPath, menuItem) {
|
|
81
|
+
let topMenu = self.menus.find(m => m.label === menuPath[0]);
|
|
82
|
+
if (!topMenu) {
|
|
83
|
+
const idx = this.appendMenu(menuPath[0]);
|
|
84
|
+
topMenu = self.menus[idx - 1];
|
|
85
|
+
}
|
|
86
|
+
let { menuItems: subMenu } = topMenu;
|
|
87
|
+
const pathSoFar = [menuPath[0]];
|
|
88
|
+
menuPath.slice(1).forEach(menuName => {
|
|
89
|
+
pathSoFar.push(menuName);
|
|
90
|
+
let sm = subMenu.find(mi => 'label' in mi && mi.label === menuName);
|
|
91
|
+
if (!sm) {
|
|
92
|
+
const idx = subMenu.push({ label: menuName, subMenu: [] });
|
|
93
|
+
sm = subMenu[idx - 1];
|
|
94
|
+
}
|
|
95
|
+
if (!('subMenu' in sm)) {
|
|
96
|
+
throw new Error(`"${menuName}" in path "${pathSoFar}" is not a subMenu`);
|
|
97
|
+
}
|
|
98
|
+
subMenu = sm.subMenu;
|
|
99
|
+
});
|
|
100
|
+
return subMenu.push(menuItem);
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* #action
|
|
104
|
+
* Insert a menu item into a sub-menu
|
|
105
|
+
* @param menuPath - Path to the sub-menu to add to, starting with the
|
|
106
|
+
* top-level menu (e.g. `['File', 'Insert']`).
|
|
107
|
+
* @param menuItem - Menu item to insert.
|
|
108
|
+
* @param position - Position to insert menu item. If negative, counts
|
|
109
|
+
* from the end, e.g. `insertMenu('My Menu', -1)` will insert the menu as
|
|
110
|
+
* the second-to-last one.
|
|
111
|
+
* @returns The new length of the sub-menu
|
|
112
|
+
*/
|
|
113
|
+
insertInSubMenu(menuPath, menuItem, position) {
|
|
114
|
+
let topMenu = self.menus.find(m => m.label === menuPath[0]);
|
|
115
|
+
if (!topMenu) {
|
|
116
|
+
const idx = this.appendMenu(menuPath[0]);
|
|
117
|
+
topMenu = self.menus[idx - 1];
|
|
118
|
+
}
|
|
119
|
+
let { menuItems: subMenu } = topMenu;
|
|
120
|
+
const pathSoFar = [menuPath[0]];
|
|
121
|
+
menuPath.slice(1).forEach(menuName => {
|
|
122
|
+
pathSoFar.push(menuName);
|
|
123
|
+
let sm = subMenu.find(mi => 'label' in mi && mi.label === menuName);
|
|
124
|
+
if (!sm) {
|
|
125
|
+
const idx = subMenu.push({ label: menuName, subMenu: [] });
|
|
126
|
+
sm = subMenu[idx - 1];
|
|
127
|
+
}
|
|
128
|
+
if (!('subMenu' in sm)) {
|
|
129
|
+
throw new Error(`"${menuName}" in path "${pathSoFar}" is not a subMenu`);
|
|
130
|
+
}
|
|
131
|
+
subMenu = sm.subMenu;
|
|
132
|
+
});
|
|
133
|
+
subMenu.splice(position, 0, menuItem);
|
|
134
|
+
return subMenu.length;
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
}
|
package/esm/index.d.ts
ADDED
package/esm/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SessionWithDrawerWidgets } from '@jbrowse/core/util';
|
|
3
|
+
import { SnackbarMessage } from '@jbrowse/core/ui/SnackbarModel';
|
|
4
|
+
import { MenuItem as JBMenuItem } from '@jbrowse/core/ui/Menu';
|
|
5
|
+
type Props = {
|
|
6
|
+
HeaderButtons?: React.ReactElement;
|
|
7
|
+
session: SessionWithDrawerWidgets & {
|
|
8
|
+
savedSessionNames: string[];
|
|
9
|
+
menus: {
|
|
10
|
+
label: string;
|
|
11
|
+
menuItems: JBMenuItem[];
|
|
12
|
+
}[];
|
|
13
|
+
renameCurrentSession: (arg: string) => void;
|
|
14
|
+
snackbarMessages: SnackbarMessage[];
|
|
15
|
+
popSnackbarMessage: () => unknown;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
declare const App: (props: Props) => React.JSX.Element;
|
|
19
|
+
export { App };
|