@jbrowse/app-core 5.0.0-beta.1 → 5.0.0-beta.11

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 (75) hide show
  1. package/esm/AppSession/AppSessionMixin.d.ts +42 -316
  2. package/esm/Assemblies/AssembliesMixin.d.ts +172 -103
  3. package/esm/Assemblies/AssembliesMixin.js +13 -8
  4. package/esm/HistoryManagement/index.d.ts +6 -11
  5. package/esm/HistoryManagement/index.js +24 -28
  6. package/esm/JBrowseConfig/RootConfiguration.d.ts +80 -124
  7. package/esm/JBrowseConfig/RootConfiguration.js +5 -11
  8. package/esm/JBrowseConfig/defaultShareUrl.d.ts +1 -0
  9. package/esm/JBrowseConfig/defaultShareUrl.js +5 -0
  10. package/esm/JBrowseConfig/index.d.ts +89 -83
  11. package/esm/JBrowseConfig/index.js +6 -4
  12. package/esm/JBrowseModel/index.d.ts +93 -96
  13. package/esm/JBrowseModel/index.js +43 -43
  14. package/esm/JbApi/index.d.ts +2 -0
  15. package/esm/JbApi/index.js +1 -0
  16. package/esm/JbApi/jbApi.d.ts +2767 -0
  17. package/esm/JbApi/jbApi.js +1383 -0
  18. package/esm/RootMenu/index.d.ts +2 -11
  19. package/esm/RootMenu/index.js +0 -11
  20. package/esm/SessionSpec/index.d.ts +1 -1
  21. package/esm/SessionSpec/index.js +1 -1
  22. package/esm/SessionSpec/lgvUrlInit.js +5 -2
  23. package/esm/SessionSpec/loadSessionSpec.d.ts +56 -2
  24. package/esm/SessionSpec/loadSessionSpec.js +285 -123
  25. package/esm/SessionSpec/parseSessionSpecUrl.d.ts +2 -8
  26. package/esm/SessionSpec/parseSessionSpecUrl.js +2 -17
  27. package/esm/SessionSpec/types.d.ts +16 -12
  28. package/esm/WorkspaceLayout/WorkspaceContainer.js +4 -2
  29. package/esm/WorkspaceLayout/WorkspaceTab.js +2 -6
  30. package/esm/WorkspaceLayout/model.d.ts +25 -5
  31. package/esm/WorkspaceLayout/model.js +77 -18
  32. package/esm/WorkspaceLayout/spec.d.ts +40 -10
  33. package/esm/WorkspaceLayout/spec.js +81 -8
  34. package/esm/index.d.ts +4 -2
  35. package/esm/index.js +4 -1
  36. package/esm/menus.d.ts +15 -29
  37. package/esm/menus.js +76 -92
  38. package/esm/queryParams.d.ts +1 -1
  39. package/esm/queryParams.js +10 -9
  40. package/esm/ui/App/App.js +18 -11
  41. package/esm/ui/App/AppToolbar.js +23 -8
  42. package/esm/ui/App/ClassicViewsContainer.d.ts +2 -2
  43. package/esm/ui/App/DialogQueue.d.ts +2 -2
  44. package/esm/ui/App/DialogQueue.js +3 -3
  45. package/esm/ui/App/DrawerHeader.js +2 -3
  46. package/esm/ui/App/ThemeModeButton.d.ts +12 -0
  47. package/esm/ui/App/ThemeModeButton.js +34 -0
  48. package/esm/ui/App/ViewButtons.js +2 -2
  49. package/esm/ui/App/ViewContainer.js +1 -17
  50. package/esm/ui/App/ViewContainerTitle.js +15 -12
  51. package/esm/ui/App/ViewLauncher.js +1 -1
  52. package/esm/ui/App/ViewMenu.js +2 -2
  53. package/esm/ui/App/ViewStack.js +7 -1
  54. package/esm/ui/App/ViewsContainer.d.ts +2 -4
  55. package/esm/ui/App/ViewsContainer.js +3 -9
  56. package/esm/ui/App/index.d.ts +1 -1
  57. package/esm/ui/App/index.js +1 -1
  58. package/esm/ui/App/lazyParts.d.ts +32 -0
  59. package/esm/ui/App/lazyParts.js +8 -0
  60. package/esm/ui/App/preloadAppShell.d.ts +14 -0
  61. package/esm/ui/App/preloadAppShell.js +41 -0
  62. package/esm/ui/App/types.d.ts +12 -7
  63. package/esm/ui/App/useViewVisibility.d.ts +10 -9
  64. package/esm/ui/App/useViewVisibility.js +12 -11
  65. package/esm/ui/App/viewTitle.d.ts +10 -3
  66. package/esm/ui/App/viewTitle.js +13 -5
  67. package/esm/ui/index.d.ts +1 -1
  68. package/esm/ui/index.js +1 -1
  69. package/package.json +7 -7
  70. package/esm/ui/App/AppReadyMarker.d.ts +0 -34
  71. package/esm/ui/App/AppReadyMarker.js +0 -56
  72. package/esm/ui/App/DrawerControls.d.ts +0 -1
  73. package/esm/ui/App/DrawerControls.js +0 -1
  74. package/esm/ui/App/copyView.d.ts +0 -1
  75. package/esm/ui/App/copyView.js +0 -29
