@jbrowse/plugin-data-management 2.11.0 → 2.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AddConnectionWidget/index.d.ts +1 -2
- package/dist/AddConnectionWidget/index.js +3 -2
- package/dist/AddTrackWidget/index.d.ts +1 -2
- package/dist/AddTrackWidget/index.js +3 -2
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/FacetedSelector.js +48 -16
- package/dist/HierarchicalTrackSelectorWidget/facetedModel.d.ts +0 -5
- package/dist/HierarchicalTrackSelectorWidget/facetedModel.js +0 -26
- package/dist/HierarchicalTrackSelectorWidget/index.d.ts +1 -2
- package/dist/HierarchicalTrackSelectorWidget/index.js +3 -2
- package/dist/HierarchicalTrackSelectorWidget/model.d.ts +16 -36
- package/dist/HierarchicalTrackSelectorWidget/model.js +99 -86
- package/dist/HierarchicalTrackSelectorWidget/util.d.ts +1 -1
- package/dist/HierarchicalTrackSelectorWidget/util.js +4 -3
- package/dist/PluginStoreWidget/index.d.ts +1 -2
- package/dist/PluginStoreWidget/index.js +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/ucsc-trackhub/index.d.ts +1 -2
- package/dist/ucsc-trackhub/index.js +3 -2
- package/esm/AddConnectionWidget/index.d.ts +1 -2
- package/esm/AddConnectionWidget/index.js +2 -2
- package/esm/AddTrackWidget/index.d.ts +1 -2
- package/esm/AddTrackWidget/index.js +2 -2
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetedSelector.js +26 -17
- package/esm/HierarchicalTrackSelectorWidget/facetedModel.d.ts +0 -5
- package/esm/HierarchicalTrackSelectorWidget/facetedModel.js +1 -27
- package/esm/HierarchicalTrackSelectorWidget/index.d.ts +1 -2
- package/esm/HierarchicalTrackSelectorWidget/index.js +2 -2
- package/esm/HierarchicalTrackSelectorWidget/model.d.ts +16 -36
- package/esm/HierarchicalTrackSelectorWidget/model.js +100 -87
- package/esm/HierarchicalTrackSelectorWidget/util.d.ts +1 -1
- package/esm/HierarchicalTrackSelectorWidget/util.js +4 -3
- package/esm/PluginStoreWidget/index.d.ts +1 -2
- package/esm/PluginStoreWidget/index.js +2 -2
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/ucsc-trackhub/index.d.ts +1 -2
- package/esm/ucsc-trackhub/index.js +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { types, addDisposer } from 'mobx-state-tree';
|
|
2
|
-
import { autorun } from 'mobx';
|
|
2
|
+
import { autorun, observable } from 'mobx';
|
|
3
3
|
import { getConf, readConfObject, } from '@jbrowse/core/configuration';
|
|
4
4
|
import { dedupe, getSession, localStorageGetItem, localStorageSetItem, notEmpty, } from '@jbrowse/core/util';
|
|
5
5
|
import { ElementId } from '@jbrowse/core/util/types/mst';
|
|
@@ -8,21 +8,52 @@ import { filterTracks } from './filterTracks';
|
|
|
8
8
|
import { generateHierarchy } from './generateHierarchy';
|
|
9
9
|
import { findSubCategories, findTopLevelCategories } from './util';
|
|
10
10
|
import { facetedStateTreeF } from './facetedModel';
|
|
11
|
-
// for settings that are config dependent
|
|
12
|
-
function
|
|
11
|
+
// for settings that are not config dependent
|
|
12
|
+
function keyNoConfigPostFix() {
|
|
13
13
|
return typeof window !== 'undefined'
|
|
14
14
|
? [window.location.host, window.location.pathname].join('-')
|
|
15
15
|
: 'empty';
|
|
16
16
|
}
|
|
17
|
-
// for settings that are
|
|
18
|
-
function
|
|
17
|
+
// for settings that are config dependent
|
|
18
|
+
function keyConfigPostFix() {
|
|
19
19
|
return typeof window !== 'undefined'
|
|
20
20
|
? [
|
|
21
|
-
|
|
21
|
+
keyNoConfigPostFix(),
|
|
22
22
|
new URLSearchParams(window.location.search).get('config'),
|
|
23
23
|
].join('-')
|
|
24
24
|
: 'empty';
|
|
25
25
|
}
|
|
26
|
+
function recentlyUsedK(assemblyNames) {
|
|
27
|
+
return ['recentlyUsedTracks', keyConfigPostFix(), assemblyNames.join(',')]
|
|
28
|
+
.filter(f => !!f)
|
|
29
|
+
.join('-');
|
|
30
|
+
}
|
|
31
|
+
// this has a extra } at the end because that's how it was initially
|
|
32
|
+
// released
|
|
33
|
+
function favoritesK() {
|
|
34
|
+
return `favoriteTracks-${keyConfigPostFix()}}`;
|
|
35
|
+
}
|
|
36
|
+
function collapsedK(assemblyNames, viewType) {
|
|
37
|
+
return [
|
|
38
|
+
'collapsedCategories',
|
|
39
|
+
keyConfigPostFix(),
|
|
40
|
+
assemblyNames.join(','),
|
|
41
|
+
viewType,
|
|
42
|
+
].join('-');
|
|
43
|
+
}
|
|
44
|
+
function sortTrackNamesK() {
|
|
45
|
+
return 'sortTrackNames';
|
|
46
|
+
}
|
|
47
|
+
function sortCategoriesK() {
|
|
48
|
+
return 'sortCategories';
|
|
49
|
+
}
|
|
50
|
+
function localStorageGetJSON(key, defaultValue) {
|
|
51
|
+
var _a;
|
|
52
|
+
return JSON.parse((_a = localStorageGetItem(key)) !== null && _a !== void 0 ? _a : defaultValue);
|
|
53
|
+
}
|
|
54
|
+
function localStorageSetJSON(key, val) {
|
|
55
|
+
localStorageSetItem(key, JSON.stringify(val));
|
|
56
|
+
}
|
|
26
57
|
const MAX_RECENTLY_USED = 10;
|
|
27
58
|
/**
|
|
28
59
|
* #stateModel HierarchicalTrackSelectorWidget
|
|
@@ -38,22 +69,6 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
38
69
|
* #property
|
|
39
70
|
*/
|
|
40
71
|
type: types.literal('HierarchicalTrackSelectorWidget'),
|
|
41
|
-
/**
|
|
42
|
-
* #property
|
|
43
|
-
*/
|
|
44
|
-
initialized: types.maybe(types.boolean),
|
|
45
|
-
/**
|
|
46
|
-
* #property
|
|
47
|
-
*/
|
|
48
|
-
collapsed: types.map(types.boolean),
|
|
49
|
-
/**
|
|
50
|
-
* #property
|
|
51
|
-
*/
|
|
52
|
-
sortTrackNames: types.maybe(types.boolean),
|
|
53
|
-
/**
|
|
54
|
-
* #property
|
|
55
|
-
*/
|
|
56
|
-
sortCategories: types.maybe(types.boolean),
|
|
57
72
|
/**
|
|
58
73
|
* #property
|
|
59
74
|
*/
|
|
@@ -64,9 +79,12 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
64
79
|
faceted: types.optional(facetedStateTreeF(), {}),
|
|
65
80
|
})
|
|
66
81
|
.volatile(() => ({
|
|
67
|
-
favorites: [],
|
|
82
|
+
favorites: localStorageGetJSON(favoritesK(), '[]'),
|
|
68
83
|
recentlyUsed: [],
|
|
69
84
|
selection: [],
|
|
85
|
+
sortTrackNames: !!localStorageGetJSON(sortTrackNamesK(), 'false'),
|
|
86
|
+
sortCategories: !!localStorageGetJSON(sortCategoriesK(), 'false'),
|
|
87
|
+
collapsed: observable.map(),
|
|
70
88
|
filterText: '',
|
|
71
89
|
recentlyUsedCounter: 0,
|
|
72
90
|
favoritesCounter: 0,
|
|
@@ -97,6 +115,13 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
97
115
|
get recentlyUsedSet() {
|
|
98
116
|
return new Set(self.recentlyUsed);
|
|
99
117
|
},
|
|
118
|
+
/**
|
|
119
|
+
* #getter
|
|
120
|
+
*/
|
|
121
|
+
get assemblyNames() {
|
|
122
|
+
var _a;
|
|
123
|
+
return ((_a = self.view) === null || _a === void 0 ? void 0 : _a.assemblyNames) || [];
|
|
124
|
+
},
|
|
100
125
|
}))
|
|
101
126
|
.actions(self => ({
|
|
102
127
|
/**
|
|
@@ -221,6 +246,12 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
221
246
|
expandAllCategories() {
|
|
222
247
|
self.collapsed.clear();
|
|
223
248
|
},
|
|
249
|
+
/**
|
|
250
|
+
* #action
|
|
251
|
+
*/
|
|
252
|
+
setCollapsedCategories(str) {
|
|
253
|
+
self.collapsed.replace(str);
|
|
254
|
+
},
|
|
224
255
|
/**
|
|
225
256
|
* #action
|
|
226
257
|
*/
|
|
@@ -261,43 +292,17 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
261
292
|
const assembly = assemblyManager.get(assemblyName);
|
|
262
293
|
const trackConf = assembly === null || assembly === void 0 ? void 0 : assembly.configuration.sequence;
|
|
263
294
|
const viewType = pluginManager.getViewType(self.view.type);
|
|
264
|
-
if (
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
return trackConf;
|
|
295
|
+
if (trackConf) {
|
|
296
|
+
for (const display of trackConf.displays) {
|
|
297
|
+
if (viewType.displayTypes.some(d => d.name === display.type)) {
|
|
298
|
+
return trackConf;
|
|
299
|
+
}
|
|
270
300
|
}
|
|
271
301
|
}
|
|
272
302
|
return undefined;
|
|
273
303
|
},
|
|
274
304
|
}))
|
|
275
305
|
.views(self => ({
|
|
276
|
-
/**
|
|
277
|
-
* #getter
|
|
278
|
-
*/
|
|
279
|
-
get assemblyNames() {
|
|
280
|
-
var _a;
|
|
281
|
-
return ((_a = self.view) === null || _a === void 0 ? void 0 : _a.assemblyNames) || [];
|
|
282
|
-
},
|
|
283
|
-
}))
|
|
284
|
-
.views(self => ({
|
|
285
|
-
/**
|
|
286
|
-
* #getter
|
|
287
|
-
*/
|
|
288
|
-
get recentlyUsedLocalStorageKey() {
|
|
289
|
-
return `recentlyUsedTracks-${[postF(), self.assemblyNames.join(',')]
|
|
290
|
-
.filter(f => !!f)
|
|
291
|
-
.join('-')}`;
|
|
292
|
-
},
|
|
293
|
-
/**
|
|
294
|
-
* #getter
|
|
295
|
-
*/
|
|
296
|
-
get favoritesLocalStorageKey() {
|
|
297
|
-
// this has a extra } at the end because that's how it was initially
|
|
298
|
-
// released
|
|
299
|
-
return `favoriteTracks-${postF()}}`;
|
|
300
|
-
},
|
|
301
306
|
/**
|
|
302
307
|
* #getter
|
|
303
308
|
*/
|
|
@@ -432,35 +437,6 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
432
437
|
self.setCategoryCollapsed(path, true);
|
|
433
438
|
}
|
|
434
439
|
},
|
|
435
|
-
}))
|
|
436
|
-
.actions(self => ({
|
|
437
|
-
afterCreate() {
|
|
438
|
-
if (!self.initialized) {
|
|
439
|
-
const session = getSession(self);
|
|
440
|
-
if (getConf(session, [
|
|
441
|
-
'hierarchical',
|
|
442
|
-
'defaultCollapsed',
|
|
443
|
-
'topLevelCategories',
|
|
444
|
-
])) {
|
|
445
|
-
self.collapseTopLevelCategories();
|
|
446
|
-
}
|
|
447
|
-
if (getConf(session, [
|
|
448
|
-
'hierarchical',
|
|
449
|
-
'defaultCollapsed',
|
|
450
|
-
'subCategories',
|
|
451
|
-
])) {
|
|
452
|
-
self.collapseSubCategories();
|
|
453
|
-
}
|
|
454
|
-
for (const entry of getConf(session, [
|
|
455
|
-
'hierarchical',
|
|
456
|
-
'defaultCollapsed',
|
|
457
|
-
'categoryNames',
|
|
458
|
-
])) {
|
|
459
|
-
self.collapsed.set(entry, true);
|
|
460
|
-
}
|
|
461
|
-
self.initialized = true;
|
|
462
|
-
}
|
|
463
|
-
},
|
|
464
440
|
}))
|
|
465
441
|
.views(self => ({
|
|
466
442
|
/**
|
|
@@ -474,13 +450,50 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
474
450
|
afterAttach() {
|
|
475
451
|
// this should be the first autorun to properly initialize
|
|
476
452
|
addDisposer(self, autorun(() => {
|
|
477
|
-
|
|
478
|
-
self.
|
|
453
|
+
const { assemblyNames, view } = self;
|
|
454
|
+
self.setRecentlyUsed(localStorageGetJSON(recentlyUsedK(assemblyNames), '[]'));
|
|
455
|
+
if (view) {
|
|
456
|
+
const val = localStorageGetItem(collapsedK(assemblyNames, view.type));
|
|
457
|
+
if (!val) {
|
|
458
|
+
self.expandAllCategories();
|
|
459
|
+
const session = getSession(self);
|
|
460
|
+
if (getConf(session, [
|
|
461
|
+
'hierarchical',
|
|
462
|
+
'defaultCollapsed',
|
|
463
|
+
'topLevelCategories',
|
|
464
|
+
])) {
|
|
465
|
+
self.collapseTopLevelCategories();
|
|
466
|
+
}
|
|
467
|
+
if (getConf(session, [
|
|
468
|
+
'hierarchical',
|
|
469
|
+
'defaultCollapsed',
|
|
470
|
+
'subCategories',
|
|
471
|
+
])) {
|
|
472
|
+
self.collapseSubCategories();
|
|
473
|
+
}
|
|
474
|
+
for (const entry of getConf(session, [
|
|
475
|
+
'hierarchical',
|
|
476
|
+
'defaultCollapsed',
|
|
477
|
+
'categoryNames',
|
|
478
|
+
])) {
|
|
479
|
+
self.setCategoryCollapsed(`Tracks-${entry}`, true);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
self.setCollapsedCategories(JSON.parse(val));
|
|
484
|
+
}
|
|
485
|
+
}
|
|
479
486
|
}));
|
|
480
487
|
// this should be the second autorun
|
|
481
488
|
addDisposer(self, autorun(() => {
|
|
482
|
-
|
|
483
|
-
|
|
489
|
+
const { assemblyNames, collapsed, view } = self;
|
|
490
|
+
localStorageSetJSON(recentlyUsedK(assemblyNames), self.recentlyUsed);
|
|
491
|
+
localStorageSetJSON(favoritesK(), self.favorites);
|
|
492
|
+
localStorageSetJSON(sortTrackNamesK(), self.sortTrackNames);
|
|
493
|
+
localStorageSetJSON(sortCategoriesK(), self.sortCategories);
|
|
494
|
+
if (view) {
|
|
495
|
+
localStorageSetJSON(collapsedK(assemblyNames, view.type), collapsed);
|
|
496
|
+
}
|
|
484
497
|
}));
|
|
485
498
|
},
|
|
486
499
|
}));
|
|
@@ -7,6 +7,6 @@ interface Node {
|
|
|
7
7
|
children: Node[];
|
|
8
8
|
id: string;
|
|
9
9
|
}
|
|
10
|
-
export declare function findSubCategories(obj: Node[], paths: string[]): boolean;
|
|
10
|
+
export declare function findSubCategories(obj: Node[], paths: string[], depth?: number): boolean;
|
|
11
11
|
export declare function findTopLevelCategories(obj: Node[], paths: string[]): void;
|
|
12
12
|
export {};
|
|
@@ -21,12 +21,13 @@ export function matches(query, conf, session) {
|
|
|
21
21
|
return (getTrackName(conf, session).toLowerCase().includes(queryLower) ||
|
|
22
22
|
!!categories.filter(c => c.toLowerCase().includes(queryLower)).length);
|
|
23
23
|
}
|
|
24
|
-
export function findSubCategories(obj, paths) {
|
|
24
|
+
export function findSubCategories(obj, paths, depth = 0) {
|
|
25
25
|
let hasSubs = false;
|
|
26
26
|
for (const elt of obj) {
|
|
27
27
|
if (elt.children.length) {
|
|
28
|
-
const hasSubCategories = findSubCategories(elt.children, paths);
|
|
29
|
-
|
|
28
|
+
const hasSubCategories = findSubCategories(elt.children, paths, depth + 1);
|
|
29
|
+
// avoid pushing the root "Tracks" node by checking depth>0
|
|
30
|
+
if (hasSubCategories && depth > 0) {
|
|
30
31
|
paths.push(elt.id);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -3,7 +3,7 @@ import { WidgetType } from '@jbrowse/core/pluggableElementTypes';
|
|
|
3
3
|
import { lazy } from 'react';
|
|
4
4
|
import stateModelFactory from './model';
|
|
5
5
|
const configSchema = ConfigurationSchema('PluginStoreWidget', {});
|
|
6
|
-
export default (pluginManager)
|
|
6
|
+
export default function PluginStoreWidgetF(pluginManager) {
|
|
7
7
|
pluginManager.addWidgetType(() => {
|
|
8
8
|
return new WidgetType({
|
|
9
9
|
name: 'PluginStoreWidget',
|
|
@@ -13,4 +13,4 @@ export default (pluginManager) => {
|
|
|
13
13
|
ReactComponent: lazy(() => import('./components/PluginStoreWidget')),
|
|
14
14
|
});
|
|
15
15
|
});
|
|
16
|
-
}
|
|
16
|
+
}
|
package/esm/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare const AssemblyManager: import("react").LazyExoticComponent<({ rootModel,
|
|
|
5
5
|
rootModel: any;
|
|
6
6
|
onClose: (arg: boolean) => void;
|
|
7
7
|
}) => import("react").JSX.Element>;
|
|
8
|
-
export default class extends Plugin {
|
|
8
|
+
export default class DataManagementPlugin extends Plugin {
|
|
9
9
|
name: string;
|
|
10
10
|
exports: {
|
|
11
11
|
AssemblyManager: import("react").LazyExoticComponent<({ rootModel, onClose, }: {
|
package/esm/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import AddConnectionWidgetF from './AddConnectionWidget';
|
|
|
6
6
|
import PluginStoreWidgetF from './PluginStoreWidget';
|
|
7
7
|
import HierarchicalTrackSelectorWidgetF from './HierarchicalTrackSelectorWidget';
|
|
8
8
|
const AssemblyManager = lazy(() => import('./AssemblyManager'));
|
|
9
|
-
export default class extends Plugin {
|
|
9
|
+
export default class DataManagementPlugin extends Plugin {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
12
|
this.name = 'DataManagementPlugin';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConnectionType } from '@jbrowse/core/pluggableElementTypes';
|
|
2
2
|
import stateModelFactory from './model';
|
|
3
3
|
import configSchema from './configSchema';
|
|
4
|
-
export default (pluginManager)
|
|
4
|
+
export default function UCSCTrackHubConnectionF(pluginManager) {
|
|
5
5
|
pluginManager.addConnectionType(() => new ConnectionType({
|
|
6
6
|
name: 'UCSCTrackHubConnection',
|
|
7
7
|
configSchema,
|
|
@@ -10,4 +10,4 @@ export default (pluginManager) => {
|
|
|
10
10
|
description: 'A track or assembly hub in the Track Hub format',
|
|
11
11
|
url: '//genome.ucsc.edu/goldenPath/help/hgTrackHubHelp.html#Intro',
|
|
12
12
|
}));
|
|
13
|
-
}
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-data-management",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.2",
|
|
4
4
|
"description": "JBrowse 2 linear genome view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"distModule": "esm/index.js",
|
|
61
61
|
"srcModule": "src/index.ts",
|
|
62
62
|
"module": "esm/index.js",
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "511048cb6965f0bf624c96de244e7fd47fce17d6"
|
|
64
64
|
}
|