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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) 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 +167 -78
  14. package/esm/JBrowseConfig/RootConfiguration.js +85 -7
  15. package/esm/JBrowseConfig/index.d.ts +169 -84
  16. package/esm/JBrowseConfig/index.js +62 -2
  17. package/esm/JBrowseModel/index.d.ts +176 -95
  18. package/esm/JBrowseModel/index.js +122 -21
  19. package/esm/RootMenu/index.d.ts +77 -2
  20. package/esm/RootMenu/index.js +107 -61
  21. package/esm/SessionSpec/index.d.ts +6 -0
  22. package/esm/SessionSpec/index.js +3 -0
  23. package/esm/SessionSpec/lgvUrlInit.d.ts +79 -0
  24. package/esm/SessionSpec/lgvUrlInit.js +158 -0
  25. package/esm/SessionSpec/loadSessionSpec.d.ts +21 -0
  26. package/esm/SessionSpec/loadSessionSpec.js +311 -0
  27. package/esm/SessionSpec/parseSessionSpecUrl.d.ts +13 -0
  28. package/esm/SessionSpec/parseSessionSpecUrl.js +196 -0
  29. package/esm/SessionSpec/types.d.ts +33 -0
  30. package/esm/SessionSpec/types.js +1 -0
  31. package/esm/WorkspaceLayout/LayoutRenderer.d.ts +24 -0
  32. package/esm/WorkspaceLayout/LayoutRenderer.js +185 -0
  33. package/esm/WorkspaceLayout/PanelView.d.ts +13 -0
  34. package/esm/WorkspaceLayout/PanelView.js +99 -0
  35. package/esm/WorkspaceLayout/TabStrip.d.ts +14 -0
  36. package/esm/WorkspaceLayout/TabStrip.js +226 -0
  37. package/esm/WorkspaceLayout/WorkspaceContainer.d.ts +16 -0
  38. package/esm/WorkspaceLayout/WorkspaceContainer.js +105 -0
  39. package/esm/WorkspaceLayout/WorkspacePanelActions.d.ts +24 -0
  40. package/esm/WorkspaceLayout/WorkspacePanelActions.js +120 -0
  41. package/esm/WorkspaceLayout/WorkspaceTab.d.ts +27 -0
  42. package/esm/WorkspaceLayout/WorkspaceTab.js +109 -0
  43. package/esm/WorkspaceLayout/dockviewTheme.d.ts +69 -0
  44. package/esm/WorkspaceLayout/dockviewTheme.js +82 -0
  45. package/esm/WorkspaceLayout/dropZone.d.ts +105 -0
  46. package/esm/WorkspaceLayout/dropZone.js +113 -0
  47. package/esm/WorkspaceLayout/index.d.ts +8 -0
  48. package/esm/WorkspaceLayout/index.js +4 -0
  49. package/esm/WorkspaceLayout/model.d.ts +240 -0
  50. package/esm/WorkspaceLayout/model.js +527 -0
  51. package/esm/WorkspaceLayout/panelChrome.d.ts +19 -0
  52. package/esm/WorkspaceLayout/panelChrome.js +4 -0
  53. package/esm/WorkspaceLayout/spec.d.ts +58 -0
  54. package/esm/WorkspaceLayout/spec.js +153 -0
  55. package/esm/WorkspaceLayout/splitter.d.ts +25 -0
  56. package/esm/WorkspaceLayout/splitter.js +37 -0
  57. package/esm/WorkspaceLayout/tree.d.ts +158 -0
  58. package/esm/WorkspaceLayout/tree.js +379 -0
  59. package/esm/WorkspaceLayout/useLayoutDrag.d.ts +34 -0
  60. package/esm/WorkspaceLayout/useLayoutDrag.js +232 -0
  61. package/esm/index.d.ts +16 -9
  62. package/esm/index.js +13 -9
  63. package/esm/menus.d.ts +63 -62
  64. package/esm/menus.js +131 -84
  65. package/esm/queryParams.d.ts +9 -0
  66. package/esm/queryParams.js +92 -0
  67. package/esm/sessionModelFactory.d.ts +18 -0
  68. package/esm/sessionModelFactory.js +1 -0
  69. package/esm/ui/App/App.d.ts +3 -14
  70. package/esm/ui/App/App.js +30 -17
  71. package/esm/ui/App/AppFab.d.ts +12 -3
  72. package/esm/ui/App/AppFab.js +15 -8
  73. package/esm/ui/App/AppReadyMarker.d.ts +34 -0
  74. package/esm/ui/App/AppReadyMarker.js +56 -0
  75. package/esm/ui/App/AppToolbar.d.ts +2 -14
  76. package/esm/ui/App/AppToolbar.js +23 -24
  77. package/esm/ui/App/ClassicViewsContainer.d.ts +3 -9
  78. package/esm/ui/App/ClassicViewsContainer.js +9 -8
  79. package/esm/ui/App/DialogQueue.d.ts +17 -1
  80. package/esm/ui/App/DialogQueue.js +30 -1
  81. package/esm/ui/App/Drawer.d.ts +1 -1
  82. package/esm/ui/App/Drawer.js +10 -39
  83. package/esm/ui/App/DrawerControls.d.ts +1 -5
  84. package/esm/ui/App/DrawerControls.js +1 -25
  85. package/esm/ui/App/DrawerHeader.d.ts +2 -3
  86. package/esm/ui/App/DrawerHeader.js +24 -10
  87. package/esm/ui/App/DrawerHeaderHelpButton.d.ts +1 -1
  88. package/esm/ui/App/DrawerHeaderHelpButton.js +3 -3
  89. package/esm/ui/App/DrawerHeaderHelpDialog.d.ts +2 -2
  90. package/esm/ui/App/DrawerHeaderHelpDialog.js +3 -4
  91. package/esm/ui/App/DrawerWidget.d.ts +1 -1
  92. package/esm/ui/App/DrawerWidget.js +9 -21
  93. package/esm/ui/App/JBrowseTabMenu.d.ts +2 -3
  94. package/esm/ui/App/JBrowseTabMenu.js +24 -5
  95. package/esm/ui/App/ViewButtons.d.ts +2 -4
  96. package/esm/ui/App/ViewButtons.js +15 -3
  97. package/esm/ui/App/ViewContainer.d.ts +3 -2
  98. package/esm/ui/App/ViewContainer.js +144 -24
  99. package/esm/ui/App/ViewContainerTitle.d.ts +1 -1
  100. package/esm/ui/App/ViewContainerTitle.js +9 -2
  101. package/esm/ui/App/ViewErrorFallback.d.ts +18 -0
  102. package/esm/ui/App/ViewErrorFallback.js +42 -0
  103. package/esm/ui/App/ViewHeader.d.ts +3 -4
  104. package/esm/ui/App/ViewHeader.js +28 -17
  105. package/esm/ui/App/ViewLauncher.d.ts +2 -8
  106. package/esm/ui/App/ViewLauncher.js +7 -5
  107. package/esm/ui/App/ViewMenu.d.ts +3 -5
  108. package/esm/ui/App/ViewMenu.js +87 -92
  109. package/esm/ui/App/ViewStack.d.ts +7 -0
  110. package/esm/ui/App/ViewStack.js +42 -0
  111. package/esm/ui/App/ViewWrapper.d.ts +15 -1
  112. package/esm/ui/App/ViewWrapper.js +26 -10
  113. package/esm/ui/App/ViewsContainer.d.ts +3 -8
  114. package/esm/ui/App/ViewsContainer.js +9 -6
  115. package/esm/ui/App/copyView.js +1 -1
  116. package/esm/ui/App/index.d.ts +2 -1
  117. package/esm/ui/App/index.js +3 -2
  118. package/esm/ui/App/lazyChunk.d.ts +13 -0
  119. package/esm/ui/App/lazyChunk.js +91 -0
  120. package/esm/ui/App/types.d.ts +12 -3
  121. package/esm/ui/App/types.js +1 -1
  122. package/esm/ui/App/useViewVisibility.d.ts +34 -0
  123. package/esm/ui/App/useViewVisibility.js +87 -0
  124. package/esm/ui/App/viewTitle.d.ts +5 -0
  125. package/esm/ui/App/viewTitle.js +9 -0
  126. package/esm/ui/index.d.ts +1 -1
  127. package/esm/ui/index.js +1 -1
  128. package/package.json +12 -17
  129. package/esm/AppFocus/index.d.ts +0 -5
  130. package/esm/AppFocus/index.js +0 -12
  131. package/esm/Assemblies/SessionAssembliesMixin.d.ts +0 -92
  132. package/esm/Assemblies/SessionAssembliesMixin.js +0 -53
  133. package/esm/Assemblies/TemporaryAssembliesMixin.d.ts +0 -10
  134. package/esm/Assemblies/TemporaryAssembliesMixin.js +0 -37
  135. package/esm/DockviewLayout/index.d.ts +0 -35
  136. package/esm/DockviewLayout/index.js +0 -111
  137. package/esm/ui/App/DockviewContext.d.ts +0 -22
  138. package/esm/ui/App/DockviewContext.js +0 -29
  139. package/esm/ui/App/DockviewLeftHeaderActions.d.ts +0 -2
  140. package/esm/ui/App/DockviewLeftHeaderActions.js +0 -58
  141. package/esm/ui/App/DockviewRightHeaderActions.d.ts +0 -2
  142. package/esm/ui/App/DockviewRightHeaderActions.js +0 -100
  143. package/esm/ui/App/DrawerWidgetSelector.d.ts +0 -5
  144. package/esm/ui/App/DrawerWidgetSelector.js +0 -47
  145. package/esm/ui/App/JBrowseViewPanel.d.ts +0 -8
  146. package/esm/ui/App/JBrowseViewPanel.js +0 -40
  147. package/esm/ui/App/JBrowseViewTab.d.ts +0 -8
  148. package/esm/ui/App/JBrowseViewTab.js +0 -97
  149. package/esm/ui/App/ModalWidget.d.ts +0 -6
  150. package/esm/ui/App/ModalWidget.js +0 -48
  151. package/esm/ui/App/TiledViewsContainer.d.ts +0 -6
  152. package/esm/ui/App/TiledViewsContainer.js +0 -366
  153. package/esm/ui/App/dockviewUtils.d.ts +0 -46
  154. package/esm/ui/App/dockviewUtils.js +0 -55