@@ -11,133 +11,137 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, ext
11
11
  configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
12
12
  readonly rpc: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
13
13
  readonly defaultDriver: {
14
- readonly type: "string";
15
- readonly description: "the RPC driver to run data fetching on: MainThreadRpcDriver or WebWorkerRpcDriver. Leave empty to use the default for this application";
16
- readonly defaultValue: "";
17
- readonly advanced: true;
14
+ type: "string";
15
+ } & {
16
+ defaultValue: string;
18
17
  };
19
18
  readonly workerCount: {
20
- readonly type: "number";
21
- readonly description: "The number of workers to use. If 0 (the default) JBrowse will decide how many workers to use.";
22
- readonly defaultValue: 0;
23
- readonly advanced: true;
19
+ type: "number";
20
+ } & {
21
+ defaultValue: number;
24
22
  };
25
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
23
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
26
24
  readonly formatDetails: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
27
25
  readonly feature: {
28
- readonly type: "frozen";
29
- readonly description: "adds extra fields to the feature details";
30
- readonly defaultValue: {};
31
- readonly contextVariable: ["feature"];
26
+ type: "frozen";
27
+ } & {
28
+ defaultValue: unknown;
32
29
  };
33
30
  readonly subfeatures: {
34
- readonly type: "frozen";
35
- readonly description: "adds extra fields to the subfeatures of a feature";
36
- readonly defaultValue: {};
37
- readonly contextVariable: ["feature"];
31
+ type: "frozen";
32
+ } & {
33
+ defaultValue: unknown;
38
34
  };
39
35
  readonly depth: {
40
- readonly type: "maybeNumber";
41
- readonly description: "levels of subfeature the formatDetails.subfeatures callback runs on, default 2";
36
+ type: "maybeNumber";
42
37
  };
43
38
  readonly maxDepth: {
44
- readonly type: "maybeNumber";
45
- readonly description: "hide subfeatures nested deeper than this, default no limit";
39
+ type: "maybeNumber";
46
40
  };
47
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
41
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
48
42
  readonly formatAbout: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
49
43
  readonly config: {
50
- readonly type: "frozen";
51
- readonly description: "formats configuration object in about dialog";
52
- readonly defaultValue: {};
53
- readonly contextVariable: ["config"];
44
+ type: "frozen";
45
+ } & {
46
+ defaultValue: unknown;
54
47
  };
55
48
  readonly hideUris: {
56
- readonly type: "boolean";
57
- readonly defaultValue: false;
49
+ type: "boolean";
50
+ } & {
51
+ defaultValue: boolean;
58
52
  };
59
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
53
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
60
54
  readonly shareURL: {
61
- readonly type: "string";
62
- readonly defaultValue: "https://share.jbrowse.org/api/v1/";
63
- readonly advanced: true;
55
+ type: "string";
56
+ } & {
57
+ defaultValue: string;
64
58
  };
65
59
  readonly disableAnalytics: {
66
- readonly type: "boolean";
67
- readonly defaultValue: false;
68
- readonly advanced: true;
60
+ type: "boolean";
61
+ } & {
62
+ defaultValue: boolean;
69
63
  };
70
64
  readonly hierarchical: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
71
65
  readonly sort: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
