pdbe-molstar 3.7.1 → 3.8.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/build/pdbe-molstar-component.js +2 -2
- package/build/pdbe-molstar-light.css +2 -2
- package/build/pdbe-molstar-plugin.js +2 -2
- package/build/pdbe-molstar-plugin.js.LICENSE.txt +1 -1
- package/build/pdbe-molstar.css +2 -2
- package/lib/extensions/complexes/index.d.ts +1 -2
- package/lib/extensions/complexes/superpose-by-biggest-chain.js +1 -2
- package/lib/extensions/complexes/superpose-by-sequence-alignment.js +1 -2
- package/lib/helpers.d.ts +26 -14
- package/lib/helpers.js +4 -0
- package/lib/sequence-color/behavior.js +16 -11
- package/lib/sequence-color/color.d.ts +7 -3
- package/lib/sequence-color/color.js +69 -22
- package/lib/sequence-color/{prop.d.ts → sequence-color-annotations-prop.d.ts} +9 -5
- package/lib/sequence-color/{prop.js → sequence-color-annotations-prop.js} +15 -12
- package/lib/sequence-color/sequence-color-theme-prop.d.ts +46 -0
- package/lib/sequence-color/sequence-color-theme-prop.js +60 -0
- package/lib/spec.d.ts +7 -1
- package/lib/styles/pdbe-molstar/_index.scss +8 -3
- package/lib/superposition.js +0 -1
- package/lib/ui/layout-no-controls-unless-expanded.d.ts +1 -1
- package/lib/ui/layout-no-controls-unless-expanded.js +2 -2
- package/lib/ui/overlay.js +1 -1
- package/lib/ui/pdbe-viewport-controls.js +4 -1
- package/lib/viewer.d.ts +32 -2
- package/lib/viewer.js +74 -0
- package/package.json +3 -2
- package/lib/ui/_layout.d.ts +0 -15
- package/lib/ui/_layout.js +0 -162
package/lib/ui/_layout.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Layout = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const file_1 = require("molstar/lib/mol-plugin-state/actions/file");
|
|
6
|
-
const base_1 = require("molstar/lib/mol-plugin-ui/base");
|
|
7
|
-
const use_behavior_1 = require("molstar/lib/mol-plugin-ui/hooks/use-behavior");
|
|
8
|
-
const left_panel_1 = require("molstar/lib/mol-plugin-ui/left-panel");
|
|
9
|
-
const plugin_1 = require("molstar/lib/mol-plugin-ui/plugin");
|
|
10
|
-
const sequence_1 = require("molstar/lib/mol-plugin-ui/sequence");
|
|
11
|
-
const task_1 = require("molstar/lib/mol-plugin-ui/task");
|
|
12
|
-
const commands_1 = require("molstar/lib/mol-plugin/commands");
|
|
13
|
-
const assets_1 = require("molstar/lib/mol-util/assets");
|
|
14
|
-
const rxjs_1 = require("rxjs");
|
|
15
|
-
/** Copy of `Layout` in molstar/src/mol-plugin-ui/plugin.tsx, TODO export from core Molstar and remove here */
|
|
16
|
-
class Layout extends base_1.PluginUIComponent {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
this.onDrop = (ev) => {
|
|
20
|
-
ev.preventDefault();
|
|
21
|
-
const files = [];
|
|
22
|
-
if (ev.dataTransfer.items) {
|
|
23
|
-
// Use DataTransferItemList interface to access the file(s)
|
|
24
|
-
for (let i = 0; i < ev.dataTransfer.items.length; i++) { // eslint-disable-line @typescript-eslint/prefer-for-of
|
|
25
|
-
if (ev.dataTransfer.items[i].kind !== 'file')
|
|
26
|
-
continue;
|
|
27
|
-
const file = ev.dataTransfer.items[i].getAsFile();
|
|
28
|
-
if (file)
|
|
29
|
-
files.push(file);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
for (let i = 0; i < ev.dataTransfer.files.length; i++) { // eslint-disable-line @typescript-eslint/prefer-for-of
|
|
34
|
-
const file = ev.dataTransfer.files[i];
|
|
35
|
-
if (file)
|
|
36
|
-
files.push(file);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const sessions = files.filter(f => {
|
|
40
|
-
const fn = f.name.toLowerCase();
|
|
41
|
-
return fn.endsWith('.molx') || fn.endsWith('.molj');
|
|
42
|
-
});
|
|
43
|
-
if (sessions.length > 0) {
|
|
44
|
-
commands_1.PluginCommands.State.Snapshots.OpenFile(this.plugin, { file: sessions[0] });
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
this.plugin.runTask(this.plugin.state.data.applyAction(file_1.OpenFiles, {
|
|
48
|
-
files: files.map(f => assets_1.Asset.File(f)),
|
|
49
|
-
format: { name: 'auto', params: {} },
|
|
50
|
-
visuals: true,
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
this.onDragOver = (ev) => {
|
|
55
|
-
ev.preventDefault();
|
|
56
|
-
};
|
|
57
|
-
this.showDragOverlay = new rxjs_1.BehaviorSubject(false);
|
|
58
|
-
this.onDragEnter = (ev) => {
|
|
59
|
-
let hasFile = false;
|
|
60
|
-
if (ev.dataTransfer.items && ev.dataTransfer.items.length > 0) {
|
|
61
|
-
for (let i = 0; i < ev.dataTransfer.items.length; i++) { // eslint-disable-line @typescript-eslint/prefer-for-of
|
|
62
|
-
if (ev.dataTransfer.items[i].kind !== 'file')
|
|
63
|
-
continue;
|
|
64
|
-
hasFile = true;
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
for (let i = 0; i < ev.dataTransfer.types.length; i++) { // eslint-disable-line @typescript-eslint/prefer-for-of
|
|
70
|
-
if (ev.dataTransfer.types[i] !== 'Files')
|
|
71
|
-
continue;
|
|
72
|
-
hasFile = true;
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (hasFile) {
|
|
77
|
-
this.showDragOverlay.next(true);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
componentDidMount() {
|
|
82
|
-
this.subscribe(this.plugin.layout.events.updated, () => this.forceUpdate());
|
|
83
|
-
}
|
|
84
|
-
region(kind, Element) {
|
|
85
|
-
return (0, jsx_runtime_1.jsx)("div", { className: `msp-layout-region msp-layout-${kind}`, children: (0, jsx_runtime_1.jsx)("div", { className: 'msp-layout-static', children: Element ? (0, jsx_runtime_1.jsx)(Element, {}) : null }) });
|
|
86
|
-
}
|
|
87
|
-
get layoutVisibilityClassName() {
|
|
88
|
-
var _a, _b;
|
|
89
|
-
const layout = this.plugin.layout.state;
|
|
90
|
-
const controls = (_b = (_a = this.plugin.spec.components) === null || _a === void 0 ? void 0 : _a.controls) !== null && _b !== void 0 ? _b : {};
|
|
91
|
-
const classList = [];
|
|
92
|
-
if (controls.top === 'none' || !layout.showControls || layout.regionState.top === 'hidden') {
|
|
93
|
-
classList.push('msp-layout-hide-top');
|
|
94
|
-
}
|
|
95
|
-
if (controls.left === 'none' || !layout.showControls || layout.regionState.left === 'hidden') {
|
|
96
|
-
classList.push('msp-layout-hide-left');
|
|
97
|
-
}
|
|
98
|
-
else if (layout.regionState.left === 'collapsed') {
|
|
99
|
-
classList.push('msp-layout-collapse-left');
|
|
100
|
-
}
|
|
101
|
-
if (controls.right === 'none' || !layout.showControls || layout.regionState.right === 'hidden') {
|
|
102
|
-
classList.push('msp-layout-hide-right');
|
|
103
|
-
}
|
|
104
|
-
if (controls.bottom === 'none' || !layout.showControls || layout.regionState.bottom === 'hidden') {
|
|
105
|
-
classList.push('msp-layout-hide-bottom');
|
|
106
|
-
}
|
|
107
|
-
return classList.join(' ');
|
|
108
|
-
}
|
|
109
|
-
get layoutClassName() {
|
|
110
|
-
const layout = this.plugin.layout.state;
|
|
111
|
-
const classList = ['msp-plugin-content'];
|
|
112
|
-
if (layout.isExpanded) {
|
|
113
|
-
classList.push('msp-layout-expanded');
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
classList.push('msp-layout-standard', `msp-layout-standard-${layout.controlsDisplay}`);
|
|
117
|
-
}
|
|
118
|
-
return classList.join(' ');
|
|
119
|
-
}
|
|
120
|
-
render() {
|
|
121
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
122
|
-
const layout = this.plugin.layout.state;
|
|
123
|
-
const controls = ((_a = this.plugin.spec.components) === null || _a === void 0 ? void 0 : _a.controls) || {};
|
|
124
|
-
const viewport = ((_c = (_b = this.plugin.spec.components) === null || _b === void 0 ? void 0 : _b.viewport) === null || _c === void 0 ? void 0 : _c.view) || plugin_1.DefaultViewport;
|
|
125
|
-
const sequenceView = ((_e = (_d = this.plugin.spec.components) === null || _d === void 0 ? void 0 : _d.sequenceViewer) === null || _e === void 0 ? void 0 : _e.view) || sequence_1.SequenceView;
|
|
126
|
-
return (0, jsx_runtime_1.jsx)("div", { className: 'msp-plugin', children: (0, jsx_runtime_1.jsxs)("div", { className: this.layoutClassName, onDragEnter: this.onDragEnter, children: [(0, jsx_runtime_1.jsxs)("div", { className: this.layoutVisibilityClassName, children: [this.region('main', viewport), layout.showControls && controls.top !== 'none' && this.region('top', controls.top || sequenceView), layout.showControls && controls.left !== 'none' && this.region('left', controls.left || left_panel_1.LeftPanelControls), layout.showControls && controls.right !== 'none' && this.region('right', controls.right || plugin_1.ControlsWrapper), layout.showControls && controls.bottom !== 'none' && this.region('bottom', controls.bottom || plugin_1.Log)] }), !((_f = this.plugin.spec.components) === null || _f === void 0 ? void 0 : _f.hideTaskOverlay) && (0, jsx_runtime_1.jsx)(task_1.OverlayTaskProgress, {}), !((_g = this.plugin.spec.components) === null || _g === void 0 ? void 0 : _g.disableDragOverlay) && (0, jsx_runtime_1.jsx)(DragOverlay, { plugin: this.plugin, showDragOverlay: this.showDragOverlay })] }) });
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
exports.Layout = Layout;
|
|
130
|
-
function dropFiles(ev, plugin, showDragOverlay) {
|
|
131
|
-
ev.preventDefault();
|
|
132
|
-
ev.stopPropagation();
|
|
133
|
-
showDragOverlay.next(false);
|
|
134
|
-
const files = [];
|
|
135
|
-
if (ev.dataTransfer.items) {
|
|
136
|
-
// Use DataTransferItemList interface to access the file(s)
|
|
137
|
-
for (let i = 0; i < ev.dataTransfer.items.length; i++) { // eslint-disable-line @typescript-eslint/prefer-for-of
|
|
138
|
-
if (ev.dataTransfer.items[i].kind !== 'file')
|
|
139
|
-
continue;
|
|
140
|
-
const file = ev.dataTransfer.items[i].getAsFile();
|
|
141
|
-
if (file)
|
|
142
|
-
files.push(file);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
for (let i = 0; i < ev.dataTransfer.files.length; i++) { // eslint-disable-line @typescript-eslint/prefer-for-of
|
|
147
|
-
const file = ev.dataTransfer.files[i];
|
|
148
|
-
if (file)
|
|
149
|
-
files.push(file);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
plugin.managers.dragAndDrop.handle(files);
|
|
153
|
-
}
|
|
154
|
-
function DragOverlay({ plugin, showDragOverlay }) {
|
|
155
|
-
const show = (0, use_behavior_1.useBehavior)(showDragOverlay);
|
|
156
|
-
const preventDrag = (e) => {
|
|
157
|
-
e.dataTransfer.dropEffect = 'copy';
|
|
158
|
-
e.preventDefault();
|
|
159
|
-
e.stopPropagation();
|
|
160
|
-
};
|
|
161
|
-
return (0, jsx_runtime_1.jsx)("div", { className: 'msp-drag-drop-overlay', style: { display: show ? 'flex' : 'none' }, onDragEnter: preventDrag, onDragOver: preventDrag, onDragLeave: () => showDragOverlay.next(false), onDrop: e => dropFiles(e, plugin, showDragOverlay), children: "Load File(s)" });
|
|
162
|
-
}
|