@jbrowse/product-core 4.3.0 → 5.0.0-beta.10

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 (157) hide show
  1. package/esm/RootModel/BaseRootModel.d.ts +514 -323
  2. package/esm/RootModel/BaseRootModel.js +141 -14
  3. package/esm/RootModel/HierarchicalConfig.d.ts +30 -20
  4. package/esm/RootModel/HierarchicalConfig.js +36 -0
  5. package/esm/RootModel/InternetAccounts.d.ts +18 -1
  6. package/esm/RootModel/InternetAccounts.js +120 -22
  7. package/esm/RootModel/PreferencesConfig.d.ts +37 -0
  8. package/esm/RootModel/PreferencesConfig.js +75 -0
  9. package/esm/RootModel/createConfigModel.d.ts +257 -0
  10. package/esm/RootModel/createConfigModel.js +77 -0
  11. package/esm/RootModel/index.d.ts +10 -5
  12. package/esm/RootModel/index.js +10 -5
  13. package/esm/RootModel/menuItems.d.ts +24 -0
  14. package/esm/RootModel/menuItems.js +141 -0
  15. package/esm/Session/BaseSession.d.ts +285 -11
  16. package/esm/Session/BaseSession.js +383 -15
  17. package/esm/Session/Connections.d.ts +115 -8
  18. package/esm/Session/Connections.js +196 -74
  19. package/esm/Session/DrawerWidgets.d.ts +145 -13
  20. package/esm/Session/DrawerWidgets.js +219 -49
  21. package/esm/Session/MultipleViews.d.ts +1067 -1177
  22. package/esm/Session/MultipleViews.js +395 -64
  23. package/esm/Session/Preferences.d.ts +1389 -0
  24. package/esm/Session/Preferences.js +58 -0
  25. package/esm/Session/ReferenceManagement.d.ts +28 -3
  26. package/esm/Session/ReferenceManagement.js +56 -41
  27. package/esm/Session/SessionTracks.d.ts +1101 -1180
  28. package/esm/Session/SessionTracks.js +584 -34
  29. package/esm/Session/Themes.d.ts +136 -2
  30. package/esm/Session/Themes.js +267 -21
  31. package/esm/Session/TrackMenu.d.ts +88 -0
  32. package/esm/Session/TrackMenu.js +175 -0
  33. package/esm/Session/TrackMenuSessionMixin.d.ts +27 -0
  34. package/esm/Session/TrackMenuSessionMixin.js +42 -0
  35. package/esm/Session/Tracks.d.ts +945 -1159
  36. package/esm/Session/Tracks.js +229 -30
  37. package/esm/Session/assertSessionModel.d.ts +21 -0
  38. package/esm/Session/assertSessionModel.js +1 -0
  39. package/esm/Session/copyTrackSnapshot.d.ts +21 -0
  40. package/esm/Session/copyTrackSnapshot.js +20 -0
  41. package/esm/Session/developerMode.d.ts +7 -0
  42. package/esm/Session/developerMode.js +43 -0
  43. package/esm/Session/finalizeSession.d.ts +15 -0
  44. package/esm/Session/finalizeSession.js +28 -0
  45. package/esm/Session/hydratedForms.d.ts +16 -0
  46. package/esm/Session/hydratedForms.js +13 -0
  47. package/esm/Session/index.d.ts +27 -10
  48. package/esm/Session/index.js +16 -10
  49. package/esm/Session/pluginExtraTrackItems.d.ts +11 -0
  50. package/esm/Session/pluginExtraTrackItems.js +13 -0
  51. package/esm/Session/readdedTrackConf.d.ts +8 -0
  52. package/esm/Session/readdedTrackConf.js +24 -0
  53. package/esm/Session/shareableSnapshot.d.ts +23 -0
  54. package/esm/Session/shareableSnapshot.js +66 -0
  55. package/esm/Session/temporaryAssemblyTracks.d.ts +24 -0
  56. package/esm/Session/temporaryAssemblyTracks.js +37 -0
  57. package/esm/assertExtends.d.ts +55 -0
  58. package/esm/assertExtends.js +1 -0
  59. package/esm/controllerTracks.d.ts +76 -0
  60. package/esm/controllerTracks.js +125 -0
  61. package/esm/destroyViewState.d.ts +21 -0
  62. package/esm/destroyViewState.js +29 -0
  63. package/esm/embeddedController.d.ts +57 -0
  64. package/esm/embeddedController.js +100 -0
  65. package/esm/index.d.ts +32 -4
  66. package/esm/index.js +31 -4
  67. package/esm/loadPlugins.d.ts +38 -0
  68. package/esm/loadPlugins.js +45 -0
  69. package/esm/localFiles.d.ts +74 -0
  70. package/esm/localFiles.js +156 -0
  71. package/esm/observeSession.d.ts +55 -0
  72. package/esm/observeSession.js +90 -0
  73. package/esm/parallelChunkLoading.d.ts +30 -0
  74. package/esm/parallelChunkLoading.js +71 -0
  75. package/esm/pluginInput.d.ts +32 -0
  76. package/esm/pluginInput.js +19 -0
  77. package/esm/pruneUnbuildableNodes.d.ts +109 -0
  78. package/esm/pruneUnbuildableNodes.js +562 -0
  79. package/esm/resolveAssemblies.d.ts +68 -0
  80. package/esm/resolveAssemblies.js +77 -0
  81. package/esm/rpcWorker.d.ts +36 -4
  82. package/esm/rpcWorker.js +126 -20
  83. package/esm/sessionMigrations/index.d.ts +15 -0
  84. package/esm/sessionMigrations/index.js +178 -0
  85. package/esm/sessionUrl.d.ts +40 -0
  86. package/esm/sessionUrl.js +66 -0
  87. package/esm/sessionUtils.d.ts +74 -0
  88. package/esm/sessionUtils.js +599 -0
  89. package/esm/siblingCast.d.ts +14 -0
  90. package/esm/siblingCast.js +16 -0
  91. package/esm/snapshotUtils.d.ts +8 -0
  92. package/esm/snapshotUtils.js +12 -0
  93. package/esm/ui/AboutDialog.d.ts +8 -3
  94. package/esm/ui/AboutDialog.js +14 -5
  95. package/esm/ui/AboutDialogContents.d.ts +2 -6
  96. package/esm/ui/AboutDialogContents.js +13 -17
  97. package/esm/ui/AssemblyInfoPanel.d.ts +5 -0
  98. package/esm/ui/AssemblyInfoPanel.js +63 -0
  99. package/esm/ui/DescriptionPanel.d.ts +3 -0
  100. package/esm/ui/DescriptionPanel.js +25 -0
  101. package/esm/ui/Drawer.d.ts +21 -0
  102. package/esm/ui/Drawer.js +60 -0
  103. package/esm/ui/DrawerControls.d.ts +5 -0
  104. package/esm/ui/DrawerControls.js +28 -0
  105. package/esm/ui/DrawerHeader.d.ts +6 -0
  106. package/esm/ui/DrawerHeader.js +36 -0
  107. package/esm/ui/DrawerWidget.d.ts +5 -0
  108. package/esm/ui/DrawerWidget.js +12 -0
  109. package/esm/ui/DrawerWidgetSelector.d.ts +5 -0
  110. package/esm/ui/DrawerWidgetSelector.js +40 -0
  111. package/esm/ui/FileInfoPanel.d.ts +3 -6
  112. package/esm/ui/FileInfoPanel.js +36 -26
  113. package/esm/ui/GeneralPreferencesTab.d.ts +17 -0
  114. package/esm/ui/GeneralPreferencesTab.js +34 -0
  115. package/esm/ui/HeaderButtons.d.ts +2 -1
  116. package/esm/ui/HeaderButtons.js +15 -17
  117. package/esm/ui/ModalWidget.d.ts +13 -0
  118. package/esm/ui/ModalWidget.js +48 -0
  119. package/esm/ui/ModalWidgetAppBar.d.ts +8 -0
  120. package/esm/ui/ModalWidgetAppBar.js +9 -0
  121. package/esm/ui/PreferenceCheckbox.d.ts +6 -0
  122. package/esm/ui/PreferenceCheckbox.js +16 -0
  123. package/esm/ui/PreferencesDialog.d.ts +34 -0
  124. package/esm/ui/PreferencesDialog.js +55 -0
  125. package/esm/ui/PreferencesResetDialog.d.ts +8 -0
  126. package/esm/ui/PreferencesResetDialog.js +19 -0
  127. package/esm/ui/RefNameAliasesDialog.d.ts +9 -0
  128. package/esm/ui/RefNameAliasesDialog.js +65 -0
  129. package/esm/ui/RefNameInfoDialog.d.ts +3 -6
  130. package/esm/ui/RefNameInfoDialog.js +45 -63
  131. package/esm/ui/ViewPreferencesTab.d.ts +12 -0
  132. package/esm/ui/ViewPreferencesTab.js +15 -0
  133. package/esm/ui/WidgetBody.d.ts +18 -0
  134. package/esm/ui/WidgetBody.js +22 -0
  135. package/esm/ui/WidgetHeading.d.ts +7 -0
  136. package/esm/ui/WidgetHeading.js +7 -0
  137. package/esm/ui/aboutTestUtils.d.ts +140 -0
  138. package/esm/ui/aboutTestUtils.js +25 -0
  139. package/esm/ui/descriptionHtml.d.ts +25 -0
  140. package/esm/ui/descriptionHtml.js +64 -0
  141. package/esm/ui/drawerLayout.d.ts +18 -0
  142. package/esm/ui/drawerLayout.js +22 -0
  143. package/esm/ui/index.d.ts +15 -1
  144. package/esm/ui/index.js +13 -1
  145. package/esm/ui/preferencesReset.d.ts +18 -0
  146. package/esm/ui/preferencesReset.js +69 -0
  147. package/esm/ui/util.d.ts +22 -7
  148. package/esm/ui/util.js +19 -41
  149. package/esm/useEngineLifecycle.d.ts +19 -0
  150. package/esm/useEngineLifecycle.js +44 -0
  151. package/package.json +15 -18
  152. package/esm/RootModel/FormatAbout.d.ts +0 -12
  153. package/esm/RootModel/FormatAbout.js +0 -15
  154. package/esm/RootModel/FormatDetails.d.ts +0 -24
  155. package/esm/RootModel/FormatDetails.js +0 -27
  156. package/esm/Session/DialogQueue.d.ts +0 -17
  157. package/esm/Session/DialogQueue.js +0 -31
