@jbrowse/plugin-data-management 2.12.3 → 2.13.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.
@@ -58,7 +58,7 @@ function Category({ isOpen, setOpen, data, }) {
58
58
  setOpen(!isOpen);
59
59
  }
60
60
  } },
61
- react_1.default.createElement(material_1.Typography, null,
61
+ react_1.default.createElement(material_1.Typography, { "data-testid": `htsCategory-${name}` },
62
62
  isOpen ? react_1.default.createElement(ArrowDropDown_1.default, null) : react_1.default.createElement(ArrowRight_1.default, null),
63
63
  name,
64
64
  react_1.default.createElement(material_1.IconButton, { onClick: event => {
@@ -2,6 +2,7 @@ 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
+ type MaybeBoolean = boolean | undefined;
5
6
  /**
6
7
  * #stateModel HierarchicalTrackSelectorWidget
7
8
  */
@@ -100,14 +101,41 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
100
101
  afterAttach(): void;
101
102
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
102
103
  }, {
104
+ /**
105
+ * #volatile
106
+ */
103
107
  favorites: string[];
108
+ /**
109
+ * #volatile
110
+ */
104
111
  recentlyUsed: string[];
112
+ /**
113
+ * #volatile
114
+ */
105
115
  selection: AnyConfigurationModel[];
106
- sortTrackNames: boolean;
107
- sortCategories: boolean;
116
+ /**
117
+ * #volatile
118
+ */
119
+ sortTrackNames: MaybeBoolean;
120
+ /**
121
+ * #volatile
122
+ */
123
+ sortCategories: MaybeBoolean;
124
+ /**
125
+ * #volatile
126
+ */
108
127
  collapsed: import("mobx").ObservableMap<string, boolean>;
128
+ /**
129
+ * #volatile
130
+ */
109
131
  filterText: string;
132
+ /**
133
+ * #volatile
134
+ */
110
135
  recentlyUsedCounter: number;
136
+ /**
137
+ * #volatile
138
+ */
111
139
  favoritesCounter: number;
112
140
  } & {
113
141
  /**
@@ -250,11 +278,11 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
250
278
  /**
251
279
  * #getter
252
280
  */
253
- readonly activeSortTrackNames: boolean;
281
+ readonly activeSortTrackNames: any;
254
282
  /**
255
283
  * #getter
256
284
  */
257
- readonly activeSortCategories: boolean;
285
+ readonly activeSortCategories: any;
258
286
  /**
259
287
  * #getter
260
288
  * filter out tracks that don't match the current assembly/display types
@@ -11,19 +11,15 @@ const filterTracks_1 = require("./filterTracks");
11
11
  const generateHierarchy_1 = require("./generateHierarchy");
12
12
  const util_2 = require("./util");
13
13
  const facetedModel_1 = require("./facetedModel");
14
- // for settings that are not config dependent
15
- function keyNoConfigPostFix() {
16
- return typeof window !== 'undefined'
17
- ? [window.location.host, window.location.pathname].join('-')
18
- : 'empty';
19
- }
20
14
  // for settings that are config dependent
21
15
  function keyConfigPostFix() {
22
16
  return typeof window !== 'undefined'
23
17
  ? [
24
- keyNoConfigPostFix(),
18
+ window.location.pathname,
25
19
  new URLSearchParams(window.location.search).get('config'),
26
- ].join('-')
20
+ ]
21
+ .filter(f => !!f)
22
+ .join('-')
27
23
  : 'empty';
28
24
  }
29
25
  function recentlyUsedK(assemblyNames) {
@@ -51,11 +47,15 @@ function sortCategoriesK() {
51
47
  return 'sortCategories';
52
48
  }
53
49
  function localStorageGetJSON(key, defaultValue) {
54
- var _a;
55
- return JSON.parse((_a = (0, util_1.localStorageGetItem)(key)) !== null && _a !== void 0 ? _a : defaultValue);
50
+ const val = (0, util_1.localStorageGetItem)(key);
51
+ return val !== undefined && val !== null && val
52
+ ? JSON.parse(val)
53
+ : defaultValue;
56
54
  }
57
55
  function localStorageSetJSON(key, val) {
58
- (0, util_1.localStorageSetItem)(key, JSON.stringify(val));
56
+ if (val !== undefined && val !== null) {
57
+ (0, util_1.localStorageSetItem)(key, JSON.stringify(val));
58
+ }
59
59
  }
60
60
  const MAX_RECENTLY_USED = 10;
61
61
  /**
@@ -82,14 +82,41 @@ function stateTreeFactory(pluginManager) {
82
82
  faceted: mobx_state_tree_1.types.optional((0, facetedModel_1.facetedStateTreeF)(), {}),
83
83
  })
84
84
  .volatile(() => ({
85
- favorites: localStorageGetJSON(favoritesK(), '[]'),
85
+ /**
86
+ * #volatile
87
+ */
88
+ favorites: localStorageGetJSON(favoritesK(), []),
89
+ /**
90
+ * #volatile
91
+ */
86
92
  recentlyUsed: [],
93
+ /**
94
+ * #volatile
95
+ */
87
96
  selection: [],
88
- sortTrackNames: !!localStorageGetJSON(sortTrackNamesK(), 'false'),
89
- sortCategories: !!localStorageGetJSON(sortCategoriesK(), 'false'),
97
+ /**
98
+ * #volatile
99
+ */
100
+ sortTrackNames: localStorageGetJSON(sortTrackNamesK(), undefined),
101
+ /**
102
+ * #volatile
103
+ */
104
+ sortCategories: localStorageGetJSON(sortCategoriesK(), undefined),
105
+ /**
106
+ * #volatile
107
+ */
90
108
  collapsed: mobx_1.observable.map(),
109
+ /**
110
+ * #volatile
111
+ */
91
112
  filterText: '',
113
+ /**
114
+ * #volatile
115
+ */
92
116
  recentlyUsedCounter: 0,
117
+ /**
118
+ * #volatile
119
+ */
93
120
  favoritesCounter: 0,
94
121
  }))
95
122
  .views(self => ({
@@ -454,46 +481,35 @@ function stateTreeFactory(pluginManager) {
454
481
  // this should be the first autorun to properly initialize
455
482
  (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
456
483
  const { assemblyNames, view } = self;
457
- self.setRecentlyUsed(localStorageGetJSON(recentlyUsedK(assemblyNames), '[]'));
484
+ self.setRecentlyUsed(localStorageGetJSON(recentlyUsedK(assemblyNames), []));
458
485
  if (view) {
459
- const val = (0, util_1.localStorageGetItem)(collapsedK(assemblyNames, view.type));
460
- if (!val) {
486
+ const lc = localStorageGetJSON(collapsedK(assemblyNames, view.type), undefined);
487
+ const r = ['hierarchical', 'defaultCollapsed'];
488
+ const session = (0, util_1.getSession)(self);
489
+ if (!lc) {
461
490
  self.expandAllCategories();
462
- const session = (0, util_1.getSession)(self);
463
- if ((0, configuration_1.getConf)(session, [
464
- 'hierarchical',
465
- 'defaultCollapsed',
466
- 'topLevelCategories',
467
- ])) {
491
+ if ((0, configuration_1.getConf)(session, [...r, 'topLevelCategories'])) {
468
492
  self.collapseTopLevelCategories();
469
493
  }
470
- if ((0, configuration_1.getConf)(session, [
471
- 'hierarchical',
472
- 'defaultCollapsed',
473
- 'subCategories',
474
- ])) {
494
+ if ((0, configuration_1.getConf)(session, [...r, 'subCategories'])) {
475
495
  self.collapseSubCategories();
476
496
  }
477
- for (const entry of (0, configuration_1.getConf)(session, [
478
- 'hierarchical',
479
- 'defaultCollapsed',
480
- 'categoryNames',
481
- ])) {
482
- self.setCategoryCollapsed(`Tracks-${entry}`, true);
497
+ for (const elt of (0, configuration_1.getConf)(session, [...r, 'categoryNames'])) {
498
+ self.setCategoryCollapsed(`Tracks-${elt}`, true);
483
499
  }
484
500
  }
485
501
  else {
486
- self.setCollapsedCategories(JSON.parse(val));
502
+ self.setCollapsedCategories(lc);
487
503
  }
488
504
  }
489
505
  }));
490
506
  // this should be the second autorun
491
507
  (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
492
- const { assemblyNames, collapsed, view } = self;
493
- localStorageSetJSON(recentlyUsedK(assemblyNames), self.recentlyUsed);
494
- localStorageSetJSON(favoritesK(), self.favorites);
495
- localStorageSetJSON(sortTrackNamesK(), self.sortTrackNames);
496
- localStorageSetJSON(sortCategoriesK(), self.sortCategories);
508
+ const { sortTrackNames, sortCategories, favorites, recentlyUsed, assemblyNames, collapsed, view, } = self;
509
+ localStorageSetJSON(recentlyUsedK(assemblyNames), recentlyUsed);
510
+ localStorageSetJSON(favoritesK(), favorites);
511
+ localStorageSetJSON(sortTrackNamesK(), sortTrackNames);
512
+ localStorageSetJSON(sortCategoriesK(), sortCategories);
497
513
  if (view) {
498
514
  localStorageSetJSON(collapsedK(assemblyNames, view.type), collapsed);
499
515
  }
@@ -22,7 +22,5 @@ function DeletePluginDialog({ onClose, plugin, }) {
22
22
  onClose(plugin);
23
23
  }, 500);
24
24
  } }, "Confirm"),
25
- react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
26
- onClose();
27
- } }, "Cancel"))));
25
+ react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => onClose() }, "Cancel"))));
28
26
  }