72
66
  readonly trackNames: {
73
- readonly type: "boolean";
74
- readonly defaultValue: false;
67
+ type: "boolean";
68
+ } & {
69
+ defaultValue: boolean;
75
70
  };
76
71
  readonly categories: {
77
- readonly type: "boolean";
78
- readonly defaultValue: false;
72
+ type: "boolean";
73
+ } & {
74
+ defaultValue: boolean;
79
75
  };
80
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
76
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
81
77
  readonly defaultFolderCategories: {
82
- readonly type: "stringArray";
83
- readonly description: "list of category names to display as folders by default";
84
- readonly defaultValue: readonly [];
78
+ type: "stringArray";
79
+ } & {
80
+ defaultValue: unknown;
85
81
  };
86
82
  readonly defaultCollapsed: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
87
83
  readonly categoryNames: {
88
- readonly type: "stringArray";
89
- readonly defaultValue: readonly [];
84
+ type: "stringArray";
85
+ } & {
86
+ defaultValue: unknown;
90
87
  };
91
88
  readonly topLevelCategories: {
92
- readonly type: "boolean";
93
- readonly defaultValue: false;
89
+ type: "boolean";
90
+ } & {
91
+ defaultValue: boolean;
94
92
  };
95
93
  readonly subCategories: {
96
- readonly type: "boolean";
97
- readonly defaultValue: false;
94
+ type: "boolean";
95
+ } & {
96
+ defaultValue: boolean;
98
97
  };
99
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
100
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
98
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
99
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
101
100
  readonly preferences: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
102
101
  readonly animationMode: {
103
- readonly model: import("@jbrowse/mobx-state-tree").ISimpleType<"disabled" | "enabled" | "system">;
104
- readonly type: "stringEnum";
105
- readonly defaultValue: "enabled";
102
+ type: "stringEnum";
103
+ } & {
104
+ model: import("@jbrowse/mobx-state-tree").ISimpleType<"disabled" | "enabled" | "system">;
105
+ } & {
106
+ defaultValue: string;
106
107
  };
107
108
  readonly scrollZoom: {
108
- readonly type: "boolean";
109
- readonly defaultValue: false;
109
+ type: "boolean";
110
+ } & {
111
+ defaultValue: boolean;
110
112
  };
111
113
  readonly numberGrouping: {
112
- readonly type: "boolean";
113
- readonly defaultValue: true;
114
+ type: "boolean";
115
+ } & {
116
+ defaultValue: boolean;
114
117
  };
115
118
  readonly useWorkspaces: {
116
- readonly type: "boolean";
117
- readonly defaultValue: false;
119
+ type: "boolean";
120
+ } & {
121
+ defaultValue: boolean;
118
122
  };
119
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
123
+ readonly developerMode: {
124
+ type: "boolean";
125
+ } & {
126
+ defaultValue: boolean;
127
+ };
128
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
120
129
  readonly theme: {
121
- readonly type: "frozen";
122
- readonly description: "Material UI theme overrides applied to the JBrowse UI";
123
- readonly defaultValue: {};
130
+ type: "frozen";
131
+ } & {
132
+ defaultValue: unknown;
124
133
  };
125
134
  readonly extraThemes: {
126
- readonly type: "frozen";
127
- readonly description: "additional named themes the user can switch between";
128
- readonly defaultValue: {};
129
- readonly advanced: true;
135
+ type: "frozen";
136
+ } & {
137
+ defaultValue: unknown;
130
138
  };
131
139
  readonly logoPath: {
132
- readonly type: "fileLocation";
133
- readonly description: "path to a custom logo image displayed in the app header";
134
- readonly defaultValue: {
135
- readonly uri: "";
136
- readonly locationType: "UriLocation";
137
- };
138
- readonly advanced: true;
140
+ type: "fileLocation";
141
+ } & {
142
+ defaultValue: unknown;
139
143
  };
140
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
144
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
141
145
  plugins: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<PluginDefinition, PluginDefinition, PluginDefinition>>;
142
146
  assemblies: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>;
143
147
  tracks: import("@jbrowse/mobx-state-tree").IType<{
@@ -150,9 +154,9 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, ext
150
154
  [key: string]: unknown;
151
155
  trackId: string;
152
156
  }[]>;
