@jbrowse/app-core 4.3.0 → 5.0.0-beta.2

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 (158) hide show
  1. package/esm/AppSession/AppRootModel.d.ts +30 -0
  2. package/esm/AppSession/AppRootModel.js +1 -0
  3. package/esm/AppSession/AppSessionMixin.d.ts +1598 -0
  4. package/esm/AppSession/AppSessionMixin.js +62 -0
  5. package/esm/AppSession/index.d.ts +2 -0
  6. package/esm/AppSession/index.js +1 -0
  7. package/esm/Assemblies/AssembliesMixin.d.ts +225 -0
  8. package/esm/Assemblies/AssembliesMixin.js +149 -0
  9. package/esm/Assemblies/index.d.ts +1 -2
  10. package/esm/Assemblies/index.js +1 -2
  11. package/esm/HistoryManagement/index.d.ts +19 -0
  12. package/esm/HistoryManagement/index.js +42 -5
  13. package/esm/JBrowseConfig/RootConfiguration.d.ts +171 -78
  14. package/esm/JBrowseConfig/RootConfiguration.js +85 -7
  15. package/esm/JBrowseConfig/index.d.ts +173 -84
  16. package/esm/JBrowseConfig/index.js +62 -2
  17. package/esm/JBrowseModel/index.d.ts +180 -95
  18. package/esm/JBrowseModel/index.js +122 -21
  19. package/esm/JbApi/index.d.ts +2 -0
  20. package/esm/JbApi/index.js +1 -0
  21. package/esm/JbApi/jbApi.d.ts +325 -0
  22. package/esm/JbApi/jbApi.js +748 -0
  23. package/esm/RootMenu/index.d.ts +69 -3
  24. package/esm/RootMenu/index.js +96 -61
  25. package/esm/SessionSpec/index.d.ts +6 -0
  26. package/esm/SessionSpec/index.js +3 -0
  27. package/esm/SessionSpec/lgvUrlInit.d.ts +79 -0
  28. package/esm/SessionSpec/lgvUrlInit.js +158 -0
  29. package/esm/SessionSpec/loadSessionSpec.d.ts +21 -0
  30. package/esm/SessionSpec/loadSessionSpec.js +392 -0
  31. package/esm/SessionSpec/parseSessionSpecUrl.d.ts +13 -0
  32. package/esm/SessionSpec/parseSessionSpecUrl.js +196 -0
  33. package/esm/SessionSpec/types.d.ts +31 -0
  34. package/esm/SessionSpec/types.js +1 -0
  35. package/esm/WorkspaceLayout/LayoutRenderer.d.ts +24 -0
  36. package/esm/WorkspaceLayout/LayoutRenderer.js +185 -0
  37. package/esm/WorkspaceLayout/PanelView.d.ts +13 -0
  38. package/esm/WorkspaceLayout/PanelView.js +99 -0
  39. package/esm/WorkspaceLayout/TabStrip.d.ts +14 -0
  40. package/esm/WorkspaceLayout/TabStrip.js +226 -0
  41. package/esm/WorkspaceLayout/WorkspaceContainer.d.ts +16 -0
  42. package/esm/WorkspaceLayout/WorkspaceContainer.js +105 -0
  43. package/esm/WorkspaceLayout/WorkspacePanelActions.d.ts +24 -0
  44. package/esm/WorkspaceLayout/WorkspacePanelActions.js +120 -0
  45. package/esm/WorkspaceLayout/WorkspaceTab.d.ts +27 -0
  46. package/esm/WorkspaceLayout/WorkspaceTab.js +109 -0
  47. package/esm/WorkspaceLayout/dockviewTheme.d.ts +69 -0
  48. package/esm/WorkspaceLayout/dockviewTheme.js +82 -0
  49. package/esm/WorkspaceLayout/dropZone.d.ts +105 -0
  50. package/esm/WorkspaceLayout/dropZone.js +113 -0
  51. package/esm/WorkspaceLayout/index.d.ts +8 -0
  52. package/esm/WorkspaceLayout/index.js +4 -0
  53. package/esm/WorkspaceLayout/model.d.ts +248 -0
  54. package/esm/WorkspaceLayout/model.js +562 -0
  55. package/esm/WorkspaceLayout/panelChrome.d.ts +19 -0
  56. package/esm/WorkspaceLayout/panelChrome.js +4 -0
  57. package/esm/WorkspaceLayout/spec.d.ts +88 -0
  58. package/esm/WorkspaceLayout/spec.js +226 -0
  59. package/esm/WorkspaceLayout/splitter.d.ts +25 -0
  60. package/esm/WorkspaceLayout/splitter.js +37 -0
  61. package/esm/WorkspaceLayout/tree.d.ts +158 -0
  62. package/esm/WorkspaceLayout/tree.js +379 -0
  63. package/esm/WorkspaceLayout/useLayoutDrag.d.ts +34 -0
  64. package/esm/WorkspaceLayout/useLayoutDrag.js +232 -0
  65. package/esm/index.d.ts +18 -9
  66. package/esm/index.js +16 -9
  67. package/esm/menus.d.ts +55 -68
  68. package/esm/menus.js +117 -86
  69. package/esm/queryParams.d.ts +9 -0
  70. package/esm/queryParams.js +92 -0
  71. package/esm/sessionModelFactory.d.ts +18 -0
  72. package/esm/sessionModelFactory.js +1 -0
  73. package/esm/ui/App/App.d.ts +3 -14
  74. package/esm/ui/App/App.js +30 -17
  75. package/esm/ui/App/AppFab.d.ts +12 -3
  76. package/esm/ui/App/AppFab.js +15 -8
  77. package/esm/ui/App/AppReadyMarker.d.ts +43 -0
  78. package/esm/ui/App/AppReadyMarker.js +56 -0
  79. package/esm/ui/App/AppToolbar.d.ts +2 -14
  80. package/esm/ui/App/AppToolbar.js +23 -24
  81. package/esm/ui/App/ClassicViewsContainer.d.ts +3 -9
  82. package/esm/ui/App/ClassicViewsContainer.js +9 -8
  83. package/esm/ui/App/DialogQueue.d.ts +17 -1
  84. package/esm/ui/App/DialogQueue.js +30 -1
  85. package/esm/ui/App/Drawer.d.ts +1 -1
  86. package/esm/ui/App/Drawer.js +10 -39
  87. package/esm/ui/App/DrawerControls.d.ts +1 -5
  88. package/esm/ui/App/DrawerControls.js +1 -25
  89. package/esm/ui/App/DrawerHeader.d.ts +2 -3
  90. package/esm/ui/App/DrawerHeader.js +24 -10
  91. package/esm/ui/App/DrawerHeaderHelpButton.d.ts +1 -1
  92. package/esm/ui/App/DrawerHeaderHelpButton.js +3 -3
  93. package/esm/ui/App/DrawerHeaderHelpDialog.d.ts +2 -2
  94. package/esm/ui/App/DrawerHeaderHelpDialog.js +3 -4
  95. package/esm/ui/App/DrawerWidget.d.ts +1 -1
  96. package/esm/ui/App/DrawerWidget.js +9 -21
  97. package/esm/ui/App/JBrowseTabMenu.d.ts +2 -3
  98. package/esm/ui/App/JBrowseTabMenu.js +24 -5
  99. package/esm/ui/App/ViewButtons.d.ts +2 -4
  100. package/esm/ui/App/ViewButtons.js +15 -3
  101. package/esm/ui/App/ViewContainer.d.ts +3 -2
  102. package/esm/ui/App/ViewContainer.js +144 -24
  103. package/esm/ui/App/ViewContainerTitle.d.ts +1 -1
  104. package/esm/ui/App/ViewContainerTitle.js +9 -2
  105. package/esm/ui/App/ViewErrorFallback.d.ts +18 -0
  106. package/esm/ui/App/ViewErrorFallback.js +42 -0
  107. package/esm/ui/App/ViewHeader.d.ts +3 -4
  108. package/esm/ui/App/ViewHeader.js +28 -17
  109. package/esm/ui/App/ViewLauncher.d.ts +2 -8
  110. package/esm/ui/App/ViewLauncher.js +7 -5
  111. package/esm/ui/App/ViewMenu.d.ts +3 -5
  112. package/esm/ui/App/ViewMenu.js +87 -92
  113. package/esm/ui/App/ViewStack.d.ts +7 -0
  114. package/esm/ui/App/ViewStack.js +42 -0
  115. package/esm/ui/App/ViewWrapper.d.ts +15 -1
  116. package/esm/ui/App/ViewWrapper.js +26 -10
  117. package/esm/ui/App/ViewsContainer.d.ts +3 -8
  118. package/esm/ui/App/ViewsContainer.js +9 -6
  119. package/esm/ui/App/copyView.js +1 -1
  120. package/esm/ui/App/index.d.ts +2 -1
  121. package/esm/ui/App/index.js +3 -2
  122. package/esm/ui/App/lazyChunk.d.ts +13 -0
  123. package/esm/ui/App/lazyChunk.js +91 -0
  124. package/esm/ui/App/types.d.ts +12 -3
  125. package/esm/ui/App/types.js +1 -1
  126. package/esm/ui/App/useViewVisibility.d.ts +34 -0
  127. package/esm/ui/App/useViewVisibility.js +87 -0
  128. package/esm/ui/App/viewTitle.d.ts +5 -0
  129. package/esm/ui/App/viewTitle.js +9 -0
  130. package/esm/ui/index.d.ts +1 -1
  131. package/esm/ui/index.js +1 -1
  132. package/package.json +12 -17
  133. package/esm/AppFocus/index.d.ts +0 -5
  134. package/esm/AppFocus/index.js +0 -12
  135. package/esm/Assemblies/SessionAssembliesMixin.d.ts +0 -92
  136. package/esm/Assemblies/SessionAssembliesMixin.js +0 -53
  137. package/esm/Assemblies/TemporaryAssembliesMixin.d.ts +0 -10
  138. package/esm/Assemblies/TemporaryAssembliesMixin.js +0 -37
  139. package/esm/DockviewLayout/index.d.ts +0 -35
  140. package/esm/DockviewLayout/index.js +0 -111
  141. package/esm/ui/App/DockviewContext.d.ts +0 -22
  142. package/esm/ui/App/DockviewContext.js +0 -29
  143. package/esm/ui/App/DockviewLeftHeaderActions.d.ts +0 -2
  144. package/esm/ui/App/DockviewLeftHeaderActions.js +0 -58
  145. package/esm/ui/App/DockviewRightHeaderActions.d.ts +0 -2
  146. package/esm/ui/App/DockviewRightHeaderActions.js +0 -100
  147. package/esm/ui/App/DrawerWidgetSelector.d.ts +0 -5
  148. package/esm/ui/App/DrawerWidgetSelector.js +0 -47
  149. package/esm/ui/App/JBrowseViewPanel.d.ts +0 -8
  150. package/esm/ui/App/JBrowseViewPanel.js +0 -40
  151. package/esm/ui/App/JBrowseViewTab.d.ts +0 -8
  152. package/esm/ui/App/JBrowseViewTab.js +0 -97
  153. package/esm/ui/App/ModalWidget.d.ts +0 -6
  154. package/esm/ui/App/ModalWidget.js +0 -48
  155. package/esm/ui/App/TiledViewsContainer.d.ts +0 -6
  156. package/esm/ui/App/TiledViewsContainer.js +0 -366
  157. package/esm/ui/App/dockviewUtils.d.ts +0 -46
  158. package/esm/ui/App/dockviewUtils.js +0 -55