@@ -6,7 +6,13 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
6
6
  filterText: import("mobx-state-tree").IType<string | undefined, string, string>;
7
7
  view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
8
8
  }, {
9
+ /**
10
+ * #action
11
+ */
9
12
  clearFilterText(): void;
13
+ /**
14
+ * #action
15
+ */
10
16
  setFilterText(newText: string): void;
11
17
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
12
18
  export type PluginStoreStateModel = ReturnType<typeof stateModelFactory>;
@@ -6,15 +6,33 @@ const mst_1 = require("@jbrowse/core/util/types/mst");
6
6
  function stateModelFactory(pluginManager) {
7
7
  return mobx_state_tree_1.types
8
8
  .model('PluginStoreModel', {
9
+ /**
10
+ * #property
11
+ */
9
12
  id: mst_1.ElementId,
13
+ /**
14
+ * #property
15
+ */
10
16
  type: mobx_state_tree_1.types.literal('PluginStoreWidget'),
17
+ /**
18
+ * #property
19
+ */
11
20
  filterText: '',
21
+ /**
22
+ * #property
23
+ */
12
24
  view: mobx_state_tree_1.types.safeReference(pluginManager.pluggableMstType('view', 'stateModel')),
13
25
  })
14
26
  .actions(self => ({
27
+ /**
28
+ * #action
29
+ */
15
30
  clearFilterText() {
16
31
  self.filterText = '';
17
32
  },
33
+ /**
34
+ * #action
35
+ */
18
36
  setFilterText(newText) {
19
37
  self.filterText = newText;
20
38
  },
@@ -29,7 +29,7 @@ export default function Category({ isOpen, setOpen, data, }) {
29
29
  setOpen(!isOpen);
30
30
  }
31
31
  } },
32
- React.createElement(Typography, null,
32
+ React.createElement(Typography, { "data-testid": `htsCategory-${name}` },
33
33
  isOpen ? React.createElement(ArrowDropDownIcon, null) : React.createElement(ArrowRightIcon, null),
34
34
  name,
35
35
  React.createElement(IconButton, { onClick: event => {
@@ -2,6 +2,7 @@ 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
+ type MaybeBoolean = boolean | undefined;
5
6
  /**
6
7
  * #stateModel HierarchicalTrackSelectorWidget
7
8
  */
@@ -100,14 +101,41 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
100
101
  afterAttach(): void;
101
102
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
102
103
  }, {
104
+ /**
105
+ * #volatile
106
+ */
103
107
  favorites: string[];
108
+ /**
109
+ * #volatile
110
+ */
104
111
  recentlyUsed: string[];
112
+ /**
113
+ * #volatile
114
+ */
105
115
  selection: AnyConfigurationModel[];
106
- sortTrackNames: boolean;
107
- sortCategories: boolean;
116
+ /**
117
+ * #volatile
118
+ */
119
+ sortTrackNames: MaybeBoolean;
120
+ /**
121
+ * #volatile
122
+ */
123
+ sortCategories: MaybeBoolean;
124
+ /**
125
+ * #volatile
126
+ */
108
127
  collapsed: import("mobx").ObservableMap<string, boolean>;
128
+ /**
129
+ * #volatile
130
+ */
109
131
  filterText: string;
132
+ /**
133
+ * #volatile
134
+ */
110
135
  recentlyUsedCounter: number;
136
+ /**
137
+ * #volatile
138
+ */
111
139
  favoritesCounter: number;
112
140
  } & {
113
141
  /**
@@ -250,11 +278,11 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
250
278
  /**
251
279
  * #getter
252
280
  */
253
- readonly activeSortTrackNames: boolean;
281
+ readonly activeSortTrackNames: any;
254
282
  /**
255
283
  * #getter
256
284
  */
257
- readonly activeSortCategories: boolean;
285
+ readonly activeSortCategories: any;
258
286
  /**
259
287
  * #getter
260
288
  * filter out tracks that don't match the current assembly/display types
@@ -8,19 +8,15 @@ 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 not config dependent
12
- function keyNoConfigPostFix() {
13
- return typeof window !== 'undefined'
14
- ? [window.location.host, window.location.pathname].join('-')
15
- : 'empty';
16
- }
17
11
  // for settings that are config dependent
18
12
  function keyConfigPostFix() {
19
13
  return typeof window !== 'undefined'
20
14
  ? [
21
- keyNoConfigPostFix(),
15
+ window.location.pathname,
22
16
  new URLSearchParams(window.location.search).get('config'),
23
- ].join('-')
17
+ ]
18
+ .filter(f => !!f)
19
+ .join('-')
24
20
  : 'empty';
25
21
  }
26
22
  function recentlyUsedK(assemblyNames) {
@@ -48,11 +44,15 @@ function sortCategoriesK() {
48
44
  return 'sortCategories';
49
45
  }
50
46
  function localStorageGetJSON(key, defaultValue) {
51
- var _a;
52
- return JSON.parse((_a = localStorageGetItem(key)) !== null && _a !== void 0 ? _a : defaultValue);
47
+ const val = localStorageGetItem(key);
48
+ return val !== undefined && val !== null && val
49
+ ? JSON.parse(val)
50
+ : defaultValue;
53
51
  }
54
52
  function localStorageSetJSON(key, val) {
55
- localStorageSetItem(key, JSON.stringify(val));
53
+ if (val !== undefined && val !== null) {
54
+ localStorageSetItem(key, JSON.stringify(val));
55
+ }
56
56
  }
57
57
  const MAX_RECENTLY_USED = 10;
58
58
  /**
@@ -79,14 +79,41 @@ export default function stateTreeFactory(pluginManager) {
79
79
  faceted: types.optional(facetedStateTreeF(), {}),
80
80
  })
81
81
  .volatile(() => ({
82
- favorites: localStorageGetJSON(favoritesK(), '[]'),
82
+ /**
83
+ * #volatile
84
+ */
85
+ favorites: localStorageGetJSON(favoritesK(), []),
86
+ /**
87
+ * #volatile
88
+ */
83
89
  recentlyUsed: [],
90
+ /**
91
+ * #volatile
92
+ */
84
93
  selection: [],
85
- sortTrackNames: !!localStorageGetJSON(sortTrackNamesK(), 'false'),
86
- sortCategories: !!localStorageGetJSON(sortCategoriesK(), 'false'),
94
+ /**
95
+ * #volatile
96
+ */
97
+ sortTrackNames: localStorageGetJSON(sortTrackNamesK(), undefined),
98
+ /**
99
+ * #volatile
100
+ */
101
+ sortCategories: localStorageGetJSON(sortCategoriesK(), undefined),
102
+ /**
103
+ * #volatile
104
+ */
87
105
  collapsed: observable.map(),
106
+ /**
107
+ * #volatile
108
+ */
88
109
  filterText: '',
110
+ /**
111
+ * #volatile
112
+ */
89
113
  recentlyUsedCounter: 0,
114
+ /**
115
+ * #volatile
116
+ */
90
117
  favoritesCounter: 0,
91
118
  }))
92
119
  .views(self => ({
@@ -451,46 +478,35 @@ export default function stateTreeFactory(pluginManager) {
451
478
  // this should be the first autorun to properly initialize
452
479
  addDisposer(self, autorun(() => {
453
480
  const { assemblyNames, view } = self;
454
- self.setRecentlyUsed(localStorageGetJSON(recentlyUsedK(assemblyNames), '[]'));
481
+ self.setRecentlyUsed(localStorageGetJSON(recentlyUsedK(assemblyNames), []));
455
482
  if (view) {
456
- const val = localStorageGetItem(collapsedK(assemblyNames, view.type));
457
- if (!val) {
483
+ const lc = localStorageGetJSON(collapsedK(assemblyNames, view.type), undefined);
484
+ const r = ['hierarchical', 'defaultCollapsed'];
485
+ const session = getSession(self);
486
+ if (!lc) {
458
487
  self.expandAllCategories();
459
- const session = getSession(self);
460
- if (getConf(session, [
461
- 'hierarchical',
462
- 'defaultCollapsed',
463
- 'topLevelCategories',
464
- ])) {
488
+ if (getConf(session, [...r, 'topLevelCategories'])) {
465
489
  self.collapseTopLevelCategories();
466
490
  }
467
- if (getConf(session, [
468
- 'hierarchical',
469
- 'defaultCollapsed',
470
- 'subCategories',
471
- ])) {
491
+ if (getConf(session, [...r, 'subCategories'])) {
472
492
  self.collapseSubCategories();
473
493
  }
474
- for (const entry of getConf(session, [
475
- 'hierarchical',
476
- 'defaultCollapsed',
477
- 'categoryNames',
478
- ])) {
479
- self.setCategoryCollapsed(`Tracks-${entry}`, true);
494
+ for (const elt of getConf(session, [...r, 'categoryNames'])) {
495
+ self.setCategoryCollapsed(`Tracks-${elt}`, true);
480
496
  }
481
497
  }
482
498
  else {
483
- self.setCollapsedCategories(JSON.parse(val));
499
+ self.setCollapsedCategories(lc);
484
500
  }
485
501
  }
486
502
  }));
487
503
  // this should be the second autorun
488
504
  addDisposer(self, autorun(() => {
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);
505
+ const { sortTrackNames, sortCategories, favorites, recentlyUsed, assemblyNames, collapsed, view, } = self;
506
+ localStorageSetJSON(recentlyUsedK(assemblyNames), recentlyUsed);
507
+ localStorageSetJSON(favoritesK(), favorites);
508
+ localStorageSetJSON(sortTrackNamesK(), sortTrackNames);
509
+ localStorageSetJSON(sortCategoriesK(), sortCategories);
494
510
  if (view) {
495
511
  localStorageSetJSON(collapsedK(assemblyNames, view.type), collapsed);
496
512
  }
@@ -16,7 +16,5 @@ export default function DeletePluginDialog({ onClose, plugin, }) {
16
16
  onClose(plugin);
17
17
  }, 500);
18
18
  } }, "Confirm"),
19
- React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => {
20
- onClose();
21
- } }, "Cancel"))));
19
+ React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => onClose() }, "Cancel"))));
22
20
  }
