@rivm-loculus-tools/sequence-editor 1.0.1 → 1.1.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/SequenceEditor.js +191 -171
- package/dist/_chunks/SequenceEditor.js.map +1 -1
- package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -1
- package/dist/assets/{index-B5Du4hQk.js → index-DsKOK2HN.js} +2 -2
- package/dist/assets/index-DsKOK2HN.js.map +1 -0
- package/dist/classes/services/EditorWorkerService/EditorWorkerService.d.ts +7 -2
- package/dist/classes/services/EditorWorkerService/index.js +26 -1
- package/dist/classes/services/EditorWorkerService/index.js.map +1 -1
- package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +2 -0
- package/dist/classes/workers/EngineWorker/EngineWorker.d.ts +7 -2
- package/dist/classes/workers/EngineWorker/index.js +27 -1
- package/dist/classes/workers/EngineWorker/index.js.map +1 -1
- package/dist/components/ui/SequenceEditorPageHeader/index.js +69 -38
- package/dist/components/ui/SequenceEditorPageHeader/index.js.map +1 -1
- package/dist/models/config.models.d.ts +2 -0
- package/dist/models/editor.models.d.ts +26 -10
- package/dist/models/editor.models.js.map +1 -1
- package/dist/pages/SequenceEditorMainPage/index.js +18 -39
- package/dist/pages/SequenceEditorMainPage/index.js.map +1 -1
- package/dist/utils/EditorUtil/EditorUtil.d.ts +4 -2
- package/dist/utils/EditorUtil/index.js +81 -28
- package/dist/utils/EditorUtil/index.js.map +1 -1
- package/dist/utils/SequenceEditorStandardConfigUtil/SequenceEditorStandardConfigUtil.d.ts +2 -1
- package/dist/utils/SequenceEditorStandardConfigUtil/index.js +0 -1
- package/dist/utils/SequenceEditorStandardConfigUtil/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/assets/index-B5Du4hQk.js.map +0 -1
|
@@ -14,9 +14,10 @@ import { container as b } from "tsyringe";
|
|
|
14
14
|
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
15
15
|
import { Subject as C } from "@gen-epix/ui-core/classes/Subject";
|
|
16
16
|
import { DEVICE_PIXEL_RATIO_SERVICE_TOKEN as w, KEYBOARD_SHORTCUT_SERVICE_TOKEN as T } from "@rivm-loculus-tools/common-frontend/constants/config.constants";
|
|
17
|
-
import {
|
|
17
|
+
import { ExportUtil as E } from "@rivm-loculus-tools/common-frontend/utils/ExportUtil";
|
|
18
|
+
import { withDialog as D } from "@gen-epix/ui-core-components/hoc/withDialog";
|
|
18
19
|
//#region ../../../../node_modules/.pnpm/use-debounce@10.1.1_react@19.3.0/node_modules/use-debounce/dist/index.module.js
|
|
19
|
-
function
|
|
20
|
+
function O(e, t, n, r) {
|
|
20
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();
|
|
21
22
|
h.current = e;
|
|
22
23
|
var y = typeof window < "u", b = !t && t !== 0 && y;
|
|
@@ -84,7 +85,7 @@ function D(e, t, n, r) {
|
|
|
84
85
|
}
|
|
85
86
|
//#endregion
|
|
86
87
|
//#region src/components/ui/SequenceEditor/SequenceEditorStatusBar.tsx
|
|
87
|
-
var
|
|
88
|
+
var ee = () => {
|
|
88
89
|
let n = y(), r = t(e, (e) => e.latestMessage), i = t(e, (e) => e.meta), a = t(e, (e) => e.selection), o = p(() => c.getStatusBarSelectionStats(a, i), [i, a]);
|
|
89
90
|
return /* @__PURE__ */ x(g, {
|
|
90
91
|
sx: {
|
|
@@ -119,7 +120,7 @@ var O = () => {
|
|
|
119
120
|
]
|
|
120
121
|
})
|
|
121
122
|
});
|
|
122
|
-
}, k = /^(?:\d+|,\d+|\d+,\d+)$/,
|
|
123
|
+
}, k = /^(?:\d+|,\d+|\d+,\d+)$/, te = D(({ onActionsChange: e, onClose: t, onGotoPosition: n }) => {
|
|
123
124
|
let [r, i] = h(""), a = m(null), o = r === "" || k.test(r);
|
|
124
125
|
f(() => {
|
|
125
126
|
a.current?.focus();
|
|
@@ -173,25 +174,25 @@ var O = () => {
|
|
|
173
174
|
fullWidth: !0,
|
|
174
175
|
maxWidth: "xs",
|
|
175
176
|
testId: "SequenceEditorGotoPositionDialog"
|
|
176
|
-
}),
|
|
177
|
-
let _ = t(e, (e) => e.rawFasta), v = t(e, (e) => e.setLatestMessage),
|
|
177
|
+
}), ne = () => {
|
|
178
|
+
let _ = t(e, (e) => e.rawFasta), v = t(e, (e) => e.setLatestMessage), D = t(e, (e) => e.setMeta), k = t(e, (e) => e.setSelection), ne = m(null), A = p(() => b.resolve(l), []), j = m(null), M = m(null), N = m(null), P = m(null), F = m(null), I = m(null), [L, re] = h({
|
|
178
179
|
height: 0,
|
|
179
180
|
width: 0
|
|
180
|
-
}), [
|
|
181
|
+
}), [ie, ae] = h(() => b.resolve(w).data), [oe, se] = h(0), [ce, le] = h(0), R = p(() => new C({
|
|
181
182
|
scrollLeft: 0,
|
|
182
183
|
scrollTop: 0
|
|
183
|
-
}), []),
|
|
184
|
-
let e =
|
|
184
|
+
}), []), ue = m(L), z = p(() => new C(null), []), B = p(() => new C(null), []), V = m(null), H = m(null), U = p(() => new C(n), []), W = p(() => new C(null), []), G = m(null), K = m(0), q = m(null), J = m(!1), Y = y(), X = d(() => {
|
|
185
|
+
let e = U.data, t = z.data;
|
|
185
186
|
if (!e || !t) return;
|
|
186
187
|
let n = e.labelWidth + e.cellWidth + t.alignmentWidth * e.cellWidth, r = e.rulerHeight + t.sequenceCount * e.cellHeight;
|
|
187
|
-
|
|
188
|
-
}, [
|
|
188
|
+
le(n), se(r);
|
|
189
|
+
}, [U, z]), Z = d(async () => {
|
|
189
190
|
let e = await b.resolve(l).getMetaData();
|
|
190
|
-
|
|
191
|
-
}, [
|
|
192
|
-
let e =
|
|
191
|
+
z.next(e);
|
|
192
|
+
}, [z]), Q = d(() => {
|
|
193
|
+
let e = U.data, t = z.data;
|
|
193
194
|
if (!t || !e) return;
|
|
194
|
-
let { scrollLeft: n, scrollTop: r } =
|
|
195
|
+
let { scrollLeft: n, scrollTop: r } = R.data, { height: i, width: a } = ue.current, o = c.getVisibleGridRange({
|
|
195
196
|
geometry: e,
|
|
196
197
|
numCols: t.alignmentWidth,
|
|
197
198
|
numRows: t.sequenceCount,
|
|
@@ -200,7 +201,7 @@ var O = () => {
|
|
|
200
201
|
viewportHeight: i,
|
|
201
202
|
viewportWidth: a
|
|
202
203
|
});
|
|
203
|
-
|
|
204
|
+
B.next({
|
|
204
205
|
geometry: e,
|
|
205
206
|
scrollLeft: n,
|
|
206
207
|
scrollTop: r,
|
|
@@ -209,94 +210,94 @@ var O = () => {
|
|
|
209
210
|
visibleGridRange: o
|
|
210
211
|
});
|
|
211
212
|
}, [
|
|
212
|
-
|
|
213
|
-
B,
|
|
213
|
+
U,
|
|
214
214
|
z,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
R,
|
|
216
|
+
B
|
|
217
|
+
]), de = O((e, t) => {
|
|
218
|
+
re({
|
|
218
219
|
height: t,
|
|
219
220
|
width: e
|
|
220
221
|
});
|
|
221
222
|
}, 0, { trailing: !0 });
|
|
222
223
|
f(() => {
|
|
223
|
-
|
|
224
|
-
}, [
|
|
225
|
-
let $ =
|
|
224
|
+
ue.current = L, Q();
|
|
225
|
+
}, [L, Q]);
|
|
226
|
+
let $ = L.width > 0 ? L.width / 2 : 120;
|
|
226
227
|
f(() => {
|
|
227
|
-
let e = [
|
|
228
|
-
|
|
229
|
-
}),
|
|
228
|
+
let e = [z.subscribe((e) => {
|
|
229
|
+
D(e);
|
|
230
|
+
}), W.subscribe((e) => {
|
|
230
231
|
k(e);
|
|
231
232
|
})];
|
|
232
233
|
return () => {
|
|
233
|
-
e.forEach((e) => e()), v(null),
|
|
234
|
+
e.forEach((e) => e()), v(null), D(null), k(null);
|
|
234
235
|
};
|
|
235
236
|
}, [
|
|
236
|
-
|
|
237
|
-
|
|
237
|
+
z,
|
|
238
|
+
W,
|
|
238
239
|
v,
|
|
239
|
-
|
|
240
|
+
D,
|
|
240
241
|
k
|
|
241
242
|
]), f(() => {
|
|
242
|
-
if (
|
|
243
|
-
let e =
|
|
244
|
-
e.labelWidth > $ &&
|
|
243
|
+
if (L.width <= 0) return;
|
|
244
|
+
let e = U.data;
|
|
245
|
+
e.labelWidth > $ && U.next({
|
|
245
246
|
...e,
|
|
246
247
|
labelWidth: $
|
|
247
248
|
});
|
|
248
249
|
}, [
|
|
249
|
-
|
|
250
|
-
|
|
250
|
+
L.width,
|
|
251
|
+
U,
|
|
251
252
|
$
|
|
252
253
|
]), f(() => {
|
|
253
|
-
let e =
|
|
254
|
+
let e = I.current;
|
|
254
255
|
if (!e) return;
|
|
255
256
|
let t = new ResizeObserver(([e]) => {
|
|
256
257
|
if (!e) return;
|
|
257
258
|
let t = Math.max(1, e.contentRect.height), n = Math.max(1, e.contentRect.width);
|
|
258
|
-
|
|
259
|
+
de(n, t);
|
|
259
260
|
});
|
|
260
261
|
return t.observe(e), () => t.disconnect();
|
|
261
|
-
}, [
|
|
262
|
+
}, [A, de]), f(() => {
|
|
262
263
|
(async () => {
|
|
263
|
-
|
|
264
|
+
V.current = null, H.current = null, R.next({
|
|
264
265
|
scrollLeft: 0,
|
|
265
266
|
scrollTop: 0
|
|
266
|
-
}),
|
|
267
|
+
}), W.next(null), await A.initialize(), await A.loadFasta(_), await Z(), Q();
|
|
267
268
|
})().catch((e) => {
|
|
268
269
|
console.error(e);
|
|
269
270
|
});
|
|
270
271
|
}, [
|
|
271
|
-
|
|
272
|
+
A,
|
|
272
273
|
_,
|
|
273
|
-
|
|
274
|
-
|
|
274
|
+
R,
|
|
275
|
+
W,
|
|
275
276
|
Z,
|
|
276
277
|
Q
|
|
277
278
|
]), f(() => {
|
|
278
279
|
let t = null, n = !0, r = null, i = null, a = async () => {
|
|
279
|
-
if (n && !
|
|
280
|
-
|
|
280
|
+
if (n && !J.current) {
|
|
281
|
+
J.current = !0;
|
|
281
282
|
try {
|
|
282
|
-
for (; n &&
|
|
283
|
-
let a =
|
|
284
|
-
|
|
285
|
-
let o =
|
|
286
|
-
if (!
|
|
287
|
-
cachedGridRange:
|
|
283
|
+
for (; n && q.current;) {
|
|
284
|
+
let a = q.current;
|
|
285
|
+
q.current = null;
|
|
286
|
+
let o = K.current;
|
|
287
|
+
if (!H.current || !c.isWithinGridRange({
|
|
288
|
+
cachedGridRange: H.current.range,
|
|
288
289
|
visibleGridRange: a.visibleGridRange.visible
|
|
289
290
|
})) {
|
|
290
291
|
let e = [];
|
|
291
|
-
for (let t = a.visibleGridRange.cache.startRow; t <= a.visibleGridRange.cache.endRow; t++) e.push(await
|
|
292
|
+
for (let t = a.visibleGridRange.cache.startRow; t <= a.visibleGridRange.cache.endRow; t++) e.push(await A.name(t));
|
|
292
293
|
if (!n) return;
|
|
293
|
-
|
|
294
|
+
H.current = {
|
|
294
295
|
range: a.visibleGridRange.cache,
|
|
295
296
|
rowNames: e
|
|
296
297
|
};
|
|
297
298
|
}
|
|
298
|
-
if (!
|
|
299
|
-
cachedGridRange:
|
|
299
|
+
if (!V.current || !c.isWithinGridRange({
|
|
300
|
+
cachedGridRange: V.current.range,
|
|
300
301
|
visibleGridRange: a.visibleGridRange.visible
|
|
301
302
|
})) {
|
|
302
303
|
let e = await b.resolve(l).viewport({
|
|
@@ -306,82 +307,82 @@ var O = () => {
|
|
|
306
307
|
startRow: a.visibleGridRange.cache.startRow
|
|
307
308
|
});
|
|
308
309
|
if (!n) return;
|
|
309
|
-
|
|
310
|
+
V.current = {
|
|
310
311
|
range: a.visibleGridRange.cache,
|
|
311
312
|
viewportResult: e
|
|
312
313
|
};
|
|
313
314
|
}
|
|
314
|
-
o ===
|
|
315
|
-
n && o ===
|
|
316
|
-
canvasElement:
|
|
315
|
+
o === K.current && (t !== null && cancelAnimationFrame(t), t = requestAnimationFrame(() => {
|
|
316
|
+
n && o === K.current && j.current && e.getState().nucleotidePalette && V.current && z.data && H.current && (M.current = c.drawCanvas({
|
|
317
|
+
canvasElement: j.current,
|
|
317
318
|
devicePixelRatio: b.resolve(w).data,
|
|
318
319
|
geometry: a.geometry,
|
|
319
|
-
meta:
|
|
320
|
+
meta: z.data,
|
|
320
321
|
palette: e.getState().nucleotidePalette,
|
|
321
|
-
rowNames:
|
|
322
|
-
rowNamesStartRow:
|
|
322
|
+
rowNames: H.current.rowNames,
|
|
323
|
+
rowNamesStartRow: H.current.range.startRow,
|
|
323
324
|
scrollLeft: a.scrollLeft,
|
|
324
325
|
scrollTop: a.scrollTop,
|
|
325
326
|
searchResult: r,
|
|
326
327
|
searchResultHighlightedIndex: i,
|
|
327
|
-
selection:
|
|
328
|
-
viewport:
|
|
328
|
+
selection: W.data,
|
|
329
|
+
viewport: V.current.viewportResult,
|
|
329
330
|
viewportHeight: a.viewportHeight,
|
|
330
331
|
viewportWidth: a.viewportWidth
|
|
331
332
|
}));
|
|
332
333
|
}));
|
|
333
334
|
}
|
|
334
335
|
} finally {
|
|
335
|
-
|
|
336
|
+
J.current = !1, n && q.current && a();
|
|
336
337
|
}
|
|
337
338
|
}
|
|
338
339
|
}, o = [e.subscribe((e, t) => {
|
|
339
340
|
let n = !1;
|
|
340
341
|
e.searchResult !== t.searchResult && (r = e.searchResult, n = !0), e.searchResultHighlightedIndex !== t.searchResultHighlightedIndex && (i = e.searchResultHighlightedIndex, c.scrollToSearchResult({
|
|
341
|
-
geometry:
|
|
342
|
-
scrollContainer:
|
|
342
|
+
geometry: U.data,
|
|
343
|
+
scrollContainer: I.current,
|
|
343
344
|
searchResult: e.searchResult,
|
|
344
345
|
searchResultHighlightedIndex: e.searchResultHighlightedIndex
|
|
345
346
|
}), n = !0), n && Q();
|
|
346
|
-
}),
|
|
347
|
-
e && (
|
|
347
|
+
}), B.subscribe((e) => {
|
|
348
|
+
e && (q.current = e, K.current += 1, a());
|
|
348
349
|
})];
|
|
349
350
|
return () => {
|
|
350
|
-
n = !1,
|
|
351
|
+
n = !1, q.current = null, t !== null && cancelAnimationFrame(t), K.current += 1, o.forEach((e) => e());
|
|
351
352
|
};
|
|
352
353
|
}, [
|
|
353
|
-
|
|
354
|
+
A,
|
|
355
|
+
U,
|
|
356
|
+
z,
|
|
354
357
|
W,
|
|
355
|
-
B,
|
|
356
|
-
G,
|
|
357
358
|
Q,
|
|
358
|
-
|
|
359
|
+
B
|
|
359
360
|
]), f(() => {
|
|
360
361
|
let t = [
|
|
361
362
|
e.subscribe((e, t) => {
|
|
362
363
|
e.nucleotidePalette?.name !== t.nucleotidePalette?.name && Q();
|
|
363
364
|
}),
|
|
364
|
-
|
|
365
|
+
U.subscribe(() => {
|
|
365
366
|
X(), Q();
|
|
366
367
|
}),
|
|
367
|
-
|
|
368
|
-
|
|
368
|
+
R.subscribe(() => Q()),
|
|
369
|
+
z.subscribe((e) => {
|
|
369
370
|
e && (X(), Q());
|
|
370
371
|
}),
|
|
371
|
-
|
|
372
|
+
W.subscribe(() => Q()),
|
|
372
373
|
b.resolve(w).subscribe((e) => {
|
|
373
|
-
|
|
374
|
+
ae(e), X(), Q();
|
|
374
375
|
})
|
|
375
376
|
];
|
|
376
377
|
return () => {
|
|
377
378
|
t.forEach((e) => e());
|
|
378
379
|
};
|
|
379
380
|
}, [
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
B,
|
|
381
|
+
A,
|
|
382
|
+
U,
|
|
383
383
|
z,
|
|
384
|
-
|
|
384
|
+
R,
|
|
385
|
+
W,
|
|
385
386
|
X,
|
|
386
387
|
Q
|
|
387
388
|
]), f(() => {
|
|
@@ -390,7 +391,7 @@ var O = () => {
|
|
|
390
391
|
r.has(t) && (e.preventDefault(), b.resolve(i).emit("onMutateSelection", t));
|
|
391
392
|
}, t = (e) => b.resolve(T).registerShortcut({
|
|
392
393
|
callback: e.callback,
|
|
393
|
-
element:
|
|
394
|
+
element: F.current,
|
|
394
395
|
...e.shortcut
|
|
395
396
|
}), n = [
|
|
396
397
|
t(s.expandSelectionLeft),
|
|
@@ -420,11 +421,11 @@ var O = () => {
|
|
|
420
421
|
t(s.gotoPosition),
|
|
421
422
|
b.resolve(T).registerShortcut({
|
|
422
423
|
callback: e,
|
|
423
|
-
element:
|
|
424
|
+
element: F.current
|
|
424
425
|
}),
|
|
425
426
|
b.resolve(T).registerShortcut({
|
|
426
427
|
callback: e,
|
|
427
|
-
element:
|
|
428
|
+
element: F.current,
|
|
428
429
|
modifiers: [["Shift"]]
|
|
429
430
|
})
|
|
430
431
|
];
|
|
@@ -435,49 +436,58 @@ var O = () => {
|
|
|
435
436
|
let t = async (e) => {
|
|
436
437
|
let { command: t, getSelectionPostCommand: n } = e;
|
|
437
438
|
try {
|
|
438
|
-
if (await t(),
|
|
439
|
+
if (await t(), V.current = null, H.current = null, await Z(), Q(), n) {
|
|
439
440
|
let e = n();
|
|
440
|
-
|
|
441
|
+
W.next(e), G.current = e;
|
|
441
442
|
}
|
|
442
443
|
} catch (e) {
|
|
443
444
|
console.error("Failed to post command:", e);
|
|
444
445
|
}
|
|
445
446
|
}, n = async (e) => {
|
|
446
|
-
if (!
|
|
447
|
-
let n = c.getMutateArguments(
|
|
447
|
+
if (!z.data) return;
|
|
448
|
+
let n = c.getMutateArguments(W.data, z.data);
|
|
448
449
|
n && await t({ command: async () => {
|
|
449
|
-
|
|
450
|
+
await A.mutate(n.rows, n.columns, e);
|
|
450
451
|
} });
|
|
451
452
|
}, r = (e) => {
|
|
452
|
-
if (!
|
|
453
|
-
let t = c.getMovedSelection(
|
|
453
|
+
if (!z.data) return;
|
|
454
|
+
let t = c.getMovedSelection(W.data, e, z.data);
|
|
454
455
|
if (t) {
|
|
455
|
-
if (
|
|
456
|
-
let t = c.getMovedSelection(
|
|
457
|
-
|
|
458
|
-
} else
|
|
456
|
+
if (W.next(t), G.current) {
|
|
457
|
+
let t = c.getMovedSelection(G.current, e, z.data);
|
|
458
|
+
G.current = t;
|
|
459
|
+
} else G.current = t;
|
|
459
460
|
}
|
|
460
461
|
}, o = (e) => {
|
|
461
|
-
if (!
|
|
462
|
-
let t = c.getExpandedSelection(
|
|
463
|
-
t &&
|
|
464
|
-
}, s = async (e) => {
|
|
465
|
-
if (!
|
|
466
|
-
let n = c.getRowsToMove(
|
|
462
|
+
if (!z.data || !G.current || !W.data) return;
|
|
463
|
+
let t = c.getExpandedSelection(W.data, G.current, e, z.data);
|
|
464
|
+
t && W.next(t);
|
|
465
|
+
}, s = async (e) => {
|
|
466
|
+
if (!z.data) return;
|
|
467
|
+
let n = c.getRowsToMove(W.data, e, z.data);
|
|
467
468
|
n && await t({
|
|
468
469
|
command: async () => {
|
|
469
|
-
e === a.UP ? await
|
|
470
|
+
e === a.UP ? (await A.moveRowsToTop(n), I.current && (I.current.scrollTop = 0)) : (await A.moveRowsToBottom(n), I.current && (I.current.scrollTop = I.current.scrollHeight - I.current.clientHeight));
|
|
470
471
|
},
|
|
471
|
-
getSelectionPostCommand: () => c.
|
|
472
|
+
getSelectionPostCommand: () => c.getMovedRowsEndSelection(W.data, e, z.data)
|
|
473
|
+
});
|
|
474
|
+
}, l = async (e) => {
|
|
475
|
+
if (!z.data) return;
|
|
476
|
+
let n = c.getRowsToMove(W.data, e, z.data);
|
|
477
|
+
n && await t({
|
|
478
|
+
command: async () => {
|
|
479
|
+
e === a.UP ? await A.moveRowsUp(n) : await A.moveRowsDown(n);
|
|
480
|
+
},
|
|
481
|
+
getSelectionPostCommand: () => c.getMovedRowsRelativeSelection(W.data, e, z.data)
|
|
472
482
|
});
|
|
473
483
|
}, u = async (e) => {}, d = b.resolve(i), f = [
|
|
474
484
|
d.addEventListener("onSearch", async (t) => {
|
|
475
485
|
if (!t) return;
|
|
476
|
-
let n = await
|
|
486
|
+
let n = await A.search(t, !0);
|
|
477
487
|
e.getState().setSearchResult(n);
|
|
478
488
|
}),
|
|
479
489
|
d.addEventListener("onExpandSelection", (e) => o(e)),
|
|
480
|
-
d.addEventListener("onGotoPosition", () =>
|
|
490
|
+
d.addEventListener("onGotoPosition", () => ne.current?.open({})),
|
|
481
491
|
d.addEventListener("onMoveSelection", (e) => r(e)),
|
|
482
492
|
d.addEventListener("onMoveRows", (e) => {
|
|
483
493
|
l(e);
|
|
@@ -489,38 +499,38 @@ var O = () => {
|
|
|
489
499
|
u(e);
|
|
490
500
|
}),
|
|
491
501
|
d.addEventListener("onScrollToLineStart", () => {
|
|
492
|
-
let e =
|
|
502
|
+
let e = I.current;
|
|
493
503
|
e && (e.scrollLeft = 0);
|
|
494
504
|
}),
|
|
495
505
|
d.addEventListener("onScrollToLineEnd", () => {
|
|
496
|
-
let e =
|
|
506
|
+
let e = I.current;
|
|
497
507
|
e && (e.scrollLeft = e.scrollWidth - e.clientWidth);
|
|
498
508
|
}),
|
|
499
509
|
d.addEventListener("onScrollPageUp", () => {
|
|
500
|
-
let e =
|
|
510
|
+
let e = I.current;
|
|
501
511
|
e && (e.scrollTop = Math.max(0, e.scrollTop - e.clientHeight));
|
|
502
512
|
}),
|
|
503
513
|
d.addEventListener("onScrollPageDown", () => {
|
|
504
|
-
let e =
|
|
514
|
+
let e = I.current;
|
|
505
515
|
e && (e.scrollTop = Math.min(e.scrollHeight - e.clientHeight, e.scrollTop + e.clientHeight));
|
|
506
516
|
}),
|
|
507
517
|
d.addEventListener("onInsert", () => {
|
|
508
518
|
(async () => {
|
|
509
|
-
if (!
|
|
510
|
-
let e = c.getUpsertArguments(
|
|
519
|
+
if (!z.data) return;
|
|
520
|
+
let e = c.getUpsertArguments(W.data, z.data);
|
|
511
521
|
e && await t({
|
|
512
|
-
command: async () =>
|
|
513
|
-
getSelectionPostCommand: () => c.getPostUpsertSelection(
|
|
522
|
+
command: async () => A.insert(e.rows, e.col),
|
|
523
|
+
getSelectionPostCommand: () => c.getPostUpsertSelection(W.data, a.RIGHT)
|
|
514
524
|
});
|
|
515
525
|
})();
|
|
516
526
|
}),
|
|
517
527
|
d.addEventListener("onDeleteBackward", () => {
|
|
518
528
|
(async () => {
|
|
519
|
-
if (!
|
|
520
|
-
let e = c.getUpsertArguments(
|
|
529
|
+
if (!z.data) return;
|
|
530
|
+
let e = c.getUpsertArguments(W.data, z.data, -1);
|
|
521
531
|
e && await t({
|
|
522
|
-
command: async () =>
|
|
523
|
-
getSelectionPostCommand: () => c.getPostUpsertSelection(
|
|
532
|
+
command: async () => A.delete(e.rows, e.col),
|
|
533
|
+
getSelectionPostCommand: () => c.getPostUpsertSelection(W.data, a.LEFT)
|
|
524
534
|
});
|
|
525
535
|
})();
|
|
526
536
|
}),
|
|
@@ -529,40 +539,50 @@ var O = () => {
|
|
|
529
539
|
}),
|
|
530
540
|
d.addEventListener("onUndo", () => {
|
|
531
541
|
t({
|
|
532
|
-
command: async () =>
|
|
542
|
+
command: async () => A.undo(),
|
|
533
543
|
getSelectionPostCommand: () => null
|
|
534
544
|
});
|
|
535
545
|
}),
|
|
536
546
|
d.addEventListener("onRedo", () => {
|
|
537
547
|
t({
|
|
538
|
-
command: async () =>
|
|
548
|
+
command: async () => A.redo(),
|
|
539
549
|
getSelectionPostCommand: () => null
|
|
540
550
|
});
|
|
551
|
+
}),
|
|
552
|
+
d.addEventListener("onExportGappedFasta", async () => {
|
|
553
|
+
console.log("Exporting gapped fasta");
|
|
554
|
+
let e = await A.exportGappedFasta();
|
|
555
|
+
E.downloadFastaFile(e, "sequence.gapped.fasta");
|
|
556
|
+
}),
|
|
557
|
+
d.addEventListener("onExportUngappedFasta", async () => {
|
|
558
|
+
console.log("Exporting ungapped fasta");
|
|
559
|
+
let e = await A.exportUngappedFasta();
|
|
560
|
+
E.downloadFastaFile(e, "sequence.ungapped.fasta");
|
|
541
561
|
})
|
|
542
562
|
];
|
|
543
563
|
return () => {
|
|
544
564
|
f.forEach((e) => e());
|
|
545
565
|
};
|
|
546
566
|
}, [
|
|
547
|
-
|
|
548
|
-
|
|
567
|
+
A,
|
|
568
|
+
W,
|
|
549
569
|
Z,
|
|
550
570
|
Q,
|
|
551
|
-
|
|
571
|
+
z
|
|
552
572
|
]), f(() => {
|
|
553
573
|
Q();
|
|
554
574
|
}, [Q]);
|
|
555
|
-
let
|
|
575
|
+
let fe = d((e) => {
|
|
556
576
|
let t = e.currentTarget;
|
|
557
|
-
|
|
577
|
+
R.next({
|
|
558
578
|
scrollLeft: t.scrollLeft,
|
|
559
579
|
scrollTop: t.scrollTop
|
|
560
580
|
});
|
|
561
|
-
}, [
|
|
562
|
-
|
|
581
|
+
}, [R]), pe = d((e) => {
|
|
582
|
+
F.current?.focus();
|
|
563
583
|
let t = e.currentTarget, n = t.getBoundingClientRect(), r = e.clientX >= n.left + t.clientWidth, i = e.clientY >= n.top + t.clientHeight;
|
|
564
584
|
if (r || i) return;
|
|
565
|
-
let a =
|
|
585
|
+
let a = j.current, s = M.current, l = b.resolve(w).data;
|
|
566
586
|
if (!a || !s) return;
|
|
567
587
|
let u = c.getPathPropertiesFromCanvas({
|
|
568
588
|
canvas: a,
|
|
@@ -573,12 +593,12 @@ var O = () => {
|
|
|
573
593
|
if (u) {
|
|
574
594
|
if (u.type !== o.DIVIDER) {
|
|
575
595
|
if (u.type === o.LABEL && (e.metaKey || e.ctrlKey)) {
|
|
576
|
-
let t =
|
|
577
|
-
if (e.preventDefault(),
|
|
578
|
-
|
|
596
|
+
let t = W.data?.rows ?? [], n = t.includes(u.row) ? t.filter((e) => e !== u.row) : [...t, u.row].sort((e, t) => e - t);
|
|
597
|
+
if (e.preventDefault(), P.current = null, n.length === 0) {
|
|
598
|
+
W.next(null), G.current = null;
|
|
579
599
|
return;
|
|
580
600
|
}
|
|
581
|
-
|
|
601
|
+
W.next({ rows: n }), G.current = { rows: n };
|
|
582
602
|
return;
|
|
583
603
|
}
|
|
584
604
|
let t = c.getSelectionFromPathProperties({
|
|
@@ -586,26 +606,26 @@ var O = () => {
|
|
|
586
606
|
startPath: u
|
|
587
607
|
});
|
|
588
608
|
if (!t) return;
|
|
589
|
-
e.preventDefault(),
|
|
590
|
-
} else e.preventDefault(),
|
|
591
|
-
startLabelWidth:
|
|
609
|
+
e.preventDefault(), P.current = u, W.next(t), G.current = t;
|
|
610
|
+
} else e.preventDefault(), P.current = null, N.current = {
|
|
611
|
+
startLabelWidth: U.data.labelWidth,
|
|
592
612
|
startX: e.clientX
|
|
593
613
|
};
|
|
594
614
|
}
|
|
595
|
-
}, [
|
|
596
|
-
let t =
|
|
615
|
+
}, [U, W]), me = d((e) => {
|
|
616
|
+
let t = j.current, n = F.current, r = b.resolve(w).data, i = N.current;
|
|
597
617
|
if (!n || !t) return;
|
|
598
618
|
if (i) {
|
|
599
619
|
let t = Math.min($, Math.max(120, i.startLabelWidth + e.clientX - i.startX));
|
|
600
|
-
|
|
601
|
-
...
|
|
620
|
+
U.next({
|
|
621
|
+
...U.data,
|
|
602
622
|
labelWidth: t
|
|
603
623
|
}), n.style.cursor = "col-resize";
|
|
604
624
|
return;
|
|
605
625
|
}
|
|
606
|
-
let a =
|
|
626
|
+
let a = P.current;
|
|
607
627
|
if (a) {
|
|
608
|
-
let n =
|
|
628
|
+
let n = M.current;
|
|
609
629
|
if (!n) return;
|
|
610
630
|
let i = c.getPathPropertiesFromCanvas({
|
|
611
631
|
canvas: t,
|
|
@@ -618,10 +638,10 @@ var O = () => {
|
|
|
618
638
|
endPath: i,
|
|
619
639
|
startPath: a
|
|
620
640
|
});
|
|
621
|
-
o && (
|
|
641
|
+
o && (W.next(o), G.current = o);
|
|
622
642
|
return;
|
|
623
643
|
}
|
|
624
|
-
let s =
|
|
644
|
+
let s = M.current;
|
|
625
645
|
if (!s) return;
|
|
626
646
|
let l = c.getPathPropertiesFromCanvas({
|
|
627
647
|
canvas: t,
|
|
@@ -631,19 +651,19 @@ var O = () => {
|
|
|
631
651
|
});
|
|
632
652
|
l && l.type === o.DIVIDER ? n.style.cursor = "col-resize" : n.style.cursor = "default";
|
|
633
653
|
}, [
|
|
634
|
-
|
|
654
|
+
U,
|
|
635
655
|
$,
|
|
636
|
-
|
|
637
|
-
]),
|
|
638
|
-
|
|
639
|
-
}, []),
|
|
656
|
+
W
|
|
657
|
+
]), he = d(() => {
|
|
658
|
+
N.current = null, P.current = null;
|
|
659
|
+
}, []), ge = d((e, t) => {
|
|
640
660
|
c.scrollToPosition({
|
|
641
|
-
geometry:
|
|
642
|
-
scrollContainer:
|
|
661
|
+
geometry: U.data,
|
|
662
|
+
scrollContainer: I.current,
|
|
643
663
|
x: e,
|
|
644
664
|
y: t
|
|
645
665
|
});
|
|
646
|
-
}, [
|
|
666
|
+
}, [U]), _e = Math.max(1, Math.floor(L.width * ie)), ve = Math.max(1, Math.floor(L.height * ie));
|
|
647
667
|
return /* @__PURE__ */ S(g, {
|
|
648
668
|
sx: {
|
|
649
669
|
display: "grid",
|
|
@@ -655,8 +675,8 @@ var O = () => {
|
|
|
655
675
|
children: [
|
|
656
676
|
/* @__PURE__ */ x(u, {}),
|
|
657
677
|
/* @__PURE__ */ S(g, {
|
|
658
|
-
onMouseUp:
|
|
659
|
-
ref:
|
|
678
|
+
onMouseUp: he,
|
|
679
|
+
ref: F,
|
|
660
680
|
sx: {
|
|
661
681
|
height: `calc(100% - ${Y.spacing(3)})`,
|
|
662
682
|
marginBottom: Y.spacing(3),
|
|
@@ -666,10 +686,10 @@ var O = () => {
|
|
|
666
686
|
tabIndex: 0,
|
|
667
687
|
children: [
|
|
668
688
|
/* @__PURE__ */ x(g, {
|
|
669
|
-
onMouseDown:
|
|
670
|
-
onMouseMove:
|
|
671
|
-
onScroll:
|
|
672
|
-
ref:
|
|
689
|
+
onMouseDown: pe,
|
|
690
|
+
onMouseMove: me,
|
|
691
|
+
onScroll: fe,
|
|
692
|
+
ref: I,
|
|
673
693
|
sx: {
|
|
674
694
|
height: "100%",
|
|
675
695
|
overflowX: "scroll",
|
|
@@ -679,26 +699,26 @@ var O = () => {
|
|
|
679
699
|
zIndex: 1
|
|
680
700
|
},
|
|
681
701
|
children: /* @__PURE__ */ x(g, { sx: {
|
|
682
|
-
height: `${Math.max(
|
|
702
|
+
height: `${Math.max(oe, L.height)}px`,
|
|
683
703
|
pointerEvents: "none",
|
|
684
|
-
width: `${Math.max(
|
|
704
|
+
width: `${Math.max(ce, L.width)}px`
|
|
685
705
|
} })
|
|
686
706
|
}),
|
|
687
707
|
/* @__PURE__ */ x("canvas", {
|
|
688
|
-
height:
|
|
689
|
-
ref:
|
|
708
|
+
height: ve,
|
|
709
|
+
ref: j,
|
|
690
710
|
style: {
|
|
691
711
|
display: "block",
|
|
692
|
-
height: `${
|
|
712
|
+
height: `${L.height}px`,
|
|
693
713
|
imageRendering: "pixelated",
|
|
694
714
|
left: 0,
|
|
695
715
|
pointerEvents: "auto",
|
|
696
716
|
position: "absolute",
|
|
697
717
|
top: 0,
|
|
698
|
-
width: `${
|
|
718
|
+
width: `${L.width}px`,
|
|
699
719
|
zIndex: 0
|
|
700
720
|
},
|
|
701
|
-
width:
|
|
721
|
+
width: _e
|
|
702
722
|
}),
|
|
703
723
|
/* @__PURE__ */ x(g, {
|
|
704
724
|
sx: {
|
|
@@ -709,18 +729,18 @@ var O = () => {
|
|
|
709
729
|
width: "100%",
|
|
710
730
|
zIndex: 2
|
|
711
731
|
},
|
|
712
|
-
children: /* @__PURE__ */ x(
|
|
732
|
+
children: /* @__PURE__ */ x(ee, {})
|
|
713
733
|
})
|
|
714
734
|
]
|
|
715
735
|
}),
|
|
716
|
-
/* @__PURE__ */ x(
|
|
717
|
-
onGotoPosition:
|
|
718
|
-
ref:
|
|
736
|
+
/* @__PURE__ */ x(te, {
|
|
737
|
+
onGotoPosition: ge,
|
|
738
|
+
ref: ne
|
|
719
739
|
})
|
|
720
740
|
]
|
|
721
741
|
});
|
|
722
742
|
};
|
|
723
743
|
//#endregion
|
|
724
|
-
export {
|
|
744
|
+
export { ne as t };
|
|
725
745
|
|
|
726
746
|
//# sourceMappingURL=SequenceEditor.js.map
|