@@ -1,115 +1,145 @@
1
- import type { PluginDefinition } from '@jbrowse/core/PluginLoader';
2
1
  import type PluginManager from '@jbrowse/core/PluginManager';
3
2
  import type { BaseAssemblyConfigSchema } from '@jbrowse/core/assemblyManager';
4
- import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
+ import type { AnyConfiguration, AnyConfigurationModel, ConfigurationSchemaDefinition } from '@jbrowse/core/configuration';
4
+ import type { PluginDefinition } from '@jbrowse/core/pluginDefinitions';
5
5
  import type RpcManager from '@jbrowse/core/rpc/RpcManager';
6
- export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }: {
7
- adminMode?: boolean;
6
+ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, extraConfigSlots, }: {
8
7
  pluginManager: PluginManager;
9
8
  assemblyConfigSchema: BaseAssemblyConfigSchema;
10
- }): import("@jbrowse/mobx-state-tree").IModelType<{
9
+ extraConfigSlots?: ConfigurationSchemaDefinition;
10
+ }): import("@jbrowse/mobx-state-tree").ISnapshotProcessor<import("@jbrowse/mobx-state-tree").IModelType<{
11
11
  configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
12
- rpc: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
13
- defaultDriver: {
14
- type: string;
15
- description: string;
16
- defaultValue: string;
12
+ readonly rpc: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
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;
18
+ };
19
+ 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;
17
24
  };
