@jbrowse/product-core 3.0.4 → 3.1.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.
@@ -15,6 +15,7 @@ export declare function MultipleViewsSessionMixin(pluginManager: PluginManager):
15
15
  minimized: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
16
16
  } & {
17
17
  views: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyType>;
18
+ stickyViewHeaders: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
18
19
  }, {
19
20
  selection: unknown;
20
21
  hovered: unknown;
@@ -69,6 +70,8 @@ export declare function MultipleViewsSessionMixin(pluginManager: PluginManager):
69
70
  addViewFromAnotherView(viewType: string, otherView: IBaseViewModelWithDisplayedRegions, initialState?: {
70
71
  displayedRegions?: Region[];
71
72
  }): any;
73
+ setStickyViewHeaders(sticky: boolean): void;
74
+ afterAttach(): void;
72
75
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
73
76
  export type SessionWithMultipleViewsType = ReturnType<typeof MultipleViewsSessionMixin>;
74
77
  export type SessionWithMultipleViews = Instance<SessionWithMultipleViewsType>;
@@ -3,14 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MultipleViewsSessionMixin = MultipleViewsSessionMixin;
4
4
  exports.isSessionWithMultipleViews = isSessionWithMultipleViews;
5
5
  const configuration_1 = require("@jbrowse/core/configuration");
6
+ const util_1 = require("@jbrowse/core/util");
7
+ const mobx_1 = require("mobx");
6
8
  const mobx_state_tree_1 = require("mobx-state-tree");
7
9
  const BaseSession_1 = require("./BaseSession");
8
10
  const DrawerWidgets_1 = require("./DrawerWidgets");
11
+ function localStorageSetBoolean(key, value) {
12
+ (0, util_1.localStorageSetItem)(key, JSON.stringify(value));
13
+ }
9
14
  function MultipleViewsSessionMixin(pluginManager) {
10
15
  return mobx_state_tree_1.types
11
16
  .compose((0, BaseSession_1.BaseSessionModel)(pluginManager), (0, DrawerWidgets_1.DrawerWidgetSessionMixin)(pluginManager))
12
17
  .props({
13
18
  views: mobx_state_tree_1.types.array(pluginManager.pluggableMstType('view', 'stateModel')),
19
+ stickyViewHeaders: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.boolean, () => (0, util_1.localStorageGetBoolean)('stickyViewHeaders', true)),
14
20
  })
15
21
  .actions(self => ({
16
22
  moveViewDown(id) {
@@ -76,6 +82,15 @@ function MultipleViewsSessionMixin(pluginManager) {
76
82
  state.displayedRegions = (0, mobx_state_tree_1.getSnapshot)(otherView.displayedRegions);
77
83
  return this.addView(viewType, state);
78
84
  },
85
+ setStickyViewHeaders(sticky) {
86
+ self.stickyViewHeaders = sticky;
87
+ localStorageSetBoolean('stickyViewHeaders', sticky);
88
+ },
89
+ afterAttach() {
90
+ (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
91
+ localStorageSetBoolean('stickyViewHeaders', self.stickyViewHeaders);
92
+ }));
93
+ },
79
94
  }));
80
95
  }
81
96
  function isSessionWithMultipleViews(session) {
@@ -15,6 +15,7 @@ export declare function MultipleViewsSessionMixin(pluginManager: PluginManager):
15
15
  minimized: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
16
16
  } & {
17
17
  views: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyType>;
18
+ stickyViewHeaders: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
18
19
  }, {
19
20
  selection: unknown;
20
21
  hovered: unknown;
@@ -69,6 +70,8 @@ export declare function MultipleViewsSessionMixin(pluginManager: PluginManager):
69
70
  addViewFromAnotherView(viewType: string, otherView: IBaseViewModelWithDisplayedRegions, initialState?: {
70
71
  displayedRegions?: Region[];
71
72
  }): any;
73
+ setStickyViewHeaders(sticky: boolean): void;
74
+ afterAttach(): void;
72
75
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
73
76
  export type SessionWithMultipleViewsType = ReturnType<typeof MultipleViewsSessionMixin>;
74
77
  export type SessionWithMultipleViews = Instance<SessionWithMultipleViewsType>;
@@ -1,12 +1,18 @@
1
1
  import { readConfObject } from '@jbrowse/core/configuration';
2
- import { cast, getSnapshot, types } from 'mobx-state-tree';
2
+ import { localStorageGetBoolean, localStorageSetItem } from '@jbrowse/core/util';
3
+ import { autorun } from 'mobx';
4
+ import { addDisposer, cast, getSnapshot, types } from 'mobx-state-tree';
3
5
  import { BaseSessionModel, isBaseSession } from './BaseSession';
4
6
  import { DrawerWidgetSessionMixin } from './DrawerWidgets';
7
+ function localStorageSetBoolean(key, value) {
8
+ localStorageSetItem(key, JSON.stringify(value));
9
+ }
5
10
  export function MultipleViewsSessionMixin(pluginManager) {
6
11
  return types
7
12
  .compose(BaseSessionModel(pluginManager), DrawerWidgetSessionMixin(pluginManager))
8
13
  .props({
9
14
  views: types.array(pluginManager.pluggableMstType('view', 'stateModel')),
15
+ stickyViewHeaders: types.optional(types.boolean, () => localStorageGetBoolean('stickyViewHeaders', true)),
10
16
  })
11
17
  .actions(self => ({
12
18
  moveViewDown(id) {
@@ -72,6 +78,15 @@ export function MultipleViewsSessionMixin(pluginManager) {
72
78
  state.displayedRegions = getSnapshot(otherView.displayedRegions);
73
79
  return this.addView(viewType, state);
74
80
  },
81
+ setStickyViewHeaders(sticky) {
82
+ self.stickyViewHeaders = sticky;
83
+ localStorageSetBoolean('stickyViewHeaders', sticky);
84
+ },
85
+ afterAttach() {
86
+ addDisposer(self, autorun(() => {
87
+ localStorageSetBoolean('stickyViewHeaders', self.stickyViewHeaders);
88
+ }));
89
+ },
75
90
  }));
76
91
  }
77
92
  export function isSessionWithMultipleViews(session) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/product-core",
3
- "version": "3.0.4",
3
+ "version": "3.1.0",
4
4
  "sideEffects": false,
5
5
  "description": "JBrowse 2 code shared between products but not used by plugins",
6
6
  "keywords": [
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@babel/runtime": "^7.16.3",
46
- "@jbrowse/core": "^3.0.4",
46
+ "@jbrowse/core": "^3.1.0",
47
47
  "@mui/icons-material": "^6.0.0",
48
48
  "@mui/material": "^6.0.0",
49
49
  "copy-to-clipboard": "^3.3.1",
@@ -62,5 +62,5 @@
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "61e6d26f83acbf58a946c2add3415bc46b878df9"
65
+ "gitHead": "91492049ddea0aed90eb24d3c066c2d9f5a6b189"
66
66
  }