@jbrowse/product-core 5.0.0-beta.11 → 5.0.0-beta.14

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 (72) hide show
  1. package/esm/RootModel/BaseRootModel.d.ts +88 -47
  2. package/esm/RootModel/BaseRootModel.js +45 -2
  3. package/esm/RootModel/HierarchicalConfig.d.ts +3 -1
  4. package/esm/RootModel/HierarchicalConfig.js +3 -1
  5. package/esm/RootModel/InternetAccounts.d.ts +2 -0
  6. package/esm/RootModel/InternetAccounts.js +2 -0
  7. package/esm/RootModel/PreferencesConfig.d.ts +4 -9
  8. package/esm/RootModel/PreferencesConfig.js +4 -15
  9. package/esm/RootModel/createConfigModel.d.ts +0 -10
  10. package/esm/RootModel/index.d.ts +1 -1
  11. package/esm/RootModel/index.js +1 -1
  12. package/esm/RootModel/menuItems.d.ts +1 -4
  13. package/esm/RootModel/menuItems.js +3 -22
  14. package/esm/Session/BaseSession.d.ts +8 -9
  15. package/esm/Session/BaseSession.js +16 -9
  16. package/esm/Session/Connections.d.ts +3 -0
  17. package/esm/Session/Connections.js +3 -0
  18. package/esm/Session/DrawerWidgets.d.ts +2 -0
  19. package/esm/Session/DrawerWidgets.js +25 -14
  20. package/esm/Session/MultipleViews.d.ts +127 -150
  21. package/esm/Session/MultipleViews.js +8 -64
  22. package/esm/Session/Preferences.d.ts +122 -97
  23. package/esm/Session/Preferences.js +9 -6
  24. package/esm/Session/ReferenceManagement.d.ts +2 -0
  25. package/esm/Session/ReferenceManagement.js +2 -0
  26. package/esm/Session/SessionTracks.d.ts +133 -107
  27. package/esm/Session/SessionTracks.js +6 -10
  28. package/esm/Session/Themes.d.ts +20 -7
  29. package/esm/Session/Themes.js +38 -15
  30. package/esm/Session/TrackMenu.d.ts +8 -12
  31. package/esm/Session/TrackMenu.js +13 -7
  32. package/esm/Session/TrackMenuSessionMixin.d.ts +2 -2
  33. package/esm/Session/TrackMenuSessionMixin.js +7 -3
  34. package/esm/Session/Tracks.d.ts +131 -104
  35. package/esm/Session/Tracks.js +5 -2
  36. package/esm/Session/copyTrackSnapshot.d.ts +2 -2
  37. package/esm/Session/index.d.ts +1 -1
  38. package/esm/Session/index.js +1 -1
  39. package/esm/Session/pluginExtraTrackItems.d.ts +3 -4
  40. package/esm/Session/pluginExtraTrackItems.js +1 -1
  41. package/esm/Session/shareableSnapshot.d.ts +3 -19
  42. package/esm/Session/shareableSnapshot.js +4 -61
  43. package/esm/index.d.ts +2 -2
  44. package/esm/index.js +2 -2
  45. package/esm/sessionMigrations/index.js +2 -2
  46. package/esm/sessionUrl.d.ts +0 -4
  47. package/esm/sessionUrl.js +0 -4
  48. package/esm/sessionUtils.js +1 -1
  49. package/esm/siblingCast.d.ts +6 -0
  50. package/esm/siblingCast.js +7 -0
  51. package/esm/ui/AboutDialog.d.ts +3 -2
  52. package/esm/ui/AboutDialog.js +4 -2
  53. package/esm/ui/AboutDialogContents.js +4 -4
  54. package/esm/ui/DescriptionPanel.js +4 -4
  55. package/esm/ui/Drawer.js +11 -15
  56. package/esm/ui/GeneralPreferencesTab.d.ts +1 -0
  57. package/esm/ui/GeneralPreferencesTab.js +3 -1
  58. package/esm/ui/HeaderButtons.d.ts +1 -1
  59. package/esm/ui/HeaderButtons.js +3 -2
  60. package/esm/ui/PreferenceCheckbox.d.ts +3 -2
  61. package/esm/ui/PreferenceCheckbox.js +4 -2
  62. package/esm/ui/ViewPreferencesTab.d.ts +0 -2
  63. package/esm/ui/ViewPreferencesTab.js +0 -2
  64. package/esm/ui/WidgetHeading.d.ts +2 -2
  65. package/esm/ui/WidgetHeading.js +3 -2
  66. package/esm/ui/aboutTestUtils.d.ts +105 -0
  67. package/esm/ui/aboutTestUtils.js +15 -1
  68. package/esm/ui/preferencesReset.d.ts +0 -3
  69. package/esm/ui/preferencesReset.js +0 -13
  70. package/esm/ui/util.d.ts +5 -6
  71. package/esm/ui/util.js +8 -11
  72. package/package.json +7 -7
