@jbrowse/plugin-data-management 2.8.0 → 2.10.0
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.
- package/dist/AddTrackWidget/components/DefaultAddTrackWorkflow.js +4 -8
- package/dist/AddTrackWidget/model.d.ts +81 -0
- package/dist/AddTrackWidget/model.js +81 -0
- package/dist/HierarchicalTrackSelectorWidget/components/ShoppingCart.d.ts +1 -1
- package/dist/HierarchicalTrackSelectorWidget/components/ShoppingCart.js +11 -53
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/FacetFilter.d.ts +5 -7
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/FacetFilter.js +12 -11
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/FacetFilters.d.ts +5 -7
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/FacetFilters.js +11 -8
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/FacetedHeader.d.ts +1 -11
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/FacetedHeader.js +9 -7
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/FacetedSelector.js +40 -135
- package/dist/HierarchicalTrackSelectorWidget/components/tree/DropdownTrackSelector.d.ts +12 -0
- package/dist/HierarchicalTrackSelectorWidget/components/tree/DropdownTrackSelector.js +59 -0
- package/dist/HierarchicalTrackSelectorWidget/components/tree/FavoriteTracks.d.ts +6 -0
- package/dist/HierarchicalTrackSelectorWidget/components/tree/FavoriteTracks.js +45 -0
- package/dist/HierarchicalTrackSelectorWidget/components/tree/HamburgerMenu.js +71 -46
- package/dist/HierarchicalTrackSelectorWidget/components/tree/HierarchicalHeader.js +5 -34
- package/dist/HierarchicalTrackSelectorWidget/components/tree/HierarchicalTree.js +8 -3
- package/dist/HierarchicalTrackSelectorWidget/components/tree/RecentlyUsedTracks.d.ts +6 -0
- package/dist/HierarchicalTrackSelectorWidget/components/tree/RecentlyUsedTracks.js +42 -0
- package/dist/HierarchicalTrackSelectorWidget/components/tree/TrackCategory.js +7 -6
- package/dist/HierarchicalTrackSelectorWidget/components/tree/TrackLabel.js +9 -28
- package/dist/HierarchicalTrackSelectorWidget/components/tree/TrackLabelMenu.d.ts +12 -0
- package/dist/HierarchicalTrackSelectorWidget/components/tree/TrackLabelMenu.js +50 -0
- package/dist/HierarchicalTrackSelectorWidget/components/util.d.ts +3 -0
- package/dist/HierarchicalTrackSelectorWidget/components/util.js +5 -1
- package/dist/HierarchicalTrackSelectorWidget/facetedModel.d.ts +128 -0
- package/dist/HierarchicalTrackSelectorWidget/facetedModel.js +206 -0
- package/dist/HierarchicalTrackSelectorWidget/facetedUtil.d.ts +2 -0
- package/dist/HierarchicalTrackSelectorWidget/{components/faceted/util.js → facetedUtil.js} +5 -1
- package/dist/HierarchicalTrackSelectorWidget/generateHierarchy.d.ts +17 -5
- package/dist/HierarchicalTrackSelectorWidget/generateHierarchy.js +27 -21
- package/dist/HierarchicalTrackSelectorWidget/model.d.ts +193 -15
- package/dist/HierarchicalTrackSelectorWidget/model.js +209 -22
- package/dist/ucsc-trackhub/doConnect.d.ts +1 -0
- package/dist/ucsc-trackhub/doConnect.js +131 -0
- package/dist/ucsc-trackhub/model.d.ts +19 -2
- package/dist/ucsc-trackhub/model.js +16 -71
- package/dist/ucsc-trackhub/ucscTrackHub.d.ts +161 -4
- package/dist/ucsc-trackhub/ucscTrackHub.js +49 -166
- package/esm/AddTrackWidget/components/DefaultAddTrackWorkflow.js +4 -8
- package/esm/AddTrackWidget/model.d.ts +81 -0
- package/esm/AddTrackWidget/model.js +81 -0
- package/esm/HierarchicalTrackSelectorWidget/components/ShoppingCart.d.ts +1 -1
- package/esm/HierarchicalTrackSelectorWidget/components/ShoppingCart.js +12 -31
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetFilter.d.ts +5 -7
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetFilter.js +13 -11
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetFilters.d.ts +5 -7
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetFilters.js +12 -8
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetedHeader.d.ts +1 -11
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetedHeader.js +9 -7
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetedSelector.js +41 -113
- package/esm/HierarchicalTrackSelectorWidget/components/tree/DropdownTrackSelector.d.ts +12 -0
- package/esm/HierarchicalTrackSelectorWidget/components/tree/DropdownTrackSelector.js +31 -0
- package/esm/HierarchicalTrackSelectorWidget/components/tree/FavoriteTracks.d.ts +6 -0
- package/esm/HierarchicalTrackSelectorWidget/components/tree/FavoriteTracks.js +40 -0
- package/esm/HierarchicalTrackSelectorWidget/components/tree/HamburgerMenu.js +71 -46
- package/esm/HierarchicalTrackSelectorWidget/components/tree/HierarchicalHeader.js +6 -12
- package/esm/HierarchicalTrackSelectorWidget/components/tree/HierarchicalTree.js +8 -3
- package/esm/HierarchicalTrackSelectorWidget/components/tree/RecentlyUsedTracks.d.ts +6 -0
- package/esm/HierarchicalTrackSelectorWidget/components/tree/RecentlyUsedTracks.js +37 -0
- package/esm/HierarchicalTrackSelectorWidget/components/tree/TrackCategory.js +7 -6
- package/esm/HierarchicalTrackSelectorWidget/components/tree/TrackLabel.js +8 -27
- package/esm/HierarchicalTrackSelectorWidget/components/tree/TrackLabelMenu.d.ts +12 -0
- package/esm/HierarchicalTrackSelectorWidget/components/tree/TrackLabelMenu.js +45 -0
- package/esm/HierarchicalTrackSelectorWidget/components/util.d.ts +3 -0
- package/esm/HierarchicalTrackSelectorWidget/components/util.js +5 -1
- package/esm/HierarchicalTrackSelectorWidget/facetedModel.d.ts +128 -0
- package/esm/HierarchicalTrackSelectorWidget/facetedModel.js +202 -0
- package/esm/HierarchicalTrackSelectorWidget/facetedUtil.d.ts +2 -0
- package/esm/HierarchicalTrackSelectorWidget/{components/faceted/util.js → facetedUtil.js} +3 -0
- package/esm/HierarchicalTrackSelectorWidget/generateHierarchy.d.ts +17 -5
- package/esm/HierarchicalTrackSelectorWidget/generateHierarchy.js +27 -21
- package/esm/HierarchicalTrackSelectorWidget/model.d.ts +193 -15
- package/esm/HierarchicalTrackSelectorWidget/model.js +211 -24
- package/esm/ucsc-trackhub/doConnect.d.ts +1 -0
- package/esm/ucsc-trackhub/doConnect.js +127 -0
- package/esm/ucsc-trackhub/model.d.ts +19 -2
- package/esm/ucsc-trackhub/model.js +17 -72
- package/esm/ucsc-trackhub/ucscTrackHub.d.ts +161 -4
- package/esm/ucsc-trackhub/ucscTrackHub.js +48 -141
- package/package.json +3 -4
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/util.d.ts +0 -1
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/util.d.ts +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Instance } from 'mobx-state-tree';
|
|
2
2
|
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
3
|
import PluginManager from '@jbrowse/core/PluginManager';
|
|
4
|
-
|
|
4
|
+
type MaybeAnyConfigurationModel = AnyConfigurationModel | undefined;
|
|
5
5
|
/**
|
|
6
6
|
* #stateModel HierarchicalTrackSelectorWidget
|
|
7
7
|
*/
|
|
@@ -34,13 +34,103 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
34
34
|
* #property
|
|
35
35
|
*/
|
|
36
36
|
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
37
|
+
/**
|
|
38
|
+
* #property
|
|
39
|
+
*/
|
|
40
|
+
faceted: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IModelType<{
|
|
41
|
+
filterText: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
42
|
+
showSparse: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
43
|
+
showFilters: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
44
|
+
showOptions: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
45
|
+
panelWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>; /**
|
|
46
|
+
* #property
|
|
47
|
+
*/
|
|
48
|
+
}, {
|
|
49
|
+
visible: Record<string, boolean>;
|
|
50
|
+
widths: Record<string, number | undefined>;
|
|
51
|
+
useShoppingCart: boolean;
|
|
52
|
+
filters: import("mobx").ObservableMap<string, string[]>;
|
|
53
|
+
} & {
|
|
54
|
+
setFilter(key: string, value: string[]): void;
|
|
55
|
+
setPanelWidth(width: number): void;
|
|
56
|
+
setUseShoppingCart(f: boolean): void;
|
|
57
|
+
setFilterText(str: string): void;
|
|
58
|
+
setShowSparse(f: boolean): void;
|
|
59
|
+
setShowOptions(f: boolean): void; /**
|
|
60
|
+
* #getter
|
|
61
|
+
*/
|
|
62
|
+
setShowFilters(f: boolean): void;
|
|
63
|
+
} & {
|
|
64
|
+
readonly allTrackConfigurations: ({
|
|
65
|
+
[x: string]: any;
|
|
66
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
67
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
68
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[];
|
|
69
|
+
} & {
|
|
70
|
+
readonly rows: {
|
|
71
|
+
readonly id: string;
|
|
72
|
+
readonly conf: {
|
|
73
|
+
[x: string]: any;
|
|
74
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
75
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
76
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>;
|
|
77
|
+
readonly name: string;
|
|
78
|
+
readonly category: string;
|
|
79
|
+
readonly adapter: string;
|
|
80
|
+
readonly description: string;
|
|
81
|
+
readonly metadata: any;
|
|
82
|
+
}[];
|
|
83
|
+
} & {
|
|
84
|
+
readonly filteredNonMetadataKeys: string[] | readonly ["category", "adapter", "description"];
|
|
85
|
+
readonly metadataKeys: string[];
|
|
86
|
+
readonly filteredMetadataKeys: string[];
|
|
87
|
+
readonly fields: string[];
|
|
88
|
+
readonly filteredRows: {
|
|
89
|
+
readonly id: string;
|
|
90
|
+
readonly conf: {
|
|
91
|
+
[x: string]: any;
|
|
92
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
93
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
94
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>;
|
|
95
|
+
readonly name: string;
|
|
96
|
+
readonly category: string;
|
|
97
|
+
readonly adapter: string;
|
|
98
|
+
readonly description: string;
|
|
99
|
+
readonly metadata: any;
|
|
100
|
+
}[];
|
|
101
|
+
} & {
|
|
102
|
+
setVisible(args: Record<string, boolean>): void;
|
|
103
|
+
setWidths(args: Record<string, number | undefined>): void;
|
|
104
|
+
afterAttach(): void;
|
|
105
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
37
106
|
}, {
|
|
107
|
+
favorites: string[];
|
|
108
|
+
recentlyUsed: string[];
|
|
38
109
|
selection: ({
|
|
39
110
|
[x: string]: any;
|
|
40
111
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
41
112
|
setSubschema(slotName: string, data: unknown): any;
|
|
42
113
|
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[];
|
|
43
114
|
filterText: string;
|
|
115
|
+
recentlyUsedCounter: number;
|
|
116
|
+
favoritesCounter: number;
|
|
117
|
+
} & {
|
|
118
|
+
/**
|
|
119
|
+
* #getter
|
|
120
|
+
*/
|
|
121
|
+
readonly selectionSet: Set<{
|
|
122
|
+
[x: string]: any;
|
|
123
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
124
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
125
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>>;
|
|
126
|
+
/**
|
|
127
|
+
* #getter
|
|
128
|
+
*/
|
|
129
|
+
readonly favoritesSet: Set<string>;
|
|
130
|
+
/**
|
|
131
|
+
* #getter
|
|
132
|
+
*/
|
|
133
|
+
readonly recentlyUsedSet: Set<string>;
|
|
44
134
|
} & {
|
|
45
135
|
/**
|
|
46
136
|
* #action
|
|
@@ -66,6 +156,42 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
66
156
|
* #action
|
|
67
157
|
*/
|
|
68
158
|
clearSelection(): void;
|
|
159
|
+
/**
|
|
160
|
+
* #action
|
|
161
|
+
*/
|
|
162
|
+
addToFavorites(trackId: string): void;
|
|
163
|
+
/**
|
|
164
|
+
* #action
|
|
165
|
+
*/
|
|
166
|
+
removeFromFavorites(trackId: string): void;
|
|
167
|
+
/**
|
|
168
|
+
* #action
|
|
169
|
+
*/
|
|
170
|
+
clearFavorites(): void;
|
|
171
|
+
/**
|
|
172
|
+
* #action
|
|
173
|
+
*/
|
|
174
|
+
setRecentlyUsedCounter(val: number): void;
|
|
175
|
+
/**
|
|
176
|
+
* #action
|
|
177
|
+
*/
|
|
178
|
+
setRecentlyUsed(str: string[]): void;
|
|
179
|
+
/**
|
|
180
|
+
* #action
|
|
181
|
+
*/
|
|
182
|
+
setFavorites(str: string[]): void;
|
|
183
|
+
/**
|
|
184
|
+
* #action
|
|
185
|
+
*/
|
|
186
|
+
setFavoritesCounter(val: number): void;
|
|
187
|
+
/**
|
|
188
|
+
* #action
|
|
189
|
+
*/
|
|
190
|
+
addToRecentlyUsed(id: string): void;
|
|
191
|
+
/**
|
|
192
|
+
* #action
|
|
193
|
+
*/
|
|
194
|
+
clearRecentlyUsed(): void;
|
|
69
195
|
/**
|
|
70
196
|
* #action
|
|
71
197
|
*/
|
|
@@ -94,13 +220,33 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
94
220
|
/**
|
|
95
221
|
* #method
|
|
96
222
|
*/
|
|
97
|
-
|
|
223
|
+
isSelected(track: AnyConfigurationModel): boolean;
|
|
224
|
+
/**
|
|
225
|
+
* #method
|
|
226
|
+
*/
|
|
227
|
+
isFavorite(trackId: string): boolean;
|
|
228
|
+
/**
|
|
229
|
+
* #method
|
|
230
|
+
*/
|
|
231
|
+
isRecentlyUsed(trackId: string): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* #method
|
|
234
|
+
*/
|
|
235
|
+
getRefSeqTrackConf(assemblyName: string): MaybeAnyConfigurationModel;
|
|
98
236
|
} & {
|
|
99
237
|
/**
|
|
100
238
|
* #getter
|
|
101
239
|
*/
|
|
102
240
|
readonly assemblyNames: string[];
|
|
103
241
|
} & {
|
|
242
|
+
/**
|
|
243
|
+
* #getter
|
|
244
|
+
*/
|
|
245
|
+
readonly recentlyUsedLocalStorageKey: string;
|
|
246
|
+
/**
|
|
247
|
+
* #getter
|
|
248
|
+
*/
|
|
249
|
+
readonly favoritesLocalStorageKey: string;
|
|
104
250
|
/**
|
|
105
251
|
* #getter
|
|
106
252
|
*/
|
|
@@ -110,34 +256,53 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
110
256
|
*/
|
|
111
257
|
readonly activeSortCategories: any;
|
|
112
258
|
/**
|
|
113
|
-
* #
|
|
114
|
-
* filter out tracks that don't match the current display types
|
|
259
|
+
* #getter
|
|
260
|
+
* filter out tracks that don't match the current assembly/display types
|
|
115
261
|
*/
|
|
116
|
-
|
|
117
|
-
tracks: AnyConfigurationModel[];
|
|
118
|
-
}): ({
|
|
262
|
+
readonly configAndSessionTrackConfigurations: ({
|
|
119
263
|
[x: string]: any;
|
|
120
264
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
121
265
|
setSubschema(slotName: string, data: unknown): any;
|
|
122
266
|
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[];
|
|
123
267
|
/**
|
|
124
268
|
* #getter
|
|
125
|
-
* filter out tracks that don't match the current assembly/display types
|
|
126
269
|
*/
|
|
127
|
-
readonly
|
|
270
|
+
readonly allTrackConfigurations: ({
|
|
128
271
|
[x: string]: any;
|
|
129
272
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
130
273
|
setSubschema(slotName: string, data: unknown): any;
|
|
131
274
|
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[];
|
|
275
|
+
/**
|
|
276
|
+
* #getter
|
|
277
|
+
*/
|
|
278
|
+
readonly allTrackConfigurationTrackIdSet: Map<any, {
|
|
279
|
+
[x: string]: any;
|
|
280
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
281
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
282
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>>;
|
|
132
283
|
} & {
|
|
133
284
|
/**
|
|
134
|
-
* #
|
|
285
|
+
* #getter
|
|
286
|
+
* filters out tracks that are not in the favorites group
|
|
135
287
|
*/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
288
|
+
readonly favoriteTracks: ({
|
|
289
|
+
[x: string]: any;
|
|
290
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
291
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
292
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[];
|
|
293
|
+
/**
|
|
294
|
+
* #getter
|
|
295
|
+
* filters out tracks that are not in the recently used group
|
|
296
|
+
*/
|
|
297
|
+
readonly recentlyUsedTracks: ({
|
|
298
|
+
[x: string]: any;
|
|
299
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
300
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
301
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[];
|
|
140
302
|
} & {
|
|
303
|
+
/**
|
|
304
|
+
* #getter
|
|
305
|
+
*/
|
|
141
306
|
readonly allTracks: {
|
|
142
307
|
group: any;
|
|
143
308
|
tracks: ({
|
|
@@ -145,6 +310,8 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
145
310
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
146
311
|
setSubschema(slotName: string, data: unknown): any;
|
|
147
312
|
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[];
|
|
313
|
+
noCategories: boolean;
|
|
314
|
+
menuItems: never[];
|
|
148
315
|
}[];
|
|
149
316
|
} & {
|
|
150
317
|
/**
|
|
@@ -153,10 +320,15 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
153
320
|
readonly hierarchy: {
|
|
154
321
|
name: string;
|
|
155
322
|
id: string;
|
|
323
|
+
isOpenByDefault: boolean;
|
|
324
|
+
type: "category";
|
|
156
325
|
children: {
|
|
157
326
|
name: any;
|
|
158
327
|
id: any;
|
|
159
|
-
|
|
328
|
+
type: "category";
|
|
329
|
+
isOpenByDefault: boolean;
|
|
330
|
+
menuItems: never[];
|
|
331
|
+
children: import("./generateHierarchy").TreeNode[];
|
|
160
332
|
}[];
|
|
161
333
|
};
|
|
162
334
|
} & {
|
|
@@ -171,7 +343,13 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
171
343
|
} & {
|
|
172
344
|
afterCreate(): void;
|
|
173
345
|
} & {
|
|
346
|
+
/**
|
|
347
|
+
* #getter
|
|
348
|
+
*/
|
|
174
349
|
readonly hasAnySubcategories: boolean;
|
|
350
|
+
} & {
|
|
351
|
+
afterAttach(): void;
|
|
175
352
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
176
353
|
export type HierarchicalTrackSelectorStateModel = ReturnType<typeof stateTreeFactory>;
|
|
177
354
|
export type HierarchicalTrackSelectorModel = Instance<HierarchicalTrackSelectorStateModel>;
|
|
355
|
+
export {};
|
|
@@ -1,11 +1,29 @@
|
|
|
1
|
-
import { types } from 'mobx-state-tree';
|
|
1
|
+
import { types, addDisposer } from 'mobx-state-tree';
|
|
2
|
+
import { autorun } from 'mobx';
|
|
2
3
|
import { getConf, readConfObject, } from '@jbrowse/core/configuration';
|
|
3
|
-
import { dedupe, getSession, notEmpty } from '@jbrowse/core/util';
|
|
4
|
+
import { dedupe, getSession, localStorageGetItem, localStorageSetItem, notEmpty, } from '@jbrowse/core/util';
|
|
4
5
|
import { ElementId } from '@jbrowse/core/util/types/mst';
|
|
5
6
|
// locals
|
|
6
7
|
import { filterTracks } from './filterTracks';
|
|
7
8
|
import { generateHierarchy } from './generateHierarchy';
|
|
8
9
|
import { findSubCategories, findTopLevelCategories } from './util';
|
|
10
|
+
import { facetedStateTreeF } from './facetedModel';
|
|
11
|
+
// for settings that are config dependent
|
|
12
|
+
function postNoConfigF() {
|
|
13
|
+
return typeof window !== undefined
|
|
14
|
+
? [window.location.host, window.location.pathname].join('-')
|
|
15
|
+
: 'empty';
|
|
16
|
+
}
|
|
17
|
+
// for settings that are not config dependent
|
|
18
|
+
function postF() {
|
|
19
|
+
return typeof window !== undefined
|
|
20
|
+
? [
|
|
21
|
+
postNoConfigF(),
|
|
22
|
+
new URLSearchParams(window.location.search).get('config'),
|
|
23
|
+
].join('-')
|
|
24
|
+
: 'empty';
|
|
25
|
+
}
|
|
26
|
+
const MAX_RECENTLY_USED = 10;
|
|
9
27
|
/**
|
|
10
28
|
* #stateModel HierarchicalTrackSelectorWidget
|
|
11
29
|
*/
|
|
@@ -40,10 +58,38 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
40
58
|
* #property
|
|
41
59
|
*/
|
|
42
60
|
view: types.safeReference(pluginManager.pluggableMstType('view', 'stateModel')),
|
|
61
|
+
/**
|
|
62
|
+
* #property
|
|
63
|
+
*/
|
|
64
|
+
faceted: types.optional(facetedStateTreeF(), {}),
|
|
43
65
|
})
|
|
44
66
|
.volatile(() => ({
|
|
67
|
+
favorites: [],
|
|
68
|
+
recentlyUsed: [],
|
|
45
69
|
selection: [],
|
|
46
70
|
filterText: '',
|
|
71
|
+
recentlyUsedCounter: 0,
|
|
72
|
+
favoritesCounter: 0,
|
|
73
|
+
}))
|
|
74
|
+
.views(self => ({
|
|
75
|
+
/**
|
|
76
|
+
* #getter
|
|
77
|
+
*/
|
|
78
|
+
get selectionSet() {
|
|
79
|
+
return new Set(self.selection);
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* #getter
|
|
83
|
+
*/
|
|
84
|
+
get favoritesSet() {
|
|
85
|
+
return new Set(self.favorites);
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* #getter
|
|
89
|
+
*/
|
|
90
|
+
get recentlyUsedSet() {
|
|
91
|
+
return new Set(self.recentlyUsed);
|
|
92
|
+
},
|
|
47
93
|
}))
|
|
48
94
|
.actions(self => ({
|
|
49
95
|
/**
|
|
@@ -74,7 +120,8 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
74
120
|
* #action
|
|
75
121
|
*/
|
|
76
122
|
removeFromSelection(elt) {
|
|
77
|
-
|
|
123
|
+
const s = new Set(elt);
|
|
124
|
+
self.selection = self.selection.filter(f => !s.has(f));
|
|
78
125
|
},
|
|
79
126
|
/**
|
|
80
127
|
* #action
|
|
@@ -82,6 +129,67 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
82
129
|
clearSelection() {
|
|
83
130
|
self.selection = [];
|
|
84
131
|
},
|
|
132
|
+
/**
|
|
133
|
+
* #action
|
|
134
|
+
*/
|
|
135
|
+
addToFavorites(trackId) {
|
|
136
|
+
self.favoritesCounter += 1;
|
|
137
|
+
self.favorites = [...self.favorites, trackId];
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
* #action
|
|
141
|
+
*/
|
|
142
|
+
removeFromFavorites(trackId) {
|
|
143
|
+
self.favorites = self.favorites.filter(f => f !== trackId);
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* #action
|
|
147
|
+
*/
|
|
148
|
+
clearFavorites() {
|
|
149
|
+
self.favorites = [];
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* #action
|
|
153
|
+
*/
|
|
154
|
+
setRecentlyUsedCounter(val) {
|
|
155
|
+
self.recentlyUsedCounter = val;
|
|
156
|
+
},
|
|
157
|
+
/**
|
|
158
|
+
* #action
|
|
159
|
+
*/
|
|
160
|
+
setRecentlyUsed(str) {
|
|
161
|
+
self.recentlyUsed = str;
|
|
162
|
+
},
|
|
163
|
+
/**
|
|
164
|
+
* #action
|
|
165
|
+
*/
|
|
166
|
+
setFavorites(str) {
|
|
167
|
+
self.favorites = str;
|
|
168
|
+
},
|
|
169
|
+
/**
|
|
170
|
+
* #action
|
|
171
|
+
*/
|
|
172
|
+
setFavoritesCounter(val) {
|
|
173
|
+
self.favoritesCounter = val;
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* #action
|
|
177
|
+
*/
|
|
178
|
+
addToRecentlyUsed(id) {
|
|
179
|
+
if (!self.recentlyUsed.includes(id)) {
|
|
180
|
+
self.recentlyUsedCounter = Math.min(self.recentlyUsedCounter + 1, MAX_RECENTLY_USED);
|
|
181
|
+
self.recentlyUsed =
|
|
182
|
+
self.recentlyUsed.length >= MAX_RECENTLY_USED
|
|
183
|
+
? [...self.recentlyUsed.slice(1), id]
|
|
184
|
+
: [...self.recentlyUsed, id];
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
/**
|
|
188
|
+
* #action
|
|
189
|
+
*/
|
|
190
|
+
clearRecentlyUsed() {
|
|
191
|
+
self.recentlyUsed = [];
|
|
192
|
+
},
|
|
85
193
|
/**
|
|
86
194
|
* #action
|
|
87
195
|
*/
|
|
@@ -120,6 +228,24 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
120
228
|
},
|
|
121
229
|
}))
|
|
122
230
|
.views(self => ({
|
|
231
|
+
/**
|
|
232
|
+
* #method
|
|
233
|
+
*/
|
|
234
|
+
isSelected(track) {
|
|
235
|
+
return self.selectionSet.has(track);
|
|
236
|
+
},
|
|
237
|
+
/**
|
|
238
|
+
* #method
|
|
239
|
+
*/
|
|
240
|
+
isFavorite(trackId) {
|
|
241
|
+
return self.favoritesSet.has(trackId);
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* #method
|
|
245
|
+
*/
|
|
246
|
+
isRecentlyUsed(trackId) {
|
|
247
|
+
return self.recentlyUsedSet.has(trackId);
|
|
248
|
+
},
|
|
123
249
|
/**
|
|
124
250
|
* #method
|
|
125
251
|
*/
|
|
@@ -149,6 +275,22 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
149
275
|
},
|
|
150
276
|
}))
|
|
151
277
|
.views(self => ({
|
|
278
|
+
/**
|
|
279
|
+
* #getter
|
|
280
|
+
*/
|
|
281
|
+
get recentlyUsedLocalStorageKey() {
|
|
282
|
+
return `recentlyUsedTracks-${[postF(), self.assemblyNames.join(',')]
|
|
283
|
+
.filter(f => !!f)
|
|
284
|
+
.join('-')}`;
|
|
285
|
+
},
|
|
286
|
+
/**
|
|
287
|
+
* #getter
|
|
288
|
+
*/
|
|
289
|
+
get favoritesLocalStorageKey() {
|
|
290
|
+
// this has a extra } at the end because that's how it was initially
|
|
291
|
+
// released
|
|
292
|
+
return `favoriteTracks-${postF()}}`;
|
|
293
|
+
},
|
|
152
294
|
/**
|
|
153
295
|
* #getter
|
|
154
296
|
*/
|
|
@@ -163,47 +305,71 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
163
305
|
var _a;
|
|
164
306
|
return ((_a = self.sortCategories) !== null && _a !== void 0 ? _a : getConf(getSession(self), ['hierarchical', 'sort', 'categories']));
|
|
165
307
|
},
|
|
166
|
-
/**
|
|
167
|
-
* #method
|
|
168
|
-
* filter out tracks that don't match the current display types
|
|
169
|
-
*/
|
|
170
|
-
connectionTrackConfigurations(connection) {
|
|
171
|
-
return filterTracks(connection.tracks, self);
|
|
172
|
-
},
|
|
173
308
|
/**
|
|
174
309
|
* #getter
|
|
175
310
|
* filter out tracks that don't match the current assembly/display types
|
|
176
311
|
*/
|
|
177
|
-
get
|
|
312
|
+
get configAndSessionTrackConfigurations() {
|
|
178
313
|
return [
|
|
179
314
|
...self.assemblyNames.map(a => self.getRefSeqTrackConf(a)),
|
|
180
315
|
...filterTracks(getSession(self).tracks, self),
|
|
181
316
|
].filter(notEmpty);
|
|
182
317
|
},
|
|
318
|
+
/**
|
|
319
|
+
* #getter
|
|
320
|
+
*/
|
|
321
|
+
get allTrackConfigurations() {
|
|
322
|
+
const { connectionInstances = [] } = getSession(self);
|
|
323
|
+
return [
|
|
324
|
+
...this.configAndSessionTrackConfigurations,
|
|
325
|
+
...connectionInstances === null || connectionInstances === void 0 ? void 0 : connectionInstances.flatMap(c => c.tracks),
|
|
326
|
+
];
|
|
327
|
+
},
|
|
328
|
+
/**
|
|
329
|
+
* #getter
|
|
330
|
+
*/
|
|
331
|
+
get allTrackConfigurationTrackIdSet() {
|
|
332
|
+
return new Map(this.allTrackConfigurations.map(t => [t.trackId, t]));
|
|
333
|
+
},
|
|
183
334
|
}))
|
|
184
335
|
.views(self => ({
|
|
185
336
|
/**
|
|
186
|
-
* #
|
|
337
|
+
* #getter
|
|
338
|
+
* filters out tracks that are not in the favorites group
|
|
339
|
+
*/
|
|
340
|
+
get favoriteTracks() {
|
|
341
|
+
return self.favorites
|
|
342
|
+
.filter(t => self.allTrackConfigurationTrackIdSet.has(t))
|
|
343
|
+
.map(t => self.allTrackConfigurationTrackIdSet.get(t));
|
|
344
|
+
},
|
|
345
|
+
/**
|
|
346
|
+
* #getter
|
|
347
|
+
* filters out tracks that are not in the recently used group
|
|
187
348
|
*/
|
|
188
|
-
|
|
189
|
-
return
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
extra: connection.name,
|
|
193
|
-
});
|
|
349
|
+
get recentlyUsedTracks() {
|
|
350
|
+
return self.recentlyUsed
|
|
351
|
+
.filter(t => self.allTrackConfigurationTrackIdSet.has(t))
|
|
352
|
+
.map(t => self.allTrackConfigurationTrackIdSet.get(t));
|
|
194
353
|
},
|
|
195
354
|
}))
|
|
196
355
|
.views(self => ({
|
|
356
|
+
/**
|
|
357
|
+
* #getter
|
|
358
|
+
*/
|
|
197
359
|
get allTracks() {
|
|
198
360
|
const { connectionInstances = [] } = getSession(self);
|
|
199
361
|
return [
|
|
200
362
|
{
|
|
201
363
|
group: 'Tracks',
|
|
202
|
-
tracks: self.
|
|
364
|
+
tracks: self.configAndSessionTrackConfigurations,
|
|
365
|
+
noCategories: false,
|
|
366
|
+
menuItems: [],
|
|
203
367
|
},
|
|
204
368
|
...connectionInstances.flatMap(c => ({
|
|
205
369
|
group: getConf(c, 'name'),
|
|
206
370
|
tracks: c.tracks,
|
|
371
|
+
noCategories: false,
|
|
372
|
+
menuItems: [],
|
|
207
373
|
})),
|
|
208
374
|
];
|
|
209
375
|
},
|
|
@@ -216,17 +382,21 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
216
382
|
return {
|
|
217
383
|
name: 'Root',
|
|
218
384
|
id: 'Root',
|
|
219
|
-
|
|
220
|
-
|
|
385
|
+
isOpenByDefault: true,
|
|
386
|
+
type: 'category',
|
|
387
|
+
children: self.allTracks.map(s => ({
|
|
221
388
|
name: s.group,
|
|
222
389
|
id: s.group,
|
|
390
|
+
type: 'category',
|
|
391
|
+
isOpenByDefault: !self.collapsed.get(s.group),
|
|
392
|
+
menuItems: s.menuItems,
|
|
223
393
|
children: generateHierarchy({
|
|
224
394
|
model: self,
|
|
225
395
|
trackConfs: s.tracks,
|
|
396
|
+
extra: s.group,
|
|
397
|
+
noCategories: s.noCategories,
|
|
226
398
|
}),
|
|
227
|
-
}))
|
|
228
|
-
// always keep the Tracks entry at idx 0
|
|
229
|
-
.filter((f, idx) => idx === 0 || !!f.children.length),
|
|
399
|
+
})),
|
|
230
400
|
};
|
|
231
401
|
},
|
|
232
402
|
}))
|
|
@@ -286,8 +456,25 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
286
456
|
},
|
|
287
457
|
}))
|
|
288
458
|
.views(self => ({
|
|
459
|
+
/**
|
|
460
|
+
* #getter
|
|
461
|
+
*/
|
|
289
462
|
get hasAnySubcategories() {
|
|
290
463
|
return self.allTracks.some(group => group.tracks.some(t => { var _a; return ((_a = readConfObject(t, 'category')) === null || _a === void 0 ? void 0 : _a.length) > 1; }));
|
|
291
464
|
},
|
|
465
|
+
}))
|
|
466
|
+
.actions(self => ({
|
|
467
|
+
afterAttach() {
|
|
468
|
+
// this should be the first autorun to properly initialize
|
|
469
|
+
addDisposer(self, autorun(() => {
|
|
470
|
+
self.setRecentlyUsed(JSON.parse(localStorageGetItem(self.recentlyUsedLocalStorageKey) || '[]'));
|
|
471
|
+
self.setFavorites(JSON.parse(localStorageGetItem(self.favoritesLocalStorageKey) || '[]'));
|
|
472
|
+
}));
|
|
473
|
+
// this should be the second autorun
|
|
474
|
+
addDisposer(self, autorun(() => {
|
|
475
|
+
localStorageSetItem(self.favoritesLocalStorageKey, JSON.stringify(self.favorites));
|
|
476
|
+
localStorageSetItem(self.recentlyUsedLocalStorageKey, JSON.stringify(self.recentlyUsed));
|
|
477
|
+
}));
|
|
478
|
+
},
|
|
292
479
|
}));
|
|
293
480
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function doConnect(self: any): Promise<void>;
|