18
- drivers: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IMapType<import("@jbrowse/mobx-state-tree").ITypeUnion<import("@jbrowse/mobx-state-tree").ModelCreationType<import("@jbrowse/mobx-state-tree/dist/internal").ExtractCFromProps<Record<string, any>>> | undefined, import("@jbrowse/mobx-state-tree").ModelSnapshotType<Record<string, any>>, ({} & Partial<import("@jbrowse/mobx-state-tree/dist/internal").ExtractCFromProps<Record<string, any>>> & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject) | undefined>>, [undefined]>;
19
25
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
20
- highResolutionScaling: {
21
- type: string;
22
- defaultValue: number;
23
- };
24
- formatDetails: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
25
- feature: {
26
- type: string;
27
- description: string;
28
- defaultValue: {};
29
- contextVariable: string[];
26
+ readonly formatDetails: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
27
+ readonly feature: {
28
+ readonly type: "frozen";
29
+ readonly description: "adds extra fields to the feature details";
30
+ readonly defaultValue: {};
31
+ readonly contextVariable: ["feature"];
30
32
  };
31
- subfeatures: {
32
- type: string;
33
- description: string;
34
- defaultValue: {};
35
- contextVariable: string[];
33
+ 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"];
36
38
  };
37
- depth: {
38
- type: string;
39
- defaultValue: number;
40
- description: string;
39
+ readonly depth: {
40
+ readonly type: "maybeNumber";
41
+ readonly description: "levels of subfeature the formatDetails.subfeatures callback runs on, default 2";
41
42
  };
42
- maxDepth: {
43
- type: string;
44
- defaultValue: number;
45
- description: string;
43
+ readonly maxDepth: {
44
+ readonly type: "maybeNumber";
45
+ readonly description: "hide subfeatures nested deeper than this, default no limit";
46
46
  };
47
47
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
48
- formatAbout: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
49
- config: {
50
- type: string;
51
- description: string;
52
- defaultValue: {};
53
- contextVariable: string[];
48
+ readonly formatAbout: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
49
+ readonly config: {
50
+ readonly type: "frozen";
51
+ readonly description: "formats configuration object in about dialog";
52
+ readonly defaultValue: {};
53
+ readonly contextVariable: ["config"];
54
54
  };
55
- hideUris: {
56
- type: string;
57
- defaultValue: boolean;
55
+ readonly hideUris: {
56
+ readonly type: "boolean";
57
+ readonly defaultValue: false;
58
58
  };
59
59
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
60
- shareURL: {
61
- type: string;
62
- defaultValue: string;
60
+ readonly shareURL: {
61
+ readonly type: "string";
62
+ readonly defaultValue: "https://share.jbrowse.org/api/v1/";
63
+ readonly advanced: true;
63
64
  };
64
- disableAnalytics: {
65
- type: string;
66
- defaultValue: boolean;
65
+ readonly disableAnalytics: {
66
+ readonly type: "boolean";
67
+ readonly defaultValue: false;
68
+ readonly advanced: true;
67
69
  };
68
- hierarchical: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
69
- sort: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
70
- trackNames: {
71
- type: string;
72
- defaultValue: boolean;
70
+ readonly hierarchical: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
71
+ readonly sort: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
72
+ readonly trackNames: {
73
+ readonly type: "boolean";
74
+ readonly defaultValue: false;
73
75
  };
74
- categories: {
75
- type: string;
76
- defaultValue: boolean;
76
+ readonly categories: {
77
+ readonly type: "boolean";
78
+ readonly defaultValue: false;
77
79
  };
78
80
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
79
- defaultFolderCategories: {
80
- type: string;
81
- description: string;
82
- defaultValue: never[];
81
+ readonly defaultFolderCategories: {
82
+ readonly type: "stringArray";
83
+ readonly description: "list of category names to display as folders by default";
84
+ readonly defaultValue: readonly [];
83
85
  };
84
- defaultCollapsed: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
85
- categoryNames: {
86
- type: string;
87
- defaultValue: never[];
86
+ readonly defaultCollapsed: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
87
+ readonly categoryNames: {
88
+ readonly type: "stringArray";
89
+ readonly defaultValue: readonly [];
88
90
  };
89
- topLevelCategories: {
90
- type: string;
91
- defaultValue: boolean;
91
+ readonly topLevelCategories: {
92
+ readonly type: "boolean";
93
+ readonly defaultValue: false;
92
94
  };
93
- subCategories: {
94
- type: string;
95
- defaultValue: boolean;
95
+ readonly subCategories: {
96
+ readonly type: "boolean";
97
+ readonly defaultValue: false;
96
98
  };
97
99
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
98
100
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
99
- theme: {
100
- type: string;
101
- defaultValue: {};
101
+ readonly preferences: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
102
+ readonly animationMode: {
103
+ readonly model: import("@jbrowse/mobx-state-tree").ISimpleType<"disabled" | "enabled" | "system">;
104
+ readonly type: "stringEnum";
105
+ readonly defaultValue: "enabled";
106
+ };
107
+ readonly scrollZoom: {
108
+ readonly type: "boolean";
109
+ readonly defaultValue: false;
110
+ };
111
+ readonly numberGrouping: {
112
+ readonly type: "boolean";
113
+ readonly defaultValue: true;
114
+ };
115
+ readonly useWorkspaces: {
116
+ readonly type: "boolean";
117
+ readonly defaultValue: false;
118
+ };
119
+ readonly developerMode: {
120
+ readonly type: "boolean";
121
+ readonly defaultValue: false;
122
+ };
123
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
124
+ readonly theme: {
125
+ readonly type: "frozen";
126
+ readonly description: "Material UI theme overrides applied to the JBrowse UI";
127
+ readonly defaultValue: {};
102
128
  };
103
- extraThemes: {
104
- type: string;
105
- defaultValue: {};
129
+ readonly extraThemes: {
130
+ readonly type: "frozen";
131
+ readonly description: "additional named themes the user can switch between";
132
+ readonly defaultValue: {};
133
+ readonly advanced: true;
106
134
  };
107
- logoPath: {
108
- type: string;
109
- defaultValue: {
110
- uri: string;
111
- locationType: string;
135
+ readonly logoPath: {
136
+ readonly type: "fileLocation";
137
+ readonly description: "path to a custom logo image displayed in the app header";
138
+ readonly defaultValue: {
139
+ readonly uri: "";
140
+ readonly locationType: "UriLocation";
112
141
  };
142
+ readonly advanced: true;
113
143
  };
114
144
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
115
145
  plugins: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<PluginDefinition, PluginDefinition, PluginDefinition>>;
@@ -124,42 +154,97 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
124
154
  [key: string]: unknown;
125
155
  trackId: string;
126
156
  }[]>;
127
- internetAccounts: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyModelType>;
128
- aggregateTextSearchAdapters: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyModelType>;
129
- connections: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyModelType>;
157
+ internetAccounts: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyType>;
158
+ aggregateTextSearchAdapters: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyType>;
159
+ connections: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyType>;
130
160
  defaultSession: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IType<any, any, any>, [undefined]>;
131
161
  preConfiguredSessions: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<any, any, any>>;
132
162
  }, {
163
+ /**
164
+ * #getter
165
+ */
133
166
  readonly assemblyNames: string[];
167
+ /**
168
+ * #getter
169
+ */
134
170
  readonly rpcManager: RpcManager;
135
171
  } & {
136
- addAssemblyConf(conf: AnyConfigurationModel): ({
137
- [x: string]: any;
138
- } & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject & {
139
- setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
140
- [x: string]: any;
141
- } & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject & any & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
172
+ /**
173
+ * #action
174
+ */
175
+ addAssemblyConf(conf: AnyConfigurationModel): (import("@jbrowse/mobx-state-tree").ModelInstanceTypeProps<Record<string, any>> & {
176
+ setSubschema(slotName: string, data: Record<string, unknown>): any;
177
+ setSlot(slotName: string, value: unknown): void;
142
178
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>) | undefined;
179
+ /**
180
+ * #action
181
+ */
143
182
  removeAssemblyConf(assemblyName: string): void;
144
- addTrackConf(trackConf: {
183
+ /**
184
+ * #action
185
+ */
186
+ addTrackConf(loose: {
145
187
  trackId: string;
146
- type: string;
188
+ type?: string;
147
189
  }): {
148
190
  [key: string]: unknown;
149
191
  trackId: string;
150
192
  } | undefined;
151
- addConnectionConf(connectionConf: AnyConfigurationModel): any;
193
+ /**
194
+ * #action
195
+ * Adds to the config's own `connections`, which every visitor to this
196
+ * instance loads. Takes a snapshot as readily as a built config model —
197
+ * the array coerces — since callers hand it plain JSON (a session spec's
198
+ * `sessionConnections`, the CLI's add-connection output).
199
+ */
200
+ addConnectionConf(connectionConf: AnyConfiguration): any;
201
+ /**
202
+ * #action
203
+ */
152
204
  deleteConnectionConf(configuration: AnyConfigurationModel): boolean;
205
+ /**
206
+ * #action
207
+ */
153
208
  deleteTrackConf(trackConf: AnyConfigurationModel | {
154
209
  trackId: string;
155
210
  }): void;
211
+ /**
212
+ * #action
213
+ * Updates an existing track configuration. Used to sync editable configs
214
+ * back to the frozen tracks array.
215
+ */
156
216
  updateTrackConf(trackConf: {
157
217
  trackId: string;
158
218
  [key: string]: unknown;
159
219
  }): void;
220
+ /**
221
+ * #action
222
+ */
160
223
  addPlugin(pluginDefinition: PluginDefinition): void;
224
+ /**
225
+ * #action
226
+ * Removes the entry that loads from the same url — the version-pinned
227
+ * definition, not every entry sharing a name, so the update flow's
228
+ * remove-then-add swaps one version for another.
229
+ *
230
+ * A definition naming no loader matches nothing (`isPluginUrl`) rather than
231
+ * every other url-less entry: `pluginUrl`'s miss value is the display string
232
+ * 'unknown url', so removing one hand-written broken entry used to filter out
233
+ * all of them. Such an entry has no InstalledPlugin row to remove it from
234
+ * either — it never loads, so it is never in `runtimePluginDefinitions` — so
235
+ * matching nothing costs nothing the UI could reach.
236
+ */
161
237
  removePlugin(pluginDefinition: PluginDefinition): void;
238
+ /**
239
+ * #action
240
+ */
162
241
  setDefaultSessionConf(sessionConf: AnyConfigurationModel): void;
242
+ /**
243
+ * #action
244
+ */
163
245
  addInternetAccountConf(internetAccountConf: AnyConfigurationModel): any;
246
+ /**
247
+ * #action
248
+ */
164
249
  deleteInternetAccountConf(configuration: AnyConfigurationModel): boolean;
165
- }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
250
+ }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>, Record<string, unknown>, import("@jbrowse/mobx-state-tree")._NotCustomized>;
@@ -1,18 +1,57 @@
1
1
  import { readConfObject } from '@jbrowse/core/configuration';
2
- import { cast, getParent, getSnapshot } from '@jbrowse/mobx-state-tree';
2
+ import { isPluginUrl, maybePluginUrl } from '@jbrowse/core/pluginDefinitions';
3
+ 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';
3
6
  import { toJS } from 'mobx';
4
- import { JBrowseConfigF } from "../JBrowseConfig/index.js";
5
- export function JBrowseModelF({ pluginManager, assemblyConfigSchema, }) {
6
- return JBrowseConfigF({ pluginManager, assemblyConfigSchema })
7
+ import { JBrowseConfigF } from '../JBrowseConfig/index.js';
8
+ /**
9
+ * #stateModel AppCoreJBrowseModel
10
+ * #category root
11
+ * built on the [JBrowseRootConfig](/docs/config/jbrowserootconfig) config model —
12
+ * config models are MST trees themselves, which is why this state model is
13
+ * allowed to build on one. Generally found on a property named rootModel.jbrowse
14
+ */
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.
17
+ function expandLooseTracks(snapshot, pluginManager) {
18
+ const tracks = snapshot.tracks;
19
+ if (!Array.isArray(tracks)) {
20
+ return snapshot;
21
+ }
22
+ const assemblies = snapshot.assemblies;
23
+ const only = Array.isArray(assemblies) && assemblies.length === 1
24
+ ? assemblies[0].name
25
+ : undefined;
26
+ const expanded = tracks.map(t => expandLooseTrackConfig(t, pluginManager, only));
27
+ return expanded.every((t, i) => t === tracks[i])
28
+ ? snapshot
29
+ : { ...snapshot, tracks: expanded };
30
+ }
31
+ export function JBrowseModelF({ pluginManager, assemblyConfigSchema, extraConfigSlots, }) {
32
+ const model = JBrowseConfigF({
33
+ pluginManager,
34
+ assemblyConfigSchema,
35
+ extraConfigSlots,
36
+ })
7
37
  .views(self => ({
38
+ /**
39
+ * #getter
40
+ */
8
41
  get assemblyNames() {
9
42
  return self.assemblies.map(assembly => readConfObject(assembly, 'name'));
10
43
  },
44
+ /**
45
+ * #getter
46
+ */
11
47
  get rpcManager() {
12
48
  return getParent(self).rpcManager;
13
49
  },
14
50
  }))
15
51
  .actions(self => ({
52
+ /**
53
+ * #action
54
+ */
16
55
  addAssemblyConf(conf) {
17
56
  const { name } = conf;
18
57
  if (!name) {
@@ -31,36 +70,64 @@ export function JBrowseModelF({ pluginManager, assemblyConfigSchema, }) {
31
70
  });
32
71
  return self.assemblies[length - 1];
33
72
  },
73
+ /**
74
+ * #action
75
+ */
34
76
  removeAssemblyConf(assemblyName) {
35
77
  const toRemove = self.assemblies.find(a => a.name === assemblyName);
36
78
  if (toRemove) {
37
79
  self.assemblies.remove(toRemove);
38
80
  }
39
81
  },
40
- addTrackConf(trackConf) {
82
+ /**
83
+ * #action
84
+ */
85
+ addTrackConf(loose) {
86
+ const trackConf = expandLooseTrackConfig(loose, pluginManager);
41
87
  const { type } = trackConf;
42
88
  if (!type) {
43
- throw new Error(`unknown track type ${type}`);
89
+ throw new Error(`track type not specified for "${trackConf.trackId}"`);
44
90
  }
45
91
  self.tracks = [...self.tracks, trackConf];
46
92
  return self.tracks.at(-1);
47
93
  },
94
+ /**
95
+ * #action
96
+ * Adds to the config's own `connections`, which every visitor to this
97
+ * instance loads. Takes a snapshot as readily as a built config model —
98
+ * the array coerces — since callers hand it plain JSON (a session spec's
99
+ * `sessionConnections`, the CLI's add-connection output).
100
+ */
48
101
  addConnectionConf(connectionConf) {
49
102
  const { type } = connectionConf;
50
103
  if (!type) {
51
- throw new Error(`unknown connection type ${type}`);
104
+ throw new Error('connection type not specified');
52
105
  }
53
106
  const length = self.connections.push(connectionConf);
54
107
  return self.connections[length - 1];
55
108
  },
109
+ /**
110
+ * #action
111
+ */
56
112
  deleteConnectionConf(configuration) {
57
- const elt = self.connections.find(conn => conn.id === configuration.id);
58
- return self.connections.remove(elt);
113
+ // key on connectionId: the connection schema's explicitIdentifier means
114
+ // `.id` is undefined on every entry, so an id-based find always matched
115
+ // the first connection and deleted the wrong one
116
+ const elt = self.connections.find(conn => conn.connectionId === configuration.connectionId);
117
+ return elt ? self.connections.remove(elt) : false;
59
118
  },
119
+ /**
120
+ * #action
121
+ */
60
122
  deleteTrackConf(trackConf) {
61
123
  const trackId = trackConf.trackId;
62
124
  self.tracks = self.tracks.filter(t => t.trackId !== trackId);
63
125
  },
126
+ /**
127
+ * #action
128
+ * Updates an existing track configuration. Used to sync editable configs
129
+ * back to the frozen tracks array.
130
+ */
64
131
  updateTrackConf(trackConf) {
65
132
  const { trackId } = trackConf;
66
133
  const idx = self.tracks.findIndex(t => t.trackId === trackId);
@@ -70,38 +137,72 @@ export function JBrowseModelF({ pluginManager, assemblyConfigSchema, }) {
70
137
  self.tracks = newTracks;
71
138
  }
72
139
  },
140
+ /**
141
+ * #action
142
+ */
73
143
  addPlugin(pluginDefinition) {
74
144
  self.plugins.push(pluginDefinition);
75
- const rootModel = getParent(self);
76
- rootModel.setPluginsUpdated(true);
145
+ getParent(self).setPluginsUpdated();
77
146
  },
147
+ /**
148
+ * #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.
159
+ */
78
160
  removePlugin(pluginDefinition) {
79
- self.plugins = cast(self.plugins.filter(plugin => plugin.url !== pluginDefinition.url ||
80
- plugin.umdUrl !== pluginDefinition.umdUrl ||
81
- plugin.cjsUrl !== pluginDefinition.cjsUrl ||
82
- plugin.esmUrl !== pluginDefinition.esmUrl));
83
- getParent(self).setPluginsUpdated(true);
161
+ const targetUrl = maybePluginUrl(pluginDefinition);
162
+ self.plugins = cast(self.plugins.filter(plugin => !isPluginUrl(plugin, targetUrl)));
163
+ getParent(self).setPluginsUpdated();
84
164
  },
165
+ /**
166
+ * #action
167
+ */
85
168
  setDefaultSessionConf(sessionConf) {
86
- const newDefault = getParent(self).session.name === sessionConf.name
169
+ const newDefault = getParent(self).session?.name === sessionConf.name
87
170
  ? getSnapshot(sessionConf)
88
171
  : toJS(sessionConf);
89
172
  if (!newDefault.name) {
90
- throw new Error(`unable to set default session to ${newDefault.name}`);
173
+ throw new Error('default session must have a name');
91
174
  }
92
175
  self.defaultSession = cast(newDefault);
93
176
  },
177
+ /**
178
+ * #action
179
+ */
94
180
  addInternetAccountConf(internetAccountConf) {
95
181
  const { type } = internetAccountConf;
96
182
  if (!type) {
97
- throw new Error(`unknown internetAccount type ${type}`);
183
+ throw new Error('internet account type not specified');
98
184
  }
99
185
  const length = self.internetAccounts.push(internetAccountConf);
100
186
  return self.internetAccounts[length - 1];
101
187
  },
188
+ /**
189
+ * #action
190
+ */
102
191
  deleteInternetAccountConf(configuration) {
103
- const elt = self.internetAccounts.find(a => a.id === configuration.id);
104
- return self.internetAccounts.remove(elt);
192
+ // key on internetAccountId, not the undefined `.id` (see
193
+ // deleteConnectionConf) so the correct account is removed
194
+ const elt = self.internetAccounts.find(a => a.internetAccountId === configuration.internetAccountId);
195
+ return elt ? self.internetAccounts.remove(elt) : false;
105
196
  },
106
197
  }));
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.
203
+ return types.snapshotProcessor(model, {
204
+ preProcessor(snapshot) {
205
+ return migrateConfigSnapshot(expandLooseTracks(snapshot, pluginManager));
206
+ },
207
+ });
107
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';