@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.
Files changed (92) hide show
  1. package/LICENSE +201 -0
  2. package/dist/RootModel/BaseRootModel.d.ts +607 -0
  3. package/dist/RootModel/BaseRootModel.js +101 -0
  4. package/dist/RootModel/InternetAccounts.d.ts +31 -0
  5. package/dist/RootModel/InternetAccounts.js +99 -0
  6. package/dist/RootModel/index.d.ts +2 -0
  7. package/dist/RootModel/index.js +18 -0
  8. package/dist/Session/BaseSession.d.ts +99 -0
  9. package/dist/Session/BaseSession.js +112 -0
  10. package/dist/Session/Connections.d.ts +174 -0
  11. package/dist/Session/Connections.js +113 -0
  12. package/dist/Session/DialogQueue.d.ts +34 -0
  13. package/dist/Session/DialogQueue.js +55 -0
  14. package/dist/Session/DrawerWidgets.d.ts +88 -0
  15. package/dist/Session/DrawerWidgets.js +167 -0
  16. package/dist/Session/MultipleViews.d.ts +1798 -0
  17. package/dist/Session/MultipleViews.js +105 -0
  18. package/dist/Session/ReferenceManagement.d.ts +34 -0
  19. package/dist/Session/ReferenceManagement.js +91 -0
  20. package/dist/Session/SessionTracks.d.ts +1866 -0
  21. package/dist/Session/SessionTracks.js +75 -0
  22. package/dist/Session/Themes.d.ts +38 -0
  23. package/dist/Session/Themes.js +64 -0
  24. package/dist/Session/Tracks.d.ts +1821 -0
  25. package/dist/Session/Tracks.js +51 -0
  26. package/dist/Session/index.d.ts +10 -0
  27. package/dist/Session/index.js +26 -0
  28. package/dist/index.d.ts +3 -0
  29. package/dist/index.js +19 -0
  30. package/dist/ui/AboutDialog.d.ts +6 -0
  31. package/dist/ui/AboutDialog.js +20 -0
  32. package/dist/ui/AboutDialogContents.d.ts +5 -0
  33. package/dist/ui/AboutDialogContents.js +70 -0
  34. package/dist/ui/FileInfoPanel.d.ts +5 -0
  35. package/dist/ui/FileInfoPanel.js +76 -0
  36. package/dist/ui/index.d.ts +1 -0
  37. package/dist/ui/index.js +17 -0
  38. package/esm/RootModel/BaseRootModel.d.ts +607 -0
  39. package/esm/RootModel/BaseRootModel.js +93 -0
  40. package/esm/RootModel/InternetAccounts.d.ts +31 -0
  41. package/esm/RootModel/InternetAccounts.js +95 -0
  42. package/esm/RootModel/index.d.ts +2 -0
  43. package/esm/RootModel/index.js +2 -0
  44. package/esm/Session/BaseSession.d.ts +99 -0
  45. package/esm/Session/BaseSession.js +103 -0
  46. package/esm/Session/Connections.d.ts +174 -0
  47. package/esm/Session/Connections.js +108 -0
  48. package/esm/Session/DialogQueue.d.ts +34 -0
  49. package/esm/Session/DialogQueue.js +50 -0
  50. package/esm/Session/DrawerWidgets.d.ts +88 -0
  51. package/esm/Session/DrawerWidgets.js +162 -0
  52. package/esm/Session/MultipleViews.d.ts +1798 -0
  53. package/esm/Session/MultipleViews.js +100 -0
  54. package/esm/Session/ReferenceManagement.d.ts +34 -0
  55. package/esm/Session/ReferenceManagement.js +86 -0
  56. package/esm/Session/SessionTracks.d.ts +1866 -0
  57. package/esm/Session/SessionTracks.js +70 -0
  58. package/esm/Session/Themes.d.ts +38 -0
  59. package/esm/Session/Themes.js +59 -0
  60. package/esm/Session/Tracks.d.ts +1821 -0
  61. package/esm/Session/Tracks.js +46 -0
  62. package/esm/Session/index.d.ts +10 -0
  63. package/esm/Session/index.js +10 -0
  64. package/esm/index.d.ts +3 -0
  65. package/esm/index.js +3 -0
  66. package/esm/ui/AboutDialog.d.ts +6 -0
  67. package/esm/ui/AboutDialog.js +13 -0
  68. package/esm/ui/AboutDialogContents.d.ts +5 -0
  69. package/esm/ui/AboutDialogContents.js +41 -0
  70. package/esm/ui/FileInfoPanel.d.ts +5 -0
  71. package/esm/ui/FileInfoPanel.js +47 -0
  72. package/esm/ui/index.d.ts +1 -0
  73. package/esm/ui/index.js +1 -0
  74. package/package.json +66 -0
  75. package/src/RootModel/BaseRootModel.ts +131 -0
  76. package/src/RootModel/InternetAccounts.ts +126 -0
  77. package/src/RootModel/index.ts +2 -0
  78. package/src/Session/BaseSession.ts +129 -0
  79. package/src/Session/Connections.ts +145 -0
  80. package/src/Session/DialogQueue.ts +63 -0
  81. package/src/Session/DrawerWidgets.ts +222 -0
  82. package/src/Session/MultipleViews.ts +151 -0
  83. package/src/Session/ReferenceManagement.ts +134 -0
  84. package/src/Session/SessionTracks.ts +98 -0
  85. package/src/Session/Themes.ts +85 -0
  86. package/src/Session/Tracks.ts +72 -0
  87. package/src/Session/index.ts +10 -0
  88. package/src/index.ts +3 -0
  89. package/src/ui/AboutDialog.tsx +31 -0
  90. package/src/ui/AboutDialogContents.tsx +88 -0
  91. package/src/ui/FileInfoPanel.tsx +75 -0
  92. package/src/ui/index.ts +1 -0
