@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,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSessionWithSessionTracks = exports.SessionTracksManagerSessionMixin = void 0;
4
+ const mobx_state_tree_1 = require("mobx-state-tree");
5
+ // locals
6
+ const Tracks_1 = require("./Tracks");
7
+ const BaseSession_1 = require("./BaseSession");
8
+ /**
9
+ * #stateModel SessionTracksManagerSessionMixin
10
+ */
11
+ function SessionTracksManagerSessionMixin(pluginManager) {
12
+ return (0, Tracks_1.TracksManagerSessionMixin)(pluginManager)
13
+ .named('SessionTracksManagerSessionMixin')
14
+ .props({
15
+ /**
16
+ * #property
17
+ */
18
+ sessionTracks: mobx_state_tree_1.types.array(pluginManager.pluggableConfigSchemaType('track')),
19
+ })
20
+ .views(self => ({
21
+ /**
22
+ * #getter
23
+ */
24
+ get tracks() {
25
+ return self.jbrowse.tracks;
26
+ },
27
+ }))
28
+ .actions(self => {
29
+ const { addTrackConf: superAddTrackConf, deleteTrackConf: superDeleteTrackConf, } = self;
30
+ return {
31
+ /**
32
+ * #action
33
+ */
34
+ addTrackConf(trackConf) {
35
+ if (self.adminMode) {
36
+ return superAddTrackConf(trackConf);
37
+ }
38
+ const { trackId, type } = trackConf;
39
+ if (!type) {
40
+ throw new Error(`unknown track type ${type}`);
41
+ }
42
+ const track = self.sessionTracks.find(t => t.trackId === trackId);
43
+ if (track) {
44
+ return track;
45
+ }
46
+ const length = self.sessionTracks.push(trackConf);
47
+ return self.sessionTracks[length - 1];
48
+ },
49
+ /**
50
+ * #action
51
+ */
52
+ deleteTrackConf(trackConf) {
53
+ // try to delete it in the main config if in admin mode
54
+ const found = superDeleteTrackConf(trackConf);
55
+ if (found) {
56
+ return found;
57
+ }
58
+ // if not found or not in admin mode, try to delete it in the
59
+ // sessionTracks
60
+ const { trackId } = trackConf;
61
+ const idx = self.sessionTracks.findIndex(t => t.trackId === trackId);
62
+ if (idx === -1) {
63
+ return undefined;
64
+ }
65
+ return self.sessionTracks.splice(idx, 1);
66
+ },
67
+ };
68
+ });
69
+ }
70
+ exports.SessionTracksManagerSessionMixin = SessionTracksManagerSessionMixin;
71
+ /** Type guard for SessionWithSessionTracks */
72
+ function isSessionWithSessionTracks(thing) {
73
+ return (0, BaseSession_1.isBaseSession)(thing) && 'sessionTracks' in thing;
74
+ }
75
+ exports.isSessionWithSessionTracks = isSessionWithSessionTracks;
@@ -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,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSessionWithThemes = exports.ThemeManagerSessionMixin = void 0;
4
+ const mobx_state_tree_1 = require("mobx-state-tree");
5
+ const configuration_1 = require("@jbrowse/core/configuration");
6
+ const ui_1 = require("@jbrowse/core/ui");
7
+ const util_1 = require("@jbrowse/core/util");
8
+ const mobx_1 = require("mobx");
9
+ /**
10
+ * #stateModel ThemeManagerSessionMixin
11
+ */
12
+ function ThemeManagerSessionMixin(pluginManager) {
13
+ return mobx_state_tree_1.types
14
+ .model({})
15
+ .volatile(() => ({
16
+ sessionThemeName: (0, util_1.localStorageGetItem)('themeName') || 'default',
17
+ }))
18
+ .views(s => ({
19
+ /**
20
+ * #method
21
+ */
22
+ allThemes() {
23
+ const self = s;
24
+ const extraThemes = (0, configuration_1.getConf)(self.jbrowse, 'extraThemes');
25
+ return { ...ui_1.defaultThemes, ...extraThemes };
26
+ },
27
+ /**
28
+ * #getter
29
+ */
30
+ get themeName() {
31
+ const { sessionThemeName } = s;
32
+ const all = this.allThemes();
33
+ return all[sessionThemeName] ? sessionThemeName : 'default';
34
+ },
35
+ /**
36
+ * #getter
37
+ */
38
+ get theme() {
39
+ const self = s;
40
+ const configTheme = (0, configuration_1.getConf)(self.jbrowse, 'theme');
41
+ const all = this.allThemes();
42
+ return (0, ui_1.createJBrowseTheme)(configTheme, all, this.themeName);
43
+ },
44
+ }))
45
+ .actions(self => ({
46
+ /**
47
+ * #action
48
+ */
49
+ setThemeName(name) {
50
+ self.sessionThemeName = name;
51
+ },
52
+ afterAttach() {
53
+ (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
54
+ (0, util_1.localStorageSetItem)('themeName', self.themeName);
55
+ }));
56
+ },
57
+ }));
58
+ }
59
+ exports.ThemeManagerSessionMixin = ThemeManagerSessionMixin;
60
+ /** Type guard for SessionWithThemes */
61
+ function isSessionWithThemes(session) {
62
+ return 'theme' in session;
63
+ }
64
+ exports.isSessionWithThemes = isSessionWithThemes;