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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) 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 +1324 -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 +294 -0
  8. package/esm/Assemblies/AssembliesMixin.js +154 -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 +11 -0
  12. package/esm/HistoryManagement/index.js +43 -10
  13. package/esm/JBrowseConfig/RootConfiguration.d.ts +123 -78
  14. package/esm/JBrowseConfig/RootConfiguration.js +79 -7
  15. package/esm/JBrowseConfig/defaultShareUrl.d.ts +1 -0
  16. package/esm/JBrowseConfig/defaultShareUrl.js +5 -0
  17. package/esm/JBrowseConfig/index.d.ts +175 -84
  18. package/esm/JBrowseConfig/index.js +64 -2
  19. package/esm/JBrowseModel/index.d.ts +175 -97
  20. package/esm/JBrowseModel/index.js +132 -31
  21. package/esm/JbApi/index.d.ts +2 -0
  22. package/esm/JbApi/index.js +1 -0
  23. package/esm/JbApi/jbApi.d.ts +2767 -0
  24. package/esm/JbApi/jbApi.js +1383 -0
  25. package/esm/RootMenu/index.d.ts +69 -3
  26. package/esm/RootMenu/index.js +96 -61
  27. package/esm/SessionSpec/index.d.ts +6 -0
  28. package/esm/SessionSpec/index.js +3 -0
  29. package/esm/SessionSpec/lgvUrlInit.d.ts +79 -0
  30. package/esm/SessionSpec/lgvUrlInit.js +161 -0
  31. package/esm/SessionSpec/loadSessionSpec.d.ts +75 -0
  32. package/esm/SessionSpec/loadSessionSpec.js +473 -0
  33. package/esm/SessionSpec/parseSessionSpecUrl.d.ts +7 -0
  34. package/esm/SessionSpec/parseSessionSpecUrl.js +181 -0
  35. package/esm/SessionSpec/types.d.ts +37 -0
  36. package/esm/SessionSpec/types.js +1 -0
  37. package/esm/WorkspaceLayout/LayoutRenderer.d.ts +24 -0
  38. package/esm/WorkspaceLayout/LayoutRenderer.js +185 -0
  39. package/esm/WorkspaceLayout/PanelView.d.ts +13 -0
  40. package/esm/WorkspaceLayout/PanelView.js +99 -0
  41. package/esm/WorkspaceLayout/TabStrip.d.ts +14 -0
  42. package/esm/WorkspaceLayout/TabStrip.js +226 -0
  43. package/esm/WorkspaceLayout/WorkspaceContainer.d.ts +16 -0
  44. package/esm/WorkspaceLayout/WorkspaceContainer.js +107 -0
  45. package/esm/WorkspaceLayout/WorkspacePanelActions.d.ts +24 -0
  46. package/esm/WorkspaceLayout/WorkspacePanelActions.js +120 -0
  47. package/esm/WorkspaceLayout/WorkspaceTab.d.ts +27 -0
  48. package/esm/WorkspaceLayout/WorkspaceTab.js +105 -0
  49. package/esm/WorkspaceLayout/dockviewTheme.d.ts +69 -0
  50. package/esm/WorkspaceLayout/dockviewTheme.js +82 -0
  51. package/esm/WorkspaceLayout/dropZone.d.ts +105 -0
  52. package/esm/WorkspaceLayout/dropZone.js +113 -0
  53. package/esm/WorkspaceLayout/index.d.ts +8 -0
  54. package/esm/WorkspaceLayout/index.js +4 -0
  55. package/esm/WorkspaceLayout/model.d.ts +260 -0
  56. package/esm/WorkspaceLayout/model.js +586 -0
  57. package/esm/WorkspaceLayout/panelChrome.d.ts +19 -0
  58. package/esm/WorkspaceLayout/panelChrome.js +4 -0
  59. package/esm/WorkspaceLayout/spec.d.ts +88 -0
  60. package/esm/WorkspaceLayout/spec.js +226 -0
  61. package/esm/WorkspaceLayout/splitter.d.ts +25 -0
  62. package/esm/WorkspaceLayout/splitter.js +37 -0
  63. package/esm/WorkspaceLayout/tree.d.ts +158 -0
  64. package/esm/WorkspaceLayout/tree.js +379 -0
  65. package/esm/WorkspaceLayout/useLayoutDrag.d.ts +34 -0
  66. package/esm/WorkspaceLayout/useLayoutDrag.js +232 -0
  67. package/esm/index.d.ts +18 -9
  68. package/esm/index.js +16 -9
  69. package/esm/menus.d.ts +55 -68
  70. package/esm/menus.js +117 -86
  71. package/esm/queryParams.d.ts +9 -0
  72. package/esm/queryParams.js +93 -0
  73. package/esm/sessionModelFactory.d.ts +18 -0
  74. package/esm/sessionModelFactory.js +1 -0
  75. package/esm/ui/App/App.d.ts +3 -14
  76. package/esm/ui/App/App.js +39 -19
  77. package/esm/ui/App/AppFab.d.ts +12 -3
  78. package/esm/ui/App/AppFab.js +15 -8
  79. package/esm/ui/App/AppToolbar.d.ts +2 -14
  80. package/esm/ui/App/AppToolbar.js +45 -31
  81. package/esm/ui/App/ClassicViewsContainer.d.ts +4 -10
  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/DrawerHeader.d.ts +2 -3
  88. package/esm/ui/App/DrawerHeader.js +24 -11
  89. package/esm/ui/App/DrawerHeaderHelpButton.d.ts +1 -1
  90. package/esm/ui/App/DrawerHeaderHelpButton.js +3 -3
  91. package/esm/ui/App/DrawerHeaderHelpDialog.d.ts +2 -2
  92. package/esm/ui/App/DrawerHeaderHelpDialog.js +3 -4
  93. package/esm/ui/App/DrawerWidget.d.ts +1 -1
  94. package/esm/ui/App/DrawerWidget.js +9 -21
  95. package/esm/ui/App/JBrowseTabMenu.d.ts +2 -3
  96. package/esm/ui/App/JBrowseTabMenu.js +24 -5
  97. package/esm/ui/App/ThemeModeButton.d.ts +12 -0
  98. package/esm/ui/App/ThemeModeButton.js +34 -0
  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 +128 -24
  103. package/esm/ui/App/ViewContainerTitle.d.ts +1 -1
  104. package/esm/ui/App/ViewContainerTitle.js +21 -11
  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 +48 -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 +4 -11
  118. package/esm/ui/App/ViewsContainer.js +6 -9
  119. package/esm/ui/App/index.d.ts +2 -1
  120. package/esm/ui/App/index.js +3 -2
  121. package/esm/ui/App/lazyChunk.d.ts +13 -0
  122. package/esm/ui/App/lazyChunk.js +91 -0
  123. package/esm/ui/App/lazyParts.d.ts +32 -0
  124. package/esm/ui/App/lazyParts.js +8 -0
  125. package/esm/ui/App/preloadAppShell.d.ts +14 -0
  126. package/esm/ui/App/preloadAppShell.js +41 -0
  127. package/esm/ui/App/types.d.ts +17 -3
  128. package/esm/ui/App/types.js +1 -1
  129. package/esm/ui/App/useViewVisibility.d.ts +35 -0
  130. package/esm/ui/App/useViewVisibility.js +88 -0
  131. package/esm/ui/App/viewTitle.d.ts +12 -0
  132. package/esm/ui/App/viewTitle.js +17 -0
  133. package/esm/ui/index.d.ts +1 -1
  134. package/esm/ui/index.js +1 -1
  135. package/package.json +12 -17
  136. package/esm/AppFocus/index.d.ts +0 -5
  137. package/esm/AppFocus/index.js +0 -12
  138. package/esm/Assemblies/SessionAssembliesMixin.d.ts +0 -92
  139. package/esm/Assemblies/SessionAssembliesMixin.js +0 -53
  140. package/esm/Assemblies/TemporaryAssembliesMixin.d.ts +0 -10
  141. package/esm/Assemblies/TemporaryAssembliesMixin.js +0 -37
  142. package/esm/DockviewLayout/index.d.ts +0 -35
  143. package/esm/DockviewLayout/index.js +0 -111
  144. package/esm/ui/App/DockviewContext.d.ts +0 -22
  145. package/esm/ui/App/DockviewContext.js +0 -29
  146. package/esm/ui/App/DockviewLeftHeaderActions.d.ts +0 -2
  147. package/esm/ui/App/DockviewLeftHeaderActions.js +0 -58
  148. package/esm/ui/App/DockviewRightHeaderActions.d.ts +0 -2
  149. package/esm/ui/App/DockviewRightHeaderActions.js +0 -100
  150. package/esm/ui/App/DrawerControls.d.ts +0 -5
  151. package/esm/ui/App/DrawerControls.js +0 -25
  152. package/esm/ui/App/DrawerWidgetSelector.d.ts +0 -5
  153. package/esm/ui/App/DrawerWidgetSelector.js +0 -47
  154. package/esm/ui/App/JBrowseViewPanel.d.ts +0 -8
  155. package/esm/ui/App/JBrowseViewPanel.js +0 -40
  156. package/esm/ui/App/JBrowseViewTab.d.ts +0 -8
  157. package/esm/ui/App/JBrowseViewTab.js +0 -97
  158. package/esm/ui/App/ModalWidget.d.ts +0 -6
  159. package/esm/ui/App/ModalWidget.js +0 -48
  160. package/esm/ui/App/TiledViewsContainer.d.ts +0 -6
  161. package/esm/ui/App/TiledViewsContainer.js +0 -366
  162. package/esm/ui/App/copyView.d.ts +0 -1
  163. package/esm/ui/App/copyView.js +0 -29
  164. package/esm/ui/App/dockviewUtils.d.ts +0 -46
  165. package/esm/ui/App/dockviewUtils.js +0 -55
