@jbrowse/plugin-grid-bookmark 2.17.0 → 2.18.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/GridBookmarkWidget/components/AssemblySelector.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/AssemblySelector.js +1 -2
- package/dist/GridBookmarkWidget/components/BookmarkGrid.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/BookmarkGrid.js +53 -82
- package/dist/GridBookmarkWidget/components/GridBookmarkWidget.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/GridBookmarkWidget.js +9 -12
- package/dist/GridBookmarkWidget/components/Highlight/Highlight.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/Highlight/Highlight.js +14 -11
- package/dist/GridBookmarkWidget/components/Highlight/OverviewHighlight.d.ts +2 -2
- package/dist/GridBookmarkWidget/components/Highlight/OverviewHighlight.js +5 -5
- package/dist/GridBookmarkWidget/components/Highlight/index.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/Highlight/index.js +2 -7
- package/dist/GridBookmarkWidget/components/dialogs/DeleteBookmarksDialog.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/dialogs/DeleteBookmarksDialog.js +2 -2
- package/dist/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.js +2 -2
- package/dist/GridBookmarkWidget/components/dialogs/ExportBookmarksDialog.d.ts +2 -2
- package/dist/GridBookmarkWidget/components/dialogs/ExportBookmarksDialog.js +8 -7
- package/dist/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.js +4 -4
- package/dist/GridBookmarkWidget/components/dialogs/ImportBookmarksDialog.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/dialogs/ImportBookmarksDialog.js +8 -11
- package/dist/GridBookmarkWidget/components/dialogs/ShareBookmarksDialog.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/dialogs/ShareBookmarksDialog.js +5 -7
- package/dist/GridBookmarkWidget/index.d.ts +1 -1
- package/dist/GridBookmarkWidget/index.js +1 -2
- package/dist/GridBookmarkWidget/model.d.ts +10 -86
- package/dist/GridBookmarkWidget/model.js +18 -94
- package/dist/GridBookmarkWidget/sessionSharing.d.ts +1 -1
- package/dist/GridBookmarkWidget/sessionSharing.js +3 -9
- package/dist/GridBookmarkWidget/types.d.ts +1 -1
- package/dist/GridBookmarkWidget/utils.d.ts +2 -16
- package/dist/GridBookmarkWidget/utils.js +2 -23
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -29
- package/esm/GridBookmarkWidget/components/AssemblySelector.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/AssemblySelector.js +1 -2
- package/esm/GridBookmarkWidget/components/BookmarkGrid.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/BookmarkGrid.js +53 -59
- package/esm/GridBookmarkWidget/components/GridBookmarkWidget.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/GridBookmarkWidget.js +9 -12
- package/esm/GridBookmarkWidget/components/Highlight/Highlight.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/Highlight/Highlight.js +14 -11
- package/esm/GridBookmarkWidget/components/Highlight/OverviewHighlight.d.ts +2 -2
- package/esm/GridBookmarkWidget/components/Highlight/OverviewHighlight.js +5 -5
- package/esm/GridBookmarkWidget/components/Highlight/index.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/Highlight/index.js +2 -7
- package/esm/GridBookmarkWidget/components/dialogs/DeleteBookmarksDialog.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/dialogs/DeleteBookmarksDialog.js +2 -2
- package/esm/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.js +2 -2
- package/esm/GridBookmarkWidget/components/dialogs/ExportBookmarksDialog.d.ts +2 -2
- package/esm/GridBookmarkWidget/components/dialogs/ExportBookmarksDialog.js +8 -7
- package/esm/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.js +4 -4
- package/esm/GridBookmarkWidget/components/dialogs/ImportBookmarksDialog.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/dialogs/ImportBookmarksDialog.js +7 -10
- package/esm/GridBookmarkWidget/components/dialogs/ShareBookmarksDialog.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/dialogs/ShareBookmarksDialog.js +5 -7
- package/esm/GridBookmarkWidget/index.d.ts +1 -1
- package/esm/GridBookmarkWidget/index.js +1 -2
- package/esm/GridBookmarkWidget/model.d.ts +10 -86
- package/esm/GridBookmarkWidget/model.js +18 -94
- package/esm/GridBookmarkWidget/sessionSharing.d.ts +1 -1
- package/esm/GridBookmarkWidget/sessionSharing.js +3 -9
- package/esm/GridBookmarkWidget/types.d.ts +1 -1
- package/esm/GridBookmarkWidget/utils.d.ts +2 -16
- package/esm/GridBookmarkWidget/utils.js +2 -23
- package/esm/index.d.ts +1 -1
- package/esm/index.js +10 -29
- package/package.json +2 -2
- package/dist/GridBookmarkWidget/components/dialogs/EditBookmarkLabelDialog.d.ts +0 -8
- package/dist/GridBookmarkWidget/components/dialogs/EditBookmarkLabelDialog.js +0 -54
- package/esm/GridBookmarkWidget/components/dialogs/EditBookmarkLabelDialog.d.ts +0 -8
- package/esm/GridBookmarkWidget/components/dialogs/EditBookmarkLabelDialog.js +0 -29
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import type { Region } from '@jbrowse/core/util/types';
|
|
3
|
+
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
4
|
+
import type { IMSTArray, Instance, SnapshotIn } from 'mobx-state-tree';
|
|
5
5
|
declare const LabeledRegionModel: import("mobx-state-tree").IModelType<{
|
|
6
6
|
refName: import("mobx-state-tree").ISimpleType<string>;
|
|
7
7
|
start: import("mobx-state-tree").ISimpleType<number>;
|
|
@@ -19,10 +19,10 @@ declare const LabeledRegionModel: import("mobx-state-tree").IModelType<{
|
|
|
19
19
|
setHighlight(color: string): void;
|
|
20
20
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
21
21
|
export interface IExtendedLGV extends LinearGenomeViewModel {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
bookmarkHighlightsVisible: boolean;
|
|
23
|
+
bookmarkLabelsVisible: boolean;
|
|
24
|
+
setBookmarkHighlightsVisible: (arg: boolean) => void;
|
|
25
|
+
setBookmarkLabelsVisible: (arg: boolean) => void;
|
|
26
26
|
}
|
|
27
27
|
export interface ILabeledRegionModel extends SnapshotIn<typeof LabeledRegionModel> {
|
|
28
28
|
refName: string;
|
|
@@ -40,22 +40,9 @@ export interface IExtendedLabeledRegionModel extends ILabeledRegionModel {
|
|
|
40
40
|
id: number;
|
|
41
41
|
correspondingObj: ILabeledRegionModel;
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
44
|
-
* #stateModel GridBookmarkWidgetModel
|
|
45
|
-
*/
|
|
46
43
|
export default function f(_pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
47
|
-
/**
|
|
48
|
-
* #property
|
|
49
|
-
*/
|
|
50
44
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
51
|
-
/**
|
|
52
|
-
* #property
|
|
53
|
-
*/
|
|
54
45
|
type: import("mobx-state-tree").ISimpleType<"GridBookmarkWidget">;
|
|
55
|
-
/**
|
|
56
|
-
* #property
|
|
57
|
-
* removed by postProcessSnapshot, only loaded from localStorage
|
|
58
|
-
*/
|
|
59
46
|
bookmarks: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
60
47
|
refName: import("mobx-state-tree").ISimpleType<string>;
|
|
61
48
|
start: import("mobx-state-tree").ISimpleType<number>;
|
|
@@ -76,26 +63,11 @@ export default function f(_pluginManager: PluginManager): import("mobx-state-tre
|
|
|
76
63
|
selectedBookmarks: IExtendedLabeledRegionModel[];
|
|
77
64
|
selectedAssembliesPre: string[] | undefined;
|
|
78
65
|
} & {
|
|
79
|
-
/**
|
|
80
|
-
* #getter
|
|
81
|
-
*/
|
|
82
66
|
readonly bookmarkAssemblies: string[];
|
|
83
|
-
/**
|
|
84
|
-
* #getter
|
|
85
|
-
*/
|
|
86
67
|
readonly validAssemblies: Set<string>;
|
|
87
|
-
/**
|
|
88
|
-
* #getter
|
|
89
|
-
*/
|
|
90
68
|
readonly areBookmarksHighlightedOnAllOpenViews: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* #getter
|
|
93
|
-
*/
|
|
94
69
|
readonly areBookmarksHighlightLabelsOnAllOpenViews: boolean;
|
|
95
70
|
} & {
|
|
96
|
-
/**
|
|
97
|
-
* #getter
|
|
98
|
-
*/
|
|
99
71
|
readonly bookmarksWithValidAssemblies: ({
|
|
100
72
|
refName: string;
|
|
101
73
|
start: number;
|
|
@@ -126,9 +98,6 @@ export default function f(_pluginManager: PluginManager): import("mobx-state-tre
|
|
|
126
98
|
setHighlight(color: string): void;
|
|
127
99
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>)[];
|
|
128
100
|
} & {
|
|
129
|
-
/**
|
|
130
|
-
* #getter
|
|
131
|
-
*/
|
|
132
101
|
readonly sharedBookmarksModel: {
|
|
133
102
|
sharedBookmarks: (IMSTArray<import("mobx-state-tree").IModelType<{
|
|
134
103
|
refName: import("mobx-state-tree").ISimpleType<string>;
|
|
@@ -179,9 +148,6 @@ export default function f(_pluginManager: PluginManager): import("mobx-state-tre
|
|
|
179
148
|
setHighlight(color: string): void;
|
|
180
149
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>>;
|
|
181
150
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
182
|
-
/**
|
|
183
|
-
* #getter
|
|
184
|
-
*/
|
|
185
151
|
readonly allBookmarksModel: {
|
|
186
152
|
sharedBookmarks: (IMSTArray<import("mobx-state-tree").IModelType<{
|
|
187
153
|
refName: import("mobx-state-tree").ISimpleType<string>;
|
|
@@ -233,64 +199,22 @@ export default function f(_pluginManager: PluginManager): import("mobx-state-tre
|
|
|
233
199
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>>;
|
|
234
200
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
235
201
|
} & {
|
|
236
|
-
/**
|
|
237
|
-
* #action
|
|
238
|
-
*/
|
|
239
202
|
setSelectedAssemblies(assemblies?: string[]): void;
|
|
240
203
|
} & {
|
|
241
|
-
/**
|
|
242
|
-
* #getter
|
|
243
|
-
*/
|
|
244
204
|
readonly selectedAssemblies: string[];
|
|
245
205
|
} & {
|
|
246
|
-
/**
|
|
247
|
-
* #action
|
|
248
|
-
*/
|
|
249
206
|
importBookmarks(regions: Region[]): void;
|
|
250
|
-
/**
|
|
251
|
-
* #action
|
|
252
|
-
*/
|
|
253
207
|
addBookmark(region: Region): void;
|
|
254
|
-
/**
|
|
255
|
-
* #action
|
|
256
|
-
*/
|
|
257
208
|
removeBookmark(index: number): void;
|
|
258
|
-
/**
|
|
259
|
-
* #action
|
|
260
|
-
*/
|
|
261
209
|
updateBookmarkLabel(bookmark: IExtendedLabeledRegionModel, label: string): void;
|
|
262
|
-
/**
|
|
263
|
-
* #action
|
|
264
|
-
*/
|
|
265
210
|
updateBookmarkHighlight(bookmark: IExtendedLabeledRegionModel, color: string): void;
|
|
266
|
-
/**
|
|
267
|
-
* #action
|
|
268
|
-
*/
|
|
269
211
|
updateBulkBookmarkHighlights(color: string): void;
|
|
270
|
-
/**
|
|
271
|
-
* #action
|
|
272
|
-
*/
|
|
273
212
|
setSelectedBookmarks(bookmarks: IExtendedLabeledRegionModel[]): void;
|
|
274
|
-
/**
|
|
275
|
-
* #action
|
|
276
|
-
*/
|
|
277
213
|
setBookmarkedRegions(regions: IMSTArray<typeof LabeledRegionModel>): void;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
*/
|
|
281
|
-
setHighlightToggle(toggle: boolean): void;
|
|
282
|
-
/**
|
|
283
|
-
* #action
|
|
284
|
-
*/
|
|
285
|
-
setLabelToggle(toggle: boolean): void;
|
|
214
|
+
setBookmarkHighlightsVisible(arg: boolean): void;
|
|
215
|
+
setBookmarkLabelsVisible(arg: boolean): void;
|
|
286
216
|
} & {
|
|
287
|
-
/**
|
|
288
|
-
* #action
|
|
289
|
-
*/
|
|
290
217
|
clearAllBookmarks(): void;
|
|
291
|
-
/**
|
|
292
|
-
* #action
|
|
293
|
-
*/
|
|
294
218
|
clearSelectedBookmarks(): void;
|
|
295
219
|
removeBookmarkObject(arg: Instance<typeof LabeledRegionModel>): void;
|
|
296
220
|
} & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { types, cast, addDisposer, } from 'mobx-state-tree';
|
|
2
|
-
import { Region as RegionModel, ElementId } from '@jbrowse/core/util/types/mst';
|
|
3
1
|
import { getSession, localStorageGetItem, localStorageSetItem, } from '@jbrowse/core/util';
|
|
2
|
+
import { ElementId, Region as RegionModel } from '@jbrowse/core/util/types/mst';
|
|
4
3
|
import { autorun } from 'mobx';
|
|
4
|
+
import { addDisposer, cast, types } from 'mobx-state-tree';
|
|
5
5
|
const LabeledRegionModel = types
|
|
6
6
|
.compose(RegionModel, types.model('Label', {
|
|
7
7
|
label: types.optional(types.string, ''),
|
|
@@ -21,24 +21,11 @@ const SharedBookmarksModel = types.model('SharedBookmarksModel', {
|
|
|
21
21
|
const localStorageKeyF = () => typeof window !== 'undefined'
|
|
22
22
|
? `bookmarks-${[window.location.host + window.location.pathname].join('-')}`
|
|
23
23
|
: 'empty';
|
|
24
|
-
/**
|
|
25
|
-
* #stateModel GridBookmarkWidgetModel
|
|
26
|
-
*/
|
|
27
24
|
export default function f(_pluginManager) {
|
|
28
25
|
return types
|
|
29
26
|
.model('GridBookmarkModel', {
|
|
30
|
-
/**
|
|
31
|
-
* #property
|
|
32
|
-
*/
|
|
33
27
|
id: ElementId,
|
|
34
|
-
/**
|
|
35
|
-
* #property
|
|
36
|
-
*/
|
|
37
28
|
type: types.literal('GridBookmarkWidget'),
|
|
38
|
-
/**
|
|
39
|
-
* #property
|
|
40
|
-
* removed by postProcessSnapshot, only loaded from localStorage
|
|
41
|
-
*/
|
|
42
29
|
bookmarks: types.optional(types.array(LabeledRegionModel), () => JSON.parse(localStorageGetItem(localStorageKeyF()) || '[]')),
|
|
43
30
|
})
|
|
44
31
|
.volatile(() => ({
|
|
@@ -46,167 +33,104 @@ export default function f(_pluginManager) {
|
|
|
46
33
|
selectedAssembliesPre: undefined,
|
|
47
34
|
}))
|
|
48
35
|
.views(self => ({
|
|
49
|
-
/**
|
|
50
|
-
* #getter
|
|
51
|
-
*/
|
|
52
36
|
get bookmarkAssemblies() {
|
|
53
37
|
return [...new Set(self.bookmarks.map(r => r.assemblyName))];
|
|
54
38
|
},
|
|
55
|
-
/**
|
|
56
|
-
* #getter
|
|
57
|
-
*/
|
|
58
39
|
get validAssemblies() {
|
|
59
40
|
const { assemblyManager } = getSession(self);
|
|
60
41
|
return new Set(this.bookmarkAssemblies.filter(a => assemblyManager.get(a)));
|
|
61
42
|
},
|
|
62
|
-
/**
|
|
63
|
-
* #getter
|
|
64
|
-
*/
|
|
65
43
|
get areBookmarksHighlightedOnAllOpenViews() {
|
|
66
44
|
const { views } = getSession(self);
|
|
67
|
-
return views.every(v => '
|
|
45
|
+
return views.every(v => 'bookmarkHighlightsVisible' in v ? v.bookmarkHighlightsVisible : true);
|
|
68
46
|
},
|
|
69
|
-
/**
|
|
70
|
-
* #getter
|
|
71
|
-
*/
|
|
72
47
|
get areBookmarksHighlightLabelsOnAllOpenViews() {
|
|
73
48
|
const { views } = getSession(self);
|
|
74
|
-
return views.every(v => '
|
|
49
|
+
return views.every(v => 'bookmarkLabelsVisible' in v ? v.bookmarkLabelsVisible : true);
|
|
75
50
|
},
|
|
76
51
|
}))
|
|
77
52
|
.views(self => ({
|
|
78
|
-
/**
|
|
79
|
-
* #getter
|
|
80
|
-
*/
|
|
81
53
|
get bookmarksWithValidAssemblies() {
|
|
82
54
|
return self.bookmarks.filter(e => self.validAssemblies.has(e.assemblyName));
|
|
83
55
|
},
|
|
84
56
|
}))
|
|
85
57
|
.views(self => ({
|
|
86
|
-
/**
|
|
87
|
-
* #getter
|
|
88
|
-
*/
|
|
89
58
|
get sharedBookmarksModel() {
|
|
90
|
-
// requires cloning bookmarks with JSON.stringify/parse to avoid duplicate
|
|
91
|
-
// reference to same object in the same state tree, will otherwise error
|
|
92
|
-
// when performing share
|
|
93
59
|
return SharedBookmarksModel.create({
|
|
94
60
|
sharedBookmarks: JSON.parse(JSON.stringify(self.selectedBookmarks)),
|
|
95
61
|
});
|
|
96
62
|
},
|
|
97
|
-
/**
|
|
98
|
-
* #getter
|
|
99
|
-
*/
|
|
100
63
|
get allBookmarksModel() {
|
|
101
|
-
// requires cloning bookmarks with JSON.stringify/parse to avoid duplicate
|
|
102
|
-
// reference to same object in the same state tree, will otherwise error
|
|
103
|
-
// when performing share
|
|
104
64
|
return SharedBookmarksModel.create({
|
|
105
65
|
sharedBookmarks: JSON.parse(JSON.stringify(self.bookmarksWithValidAssemblies)),
|
|
106
66
|
});
|
|
107
67
|
},
|
|
108
68
|
}))
|
|
109
69
|
.actions(self => ({
|
|
110
|
-
/**
|
|
111
|
-
* #action
|
|
112
|
-
*/
|
|
113
70
|
setSelectedAssemblies(assemblies) {
|
|
114
71
|
self.selectedAssembliesPre = assemblies;
|
|
115
72
|
},
|
|
116
73
|
}))
|
|
117
74
|
.views(self => ({
|
|
118
|
-
/**
|
|
119
|
-
* #getter
|
|
120
|
-
*/
|
|
121
75
|
get selectedAssemblies() {
|
|
122
76
|
var _a, _b;
|
|
123
77
|
return ((_b = (_a = self.selectedAssembliesPre) === null || _a === void 0 ? void 0 : _a.filter(f => self.validAssemblies.has(f))) !== null && _b !== void 0 ? _b : [...self.validAssemblies]);
|
|
124
78
|
},
|
|
125
79
|
}))
|
|
126
80
|
.actions(self => ({
|
|
127
|
-
/**
|
|
128
|
-
* #action
|
|
129
|
-
*/
|
|
130
81
|
importBookmarks(regions) {
|
|
131
82
|
self.bookmarks = cast([...self.bookmarks, ...regions]);
|
|
132
83
|
},
|
|
133
|
-
/**
|
|
134
|
-
* #action
|
|
135
|
-
*/
|
|
136
84
|
addBookmark(region) {
|
|
137
85
|
self.bookmarks.push(region);
|
|
138
86
|
},
|
|
139
|
-
/**
|
|
140
|
-
* #action
|
|
141
|
-
*/
|
|
142
87
|
removeBookmark(index) {
|
|
143
88
|
self.bookmarks.splice(index, 1);
|
|
144
89
|
},
|
|
145
|
-
/**
|
|
146
|
-
* #action
|
|
147
|
-
*/
|
|
148
90
|
updateBookmarkLabel(bookmark, label) {
|
|
149
91
|
bookmark.correspondingObj.setLabel(label);
|
|
150
92
|
},
|
|
151
|
-
/**
|
|
152
|
-
* #action
|
|
153
|
-
*/
|
|
154
93
|
updateBookmarkHighlight(bookmark, color) {
|
|
155
94
|
bookmark.correspondingObj.setHighlight(color);
|
|
156
95
|
},
|
|
157
|
-
/**
|
|
158
|
-
* #action
|
|
159
|
-
*/
|
|
160
96
|
updateBulkBookmarkHighlights(color) {
|
|
161
97
|
self.selectedBookmarks.forEach(bookmark => {
|
|
162
98
|
this.updateBookmarkHighlight(bookmark, color);
|
|
163
99
|
});
|
|
164
100
|
},
|
|
165
|
-
/**
|
|
166
|
-
* #action
|
|
167
|
-
*/
|
|
168
101
|
setSelectedBookmarks(bookmarks) {
|
|
169
102
|
self.selectedBookmarks = bookmarks;
|
|
170
103
|
},
|
|
171
|
-
/**
|
|
172
|
-
* #action
|
|
173
|
-
*/
|
|
174
104
|
setBookmarkedRegions(regions) {
|
|
175
105
|
self.bookmarks = cast(regions);
|
|
176
106
|
},
|
|
177
|
-
|
|
178
|
-
* #action
|
|
179
|
-
*/
|
|
180
|
-
setHighlightToggle(toggle) {
|
|
107
|
+
setBookmarkHighlightsVisible(arg) {
|
|
181
108
|
const { views } = getSession(self);
|
|
182
109
|
views.forEach(view => {
|
|
183
|
-
var _a;
|
|
184
|
-
|
|
185
|
-
(
|
|
110
|
+
var _a, _b;
|
|
111
|
+
(_a = view.setBookmarkHighlightsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
112
|
+
(_b = view.views) === null || _b === void 0 ? void 0 : _b.map(view => {
|
|
113
|
+
var _a;
|
|
114
|
+
(_a = view.setBookmarkHighlightsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
115
|
+
});
|
|
186
116
|
});
|
|
187
117
|
},
|
|
188
|
-
|
|
189
|
-
* #action
|
|
190
|
-
*/
|
|
191
|
-
setLabelToggle(toggle) {
|
|
118
|
+
setBookmarkLabelsVisible(arg) {
|
|
192
119
|
const { views } = getSession(self);
|
|
193
120
|
views.forEach(view => {
|
|
194
|
-
var _a;
|
|
195
|
-
|
|
196
|
-
(
|
|
121
|
+
var _a, _b;
|
|
122
|
+
(_a = view.setBookmarkLabelsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
123
|
+
(_b = view.views) === null || _b === void 0 ? void 0 : _b.map(view => {
|
|
124
|
+
var _a;
|
|
125
|
+
(_a = view.setBookmarkHighlightsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
126
|
+
});
|
|
197
127
|
});
|
|
198
128
|
},
|
|
199
129
|
}))
|
|
200
130
|
.actions(self => ({
|
|
201
|
-
/**
|
|
202
|
-
* #action
|
|
203
|
-
*/
|
|
204
131
|
clearAllBookmarks() {
|
|
205
132
|
self.setBookmarkedRegions(self.bookmarks.filter(bookmark => !self.validAssemblies.has(bookmark.assemblyName)));
|
|
206
133
|
},
|
|
207
|
-
/**
|
|
208
|
-
* #action
|
|
209
|
-
*/
|
|
210
134
|
clearSelectedBookmarks() {
|
|
211
135
|
for (const bookmark of self.selectedBookmarks) {
|
|
212
136
|
self.bookmarks.remove(bookmark.correspondingObj);
|
|
@@ -3,4 +3,4 @@ export declare function shareSessionToDynamo(session: unknown, url: string, refe
|
|
|
3
3
|
encryptedSession: string;
|
|
4
4
|
password: string;
|
|
5
5
|
}>;
|
|
6
|
-
export declare function readSessionFromDynamo(baseUrl: string, sessionQueryParam: string, password: string
|
|
6
|
+
export declare function readSessionFromDynamo(baseUrl: string, sessionQueryParam: string, password: string): Promise<string>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
// duplicated from products/jbrowse-web/src/sessionSharing.ts ; could possibly be moved into a higher directory and shared between the two
|
|
2
1
|
import { toUrlSafeB64 } from './utils';
|
|
3
|
-
// from https://stackoverflow.com/questions/1349404/
|
|
4
2
|
function generateUID(length) {
|
|
5
3
|
return window
|
|
6
4
|
.btoa([...window.crypto.getRandomValues(new Uint8Array(length * 2))]
|
|
@@ -28,7 +26,6 @@ function getErrorMsg(err) {
|
|
|
28
26
|
return err;
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
|
-
// writes the encrypted session, current datetime, and referer to DynamoDB
|
|
32
29
|
export async function shareSessionToDynamo(session, url, referer) {
|
|
33
30
|
const sess = await toUrlSafeB64(JSON.stringify(session));
|
|
34
31
|
const password = generateUID(5);
|
|
@@ -53,15 +50,12 @@ export async function shareSessionToDynamo(session, url, referer) {
|
|
|
53
50
|
password,
|
|
54
51
|
};
|
|
55
52
|
}
|
|
56
|
-
export async function readSessionFromDynamo(baseUrl, sessionQueryParam, password
|
|
53
|
+
export async function readSessionFromDynamo(baseUrl, sessionQueryParam, password) {
|
|
57
54
|
const sessionId = sessionQueryParam.split('share-')[1];
|
|
58
55
|
const url = `${baseUrl}?sessionId=${encodeURIComponent(sessionId)}`;
|
|
59
|
-
const response = await fetch(url
|
|
60
|
-
signal,
|
|
61
|
-
});
|
|
56
|
+
const response = await fetch(url);
|
|
62
57
|
if (!response.ok) {
|
|
63
|
-
|
|
64
|
-
throw new Error(getErrorMsg(err));
|
|
58
|
+
throw new Error(getErrorMsg(await response.text()));
|
|
65
59
|
}
|
|
66
60
|
const json = await response.json();
|
|
67
61
|
return decrypt(json.session, password);
|
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { GridBookmarkModel } from './model';
|
|
2
|
+
import type { AbstractViewModel } from '@jbrowse/core/util/types';
|
|
3
3
|
export declare function navToBookmark(locString: string, assembly: string, views: AbstractViewModel[], model: GridBookmarkModel): Promise<void>;
|
|
4
4
|
export declare function downloadBookmarkFile(fileFormat: string, model: GridBookmarkModel): void;
|
|
5
|
-
/**
|
|
6
|
-
* Pad the end of a base64 string with "=" to make it valid
|
|
7
|
-
* @param b64 - unpadded b64 string
|
|
8
|
-
*/
|
|
9
5
|
export declare function b64PadSuffix(b64: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Decode and inflate a url-safe base64 to a string
|
|
12
|
-
* See {@link https://en.wikipedia.org/wiki/Base64#URL_applications}
|
|
13
|
-
* @param b64 - a base64 string to decode and inflate
|
|
14
|
-
*/
|
|
15
6
|
export declare function fromUrlSafeB64(b64: string): Promise<string>;
|
|
16
|
-
/**
|
|
17
|
-
* Compress and encode a string as url-safe base64
|
|
18
|
-
* See {@link https://en.wikipedia.org/wiki/Base64#URL_applications}
|
|
19
|
-
* @param str- a string to compress and encode
|
|
20
|
-
*/
|
|
21
7
|
export declare function toUrlSafeB64(str: string): Promise<string>;
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
+
import { assembleLocString, getSession } from '@jbrowse/core/util';
|
|
1
2
|
import { saveAs } from 'file-saver';
|
|
2
|
-
import { getSession, assembleLocString } from '@jbrowse/core/util';
|
|
3
3
|
export async function navToBookmark(locString, assembly, views, model) {
|
|
4
4
|
const session = getSession(model);
|
|
5
5
|
try {
|
|
6
|
-
// get the focused view
|
|
7
6
|
let view = views.find(view => view.id === session.focusedViewId);
|
|
8
|
-
// check if the focused view is the appropriate assembly, if not proceed
|
|
9
7
|
if ((view === null || view === void 0 ? void 0 : view.assemblyNames[0]) !== assembly) {
|
|
10
|
-
view = views.find(elt =>
|
|
11
|
-
// @ts-expect-error
|
|
12
|
-
elt.type === 'LinearGenomeView' && elt.assemblyNames[0] === assembly);
|
|
8
|
+
view = views.find(elt => elt.type === 'LinearGenomeView' && elt.assemblyNames[0] === assembly);
|
|
13
9
|
}
|
|
14
|
-
// if no view is opened of the selectedAssembly, open a new
|
|
15
|
-
// view with that assembly
|
|
16
10
|
if (!view) {
|
|
17
11
|
const newViewId = `${model.id}_${assembly}`;
|
|
18
12
|
view = session.addView('LinearGenomeView', {
|
|
@@ -55,7 +49,6 @@ export function downloadBookmarkFile(fileFormat, model) {
|
|
|
55
49
|
}
|
|
56
50
|
}
|
|
57
51
|
else {
|
|
58
|
-
// TSV
|
|
59
52
|
const fileHeader = 'chrom\tstart\tend\tlabel\tassembly_name\tcoord_range\n';
|
|
60
53
|
const fileContents = bookmarksToDownload
|
|
61
54
|
.map(bookmark => {
|
|
@@ -72,10 +65,6 @@ export function downloadBookmarkFile(fileFormat, model) {
|
|
|
72
65
|
saveAs(blob, fileName);
|
|
73
66
|
}
|
|
74
67
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Pad the end of a base64 string with "=" to make it valid
|
|
77
|
-
* @param b64 - unpadded b64 string
|
|
78
|
-
*/
|
|
79
68
|
export function b64PadSuffix(b64) {
|
|
80
69
|
let num = 0;
|
|
81
70
|
const mo = b64.length % 4;
|
|
@@ -94,11 +83,6 @@ export function b64PadSuffix(b64) {
|
|
|
94
83
|
}
|
|
95
84
|
return b64 + '='.repeat(num);
|
|
96
85
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Decode and inflate a url-safe base64 to a string
|
|
99
|
-
* See {@link https://en.wikipedia.org/wiki/Base64#URL_applications}
|
|
100
|
-
* @param b64 - a base64 string to decode and inflate
|
|
101
|
-
*/
|
|
102
86
|
export async function fromUrlSafeB64(b64) {
|
|
103
87
|
const originalB64 = b64PadSuffix(b64.replaceAll('-', '+').replaceAll('_', '/'));
|
|
104
88
|
const { toByteArray } = await import('base64-js');
|
|
@@ -107,11 +91,6 @@ export async function fromUrlSafeB64(b64) {
|
|
|
107
91
|
const inflated = inflate(bytes);
|
|
108
92
|
return new TextDecoder().decode(inflated);
|
|
109
93
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Compress and encode a string as url-safe base64
|
|
112
|
-
* See {@link https://en.wikipedia.org/wiki/Base64#URL_applications}
|
|
113
|
-
* @param str- a string to compress and encode
|
|
114
|
-
*/
|
|
115
94
|
export async function toUrlSafeB64(str) {
|
|
116
95
|
const bytes = new TextEncoder().encode(str);
|
|
117
96
|
const { deflate } = await import('pako');
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
3
3
|
export default class GridBookmarkPlugin extends Plugin {
|
|
4
4
|
name: string;
|
|
5
5
|
install(pluginManager: PluginManager): void;
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
2
|
import { getSession, isAbstractMenuManager, isSessionModelWithWidgets, } from '@jbrowse/core/util';
|
|
3
|
-
// icons
|
|
4
3
|
import BookmarkIcon from '@mui/icons-material/Bookmark';
|
|
5
4
|
import BookmarksIcon from '@mui/icons-material/Bookmarks';
|
|
6
5
|
import HighlightIcon from '@mui/icons-material/Highlight';
|
|
@@ -19,31 +18,15 @@ export default class GridBookmarkPlugin extends Plugin {
|
|
|
19
18
|
const lgv = stateModel;
|
|
20
19
|
const newStateModel = lgv
|
|
21
20
|
.props({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* show the bookmark highlights on this track
|
|
25
|
-
*/
|
|
26
|
-
showBookmarkHighlights: true,
|
|
27
|
-
/**
|
|
28
|
-
* #property
|
|
29
|
-
* show the bookmark labels on this track
|
|
30
|
-
*/
|
|
31
|
-
showBookmarkLabels: true,
|
|
21
|
+
bookmarkHighlightsVisible: true,
|
|
22
|
+
bookmarkLabelsVisible: true,
|
|
32
23
|
})
|
|
33
24
|
.actions(self => ({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*/
|
|
37
|
-
toggleShowBookmarkHighlights(toggle) {
|
|
38
|
-
self.showBookmarkHighlights =
|
|
39
|
-
toggle !== undefined ? toggle : !self.showBookmarkHighlights;
|
|
25
|
+
setBookmarkHighlightsVisible(arg) {
|
|
26
|
+
self.bookmarkHighlightsVisible = arg;
|
|
40
27
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*/
|
|
44
|
-
toggleShowBookmarkLabels(toggle) {
|
|
45
|
-
self.showBookmarkLabels =
|
|
46
|
-
toggle !== undefined ? toggle : !self.showBookmarkLabels;
|
|
28
|
+
setBookmarkLabelsVisible(arg) {
|
|
29
|
+
self.bookmarkLabelsVisible = arg;
|
|
47
30
|
},
|
|
48
31
|
activateBookmarkWidget() {
|
|
49
32
|
const session = getSession(self);
|
|
@@ -110,18 +93,18 @@ export default class GridBookmarkPlugin extends Plugin {
|
|
|
110
93
|
label: 'Toggle bookmark highlights',
|
|
111
94
|
icon: HighlightIcon,
|
|
112
95
|
type: 'checkbox',
|
|
113
|
-
checked: self.
|
|
96
|
+
checked: self.bookmarkHighlightsVisible,
|
|
114
97
|
onClick: () => {
|
|
115
|
-
self.
|
|
98
|
+
self.setBookmarkHighlightsVisible(!self.bookmarkHighlightsVisible);
|
|
116
99
|
},
|
|
117
100
|
},
|
|
118
101
|
{
|
|
119
102
|
label: 'Toggle bookmark labels',
|
|
120
103
|
icon: LabelIcon,
|
|
121
104
|
type: 'checkbox',
|
|
122
|
-
checked: self.
|
|
105
|
+
checked: self.bookmarkLabelsVisible,
|
|
123
106
|
onClick: () => {
|
|
124
|
-
self.
|
|
107
|
+
self.setBookmarkLabelsVisible(!self.bookmarkLabelsVisible);
|
|
125
108
|
},
|
|
126
109
|
},
|
|
127
110
|
],
|
|
@@ -154,14 +137,12 @@ export default class GridBookmarkPlugin extends Plugin {
|
|
|
154
137
|
afterCreate() {
|
|
155
138
|
document.addEventListener('keydown', e => {
|
|
156
139
|
const activationSequence = (e.ctrlKey || e.metaKey) && e.shiftKey;
|
|
157
|
-
// ctrl+shift+d or cmd+shift+d
|
|
158
140
|
if (activationSequence && e.code === 'KeyD') {
|
|
159
141
|
e.preventDefault();
|
|
160
142
|
self.activateBookmarkWidget();
|
|
161
143
|
self.bookmarkCurrentRegion();
|
|
162
144
|
getSession(self).notify('Bookmark created.', 'success');
|
|
163
145
|
}
|
|
164
|
-
// ctrl+shift+m or cmd+shift+m
|
|
165
146
|
if (activationSequence && e.code === 'KeyM') {
|
|
166
147
|
e.preventDefault();
|
|
167
148
|
self.navigateNewestBookmark();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-grid-bookmark",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "JBrowse 2 grid bookmark widget",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"distModule": "esm/index.js",
|
|
60
60
|
"srcModule": "src/index.ts",
|
|
61
61
|
"module": "esm/index.js",
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "c344ea60099cb7e460b77f15808946b24a7eee74"
|
|
63
63
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { GridBookmarkModel, IExtendedLabeledRegionModel } from '../../model';
|
|
3
|
-
declare const EditBookmarkLabelDialog: ({ model, onClose, dialogRow, }: {
|
|
4
|
-
model: GridBookmarkModel;
|
|
5
|
-
dialogRow: IExtendedLabeledRegionModel;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
}) => React.JSX.Element;
|
|
8
|
-
export default EditBookmarkLabelDialog;
|