@@ -1,115 +1,141 @@
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
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
120
+ readonly theme: {
121
+ readonly type: "frozen";
122
+ readonly description: "Material UI theme overrides applied to the JBrowse UI";
123
+ readonly defaultValue: {};
102
124
  };
103
- extraThemes: {
104
- type: string;
105
- defaultValue: {};
125
+ readonly extraThemes: {
126
+ readonly type: "frozen";
127
+ readonly description: "additional named themes the user can switch between";
128
+ readonly defaultValue: {};
129
+ readonly advanced: true;
106
130
  };
107
- logoPath: {
108
- type: string;
109
- defaultValue: {
110
- uri: string;
111
- locationType: string;
131
+ 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";
112
137
  };
138
+ readonly advanced: true;
113
139
  };
114
140
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
115
141
  plugins: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<PluginDefinition, PluginDefinition, PluginDefinition>>;
@@ -124,42 +150,97 @@ export declare function JBrowseModelF({ pluginManager, assemblyConfigSchema, }:
124
150
  [key: string]: unknown;
125
151
  trackId: string;
126
152
  }[]>;
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>;
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>;
130
156
  defaultSession: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IType<any, any, any>, [undefined]>;
131
157
  preConfiguredSessions: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<any, any, any>>;
132
158
  }, {
159
+ /**
160
+ * #getter
161
+ */
133
162
  readonly assemblyNames: string[];
163
+ /**
164
+ * #getter
165
+ */
134
166
  readonly rpcManager: RpcManager;
135
167
  } & {
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>);
168
+ /**
169
+ * #action
170
+ */
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;
142
174
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>) | undefined;
175
+ /**
176
+ * #action
177
+ */
143
178
  removeAssemblyConf(assemblyName: string): void;