@@ -0,0 +1,175 @@
1
+ import { lazy } from 'react';
2
+ import { InfoIcon } from '@jbrowse/core/ui/Icons';
3
+ import { namesTemporaryAssembly } from '@jbrowse/core/util';
4
+ import { types } from '@jbrowse/mobx-state-tree';
5
+ import DeleteIcon from '@mui/icons-material/Delete';
6
+ import CopyIcon from '@mui/icons-material/FileCopy';
7
+ import OpenInNewIcon from '@mui/icons-material/OpenInNew';
8
+ import SettingsIcon from '@mui/icons-material/Settings';
9
+ import SettingsBackupRestoreIcon from '@mui/icons-material/SettingsBackupRestore';
10
+ import { pluginExtraTrackItems } from './pluginExtraTrackItems.js';
11
+ const AboutDialog = lazy(() => import('../ui/AboutDialog.js'));
12
+ /**
13
+ * The shared Settings / Copy / Copy-and-open / Delete track actions. Each
14
+ * product supplies `makeCopy` (its own session-track/category rules) and
15
+ * `canEdit`; reference sequence tracks can't be copied or deleted. When
16
+ * `isSessionOverride` is set the track carries session edits over its base
17
+ * config, so a Reset is offered, and it replaces Delete for a user who cannot
18
+ * delete the base.
19
+ */
20
+ export function trackActionItems({ session, config, view, canEdit, isSessionOverride, makeCopy, }) {
21
+ const isRefSeq = config.type === 'ReferenceSequenceTrack';
22
+ // A copy of a track drawn on an assembly this view synthesized is dead on
23
+ // arrival: the assembly goes back when the view closes, and the copy is left
24
+ // naming one that never existed anywhere else. Both destinations were wrong
25
+ // for it — `publishTrackConf` writes an admin's into the config.json every
26
+ // visitor is served, one per click since the copy's stamped trackId defeats
27
+ // the dedupe, and a non-admin's lands as the dead `sessionTracks` entry
28
+ // ADR-084 removed the sweep for. Neither is worth offering, so the item says
29
+ // so instead of producing garbage; the contract check on the adders
30
+ // is what found this.
31
+ //
32
+ // Greying a row tells nobody anything, and this reason is one nobody guesses:
33
+ // a refseq track explains its own greyed Copy, a synteny band that looks like
34
+ // every other track does not. `disabledHelpText` is what says it.
35
+ const isTemporary = namesTemporaryAssembly(session, config);
36
+ const copyRefusal = isRefSeq
37
+ ? 'A reference sequence track cannot be copied.'
38
+ : isTemporary
39
+ ? 'This track is drawn on an assembly this view synthesized, which goes away with the view — a copy of it would name an assembly nothing can resolve.'
40
+ : undefined;
41
+ // the display active in this view expands in the config editor, so the
42
+ // track's other (incompatible/inactive) displays start collapsed
43
+ const expandedDisplayId = view?.getActiveDisplayId?.(config.trackId);
44
+ return [
45
+ {
46
+ // always available: editing a non-session (admin-owned) track applies
47
+ // in-memory for the current session even when the user can't persist it
48
+ label: 'Settings',
49
+ icon: SettingsIcon,
50
+ onClick: () => {
51
+ session.editConfiguration(config, { expandedDisplayId });
52
+ },
53
+ },
54
+ {
55
+ label: 'Copy track',
56
+ icon: CopyIcon,
57
+ disabled: isRefSeq || isTemporary,
58
+ disabledHelpText: copyRefusal,
59
+ onClick: () => {
60
+ session.publishTrackConf(makeCopy());
61
+ },
62
+ },
63
+ {
64
+ label: 'Copy and open track',
65
+ icon: OpenInNewIcon,
66
+ disabled: isRefSeq || isTemporary || !view,
67
+ disabledHelpText: copyRefusal ?? (view ? undefined : 'No view to open the copy in.'),
68
+ onClick: () => {
69
+ const snap = makeCopy();
70
+ if (session.publishTrackConf(snap)) {
71
+ void view.launchTrack(snap.trackId);
72
+ }
73
+ },
74
+ },
75
+ ...(isSessionOverride
76
+ ? [
77
+ {
78
+ label: 'Reset track settings',
79
+ icon: SettingsBackupRestoreIcon,
80
+ onClick: () => {
81
+ session.resetTrackConfiguration?.(config.trackId);
82
+ },
83
+ },
84
+ ]
85
+ : []),
86
+ ...(isSessionOverride && !canEdit
87
+ ? []
88
+ : [
89
+ {
90
+ label: 'Delete track',
91
+ icon: DeleteIcon,
92
+ disabled: !canEdit || isRefSeq,
93
+ onClick: () => {
94
+ session.deleteTrackConf(config);
95
+ },
96
+ },
97
+ ]),
98
+ ];
99
+ }
100
+ /** "About track" menu item, shared by every product's track menu */
101
+ export function aboutTrackMenuItem(session, config) {
102
+ return {
103
+ label: 'About track',
104
+ icon: InfoIcon,
105
+ onClick: () => {
106
+ session.queueDialog(handleClose => [
107
+ AboutDialog,
108
+ { config, session, handleClose },
109
+ ]);
110
+ },
111
+ };
112
+ }
113
+ /**
114
+ * flattened track menu (About + raw actions) for the hierarchical track selector
115
+ */
116
+ export function trackListMenuItems(session, config, actions) {
117
+ return [aboutTrackMenuItem(session, config), ...actions];
118
+ }
119
+ /**
120
+ * track menu with an "About track" item and a "Track actions" submenu, for the
121
+ * in-view track label menu
122
+ */
123
+ export function trackActionMenuItems(session, config, actions) {
124
+ return [
125
+ {
126
+ ...aboutTrackMenuItem(session, config),
127
+ priority: 1002,
128
+ },
129
+ {
130
+ type: 'subMenu',
131
+ label: 'Track actions',
132
+ priority: 1001,
133
+ subMenu: actions,
134
+ },
135
+ { type: 'divider' },
136
+ ];
137
+ }
138
+ // (TrackMenuSessionMixin — the minimal embedded-view variant — lives in its own
139
+ // file so each documented state model is the sole one in its file, which the
140
+ // autogen docs generator requires.)
141
+ /**
142
+ * #stateModel TrackMenuItemsSessionMixin
143
+ *
144
+ * The two track-menu wrappers (`getTrackListMenuItems` for the hierarchical
145
+ * selector, `getTrackActionMenuItems` for the in-view label menu) shared by the
146
+ * full web and desktop sessions. Both are pure functions of `getTrackActions`,
147
+ * which each session supplies (web gates on edit rights; desktop adds indexing).
148
+ */
149
+ export function TrackMenuItemsSessionMixin(pluginManager) {
150
+ return types.model('TrackMenuItemsSessionMixin', {}).views(s => {
151
+ const self = s;
152
+ return {
153
+ /**
154
+ * #method
155
+ * flattened menu items for use in hierarchical track selector
156
+ */
157
+ getTrackListMenuItems(config, view) {
158
+ return [
159
+ ...trackListMenuItems(self, config, self.getTrackActions(config, view)),
160
+ ...pluginExtraTrackItems(pluginManager, self, config, view),
161
+ ];
162
+ },
163
+ /**
164
+ * #method
165
+ * track menu with About + "Track actions" submenu for the in-view label
166
+ */
167
+ getTrackActionMenuItems({ config, view, }) {
168
+ return trackActionMenuItems(self, config, [
169
+ ...self.getTrackActions(config, view),
170
+ ...pluginExtraTrackItems(pluginManager, self, config, view),
171
+ ]);
172
+ },
173
+ };
174
+ });
175
+ }
@@ -0,0 +1,27 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
+ import type { MenuItem } from '@jbrowse/core/ui';
4
+ import type { TrackActionView } from '@jbrowse/core/util/types';
5
+ /**
6
+ * #stateModel TrackMenuSessionMixin
7
+ *
8
+ * The minimal track menus used by the embedded react views, which have no
9
+ * track-editing actions to offer: just "About track" plus any plugin-contributed
10
+ * items (`Core-extraTrackMenuItems`). Mirrors the shape of the full
11
+ * `TrackMenuItemsSessionMixin` so both menu surfaces stay consistent across
12
+ * products, minus the Settings/Copy/Delete actions.
13
+ */
14
+ export declare function TrackMenuSessionMixin(pluginManager: PluginManager): import("@jbrowse/mobx-state-tree").IModelType<{}, {
15
+ /**
16
+ * #method
17
+ * flattened menu items for use in hierarchical track selector
18
+ */
19
+ getTrackListMenuItems(config: AnyConfigurationModel, view?: TrackActionView): MenuItem[];
20
+ /**
21
+ * #method
22
+ */
23
+ getTrackActionMenuItems({ config, view, }: {
24
+ config: AnyConfigurationModel;
25
+ view?: TrackActionView;
26
+ }): MenuItem[];
27
+ }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
@@ -0,0 +1,42 @@
1
+ import { types } from '@jbrowse/mobx-state-tree';
2
+ import { asSession } from '../siblingCast.js';
3
+ import { aboutTrackMenuItem, trackListMenuItems } from './TrackMenu.js';
4
+ import { pluginExtraTrackItems } from './pluginExtraTrackItems.js';
5
+ /**
6
+ * #stateModel TrackMenuSessionMixin
7
+ *
8
+ * The minimal track menus used by the embedded react views, which have no
9
+ * track-editing actions to offer: just "About track" plus any plugin-contributed
10
+ * items (`Core-extraTrackMenuItems`). Mirrors the shape of the full
11
+ * `TrackMenuItemsSessionMixin` so both menu surfaces stay consistent across
12
+ * products, minus the Settings/Copy/Delete actions.
13
+ */
14
+ export function TrackMenuSessionMixin(pluginManager) {
15
+ return types.model('TrackMenuSessionMixin', {}).views(s => {
16
+ const self = asSession(s);
17
+ return {
18
+ /**
19
+ * #method
20
+ * flattened menu items for use in hierarchical track selector
21
+ */
22
+ getTrackListMenuItems(config, view) {
23
+ return [
24
+ ...trackListMenuItems(self, config, []),
25
+ ...pluginExtraTrackItems(pluginManager, self, config, view),
26
+ ];
27
+ },
28
+ /**
29
+ * #method
30
+ */
31
+ getTrackActionMenuItems({ config, view, }) {
32
+ return [
33
+ // priority mirrors the full TrackMenuItemsSessionMixin so "About
34
+ // track" sorts to the top of the in-view label menu consistently
35
+ // across embedded and full products
36
+ { ...aboutTrackMenuItem(self, config), priority: 1002 },
37
+ ...pluginExtraTrackItems(pluginManager, self, config, view),
38
+ ];
39
+ },
40
+ };
41
+ });
42
+ }