@@ -6,7 +6,13 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
6
6
  filterText: import("mobx-state-tree").IType<string | undefined, string, string>;
7
7
  view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
8
8
  }, {
9
+ /**
10
+ * #action
11
+ */
9
12
  clearFilterText(): void;
13
+ /**
14
+ * #action
15
+ */
10
16
  setFilterText(newText: string): void;
11
17
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
12
18
  export type PluginStoreStateModel = ReturnType<typeof stateModelFactory>;
@@ -3,15 +3,33 @@ import { ElementId } from '@jbrowse/core/util/types/mst';
3
3
  export default function stateModelFactory(pluginManager) {
4
4
  return types
5
5
  .model('PluginStoreModel', {
6
+ /**
7
+ * #property
8
+ */
6
9
  id: ElementId,
10
+ /**
11
+ * #property
12
+ */
7
13
  type: types.literal('PluginStoreWidget'),
14
+ /**
15
+ * #property
16
+ */
8
17
  filterText: '',
18
+ /**
19
+ * #property
20
+ */
9
21
  view: types.safeReference(pluginManager.pluggableMstType('view', 'stateModel')),
10
22
  })
11
23
  .actions(self => ({
24
+ /**
25
+ * #action
26
+ */
12
27
  clearFilterText() {
13
28
  self.filterText = '';
14
29
  },
30
+ /**
31
+ * #action
32
+ */
15
33
  setFilterText(newText) {
16
34
  self.filterText = newText;
17
35
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-data-management",
3
- "version": "2.12.3",
3
+ "version": "2.13.1",
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": "2775490221cde56af344acebb0afa7e14531cd81"
63
+ "gitHead": "fcebca71cc1d066654603e1a9accfa6c6d4f764d"
64
64
  }