153
- internetAccounts: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyType>;
154
- aggregateTextSearchAdapters: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyType>;
155
- connections: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyType>;
157
+ internetAccounts: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/core/PluginManager").PluggableConfigSchemaType>;
158
+ aggregateTextSearchAdapters: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/core/PluginManager").PluggableConfigSchemaType>;
159
+ connections: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/core/PluginManager").PluggableConfigSchemaType>;
156
160
  defaultSession: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IType<any, any, any>, [undefined]>;
157
161
  preConfiguredSessions: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<any, any, any>>;
158
162
  }, {
@@ -168,10 +172,7 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, ext
168
172
  /**
169
173
  * #action
170
174
  */
171
- addAssemblyConf(conf: AnyConfigurationModel): (import("@jbrowse/mobx-state-tree").ModelInstanceTypeProps<Record<string, any>> & {
172
- setSubschema(slotName: string, data: Record<string, unknown>): any;
173
- setSlot(slotName: string, value: unknown): void;
174
- } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>) | undefined;
175
+ addAssemblyConf(conf: AnyConfigurationModel): (import("@jbrowse/core/configuration").ConfigNodeProps<any> & import("@jbrowse/core/configuration").ConfigNodeActions & import("@jbrowse/core/configuration").ConfigNodeBrand<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>) | undefined;
175
176
  /**
176
177
  * #action
177
178
  */
@@ -193,7 +194,7 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, ext
193
194
  * the array coerces — since callers hand it plain JSON (a session spec's
194
195
  * `sessionConnections`, the CLI's add-connection output).
195
196
  */
196
- addConnectionConf(connectionConf: AnyConfiguration): any;
197
+ addConnectionConf(connectionConf: AnyConfiguration): (import("@jbrowse/core/configuration").PluggableConfigNode & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/PluginManager").PluggableConfigSchemaType>) | undefined;
197
198
  /**
198
199
  * #action
199
200
  */
@@ -207,7 +208,8 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, ext
207
208
  /**
208
209
  * #action
209
210
  * Updates an existing track configuration. Used to sync editable configs
210
- * back to the frozen tracks array.
211
+ * back to the frozen tracks array. A trackId the array repeats replaces
212
+ * its last entry, the one the session resolves it to.
211
213
  */
212
214
  updateTrackConf(trackConf: {
213
215
  trackId: string;
@@ -219,26 +221,21 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, ext
219
221
  addPlugin(pluginDefinition: PluginDefinition): void;
220
222
  /**
221
223
  * #action
222
- * Removes the entry that loads from the same url — the version-pinned
223
- * definition, not every entry sharing a name, so the update flow's
224
- * remove-then-add swaps one version for another.
225
- *
226
- * A definition naming no loader matches nothing (`isPluginUrl`) rather than
227
- * every other url-less entry: `pluginUrl`'s miss value is the display string
228
- * 'unknown url', so removing one hand-written broken entry used to filter out
229
- * all of them. Such an entry has no InstalledPlugin row to remove it from
230
- * either — it never loads, so it is never in `runtimePluginDefinitions` — so
231
- * matching nothing costs nothing the UI could reach.
224
+ * Removes the entry the loaded copy came from — the version-pinned
225
+ * definition, or the bare store ref that resolved to it. Not every entry
226
+ * sharing a name or a ref, so the update flow's remove-then-add swaps one
227
+ * version for another; `holdsPluginVersion` argues both halves.
232
228
  */
233
229
  removePlugin(pluginDefinition: PluginDefinition): void;
234
230
  /**
235
231
  * #action
232
+ * takes the live session or a plain session snapshot
236
233
  */
237
234
  setDefaultSessionConf(sessionConf: AnyConfigurationModel): void;
238
235
  /**
239
236
  * #action
240
237
  */
241
- addInternetAccountConf(internetAccountConf: AnyConfigurationModel): any;
238
+ addInternetAccountConf(internetAccountConf: AnyConfigurationModel): (import("@jbrowse/core/configuration").PluggableConfigNode & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/PluginManager").PluggableConfigSchemaType>) | undefined;
242
239
  /**
243
240
  * #action
244
241
  */
@@ -1,8 +1,9 @@
1
1
  import { readConfObject } from '@jbrowse/core/configuration';
2
- import { isPluginUrl, maybePluginUrl } from '@jbrowse/core/pluginDefinitions';
2
+ import { migrateRetiredDisplays } from '@jbrowse/core/pluggableElementTypes/models';
3
+ import { holdsPluginVersion } from '@jbrowse/core/pluginDefinitions';
4
+ import { expandLooseSearchIndex } from '@jbrowse/core/util/expandLooseSearchIndex';
3
5
  import { expandLooseTrackConfig } from '@jbrowse/core/util/tracks';
4
- import { cast, getParent, getSnapshot, types } from '@jbrowse/mobx-state-tree';
5
- import { migrateConfigSnapshot } from '@jbrowse/product-core';
6
+ import { cast, getParent, getSnapshot, isStateTreeNode, types, } from '@jbrowse/mobx-state-tree';
6
7
  import { toJS } from 'mobx';
7
8
  import { JBrowseConfigF } from '../JBrowseConfig/index.js';
8
9
  /**
@@ -12,21 +13,34 @@ import { JBrowseConfigF } from '../JBrowseConfig/index.js';
12
13
  * config models are MST trees themselves, which is why this state model is
13
14
  * allowed to build on one. Generally found on a property named rootModel.jbrowse
14
15
  */
15
- // A config with exactly one assembly is what every loose track is on, so
16
- // `assemblyNames` may be left off; with several, the track has to say.
16
+ // A config with exactly one assembly is what every loose track and search index
17
+ // is on, so `assemblyNames` may be left off; with several, each has to say.
17
18
  function expandLooseTracks(snapshot, pluginManager) {
18
- const tracks = snapshot.tracks;
19
- if (!Array.isArray(tracks)) {
20
- return snapshot;
21
- }
22
- const assemblies = snapshot.assemblies;
19
+ const { tracks, assemblies, aggregateTextSearchAdapters: indexes } = snapshot;
23
20
  const only = Array.isArray(assemblies) && assemblies.length === 1
24
21
  ? assemblies[0].name
25
22
  : undefined;
26
- const expanded = tracks.map(t => expandLooseTrackConfig(t, pluginManager, only));
27
- return expanded.every((t, i) => t === tracks[i])
23
+ const expandedTracks = Array.isArray(tracks)
24
+ ? tracks.map(t => {
25
+ const track = expandLooseTrackConfig(t, pluginManager, only);
26
+ return track && typeof track === 'object'
27
+ ? migrateRetiredDisplays(pluginManager, track)
28
+ : track;
29
+ })
30
+ : tracks;
31
+ const expandedIndexes = Array.isArray(indexes)
32
+ ? indexes.map(i => expandLooseSearchIndex(i, only ? [only] : undefined))
33
+ : indexes;
34
+ const same = (a, b) => !Array.isArray(a) || a.every((x, i) => x === b[i]);
35
+ return same(expandedTracks, tracks) && same(expandedIndexes, indexes)
28
36
  ? snapshot
29
- : { ...snapshot, tracks: expanded };
37
+ : {
38
+ ...snapshot,
39
+ ...(expandedTracks ? { tracks: expandedTracks } : {}),
40
+ ...(expandedIndexes
41
+ ? { aggregateTextSearchAdapters: expandedIndexes }
42
+ : {}),
43
+ };
30
44
  }
31
45
  export function JBrowseModelF({ pluginManager, assemblyConfigSchema, extraConfigSlots, }) {
32
46
  const model = JBrowseConfigF({
@@ -57,17 +71,10 @@ export function JBrowseModelF({ pluginManager, assemblyConfigSchema, extraConfig
57
71
  if (!name) {
58
72
  throw new Error('Can\'t add assembly with no "name"');
59
73
  }
60
- if (self.assemblyNames.includes(name)) {
74
+ if (self.assemblies.some(a => a.name === name || a.aliases.includes(name))) {
61
75
  throw new Error(`Can't add assembly with name "${name}", an assembly with that name already exists`);
62
76
  }
63
- const length = self.assemblies.push({
64
- ...conf,
65
- sequence: {
66
- type: 'ReferenceSequenceTrack',
67
- trackId: `${name}-${Date.now()}`,
68
- ...conf.sequence,
69
- },
70
- });
77
+ const length = self.assemblies.push(conf);
71
78
  return self.assemblies[length - 1];
72
79
  },
73
80
  /**
@@ -126,11 +133,12 @@ export function JBrowseModelF({ pluginManager, assemblyConfigSchema, extraConfig
126
133
  /**
127
134
  * #action
128
135
  * Updates an existing track configuration. Used to sync editable configs
129
- * back to the frozen tracks array.
136
+ * back to the frozen tracks array. A trackId the array repeats replaces
137
+ * its last entry, the one the session resolves it to.
130
138
  */
131
139
  updateTrackConf(trackConf) {
132
140
  const { trackId } = trackConf;
133
- const idx = self.tracks.findIndex(t => t.trackId === trackId);
141
+ const idx = self.tracks.findLastIndex(t => t.trackId === trackId);
134
142
  if (idx !== -1) {
135
143
  const newTracks = [...self.tracks];
136
144
  newTracks[idx] = trackConf;
@@ -146,27 +154,21 @@ export function JBrowseModelF({ pluginManager, assemblyConfigSchema, extraConfig
146
154
  },
147
155
  /**
148
156
  * #action
149
- * Removes the entry that loads from the same url — the version-pinned
150
- * definition, not every entry sharing a name, so the update flow's
151
- * remove-then-add swaps one version for another.
152
- *
153
- * A definition naming no loader matches nothing (`isPluginUrl`) rather than
154
- * every other url-less entry: `pluginUrl`'s miss value is the display string
155
- * 'unknown url', so removing one hand-written broken entry used to filter out
156
- * all of them. Such an entry has no InstalledPlugin row to remove it from
157
- * either — it never loads, so it is never in `runtimePluginDefinitions` — so
158
- * matching nothing costs nothing the UI could reach.
157
+ * Removes the entry the loaded copy came from — the version-pinned
158
+ * definition, or the bare store ref that resolved to it. Not every entry
159
+ * sharing a name or a ref, so the update flow's remove-then-add swaps one
160
+ * version for another; `holdsPluginVersion` argues both halves.
159
161
  */
160
162
  removePlugin(pluginDefinition) {
161
- const targetUrl = maybePluginUrl(pluginDefinition);
162
- self.plugins = cast(self.plugins.filter(plugin => !isPluginUrl(plugin, targetUrl)));
163
+ self.plugins = cast(self.plugins.filter(plugin => !holdsPluginVersion(plugin, pluginDefinition)));
163
164
  getParent(self).setPluginsUpdated();
164
165
  },
165
166
  /**
166
167
  * #action
168
+ * takes the live session or a plain session snapshot
167
169
  */
168
170
  setDefaultSessionConf(sessionConf) {
169
- const newDefault = getParent(self).session?.name === sessionConf.name
171
+ const newDefault = isStateTreeNode(sessionConf)
170
172
  ? getSnapshot(sessionConf)
171
173
  : toJS(sessionConf);
172
174
  if (!newDefault.name) {
@@ -195,14 +197,12 @@ export function JBrowseModelF({ pluginManager, assemblyConfigSchema, extraConfig
195
197
  return elt ? self.internetAccounts.remove(elt) : false;
196
198
  },
197
199
  }));
198
- // Migrate legacy display types (e.g. LinearPileupDisplay →
199
- // LinearAlignmentsDisplay) when ingesting config snapshots so saved
200
- // configs from older JBrowse versions still load. `tracks` stays frozen
201
- // (ADR-032), so the loose `{ trackId, uri }` form is expanded here, where
202
- // the track selector and the trackId index read it, and never by a schema.
200
+ // `tracks` stays frozen (ADR-032), so the loose `{ trackId, uri }` form is
201
+ // expanded and a retired display type loaded as its successor here, where
202
+ // the track selector and the trackId index read them, and never by a schema.
203
203
  return types.snapshotProcessor(model, {
204
204
  preProcessor(snapshot) {
205
- return migrateConfigSnapshot(expandLooseTracks(snapshot, pluginManager));
205
+ return expandLooseTracks(snapshot, pluginManager);
206
206
  },
207
207
  });
208
208
  }
@@ -0,0 +1,2 @@
1
+ export { createJbApi, ensureReExports, safeJson, sessionOf, undeliveredNotifications, waitReady, } from './jbApi.ts';
2
+ export type { JbApi } from './jbApi.ts';
@@ -0,0 +1 @@
1
+ export { createJbApi, ensureReExports, safeJson, sessionOf, undeliveredNotifications, waitReady, } from './jbApi.js';