@jbrowse/plugin-grid-bookmark 2.17.0 → 3.0.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 +2 -3
- package/dist/GridBookmarkWidget/components/AssemblySelector.js +10 -25
- package/dist/GridBookmarkWidget/components/BookmarkGrid.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/BookmarkGrid.js +52 -82
- package/dist/GridBookmarkWidget/components/GridBookmarkWidget.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/GridBookmarkWidget.js +90 -93
- package/dist/GridBookmarkWidget/components/Highlight/Highlight.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/Highlight/Highlight.js +34 -58
- package/dist/GridBookmarkWidget/components/Highlight/OverviewHighlight.d.ts +3 -4
- package/dist/GridBookmarkWidget/components/Highlight/OverviewHighlight.js +8 -31
- package/dist/GridBookmarkWidget/components/Highlight/index.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/Highlight/index.js +5 -10
- package/dist/GridBookmarkWidget/components/dialogs/DeleteBookmarksDialog.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/dialogs/DeleteBookmarksDialog.js +12 -23
- package/dist/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.js +12 -41
- package/dist/GridBookmarkWidget/components/dialogs/ExportBookmarksDialog.d.ts +3 -4
- package/dist/GridBookmarkWidget/components/dialogs/ExportBookmarksDialog.js +14 -47
- package/dist/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.js +10 -23
- package/dist/GridBookmarkWidget/components/dialogs/ImportBookmarksDialog.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/dialogs/ImportBookmarksDialog.js +39 -81
- package/dist/GridBookmarkWidget/components/dialogs/ShareBookmarksDialog.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/dialogs/ShareBookmarksDialog.js +19 -53
- package/dist/GridBookmarkWidget/index.d.ts +1 -1
- package/dist/GridBookmarkWidget/index.js +18 -9
- 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 +20 -16
- package/dist/GridBookmarkWidget/types.d.ts +1 -1
- package/dist/GridBookmarkWidget/utils.d.ts +2 -16
- package/dist/GridBookmarkWidget/utils.js +19 -30
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -29
- package/esm/GridBookmarkWidget/components/AssemblySelector.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/AssemblySelector.js +10 -22
- package/esm/GridBookmarkWidget/components/BookmarkGrid.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/BookmarkGrid.js +52 -59
- package/esm/GridBookmarkWidget/components/GridBookmarkWidget.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/GridBookmarkWidget.js +73 -86
- package/esm/GridBookmarkWidget/components/Highlight/Highlight.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/Highlight/Highlight.js +34 -35
- package/esm/GridBookmarkWidget/components/Highlight/OverviewHighlight.d.ts +3 -4
- package/esm/GridBookmarkWidget/components/Highlight/OverviewHighlight.js +8 -8
- package/esm/GridBookmarkWidget/components/Highlight/index.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/Highlight/index.js +5 -10
- package/esm/GridBookmarkWidget/components/dialogs/DeleteBookmarksDialog.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/dialogs/DeleteBookmarksDialog.js +12 -20
- package/esm/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.js +12 -18
- package/esm/GridBookmarkWidget/components/dialogs/ExportBookmarksDialog.d.ts +3 -4
- package/esm/GridBookmarkWidget/components/dialogs/ExportBookmarksDialog.js +14 -24
- package/esm/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.js +10 -20
- package/esm/GridBookmarkWidget/components/dialogs/ImportBookmarksDialog.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/dialogs/ImportBookmarksDialog.js +40 -59
- package/esm/GridBookmarkWidget/components/dialogs/ShareBookmarksDialog.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/dialogs/ShareBookmarksDialog.js +19 -30
- 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,41 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const ui_1 = require("@jbrowse/core/ui");
|
|
9
|
+
const Icons_1 = require("@jbrowse/core/ui/Icons");
|
|
10
|
+
const util_1 = require("@jbrowse/core/util");
|
|
11
|
+
const material_1 = require("@mui/material");
|
|
12
|
+
const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
|
|
30
13
|
const mobx_react_1 = require("mobx-react");
|
|
31
14
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
32
|
-
const material_1 = require("@mui/material");
|
|
33
15
|
const mui_1 = require("tss-react/mui");
|
|
34
|
-
const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
|
|
35
|
-
const util_1 = require("@jbrowse/core/util");
|
|
36
|
-
const ui_1 = require("@jbrowse/core/ui");
|
|
37
|
-
const Icons_1 = require("@jbrowse/core/ui/Icons");
|
|
38
|
-
// locals
|
|
39
16
|
const sessionSharing_1 = require("../../sessionSharing");
|
|
40
17
|
const useStyles = (0, mui_1.makeStyles)()(() => ({
|
|
41
18
|
flexItem: {
|
|
@@ -59,7 +36,6 @@ const ShareBookmarksDialog = (0, mobx_react_1.observer)(function ({ onClose, mod
|
|
|
59
36
|
? model.allBookmarksModel
|
|
60
37
|
: model.sharedBookmarksModel;
|
|
61
38
|
(0, react_1.useEffect)(() => {
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
63
39
|
;
|
|
64
40
|
(async () => {
|
|
65
41
|
try {
|
|
@@ -85,27 +61,17 @@ const ShareBookmarksDialog = (0, mobx_react_1.observer)(function ({ onClose, mod
|
|
|
85
61
|
}
|
|
86
62
|
})();
|
|
87
63
|
}, [bookmarksToShare, session]);
|
|
88
|
-
return (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const target = event.target;
|
|
101
|
-
target.select();
|
|
102
|
-
} })),
|
|
103
|
-
react_1.default.createElement(material_1.DialogContentText, null, "The URL should be pasted into the \"Import from share link\" field in the \"Import\" form found in the \"Bookmarked regions\" drawer.")),
|
|
104
|
-
react_1.default.createElement(material_1.DialogActions, null,
|
|
105
|
-
react_1.default.createElement(material_1.Button, { className: classes.flexItem, "data-testid": "dialogShare", variant: "contained", color: "primary", disabled: loading, startIcon: react_1.default.createElement(Icons_1.ContentCopy, null), onClick: async () => {
|
|
106
|
-
(0, copy_to_clipboard_1.default)(url);
|
|
107
|
-
session.notify('Copied to clipboard', 'success');
|
|
108
|
-
onClose();
|
|
109
|
-
} }, "Copy share link"))));
|
|
64
|
+
return ((0, jsx_runtime_1.jsxs)(ui_1.Dialog, { open: true, onClose: onClose, title: "Share bookmarks", children: [(0, jsx_runtime_1.jsxs)(material_1.DialogContent, { className: classes.content, children: [(0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "info", children: shareAll ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { children: "All bookmarks will be shared." }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("span", { children: "Use the checkboxes to select individual bookmarks to share." })] })) : ('Only selected bookmarks will be shared.') }), (0, jsx_runtime_1.jsx)(material_1.DialogContentText, { children: "Copy the URL below to share your bookmarks." }), error ? ((0, jsx_runtime_1.jsx)(ui_1.ErrorMessage, { error: error })) : loading ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { children: "Generating short URL..." })) : ((0, jsx_runtime_1.jsx)(material_1.TextField, { label: "URL", value: url, slotProps: {
|
|
65
|
+
input: {
|
|
66
|
+
readOnly: true,
|
|
67
|
+
},
|
|
68
|
+
}, variant: "filled", fullWidth: true, onClick: event => {
|
|
69
|
+
const target = event.target;
|
|
70
|
+
target.select();
|
|
71
|
+
} })), (0, jsx_runtime_1.jsx)(material_1.DialogContentText, { children: "The URL should be pasted into the \"Import from share link\" field in the \"Import\" form found in the \"Bookmarked regions\" drawer." })] }), (0, jsx_runtime_1.jsx)(material_1.DialogActions, { children: (0, jsx_runtime_1.jsx)(material_1.Button, { className: classes.flexItem, "data-testid": "dialogShare", variant: "contained", color: "primary", disabled: loading, startIcon: (0, jsx_runtime_1.jsx)(Icons_1.ContentCopy, {}), onClick: async () => {
|
|
72
|
+
(0, copy_to_clipboard_1.default)(url);
|
|
73
|
+
session.notify('Copied to clipboard', 'success');
|
|
74
|
+
onClose();
|
|
75
|
+
}, children: "Copy share link" }) })] }));
|
|
110
76
|
});
|
|
111
77
|
exports.default = ShareBookmarksDialog;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function GridBookmarkWidgetF(pluginManager: PluginManager): void;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -30,9 +40,8 @@ exports.default = GridBookmarkWidgetF;
|
|
|
30
40
|
const react_1 = require("react");
|
|
31
41
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
32
42
|
const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
|
|
33
|
-
// locals
|
|
34
|
-
const model_1 = __importDefault(require("./model"));
|
|
35
43
|
const Highlight_1 = __importDefault(require("./components/Highlight"));
|
|
44
|
+
const model_1 = __importDefault(require("./model"));
|
|
36
45
|
const configSchema = (0, configuration_1.ConfigurationSchema)('GridBookmarkWidget', {});
|
|
37
46
|
function GridBookmarkWidgetF(pluginManager) {
|
|
38
47
|
pluginManager.addWidgetType(() => {
|
|
@@ -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,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = f;
|
|
4
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
|
-
const mst_1 = require("@jbrowse/core/util/types/mst");
|
|
6
4
|
const util_1 = require("@jbrowse/core/util");
|
|
5
|
+
const mst_1 = require("@jbrowse/core/util/types/mst");
|
|
7
6
|
const mobx_1 = require("mobx");
|
|
7
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
8
8
|
const LabeledRegionModel = mobx_state_tree_1.types
|
|
9
9
|
.compose(mst_1.Region, mobx_state_tree_1.types.model('Label', {
|
|
10
10
|
label: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.string, ''),
|
|
@@ -24,24 +24,11 @@ const SharedBookmarksModel = mobx_state_tree_1.types.model('SharedBookmarksModel
|
|
|
24
24
|
const localStorageKeyF = () => typeof window !== 'undefined'
|
|
25
25
|
? `bookmarks-${[window.location.host + window.location.pathname].join('-')}`
|
|
26
26
|
: 'empty';
|
|
27
|
-
/**
|
|
28
|
-
* #stateModel GridBookmarkWidgetModel
|
|
29
|
-
*/
|
|
30
27
|
function f(_pluginManager) {
|
|
31
28
|
return mobx_state_tree_1.types
|
|
32
29
|
.model('GridBookmarkModel', {
|
|
33
|
-
/**
|
|
34
|
-
* #property
|
|
35
|
-
*/
|
|
36
30
|
id: mst_1.ElementId,
|
|
37
|
-
/**
|
|
38
|
-
* #property
|
|
39
|
-
*/
|
|
40
31
|
type: mobx_state_tree_1.types.literal('GridBookmarkWidget'),
|
|
41
|
-
/**
|
|
42
|
-
* #property
|
|
43
|
-
* removed by postProcessSnapshot, only loaded from localStorage
|
|
44
|
-
*/
|
|
45
32
|
bookmarks: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.array(LabeledRegionModel), () => JSON.parse((0, util_1.localStorageGetItem)(localStorageKeyF()) || '[]')),
|
|
46
33
|
})
|
|
47
34
|
.volatile(() => ({
|
|
@@ -49,167 +36,104 @@ function f(_pluginManager) {
|
|
|
49
36
|
selectedAssembliesPre: undefined,
|
|
50
37
|
}))
|
|
51
38
|
.views(self => ({
|
|
52
|
-
/**
|
|
53
|
-
* #getter
|
|
54
|
-
*/
|
|
55
39
|
get bookmarkAssemblies() {
|
|
56
40
|
return [...new Set(self.bookmarks.map(r => r.assemblyName))];
|
|
57
41
|
},
|
|
58
|
-
/**
|
|
59
|
-
* #getter
|
|
60
|
-
*/
|
|
61
42
|
get validAssemblies() {
|
|
62
43
|
const { assemblyManager } = (0, util_1.getSession)(self);
|
|
63
44
|
return new Set(this.bookmarkAssemblies.filter(a => assemblyManager.get(a)));
|
|
64
45
|
},
|
|
65
|
-
/**
|
|
66
|
-
* #getter
|
|
67
|
-
*/
|
|
68
46
|
get areBookmarksHighlightedOnAllOpenViews() {
|
|
69
47
|
const { views } = (0, util_1.getSession)(self);
|
|
70
|
-
return views.every(v => '
|
|
48
|
+
return views.every(v => 'bookmarkHighlightsVisible' in v ? v.bookmarkHighlightsVisible : true);
|
|
71
49
|
},
|
|
72
|
-
/**
|
|
73
|
-
* #getter
|
|
74
|
-
*/
|
|
75
50
|
get areBookmarksHighlightLabelsOnAllOpenViews() {
|
|
76
51
|
const { views } = (0, util_1.getSession)(self);
|
|
77
|
-
return views.every(v => '
|
|
52
|
+
return views.every(v => 'bookmarkLabelsVisible' in v ? v.bookmarkLabelsVisible : true);
|
|
78
53
|
},
|
|
79
54
|
}))
|
|
80
55
|
.views(self => ({
|
|
81
|
-
/**
|
|
82
|
-
* #getter
|
|
83
|
-
*/
|
|
84
56
|
get bookmarksWithValidAssemblies() {
|
|
85
57
|
return self.bookmarks.filter(e => self.validAssemblies.has(e.assemblyName));
|
|
86
58
|
},
|
|
87
59
|
}))
|
|
88
60
|
.views(self => ({
|
|
89
|
-
/**
|
|
90
|
-
* #getter
|
|
91
|
-
*/
|
|
92
61
|
get sharedBookmarksModel() {
|
|
93
|
-
// requires cloning bookmarks with JSON.stringify/parse to avoid duplicate
|
|
94
|
-
// reference to same object in the same state tree, will otherwise error
|
|
95
|
-
// when performing share
|
|
96
62
|
return SharedBookmarksModel.create({
|
|
97
63
|
sharedBookmarks: JSON.parse(JSON.stringify(self.selectedBookmarks)),
|
|
98
64
|
});
|
|
99
65
|
},
|
|
100
|
-
/**
|
|
101
|
-
* #getter
|
|
102
|
-
*/
|
|
103
66
|
get allBookmarksModel() {
|
|
104
|
-
// requires cloning bookmarks with JSON.stringify/parse to avoid duplicate
|
|
105
|
-
// reference to same object in the same state tree, will otherwise error
|
|
106
|
-
// when performing share
|
|
107
67
|
return SharedBookmarksModel.create({
|
|
108
68
|
sharedBookmarks: JSON.parse(JSON.stringify(self.bookmarksWithValidAssemblies)),
|
|
109
69
|
});
|
|
110
70
|
},
|
|
111
71
|
}))
|
|
112
72
|
.actions(self => ({
|
|
113
|
-
/**
|
|
114
|
-
* #action
|
|
115
|
-
*/
|
|
116
73
|
setSelectedAssemblies(assemblies) {
|
|
117
74
|
self.selectedAssembliesPre = assemblies;
|
|
118
75
|
},
|
|
119
76
|
}))
|
|
120
77
|
.views(self => ({
|
|
121
|
-
/**
|
|
122
|
-
* #getter
|
|
123
|
-
*/
|
|
124
78
|
get selectedAssemblies() {
|
|
125
79
|
var _a, _b;
|
|
126
80
|
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]);
|
|
127
81
|
},
|
|
128
82
|
}))
|
|
129
83
|
.actions(self => ({
|
|
130
|
-
/**
|
|
131
|
-
* #action
|
|
132
|
-
*/
|
|
133
84
|
importBookmarks(regions) {
|
|
134
85
|
self.bookmarks = (0, mobx_state_tree_1.cast)([...self.bookmarks, ...regions]);
|
|
135
86
|
},
|
|
136
|
-
/**
|
|
137
|
-
* #action
|
|
138
|
-
*/
|
|
139
87
|
addBookmark(region) {
|
|
140
88
|
self.bookmarks.push(region);
|
|
141
89
|
},
|
|
142
|
-
/**
|
|
143
|
-
* #action
|
|
144
|
-
*/
|
|
145
90
|
removeBookmark(index) {
|
|
146
91
|
self.bookmarks.splice(index, 1);
|
|
147
92
|
},
|
|
148
|
-
/**
|
|
149
|
-
* #action
|
|
150
|
-
*/
|
|
151
93
|
updateBookmarkLabel(bookmark, label) {
|
|
152
94
|
bookmark.correspondingObj.setLabel(label);
|
|
153
95
|
},
|
|
154
|
-
/**
|
|
155
|
-
* #action
|
|
156
|
-
*/
|
|
157
96
|
updateBookmarkHighlight(bookmark, color) {
|
|
158
97
|
bookmark.correspondingObj.setHighlight(color);
|
|
159
98
|
},
|
|
160
|
-
/**
|
|
161
|
-
* #action
|
|
162
|
-
*/
|
|
163
99
|
updateBulkBookmarkHighlights(color) {
|
|
164
100
|
self.selectedBookmarks.forEach(bookmark => {
|
|
165
101
|
this.updateBookmarkHighlight(bookmark, color);
|
|
166
102
|
});
|
|
167
103
|
},
|
|
168
|
-
/**
|
|
169
|
-
* #action
|
|
170
|
-
*/
|
|
171
104
|
setSelectedBookmarks(bookmarks) {
|
|
172
105
|
self.selectedBookmarks = bookmarks;
|
|
173
106
|
},
|
|
174
|
-
/**
|
|
175
|
-
* #action
|
|
176
|
-
*/
|
|
177
107
|
setBookmarkedRegions(regions) {
|
|
178
108
|
self.bookmarks = (0, mobx_state_tree_1.cast)(regions);
|
|
179
109
|
},
|
|
180
|
-
|
|
181
|
-
* #action
|
|
182
|
-
*/
|
|
183
|
-
setHighlightToggle(toggle) {
|
|
110
|
+
setBookmarkHighlightsVisible(arg) {
|
|
184
111
|
const { views } = (0, util_1.getSession)(self);
|
|
185
112
|
views.forEach(view => {
|
|
186
|
-
var _a;
|
|
187
|
-
|
|
188
|
-
(
|
|
113
|
+
var _a, _b;
|
|
114
|
+
(_a = view.setBookmarkHighlightsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
115
|
+
(_b = view.views) === null || _b === void 0 ? void 0 : _b.map(view => {
|
|
116
|
+
var _a;
|
|
117
|
+
(_a = view.setBookmarkHighlightsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
118
|
+
});
|
|
189
119
|
});
|
|
190
120
|
},
|
|
191
|
-
|
|
192
|
-
* #action
|
|
193
|
-
*/
|
|
194
|
-
setLabelToggle(toggle) {
|
|
121
|
+
setBookmarkLabelsVisible(arg) {
|
|
195
122
|
const { views } = (0, util_1.getSession)(self);
|
|
196
123
|
views.forEach(view => {
|
|
197
|
-
var _a;
|
|
198
|
-
|
|
199
|
-
(
|
|
124
|
+
var _a, _b;
|
|
125
|
+
(_a = view.setBookmarkLabelsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
126
|
+
(_b = view.views) === null || _b === void 0 ? void 0 : _b.map(view => {
|
|
127
|
+
var _a;
|
|
128
|
+
(_a = view.setBookmarkHighlightsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
129
|
+
});
|
|
200
130
|
});
|
|
201
131
|
},
|
|
202
132
|
}))
|
|
203
133
|
.actions(self => ({
|
|
204
|
-
/**
|
|
205
|
-
* #action
|
|
206
|
-
*/
|
|
207
134
|
clearAllBookmarks() {
|
|
208
135
|
self.setBookmarkedRegions(self.bookmarks.filter(bookmark => !self.validAssemblies.has(bookmark.assemblyName)));
|
|
209
136
|
},
|
|
210
|
-
/**
|
|
211
|
-
* #action
|
|
212
|
-
*/
|
|
213
137
|
clearSelectedBookmarks() {
|
|
214
138
|
for (const bookmark of self.selectedBookmarks) {
|
|
215
139
|
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>;
|
|
@@ -15,19 +15,27 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.shareSessionToDynamo = shareSessionToDynamo;
|
|
27
37
|
exports.readSessionFromDynamo = readSessionFromDynamo;
|
|
28
|
-
// duplicated from products/jbrowse-web/src/sessionSharing.ts ; could possibly be moved into a higher directory and shared between the two
|
|
29
38
|
const utils_1 = require("./utils");
|
|
30
|
-
// from https://stackoverflow.com/questions/1349404/
|
|
31
39
|
function generateUID(length) {
|
|
32
40
|
return window
|
|
33
41
|
.btoa([...window.crypto.getRandomValues(new Uint8Array(length * 2))]
|
|
@@ -55,7 +63,6 @@ function getErrorMsg(err) {
|
|
|
55
63
|
return err;
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
|
-
// writes the encrypted session, current datetime, and referer to DynamoDB
|
|
59
66
|
async function shareSessionToDynamo(session, url, referer) {
|
|
60
67
|
const sess = await (0, utils_1.toUrlSafeB64)(JSON.stringify(session));
|
|
61
68
|
const password = generateUID(5);
|
|
@@ -80,15 +87,12 @@ async function shareSessionToDynamo(session, url, referer) {
|
|
|
80
87
|
password,
|
|
81
88
|
};
|
|
82
89
|
}
|
|
83
|
-
async function readSessionFromDynamo(baseUrl, sessionQueryParam, password
|
|
90
|
+
async function readSessionFromDynamo(baseUrl, sessionQueryParam, password) {
|
|
84
91
|
const sessionId = sessionQueryParam.split('share-')[1];
|
|
85
92
|
const url = `${baseUrl}?sessionId=${encodeURIComponent(sessionId)}`;
|
|
86
|
-
const response = await fetch(url
|
|
87
|
-
signal,
|
|
88
|
-
});
|
|
93
|
+
const response = await fetch(url);
|
|
89
94
|
if (!response.ok) {
|
|
90
|
-
|
|
91
|
-
throw new Error(getErrorMsg(err));
|
|
95
|
+
throw new Error(getErrorMsg(await response.text()));
|
|
92
96
|
}
|
|
93
97
|
const json = await response.json();
|
|
94
98
|
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>;
|