@rivm-loculus-tools/sequence-editor 1.8.0 → 1.10.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/_chunks/EngineWorker.js +1 -1
- package/dist/_chunks/EngineWorker.js.map +1 -1
- package/dist/_chunks/SequenceEditor.js +328 -228
- package/dist/_chunks/SequenceEditor.js.map +1 -1
- package/dist/_chunks/SequenceEditorEventBusService.js +1 -1
- package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -1
- package/dist/_chunks/SequenceEditorPageDrawer.js +45 -41
- package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -1
- package/dist/_chunks/SequenceEditorPageHeader.js +68 -53
- package/dist/_chunks/SequenceEditorPageHeader.js.map +1 -1
- package/dist/_chunks/react.js +1 -1
- package/dist/_chunks/react.js.map +1 -1
- package/dist/_chunks/sequenceEditorStore.js +56 -60
- package/dist/_chunks/sequenceEditorStore.js.map +1 -1
- package/dist/_chunks/sequence_editor.js +8 -1
- package/dist/_chunks/sequence_editor.js.map +1 -1
- package/dist/assets/AlignerWorker-ag-D8qid.js +8 -0
- package/dist/assets/AlignerWorker-ag-D8qid.js.map +1 -0
- package/dist/assets/index-CN_G9YrF.js +8 -0
- package/dist/assets/index-CN_G9YrF.js.map +1 -0
- package/dist/classes/services/EditorWorkerService/EditorWorkerService.d.ts +29 -23
- package/dist/classes/services/EditorWorkerService/index.js +103 -92
- package/dist/classes/services/EditorWorkerService/index.js.map +1 -1
- package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +4 -0
- package/dist/classes/workers/EngineWorker/EngineWorker.d.ts +2 -0
- package/dist/classes/workers/EngineWorker/index.js +6 -0
- package/dist/classes/workers/EngineWorker/index.js.map +1 -1
- package/dist/components/app/SequenceEditorApp/index.js +4 -4
- package/dist/components/ui/SequenceEditorSearchBar/index.js +3 -3
- package/dist/components/ui/SequenceEditorSearchBar/index.js.map +1 -1
- package/dist/constants/keyboard.d.ts +2 -0
- package/dist/constants/keyboard.js +42 -5
- package/dist/constants/keyboard.js.map +1 -1
- package/dist/constants/palette.js +147 -147
- package/dist/models/config.models.d.ts +1 -0
- package/dist/models/editor.models.d.ts +2 -0
- package/dist/models/editor.models.js.map +1 -1
- package/dist/pages/SequenceEditorMainPage/index.js +17 -17
- package/dist/pages/SequenceEditorMainPage/index.js.map +1 -1
- package/dist/stores/sequenceEditorStore/sequenceEditorStore.d.ts +3 -3
- package/dist/utils/EditorUtil/EditorUtil.d.ts +3 -0
- package/dist/utils/EditorUtil/index.js +139 -102
- package/dist/utils/EditorUtil/index.js.map +1 -1
- package/package.json +15 -15
- package/dist/assets/AlignerWorker-Cf4trdzm.js +0 -8
- package/dist/assets/AlignerWorker-Cf4trdzm.js.map +0 -1
- package/dist/assets/index-YCKQaSTQ.js +0 -8
- package/dist/assets/index-YCKQaSTQ.js.map +0 -1
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import { t as e } from "./
|
|
2
|
-
import { t } from "
|
|
1
|
+
import { t as e } from "./react.js";
|
|
2
|
+
import { EditorWorkerService as t } from "../classes/services/EditorWorkerService/index.js";
|
|
3
3
|
import { DEFAULT_GRID_GEOMETRY as n, IUPAC_KEYS as r } from "../constants/editor.js";
|
|
4
4
|
import { t as i } from "./SequenceEditorEventBusService.js";
|
|
5
5
|
import { EDITOR_DIRECTION as a, EDITOR_PATH_PROPERTIES_TYPE as o } from "../models/editor.models.js";
|
|
6
6
|
import { KEYBOARD_SHORTCUTS as s } from "../constants/keyboard.js";
|
|
7
7
|
import "../constants/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { EditorUtil as c } from "../utils/EditorUtil/index.js";
|
|
9
|
+
import { t as l } from "./EngineErrorUtil.js";
|
|
10
|
+
import { t as u } from "./sequenceEditorStore.js";
|
|
11
11
|
import { SequenceEditorSearchBar as d } from "../components/ui/SequenceEditorSearchBar/index.js";
|
|
12
12
|
import { SequenceEditorRealignModal as f } from "../components/ui/SequenceEditorRealignModal/index.js";
|
|
13
13
|
import { useCallback as p, useEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
|
|
14
14
|
import { Box as v, CircularProgress as y, TextField as b, darken as x, useTheme as S } from "@mui/material";
|
|
15
15
|
import { container as C } from "tsyringe";
|
|
16
16
|
import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
17
|
+
import { useConfig as E } from "@rivm-loculus-tools/common-frontend/hooks/useConfig";
|
|
18
|
+
import { Subject as D } from "@gen-epix/ui-core/classes/Subject";
|
|
19
|
+
import { DevicePixelRatioService as O } from "@gen-epix/ui-core/classes/services/DevicePixelRatioService";
|
|
20
|
+
import { KeyboardShortcutService as ee } from "@gen-epix/ui-core/classes/services/KeyboardShortcutService";
|
|
21
|
+
import { ExportUtil as te } from "@rivm-loculus-tools/common-frontend/utils/ExportUtil";
|
|
22
|
+
import { UploadToLoculusModal as ne } from "@rivm-loculus-tools/common-frontend/components/loculus/UploadToLoculusModal";
|
|
23
|
+
import { WindowService as re } from "@gen-epix/ui-core/classes/services/WindowService";
|
|
22
24
|
import { withDialog as k } from "@gen-epix/ui-core-components/hoc/withDialog";
|
|
23
25
|
// ../../../../node_modules/.pnpm/use-debounce@10.1.1_react@19.3.1/node_modules/use-debounce/dist/index.module.js
|
|
24
|
-
function
|
|
26
|
+
function ie(e, t, n, r) {
|
|
25
27
|
var i = this, a = g(null), o = g(0), s = g(0), c = g(null), l = g([]), u = g(), d = g(), f = g(e), p = g(!0), _ = g(), v = g();
|
|
26
28
|
f.current = e;
|
|
27
29
|
var y = typeof window < "u", b = !t && t !== 0 && y;
|
|
@@ -88,13 +90,13 @@ function ne(e, t, n, r) {
|
|
|
88
90
|
}, [C]), D;
|
|
89
91
|
}
|
|
90
92
|
// src/components/ui/SequenceEditor/SequenceEditorStatusBar.tsx
|
|
91
|
-
var
|
|
92
|
-
let
|
|
93
|
+
var ae = () => {
|
|
94
|
+
let t = S(), n = e(u, (e) => e.isRealigning), r = e(u, (e) => e.latestMessage), i = e(u, (e) => e.engineMeta), a = e(u, (e) => e.selection), o = h(() => c.getStatusBarSelectionStats(a, i), [i, a]);
|
|
93
95
|
return /* @__PURE__ */ w(v, {
|
|
94
96
|
sx: {
|
|
95
|
-
backgroundColor: x(
|
|
96
|
-
borderTop: `1px solid ${x(
|
|
97
|
-
fontSize:
|
|
97
|
+
backgroundColor: x(t.palette.background.paper, .1),
|
|
98
|
+
borderTop: `1px solid ${x(t.palette.background.paper, .2)}`,
|
|
99
|
+
fontSize: t.typography.caption,
|
|
98
100
|
height: "100%",
|
|
99
101
|
width: "100%"
|
|
100
102
|
},
|
|
@@ -102,16 +104,16 @@ var re = () => {
|
|
|
102
104
|
sx: {
|
|
103
105
|
"& > div": {
|
|
104
106
|
alignItems: "center",
|
|
105
|
-
borderLeft: `1px solid ${x(
|
|
107
|
+
borderLeft: `1px solid ${x(t.palette.background.paper, .2)}`,
|
|
106
108
|
display: "flex",
|
|
107
|
-
paddingLeft:
|
|
109
|
+
paddingLeft: t.spacing(1)
|
|
108
110
|
},
|
|
109
111
|
"& > div:first-of-type": { borderLeft: "none" },
|
|
110
112
|
display: "grid",
|
|
111
113
|
gap: 4,
|
|
112
114
|
gridTemplateColumns: "1fr repeat(5, max-content)",
|
|
113
|
-
paddingLeft:
|
|
114
|
-
paddingRight:
|
|
115
|
+
paddingLeft: t.spacing(1),
|
|
116
|
+
paddingRight: t.spacing(1)
|
|
115
117
|
},
|
|
116
118
|
children: [
|
|
117
119
|
/* @__PURE__ */ T(v, {
|
|
@@ -120,21 +122,21 @@ var re = () => {
|
|
|
120
122
|
display: "flex",
|
|
121
123
|
gap: 1
|
|
122
124
|
},
|
|
123
|
-
children: [
|
|
125
|
+
children: [n && /* @__PURE__ */ w(y, {
|
|
124
126
|
color: "inherit",
|
|
125
127
|
size: 12
|
|
126
|
-
}),
|
|
128
|
+
}), r ?? ""]
|
|
127
129
|
}),
|
|
128
|
-
/* @__PURE__ */ w(v, { children: `Pos: ${
|
|
129
|
-
/* @__PURE__ */ w(v, { children: `Selected seqs: ${
|
|
130
|
-
/* @__PURE__ */ w(v, { children: `Cols: ${
|
|
131
|
-
/* @__PURE__ */ w(v, { children: `Total selected chars: ${
|
|
132
|
-
/* @__PURE__ */ w(v, { children: `Alignment: ${
|
|
130
|
+
/* @__PURE__ */ w(v, { children: `Pos: ${o.pos}` }),
|
|
131
|
+
/* @__PURE__ */ w(v, { children: `Selected seqs: ${o.selectedSeqs}` }),
|
|
132
|
+
/* @__PURE__ */ w(v, { children: `Cols: ${o.cols}` }),
|
|
133
|
+
/* @__PURE__ */ w(v, { children: `Total selected chars: ${o.totalSelectedChars}` }),
|
|
134
|
+
/* @__PURE__ */ w(v, { children: `Alignment: ${i?.sequenceCount ?? "0"} sequences, ${i?.alignmentWidth ?? "0"} positions` })
|
|
133
135
|
]
|
|
134
136
|
})
|
|
135
137
|
});
|
|
136
|
-
},
|
|
137
|
-
let [r, i] = _(""), a = g(null), o = r === "" ||
|
|
138
|
+
}, A = /^(?:\d+|,\d+|\d+,\d+)$/, oe = k(({ onActionsChange: e, onClose: t, onGotoPosition: n }) => {
|
|
139
|
+
let [r, i] = _(""), a = g(null), o = r === "" || A.test(r);
|
|
138
140
|
m(() => {
|
|
139
141
|
a.current?.focus();
|
|
140
142
|
}, []);
|
|
@@ -187,34 +189,34 @@ var re = () => {
|
|
|
187
189
|
fullWidth: !0,
|
|
188
190
|
maxWidth: "xs",
|
|
189
191
|
testId: "SequenceEditorGotoPositionDialog"
|
|
190
|
-
}),
|
|
191
|
-
let y =
|
|
192
|
+
}), se = () => {
|
|
193
|
+
let y = E(), b = e(u, (e) => e.isRealigning), x = e(u, (e) => e.rawFasta), k = e(u, (e) => e.setEngineMeta), A = e(u, (e) => e.setSelection), se = g(null), ce = g(null), le = g(null), j = h(() => C.resolve(t), []), M = g(null), N = g(null), P = g(null), F = g(null), I = g(null), L = g(null), ue = g(null), [R, de] = _({
|
|
192
194
|
height: 0,
|
|
193
195
|
width: 0
|
|
194
|
-
}), [
|
|
196
|
+
}), [fe, pe] = _(() => C.resolve(O).data), me = g(0), he = g(0), z = h(() => new D({
|
|
195
197
|
scrollLeft: 0,
|
|
196
198
|
scrollTop: 0
|
|
197
|
-
}), []),
|
|
199
|
+
}), []), ge = g(R), B = h(() => new D(null), []), V = h(() => new D(null), []), H = g(null), U = g(null), W = h(() => new D(n), []), G = h(() => new D(null), []), K = g(null), q = g(0), J = g(null), _e = g(!1), Y = S();
|
|
198
200
|
m(() => {
|
|
199
|
-
|
|
200
|
-
}, [
|
|
201
|
+
b ? le.current?.open() : le.current?.close();
|
|
202
|
+
}, [b]);
|
|
201
203
|
let X = p(() => {
|
|
202
|
-
let e =
|
|
204
|
+
let e = ue.current;
|
|
203
205
|
if (!e) return;
|
|
204
206
|
let t = W.data, n = B.data;
|
|
205
207
|
if (t && n) {
|
|
206
208
|
let e = t.labelWidth + t.cellWidth + n.alignmentWidth * t.cellWidth, r = t.rulerHeight + n.sequenceCount * t.cellHeight;
|
|
207
|
-
|
|
209
|
+
he.current !== e && (he.current = e), me.current !== r && (me.current = r);
|
|
208
210
|
}
|
|
209
|
-
let { height: r, width: i } =
|
|
211
|
+
let { height: r, width: i } = ge.current, a = `${Math.max(he.current, i)}px`, o = `${Math.max(me.current, r)}px`;
|
|
210
212
|
e.style.width !== a && (e.style.width = a), e.style.height !== o && (e.style.height = o);
|
|
211
|
-
}, [W, B]), Z = p(async () => {
|
|
212
|
-
let
|
|
213
|
-
return B.next(
|
|
213
|
+
}, [W, B]), Z = p(async (e) => {
|
|
214
|
+
let n = C.resolve(t).getMetaData(e), r = await n;
|
|
215
|
+
return n.abortSignal?.aborted ? null : (B.next(r), r);
|
|
214
216
|
}, [B]), Q = p(() => {
|
|
215
217
|
let e = W.data, t = B.data;
|
|
216
218
|
if (!t || !e) return;
|
|
217
|
-
let { scrollLeft: n, scrollTop: r } = z.data, { height: i, width: a } =
|
|
219
|
+
let { scrollLeft: n, scrollTop: r } = z.data, { height: i, width: a } = ge.current, o = c.getVisibleGridRange({
|
|
218
220
|
geometry: e,
|
|
219
221
|
numCols: t.alignmentWidth,
|
|
220
222
|
numRows: t.sequenceCount,
|
|
@@ -236,114 +238,125 @@ var re = () => {
|
|
|
236
238
|
B,
|
|
237
239
|
z,
|
|
238
240
|
V
|
|
239
|
-
]),
|
|
240
|
-
|
|
241
|
+
]), ve = ie((e, t) => {
|
|
242
|
+
de({
|
|
241
243
|
height: t,
|
|
242
244
|
width: e
|
|
243
245
|
});
|
|
244
246
|
}, 0, { trailing: !0 });
|
|
245
247
|
m(() => {
|
|
246
|
-
|
|
248
|
+
ge.current = R, X(), Q();
|
|
247
249
|
}, [
|
|
248
|
-
|
|
250
|
+
R,
|
|
249
251
|
X,
|
|
250
252
|
Q
|
|
251
253
|
]);
|
|
252
|
-
let $ =
|
|
254
|
+
let $ = R.width > 0 ? R.width / 2 : 120;
|
|
253
255
|
m(() => {
|
|
254
|
-
let
|
|
255
|
-
x(e);
|
|
256
|
-
}), G.subscribe((e) => {
|
|
256
|
+
let e = [B.subscribe((e) => {
|
|
257
257
|
k(e);
|
|
258
|
+
}), G.subscribe((e) => {
|
|
259
|
+
A(e);
|
|
258
260
|
})];
|
|
259
261
|
return () => {
|
|
260
|
-
|
|
262
|
+
e.forEach((e) => e()), u.getState().setLatestMessage(null), k(null), A(null);
|
|
261
263
|
};
|
|
262
264
|
}, [
|
|
263
265
|
B,
|
|
264
266
|
G,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
+
k,
|
|
268
|
+
A
|
|
267
269
|
]), m(() => {
|
|
268
|
-
if (
|
|
270
|
+
if (R.width <= 0) return;
|
|
269
271
|
let e = W.data;
|
|
270
272
|
e.labelWidth > $ && W.next({
|
|
271
273
|
...e,
|
|
272
274
|
labelWidth: $
|
|
273
275
|
});
|
|
274
276
|
}, [
|
|
275
|
-
|
|
277
|
+
R.width,
|
|
276
278
|
W,
|
|
277
279
|
$
|
|
278
280
|
]), m(() => {
|
|
279
|
-
let e =
|
|
281
|
+
let e = L.current;
|
|
280
282
|
if (!e) return;
|
|
281
283
|
let t = new ResizeObserver(([e]) => {
|
|
282
284
|
if (!e) return;
|
|
283
285
|
let t = Math.max(1, e.contentRect.height), n = Math.max(1, e.contentRect.width);
|
|
284
|
-
|
|
286
|
+
ve(n, t);
|
|
285
287
|
});
|
|
286
288
|
return t.observe(e), () => t.disconnect();
|
|
287
|
-
}, [
|
|
288
|
-
|
|
289
|
+
}, [j, ve]), m(() => {
|
|
290
|
+
let e = new AbortController();
|
|
291
|
+
return (async () => {
|
|
289
292
|
H.current = null, U.current = null, z.next({
|
|
290
293
|
scrollLeft: 0,
|
|
291
294
|
scrollTop: 0
|
|
292
|
-
}), G.next(null)
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
295
|
+
}), G.next(null);
|
|
296
|
+
let t = j.initialize(e.signal);
|
|
297
|
+
if (await t, t.abortSignal?.aborted) return;
|
|
298
|
+
let n = j.reset(e.signal);
|
|
299
|
+
if (await n, n.abortSignal?.aborted) return;
|
|
300
|
+
let r = j.loadFasta(x, e.signal);
|
|
301
|
+
await r, r.abortSignal?.aborted || await Z(e.signal);
|
|
302
|
+
})().catch((t) => {
|
|
303
|
+
e.signal.aborted || console.error(t);
|
|
304
|
+
}), () => e.abort();
|
|
296
305
|
}, [
|
|
297
|
-
|
|
298
|
-
|
|
306
|
+
j,
|
|
307
|
+
x,
|
|
299
308
|
z,
|
|
300
309
|
G,
|
|
301
310
|
Z,
|
|
302
311
|
Q
|
|
303
312
|
]), m(() => {
|
|
304
|
-
let
|
|
305
|
-
if (
|
|
306
|
-
|
|
313
|
+
let e = null, t = !0, n = null, r = null, i = null, a = async () => {
|
|
314
|
+
if (t && !_e.current) {
|
|
315
|
+
_e.current = !0;
|
|
307
316
|
try {
|
|
308
|
-
for (;
|
|
317
|
+
for (; t && J.current;) {
|
|
309
318
|
let a = J.current;
|
|
310
319
|
J.current = null;
|
|
311
|
-
let o = q.current;
|
|
312
|
-
if (!
|
|
320
|
+
let o = q.current, s = n;
|
|
321
|
+
if (!s || s.signal.aborted) return;
|
|
322
|
+
if (!U.current || !c.isWithinGridRange({
|
|
313
323
|
cachedGridRange: U.current.range,
|
|
314
324
|
visibleGridRange: a.visibleGridRange.visible
|
|
315
325
|
})) {
|
|
316
326
|
let e = [];
|
|
317
|
-
for (let t = a.visibleGridRange.cache.startRow; t <= a.visibleGridRange.cache.endRow; t++)
|
|
318
|
-
|
|
327
|
+
for (let t = a.visibleGridRange.cache.startRow; t <= a.visibleGridRange.cache.endRow; t++) {
|
|
328
|
+
let n = j.name(t, s.signal);
|
|
329
|
+
if (e.push(await n), n.abortSignal?.aborted) return;
|
|
330
|
+
}
|
|
331
|
+
if (!t || s.signal.aborted) return;
|
|
319
332
|
U.current = {
|
|
320
333
|
range: a.visibleGridRange.cache,
|
|
321
334
|
rowNames: e
|
|
322
335
|
};
|
|
323
336
|
}
|
|
324
|
-
if (!H.current || !
|
|
337
|
+
if (!H.current || !c.isWithinGridRange({
|
|
325
338
|
cachedGridRange: H.current.range,
|
|
326
339
|
visibleGridRange: a.visibleGridRange.visible
|
|
327
340
|
})) {
|
|
328
|
-
let e =
|
|
341
|
+
let e = j.viewport({
|
|
329
342
|
endCol: a.visibleGridRange.cache.endCol,
|
|
330
343
|
endRow: a.visibleGridRange.cache.endRow,
|
|
331
344
|
startCol: a.visibleGridRange.cache.startCol,
|
|
332
345
|
startRow: a.visibleGridRange.cache.startRow
|
|
333
|
-
});
|
|
334
|
-
if (!
|
|
346
|
+
}, s.signal), n = await e;
|
|
347
|
+
if (!t || e.abortSignal?.aborted) return;
|
|
335
348
|
H.current = {
|
|
336
349
|
range: a.visibleGridRange.cache,
|
|
337
|
-
viewportResult:
|
|
350
|
+
viewportResult: n
|
|
338
351
|
};
|
|
339
352
|
}
|
|
340
|
-
o === q.current && (
|
|
341
|
-
|
|
342
|
-
canvasElement:
|
|
343
|
-
devicePixelRatio: C.resolve(
|
|
353
|
+
o === q.current && (e !== null && cancelAnimationFrame(e), e = requestAnimationFrame(() => {
|
|
354
|
+
t && o === q.current && M.current && u.getState().nucleotidePalette && H.current && B.data && U.current && (N.current = c.drawCanvas({
|
|
355
|
+
canvasElement: M.current,
|
|
356
|
+
devicePixelRatio: C.resolve(O).data,
|
|
344
357
|
geometry: a.geometry,
|
|
345
358
|
meta: B.data,
|
|
346
|
-
palette:
|
|
359
|
+
palette: u.getState().nucleotidePalette,
|
|
347
360
|
rowNames: U.current.rowNames,
|
|
348
361
|
rowNamesStartRow: U.current.range.startRow,
|
|
349
362
|
scrollLeft: a.scrollLeft,
|
|
@@ -357,34 +370,36 @@ var re = () => {
|
|
|
357
370
|
}));
|
|
358
371
|
}));
|
|
359
372
|
}
|
|
373
|
+
} catch (e) {
|
|
374
|
+
if (!(e instanceof DOMException && e.name === "AbortError")) throw e;
|
|
360
375
|
} finally {
|
|
361
|
-
|
|
376
|
+
_e.current = !1, t && J.current && a();
|
|
362
377
|
}
|
|
363
378
|
}
|
|
364
|
-
}, o = [
|
|
379
|
+
}, o = [u.subscribe((e, t) => {
|
|
365
380
|
let n = !1;
|
|
366
|
-
e.searchResult !== t.searchResult && (r = e.searchResult, n = !0), e.searchResultHighlightedIndex !== t.searchResultHighlightedIndex && (i = e.searchResultHighlightedIndex,
|
|
381
|
+
e.searchResult !== t.searchResult && (r = e.searchResult, n = !0), e.searchResultHighlightedIndex !== t.searchResultHighlightedIndex && (i = e.searchResultHighlightedIndex, c.scrollToSearchResult({
|
|
367
382
|
geometry: W.data,
|
|
368
|
-
scrollContainer:
|
|
383
|
+
scrollContainer: L.current,
|
|
369
384
|
searchResult: e.searchResult,
|
|
370
385
|
searchResultHighlightedIndex: e.searchResultHighlightedIndex
|
|
371
386
|
}), n = !0), n && Q();
|
|
372
387
|
}), V.subscribe((e) => {
|
|
373
|
-
e && (J.current = e, q.current += 1, a());
|
|
388
|
+
e && (n?.abort(), n = new AbortController(), J.current = e, q.current += 1, a());
|
|
374
389
|
})];
|
|
375
390
|
return () => {
|
|
376
|
-
|
|
391
|
+
t = !1, n?.abort(), J.current = null, e !== null && cancelAnimationFrame(e), q.current += 1, o.forEach((e) => e());
|
|
377
392
|
};
|
|
378
393
|
}, [
|
|
379
|
-
|
|
394
|
+
j,
|
|
380
395
|
W,
|
|
381
396
|
B,
|
|
382
397
|
G,
|
|
383
398
|
Q,
|
|
384
399
|
V
|
|
385
400
|
]), m(() => {
|
|
386
|
-
let
|
|
387
|
-
|
|
401
|
+
let e = [
|
|
402
|
+
u.subscribe((e, t) => {
|
|
388
403
|
e.nucleotidePalette !== t.nucleotidePalette && Q();
|
|
389
404
|
}),
|
|
390
405
|
W.subscribe(() => {
|
|
@@ -395,15 +410,15 @@ var re = () => {
|
|
|
395
410
|
e && (X(), Q());
|
|
396
411
|
}),
|
|
397
412
|
G.subscribe(() => Q()),
|
|
398
|
-
C.resolve(
|
|
399
|
-
|
|
413
|
+
C.resolve(O).subscribe((e) => {
|
|
414
|
+
pe(e), X(), Q();
|
|
400
415
|
})
|
|
401
416
|
];
|
|
402
417
|
return () => {
|
|
403
|
-
|
|
418
|
+
e.forEach((e) => e());
|
|
404
419
|
};
|
|
405
420
|
}, [
|
|
406
|
-
|
|
421
|
+
j,
|
|
407
422
|
W,
|
|
408
423
|
B,
|
|
409
424
|
z,
|
|
@@ -414,11 +429,12 @@ var re = () => {
|
|
|
414
429
|
let e = (e) => {
|
|
415
430
|
let t = e.key.toUpperCase();
|
|
416
431
|
r.has(t) && (e.preventDefault(), C.resolve(i).emit("onMutateSelection", t));
|
|
417
|
-
}, t = (e) => C.resolve(
|
|
432
|
+
}, t = (e) => C.resolve(ee).registerShortcut({
|
|
418
433
|
callback: e.callback,
|
|
419
|
-
element:
|
|
434
|
+
element: I.current,
|
|
420
435
|
...e.shortcut
|
|
421
436
|
}), n = [
|
|
437
|
+
t(s.copySelection),
|
|
422
438
|
t(s.expandSelectionLeft),
|
|
423
439
|
t(s.expandSelectionRight),
|
|
424
440
|
t(s.expandSelectionUp),
|
|
@@ -440,17 +456,20 @@ var re = () => {
|
|
|
440
456
|
t(s.insertGap),
|
|
441
457
|
t(s.deleteBackward),
|
|
442
458
|
t(s.deleteSelection),
|
|
459
|
+
t(s.deleteRows),
|
|
460
|
+
t(s.deleteRowsMac),
|
|
443
461
|
t(s.deleteBase),
|
|
462
|
+
t(s.pasteFasta),
|
|
444
463
|
t(s.undo),
|
|
445
464
|
t(s.redo),
|
|
446
465
|
t(s.gotoPosition),
|
|
447
|
-
C.resolve(
|
|
466
|
+
C.resolve(ee).registerShortcut({
|
|
448
467
|
callback: e,
|
|
449
|
-
element:
|
|
468
|
+
element: I.current
|
|
450
469
|
}),
|
|
451
|
-
C.resolve(
|
|
470
|
+
C.resolve(ee).registerShortcut({
|
|
452
471
|
callback: e,
|
|
453
|
-
element:
|
|
472
|
+
element: I.current,
|
|
454
473
|
modifiers: [["Shift"]]
|
|
455
474
|
})
|
|
456
475
|
];
|
|
@@ -458,204 +477,285 @@ var re = () => {
|
|
|
458
477
|
n.forEach((e) => e());
|
|
459
478
|
};
|
|
460
479
|
}, []), m(() => {
|
|
461
|
-
let
|
|
462
|
-
let {
|
|
480
|
+
let e = async (e) => {
|
|
481
|
+
let { abortSignal: t, command: n, getSelectionPostCommand: r, invalidateRowNames: i } = e;
|
|
463
482
|
try {
|
|
464
483
|
let e = B.data?.undoDepth;
|
|
465
|
-
await
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
484
|
+
if (await n(), t?.aborted) return;
|
|
485
|
+
H.current = null, i && (U.current = null);
|
|
486
|
+
let a = await Z();
|
|
487
|
+
if (r) {
|
|
488
|
+
if (e !== void 0 && a?.undoDepth === e) return;
|
|
489
|
+
let t = r();
|
|
470
490
|
G.next(t), K.current = t;
|
|
471
491
|
}
|
|
472
492
|
} catch (e) {
|
|
473
|
-
console.error("Failed to post command:", e);
|
|
493
|
+
t?.aborted || console.error("Failed to post command:", e);
|
|
474
494
|
}
|
|
475
|
-
},
|
|
495
|
+
}, t = async (t) => {
|
|
476
496
|
if (!B.data) return;
|
|
477
|
-
let n =
|
|
478
|
-
n && await
|
|
479
|
-
await
|
|
497
|
+
let n = c.getMutateArguments(G.data, B.data);
|
|
498
|
+
n && await e({ command: async () => {
|
|
499
|
+
await j.mutate(n.rows, n.columns, t);
|
|
480
500
|
} });
|
|
481
|
-
},
|
|
501
|
+
}, n = (e) => {
|
|
482
502
|
if (!B.data) return;
|
|
483
|
-
let t =
|
|
503
|
+
let t = c.getMovedSelection(G.data, e, B.data);
|
|
484
504
|
if (t) {
|
|
485
505
|
if (G.next(t), K.current) {
|
|
486
|
-
let t =
|
|
506
|
+
let t = c.getMovedSelection(K.current, e, B.data);
|
|
487
507
|
K.current = t;
|
|
488
508
|
} else K.current = t;
|
|
489
509
|
}
|
|
490
|
-
},
|
|
510
|
+
}, r = (e) => {
|
|
491
511
|
if (!B.data || !K.current || !G.data) return;
|
|
492
|
-
let t =
|
|
512
|
+
let t = c.getExpandedSelection(G.data, K.current, e, B.data);
|
|
493
513
|
t && G.next(t);
|
|
494
|
-
},
|
|
514
|
+
}, o = async (t) => {
|
|
495
515
|
if (!B.data) return;
|
|
496
|
-
let n =
|
|
497
|
-
n && await
|
|
516
|
+
let n = c.getRowsToMove(G.data, t, B.data);
|
|
517
|
+
n && await e({
|
|
498
518
|
command: async () => {
|
|
499
|
-
|
|
519
|
+
t === a.UP ? (await j.moveRowsToTop(n), L.current && (L.current.scrollTop = 0)) : (await j.moveRowsToBottom(n), L.current && (L.current.scrollTop = L.current.scrollHeight - L.current.clientHeight));
|
|
500
520
|
},
|
|
501
|
-
getSelectionPostCommand: () =>
|
|
521
|
+
getSelectionPostCommand: () => c.getMovedRowsEndSelection(G.data, t, B.data),
|
|
502
522
|
invalidateRowNames: !0
|
|
503
523
|
});
|
|
504
|
-
},
|
|
524
|
+
}, s = async (t) => {
|
|
505
525
|
if (!B.data) return;
|
|
506
|
-
let n =
|
|
507
|
-
n && await
|
|
526
|
+
let n = c.getRowsToMove(G.data, t, B.data);
|
|
527
|
+
n && await e({
|
|
508
528
|
command: async () => {
|
|
509
|
-
|
|
529
|
+
t === a.UP ? await j.moveRowsUp(n) : await j.moveRowsDown(n);
|
|
510
530
|
},
|
|
511
|
-
getSelectionPostCommand: () =>
|
|
531
|
+
getSelectionPostCommand: () => c.getMovedRowsRelativeSelection(G.data, t, B.data),
|
|
512
532
|
invalidateRowNames: !0
|
|
513
533
|
});
|
|
514
|
-
}, d = async (
|
|
515
|
-
if (!B.data ||
|
|
516
|
-
let n =
|
|
517
|
-
n && n.columns.length !== 0 && n.rows.length !== 0 && await
|
|
534
|
+
}, d = async (t) => {
|
|
535
|
+
if (!B.data || t !== a.LEFT && t !== a.RIGHT || !G.data?.cells && (!G.data?.cols || G.data.cols.length === 0)) return;
|
|
536
|
+
let n = c.getMutateArguments(G.data, B.data);
|
|
537
|
+
n && n.columns.length !== 0 && n.rows.length !== 0 && await e({
|
|
518
538
|
command: async () => {
|
|
519
|
-
await
|
|
539
|
+
await j.moveHorizontal(n.rows, n.columns, t);
|
|
520
540
|
},
|
|
521
|
-
getSelectionPostCommand: () =>
|
|
541
|
+
getSelectionPostCommand: () => c.getPostUpsertSelection(G.data, t)
|
|
522
542
|
});
|
|
523
|
-
}, f = C.resolve(i), p =
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
543
|
+
}, f = C.resolve(i), p = null, m = null, h = async (t) => {
|
|
544
|
+
if (u.getState().isRealigning || !t.trimStart().startsWith(">")) return;
|
|
545
|
+
m?.abort();
|
|
546
|
+
let n = new AbortController();
|
|
547
|
+
m = n;
|
|
548
|
+
try {
|
|
549
|
+
await e({
|
|
550
|
+
abortSignal: n.signal,
|
|
551
|
+
command: async () => {
|
|
552
|
+
let e = j.loadFasta(t, n.signal);
|
|
553
|
+
await e, e.abortSignal?.aborted || (u.getState().searchQuery && f.emit("onSearch", u.getState().searchQuery), u.getState().setLatestMessage("Pasted sequences from clipboard"));
|
|
554
|
+
},
|
|
555
|
+
getSelectionPostCommand: () => c.getPostPasteSequencesSelection(G.data, t),
|
|
556
|
+
invalidateRowNames: !0
|
|
557
|
+
});
|
|
558
|
+
} catch (e) {
|
|
559
|
+
n.signal.aborted || (console.error("Failed to load FASTA from clipboard:", e), u.getState().setLatestMessage("Failed to load FASTA from clipboard."));
|
|
560
|
+
} finally {
|
|
561
|
+
m === n && (m = null);
|
|
562
|
+
}
|
|
563
|
+
}, g = (e) => {
|
|
564
|
+
let t = e.target;
|
|
565
|
+
if (t instanceof HTMLElement && (t.isContentEditable || t.closest("input, textarea, select"))) return;
|
|
566
|
+
let n = e.clipboardData?.getData("text/plain") ?? "";
|
|
567
|
+
n.trimStart().startsWith(">") && (e.preventDefault(), h(n));
|
|
568
|
+
};
|
|
569
|
+
C.resolve(re).window.addEventListener("paste", g);
|
|
570
|
+
let _ = [
|
|
571
|
+
() => C.resolve(re).window.removeEventListener("paste", g),
|
|
572
|
+
f.addEventListener("onSearch", async (e) => {
|
|
573
|
+
if (!e) {
|
|
574
|
+
p?.abort();
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
p?.abort();
|
|
578
|
+
let t = new AbortController();
|
|
579
|
+
p = t;
|
|
580
|
+
let n = j.search(e, !0, t.signal);
|
|
581
|
+
try {
|
|
582
|
+
let e = await n;
|
|
583
|
+
n.abortSignal?.aborted || u.getState().setSearchResult(e);
|
|
584
|
+
} catch (e) {
|
|
585
|
+
t.signal.aborted || console.error("Failed to search sequences:", e);
|
|
586
|
+
}
|
|
587
|
+
}),
|
|
588
|
+
f.addEventListener("onExpandSelection", (e) => r(e)),
|
|
589
|
+
f.addEventListener("onCopySelection", async () => {
|
|
590
|
+
let e = G.data;
|
|
591
|
+
if (e) try {
|
|
592
|
+
let t = await j.exportGappedFasta(), n = c.getSelectedFasta(t, e);
|
|
593
|
+
if (!n) return;
|
|
594
|
+
await navigator.clipboard.writeText(n), u.getState().setLatestMessage("Copied selected sequences to clipboard");
|
|
595
|
+
} catch (e) {
|
|
596
|
+
console.error("Failed to copy selected sequences:", e), u.getState().setLatestMessage("Failed to copy selected sequences to clipboard.");
|
|
597
|
+
}
|
|
598
|
+
}),
|
|
599
|
+
f.addEventListener("onPasteFasta", async () => {
|
|
600
|
+
try {
|
|
601
|
+
console.log("Reading FASTA from clipboard");
|
|
602
|
+
let e = await navigator.clipboard.readText();
|
|
603
|
+
await h(e);
|
|
604
|
+
} catch (e) {
|
|
605
|
+
console.error("Failed to read FASTA from clipboard:", e), u.getState().setLatestMessage("Failed to read FASTA from clipboard.");
|
|
606
|
+
}
|
|
528
607
|
}),
|
|
529
|
-
f.addEventListener("
|
|
530
|
-
f.addEventListener("
|
|
531
|
-
f.addEventListener("onMoveSelection", (e) => r(e)),
|
|
608
|
+
f.addEventListener("onGotoPosition", () => ce.current?.open({})),
|
|
609
|
+
f.addEventListener("onMoveSelection", (e) => n(e)),
|
|
532
610
|
f.addEventListener("onMoveRows", (e) => {
|
|
533
|
-
|
|
611
|
+
s(e);
|
|
534
612
|
}),
|
|
535
613
|
f.addEventListener("onMoveRowsEnd", (e) => {
|
|
536
|
-
|
|
614
|
+
o(e);
|
|
537
615
|
}),
|
|
538
616
|
f.addEventListener("onMoveCells", (e) => {
|
|
539
617
|
d(e);
|
|
540
618
|
}),
|
|
541
619
|
f.addEventListener("onScrollToLineStart", () => {
|
|
542
|
-
let e =
|
|
620
|
+
let e = L.current;
|
|
543
621
|
e && (e.scrollLeft = 0);
|
|
544
622
|
}),
|
|
545
623
|
f.addEventListener("onScrollToLineEnd", () => {
|
|
546
|
-
let e =
|
|
624
|
+
let e = L.current;
|
|
547
625
|
e && (e.scrollLeft = e.scrollWidth - e.clientWidth);
|
|
548
626
|
}),
|
|
549
627
|
f.addEventListener("onScrollPageUp", () => {
|
|
550
|
-
let e =
|
|
628
|
+
let e = L.current;
|
|
551
629
|
e && (e.scrollTop = Math.max(0, e.scrollTop - e.clientHeight));
|
|
552
630
|
}),
|
|
553
631
|
f.addEventListener("onScrollPageDown", () => {
|
|
554
|
-
let e =
|
|
632
|
+
let e = L.current;
|
|
555
633
|
e && (e.scrollTop = Math.min(e.scrollHeight - e.clientHeight, e.scrollTop + e.clientHeight));
|
|
556
634
|
}),
|
|
557
635
|
f.addEventListener("onInsert", () => {
|
|
558
636
|
(async () => {
|
|
559
637
|
if (!B.data) return;
|
|
560
|
-
let
|
|
561
|
-
|
|
562
|
-
command: async () =>
|
|
563
|
-
getSelectionPostCommand: () =>
|
|
638
|
+
let t = c.getUpsertArguments(G.data, B.data);
|
|
639
|
+
t && await e({
|
|
640
|
+
command: async () => j.insert(t.rows, t.col),
|
|
641
|
+
getSelectionPostCommand: () => c.getPostUpsertSelection(G.data, a.RIGHT)
|
|
564
642
|
});
|
|
565
643
|
})();
|
|
566
644
|
}),
|
|
567
645
|
f.addEventListener("onDeleteBackward", () => {
|
|
568
646
|
(async () => {
|
|
569
647
|
if (!B.data) return;
|
|
570
|
-
let
|
|
571
|
-
|
|
572
|
-
command: async () =>
|
|
573
|
-
getSelectionPostCommand: () =>
|
|
648
|
+
let t = c.getUpsertArguments(G.data, B.data, -1);
|
|
649
|
+
t && await e({
|
|
650
|
+
command: async () => j.delete(t.rows, t.col),
|
|
651
|
+
getSelectionPostCommand: () => c.getPostUpsertSelection(G.data, a.LEFT)
|
|
574
652
|
});
|
|
575
653
|
})();
|
|
576
654
|
}),
|
|
655
|
+
f.addEventListener("onDeleteRows", () => {
|
|
656
|
+
(async () => {
|
|
657
|
+
let t = G.data, n = t?.rows, r = B.data;
|
|
658
|
+
n?.length && r && (await e({
|
|
659
|
+
command: async () => j.deleteRows(n),
|
|
660
|
+
getSelectionPostCommand: () => c.getPostDeleteRowsSelection(t, r.sequenceCount),
|
|
661
|
+
invalidateRowNames: !0
|
|
662
|
+
}), u.getState().setLatestMessage(`${n.length} row${n.length > 1 ? "s" : ""} deleted`));
|
|
663
|
+
})();
|
|
664
|
+
}),
|
|
577
665
|
f.addEventListener("onMutateSelection", (e) => {
|
|
578
|
-
|
|
666
|
+
t(e);
|
|
579
667
|
}),
|
|
580
668
|
f.addEventListener("onUndo", () => {
|
|
581
|
-
|
|
582
|
-
command: async () =>
|
|
669
|
+
e({
|
|
670
|
+
command: async () => j.undo(),
|
|
583
671
|
getSelectionPostCommand: () => null,
|
|
584
672
|
invalidateRowNames: !0
|
|
585
673
|
});
|
|
586
674
|
}),
|
|
587
675
|
f.addEventListener("onCancelRealign", () => {
|
|
588
|
-
|
|
676
|
+
j.cancelRealign();
|
|
589
677
|
}),
|
|
590
678
|
f.addEventListener("onRealign", () => {
|
|
591
|
-
|
|
592
|
-
let
|
|
593
|
-
|
|
679
|
+
u.getState().setIsRealigning(!0);
|
|
680
|
+
let t = !1;
|
|
681
|
+
e({
|
|
594
682
|
command: async () => {
|
|
595
683
|
try {
|
|
596
|
-
await
|
|
597
|
-
} catch (
|
|
598
|
-
if (
|
|
599
|
-
else throw
|
|
684
|
+
await j.realign();
|
|
685
|
+
} catch (e) {
|
|
686
|
+
if (e instanceof DOMException && e.name === "AbortError") t = !0;
|
|
687
|
+
else throw u.getState().setLatestMessage(l.getEngineErrorMessage(e)), e;
|
|
600
688
|
} finally {
|
|
601
|
-
|
|
689
|
+
u.getState().setIsRealigning(!1);
|
|
602
690
|
}
|
|
603
691
|
},
|
|
604
|
-
getSelectionPostCommand: () =>
|
|
692
|
+
getSelectionPostCommand: () => t ? G.data : null,
|
|
605
693
|
invalidateRowNames: !0
|
|
606
694
|
});
|
|
607
695
|
}),
|
|
608
696
|
f.addEventListener("onRedo", () => {
|
|
609
|
-
|
|
610
|
-
command: async () =>
|
|
697
|
+
e({
|
|
698
|
+
command: async () => j.redo(),
|
|
611
699
|
getSelectionPostCommand: () => null,
|
|
612
700
|
invalidateRowNames: !0
|
|
613
701
|
});
|
|
614
702
|
}),
|
|
615
703
|
f.addEventListener("onExportGappedFasta", async () => {
|
|
616
|
-
let e = await
|
|
617
|
-
|
|
704
|
+
let e = await j.exportGappedFasta();
|
|
705
|
+
te.downloadFastaFile(e, "sequence.gapped.fasta");
|
|
618
706
|
}),
|
|
619
707
|
f.addEventListener("onExportUngappedFasta", async () => {
|
|
620
|
-
let e = await
|
|
621
|
-
|
|
708
|
+
let e = await j.exportUngappedFasta();
|
|
709
|
+
te.downloadFastaFile(e, "sequence.ungapped.fasta");
|
|
622
710
|
}),
|
|
623
711
|
f.addEventListener("onExportToLoculus", async () => {
|
|
624
|
-
let
|
|
625
|
-
|
|
626
|
-
fasta:
|
|
627
|
-
metaData:
|
|
628
|
-
rawFasta:
|
|
712
|
+
let e = await j.exportUngappedFasta(), { parsedMetadata: t, rawFasta: n } = u.getState();
|
|
713
|
+
se.current?.open({
|
|
714
|
+
fasta: e,
|
|
715
|
+
metaData: t,
|
|
716
|
+
rawFasta: n
|
|
629
717
|
});
|
|
718
|
+
}),
|
|
719
|
+
f.addEventListener("onOpenInPhylogenyViewer", async () => {
|
|
720
|
+
if (!y.phylogenyViewerUrl) return;
|
|
721
|
+
let e = await j.exportUngappedFasta(), t = u.getState().rawMetadata, n = new URL(y.phylogenyViewerUrl).origin, r = C.resolve(re).window, i = null, a = (o) => {
|
|
722
|
+
o.origin === n && o.source === i && typeof o.data == "object" && o.data !== null && "type" in o.data && o.data.type === "data-receiver-ready" && (r.removeEventListener("message", a), i?.postMessage({
|
|
723
|
+
fasta: e,
|
|
724
|
+
metaData: t,
|
|
725
|
+
type: "import-data"
|
|
726
|
+
}, n));
|
|
727
|
+
};
|
|
728
|
+
r.addEventListener("message", a), i = r.open(y.phylogenyViewerUrl), i || r.removeEventListener("message", a);
|
|
630
729
|
})
|
|
631
730
|
];
|
|
632
731
|
return () => {
|
|
633
|
-
p.forEach((e) => e()),
|
|
732
|
+
window.removeEventListener("paste", g), p?.abort(), m?.abort(), _.forEach((e) => e()), j.cancelRealign();
|
|
634
733
|
};
|
|
635
734
|
}, [
|
|
636
|
-
|
|
735
|
+
j,
|
|
637
736
|
G,
|
|
638
737
|
Z,
|
|
639
738
|
Q,
|
|
640
|
-
B
|
|
739
|
+
B,
|
|
740
|
+
y.phylogenyViewerUrl
|
|
641
741
|
]), m(() => {
|
|
642
742
|
Q();
|
|
643
743
|
}, [Q]);
|
|
644
|
-
let
|
|
744
|
+
let ye = p((e) => {
|
|
645
745
|
let t = e.currentTarget;
|
|
646
746
|
z.next({
|
|
647
747
|
scrollLeft: t.scrollLeft,
|
|
648
748
|
scrollTop: t.scrollTop
|
|
649
749
|
});
|
|
650
|
-
}, [z]),
|
|
651
|
-
|
|
750
|
+
}, [z]), be = p((e) => {
|
|
751
|
+
I.current?.focus();
|
|
652
752
|
let t = e.currentTarget, n = t.getBoundingClientRect(), r = e.clientX >= n.left + t.clientWidth, i = e.clientY >= n.top + t.clientHeight;
|
|
653
753
|
if (r || i) return;
|
|
654
|
-
let a =
|
|
754
|
+
let a = M.current, s = N.current, l = C.resolve(O).data;
|
|
655
755
|
if (!a || !s) return;
|
|
656
|
-
let u =
|
|
756
|
+
let u = c.getPathPropertiesFromCanvas({
|
|
657
757
|
canvas: a,
|
|
658
|
-
devicePixelRatio:
|
|
758
|
+
devicePixelRatio: l,
|
|
659
759
|
editorAssembly: s,
|
|
660
760
|
event: e.nativeEvent
|
|
661
761
|
});
|
|
@@ -663,26 +763,26 @@ var re = () => {
|
|
|
663
763
|
if (u.type !== o.DIVIDER) {
|
|
664
764
|
if (u.type === o.LABEL && (e.metaKey || e.ctrlKey)) {
|
|
665
765
|
let t = G.data?.rows ?? [], n = t.includes(u.row) ? t.filter((e) => e !== u.row) : [...t, u.row].sort((e, t) => e - t);
|
|
666
|
-
if (e.preventDefault(),
|
|
766
|
+
if (e.preventDefault(), F.current = null, n.length === 0) {
|
|
667
767
|
G.next(null), K.current = null;
|
|
668
768
|
return;
|
|
669
769
|
}
|
|
670
770
|
G.next({ rows: n }), K.current = { rows: n };
|
|
671
771
|
return;
|
|
672
772
|
}
|
|
673
|
-
let t =
|
|
773
|
+
let t = c.getSelectionFromPathProperties({
|
|
674
774
|
endPath: u,
|
|
675
775
|
startPath: u
|
|
676
776
|
});
|
|
677
777
|
if (!t) return;
|
|
678
|
-
e.preventDefault(),
|
|
679
|
-
} else e.preventDefault(),
|
|
778
|
+
e.preventDefault(), F.current = u, G.next(t), K.current = t;
|
|
779
|
+
} else e.preventDefault(), F.current = null, P.current = {
|
|
680
780
|
startLabelWidth: W.data.labelWidth,
|
|
681
781
|
startX: e.clientX
|
|
682
782
|
};
|
|
683
783
|
}
|
|
684
|
-
}, [W, G]),
|
|
685
|
-
let t =
|
|
784
|
+
}, [W, G]), xe = p((e) => {
|
|
785
|
+
let t = M.current, n = I.current, r = C.resolve(O).data, i = P.current;
|
|
686
786
|
if (!n || !t) return;
|
|
687
787
|
if (i) {
|
|
688
788
|
let t = Math.min($, Math.max(120, i.startLabelWidth + e.clientX - i.startX));
|
|
@@ -692,47 +792,47 @@ var re = () => {
|
|
|
692
792
|
}), n.style.cursor = "col-resize";
|
|
693
793
|
return;
|
|
694
794
|
}
|
|
695
|
-
let a =
|
|
795
|
+
let a = F.current;
|
|
696
796
|
if (a) {
|
|
697
|
-
let n =
|
|
797
|
+
let n = N.current;
|
|
698
798
|
if (!n) return;
|
|
699
|
-
let i =
|
|
799
|
+
let i = c.getPathPropertiesFromCanvas({
|
|
700
800
|
canvas: t,
|
|
701
801
|
devicePixelRatio: r,
|
|
702
802
|
editorAssembly: n,
|
|
703
803
|
event: e.nativeEvent
|
|
704
804
|
});
|
|
705
805
|
if (!i) return;
|
|
706
|
-
let o =
|
|
806
|
+
let o = c.getSelectionFromPathProperties({
|
|
707
807
|
endPath: i,
|
|
708
808
|
startPath: a
|
|
709
809
|
});
|
|
710
810
|
o && (G.next(o), K.current = o);
|
|
711
811
|
return;
|
|
712
812
|
}
|
|
713
|
-
let s =
|
|
813
|
+
let s = N.current;
|
|
714
814
|
if (!s) return;
|
|
715
|
-
let
|
|
815
|
+
let l = c.getPathPropertiesFromCanvas({
|
|
716
816
|
canvas: t,
|
|
717
817
|
devicePixelRatio: r,
|
|
718
818
|
editorAssembly: s,
|
|
719
819
|
event: e.nativeEvent
|
|
720
820
|
});
|
|
721
|
-
|
|
821
|
+
l && l.type === o.DIVIDER ? n.style.cursor = "col-resize" : n.style.cursor = "default";
|
|
722
822
|
}, [
|
|
723
823
|
W,
|
|
724
824
|
$,
|
|
725
825
|
G
|
|
726
|
-
]),
|
|
727
|
-
|
|
728
|
-
}, []),
|
|
729
|
-
|
|
826
|
+
]), Se = p(() => {
|
|
827
|
+
P.current = null, F.current = null;
|
|
828
|
+
}, []), Ce = p((e, t) => {
|
|
829
|
+
c.scrollToPosition({
|
|
730
830
|
geometry: W.data,
|
|
731
|
-
scrollContainer:
|
|
831
|
+
scrollContainer: L.current,
|
|
732
832
|
x: e,
|
|
733
833
|
y: t
|
|
734
834
|
});
|
|
735
|
-
}, [W]),
|
|
835
|
+
}, [W]), we = Math.max(1, Math.floor(R.width * fe)), Te = Math.max(1, Math.floor(R.height * fe));
|
|
736
836
|
return /* @__PURE__ */ T(v, {
|
|
737
837
|
sx: {
|
|
738
838
|
display: "grid",
|
|
@@ -744,8 +844,8 @@ var re = () => {
|
|
|
744
844
|
children: [
|
|
745
845
|
/* @__PURE__ */ w(d, {}),
|
|
746
846
|
/* @__PURE__ */ T(v, {
|
|
747
|
-
onMouseUp:
|
|
748
|
-
ref:
|
|
847
|
+
onMouseUp: Se,
|
|
848
|
+
ref: I,
|
|
749
849
|
sx: {
|
|
750
850
|
height: `calc(100% - ${Y.spacing(3)})`,
|
|
751
851
|
marginBottom: Y.spacing(3),
|
|
@@ -755,10 +855,10 @@ var re = () => {
|
|
|
755
855
|
tabIndex: 0,
|
|
756
856
|
children: [
|
|
757
857
|
/* @__PURE__ */ w(v, {
|
|
758
|
-
onMouseDown:
|
|
759
|
-
onMouseMove:
|
|
760
|
-
onScroll:
|
|
761
|
-
ref:
|
|
858
|
+
onMouseDown: be,
|
|
859
|
+
onMouseMove: xe,
|
|
860
|
+
onScroll: ye,
|
|
861
|
+
ref: L,
|
|
762
862
|
sx: {
|
|
763
863
|
height: "100%",
|
|
764
864
|
overflowX: "scroll",
|
|
@@ -768,25 +868,25 @@ var re = () => {
|
|
|
768
868
|
zIndex: 1
|
|
769
869
|
},
|
|
770
870
|
children: /* @__PURE__ */ w(v, {
|
|
771
|
-
ref:
|
|
871
|
+
ref: ue,
|
|
772
872
|
sx: { pointerEvents: "none" }
|
|
773
873
|
})
|
|
774
874
|
}),
|
|
775
875
|
/* @__PURE__ */ w("canvas", {
|
|
776
|
-
height:
|
|
777
|
-
ref:
|
|
876
|
+
height: Te,
|
|
877
|
+
ref: M,
|
|
778
878
|
style: {
|
|
779
879
|
display: "block",
|
|
780
|
-
height: `${
|
|
880
|
+
height: `${R.height}px`,
|
|
781
881
|
imageRendering: "pixelated",
|
|
782
882
|
left: 0,
|
|
783
883
|
pointerEvents: "auto",
|
|
784
884
|
position: "absolute",
|
|
785
885
|
top: 0,
|
|
786
|
-
width: `${
|
|
886
|
+
width: `${R.width}px`,
|
|
787
887
|
zIndex: 0
|
|
788
888
|
},
|
|
789
|
-
width:
|
|
889
|
+
width: we
|
|
790
890
|
}),
|
|
791
891
|
/* @__PURE__ */ w(v, {
|
|
792
892
|
sx: {
|
|
@@ -797,19 +897,19 @@ var re = () => {
|
|
|
797
897
|
width: "100%",
|
|
798
898
|
zIndex: 2
|
|
799
899
|
},
|
|
800
|
-
children: /* @__PURE__ */ w(
|
|
900
|
+
children: /* @__PURE__ */ w(ae, {})
|
|
801
901
|
})
|
|
802
902
|
]
|
|
803
903
|
}),
|
|
804
|
-
/* @__PURE__ */ w(
|
|
805
|
-
onGotoPosition:
|
|
806
|
-
ref:
|
|
904
|
+
/* @__PURE__ */ w(oe, {
|
|
905
|
+
onGotoPosition: Ce,
|
|
906
|
+
ref: ce
|
|
807
907
|
}),
|
|
808
|
-
/* @__PURE__ */ w(f, { ref:
|
|
809
|
-
/* @__PURE__ */ w(
|
|
908
|
+
/* @__PURE__ */ w(f, { ref: le }),
|
|
909
|
+
/* @__PURE__ */ w(ne, { ref: se })
|
|
810
910
|
]
|
|
811
911
|
});
|
|
812
912
|
};
|
|
813
|
-
export {
|
|
913
|
+
export { se as t };
|
|
814
914
|
|
|
815
915
|
//# sourceMappingURL=SequenceEditor.js.map
|