@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.
Files changed (81) hide show
  1. package/LICENSE +201 -0
  2. package/dist/JBrowseApp/AppReExport.d.ts +1 -0
  3. package/dist/JBrowseApp/AppReExport.js +5 -0
  4. package/dist/JBrowseApp/JBrowseApp.d.ts +5 -0
  5. package/dist/JBrowseApp/JBrowseApp.js +55 -0
  6. package/dist/JBrowseApp/index.d.ts +1 -0
  7. package/dist/JBrowseApp/index.js +8 -0
  8. package/dist/components/AboutDialog.d.ts +1 -0
  9. package/dist/components/AboutDialog.js +5 -0
  10. package/dist/components/PreferencesDialog.d.ts +14 -0
  11. package/dist/components/PreferencesDialog.js +21 -0
  12. package/dist/corePlugins.d.ts +3 -0
  13. package/dist/corePlugins.js +64 -0
  14. package/dist/createModel.d.ts +581 -0
  15. package/dist/createModel.js +26 -0
  16. package/dist/createViewState.d.ts +1769 -0
  17. package/dist/createViewState.js +23 -0
  18. package/dist/index.d.ts +4 -0
  19. package/dist/index.js +14 -0
  20. package/dist/jbrowseModel.d.ts +139 -0
  21. package/dist/jbrowseModel.js +7 -0
  22. package/dist/loadPlugins.d.ts +12 -0
  23. package/dist/loadPlugins.js +12 -0
  24. package/dist/react-app.umd.production.min.js +185 -0
  25. package/dist/react-app.umd.production.min.js.LICENSE.txt +198 -0
  26. package/dist/react-app.umd.production.min.js.map +1 -0
  27. package/dist/rootModel/rootModel.d.ts +596 -0
  28. package/dist/rootModel/rootModel.js +166 -0
  29. package/dist/rootModel/rootModel.test.d.ts +1 -0
  30. package/dist/rootModel/rootModel.test.js +140 -0
  31. package/dist/rpcWorker.d.ts +2 -0
  32. package/dist/rpcWorker.js +49 -0
  33. package/dist/sessionModel/index.d.ts +2003 -0
  34. package/dist/sessionModel/index.js +10 -0
  35. package/dist/util.d.ts +5 -0
  36. package/dist/util.js +119 -0
  37. package/dist/version.d.ts +1 -0
  38. package/dist/version.js +4 -0
  39. package/dist/webpack.d.ts +7 -0
  40. package/dist/webpack.js +53 -0
  41. package/dist/workerPolyfill.d.ts +0 -0
  42. package/dist/workerPolyfill.js +32 -0
  43. package/esm/JBrowseApp/AppReExport.d.ts +1 -0
  44. package/esm/JBrowseApp/AppReExport.js +1 -0
  45. package/esm/JBrowseApp/JBrowseApp.d.ts +5 -0
  46. package/esm/JBrowseApp/JBrowseApp.js +20 -0
  47. package/esm/JBrowseApp/index.d.ts +1 -0
  48. package/esm/JBrowseApp/index.js +1 -0
  49. package/esm/components/AboutDialog.d.ts +1 -0
  50. package/esm/components/AboutDialog.js +1 -0
  51. package/esm/components/PreferencesDialog.d.ts +14 -0
  52. package/esm/components/PreferencesDialog.js +19 -0
  53. package/esm/corePlugins.d.ts +3 -0
  54. package/esm/corePlugins.js +59 -0
  55. package/esm/createModel.d.ts +581 -0
  56. package/esm/createModel.js +20 -0
  57. package/esm/createViewState.d.ts +1769 -0
  58. package/esm/createViewState.js +17 -0
  59. package/esm/index.d.ts +4 -0
  60. package/esm/index.js +4 -0
  61. package/esm/jbrowseModel.d.ts +139 -0
  62. package/esm/jbrowseModel.js +4 -0
  63. package/esm/loadPlugins.d.ts +12 -0
  64. package/esm/loadPlugins.js +6 -0
  65. package/esm/makeWorkerInstance.d.ts +1 -0
  66. package/esm/makeWorkerInstance.js +3 -0
  67. package/esm/rootModel/rootModel.d.ts +596 -0
  68. package/esm/rootModel/rootModel.js +160 -0
  69. package/esm/rpcWorker.d.ts +2 -0
  70. package/esm/rpcWorker.js +10 -0
  71. package/esm/sessionModel/index.d.ts +2003 -0
  72. package/esm/sessionModel/index.js +7 -0
  73. package/esm/util.d.ts +5 -0
  74. package/esm/util.js +80 -0
  75. package/esm/version.d.ts +1 -0
  76. package/esm/version.js +1 -0
  77. package/esm/webpack.d.ts +7 -0
  78. package/esm/webpack.js +7 -0
  79. package/esm/workerPolyfill.d.ts +0 -0
  80. package/esm/workerPolyfill.js +32 -0
  81. 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
+ }
@@ -0,0 +1,2 @@
1
+ import './workerPolyfill';
2
+ export default function doNothing(): void;
@@ -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
+ }