@jbrowse/react-app2 3.2.0
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/JBrowseApp/AppReExport.d.ts +1 -0
- package/dist/JBrowseApp/AppReExport.js +5 -0
- package/dist/JBrowseApp/JBrowseApp.d.ts +5 -0
- package/dist/JBrowseApp/JBrowseApp.js +55 -0
- package/dist/JBrowseApp/index.d.ts +1 -0
- package/dist/JBrowseApp/index.js +8 -0
- package/dist/components/AboutDialog.d.ts +1 -0
- package/dist/components/AboutDialog.js +5 -0
- package/dist/components/PreferencesDialog.d.ts +14 -0
- package/dist/components/PreferencesDialog.js +21 -0
- package/dist/corePlugins.d.ts +3 -0
- package/dist/corePlugins.js +64 -0
- package/dist/createModel.d.ts +581 -0
- package/dist/createModel.js +26 -0
- package/dist/createViewState.d.ts +1769 -0
- package/dist/createViewState.js +23 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +14 -0
- package/dist/jbrowseModel.d.ts +139 -0
- package/dist/jbrowseModel.js +7 -0
- package/dist/loadPlugins.d.ts +12 -0
- package/dist/loadPlugins.js +12 -0
- package/dist/react-app.umd.production.min.js +185 -0
- package/dist/react-app.umd.production.min.js.LICENSE.txt +198 -0
- package/dist/react-app.umd.production.min.js.map +1 -0
- package/dist/rootModel/rootModel.d.ts +596 -0
- package/dist/rootModel/rootModel.js +166 -0
- package/dist/rootModel/rootModel.test.d.ts +1 -0
- package/dist/rootModel/rootModel.test.js +140 -0
- package/dist/rpcWorker.d.ts +2 -0
- package/dist/rpcWorker.js +49 -0
- package/dist/sessionModel/index.d.ts +2003 -0
- package/dist/sessionModel/index.js +10 -0
- package/dist/util.d.ts +5 -0
- package/dist/util.js +119 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +4 -0
- package/dist/webpack.d.ts +7 -0
- package/dist/webpack.js +53 -0
- package/dist/workerPolyfill.d.ts +0 -0
- package/dist/workerPolyfill.js +32 -0
- package/esm/JBrowseApp/AppReExport.d.ts +1 -0
- package/esm/JBrowseApp/AppReExport.js +1 -0
- package/esm/JBrowseApp/JBrowseApp.d.ts +5 -0
- package/esm/JBrowseApp/JBrowseApp.js +20 -0
- package/esm/JBrowseApp/index.d.ts +1 -0
- package/esm/JBrowseApp/index.js +1 -0
- package/esm/components/AboutDialog.d.ts +1 -0
- package/esm/components/AboutDialog.js +1 -0
- package/esm/components/PreferencesDialog.d.ts +14 -0
- package/esm/components/PreferencesDialog.js +19 -0
- package/esm/corePlugins.d.ts +3 -0
- package/esm/corePlugins.js +59 -0
- package/esm/createModel.d.ts +581 -0
- package/esm/createModel.js +20 -0
- package/esm/createViewState.d.ts +1769 -0
- package/esm/createViewState.js +17 -0
- package/esm/index.d.ts +4 -0
- package/esm/index.js +4 -0
- package/esm/jbrowseModel.d.ts +139 -0
- package/esm/jbrowseModel.js +4 -0
- package/esm/loadPlugins.d.ts +12 -0
- package/esm/loadPlugins.js +6 -0
- package/esm/makeWorkerInstance.d.ts +1 -0
- package/esm/makeWorkerInstance.js +3 -0
- package/esm/rootModel/rootModel.d.ts +596 -0
- package/esm/rootModel/rootModel.js +160 -0
- package/esm/rpcWorker.d.ts +2 -0
- package/esm/rpcWorker.js +10 -0
- package/esm/sessionModel/index.d.ts +2003 -0
- package/esm/sessionModel/index.js +7 -0
- package/esm/util.d.ts +5 -0
- package/esm/util.js +80 -0
- package/esm/version.d.ts +1 -0
- package/esm/version.js +1 -0
- package/esm/webpack.d.ts +7 -0
- package/esm/webpack.js +7 -0
- package/esm/workerPolyfill.d.ts +0 -0
- package/esm/workerPolyfill.js +32 -0
- package/package.json +103 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { RootAppMenuMixin, processMutableMenuActions } from '@jbrowse/app-core';
|
|
2
|
+
import TextSearchManager from '@jbrowse/core/TextSearch/TextSearchManager';
|
|
3
|
+
import assemblyConfigSchemaFactory from '@jbrowse/core/assemblyManager/assemblyConfigSchema';
|
|
4
|
+
import RpcManager from '@jbrowse/core/rpc/RpcManager';
|
|
5
|
+
import { Cable } from '@jbrowse/core/ui/Icons';
|
|
6
|
+
import { BaseRootModelFactory, InternetAccountsRootModelMixin, } from '@jbrowse/product-core';
|
|
7
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
8
|
+
import GetAppIcon from '@mui/icons-material/GetApp';
|
|
9
|
+
import PublishIcon from '@mui/icons-material/Publish';
|
|
10
|
+
import StorageIcon from '@mui/icons-material/Storage';
|
|
11
|
+
import { saveAs } from 'file-saver';
|
|
12
|
+
import { autorun } from 'mobx';
|
|
13
|
+
import { addDisposer, cast, getSnapshot, getType, types } from 'mobx-state-tree';
|
|
14
|
+
import jbrowseWebFactory from '../jbrowseModel';
|
|
15
|
+
import { filterSessionInPlace } from '../util';
|
|
16
|
+
import { version } from '../version';
|
|
17
|
+
export default function RootModel({ pluginManager, sessionModelFactory, makeWorkerInstance = () => {
|
|
18
|
+
throw new Error('no makeWorkerInstance supplied');
|
|
19
|
+
}, }) {
|
|
20
|
+
const assemblyConfigSchema = assemblyConfigSchemaFactory(pluginManager);
|
|
21
|
+
return types
|
|
22
|
+
.compose(BaseRootModelFactory({
|
|
23
|
+
pluginManager,
|
|
24
|
+
jbrowseModelType: jbrowseWebFactory({
|
|
25
|
+
pluginManager,
|
|
26
|
+
assemblyConfigSchema,
|
|
27
|
+
}),
|
|
28
|
+
sessionModelType: sessionModelFactory({
|
|
29
|
+
pluginManager,
|
|
30
|
+
assemblyConfigSchema,
|
|
31
|
+
}),
|
|
32
|
+
assemblyConfigSchema,
|
|
33
|
+
}), InternetAccountsRootModelMixin(pluginManager), RootAppMenuMixin())
|
|
34
|
+
.volatile(self => ({
|
|
35
|
+
version,
|
|
36
|
+
pluginsUpdated: false,
|
|
37
|
+
rpcManager: new RpcManager(pluginManager, self.jbrowse.configuration.rpc, {
|
|
38
|
+
WebWorkerRpcDriver: {
|
|
39
|
+
makeWorkerInstance,
|
|
40
|
+
},
|
|
41
|
+
MainThreadRpcDriver: {},
|
|
42
|
+
}),
|
|
43
|
+
textSearchManager: new TextSearchManager(pluginManager),
|
|
44
|
+
error: undefined,
|
|
45
|
+
}))
|
|
46
|
+
.actions(self => {
|
|
47
|
+
return {
|
|
48
|
+
afterCreate() {
|
|
49
|
+
addDisposer(self, autorun(() => {
|
|
50
|
+
if (self.pluginsUpdated) {
|
|
51
|
+
window.location.reload();
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
},
|
|
55
|
+
setSession(sessionSnapshot) {
|
|
56
|
+
const oldSession = self.session;
|
|
57
|
+
self.session = cast(sessionSnapshot);
|
|
58
|
+
if (self.session) {
|
|
59
|
+
try {
|
|
60
|
+
filterSessionInPlace(self.session, getType(self.session));
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
self.session = oldSession;
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
setPluginsUpdated(flag) {
|
|
69
|
+
self.pluginsUpdated = flag;
|
|
70
|
+
},
|
|
71
|
+
setDefaultSession() {
|
|
72
|
+
const { defaultSession } = self.jbrowse;
|
|
73
|
+
this.setSession({
|
|
74
|
+
...defaultSession,
|
|
75
|
+
name: `${defaultSession.name} ${new Date().toLocaleString()}`,
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
renameCurrentSession(sessionName) {
|
|
79
|
+
if (self.session) {
|
|
80
|
+
this.setSession({
|
|
81
|
+
...getSnapshot(self.session),
|
|
82
|
+
name: sessionName,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
setError(error) {
|
|
87
|
+
self.error = error;
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
})
|
|
91
|
+
.views(self => ({
|
|
92
|
+
menus() {
|
|
93
|
+
return processMutableMenuActions([
|
|
94
|
+
{
|
|
95
|
+
label: 'File',
|
|
96
|
+
menuItems: [
|
|
97
|
+
{
|
|
98
|
+
label: 'New session',
|
|
99
|
+
icon: AddIcon,
|
|
100
|
+
onClick: (session) => {
|
|
101
|
+
session.setDefaultSession();
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
label: 'Import session…',
|
|
106
|
+
icon: PublishIcon,
|
|
107
|
+
onClick: (session) => {
|
|
108
|
+
const widget = session.addWidget('ImportSessionWidget', 'importSessionWidget');
|
|
109
|
+
session.showWidget(widget);
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
label: 'Export session',
|
|
114
|
+
icon: GetAppIcon,
|
|
115
|
+
onClick: (session) => {
|
|
116
|
+
const sessionBlob = new Blob([
|
|
117
|
+
JSON.stringify({ session: getSnapshot(session) }, null, 2),
|
|
118
|
+
], { type: 'text/plain;charset=utf-8' });
|
|
119
|
+
saveAs(sessionBlob, 'session.json');
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{ type: 'divider' },
|
|
123
|
+
{
|
|
124
|
+
label: 'Open track...',
|
|
125
|
+
icon: StorageIcon,
|
|
126
|
+
onClick: (session) => {
|
|
127
|
+
if (session.views.length === 0) {
|
|
128
|
+
session.notify('Please open a view to add a track first');
|
|
129
|
+
}
|
|
130
|
+
else if (session.views.length > 0) {
|
|
131
|
+
const widget = session.addWidget('AddTrackWidget', 'addTrackWidget', { view: session.views[0].id });
|
|
132
|
+
session.showWidget(widget);
|
|
133
|
+
if (session.views.length > 1) {
|
|
134
|
+
session.notify('This will add a track to the first view. Note: if you want to open a track in a specific view open the track selector for that view and use the add track (plus icon) in the bottom right');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
label: 'Open connection...',
|
|
141
|
+
icon: Cable,
|
|
142
|
+
onClick: (session) => {
|
|
143
|
+
const widget = session.addWidget('AddConnectionWidget', 'addConnectionWidget');
|
|
144
|
+
session.showWidget(widget);
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
label: 'Add',
|
|
151
|
+
menuItems: [],
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
label: 'Tools',
|
|
155
|
+
menuItems: [],
|
|
156
|
+
},
|
|
157
|
+
], self.mutableMenuActions);
|
|
158
|
+
},
|
|
159
|
+
}));
|
|
160
|
+
}
|
package/esm/rpcWorker.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import './workerPolyfill';
|
|
2
|
+
import { initializeWorker } from '@jbrowse/product-core';
|
|
3
|
+
import { enableStaticRendering } from 'mobx-react';
|
|
4
|
+
import corePlugins from './corePlugins';
|
|
5
|
+
enableStaticRendering(true);
|
|
6
|
+
initializeWorker(corePlugins, {
|
|
7
|
+
fetchESM: url => import(url),
|
|
8
|
+
});
|
|
9
|
+
export default function doNothing() {
|
|
10
|
+
}
|