144
- addTrackConf(trackConf: {
179
+ /**
180
+ * #action
181
+ */
182
+ addTrackConf(loose: {
145
183
  trackId: string;
146
- type: string;
184
+ type?: string;
147
185
  }): {
148
186
  [key: string]: unknown;
149
187
  trackId: string;
150
188
  } | undefined;
151
- addConnectionConf(connectionConf: AnyConfigurationModel): any;
189
+ /**
190
+ * #action
191
+ * Adds to the config's own `connections`, which every visitor to this
192
+ * instance loads. Takes a snapshot as readily as a built config model —
193
+ * the array coerces — since callers hand it plain JSON (a session spec's
194
+ * `sessionConnections`, the CLI's add-connection output).
195
+ */
196
+ addConnectionConf(connectionConf: AnyConfiguration): any;
197
+ /**
198
+ * #action
199
+ */
152
200
  deleteConnectionConf(configuration: AnyConfigurationModel): boolean;
201
+ /**
202
+ * #action
203
+ */
153
204
  deleteTrackConf(trackConf: AnyConfigurationModel | {
154
205
  trackId: string;
155
206
  }): void;
207
+ /**
208
+ * #action
209
+ * Updates an existing track configuration. Used to sync editable configs
210
+ * back to the frozen tracks array.
211
+ */
156
212
  updateTrackConf(trackConf: {
157
213
  trackId: string;
158
214
  [key: string]: unknown;
159
215
  }): void;
216
+ /**
217
+ * #action
218
+ */
160
219
  addPlugin(pluginDefinition: PluginDefinition): void;
220
+ /**
221
+ * #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.
232
+ */
161
233
  removePlugin(pluginDefinition: PluginDefinition): void;
234
+ /**
235
+ * #action
236
+ */
162
237
  setDefaultSessionConf(sessionConf: AnyConfigurationModel): void;
238
+ /**
239
+ * #action
240
+ */
163
241
  addInternetAccountConf(internetAccountConf: AnyConfigurationModel): any;
242
+ /**
243
+ * #action
244
+ */
164
245
  deleteInternetAccountConf(configuration: AnyConfigurationModel): boolean;
165
- }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
246
+ }, 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
  }