@@ -0,0 +1,62 @@
1
+ import { getParent, types } from '@jbrowse/mobx-state-tree';
2
+ /**
3
+ * #stateModel AppSessionMixin
4
+ *
5
+ * Session getters shared by the "app" products (desktop + web) that simply
6
+ * delegate to the root model — `version`, `history`, `menus`,
7
+ * `assemblyManager` — plus `renameCurrentSession`. Centralized here so the
8
+ * products compose one mixin instead of re-declaring (and diverging on) the
9
+ * same root delegations. The root must satisfy {@link AppRootModel}.
10
+ */
11
+ export function AppSessionMixin(_pluginManager) {
12
+ return types
13
+ .model({})
14
+ .views(self => ({
15
+ /**
16
+ * #getter
17
+ */
18
+ get root() {
19
+ return getParent(self);
20
+ },
21
+ }))
22
+ .views(self => ({
23
+ /**
24
+ * #getter
25
+ */
26
+ get version() {
27
+ return self.root.version;
28
+ },
29
+ /**
30
+ * #getter
31
+ */
32
+ get gitCommit() {
33
+ return self.root.gitCommit;
34
+ },
35
+ /**
36
+ * #getter
37
+ */
38
+ get history() {
39
+ return self.root.history;
40
+ },
41
+ /**
42
+ * #getter
43
+ */
44
+ get assemblyManager() {
45
+ return self.root.assemblyManager;
46
+ },
47
+ /**
48
+ * #method
49
+ */
50
+ menus() {
51
+ return self.root.menus();
52
+ },
53
+ }))
54
+ .actions(self => ({
55
+ /**
56
+ * #action
57
+ */
58
+ renameCurrentSession(sessionName) {
59
+ self.root.renameCurrentSession(sessionName);
60
+ },
61
+ }));
62
+ }
@@ -0,0 +1,2 @@
1
+ export { AppSessionMixin } from './AppSessionMixin.ts';
2
+ export type { AppRootModel } from './AppRootModel.ts';
@@ -0,0 +1 @@
1
+ export { AppSessionMixin } from './AppSessionMixin.js';
@@ -0,0 +1,294 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ import type { BaseAssemblyConfigModel, BaseAssemblyConfigSchema } from '@jbrowse/core/assemblyManager';
3
+ import type { AnyConfiguration } from '@jbrowse/core/configuration';
4
+ /**
5
+ * #stateModel AssembliesMixin
6
+ * #category root
7
+ *
8
+ * Adds `sessionAssemblies` (admin-aware, persisted-with-session assemblies) and
9
+ * `temporaryAssemblies` (used for ad-hoc read-vs-ref style assemblies).
10
+ */
11
+ export declare function AssembliesMixin(_pluginManager: PluginManager, assemblyConfigSchemasType: BaseAssemblyConfigSchema): import("@jbrowse/mobx-state-tree").IModelType<{
12
+ /**
13
+ * #property
14
+ */
15
+ sessionAssemblies: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
16
+ readonly aliases: {
17
+ type: "stringArray";
18
+ } & {
19
+ defaultValue: unknown;
20
+ };
21
+ readonly sequence: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
22
+ readonly refNameColors: {
23
+ type: "stringArray";
24
+ } & {
25
+ defaultValue: unknown;
26
+ };
27
+ readonly geneticCodes: {
28
+ type: "frozen";
29
+ } & {
30
+ defaultValue: unknown;
31
+ };
32
+ readonly geneticCodesLocation: {
33
+ type: "maybeFileLocation";
34
+ };
35
+ readonly refNameAliases: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
36
+ readonly adapter: import("@jbrowse/core/PluginManager").PluggableConfigSchemaType;
37
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
38
+ readonly cytobands: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
39
+ readonly adapter: import("@jbrowse/core/PluginManager").PluggableConfigSchemaType;
40
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
41
+ readonly displayName: {
42
+ type: "string";
43
+ } & {
44
+ defaultValue: string;
45
+ };
46
+ name: {
47
+ type: "string";
48
+ } & {
49
+ defaultValue: string;
50
+ };
51
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "name", undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>, [undefined]>;
52
+ /**
53
+ * #property
54
+ */
55
+ temporaryAssemblies: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
56
+ readonly aliases: {
57
+ type: "stringArray";
58
+ } & {
59
+ defaultValue: unknown;
60
+ };
61
+ readonly sequence: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
62
+ readonly refNameColors: {
63
+ type: "stringArray";
64
+ } & {
65
+ defaultValue: unknown;
66
+ };
67
+ readonly geneticCodes: {
68
+ type: "frozen";
69
+ } & {
70
+ defaultValue: unknown;
71
+ };
72
+ readonly geneticCodesLocation: {
73
+ type: "maybeFileLocation";
74
+ };
75
+ readonly refNameAliases: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
76
+ readonly adapter: import("@jbrowse/core/PluginManager").PluggableConfigSchemaType;
77
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
78
+ readonly cytobands: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
79
+ readonly adapter: import("@jbrowse/core/PluginManager").PluggableConfigSchemaType;
80
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
81
+ readonly displayName: {
82
+ type: "string";
83
+ } & {
84
+ defaultValue: string;
85
+ };
86
+ name: {
87
+ type: "string";
88
+ } & {
89
+ defaultValue: string;
90
+ };
91
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "name", undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>, [undefined]>;
92
+ }, {
93
+ /**
94
+ * #method
95
+ * The assembly config answering to `name`, as its name or one of its
96
+ * aliases, from any of the three arrays the assemblyManager draws on,
97
+ * or undefined.
98
+ *
99
+ * One namespace, because `name` is the assembly config's MST
100
+ * identifier: a second config carrying a name one of the others
101
+ * already has doesn't fail at the add, it makes every
102
+ * `assembly.configuration` safeReference in the manager ambiguous, and
103
+ * MST then throws on every read of one — inside the manager's own
104
+ * autorun and inside `assemblyNameMap`, which takes the session down.
105
+ * So each add path checks all three, not just the array it pushes to.
106
+ * Aliases count too: a new assembly named `GRCh38` beside an `hg38`
107
+ * aliased `GRCh38` would leave `get('GRCh38')` to array order.
108
+ */
109
+ findAssemblyConf(name: string): BaseAssemblyConfigModel | undefined;
110
+ } & {
111
+ /**
112
+ * #action
113
+ */
114
+ addSessionAssembly(conf: AnyConfiguration): (import("@jbrowse/core/configuration").ConfigNodeProps<{
115
+ readonly aliases: {
116
+ type: "stringArray";
117
+ } & {
118
+ defaultValue: unknown;
119
+ };
120
+ readonly sequence: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
121
+ readonly refNameColors: {
122
+ type: "stringArray";
123
+ } & {
124
+ defaultValue: unknown;
125
+ };
126
+ readonly geneticCodes: {
127
+ type: "frozen";
128
+ } & {
129
+ defaultValue: unknown;
130
+ };
131
+ readonly geneticCodesLocation: {
132
+ type: "maybeFileLocation";
133
+ };
134
+ readonly refNameAliases: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
135
+ readonly adapter: import("@jbrowse/core/PluginManager").PluggableConfigSchemaType;
136
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
137
+ readonly cytobands: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
138
+ readonly adapter: import("@jbrowse/core/PluginManager").PluggableConfigSchemaType;
139
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
140
+ readonly displayName: {
141
+ type: "string";
142
+ } & {
143
+ defaultValue: string;
144
+ };
145
+ name: {
146
+ type: "string";
147
+ } & {
148
+ defaultValue: string;
149
+ };
150
+ }> & import("@jbrowse/core/configuration").ConfigNodeActions & import("@jbrowse/core/configuration").ConfigNodeBrand<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
151
+ readonly aliases: {
152
+ type: "stringArray";
153
+ } & {
154
+ defaultValue: unknown;
155
+ };
156
+ readonly sequence: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
157
+ readonly refNameColors: {
158
+ type: "stringArray";
159
+ } & {
160
+ defaultValue: unknown;
161
+ };
162
+ readonly geneticCodes: {
163
+ type: "frozen";
164
+ } & {
165
+ defaultValue: unknown;
166
+ };
167
+ readonly geneticCodesLocation: {
168
+ type: "maybeFileLocation";
169
+ };
170
+ readonly refNameAliases: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
171
+ readonly adapter: import("@jbrowse/core/PluginManager").PluggableConfigSchemaType;
172
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
173
+ readonly cytobands: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
174
+ readonly adapter: import("@jbrowse/core/PluginManager").PluggableConfigSchemaType;
175
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
176
+ readonly displayName: {
177
+ type: "string";
178
+ } & {
179
+ defaultValue: string;
180
+ };
181
+ name: {
182
+ type: "string";
183
+ } & {
184
+ defaultValue: string;
185
+ };
186
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "name", undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>) | undefined;
187
+ /**
188
+ * #action
189
+ */
190
+ addAssembly(conf: AnyConfiguration): void;
191
+ /**
192
+ * #action
193
+ */
194
+ removeAssembly(name: string): void;
195
+ /**
196
+ * #action
197
+ */
198
+ removeSessionAssembly(assemblyName: string): void;
199
+ /**
200
+ * #action
201
+ * used for read vs ref type assemblies.
202
+ */
203
+ addTemporaryAssembly(conf: AnyConfiguration): (import("@jbrowse/core/configuration").ConfigNodeProps<{
204
+ readonly aliases: {
205
+ type: "stringArray";
206
+ } & {
207
+ defaultValue: unknown;
208
+ };
209
+ readonly sequence: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
210
+ readonly refNameColors: {
211
+ type: "stringArray";
212
+ } & {
213
+ defaultValue: unknown;
214
+ };
215
+ readonly geneticCodes: {
216
+ type: "frozen";
217
+ } & {
218
+ defaultValue: unknown;
219
+ };
220
+ readonly geneticCodesLocation: {
221
+ type: "maybeFileLocation";
222
+ };
223
+ readonly refNameAliases: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
224
+ readonly adapter: import("@jbrowse/core/PluginManager").PluggableConfigSchemaType;
225
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
226
+ readonly cytobands: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
227
+ readonly adapter: import("@jbrowse/core/PluginManager").PluggableConfigSchemaType;
228
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
229
+ readonly displayName: {
230
+ type: "string";
231
+ } & {
232
+ defaultValue: string;
233
+ };
234
+ name: {
235
+ type: "string";
236
+ } & {
237
+ defaultValue: string;
238
+ };
239
+ }> & import("@jbrowse/core/configuration").ConfigNodeActions & import("@jbrowse/core/configuration").ConfigNodeBrand<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
240
+ readonly aliases: {
241
+ type: "stringArray";
242
+ } & {
243
+ defaultValue: unknown;
244
+ };
245
+ readonly sequence: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
246
+ readonly refNameColors: {
247
+ type: "stringArray";
248
+ } & {
249
+ defaultValue: unknown;
250
+ };
251
+ readonly geneticCodes: {
252
+ type: "frozen";
253
+ } & {
254
+ defaultValue: unknown;
255
+ };
256
+ readonly geneticCodesLocation: {
257
+ type: "maybeFileLocation";
258
+ };
259
+ readonly refNameAliases: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
260
+ readonly adapter: import("@jbrowse/core/PluginManager").PluggableConfigSchemaType;
261
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
262
+ readonly cytobands: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
263
+ readonly adapter: import("@jbrowse/core/PluginManager").PluggableConfigSchemaType;
264
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
265
+ readonly displayName: {
266
+ type: "string";
267
+ } & {
268
+ defaultValue: string;
269
+ };
270
+ name: {
271
+ type: "string";
272
+ } & {
273
+ defaultValue: string;
274
+ };
275
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "name", undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>) | undefined;
276
+ /**
277
+ * #action
278
+ */
279
+ removeTemporaryAssembly(name: string): void;
280
+ } & {
281
+ /**
282
+ * #getter
283
+ * sessionAssemblies plus jbrowse config assemblies. Does not include
284
+ * temporaryAssemblies; this is the list shown in the AssemblySelector
285
+ * dropdown.
286
+ */
287
+ readonly assemblies: BaseAssemblyConfigModel[];
288
+ } & {
289
+ /**
290
+ * #getter
291
+ * names of the assemblies returned by the `assemblies` getter
292
+ */
293
+ readonly assemblyNames: string[];
294
+ }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
@@ -0,0 +1,154 @@
1
+ import { readConfObject } from '@jbrowse/core/configuration';
2
+ import { types } from '@jbrowse/mobx-state-tree';
3
+ import { asSession } from '@jbrowse/product-core';
4
+ /**
5
+ * #stateModel AssembliesMixin
6
+ * #category root
7
+ *
8
+ * Adds `sessionAssemblies` (admin-aware, persisted-with-session assemblies) and
9
+ * `temporaryAssemblies` (used for ad-hoc read-vs-ref style assemblies).
10
+ */
11
+ export function AssembliesMixin(_pluginManager, assemblyConfigSchemasType) {
12
+ return types
13
+ .model({
14
+ /**
15
+ * #property
16
+ */
17
+ sessionAssemblies: types.stripDefault(types.array(assemblyConfigSchemasType), []),
18
+ /**
19
+ * #property
20
+ */
21
+ temporaryAssemblies: types.stripDefault(types.array(assemblyConfigSchemasType), []),
22
+ })
23
+ .views(s => {
24
+ const self = asSession(s);
25
+ return {
26
+ /**
27
+ * #method
28
+ * The assembly config answering to `name`, as its name or one of its
29
+ * aliases, from any of the three arrays the assemblyManager draws on,
30
+ * or undefined.
31
+ *
32
+ * One namespace, because `name` is the assembly config's MST
33
+ * identifier: a second config carrying a name one of the others
34
+ * already has doesn't fail at the add, it makes every
35
+ * `assembly.configuration` safeReference in the manager ambiguous, and
36
+ * MST then throws on every read of one — inside the manager's own
37
+ * autorun and inside `assemblyNameMap`, which takes the session down.
38
+ * So each add path checks all three, not just the array it pushes to.
39
+ * Aliases count too: a new assembly named `GRCh38` beside an `hg38`
40
+ * aliased `GRCh38` would leave `get('GRCh38')` to array order.
41
+ */
42
+ findAssemblyConf(name) {
43
+ const confs = [
44
+ ...self.jbrowse.assemblies,
45
+ ...self.sessionAssemblies,
46
+ ...self.temporaryAssemblies,
47
+ ];
48
+ return (confs.find(f => f.name === name) ??
49
+ confs.find(f => f.aliases.includes(name)));
50
+ },
51
+ };
52
+ })
53
+ .actions(s => {
54
+ const self = asSession(s);
55
+ return {
56
+ /**
57
+ * #action
58
+ */
59
+ addSessionAssembly(conf) {
60
+ const asm = self.findAssemblyConf(conf.name);
61
+ if (asm) {
62
+ console.warn(`Assembly ${conf.name} already exists`);
63
+ return asm;
64
+ }
65
+ const length = self.sessionAssemblies.push(conf);
66
+ return self.sessionAssemblies[length - 1];
67
+ },
68
+ /**
69
+ * #action
70
+ */
71
+ addAssembly(conf) {
72
+ // checked here rather than left to jbrowse.addAssemblyConf, which
73
+ // sees only its own array: in admin mode the name still has to clear
74
+ // the session-scoped arrays as well
75
+ const asm = self.findAssemblyConf(conf.name);
76
+ if (asm) {
77
+ console.warn(`Assembly ${conf.name} already exists`);
78
+ return;
79
+ }
80
+ if (self.adminMode) {
81
+ self.jbrowse.addAssemblyConf(conf);
82
+ }
83
+ else {
84
+ this.addSessionAssembly(conf);
85
+ }
86
+ },
87
+ /**
88
+ * #action
89
+ */
90
+ removeAssembly(name) {
91
+ if (self.sessionAssemblies.some(a => a.name === name)) {
92
+ this.removeSessionAssembly(name);
93
+ }
94
+ else if (self.adminMode) {
95
+ self.jbrowse.removeAssemblyConf(name);
96
+ }
97
+ },
98
+ /**
99
+ * #action
100
+ */
101
+ removeSessionAssembly(assemblyName) {
102
+ const elt = self.sessionAssemblies.find(a => a.name === assemblyName);
103
+ if (elt) {
104
+ self.sessionAssemblies.remove(elt);
105
+ }
106
+ },
107
+ /**
108
+ * #action
109
+ * used for read vs ref type assemblies.
110
+ */
111
+ addTemporaryAssembly(conf) {
112
+ const asm = self.findAssemblyConf(conf.name);
113
+ if (asm) {
114
+ console.warn(`Assembly ${conf.name} already exists`);
115
+ return asm;
116
+ }
117
+ const length = self.temporaryAssemblies.push(conf);
118
+ return self.temporaryAssemblies[length - 1];
119
+ },
120
+ /**
121
+ * #action
122
+ */
123
+ removeTemporaryAssembly(name) {
124
+ const elt = self.temporaryAssemblies.find(a => a.name === name);
125
+ if (elt) {
126
+ self.temporaryAssemblies.remove(elt);
127
+ }
128
+ },
129
+ };
130
+ })
131
+ .views(s => {
132
+ const self = asSession(s);
133
+ return {
134
+ /**
135
+ * #getter
136
+ * sessionAssemblies plus jbrowse config assemblies. Does not include
137
+ * temporaryAssemblies; this is the list shown in the AssemblySelector
138
+ * dropdown.
139
+ */
140
+ get assemblies() {
141
+ return [...self.jbrowse.assemblies, ...self.sessionAssemblies];
142
+ },
143
+ };
144
+ })
145
+ .views(self => ({
146
+ /**
147
+ * #getter
148
+ * names of the assemblies returned by the `assemblies` getter
149
+ */
150
+ get assemblyNames() {
151
+ return self.assemblies.map(a => readConfObject(a, 'name'));
152
+ },
153
+ }));
154
+ }
@@ -1,2 +1 @@
1
- export * from './SessionAssembliesMixin.ts';
2
- export * from './TemporaryAssembliesMixin.ts';
1
+ export { AssembliesMixin } from './AssembliesMixin.ts';
@@ -1,2 +1 @@
1
- export * from "./SessionAssembliesMixin.js";
2
- export * from "./TemporaryAssembliesMixin.js";
1
+ export { AssembliesMixin } from './AssembliesMixin.js';
@@ -1,4 +1,14 @@
1
+ type ShortcutKeys = Pick<KeyboardEvent, 'key' | 'code' | 'ctrlKey' | 'metaKey' | 'shiftKey'>;
2
+ export declare function historyShortcut(e: ShortcutKeys): "redo" | "undo" | undefined;
3
+ /**
4
+ * #stateModel HistoryManagementMixin
5
+ * #category root
6
+ */
1
7
  export declare function HistoryManagementMixin(): import("@jbrowse/mobx-state-tree").IModelType<{
8
+ /**
9
+ * #property
10
+ * used for undo/redo
11
+ */
2
12
  history: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IModelType<{
3
13
  undoIdx: import("@jbrowse/mobx-state-tree").IType<number | undefined, number, number>;
4
14
  targetPath: import("@jbrowse/mobx-state-tree").IType<string | undefined, string, string>;
@@ -21,3 +31,4 @@ export declare function HistoryManagementMixin(): import("@jbrowse/mobx-state-tr
21
31
  afterCreate(): void;
22
32
  beforeDestroy(): void;
23
33
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
34
+ export {};
@@ -1,24 +1,53 @@
1
1
  import TimeTraveller from '@jbrowse/core/util/TimeTraveller';
2
+ import { isTextEntryFocused } from '@jbrowse/core/util/isTextEntryFocused';
2
3
  import { addDisposer, types } from '@jbrowse/mobx-state-tree';
4
+ import { asRoot } from '@jbrowse/product-core';
3
5
  import { autorun } from 'mobx';
6
+ // `key` follows the layout, so undo is wherever the user's Z is (QWERTZ reports
7
+ // it as `code: 'KeyY'`, AZERTY as `KeyW`); a non-Latin layout has no letter
8
+ // there, and the physical key stands in
9
+ function shortcutLetter(e) {
10
+ const key = e.key.toLowerCase();
11
+ return /^[a-z]$/.test(key) ? key : e.code.replace(/^Key/, '').toLowerCase();
12
+ }
13
+ // modifiers first: a synthetic keydown (autofill, an extension) is a bare Event
14
+ // with no `key` to read
15
+ export function historyShortcut(e) {
16
+ if (!e.ctrlKey && !e.metaKey) {
17
+ return undefined;
18
+ }
19
+ const letter = shortcutLetter(e);
20
+ if (letter === 'z') {
21
+ return e.shiftKey ? 'redo' : 'undo';
22
+ }
23
+ if (e.ctrlKey && !e.shiftKey && letter === 'y') {
24
+ return 'redo';
25
+ }
26
+ return undefined;
27
+ }
28
+ /**
29
+ * #stateModel HistoryManagementMixin
30
+ * #category root
31
+ */
4
32
  export function HistoryManagementMixin() {
5
33
  return types
6
34
  .model({
35
+ /**
36
+ * #property
37
+ * used for undo/redo
38
+ */
7
39
  history: types.optional(TimeTraveller, { targetPath: '../session' }),
8
40
  })
9
41
  .actions(self => {
10
42
  const keydownListener = (e) => {
11
- if (self.history.canRedo &&
12
- (((e.ctrlKey || e.metaKey) && e.shiftKey && e.code === 'KeyZ') ||
13
- (e.ctrlKey && !e.shiftKey && e.code === 'KeyY')) &&
14
- document.activeElement?.tagName.toUpperCase() !== 'INPUT') {
43
+ if (isTextEntryFocused()) {
44
+ return;
45
+ }
46
+ const shortcut = historyShortcut(e);
47
+ if (shortcut === 'redo' && self.history.canRedo) {
15
48
  self.history.redo();
16
49
  }
17
- if (self.history.canUndo &&
18
- (e.ctrlKey || e.metaKey) &&
19
- !e.shiftKey &&
20
- e.code === 'KeyZ' &&
21
- document.activeElement?.tagName.toUpperCase() !== 'INPUT') {
50
+ else if (shortcut === 'undo' && self.history.canUndo) {
22
51
  self.history.undo();
23
52
  }
24
53
  };
@@ -26,8 +55,12 @@ export function HistoryManagementMixin() {
26
55
  afterCreate() {
27
56
  document.addEventListener('keydown', keydownListener);
28
57
  addDisposer(self, autorun(function historyInitAutorun() {
29
- const { session } = self;
58
+ const { session } = asRoot(self);
30
59
  if (session) {
60
+ // we use a specific initialization routine after session is
61
+ // created to get it to start tracking itself sort of related
62
+ // issue here
63
+ // https://github.com/mobxjs/mobx-state-tree/issues/1089#issuecomment-441207911
31
64
  self.history.initialize();
32
65
  }
33
66
  }, { name: 'HistoryInit' }));