@@ -0,0 +1,70 @@
1
+ import { types } from 'mobx-state-tree';
2
+ // locals
3
+ import { TracksManagerSessionMixin } from './Tracks';
4
+ import { isBaseSession } from './BaseSession';
5
+ /**
6
+ * #stateModel SessionTracksManagerSessionMixin
7
+ */
8
+ export function SessionTracksManagerSessionMixin(pluginManager) {
9
+ return TracksManagerSessionMixin(pluginManager)
10
+ .named('SessionTracksManagerSessionMixin')
11
+ .props({
12
+ /**
13
+ * #property
14
+ */
15
+ sessionTracks: types.array(pluginManager.pluggableConfigSchemaType('track')),
16
+ })
17
+ .views(self => ({
18
+ /**
19
+ * #getter
20
+ */
21
+ get tracks() {
22
+ return self.jbrowse.tracks;
23
+ },
24
+ }))
25
+ .actions(self => {
26
+ const { addTrackConf: superAddTrackConf, deleteTrackConf: superDeleteTrackConf, } = self;
27
+ return {
28
+ /**
29
+ * #action
30
+ */
31
+ addTrackConf(trackConf) {
32
+ if (self.adminMode) {
33
+ return superAddTrackConf(trackConf);
34
+ }
35
+ const { trackId, type } = trackConf;
36
+ if (!type) {
37
+ throw new Error(`unknown track type ${type}`);
38
+ }
39
+ const track = self.sessionTracks.find(t => t.trackId === trackId);
40
+ if (track) {
41
+ return track;
42
+ }
43
+ const length = self.sessionTracks.push(trackConf);
44
+ return self.sessionTracks[length - 1];
45
+ },
46
+ /**
47
+ * #action
48
+ */
49
+ deleteTrackConf(trackConf) {
50
+ // try to delete it in the main config if in admin mode
51
+ const found = superDeleteTrackConf(trackConf);
52
+ if (found) {
53
+ return found;
54
+ }
55
+ // if not found or not in admin mode, try to delete it in the
56
+ // sessionTracks
57
+ const { trackId } = trackConf;
58
+ const idx = self.sessionTracks.findIndex(t => t.trackId === trackId);
59
+ if (idx === -1) {
60
+ return undefined;
61
+ }
62
+ return self.sessionTracks.splice(idx, 1);
63
+ },
64
+ };
65
+ });
66
+ }
67
+ /** Type guard for SessionWithSessionTracks */
68
+ export function isSessionWithSessionTracks(thing) {
69
+ return isBaseSession(thing) && 'sessionTracks' in thing;
70
+ }
@@ -0,0 +1,38 @@
1
+ import { IAnyStateTreeNode, Instance } from 'mobx-state-tree';
2
+ import PluginManager from '@jbrowse/core/PluginManager';
3
+ import { ThemeOptions } from '@mui/material';
4
+ type ThemeMap = {
5
+ [key: string]: ThemeOptions;
6
+ };
7
+ /**
8
+ * #stateModel ThemeManagerSessionMixin
9
+ */
10
+ export declare function ThemeManagerSessionMixin(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{}, {
11
+ sessionThemeName: string;
12
+ } & {
13
+ /**
14
+ * #method
15
+ */
16
+ allThemes(): ThemeMap;
17
+ /**
18
+ * #getter
19
+ */
20
+ readonly themeName: string;
21
+ /**
22
+ * #getter
23
+ */
24
+ readonly theme: import("@mui/material").Theme;
25
+ } & {
26
+ /**
27
+ * #action
28
+ */
29
+ setThemeName(name: string): void;
30
+ afterAttach(): void;
31
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
32
+ /** Session mixin MST type for a session that supports theming */
33
+ export type SessionWithThemesType = ReturnType<typeof ThemeManagerSessionMixin>;
34
+ /** Instance of a session that has theming support */
35
+ export type SessionWithThemes = Instance<SessionWithThemesType>;
36
+ /** Type guard for SessionWithThemes */
37
+ export declare function isSessionWithThemes(session: IAnyStateTreeNode): session is SessionWithThemes;
38
+ export {};
@@ -0,0 +1,59 @@
1
+ import { addDisposer, types, } from 'mobx-state-tree';
2
+ import { getConf } from '@jbrowse/core/configuration';
3
+ import { createJBrowseTheme, defaultThemes } from '@jbrowse/core/ui';
4
+ import { localStorageGetItem, localStorageSetItem } from '@jbrowse/core/util';
5
+ import { autorun } from 'mobx';
6
+ /**
7
+ * #stateModel ThemeManagerSessionMixin
8
+ */
9
+ export function ThemeManagerSessionMixin(pluginManager) {
10
+ return types
11
+ .model({})
12
+ .volatile(() => ({
13
+ sessionThemeName: localStorageGetItem('themeName') || 'default',
14
+ }))
15
+ .views(s => ({
16
+ /**
17
+ * #method
18
+ */
19
+ allThemes() {
20
+ const self = s;
21
+ const extraThemes = getConf(self.jbrowse, 'extraThemes');
22
+ return { ...defaultThemes, ...extraThemes };
23
+ },
24
+ /**
25
+ * #getter
26
+ */
27
+ get themeName() {
28
+ const { sessionThemeName } = s;
29
+ const all = this.allThemes();
30
+ return all[sessionThemeName] ? sessionThemeName : 'default';
31
+ },
32
+ /**
33
+ * #getter
34
+ */
35
+ get theme() {
36
+ const self = s;
37
+ const configTheme = getConf(self.jbrowse, 'theme');
38
+ const all = this.allThemes();
39
+ return createJBrowseTheme(configTheme, all, this.themeName);
40
+ },
41
+ }))
42
+ .actions(self => ({
43
+ /**
44
+ * #action
45
+ */
46
+ setThemeName(name) {
47
+ self.sessionThemeName = name;
48
+ },
49
+ afterAttach() {
50
+ addDisposer(self, autorun(() => {
51
+ localStorageSetItem('themeName', self.themeName);
52
+ }));
53
+ },
54
+ }));
55
+ }
56
+ /** Type guard for SessionWithThemes */
57
+ export function isSessionWithThemes(session) {
58
+ return 'theme' in session;
59
+ }