@@ -1,13 +1,88 @@
1
- import type { Menu, MenuAction } from '../menus.ts';
1
+ import type { MenuAction, MenuDefinition } from '../menus.ts';
2
2
  import type { MenuItem } from '@jbrowse/core/ui/Menu';
3
+ /**
4
+ * #stateModel RootAppMenuMixin
5
+ */
3
6
  export declare function RootAppMenuMixin(): import("@jbrowse/mobx-state-tree").IModelType<{}, {
4
7
  mutableMenuActions: MenuAction[];
5
8
  } & {
6
- setMenus(newMenus: Menu[]): void;
9
+ /**
10
+ * #action
11
+ * Replace the menu bar wholesale. Item contributions recorded before
12
+ * this one are dropped along with the menus they targeted, so a plugin
13
+ * adding to the existing bar wants `appendToMenu` instead.
14
+ *
15
+ * @param newMenus - The complete new set of top-level menus.
16
+ */
17
+ setMenus(newMenus: MenuDefinition[]): void;
18
+ /**
19
+ * #action
20
+ * Add a top-level menu, if the app bar does not already have one with
21
+ * this name.
22
+ *
23
+ * @param menuName - Name of the menu to add.
24
+ */
7
25
  appendMenu(menuName: string): void;
26
+ /**
27
+ * #action
28
+ * Insert a top-level menu, if the app bar does not already have one
29
+ * with this name.
30
+ *
31
+ * @param menuName - Name of the menu to insert.
32
+ *
33
+ * @param position - Position to insert menu. If negative, counts from the
34
+ * end, e.g. `insertMenu('My Menu', -1)` will insert the menu as the
35
+ * second-to-last one.
36
+ */
8
37
  insertMenu(menuName: string, position: number): void;
38
+ /**
39
+ * #action
40
+ * Add a menu item to a top-level menu, creating the menu if it does not
41
+ * exist.
42
+ *
43
+ * @param menuName - Name of the top-level menu to append to.
44
+ *
45
+ * @param menuItem - Menu item to append.
46
+ */
9
47
  appendToMenu(menuName: string, menuItem: MenuItem): void;
48
+ /**
49
+ * #action
50
+ * Insert a menu item into a top-level menu, creating the menu if it
51
+ * does not exist.
52
+ *
53
+ * @param menuName - Name of the top-level menu to insert into
54
+ *
55
+ * @param menuItem - Menu item to insert
56
+ *
57
+ * @param position - Position to insert menu item. If negative, counts
58
+ * from the end, e.g. `insertInMenu('My Menu', item, -1)` will insert the
59
+ * item as the second-to-last one.
60
+ */
10
61
  insertInMenu(menuName: string, menuItem: MenuItem, position: number): void;
62
+ /**
63
+ * #action
64
+ * Add a menu item to a sub-menu, creating any part of the path that
65
+ * does not exist.
66
+ *
67
+ * @param menuPath - Path to the sub-menu to add to, starting with the
68
+ * top-level menu (e.g. `['File', 'Insert']`).
69
+ *
70
+ * @param menuItem - Menu item to append.
71
+ */
11
72
  appendToSubMenu(menuPath: string[], menuItem: MenuItem): void;
73
+ /**
74
+ * #action
75
+ * Insert a menu item into a sub-menu, creating any part of the path
76
+ * that does not exist.
77
+ *
78
+ * @param menuPath - Path to the sub-menu to add to, starting with the
79
+ * top-level menu (e.g. `['File', 'Insert']`).
80
+ *
81
+ * @param menuItem - Menu item to insert.
82
+ *
83
+ * @param position - Position to insert menu item. If negative, counts
84
+ * from the end, e.g. `insertInSubMenu(path, item, -1)` will insert the
85
+ * item as the second-to-last one.
86
+ */
12
87
  insertInSubMenu(menuPath: string[], menuItem: MenuItem, position: number): void;
13
88
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;