@@ -69,11 +69,6 @@ declare function rootConfigurationSchema(): import("@jbrowse/core/configuration/
69
69
  } & {
70
70
  defaultValue: boolean;
71
71
  };
72
- readonly useWorkspaces: {
73
- type: "boolean";
74
- } & {
75
- defaultValue: boolean;
76
- };
77
72
  readonly developerMode: {
78
73
  type: "boolean";
79
74
  } & {
@@ -191,11 +186,6 @@ export declare function createConfigModel(pluginManager: PluginManager, assembly
191
186
  } & {
192
187
  defaultValue: boolean;
193
188
  };
194
- readonly useWorkspaces: {
195
- type: "boolean";
196
- } & {
197
- defaultValue: boolean;
198
- };
199
189
  readonly developerMode: {
200
190
  type: "boolean";
201
191
  } & {
@@ -7,4 +7,4 @@ export { HierarchicalConfigSchemaFactory } from './HierarchicalConfig.ts';
7
7
  export { PreferencesConfigSchemaFactory } from './PreferencesConfig.ts';
8
8
  export { createConfigModel } from './createConfigModel.ts';
9
9
  export type { RootConfigurationSnapshot } from './createConfigModel.ts';
10
- export { exportSessionMenuItem, importSessionMenuItem, newSessionMenuItem, openConnectionMenuItem, openTrackMenuItem, pluginStoreMenuItem, preferencesMenuItem, redoMenuItem, undoMenuItem, workspacesMenuItem, } from './menuItems.ts';
10
+ export { exportSessionMenuItem, importSessionMenuItem, newSessionMenuItem, openConnectionMenuItem, openTrackMenuItem, pluginStoreMenuItem, preferencesMenuItem, redoMenuItem, undoMenuItem, } from './menuItems.ts';
@@ -7,4 +7,4 @@ export { FormatAboutConfigSchemaFactory, FormatDetailsConfigSchemaFactory, } fro
7
7
  export { HierarchicalConfigSchemaFactory } from './HierarchicalConfig.js';
8
8
  export { PreferencesConfigSchemaFactory } from './PreferencesConfig.js';
9
9
  export { createConfigModel } from './createConfigModel.js';
10
- export { exportSessionMenuItem, importSessionMenuItem, newSessionMenuItem, openConnectionMenuItem, openTrackMenuItem, pluginStoreMenuItem, preferencesMenuItem, redoMenuItem, undoMenuItem, workspacesMenuItem, } from './menuItems.js';
10
+ export { exportSessionMenuItem, importSessionMenuItem, newSessionMenuItem, openConnectionMenuItem, openTrackMenuItem, pluginStoreMenuItem, preferencesMenuItem, redoMenuItem, undoMenuItem, } from './menuItems.js';
@@ -1,7 +1,5 @@
1
- import type { SessionWithMultipleViews } from '../Session/index.ts';
2
1
  import type PluginManager from '@jbrowse/core/PluginManager';
3
2
  import type { MenuItem } from '@jbrowse/core/ui';
4
- import type { DialogComponentType } from '@jbrowse/core/util';
5
3
  interface RootWithDefaultSession {
6
4
  setDefaultSession: () => void;
7
5
  }
@@ -11,7 +9,7 @@ export declare function exportSessionMenuItem(): MenuItem;
11
9
  export declare function openTrackMenuItem(): MenuItem;
12
10
  export declare function openConnectionMenuItem(): MenuItem;
13
11
  export declare function pluginStoreMenuItem(): MenuItem;
14
- export declare function preferencesMenuItem(pluginManager: PluginManager, PreferencesDialog: DialogComponentType): MenuItem;
12
+ export declare function preferencesMenuItem(pluginManager: PluginManager): MenuItem;
15
13
  interface HistoryManager {
16
14
  canUndo: boolean;
17
15
  canRedo: boolean;
@@ -20,5 +18,4 @@ interface HistoryManager {
20
18
  }
21
19
  export declare function undoMenuItem(history: HistoryManager): MenuItem;
22
20
  export declare function redoMenuItem(history: HistoryManager): MenuItem;
23
- export declare function workspacesMenuItem(session: SessionWithMultipleViews | undefined): MenuItem;
24
21
  export {};
@@ -1,3 +1,4 @@
1
+ import { lazy } from 'react';
1
2
  import { Cable } from '@jbrowse/core/ui/Icons';
2
3
  import AddIcon from '@mui/icons-material/Add';
3
4
  import ExtensionIcon from '@mui/icons-material/Extension';
@@ -5,14 +6,13 @@ import GetAppIcon from '@mui/icons-material/GetApp';
5
6
  import PublishIcon from '@mui/icons-material/Publish';
6
7
  import RedoIcon from '@mui/icons-material/Redo';
7
8
  import SettingsIcon from '@mui/icons-material/Settings';
8
- import SpaceDashboardIcon from '@mui/icons-material/SpaceDashboard';
9
9
  import StorageIcon from '@mui/icons-material/Storage';
10
10
  import UndoIcon from '@mui/icons-material/Undo';
11
11
  import { getShareableSessionSnapshot } from '../Session/index.js';
12
+ const PreferencesDialog = lazy(() => import('../ui/PreferencesDialog.js'));
12
13
  // the renderer binds the active session into each onClick (see AppToolbar's
13
14
  // wrapMenuItems), so these handlers receive it as their argument
14
15
  const MULTI_VIEW_WARNING = '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';
15
- const WORKSPACES_HELP_TEXT = 'Workspaces allow you to organize views into tabs and tiles. There are a variety of unique features, for instance, you can drag views between tabs or split them side-by-side. Try clicking and dragging the tab header to create a new split';
16
16
  export function newSessionMenuItem(root) {
17
17
  return {
18
18
  label: 'New session',
@@ -86,10 +86,7 @@ export function pluginStoreMenuItem() {
86
86
  },
87
87
  };
88
88
  }
89
- // the dialog component differs per product, so it is passed in rather than
90
- // imported; typing it as DialogComponentType lets queueDialog accept it with no
91
- // cast (the inline call sites needed `as BaseSession` to reach queueDialog)
92
- export function preferencesMenuItem(pluginManager, PreferencesDialog) {
89
+ export function preferencesMenuItem(pluginManager) {
93
90
  return {
94
91
  label: 'Preferences',
95
92
  icon: SettingsIcon,
@@ -123,19 +120,3 @@ export function redoMenuItem(history) {
123
120
  },
124
121
  };
125
122
  }
126
- export function workspacesMenuItem(session) {
127
- return {
128
- label: 'Use workspaces',
129
- icon: SpaceDashboardIcon,
130
- type: 'checkbox',
131
- checked: session?.effectiveUseWorkspaces ?? false,
132
- helpText: WORKSPACES_HELP_TEXT,
133
- // opts out of the checkbox "stay open" default: this re-lays out the whole
134
- // app (classic stack <-> tiled workspace), so it's a one-shot mode switch
135
- // rather than a setting to flip repeatedly with the menu up
136
- keepMenuOpen: false,
137
- onClick: () => {
138
- session?.setUseWorkspacesPreference(!session.effectiveUseWorkspaces);
139
- },
140
- };
141
- }
@@ -6,12 +6,12 @@ import type { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
6
6
  import type { AnimationMode, DialogComponentType, TrackConfigChange } from '@jbrowse/core/util';
7
7
  import type { HighlightType } from '@jbrowse/core/util/highlights';
8
8
  import type { IAnyStateTreeNode, Instance } from '@jbrowse/mobx-state-tree';
9
- type DoneCallback = (doneCallback: () => void) => [DialogComponentType, Record<string, unknown>];
9
+ import type React from 'react';
10
10
  /**
11
11
  * #stateModel BaseSessionModel
12
12
  *
13
- * base session shared by all JBrowse products. Be careful what you include
14
- * here, everything will use it.
13
+ * Holds a session's name, focused view, highlights and notifications. Every
14
+ * product's session composes this model, so add to it with care.
15
15
  */
16
16
  export declare function BaseSessionModel<ROOT_MODEL_TYPE extends BaseRootModelType, JB_CONFIG_SCHEMA extends AnyConfigurationSchemaType>(_pluginManager: PluginManager): import("@jbrowse/mobx-state-tree").IModelType<Omit<{
17
17
  /**
@@ -139,10 +139,7 @@ export declare function BaseSessionModel<ROOT_MODEL_TYPE extends BaseRootModelTy
139
139
  /**
140
140
  * #method
141
141
  * the admin/embedder `configuration.preferences` value for a key, ignoring
142
- * any runtime override — i.e. what a reset falls back to. Exposed rather
143
- * than inlined because "differs from the default" is a question the
144
- * Preferences reset diff asks about settings this map doesn't hold (see
145
- * `defaultUseWorkspaces`).
142
+ * any runtime override — i.e. what a reset falls back to
146
143
  */
147
144
  getPreferenceDefault(key: string): unknown;
148
145
  /**
@@ -273,12 +270,15 @@ export declare function BaseSessionModel<ROOT_MODEL_TYPE extends BaseRootModelTy
273
270
  setFocusedViewId(viewId: string | undefined): void;
274
271
  /**
275
272
  * #action
273
+ * Dismiss the dialog on screen as its own close button would, so a
274
+ * dialog that settles a promise on close (an internet account's token
275
+ * prompt) settles it, and drop it from the queue if it did not.
276
276
  */
277
277
  removeActiveDialog(): void;
278
278
  /**
279
279
  * #action
280
280
  */
281
- queueDialog(doneCallback: DoneCallback): void;
281
+ queueDialog<T extends DialogComponentType>(callback: (doneCallback: () => void) => [T, React.ComponentProps<T>]): void;
282
282
  /**
283
283
  * #action
284
284
  */
@@ -306,4 +306,3 @@ export type BaseSession = Instance<BaseSessionType>;
306
306
  export declare function isBaseSession(thing: IAnyStateTreeNode): thing is BaseSession;
307
307
  /** Type guard for whether a thing is JBrowse session */
308
308
  export declare function isSession(thing: unknown): thing is BaseSession;
309
- export {};
@@ -14,8 +14,8 @@ function isAnimationMode(val) {
14
14
  /**
15
15
  * #stateModel BaseSessionModel
16
16
  *
17
- * base session shared by all JBrowse products. Be careful what you include
18
- * here, everything will use it.
17
+ * Holds a session's name, focused view, highlights and notifications. Every
18
+ * product's session composes this model, so add to it with care.
19
19
  */
20
20
  export function BaseSessionModel(_pluginManager) {
21
21
  const baseModel = types
@@ -172,10 +172,7 @@ export function BaseSessionModel(_pluginManager) {
172
172
  /**
173
173
  * #method
174
174
  * the admin/embedder `configuration.preferences` value for a key, ignoring
175
- * any runtime override — i.e. what a reset falls back to. Exposed rather
176
- * than inlined because "differs from the default" is a question the
177
- * Preferences reset diff asks about settings this map doesn't hold (see
178
- * `defaultUseWorkspaces`).
175
+ * any runtime override — i.e. what a reset falls back to
179
176
  */
180
177
  getPreferenceDefault(key) {
181
178
  const { preferences } = self.configuration;
@@ -393,17 +390,27 @@ export function BaseSessionModel(_pluginManager) {
393
390
  },
394
391
  /**
395
392
  * #action
393
+ * Dismiss the dialog on screen as its own close button would, so a
394
+ * dialog that settles a promise on close (an internet account's token
395
+ * prompt) settles it, and drop it from the queue if it did not.
396
396
  */
397
397
  removeActiveDialog() {
398
- self.queueOfDialogs = self.queueOfDialogs.slice(1);
398
+ const active = self.queueOfDialogs[0];
399
+ const close = active?.[1].handleClose;
400
+ if (typeof close === 'function') {
401
+ close();
402
+ }
403
+ if (self.queueOfDialogs[0] === active) {
404
+ self.queueOfDialogs = self.queueOfDialogs.slice(1);
405
+ }
399
406
  },
400
407
  /**
401
408
  * #action
402
409
  */
403
- queueDialog(doneCallback) {
410
+ queueDialog(callback) {
404
411
  // its own entry, not the head: a late second call must not close the
405
412
  // dialog queued behind it
406
- const entry = doneCallback(() => {
413
+ const entry = callback(() => {
407
414
  this.removeDialog(entry);
408
415
  });
409
416
  self.queueOfDialogs = [...self.queueOfDialogs, entry];
@@ -13,6 +13,9 @@ export interface ConnectionTrackConfigEntry {
13
13
  }
14
14
  /**
15
15
  * #stateModel ConnectionManagementSessionMixin
16
+ * Adds connections to a session: the connection instances it has made, and
17
+ * the configs of the connection tracks the user opened, so those tracks load
18
+ * on session restore without reconnecting.
16
19
  */
17
20
  export declare function ConnectionManagementSessionMixin(pluginManager: PluginManager): import("@jbrowse/mobx-state-tree").IModelType<{
18
21
  /**
@@ -3,6 +3,9 @@ import { asSession } from '../siblingCast.js';
3
3
  import { isBaseSession } from './BaseSession.js';
4
4
  /**
5
5
  * #stateModel ConnectionManagementSessionMixin
6
+ * Adds connections to a session: the connection instances it has made, and
7
+ * the configs of the connection tracks the user opened, so those tracks load
8
+ * on session restore without reconnecting.
6
9
  */
7
10
  export function ConnectionManagementSessionMixin(pluginManager) {
8
11
  return types
@@ -4,6 +4,8 @@ import type { DrawerPosition, Widget } from '@jbrowse/core/util/types';
4
4
  import type { IAnyStateTreeNode, Instance } from '@jbrowse/mobx-state-tree';
5
5
  /**
6
6
  * #stateModel DrawerWidgetSessionMixin
7
+ * Adds the widget drawer to a session: the open widgets, which one is
8
+ * showing, and the drawer's side, width and minimized state.
7
9
  */
8
10
  export declare function DrawerWidgetSessionMixin(pluginManager: PluginManager): import("@jbrowse/mobx-state-tree").IModelType<{
9
11
  /**
@@ -1,6 +1,7 @@
1
1
  import { isConfigurationModel } from '@jbrowse/core/configuration';
2
2
  import { localStorageGetItem, localStorageSetItem, scheduleDetachedDestroy, } from '@jbrowse/core/util';
3
- import { addDisposer, detach, getEnv, isAlive, isStateTreeNode, types, } from '@jbrowse/mobx-state-tree';
3
+ import { getEditableTrackConfigById } from '@jbrowse/core/util/types';
4
+ import { addDisposer, detach, getEnv, isAlive, types, } from '@jbrowse/mobx-state-tree';
4
5
  import { autorun } from 'mobx';
5
6
  import { isBaseSession } from './BaseSession.js';
6
7
  const minDrawerWidth = 128;
@@ -35,6 +36,8 @@ function clampDrawerWidth(width, availableWidth) {
35
36
  }
36
37
  /**
37
38
  * #stateModel DrawerWidgetSessionMixin
39
+ * Adds the widget drawer to a session: the open widgets, which one is
40
+ * showing, and the drawer's side, width and minimized state.
38
41
  */
39
42
  export function DrawerWidgetSessionMixin(pluginManager) {
40
43
  const widgetStateModelType = pluginManager.pluggableMstType('widget', 'stateModel');
@@ -264,23 +267,31 @@ export function DrawerWidgetSessionMixin(pluginManager) {
264
267
  * @param configuration - can be an MST model or a frozen/plain object with trackId
265
268
  */
266
269
  editConfiguration(configuration, opts) {
267
- let targetConfig;
268
- if (isStateTreeNode(configuration) &&
269
- isConfigurationModel(configuration)) {
270
- // Already an MST model (e.g., from track.configuration), use directly
271
- targetConfig = configuration;
270
+ const isNode = isConfigurationModel(configuration);
271
+ if (!isNode && !('trackId' in configuration)) {
272
+ throw new Error('must pass a configuration model or frozen config with trackId to editConfiguration');
272
273
  }
273
- else if ('trackId' in configuration) {
274
- // Frozen/plain object - create a temporary MST model for editing
275
- const trackSchema = pluginManager.pluggableConfigSchemaType('track');
276
- targetConfig = trackSchema.create(configuration, getEnv(self));
274
+ const trackId = configuration.trackId;
275
+ const workingCopy = typeof trackId === 'string'
276
+ ? getEditableTrackConfigById(self, trackId)
277
+ : undefined;
278
+ const editor = self.openWidget('ConfigurationEditorWidget', 'configEditor');
279
+ // A shown track edits its working copy, so the editor edits that same
280
+ // node, and follows it when an undo replaces it (ADR-032). A node the
281
+ // session does not resolve by id, such as a track a view holds
282
+ // inline, is edited as it stands.
283
+ if (typeof trackId === 'string' &&
284
+ workingCopy &&
285
+ (!isNode || workingCopy === configuration)) {
286
+ editor.setTrackId(trackId);
277
287
  }
278
288
  else {
279
- throw new Error('must pass a configuration model or frozen config with trackId to editConfiguration');
289
+ editor.setTarget(isNode
290
+ ? configuration
291
+ : pluginManager
292
+ .pluggableConfigSchemaType('track')
293
+ .create(configuration, getEnv(self)));
280
294
  }
281
- const editor = self.openWidget('ConfigurationEditorWidget', 'configEditor');
282
- // Set target via action since it's now volatile
283
- editor.setTarget(targetConfig);
284
295
  editor.setExpandedDisplayId(opts?.expandedDisplayId);
285
296
  },
286
297
  }))