@rivm-loculus-tools/sequence-editor 1.8.0 → 1.9.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 +184 -97
- package/dist/_chunks/SequenceEditor.js.map +1 -1
- package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -1
- package/dist/_chunks/SequenceEditorPageDrawer.js +42 -38
- package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -1
- package/dist/_chunks/SequenceEditorPageHeader.js +7 -4
- package/dist/_chunks/SequenceEditorPageHeader.js.map +1 -1
- package/dist/_chunks/sequenceEditorStore.js +2 -2
- 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-cbSDVRKB.js +8 -0
- package/dist/assets/AlignerWorker-cbSDVRKB.js.map +1 -0
- package/dist/assets/index--BqOy4u7.js +8 -0
- package/dist/assets/index--BqOy4u7.js.map +1 -0
- package/dist/classes/services/EditorWorkerService/EditorWorkerService.d.ts +29 -23
- package/dist/classes/services/EditorWorkerService/index.js +80 -69
- package/dist/classes/services/EditorWorkerService/index.js.map +1 -1
- package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +3 -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/constants/keyboard.d.ts +2 -0
- package/dist/constants/keyboard.js +42 -5
- package/dist/constants/keyboard.js.map +1 -1
- package/dist/models/editor.models.d.ts +2 -0
- package/dist/models/editor.models.js.map +1 -1
- package/dist/stores/sequenceEditorStore/sequenceEditorStore.d.ts +2 -2
- 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 +3 -3
- 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,6 +1,6 @@
|
|
|
1
1
|
// src/classes/workers/EngineWorker/index.ts?worker
|
|
2
2
|
function e(e) {
|
|
3
|
-
return new Worker(new URL("../assets/index
|
|
3
|
+
return new Worker(new URL("../assets/index--BqOy4u7.js", import.meta.url).href, { name: e?.name });
|
|
4
4
|
}
|
|
5
5
|
export { e as default };
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineWorker.js","names":["import.meta.
|
|
1
|
+
{"version":3,"file":"EngineWorker.js","names":["import.meta.ROLLDOWN_FILE_URL_Vt0ylezJY9_icSddWdUoJA","WorkerWrapper","options"],"sources":[],"mappings":""}
|
|
@@ -19,9 +19,10 @@ import { DevicePixelRatioService as D } from "@gen-epix/ui-core/classes/services
|
|
|
19
19
|
import { KeyboardShortcutService as O } from "@gen-epix/ui-core/classes/services/KeyboardShortcutService";
|
|
20
20
|
import { ExportUtil as ee } from "@rivm-loculus-tools/common-frontend/utils/ExportUtil";
|
|
21
21
|
import { UploadToLoculusModal as te } from "@rivm-loculus-tools/common-frontend/components/loculus/UploadToLoculusModal";
|
|
22
|
+
import { WindowService as ne } from "@gen-epix/ui-core/classes/services/WindowService";
|
|
22
23
|
import { withDialog as k } from "@gen-epix/ui-core-components/hoc/withDialog";
|
|
23
24
|
// ../../../../node_modules/.pnpm/use-debounce@10.1.1_react@19.3.1/node_modules/use-debounce/dist/index.module.js
|
|
24
|
-
function
|
|
25
|
+
function re(e, t, n, r) {
|
|
25
26
|
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
27
|
f.current = e;
|
|
27
28
|
var y = typeof window < "u", b = !t && t !== 0 && y;
|
|
@@ -88,8 +89,8 @@ function ne(e, t, n, r) {
|
|
|
88
89
|
}, [C]), D;
|
|
89
90
|
}
|
|
90
91
|
// src/components/ui/SequenceEditor/SequenceEditorStatusBar.tsx
|
|
91
|
-
var
|
|
92
|
-
let n = S(), r = t(e, (e) => e.isRealigning), i = t(e, (e) => e.latestMessage), a = t(e, (e) => e.
|
|
92
|
+
var ie = () => {
|
|
93
|
+
let n = S(), r = t(e, (e) => e.isRealigning), i = t(e, (e) => e.latestMessage), a = t(e, (e) => e.engineMeta), o = t(e, (e) => e.selection), s = h(() => l.getStatusBarSelectionStats(o, a), [a, o]);
|
|
93
94
|
return /* @__PURE__ */ w(v, {
|
|
94
95
|
sx: {
|
|
95
96
|
backgroundColor: x(n.palette.background.paper, .1),
|
|
@@ -133,8 +134,8 @@ var re = () => {
|
|
|
133
134
|
]
|
|
134
135
|
})
|
|
135
136
|
});
|
|
136
|
-
},
|
|
137
|
-
let [r, i] = _(""), a = g(null), o = r === "" ||
|
|
137
|
+
}, ae = /^(?:\d+|,\d+|\d+,\d+)$/, oe = k(({ onActionsChange: e, onClose: t, onGotoPosition: n }) => {
|
|
138
|
+
let [r, i] = _(""), a = g(null), o = r === "" || ae.test(r);
|
|
138
139
|
m(() => {
|
|
139
140
|
a.current?.focus();
|
|
140
141
|
}, []);
|
|
@@ -187,34 +188,34 @@ var re = () => {
|
|
|
187
188
|
fullWidth: !0,
|
|
188
189
|
maxWidth: "xs",
|
|
189
190
|
testId: "SequenceEditorGotoPositionDialog"
|
|
190
|
-
}),
|
|
191
|
-
let y = t(e, (e) => e.isRealigning), b = t(e, (e) => e.rawFasta), x = t(e, (e) => e.
|
|
191
|
+
}), se = () => {
|
|
192
|
+
let y = t(e, (e) => e.isRealigning), b = t(e, (e) => e.rawFasta), x = t(e, (e) => e.setEngineMeta), k = t(e, (e) => e.setSelection), ae = g(null), se = g(null), ce = g(null), A = h(() => C.resolve(u), []), j = g(null), M = g(null), le = g(null), N = g(null), P = g(null), F = g(null), ue = g(null), [I, de] = _({
|
|
192
193
|
height: 0,
|
|
193
194
|
width: 0
|
|
194
|
-
}), [
|
|
195
|
+
}), [fe, pe] = _(() => C.resolve(D).data), L = g(0), R = g(0), z = h(() => new E({
|
|
195
196
|
scrollLeft: 0,
|
|
196
197
|
scrollTop: 0
|
|
197
|
-
}), []),
|
|
198
|
+
}), []), me = g(I), B = h(() => new E(null), []), V = h(() => new E(null), []), H = g(null), U = g(null), W = h(() => new E(n), []), G = h(() => new E(null), []), K = g(null), q = g(0), J = g(null), he = g(!1), Y = S();
|
|
198
199
|
m(() => {
|
|
199
|
-
y ?
|
|
200
|
+
y ? ce.current?.open() : ce.current?.close();
|
|
200
201
|
}, [y]);
|
|
201
202
|
let X = p(() => {
|
|
202
|
-
let e =
|
|
203
|
+
let e = ue.current;
|
|
203
204
|
if (!e) return;
|
|
204
205
|
let t = W.data, n = B.data;
|
|
205
206
|
if (t && n) {
|
|
206
207
|
let e = t.labelWidth + t.cellWidth + n.alignmentWidth * t.cellWidth, r = t.rulerHeight + n.sequenceCount * t.cellHeight;
|
|
207
208
|
R.current !== e && (R.current = e), L.current !== r && (L.current = r);
|
|
208
209
|
}
|
|
209
|
-
let { height: r, width: i } =
|
|
210
|
+
let { height: r, width: i } = me.current, a = `${Math.max(R.current, i)}px`, o = `${Math.max(L.current, r)}px`;
|
|
210
211
|
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(
|
|
212
|
+
}, [W, B]), Z = p(async (e) => {
|
|
213
|
+
let t = C.resolve(u).getMetaData(e), n = await t;
|
|
214
|
+
return t.abortSignal?.aborted ? null : (B.next(n), n);
|
|
214
215
|
}, [B]), Q = p(() => {
|
|
215
216
|
let e = W.data, t = B.data;
|
|
216
217
|
if (!t || !e) return;
|
|
217
|
-
let { scrollLeft: n, scrollTop: r } = z.data, { height: i, width: a } =
|
|
218
|
+
let { scrollLeft: n, scrollTop: r } = z.data, { height: i, width: a } = me.current, o = l.getVisibleGridRange({
|
|
218
219
|
geometry: e,
|
|
219
220
|
numCols: t.alignmentWidth,
|
|
220
221
|
numRows: t.sequenceCount,
|
|
@@ -236,14 +237,14 @@ var re = () => {
|
|
|
236
237
|
B,
|
|
237
238
|
z,
|
|
238
239
|
V
|
|
239
|
-
]),
|
|
240
|
-
|
|
240
|
+
]), ge = re((e, t) => {
|
|
241
|
+
de({
|
|
241
242
|
height: t,
|
|
242
243
|
width: e
|
|
243
244
|
});
|
|
244
245
|
}, 0, { trailing: !0 });
|
|
245
246
|
m(() => {
|
|
246
|
-
|
|
247
|
+
me.current = I, X(), Q();
|
|
247
248
|
}, [
|
|
248
249
|
I,
|
|
249
250
|
X,
|
|
@@ -281,18 +282,25 @@ var re = () => {
|
|
|
281
282
|
let t = new ResizeObserver(([e]) => {
|
|
282
283
|
if (!e) return;
|
|
283
284
|
let t = Math.max(1, e.contentRect.height), n = Math.max(1, e.contentRect.width);
|
|
284
|
-
|
|
285
|
+
ge(n, t);
|
|
285
286
|
});
|
|
286
287
|
return t.observe(e), () => t.disconnect();
|
|
287
|
-
}, [A,
|
|
288
|
-
|
|
288
|
+
}, [A, ge]), m(() => {
|
|
289
|
+
let e = new AbortController();
|
|
290
|
+
return (async () => {
|
|
289
291
|
H.current = null, U.current = null, z.next({
|
|
290
292
|
scrollLeft: 0,
|
|
291
293
|
scrollTop: 0
|
|
292
|
-
}), G.next(null)
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
294
|
+
}), G.next(null);
|
|
295
|
+
let t = A.initialize(e.signal);
|
|
296
|
+
if (await t, t.abortSignal?.aborted) return;
|
|
297
|
+
let n = A.reset(e.signal);
|
|
298
|
+
if (await n, n.abortSignal?.aborted) return;
|
|
299
|
+
let r = A.loadFasta(b, e.signal);
|
|
300
|
+
await r, !r.abortSignal?.aborted && await Z(e.signal);
|
|
301
|
+
})().catch((t) => {
|
|
302
|
+
e.signal.aborted || console.error(t);
|
|
303
|
+
}), () => e.abort();
|
|
296
304
|
}, [
|
|
297
305
|
A,
|
|
298
306
|
b,
|
|
@@ -301,79 +309,85 @@ var re = () => {
|
|
|
301
309
|
Z,
|
|
302
310
|
Q
|
|
303
311
|
]), m(() => {
|
|
304
|
-
let t = null, n = !0, r = null, i = null, a = async () => {
|
|
305
|
-
if (n && !
|
|
306
|
-
|
|
312
|
+
let t = null, n = !0, r = null, i = null, a = null, o = async () => {
|
|
313
|
+
if (n && !he.current) {
|
|
314
|
+
he.current = !0;
|
|
307
315
|
try {
|
|
308
316
|
for (; n && J.current;) {
|
|
309
|
-
let
|
|
317
|
+
let o = J.current;
|
|
310
318
|
J.current = null;
|
|
311
|
-
let
|
|
319
|
+
let s = q.current, c = r;
|
|
320
|
+
if (!c || c.signal.aborted) return;
|
|
312
321
|
if (!U.current || !l.isWithinGridRange({
|
|
313
322
|
cachedGridRange: U.current.range,
|
|
314
|
-
visibleGridRange:
|
|
323
|
+
visibleGridRange: o.visibleGridRange.visible
|
|
315
324
|
})) {
|
|
316
325
|
let e = [];
|
|
317
|
-
for (let t =
|
|
318
|
-
|
|
326
|
+
for (let t = o.visibleGridRange.cache.startRow; t <= o.visibleGridRange.cache.endRow; t++) {
|
|
327
|
+
let n = A.name(t, c.signal);
|
|
328
|
+
if (e.push(await n), n.abortSignal?.aborted) return;
|
|
329
|
+
}
|
|
330
|
+
if (!n || c.signal.aborted) return;
|
|
319
331
|
U.current = {
|
|
320
|
-
range:
|
|
332
|
+
range: o.visibleGridRange.cache,
|
|
321
333
|
rowNames: e
|
|
322
334
|
};
|
|
323
335
|
}
|
|
324
336
|
if (!H.current || !l.isWithinGridRange({
|
|
325
337
|
cachedGridRange: H.current.range,
|
|
326
|
-
visibleGridRange:
|
|
338
|
+
visibleGridRange: o.visibleGridRange.visible
|
|
327
339
|
})) {
|
|
328
|
-
let e =
|
|
329
|
-
endCol:
|
|
330
|
-
endRow:
|
|
331
|
-
startCol:
|
|
332
|
-
startRow:
|
|
333
|
-
});
|
|
334
|
-
if (!n) return;
|
|
340
|
+
let e = A.viewport({
|
|
341
|
+
endCol: o.visibleGridRange.cache.endCol,
|
|
342
|
+
endRow: o.visibleGridRange.cache.endRow,
|
|
343
|
+
startCol: o.visibleGridRange.cache.startCol,
|
|
344
|
+
startRow: o.visibleGridRange.cache.startRow
|
|
345
|
+
}, c.signal), t = await e;
|
|
346
|
+
if (!n || e.abortSignal?.aborted) return;
|
|
335
347
|
H.current = {
|
|
336
|
-
range:
|
|
337
|
-
viewportResult:
|
|
348
|
+
range: o.visibleGridRange.cache,
|
|
349
|
+
viewportResult: t
|
|
338
350
|
};
|
|
339
351
|
}
|
|
340
|
-
|
|
341
|
-
n &&
|
|
352
|
+
s === q.current && (t !== null && cancelAnimationFrame(t), t = requestAnimationFrame(() => {
|
|
353
|
+
n && s === q.current && j.current && e.getState().nucleotidePalette && H.current && B.data && U.current && (M.current = l.drawCanvas({
|
|
342
354
|
canvasElement: j.current,
|
|
343
355
|
devicePixelRatio: C.resolve(D).data,
|
|
344
|
-
geometry:
|
|
356
|
+
geometry: o.geometry,
|
|
345
357
|
meta: B.data,
|
|
346
358
|
palette: e.getState().nucleotidePalette,
|
|
347
359
|
rowNames: U.current.rowNames,
|
|
348
360
|
rowNamesStartRow: U.current.range.startRow,
|
|
349
|
-
scrollLeft:
|
|
350
|
-
scrollTop:
|
|
351
|
-
searchResult:
|
|
352
|
-
searchResultHighlightedIndex:
|
|
361
|
+
scrollLeft: o.scrollLeft,
|
|
362
|
+
scrollTop: o.scrollTop,
|
|
363
|
+
searchResult: i,
|
|
364
|
+
searchResultHighlightedIndex: a,
|
|
353
365
|
selection: G.data,
|
|
354
366
|
viewport: H.current.viewportResult,
|
|
355
|
-
viewportHeight:
|
|
356
|
-
viewportWidth:
|
|
367
|
+
viewportHeight: o.viewportHeight,
|
|
368
|
+
viewportWidth: o.viewportWidth
|
|
357
369
|
}));
|
|
358
370
|
}));
|
|
359
371
|
}
|
|
372
|
+
} catch (e) {
|
|
373
|
+
if (!(e instanceof DOMException && e.name === "AbortError")) throw e;
|
|
360
374
|
} finally {
|
|
361
|
-
|
|
375
|
+
he.current = !1, n && J.current && o();
|
|
362
376
|
}
|
|
363
377
|
}
|
|
364
|
-
},
|
|
378
|
+
}, s = [e.subscribe((e, t) => {
|
|
365
379
|
let n = !1;
|
|
366
|
-
e.searchResult !== t.searchResult && (
|
|
380
|
+
e.searchResult !== t.searchResult && (i = e.searchResult, n = !0), e.searchResultHighlightedIndex !== t.searchResultHighlightedIndex && (a = e.searchResultHighlightedIndex, l.scrollToSearchResult({
|
|
367
381
|
geometry: W.data,
|
|
368
382
|
scrollContainer: F.current,
|
|
369
383
|
searchResult: e.searchResult,
|
|
370
384
|
searchResultHighlightedIndex: e.searchResultHighlightedIndex
|
|
371
385
|
}), n = !0), n && Q();
|
|
372
386
|
}), V.subscribe((e) => {
|
|
373
|
-
e && (J.current = e, q.current += 1,
|
|
387
|
+
e && (r?.abort(), r = new AbortController(), J.current = e, q.current += 1, o());
|
|
374
388
|
})];
|
|
375
389
|
return () => {
|
|
376
|
-
n = !1, J.current = null, t !== null && cancelAnimationFrame(t), q.current += 1,
|
|
390
|
+
n = !1, r?.abort(), J.current = null, t !== null && cancelAnimationFrame(t), q.current += 1, s.forEach((e) => e());
|
|
377
391
|
};
|
|
378
392
|
}, [
|
|
379
393
|
A,
|
|
@@ -396,7 +410,7 @@ var re = () => {
|
|
|
396
410
|
}),
|
|
397
411
|
G.subscribe(() => Q()),
|
|
398
412
|
C.resolve(D).subscribe((e) => {
|
|
399
|
-
|
|
413
|
+
pe(e), X(), Q();
|
|
400
414
|
})
|
|
401
415
|
];
|
|
402
416
|
return () => {
|
|
@@ -419,6 +433,7 @@ var re = () => {
|
|
|
419
433
|
element: P.current,
|
|
420
434
|
...e.shortcut
|
|
421
435
|
}), n = [
|
|
436
|
+
t(s.copySelection),
|
|
422
437
|
t(s.expandSelectionLeft),
|
|
423
438
|
t(s.expandSelectionRight),
|
|
424
439
|
t(s.expandSelectionUp),
|
|
@@ -440,7 +455,10 @@ var re = () => {
|
|
|
440
455
|
t(s.insertGap),
|
|
441
456
|
t(s.deleteBackward),
|
|
442
457
|
t(s.deleteSelection),
|
|
458
|
+
t(s.deleteRows),
|
|
459
|
+
t(s.deleteRowsMac),
|
|
443
460
|
t(s.deleteBase),
|
|
461
|
+
t(s.pasteFasta),
|
|
444
462
|
t(s.undo),
|
|
445
463
|
t(s.redo),
|
|
446
464
|
t(s.gotoPosition),
|
|
@@ -459,18 +477,19 @@ var re = () => {
|
|
|
459
477
|
};
|
|
460
478
|
}, []), m(() => {
|
|
461
479
|
let t = async (e) => {
|
|
462
|
-
let {
|
|
480
|
+
let { abortSignal: t, command: n, getSelectionPostCommand: r, invalidateRowNames: i } = e;
|
|
463
481
|
try {
|
|
464
482
|
let e = B.data?.undoDepth;
|
|
465
|
-
await
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
483
|
+
if (await n(), t?.aborted) return;
|
|
484
|
+
H.current = null, i && (U.current = null);
|
|
485
|
+
let a = await Z();
|
|
486
|
+
if (r) {
|
|
487
|
+
if (e !== void 0 && a?.undoDepth === e) return;
|
|
488
|
+
let t = r();
|
|
470
489
|
G.next(t), K.current = t;
|
|
471
490
|
}
|
|
472
491
|
} catch (e) {
|
|
473
|
-
console.error("Failed to post command:", e);
|
|
492
|
+
t?.aborted || console.error("Failed to post command:", e);
|
|
474
493
|
}
|
|
475
494
|
}, n = async (e) => {
|
|
476
495
|
if (!B.data) return;
|
|
@@ -520,14 +539,72 @@ var re = () => {
|
|
|
520
539
|
},
|
|
521
540
|
getSelectionPostCommand: () => l.getPostUpsertSelection(G.data, e)
|
|
522
541
|
});
|
|
523
|
-
}, f = C.resolve(i), p =
|
|
542
|
+
}, f = C.resolve(i), p = null, m = null, h = async (n) => {
|
|
543
|
+
if (e.getState().isRealigning || !n.trimStart().startsWith(">")) return;
|
|
544
|
+
m?.abort();
|
|
545
|
+
let r = new AbortController();
|
|
546
|
+
m = r;
|
|
547
|
+
try {
|
|
548
|
+
await t({
|
|
549
|
+
abortSignal: r.signal,
|
|
550
|
+
command: async () => {
|
|
551
|
+
let t = A.loadFasta(n, r.signal);
|
|
552
|
+
await t, !t.abortSignal?.aborted && (e.getState().searchQuery && f.emit("onSearch", e.getState().searchQuery), e.getState().setLatestMessage("Pasted sequences from clipboard"));
|
|
553
|
+
},
|
|
554
|
+
getSelectionPostCommand: () => l.getPostPasteSequencesSelection(G.data, n),
|
|
555
|
+
invalidateRowNames: !0
|
|
556
|
+
});
|
|
557
|
+
} catch (t) {
|
|
558
|
+
r.signal.aborted || (console.error("Failed to load FASTA from clipboard:", t), e.getState().setLatestMessage("Failed to load FASTA from clipboard."));
|
|
559
|
+
} finally {
|
|
560
|
+
m === r && (m = null);
|
|
561
|
+
}
|
|
562
|
+
}, g = (e) => {
|
|
563
|
+
let t = e.target;
|
|
564
|
+
if (t instanceof HTMLElement && (t.isContentEditable || t.closest("input, textarea, select"))) return;
|
|
565
|
+
let n = e.clipboardData?.getData("text/plain") ?? "";
|
|
566
|
+
n.trimStart().startsWith(">") && (e.preventDefault(), h(n));
|
|
567
|
+
};
|
|
568
|
+
C.resolve(ne).window.addEventListener("paste", g);
|
|
569
|
+
let _ = [
|
|
570
|
+
() => C.resolve(ne).window.removeEventListener("paste", g),
|
|
524
571
|
f.addEventListener("onSearch", async (t) => {
|
|
525
|
-
if (!t)
|
|
526
|
-
|
|
527
|
-
|
|
572
|
+
if (!t) {
|
|
573
|
+
p?.abort();
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
p?.abort();
|
|
577
|
+
let n = new AbortController();
|
|
578
|
+
p = n;
|
|
579
|
+
let r = A.search(t, !0, n.signal);
|
|
580
|
+
try {
|
|
581
|
+
let t = await r;
|
|
582
|
+
r.abortSignal?.aborted || e.getState().setSearchResult(t);
|
|
583
|
+
} catch (e) {
|
|
584
|
+
n.signal.aborted || console.error("Failed to search sequences:", e);
|
|
585
|
+
}
|
|
528
586
|
}),
|
|
529
587
|
f.addEventListener("onExpandSelection", (e) => o(e)),
|
|
530
|
-
f.addEventListener("
|
|
588
|
+
f.addEventListener("onCopySelection", async () => {
|
|
589
|
+
let t = G.data;
|
|
590
|
+
if (t) try {
|
|
591
|
+
let n = await A.exportGappedFasta(), r = l.getSelectedFasta(n, t);
|
|
592
|
+
if (!r) return;
|
|
593
|
+
await navigator.clipboard.writeText(r), e.getState().setLatestMessage("Copied selected sequences to clipboard");
|
|
594
|
+
} catch (t) {
|
|
595
|
+
console.error("Failed to copy selected sequences:", t), e.getState().setLatestMessage("Failed to copy selected sequences to clipboard.");
|
|
596
|
+
}
|
|
597
|
+
}),
|
|
598
|
+
f.addEventListener("onPasteFasta", async () => {
|
|
599
|
+
try {
|
|
600
|
+
console.log("Reading FASTA from clipboard");
|
|
601
|
+
let e = await navigator.clipboard.readText();
|
|
602
|
+
await h(e);
|
|
603
|
+
} catch (t) {
|
|
604
|
+
console.error("Failed to read FASTA from clipboard:", t), e.getState().setLatestMessage("Failed to read FASTA from clipboard.");
|
|
605
|
+
}
|
|
606
|
+
}),
|
|
607
|
+
f.addEventListener("onGotoPosition", () => se.current?.open({})),
|
|
531
608
|
f.addEventListener("onMoveSelection", (e) => r(e)),
|
|
532
609
|
f.addEventListener("onMoveRows", (e) => {
|
|
533
610
|
u(e);
|
|
@@ -574,6 +651,16 @@ var re = () => {
|
|
|
574
651
|
});
|
|
575
652
|
})();
|
|
576
653
|
}),
|
|
654
|
+
f.addEventListener("onDeleteRows", () => {
|
|
655
|
+
(async () => {
|
|
656
|
+
let n = G.data, r = n?.rows, i = B.data;
|
|
657
|
+
r?.length && i && (await t({
|
|
658
|
+
command: async () => A.deleteRows(r),
|
|
659
|
+
getSelectionPostCommand: () => l.getPostDeleteRowsSelection(n, i.sequenceCount),
|
|
660
|
+
invalidateRowNames: !0
|
|
661
|
+
}), e.getState().setLatestMessage(`${r.length} row${r.length > 1 ? "s" : ""} deleted`));
|
|
662
|
+
})();
|
|
663
|
+
}),
|
|
577
664
|
f.addEventListener("onMutateSelection", (e) => {
|
|
578
665
|
n(e);
|
|
579
666
|
}),
|
|
@@ -622,7 +709,7 @@ var re = () => {
|
|
|
622
709
|
}),
|
|
623
710
|
f.addEventListener("onExportToLoculus", async () => {
|
|
624
711
|
let t = await A.exportUngappedFasta(), { parsedMetadata: n, rawFasta: r } = e.getState();
|
|
625
|
-
|
|
712
|
+
ae.current?.open({
|
|
626
713
|
fasta: t,
|
|
627
714
|
metaData: n,
|
|
628
715
|
rawFasta: r
|
|
@@ -630,7 +717,7 @@ var re = () => {
|
|
|
630
717
|
})
|
|
631
718
|
];
|
|
632
719
|
return () => {
|
|
633
|
-
p.forEach((e) => e()), A.cancelRealign();
|
|
720
|
+
window.removeEventListener("paste", g), p?.abort(), m?.abort(), _.forEach((e) => e()), A.cancelRealign();
|
|
634
721
|
};
|
|
635
722
|
}, [
|
|
636
723
|
A,
|
|
@@ -641,13 +728,13 @@ var re = () => {
|
|
|
641
728
|
]), m(() => {
|
|
642
729
|
Q();
|
|
643
730
|
}, [Q]);
|
|
644
|
-
let
|
|
731
|
+
let _e = p((e) => {
|
|
645
732
|
let t = e.currentTarget;
|
|
646
733
|
z.next({
|
|
647
734
|
scrollLeft: t.scrollLeft,
|
|
648
735
|
scrollTop: t.scrollTop
|
|
649
736
|
});
|
|
650
|
-
}, [z]),
|
|
737
|
+
}, [z]), ve = p((e) => {
|
|
651
738
|
P.current?.focus();
|
|
652
739
|
let t = e.currentTarget, n = t.getBoundingClientRect(), r = e.clientX >= n.left + t.clientWidth, i = e.clientY >= n.top + t.clientHeight;
|
|
653
740
|
if (r || i) return;
|
|
@@ -676,13 +763,13 @@ var re = () => {
|
|
|
676
763
|
});
|
|
677
764
|
if (!t) return;
|
|
678
765
|
e.preventDefault(), N.current = u, G.next(t), K.current = t;
|
|
679
|
-
} else e.preventDefault(), N.current = null,
|
|
766
|
+
} else e.preventDefault(), N.current = null, le.current = {
|
|
680
767
|
startLabelWidth: W.data.labelWidth,
|
|
681
768
|
startX: e.clientX
|
|
682
769
|
};
|
|
683
770
|
}
|
|
684
|
-
}, [W, G]),
|
|
685
|
-
let t = j.current, n = P.current, r = C.resolve(D).data, i =
|
|
771
|
+
}, [W, G]), ye = p((e) => {
|
|
772
|
+
let t = j.current, n = P.current, r = C.resolve(D).data, i = le.current;
|
|
686
773
|
if (!n || !t) return;
|
|
687
774
|
if (i) {
|
|
688
775
|
let t = Math.min($, Math.max(120, i.startLabelWidth + e.clientX - i.startX));
|
|
@@ -723,16 +810,16 @@ var re = () => {
|
|
|
723
810
|
W,
|
|
724
811
|
$,
|
|
725
812
|
G
|
|
726
|
-
]),
|
|
727
|
-
|
|
728
|
-
}, []),
|
|
813
|
+
]), be = p(() => {
|
|
814
|
+
le.current = null, N.current = null;
|
|
815
|
+
}, []), xe = p((e, t) => {
|
|
729
816
|
l.scrollToPosition({
|
|
730
817
|
geometry: W.data,
|
|
731
818
|
scrollContainer: F.current,
|
|
732
819
|
x: e,
|
|
733
820
|
y: t
|
|
734
821
|
});
|
|
735
|
-
}, [W]),
|
|
822
|
+
}, [W]), Se = Math.max(1, Math.floor(I.width * fe)), Ce = Math.max(1, Math.floor(I.height * fe));
|
|
736
823
|
return /* @__PURE__ */ T(v, {
|
|
737
824
|
sx: {
|
|
738
825
|
display: "grid",
|
|
@@ -744,7 +831,7 @@ var re = () => {
|
|
|
744
831
|
children: [
|
|
745
832
|
/* @__PURE__ */ w(d, {}),
|
|
746
833
|
/* @__PURE__ */ T(v, {
|
|
747
|
-
onMouseUp:
|
|
834
|
+
onMouseUp: be,
|
|
748
835
|
ref: P,
|
|
749
836
|
sx: {
|
|
750
837
|
height: `calc(100% - ${Y.spacing(3)})`,
|
|
@@ -755,9 +842,9 @@ var re = () => {
|
|
|
755
842
|
tabIndex: 0,
|
|
756
843
|
children: [
|
|
757
844
|
/* @__PURE__ */ w(v, {
|
|
758
|
-
onMouseDown:
|
|
759
|
-
onMouseMove:
|
|
760
|
-
onScroll:
|
|
845
|
+
onMouseDown: ve,
|
|
846
|
+
onMouseMove: ye,
|
|
847
|
+
onScroll: _e,
|
|
761
848
|
ref: F,
|
|
762
849
|
sx: {
|
|
763
850
|
height: "100%",
|
|
@@ -768,12 +855,12 @@ var re = () => {
|
|
|
768
855
|
zIndex: 1
|
|
769
856
|
},
|
|
770
857
|
children: /* @__PURE__ */ w(v, {
|
|
771
|
-
ref:
|
|
858
|
+
ref: ue,
|
|
772
859
|
sx: { pointerEvents: "none" }
|
|
773
860
|
})
|
|
774
861
|
}),
|
|
775
862
|
/* @__PURE__ */ w("canvas", {
|
|
776
|
-
height:
|
|
863
|
+
height: Ce,
|
|
777
864
|
ref: j,
|
|
778
865
|
style: {
|
|
779
866
|
display: "block",
|
|
@@ -786,7 +873,7 @@ var re = () => {
|
|
|
786
873
|
width: `${I.width}px`,
|
|
787
874
|
zIndex: 0
|
|
788
875
|
},
|
|
789
|
-
width:
|
|
876
|
+
width: Se
|
|
790
877
|
}),
|
|
791
878
|
/* @__PURE__ */ w(v, {
|
|
792
879
|
sx: {
|
|
@@ -797,19 +884,19 @@ var re = () => {
|
|
|
797
884
|
width: "100%",
|
|
798
885
|
zIndex: 2
|
|
799
886
|
},
|
|
800
|
-
children: /* @__PURE__ */ w(
|
|
887
|
+
children: /* @__PURE__ */ w(ie, {})
|
|
801
888
|
})
|
|
802
889
|
]
|
|
803
890
|
}),
|
|
804
|
-
/* @__PURE__ */ w(
|
|
805
|
-
onGotoPosition:
|
|
806
|
-
ref:
|
|
891
|
+
/* @__PURE__ */ w(oe, {
|
|
892
|
+
onGotoPosition: xe,
|
|
893
|
+
ref: se
|
|
807
894
|
}),
|
|
808
|
-
/* @__PURE__ */ w(f, { ref:
|
|
809
|
-
/* @__PURE__ */ w(te, { ref:
|
|
895
|
+
/* @__PURE__ */ w(f, { ref: ce }),
|
|
896
|
+
/* @__PURE__ */ w(te, { ref: ae })
|
|
810
897
|
]
|
|
811
898
|
});
|
|
812
899
|
};
|
|
813
|
-
export {
|
|
900
|
+
export { se as t };
|
|
814
901
|
|
|
815
902
|
//# sourceMappingURL=SequenceEditor.js.map
|