@rivm-loculus-tools/sequence-editor 0.1.5 → 0.1.7
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/_chunks/EditorWorkerService.js +12 -11
- package/dist/_chunks/EditorWorkerService.js.map +1 -1
- package/dist/_chunks/SequenceEditor.js +362 -489
- package/dist/_chunks/SequenceEditor.js.map +1 -1
- package/dist/_chunks/SequenceEditorPageDrawer.js +160 -49577
- package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -1
- package/dist/_chunks/comlink.js +228 -0
- package/dist/_chunks/comlink.js.map +1 -0
- package/dist/_chunks/react.js +11 -0
- package/dist/_chunks/react.js.map +1 -0
- package/dist/_chunks/sequenceEditorStore.js +40 -273
- package/dist/_chunks/sequenceEditorStore.js.map +1 -1
- package/dist/assets/index-Dn92arD_.js +8 -0
- package/dist/assets/index-Dn92arD_.js.map +1 -0
- package/dist/classes/services/SequenceEditorEventBusService/index.js +16 -2
- package/dist/classes/services/SequenceEditorEventBusService/index.js.map +1 -0
- package/dist/classes/workers/EngineWorker/index.js +3 -2
- package/dist/classes/workers/EngineWorker/index.js.map +1 -1
- package/dist/components/app/App/index.js +15 -951
- package/dist/components/app/App/index.js.map +1 -1
- package/dist/components/pages/SequenceEditorErrorPage/index.js +6 -6
- package/dist/components/pages/SequenceEditorErrorPage/index.js.map +1 -1
- package/dist/components/pages/SequenceEditorMainPage/index.js +61 -2
- package/dist/components/pages/SequenceEditorMainPage/index.js.map +1 -0
- package/dist/components/ui/SequenceEditorPage/index.js +8 -8
- package/dist/components/ui/SequenceEditorPage/index.js.map +1 -1
- package/dist/components/ui/SequenceEditorPageHeader/index.js +60 -2
- package/dist/components/ui/SequenceEditorPageHeader/index.js.map +1 -0
- package/dist/components/ui/SequenceEditorSearchBar/index.js +27 -2
- package/dist/components/ui/SequenceEditorSearchBar/index.js.map +1 -0
- package/dist/constants/keyboard.js +1 -1
- package/dist/utils/EditorUtil/index.js +158 -150
- package/dist/utils/EditorUtil/index.js.map +1 -1
- package/package.json +44 -21
- package/dist/_chunks/Box.js +0 -6737
- package/dist/_chunks/Box.js.map +0 -1
- package/dist/_chunks/Close.js +0 -7
- package/dist/_chunks/Close.js.map +0 -1
- package/dist/_chunks/KeyboardArrowDown.js +0 -1023
- package/dist/_chunks/KeyboardArrowDown.js.map +0 -1
- package/dist/_chunks/Redo.js +0 -2559
- package/dist/_chunks/Redo.js.map +0 -1
- package/dist/_chunks/SequenceEditorEventBusService.js +0 -102
- package/dist/_chunks/SequenceEditorEventBusService.js.map +0 -1
- package/dist/_chunks/SequenceEditorMainPage.js +0 -552
- package/dist/_chunks/SequenceEditorMainPage.js.map +0 -1
- package/dist/_chunks/SequenceEditorPageHeader.js +0 -236
- package/dist/_chunks/SequenceEditorPageHeader.js.map +0 -1
- package/dist/_chunks/SequenceEditorSearchBar.js +0 -143
- package/dist/_chunks/SequenceEditorSearchBar.js.map +0 -1
- package/dist/_chunks/TestIdUtil.js +0 -4695
- package/dist/_chunks/TestIdUtil.js.map +0 -1
- package/dist/_chunks/TextField.js +0 -3083
- package/dist/_chunks/TextField.js.map +0 -1
- package/dist/_chunks/rolldown-runtime.js +0 -13
- package/dist/_chunks/sequence_editor.js +0 -517
- package/dist/_chunks/sequence_editor.js.map +0 -1
- package/dist/_chunks/withDialog.js +0 -289
- package/dist/_chunks/withDialog.js.map +0 -1
- package/dist/assets/index-C5rc-pJV.js +0 -8
- package/dist/assets/index-C5rc-pJV.js.map +0 -1
|
@@ -1,232 +1,105 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { KEYBOARD_SHORTCUTS as s } from "../constants/keyboard.js";
|
|
1
|
+
import { EDITOR_DIRECTION as e } from "../models/editor.js";
|
|
2
|
+
import { EDITOR_PATH_PROPERTIES_TYPE as t } from "../models/model.js";
|
|
3
|
+
import { DEFAULT_GRID_GEOMETRY as n, IUPAC_KEYS as r } from "../constants/editor.js";
|
|
4
|
+
import { SequenceEditorEventBusService as i } from "../classes/services/SequenceEditorEventBusService/index.js";
|
|
5
|
+
import { KEYBOARD_SHORTCUTS as a } from "../constants/keyboard.js";
|
|
7
6
|
import "../constants/index.js";
|
|
8
|
-
import { EditorUtil as
|
|
9
|
-
import { t as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { t as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.data = e;
|
|
21
|
-
}
|
|
22
|
-
next(e) {
|
|
23
|
-
let t = this.data;
|
|
24
|
-
this.data = e, this.subscriptions.forEach((n) => {
|
|
25
|
-
n(e, t);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
subscribe(e) {
|
|
29
|
-
return this.subscriptions.push(e), () => {
|
|
30
|
-
this.subscriptions = this.subscriptions.filter((t) => t !== e);
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
//#endregion
|
|
7
|
+
import { EditorUtil as o } from "../utils/EditorUtil/index.js";
|
|
8
|
+
import { t as s } from "./sequenceEditorStore.js";
|
|
9
|
+
import { t as c } from "./react.js";
|
|
10
|
+
import { SequenceEditorSearchBar as l } from "../components/ui/SequenceEditorSearchBar/index.js";
|
|
11
|
+
import { t as u } from "./EditorWorkerService.js";
|
|
12
|
+
import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
13
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
14
|
+
import { Box as v, TextField as y, darken as b, useTheme as x } from "@mui/material";
|
|
15
|
+
import { Subject as S } from "@gen-epix/ui-core/classes/Subject";
|
|
16
|
+
import { DevicePixelRatioService as C } from "@gen-epix/ui-core/classes/services/DevicePixelRatioService";
|
|
17
|
+
import { KeyboardShortcutService as w } from "@gen-epix/ui-core/classes/services/KeyboardShortcutService";
|
|
18
|
+
import { withDialog as T } from "@gen-epix/ui-core-components/hoc/withDialog";
|
|
35
19
|
//#region ../../../../node_modules/.pnpm/use-debounce@10.1.1_react@19.3.0/node_modules/use-debounce/dist/index.module.js
|
|
36
|
-
function
|
|
37
|
-
var i = this, a = (
|
|
38
|
-
|
|
39
|
-
var
|
|
20
|
+
function E(e, t, n, r) {
|
|
21
|
+
var i = this, a = m(null), o = m(0), s = m(0), c = m(null), l = m([]), u = m(), d = m(), h = m(e), g = m(!0), _ = m(), v = m();
|
|
22
|
+
h.current = e;
|
|
23
|
+
var y = typeof window < "u", b = !t && t !== 0 && y;
|
|
40
24
|
if (typeof e != "function") throw TypeError("Expected a function");
|
|
41
25
|
t = +t || 0;
|
|
42
|
-
var
|
|
26
|
+
var x = !!(n ||= {}).leading, S = !("trailing" in n) || !!n.trailing, C = !!n.flushOnExit && S, w = "maxWait" in n, T = "debounceOnServer" in n && !!n.debounceOnServer, E = w ? Math.max(+n.maxWait || 0, t) : null, D = p(function() {
|
|
43
27
|
var e = function(e) {
|
|
44
28
|
var t = l.current, n = u.current;
|
|
45
|
-
return l.current = u.current = null, o.current = e, s.current = s.current || e, d.current =
|
|
29
|
+
return l.current = u.current = null, o.current = e, s.current = s.current || e, d.current = h.current.apply(n, t);
|
|
46
30
|
}, n = function(e, t) {
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
if (!
|
|
31
|
+
b && cancelAnimationFrame(c.current), c.current = b ? requestAnimationFrame(e) : setTimeout(e, t);
|
|
32
|
+
}, f = function(e) {
|
|
33
|
+
if (!g.current) return !1;
|
|
50
34
|
var n = e - a.current;
|
|
51
|
-
return !a.current || n >= t || n < 0 ||
|
|
52
|
-
},
|
|
53
|
-
return c.current = null,
|
|
54
|
-
},
|
|
35
|
+
return !a.current || n >= t || n < 0 || w && e - o.current >= E;
|
|
36
|
+
}, p = function(t) {
|
|
37
|
+
return c.current = null, S && l.current ? e(t) : (l.current = u.current = null, d.current);
|
|
38
|
+
}, m = function e() {
|
|
55
39
|
var r = Date.now();
|
|
56
|
-
if (
|
|
57
|
-
if (
|
|
40
|
+
if (x && s.current === o.current && D(), f(r)) return p(r);
|
|
41
|
+
if (g.current) {
|
|
58
42
|
var i = t - (r - a.current);
|
|
59
|
-
n(e,
|
|
43
|
+
n(e, w ? Math.min(i, E - (r - o.current)) : i);
|
|
60
44
|
}
|
|
61
45
|
}, D = function() {
|
|
62
46
|
r && r({});
|
|
63
47
|
}, O = function() {
|
|
64
|
-
if (
|
|
65
|
-
var r, s = Date.now(),
|
|
66
|
-
if (l.current = [].slice.call(arguments), u.current = i, a.current = s,
|
|
67
|
-
globalThis.document?.visibilityState === "hidden" &&
|
|
68
|
-
}, (r = globalThis.document) == null || r.addEventListener == null || r.addEventListener("visibilitychange",
|
|
69
|
-
if (!c.current &&
|
|
70
|
-
if (
|
|
48
|
+
if (y || T) {
|
|
49
|
+
var r, s = Date.now(), p = f(s);
|
|
50
|
+
if (l.current = [].slice.call(arguments), u.current = i, a.current = s, C && !_.current && (_.current = function() {
|
|
51
|
+
globalThis.document?.visibilityState === "hidden" && v.current.flush();
|
|
52
|
+
}, (r = globalThis.document) == null || r.addEventListener == null || r.addEventListener("visibilitychange", _.current)), p) {
|
|
53
|
+
if (!c.current && g.current) return o.current = a.current, n(m, t), x ? e(a.current) : d.current;
|
|
54
|
+
if (w) return n(m, t), e(a.current);
|
|
71
55
|
}
|
|
72
|
-
return c.current || n(
|
|
56
|
+
return c.current || n(m, t), d.current;
|
|
73
57
|
}
|
|
74
58
|
};
|
|
75
59
|
return O.cancel = function() {
|
|
76
60
|
var e = c.current;
|
|
77
|
-
e && (
|
|
61
|
+
e && (b ? cancelAnimationFrame(c.current) : clearTimeout(c.current)), o.current = 0, l.current = a.current = u.current = c.current = null, e && r && r({});
|
|
78
62
|
}, O.isPending = function() {
|
|
79
63
|
return !!c.current;
|
|
80
64
|
}, O.flush = function() {
|
|
81
|
-
return c.current ?
|
|
65
|
+
return c.current ? p(Date.now()) : d.current;
|
|
82
66
|
}, O;
|
|
83
67
|
}, [
|
|
84
|
-
v,
|
|
85
|
-
S,
|
|
86
|
-
t,
|
|
87
|
-
w,
|
|
88
|
-
y,
|
|
89
68
|
x,
|
|
90
|
-
|
|
91
|
-
|
|
69
|
+
w,
|
|
70
|
+
t,
|
|
71
|
+
E,
|
|
72
|
+
S,
|
|
92
73
|
C,
|
|
74
|
+
b,
|
|
75
|
+
y,
|
|
76
|
+
T,
|
|
93
77
|
r
|
|
94
78
|
]);
|
|
95
|
-
return
|
|
96
|
-
return
|
|
79
|
+
return v.current = D, f(function() {
|
|
80
|
+
return g.current = !0, function() {
|
|
97
81
|
var e;
|
|
98
|
-
|
|
82
|
+
C && v.current.flush(), _.current &&= ((e = globalThis.document) == null || e.removeEventListener == null || e.removeEventListener("visibilitychange", _.current), null), g.current = !1;
|
|
99
83
|
};
|
|
100
|
-
}, [
|
|
84
|
+
}, [C]), D;
|
|
101
85
|
}
|
|
102
86
|
//#endregion
|
|
103
|
-
//#region
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return this.document ? this.document.body : null;
|
|
108
|
-
}
|
|
109
|
-
get document() {
|
|
110
|
-
return this.window ? this.window.document : null;
|
|
111
|
-
}
|
|
112
|
-
get window() {
|
|
113
|
-
return globalThis;
|
|
114
|
-
}
|
|
115
|
-
constructor() {}
|
|
116
|
-
static getInstance() {
|
|
117
|
-
return e.__instance = a.getHmrSingleton("windowService", e.__instance, () => new e()), e.__instance;
|
|
118
|
-
}
|
|
119
|
-
}, w = class {
|
|
120
|
-
get data() {
|
|
121
|
-
return this.subject.data;
|
|
122
|
-
}
|
|
123
|
-
subject;
|
|
124
|
-
constructor(e) {
|
|
125
|
-
this.subject = e;
|
|
126
|
-
}
|
|
127
|
-
next(e) {
|
|
128
|
-
return this.subject.next(e);
|
|
129
|
-
}
|
|
130
|
-
subscribe(e) {
|
|
131
|
-
return this.subject.subscribe(e);
|
|
132
|
-
}
|
|
133
|
-
}, T = class e extends w {
|
|
134
|
-
static __instance;
|
|
135
|
-
constructor() {
|
|
136
|
-
super(new x(C.getInstance().window.devicePixelRatio));
|
|
137
|
-
let e = () => {
|
|
138
|
-
let t = C.getInstance().window, n = t.matchMedia(`(resolution: ${t.devicePixelRatio}dppx)`), r = () => {
|
|
139
|
-
this.subject.next(t.devicePixelRatio), n.removeEventListener("change", r), e();
|
|
140
|
-
};
|
|
141
|
-
n.addEventListener("change", r);
|
|
142
|
-
};
|
|
143
|
-
e();
|
|
144
|
-
}
|
|
145
|
-
static getInstance() {
|
|
146
|
-
return e.__instance = a.getHmrSingleton("devicePixelRatioService", e.__instance, () => new e()), e.__instance;
|
|
147
|
-
}
|
|
148
|
-
}, E = [
|
|
149
|
-
"form",
|
|
150
|
-
"input",
|
|
151
|
-
"label",
|
|
152
|
-
"select",
|
|
153
|
-
"textarea",
|
|
154
|
-
"button",
|
|
155
|
-
"fieldset",
|
|
156
|
-
"legend",
|
|
157
|
-
"datalist",
|
|
158
|
-
"output",
|
|
159
|
-
"option",
|
|
160
|
-
"optgroup"
|
|
161
|
-
], D = [
|
|
162
|
-
"Alt",
|
|
163
|
-
"AltGraph",
|
|
164
|
-
"Control",
|
|
165
|
-
"Meta",
|
|
166
|
-
"Shift"
|
|
167
|
-
], O = class e {
|
|
168
|
-
static __instance;
|
|
169
|
-
configs = [];
|
|
170
|
-
constructor() {
|
|
171
|
-
window.addEventListener("keydown", this.handleWindowKeyDown);
|
|
172
|
-
}
|
|
173
|
-
static getInstance() {
|
|
174
|
-
return e.__instance = a.getHmrSingleton("keyboardShortcutService", e.__instance, () => new e()), e.__instance;
|
|
175
|
-
}
|
|
176
|
-
static shouldIgnoreShortcut(e) {
|
|
177
|
-
let t = document.activeElement;
|
|
178
|
-
if (e?.contains(t)) return !1;
|
|
179
|
-
let n = t;
|
|
180
|
-
for (; n;) {
|
|
181
|
-
if (E.includes(n.tagName.toLowerCase())) return !0;
|
|
182
|
-
n = n.parentElement;
|
|
183
|
-
}
|
|
184
|
-
return !1;
|
|
185
|
-
}
|
|
186
|
-
registerShortcut({ callback: e, code: t, element: n, key: r, modifiers: i }) {
|
|
187
|
-
let a = {
|
|
188
|
-
callback: e,
|
|
189
|
-
code: t,
|
|
190
|
-
element: n,
|
|
191
|
-
key: r,
|
|
192
|
-
modifiers: i
|
|
193
|
-
};
|
|
194
|
-
return this.configs.push(a), (n ?? window).addEventListener("keydown", n ? this.handleElementKeyDown : this.handleWindowKeyDown), () => {
|
|
195
|
-
let e = this.configs.indexOf(a);
|
|
196
|
-
e !== -1 && (this.configs.splice(e, 1), this.configs.some((e) => e.element === n) || (n ?? window).removeEventListener("keydown", n ? this.handleElementKeyDown : this.handleWindowKeyDown));
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
handleElementKeyDown = (e) => {
|
|
200
|
-
this.handleKeyDown(e, e.currentTarget);
|
|
201
|
-
};
|
|
202
|
-
handleKeyDown = (t, n) => {
|
|
203
|
-
for (let r of this.configs) {
|
|
204
|
-
let { callback: i, code: a, key: o, modifiers: s } = r;
|
|
205
|
-
if (n === r.element && !(o && t.key !== o || a && t.code !== a) && (s?.length ? s : [[]]).some((e) => D.every((n) => e.includes(n) === t.getModifierState(n)))) {
|
|
206
|
-
if (e.shouldIgnoreShortcut(n)) return;
|
|
207
|
-
i(t);
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
handleWindowKeyDown = (e) => {
|
|
213
|
-
this.handleKeyDown(e, void 0);
|
|
214
|
-
};
|
|
215
|
-
}, k = u(), ee = () => {
|
|
216
|
-
let e = p(), t = d(l, (e) => e.latestMessage), n = d(l, (e) => e.meta), r = d(l, (e) => e.selection), i = (0, b.useMemo)(() => c.getStatusBarSelectionStats(r, n), [n, r]);
|
|
217
|
-
return /* @__PURE__ */ (0, k.jsx)(h, {
|
|
87
|
+
//#region src/components/ui/SequenceEditor/SequenceEditorStatusBar.tsx
|
|
88
|
+
var D = () => {
|
|
89
|
+
let e = x(), t = c(s, (e) => e.latestMessage), n = c(s, (e) => e.meta), r = c(s, (e) => e.selection), i = p(() => o.getStatusBarSelectionStats(r, n), [n, r]);
|
|
90
|
+
return /* @__PURE__ */ g(v, {
|
|
218
91
|
sx: {
|
|
219
|
-
backgroundColor:
|
|
220
|
-
borderTop: `1px solid ${
|
|
92
|
+
backgroundColor: b(e.palette.background.paper, .1),
|
|
93
|
+
borderTop: `1px solid ${b(e.palette.background.paper, .2)}`,
|
|
221
94
|
fontSize: e.typography.caption,
|
|
222
95
|
height: "100%",
|
|
223
96
|
width: "100%"
|
|
224
97
|
},
|
|
225
|
-
children: /* @__PURE__ */ (
|
|
98
|
+
children: /* @__PURE__ */ _(v, {
|
|
226
99
|
sx: {
|
|
227
100
|
"& > div": {
|
|
228
101
|
alignItems: "center",
|
|
229
|
-
borderLeft: `1px solid ${
|
|
102
|
+
borderLeft: `1px solid ${b(e.palette.background.paper, .2)}`,
|
|
230
103
|
display: "flex",
|
|
231
104
|
paddingLeft: e.spacing(1)
|
|
232
105
|
},
|
|
@@ -238,23 +111,23 @@ var C = class e {
|
|
|
238
111
|
paddingRight: e.spacing(1)
|
|
239
112
|
},
|
|
240
113
|
children: [
|
|
241
|
-
/* @__PURE__ */ (
|
|
242
|
-
/* @__PURE__ */ (
|
|
243
|
-
/* @__PURE__ */ (
|
|
244
|
-
/* @__PURE__ */ (
|
|
245
|
-
/* @__PURE__ */ (
|
|
246
|
-
/* @__PURE__ */ (
|
|
114
|
+
/* @__PURE__ */ g(v, { children: t ?? "" }),
|
|
115
|
+
/* @__PURE__ */ g(v, { children: `Pos: ${i.pos}` }),
|
|
116
|
+
/* @__PURE__ */ g(v, { children: `Selected seqs: ${i.selectedSeqs}` }),
|
|
117
|
+
/* @__PURE__ */ g(v, { children: `Cols: ${i.cols}` }),
|
|
118
|
+
/* @__PURE__ */ g(v, { children: `Total selected chars: ${i.totalSelectedChars}` }),
|
|
119
|
+
/* @__PURE__ */ g(v, { children: `Alignment: ${n?.alignmentWidth ?? "0"} sequences ${n?.sequenceCount ?? "0"} pos.` })
|
|
247
120
|
]
|
|
248
121
|
})
|
|
249
122
|
});
|
|
250
|
-
},
|
|
251
|
-
let [r, i] = (
|
|
252
|
-
(
|
|
123
|
+
}, O = /^(?:\d+|,\d+|\d+,\d+)$/, ee = T(({ onActionsChange: e, onClose: t, onGotoPosition: n }) => {
|
|
124
|
+
let [r, i] = h(""), a = m(null), o = r === "" || O.test(r);
|
|
125
|
+
f(() => {
|
|
253
126
|
a.current?.focus();
|
|
254
127
|
}, []);
|
|
255
|
-
let s = (
|
|
128
|
+
let s = d((e) => {
|
|
256
129
|
i(e.target.value);
|
|
257
|
-
}, []), c = (
|
|
130
|
+
}, []), c = d(() => {
|
|
258
131
|
if (!o) return;
|
|
259
132
|
let [e, i] = r.split(",");
|
|
260
133
|
n(e ? Number(e) : null, i ? Number(i) : null), t?.();
|
|
@@ -263,10 +136,10 @@ var C = class e {
|
|
|
263
136
|
t,
|
|
264
137
|
n,
|
|
265
138
|
r
|
|
266
|
-
]), l = (
|
|
139
|
+
]), l = d((e) => {
|
|
267
140
|
e.key === "Enter" && (e.preventDefault(), c());
|
|
268
141
|
}, [c]);
|
|
269
|
-
return (
|
|
142
|
+
return f(() => {
|
|
270
143
|
let n = [];
|
|
271
144
|
n.push({
|
|
272
145
|
color: "secondary",
|
|
@@ -285,7 +158,7 @@ var C = class e {
|
|
|
285
158
|
e,
|
|
286
159
|
t,
|
|
287
160
|
c
|
|
288
|
-
]), /* @__PURE__ */ (
|
|
161
|
+
]), /* @__PURE__ */ g(y, {
|
|
289
162
|
error: !o,
|
|
290
163
|
fullWidth: !0,
|
|
291
164
|
helperText: "Use x, ,y, or x,y.",
|
|
@@ -301,25 +174,25 @@ var C = class e {
|
|
|
301
174
|
fullWidth: !0,
|
|
302
175
|
maxWidth: "xs",
|
|
303
176
|
testId: "SequenceEditorGotoPositionDialog"
|
|
304
|
-
}),
|
|
305
|
-
let
|
|
177
|
+
}), k = () => {
|
|
178
|
+
let y = c(s, (e) => e.rawFasta), b = c(s, (e) => e.setLatestMessage), T = c(s, (e) => e.setMeta), O = c(s, (e) => e.setSelection), k = m(null), A = p(() => u.getInstance(), []), j = m(null), M = m(null), N = m(null), P = m(null), F = m(null), I = m(null), [L, te] = h({
|
|
306
179
|
height: 0,
|
|
307
180
|
width: 0
|
|
308
|
-
}), [
|
|
181
|
+
}), [ne, re] = h(() => C.getInstance().data), [ie, ae] = h(0), [oe, se] = h(0), R = p(() => new S({
|
|
309
182
|
scrollLeft: 0,
|
|
310
183
|
scrollTop: 0
|
|
311
|
-
}), []),
|
|
312
|
-
let e =
|
|
184
|
+
}), []), ce = m(L), z = p(() => new S(null), []), B = p(() => new S(null), []), V = m(null), H = m(null), U = p(() => new S(n), []), W = p(() => new S(null), []), G = m(null), K = m(0), q = m(null), J = m(!1), Y = x(), X = d(() => {
|
|
185
|
+
let e = U.data, t = z.data;
|
|
313
186
|
if (!e || !t) return;
|
|
314
187
|
let n = e.labelWidth + e.cellWidth + t.alignmentWidth * e.cellWidth, r = e.rulerHeight + t.sequenceCount * e.cellHeight;
|
|
315
|
-
|
|
316
|
-
}, [
|
|
317
|
-
let e = await
|
|
318
|
-
|
|
319
|
-
}, [
|
|
320
|
-
let e =
|
|
188
|
+
se(n), ae(r);
|
|
189
|
+
}, [U, z]), Z = d(async () => {
|
|
190
|
+
let e = await u.getInstance().getMetaData();
|
|
191
|
+
z.next(e);
|
|
192
|
+
}, [z]), Q = d(() => {
|
|
193
|
+
let e = U.data, t = z.data;
|
|
321
194
|
if (!t || !e) return;
|
|
322
|
-
let { scrollLeft: n, scrollTop: r } =
|
|
195
|
+
let { scrollLeft: n, scrollTop: r } = R.data, { height: i, width: a } = ce.current, s = o.getVisibleGridRange({
|
|
323
196
|
geometry: e,
|
|
324
197
|
numCols: t.alignmentWidth,
|
|
325
198
|
numRows: t.sequenceCount,
|
|
@@ -328,327 +201,327 @@ var C = class e {
|
|
|
328
201
|
viewportHeight: i,
|
|
329
202
|
viewportWidth: a
|
|
330
203
|
});
|
|
331
|
-
|
|
204
|
+
B.next({
|
|
332
205
|
geometry: e,
|
|
333
206
|
scrollLeft: n,
|
|
334
207
|
scrollTop: r,
|
|
335
208
|
viewportHeight: i,
|
|
336
209
|
viewportWidth: a,
|
|
337
|
-
visibleGridRange:
|
|
210
|
+
visibleGridRange: s
|
|
338
211
|
});
|
|
339
212
|
}, [
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
]),
|
|
345
|
-
|
|
213
|
+
U,
|
|
214
|
+
z,
|
|
215
|
+
R,
|
|
216
|
+
B
|
|
217
|
+
]), le = E((e, t) => {
|
|
218
|
+
te({
|
|
346
219
|
height: t,
|
|
347
220
|
width: e
|
|
348
221
|
});
|
|
349
222
|
}, 0, { trailing: !0 });
|
|
350
|
-
(
|
|
351
|
-
|
|
352
|
-
}, [
|
|
353
|
-
let
|
|
354
|
-
(
|
|
355
|
-
let e = [
|
|
356
|
-
|
|
357
|
-
}),
|
|
358
|
-
|
|
223
|
+
f(() => {
|
|
224
|
+
ce.current = L, Q();
|
|
225
|
+
}, [L, Q]);
|
|
226
|
+
let $ = L.width > 0 ? L.width / 2 : 120;
|
|
227
|
+
f(() => {
|
|
228
|
+
let e = [z.subscribe((e) => {
|
|
229
|
+
T(e);
|
|
230
|
+
}), W.subscribe((e) => {
|
|
231
|
+
O(e);
|
|
359
232
|
})];
|
|
360
233
|
return () => {
|
|
361
|
-
e.forEach((e) => e()),
|
|
234
|
+
e.forEach((e) => e()), b(null), T(null), O(null);
|
|
362
235
|
};
|
|
363
236
|
}, [
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
]), (
|
|
370
|
-
if (
|
|
371
|
-
let e =
|
|
372
|
-
e.labelWidth >
|
|
237
|
+
z,
|
|
238
|
+
W,
|
|
239
|
+
b,
|
|
240
|
+
T,
|
|
241
|
+
O
|
|
242
|
+
]), f(() => {
|
|
243
|
+
if (L.width <= 0) return;
|
|
244
|
+
let e = U.data;
|
|
245
|
+
e.labelWidth > $ && U.next({
|
|
373
246
|
...e,
|
|
374
|
-
labelWidth:
|
|
247
|
+
labelWidth: $
|
|
375
248
|
});
|
|
376
249
|
}, [
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
]), (
|
|
381
|
-
let e =
|
|
250
|
+
L.width,
|
|
251
|
+
U,
|
|
252
|
+
$
|
|
253
|
+
]), f(() => {
|
|
254
|
+
let e = I.current;
|
|
382
255
|
if (!e) return;
|
|
383
256
|
let t = new ResizeObserver(([e]) => {
|
|
384
257
|
if (!e) return;
|
|
385
258
|
let t = Math.max(1, e.contentRect.height), n = Math.max(1, e.contentRect.width);
|
|
386
|
-
|
|
259
|
+
le(n, t);
|
|
387
260
|
});
|
|
388
261
|
return t.observe(e), () => t.disconnect();
|
|
389
|
-
}, [
|
|
262
|
+
}, [A, le]), f(() => {
|
|
390
263
|
(async () => {
|
|
391
|
-
|
|
264
|
+
V.current = null, H.current = null, R.next({
|
|
392
265
|
scrollLeft: 0,
|
|
393
266
|
scrollTop: 0
|
|
394
|
-
}),
|
|
267
|
+
}), W.next(null), await A.initialize(), await A.loadFasta(y), await Z(), Q();
|
|
395
268
|
})().catch((e) => {
|
|
396
269
|
console.error(e);
|
|
397
270
|
});
|
|
398
271
|
}, [
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
]), (
|
|
272
|
+
A,
|
|
273
|
+
y,
|
|
274
|
+
R,
|
|
275
|
+
W,
|
|
276
|
+
Z,
|
|
277
|
+
Q
|
|
278
|
+
]), f(() => {
|
|
406
279
|
let e = null, t = !0, n = null, r = null, i = async () => {
|
|
407
|
-
if (t && !
|
|
408
|
-
|
|
280
|
+
if (t && !J.current) {
|
|
281
|
+
J.current = !0;
|
|
409
282
|
try {
|
|
410
|
-
for (; t &&
|
|
411
|
-
let i =
|
|
412
|
-
|
|
413
|
-
let a =
|
|
414
|
-
if (!
|
|
415
|
-
cachedGridRange:
|
|
283
|
+
for (; t && q.current;) {
|
|
284
|
+
let i = q.current;
|
|
285
|
+
q.current = null;
|
|
286
|
+
let a = K.current;
|
|
287
|
+
if (!H.current || !o.isWithinGridRange({
|
|
288
|
+
cachedGridRange: H.current.range,
|
|
416
289
|
visibleGridRange: i.visibleGridRange.visible
|
|
417
290
|
})) {
|
|
418
291
|
let e = [];
|
|
419
|
-
for (let t = i.visibleGridRange.cache.startRow; t <= i.visibleGridRange.cache.endRow; t++) e.push(await
|
|
292
|
+
for (let t = i.visibleGridRange.cache.startRow; t <= i.visibleGridRange.cache.endRow; t++) e.push(await A.name(t));
|
|
420
293
|
if (!t) return;
|
|
421
|
-
|
|
294
|
+
H.current = {
|
|
422
295
|
range: i.visibleGridRange.cache,
|
|
423
296
|
rowNames: e
|
|
424
297
|
};
|
|
425
298
|
}
|
|
426
|
-
if (!
|
|
427
|
-
cachedGridRange:
|
|
299
|
+
if (!V.current || !o.isWithinGridRange({
|
|
300
|
+
cachedGridRange: V.current.range,
|
|
428
301
|
visibleGridRange: i.visibleGridRange.visible
|
|
429
302
|
})) {
|
|
430
|
-
let e = await
|
|
303
|
+
let e = await u.getInstance().viewport({
|
|
431
304
|
endCol: i.visibleGridRange.cache.endCol,
|
|
432
305
|
endRow: i.visibleGridRange.cache.endRow,
|
|
433
306
|
startCol: i.visibleGridRange.cache.startCol,
|
|
434
307
|
startRow: i.visibleGridRange.cache.startRow
|
|
435
308
|
});
|
|
436
309
|
if (!t) return;
|
|
437
|
-
|
|
310
|
+
V.current = {
|
|
438
311
|
range: i.visibleGridRange.cache,
|
|
439
312
|
viewportResult: e
|
|
440
313
|
};
|
|
441
314
|
}
|
|
442
|
-
a ===
|
|
443
|
-
t && a ===
|
|
444
|
-
canvasElement:
|
|
445
|
-
devicePixelRatio:
|
|
315
|
+
a === K.current && (e !== null && cancelAnimationFrame(e), e = requestAnimationFrame(() => {
|
|
316
|
+
t && a === K.current && j.current && s.getState().nucleotidePalette && V.current && z.data && H.current && (M.current = o.drawCanvas({
|
|
317
|
+
canvasElement: j.current,
|
|
318
|
+
devicePixelRatio: C.getInstance().data,
|
|
446
319
|
geometry: i.geometry,
|
|
447
|
-
meta:
|
|
448
|
-
palette:
|
|
449
|
-
rowNames:
|
|
450
|
-
rowNamesStartRow:
|
|
320
|
+
meta: z.data,
|
|
321
|
+
palette: s.getState().nucleotidePalette,
|
|
322
|
+
rowNames: H.current.rowNames,
|
|
323
|
+
rowNamesStartRow: H.current.range.startRow,
|
|
451
324
|
scrollLeft: i.scrollLeft,
|
|
452
325
|
scrollTop: i.scrollTop,
|
|
453
326
|
searchResult: n,
|
|
454
327
|
searchResultHighlightedIndex: r,
|
|
455
|
-
selection:
|
|
456
|
-
viewport:
|
|
328
|
+
selection: W.data,
|
|
329
|
+
viewport: V.current.viewportResult,
|
|
457
330
|
viewportHeight: i.viewportHeight,
|
|
458
331
|
viewportWidth: i.viewportWidth
|
|
459
332
|
}));
|
|
460
333
|
}));
|
|
461
334
|
}
|
|
462
335
|
} finally {
|
|
463
|
-
|
|
336
|
+
J.current = !1, t && q.current && i();
|
|
464
337
|
}
|
|
465
338
|
}
|
|
466
|
-
}, a = [
|
|
339
|
+
}, a = [s.subscribe((e, t) => {
|
|
467
340
|
let i = !1;
|
|
468
|
-
e.searchResult !== t.searchResult && (n = e.searchResult, i = !0), e.searchResultHighlightedIndex !== t.searchResultHighlightedIndex && (r = e.searchResultHighlightedIndex,
|
|
469
|
-
geometry:
|
|
470
|
-
scrollContainer:
|
|
341
|
+
e.searchResult !== t.searchResult && (n = e.searchResult, i = !0), e.searchResultHighlightedIndex !== t.searchResultHighlightedIndex && (r = e.searchResultHighlightedIndex, o.scrollToSearchResult({
|
|
342
|
+
geometry: U.data,
|
|
343
|
+
scrollContainer: I.current,
|
|
471
344
|
searchResult: e.searchResult,
|
|
472
345
|
searchResultHighlightedIndex: e.searchResultHighlightedIndex
|
|
473
|
-
}), i = !0), i &&
|
|
474
|
-
}),
|
|
475
|
-
e && (
|
|
346
|
+
}), i = !0), i && Q();
|
|
347
|
+
}), B.subscribe((e) => {
|
|
348
|
+
e && (q.current = e, K.current += 1, i());
|
|
476
349
|
})];
|
|
477
350
|
return () => {
|
|
478
|
-
t = !1,
|
|
351
|
+
t = !1, q.current = null, e !== null && cancelAnimationFrame(e), K.current += 1, a.forEach((e) => e());
|
|
479
352
|
};
|
|
480
353
|
}, [
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
]), (
|
|
354
|
+
A,
|
|
355
|
+
U,
|
|
356
|
+
z,
|
|
357
|
+
W,
|
|
358
|
+
Q,
|
|
359
|
+
B
|
|
360
|
+
]), f(() => {
|
|
488
361
|
let e = [
|
|
489
|
-
|
|
490
|
-
e.nucleotidePalette?.name !== t.nucleotidePalette?.name &&
|
|
362
|
+
s.subscribe((e, t) => {
|
|
363
|
+
e.nucleotidePalette?.name !== t.nucleotidePalette?.name && Q();
|
|
491
364
|
}),
|
|
492
|
-
|
|
493
|
-
|
|
365
|
+
U.subscribe(() => {
|
|
366
|
+
X(), Q();
|
|
494
367
|
}),
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
e && (
|
|
368
|
+
R.subscribe(() => Q()),
|
|
369
|
+
z.subscribe((e) => {
|
|
370
|
+
e && (X(), Q());
|
|
498
371
|
}),
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
372
|
+
W.subscribe(() => Q()),
|
|
373
|
+
C.getInstance().subscribe((e) => {
|
|
374
|
+
re(e), X(), Q();
|
|
502
375
|
})
|
|
503
376
|
];
|
|
504
377
|
return () => {
|
|
505
378
|
e.forEach((e) => e());
|
|
506
379
|
};
|
|
507
380
|
}, [
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
]), (
|
|
381
|
+
A,
|
|
382
|
+
U,
|
|
383
|
+
z,
|
|
384
|
+
R,
|
|
385
|
+
W,
|
|
386
|
+
X,
|
|
387
|
+
Q
|
|
388
|
+
]), f(() => {
|
|
516
389
|
let e = (e) => {
|
|
517
390
|
let t = e.key.toUpperCase();
|
|
518
|
-
|
|
519
|
-
}, t = (e) =>
|
|
391
|
+
r.has(t) && (e.preventDefault(), i.getInstance().emit("onMutateSelection", t));
|
|
392
|
+
}, t = (e) => w.getInstance().registerShortcut({
|
|
520
393
|
callback: e.callback,
|
|
521
|
-
element:
|
|
394
|
+
element: F.current,
|
|
522
395
|
...e.shortcut
|
|
523
396
|
}), n = [
|
|
524
|
-
t(
|
|
525
|
-
t(
|
|
526
|
-
t(
|
|
527
|
-
t(
|
|
528
|
-
t(
|
|
529
|
-
t(
|
|
530
|
-
t(
|
|
531
|
-
t(
|
|
532
|
-
t(
|
|
533
|
-
t(
|
|
534
|
-
t(
|
|
535
|
-
t(
|
|
536
|
-
t(
|
|
537
|
-
t(
|
|
538
|
-
t(
|
|
539
|
-
t(
|
|
540
|
-
t(
|
|
541
|
-
t(
|
|
542
|
-
t(
|
|
543
|
-
t(
|
|
544
|
-
t(
|
|
545
|
-
t(
|
|
546
|
-
t(
|
|
547
|
-
t(
|
|
548
|
-
t(
|
|
549
|
-
|
|
397
|
+
t(a.expandSelectionLeft),
|
|
398
|
+
t(a.expandSelectionRight),
|
|
399
|
+
t(a.expandSelectionUp),
|
|
400
|
+
t(a.expandSelectionDown),
|
|
401
|
+
t(a.moveSelectionLeft),
|
|
402
|
+
t(a.moveSelectionRight),
|
|
403
|
+
t(a.moveSelectionUp),
|
|
404
|
+
t(a.moveSelectionDown),
|
|
405
|
+
t(a.moveRowUp),
|
|
406
|
+
t(a.moveRowDown),
|
|
407
|
+
t(a.moveRowToStart),
|
|
408
|
+
t(a.moveRowToEnd),
|
|
409
|
+
t(a.moveCellLeft),
|
|
410
|
+
t(a.moveCellRight),
|
|
411
|
+
t(a.scrollToLineStart),
|
|
412
|
+
t(a.scrollToLineEnd),
|
|
413
|
+
t(a.scrollPageUp),
|
|
414
|
+
t(a.scrollPageDown),
|
|
415
|
+
t(a.insertGap),
|
|
416
|
+
t(a.deleteBackward),
|
|
417
|
+
t(a.deleteSelection),
|
|
418
|
+
t(a.deleteBase),
|
|
419
|
+
t(a.undo),
|
|
420
|
+
t(a.redo),
|
|
421
|
+
t(a.gotoPosition),
|
|
422
|
+
w.getInstance().registerShortcut({
|
|
550
423
|
callback: e,
|
|
551
|
-
element:
|
|
424
|
+
element: F.current
|
|
552
425
|
}),
|
|
553
|
-
|
|
426
|
+
w.getInstance().registerShortcut({
|
|
554
427
|
callback: e,
|
|
555
|
-
element:
|
|
428
|
+
element: F.current,
|
|
556
429
|
modifiers: [["Shift"]]
|
|
557
430
|
})
|
|
558
431
|
];
|
|
559
432
|
return () => {
|
|
560
433
|
n.forEach((e) => e());
|
|
561
434
|
};
|
|
562
|
-
}, []), (
|
|
563
|
-
let
|
|
435
|
+
}, []), f(() => {
|
|
436
|
+
let t = async (e) => {
|
|
564
437
|
let { command: t, getSelectionPostCommand: n } = e;
|
|
565
438
|
try {
|
|
566
|
-
if (await t(),
|
|
439
|
+
if (await t(), V.current = null, H.current = null, await Z(), Q(), n) {
|
|
567
440
|
let e = n();
|
|
568
|
-
|
|
441
|
+
W.next(e), G.current = e;
|
|
569
442
|
}
|
|
570
443
|
} catch (e) {
|
|
571
444
|
console.error("Failed to post command:", e);
|
|
572
445
|
}
|
|
573
|
-
}, n = async (
|
|
574
|
-
if (!
|
|
575
|
-
let n =
|
|
576
|
-
n && await
|
|
577
|
-
for (let
|
|
446
|
+
}, n = async (e) => {
|
|
447
|
+
if (!z.data) return;
|
|
448
|
+
let n = o.getMutateArguments(W.data, z.data);
|
|
449
|
+
n && await t({ command: async () => {
|
|
450
|
+
for (let t = n.startCol; t <= n.endCol; t += 1) await A.mutate(n.rows, t, e);
|
|
578
451
|
} });
|
|
579
452
|
}, r = (e) => {
|
|
580
|
-
if (!
|
|
581
|
-
let t =
|
|
453
|
+
if (!z.data) return;
|
|
454
|
+
let t = o.getMovedSelection(W.data, e, z.data);
|
|
582
455
|
if (t) {
|
|
583
|
-
if (
|
|
584
|
-
let t =
|
|
585
|
-
|
|
586
|
-
} else
|
|
456
|
+
if (W.next(t), G.current) {
|
|
457
|
+
let t = o.getMovedSelection(G.current, e, z.data);
|
|
458
|
+
G.current = t;
|
|
459
|
+
} else G.current = t;
|
|
587
460
|
}
|
|
588
|
-
},
|
|
589
|
-
if (!
|
|
590
|
-
let t =
|
|
591
|
-
t &&
|
|
592
|
-
},
|
|
593
|
-
if (!
|
|
594
|
-
let r =
|
|
595
|
-
r && await
|
|
461
|
+
}, a = (e) => {
|
|
462
|
+
if (!z.data || !G.current || !W.data) return;
|
|
463
|
+
let t = o.getExpandedSelection(W.data, G.current, e, z.data);
|
|
464
|
+
t && W.next(t);
|
|
465
|
+
}, c = async (e) => {}, l = async (n) => {
|
|
466
|
+
if (!z.data) return;
|
|
467
|
+
let r = o.getRowsToMove(W.data, n, z.data);
|
|
468
|
+
r && await t({
|
|
596
469
|
command: async () => {
|
|
597
|
-
n ===
|
|
470
|
+
n === e.UP ? await A.moveRowsUp(r) : await A.moveRowsDown(r);
|
|
598
471
|
},
|
|
599
|
-
getSelectionPostCommand: () =>
|
|
472
|
+
getSelectionPostCommand: () => o.getMovedSelection(W.data, n, z.data)
|
|
600
473
|
});
|
|
601
|
-
}, u = async (e) => {}, d =
|
|
474
|
+
}, u = async (e) => {}, d = i.getInstance(), f = [
|
|
602
475
|
d.addEventListener("onSearch", async (e) => {
|
|
603
476
|
if (!e) return;
|
|
604
|
-
let t = await
|
|
605
|
-
|
|
477
|
+
let t = await A.search(e, !1);
|
|
478
|
+
s.getState().setSearchResult(t);
|
|
606
479
|
}),
|
|
607
|
-
d.addEventListener("onExpandSelection", (e) =>
|
|
608
|
-
d.addEventListener("onGotoPosition", () =>
|
|
480
|
+
d.addEventListener("onExpandSelection", (e) => a(e)),
|
|
481
|
+
d.addEventListener("onGotoPosition", () => k.current?.open({})),
|
|
609
482
|
d.addEventListener("onMoveSelection", (e) => r(e)),
|
|
610
483
|
d.addEventListener("onMoveRows", (e) => {
|
|
611
|
-
|
|
484
|
+
l(e);
|
|
612
485
|
}),
|
|
613
486
|
d.addEventListener("onMoveRowsEnd", (e) => {
|
|
614
|
-
|
|
487
|
+
c(e);
|
|
615
488
|
}),
|
|
616
489
|
d.addEventListener("onMoveCells", (e) => {
|
|
617
490
|
u(e);
|
|
618
491
|
}),
|
|
619
492
|
d.addEventListener("onScrollToLineStart", () => {
|
|
620
|
-
let e =
|
|
493
|
+
let e = I.current;
|
|
621
494
|
e && (e.scrollLeft = 0);
|
|
622
495
|
}),
|
|
623
496
|
d.addEventListener("onScrollToLineEnd", () => {
|
|
624
|
-
let e =
|
|
497
|
+
let e = I.current;
|
|
625
498
|
e && (e.scrollLeft = e.scrollWidth - e.clientWidth);
|
|
626
499
|
}),
|
|
627
500
|
d.addEventListener("onScrollPageUp", () => {
|
|
628
|
-
let e =
|
|
501
|
+
let e = I.current;
|
|
629
502
|
e && (e.scrollTop = Math.max(0, e.scrollTop - e.clientHeight));
|
|
630
503
|
}),
|
|
631
504
|
d.addEventListener("onScrollPageDown", () => {
|
|
632
|
-
let e =
|
|
505
|
+
let e = I.current;
|
|
633
506
|
e && (e.scrollTop = Math.min(e.scrollHeight - e.clientHeight, e.scrollTop + e.clientHeight));
|
|
634
507
|
}),
|
|
635
508
|
d.addEventListener("onInsert", () => {
|
|
636
509
|
(async () => {
|
|
637
|
-
if (!
|
|
638
|
-
let n =
|
|
639
|
-
n && await
|
|
640
|
-
command: async () =>
|
|
641
|
-
getSelectionPostCommand: () =>
|
|
510
|
+
if (!z.data) return;
|
|
511
|
+
let n = o.getUpsertArguments(W.data, z.data);
|
|
512
|
+
n && await t({
|
|
513
|
+
command: async () => A.insert(n.rows, n.col),
|
|
514
|
+
getSelectionPostCommand: () => o.getPostUpsertSelection(W.data, e.RIGHT)
|
|
642
515
|
});
|
|
643
516
|
})();
|
|
644
517
|
}),
|
|
645
518
|
d.addEventListener("onDeleteBackward", () => {
|
|
646
519
|
(async () => {
|
|
647
|
-
if (!
|
|
648
|
-
let n =
|
|
649
|
-
n && await
|
|
650
|
-
command: async () =>
|
|
651
|
-
getSelectionPostCommand: () =>
|
|
520
|
+
if (!z.data) return;
|
|
521
|
+
let n = o.getUpsertArguments(W.data, z.data, -1);
|
|
522
|
+
n && await t({
|
|
523
|
+
command: async () => A.delete(n.rows, n.col),
|
|
524
|
+
getSelectionPostCommand: () => o.getPostUpsertSelection(W.data, e.LEFT)
|
|
652
525
|
});
|
|
653
526
|
})();
|
|
654
527
|
}),
|
|
@@ -656,14 +529,14 @@ var C = class e {
|
|
|
656
529
|
n(e);
|
|
657
530
|
}),
|
|
658
531
|
d.addEventListener("onUndo", () => {
|
|
659
|
-
|
|
660
|
-
command: async () =>
|
|
532
|
+
t({
|
|
533
|
+
command: async () => A.undo(),
|
|
661
534
|
getSelectionPostCommand: () => null
|
|
662
535
|
});
|
|
663
536
|
}),
|
|
664
537
|
d.addEventListener("onRedo", () => {
|
|
665
|
-
|
|
666
|
-
command: async () =>
|
|
538
|
+
t({
|
|
539
|
+
command: async () => A.redo(),
|
|
667
540
|
getSelectionPostCommand: () => null
|
|
668
541
|
});
|
|
669
542
|
})
|
|
@@ -672,113 +545,113 @@ var C = class e {
|
|
|
672
545
|
f.forEach((e) => e());
|
|
673
546
|
};
|
|
674
547
|
}, [
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
]), (
|
|
681
|
-
|
|
682
|
-
}, [
|
|
683
|
-
let
|
|
548
|
+
A,
|
|
549
|
+
W,
|
|
550
|
+
Z,
|
|
551
|
+
Q,
|
|
552
|
+
z
|
|
553
|
+
]), f(() => {
|
|
554
|
+
Q();
|
|
555
|
+
}, [Q]);
|
|
556
|
+
let ue = d((e) => {
|
|
684
557
|
let t = e.currentTarget;
|
|
685
|
-
|
|
558
|
+
R.next({
|
|
686
559
|
scrollLeft: t.scrollLeft,
|
|
687
560
|
scrollTop: t.scrollTop
|
|
688
561
|
});
|
|
689
|
-
}, [
|
|
690
|
-
|
|
691
|
-
let
|
|
562
|
+
}, [R]), de = d((e) => {
|
|
563
|
+
F.current?.focus();
|
|
564
|
+
let n = e.currentTarget, r = n.getBoundingClientRect(), i = e.clientX >= r.left + n.clientWidth, a = e.clientY >= r.top + n.clientHeight;
|
|
692
565
|
if (i || a) return;
|
|
693
|
-
let
|
|
694
|
-
if (!
|
|
695
|
-
let u =
|
|
696
|
-
canvas:
|
|
566
|
+
let s = j.current, c = M.current, l = C.getInstance().data;
|
|
567
|
+
if (!s || !c) return;
|
|
568
|
+
let u = o.getPathPropertiesFromCanvas({
|
|
569
|
+
canvas: s,
|
|
697
570
|
devicePixelRatio: l,
|
|
698
|
-
editorAssembly:
|
|
571
|
+
editorAssembly: c,
|
|
699
572
|
event: e.nativeEvent
|
|
700
573
|
});
|
|
701
574
|
if (u) {
|
|
702
|
-
if (u.type !==
|
|
703
|
-
if (u.type ===
|
|
704
|
-
let t =
|
|
705
|
-
if (e.preventDefault(),
|
|
706
|
-
|
|
575
|
+
if (u.type !== t.DIVIDER) {
|
|
576
|
+
if (u.type === t.LABEL && (e.metaKey || e.ctrlKey)) {
|
|
577
|
+
let t = W.data?.rows ?? [], n = t.includes(u.row) ? t.filter((e) => e !== u.row) : [...t, u.row].sort((e, t) => e - t);
|
|
578
|
+
if (e.preventDefault(), P.current = null, n.length === 0) {
|
|
579
|
+
W.next(null), G.current = null;
|
|
707
580
|
return;
|
|
708
581
|
}
|
|
709
|
-
|
|
582
|
+
W.next({ rows: n }), G.current = { rows: n };
|
|
710
583
|
return;
|
|
711
584
|
}
|
|
712
|
-
let
|
|
585
|
+
let n = o.getSelectionFromPathProperties({
|
|
713
586
|
endPath: u,
|
|
714
587
|
startPath: u
|
|
715
588
|
});
|
|
716
|
-
if (!
|
|
717
|
-
e.preventDefault(),
|
|
589
|
+
if (!n) return;
|
|
590
|
+
e.preventDefault(), P.current = u, W.next(n), G.current = n;
|
|
718
591
|
return;
|
|
719
592
|
}
|
|
720
|
-
e.preventDefault(),
|
|
721
|
-
startLabelWidth:
|
|
593
|
+
e.preventDefault(), P.current = null, N.current = {
|
|
594
|
+
startLabelWidth: U.data.labelWidth,
|
|
722
595
|
startX: e.clientX
|
|
723
596
|
};
|
|
724
597
|
}
|
|
725
|
-
}, [
|
|
726
|
-
let
|
|
727
|
-
if (!r || !
|
|
598
|
+
}, [U, W]), fe = d((e) => {
|
|
599
|
+
let n = j.current, r = F.current, i = C.getInstance().data, a = N.current;
|
|
600
|
+
if (!r || !n) return;
|
|
728
601
|
if (a) {
|
|
729
|
-
let t = Math.min(
|
|
730
|
-
|
|
731
|
-
...
|
|
602
|
+
let t = Math.min($, Math.max(120, a.startLabelWidth + e.clientX - a.startX));
|
|
603
|
+
U.next({
|
|
604
|
+
...U.data,
|
|
732
605
|
labelWidth: t
|
|
733
606
|
}), r.style.cursor = "col-resize";
|
|
734
607
|
return;
|
|
735
608
|
}
|
|
736
|
-
let
|
|
737
|
-
if (
|
|
738
|
-
let
|
|
739
|
-
if (!
|
|
740
|
-
let r =
|
|
741
|
-
canvas:
|
|
609
|
+
let s = P.current;
|
|
610
|
+
if (s) {
|
|
611
|
+
let t = M.current;
|
|
612
|
+
if (!t) return;
|
|
613
|
+
let r = o.getPathPropertiesFromCanvas({
|
|
614
|
+
canvas: n,
|
|
742
615
|
devicePixelRatio: i,
|
|
743
|
-
editorAssembly:
|
|
616
|
+
editorAssembly: t,
|
|
744
617
|
event: e.nativeEvent
|
|
745
618
|
});
|
|
746
619
|
if (!r) return;
|
|
747
|
-
let a =
|
|
620
|
+
let a = o.getSelectionFromPathProperties({
|
|
748
621
|
endPath: r,
|
|
749
|
-
startPath:
|
|
622
|
+
startPath: s
|
|
750
623
|
});
|
|
751
|
-
a && (
|
|
624
|
+
a && (W.next(a), G.current = a);
|
|
752
625
|
return;
|
|
753
626
|
}
|
|
754
|
-
let
|
|
755
|
-
if (!
|
|
756
|
-
let l =
|
|
757
|
-
canvas:
|
|
627
|
+
let c = M.current;
|
|
628
|
+
if (!c) return;
|
|
629
|
+
let l = o.getPathPropertiesFromCanvas({
|
|
630
|
+
canvas: n,
|
|
758
631
|
devicePixelRatio: i,
|
|
759
|
-
editorAssembly:
|
|
632
|
+
editorAssembly: c,
|
|
760
633
|
event: e.nativeEvent
|
|
761
634
|
});
|
|
762
635
|
if (!l) {
|
|
763
636
|
r.style.cursor = "default";
|
|
764
637
|
return;
|
|
765
638
|
}
|
|
766
|
-
l.type ===
|
|
639
|
+
l.type === t.DIVIDER ? r.style.cursor = "col-resize" : r.style.cursor = "default";
|
|
767
640
|
}, [
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
]),
|
|
772
|
-
|
|
773
|
-
}, []),
|
|
774
|
-
|
|
775
|
-
geometry:
|
|
776
|
-
scrollContainer:
|
|
641
|
+
U,
|
|
642
|
+
$,
|
|
643
|
+
W
|
|
644
|
+
]), pe = d(() => {
|
|
645
|
+
N.current = null, P.current = null;
|
|
646
|
+
}, []), me = d((e, t) => {
|
|
647
|
+
o.scrollToPosition({
|
|
648
|
+
geometry: U.data,
|
|
649
|
+
scrollContainer: I.current,
|
|
777
650
|
x: e,
|
|
778
651
|
y: t
|
|
779
652
|
});
|
|
780
|
-
}, [
|
|
781
|
-
return /* @__PURE__ */ (
|
|
653
|
+
}, [U]), he = Math.max(1, Math.floor(L.width * ne)), ge = Math.max(1, Math.floor(L.height * ne));
|
|
654
|
+
return /* @__PURE__ */ _(v, {
|
|
782
655
|
sx: {
|
|
783
656
|
display: "grid",
|
|
784
657
|
gridTemplateRows: "max-content auto",
|
|
@@ -787,23 +660,23 @@ var C = class e {
|
|
|
787
660
|
width: "100%"
|
|
788
661
|
},
|
|
789
662
|
children: [
|
|
790
|
-
/* @__PURE__ */ (
|
|
791
|
-
/* @__PURE__ */ (
|
|
792
|
-
onMouseUp:
|
|
793
|
-
ref:
|
|
663
|
+
/* @__PURE__ */ g(l, {}),
|
|
664
|
+
/* @__PURE__ */ _(v, {
|
|
665
|
+
onMouseUp: pe,
|
|
666
|
+
ref: F,
|
|
794
667
|
sx: {
|
|
795
|
-
height: `calc(100% - ${
|
|
796
|
-
marginBottom:
|
|
668
|
+
height: `calc(100% - ${Y.spacing(3)})`,
|
|
669
|
+
marginBottom: Y.spacing(3),
|
|
797
670
|
position: "relative",
|
|
798
671
|
width: "100%"
|
|
799
672
|
},
|
|
800
673
|
tabIndex: 0,
|
|
801
674
|
children: [
|
|
802
|
-
/* @__PURE__ */ (
|
|
803
|
-
onMouseDown:
|
|
804
|
-
onMouseMove:
|
|
805
|
-
onScroll:
|
|
806
|
-
ref:
|
|
675
|
+
/* @__PURE__ */ g(v, {
|
|
676
|
+
onMouseDown: de,
|
|
677
|
+
onMouseMove: fe,
|
|
678
|
+
onScroll: ue,
|
|
679
|
+
ref: I,
|
|
807
680
|
sx: {
|
|
808
681
|
height: "100%",
|
|
809
682
|
overflowX: "scroll",
|
|
@@ -812,49 +685,49 @@ var C = class e {
|
|
|
812
685
|
width: "100%",
|
|
813
686
|
zIndex: 1
|
|
814
687
|
},
|
|
815
|
-
children: /* @__PURE__ */ (
|
|
816
|
-
height: `${Math.max(
|
|
688
|
+
children: /* @__PURE__ */ g(v, { sx: {
|
|
689
|
+
height: `${Math.max(ie, L.height)}px`,
|
|
817
690
|
pointerEvents: "none",
|
|
818
|
-
width: `${Math.max(
|
|
691
|
+
width: `${Math.max(oe, L.width)}px`
|
|
819
692
|
} })
|
|
820
693
|
}),
|
|
821
|
-
/* @__PURE__ */ (
|
|
822
|
-
height:
|
|
823
|
-
ref:
|
|
694
|
+
/* @__PURE__ */ g("canvas", {
|
|
695
|
+
height: ge,
|
|
696
|
+
ref: j,
|
|
824
697
|
style: {
|
|
825
698
|
display: "block",
|
|
826
|
-
height: `${
|
|
699
|
+
height: `${L.height}px`,
|
|
827
700
|
imageRendering: "pixelated",
|
|
828
701
|
left: 0,
|
|
829
702
|
pointerEvents: "auto",
|
|
830
703
|
position: "absolute",
|
|
831
704
|
top: 0,
|
|
832
|
-
width: `${
|
|
705
|
+
width: `${L.width}px`,
|
|
833
706
|
zIndex: 0
|
|
834
707
|
},
|
|
835
|
-
width:
|
|
708
|
+
width: he
|
|
836
709
|
}),
|
|
837
|
-
/* @__PURE__ */ (
|
|
710
|
+
/* @__PURE__ */ g(v, {
|
|
838
711
|
sx: {
|
|
839
|
-
bottom:
|
|
840
|
-
height:
|
|
712
|
+
bottom: Y.spacing(-3),
|
|
713
|
+
height: Y.spacing(3),
|
|
841
714
|
left: 0,
|
|
842
715
|
position: "absolute",
|
|
843
716
|
width: "100%",
|
|
844
717
|
zIndex: 2
|
|
845
718
|
},
|
|
846
|
-
children: /* @__PURE__ */ (
|
|
719
|
+
children: /* @__PURE__ */ g(D, {})
|
|
847
720
|
})
|
|
848
721
|
]
|
|
849
722
|
}),
|
|
850
|
-
/* @__PURE__ */ (
|
|
851
|
-
onGotoPosition:
|
|
852
|
-
ref:
|
|
723
|
+
/* @__PURE__ */ g(ee, {
|
|
724
|
+
onGotoPosition: me,
|
|
725
|
+
ref: k
|
|
853
726
|
})
|
|
854
727
|
]
|
|
855
728
|
});
|
|
856
729
|
};
|
|
857
730
|
//#endregion
|
|
858
|
-
export {
|
|
731
|
+
export { k as t };
|
|
859
732
|
|
|
860
733
|
//# sourceMappingURL=SequenceEditor.js.map
|