@rivm-loculus-tools/sequence-editor 1.0.0 → 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.
Files changed (27) hide show
  1. package/dist/_chunks/SequenceEditor.js +191 -171
  2. package/dist/_chunks/SequenceEditor.js.map +1 -1
  3. package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -1
  4. package/dist/assets/{index-B5Du4hQk.js → index-DsKOK2HN.js} +2 -2
  5. package/dist/assets/index-DsKOK2HN.js.map +1 -0
  6. package/dist/classes/services/EditorWorkerService/EditorWorkerService.d.ts +7 -2
  7. package/dist/classes/services/EditorWorkerService/index.js +26 -1
  8. package/dist/classes/services/EditorWorkerService/index.js.map +1 -1
  9. package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +2 -0
  10. package/dist/classes/workers/EngineWorker/EngineWorker.d.ts +7 -2
  11. package/dist/classes/workers/EngineWorker/index.js +27 -1
  12. package/dist/classes/workers/EngineWorker/index.js.map +1 -1
  13. package/dist/components/ui/SequenceEditorPageHeader/index.js +69 -38
  14. package/dist/components/ui/SequenceEditorPageHeader/index.js.map +1 -1
  15. package/dist/models/config.models.d.ts +2 -0
  16. package/dist/models/editor.models.d.ts +26 -10
  17. package/dist/models/editor.models.js.map +1 -1
  18. package/dist/pages/SequenceEditorMainPage/index.js +18 -39
  19. package/dist/pages/SequenceEditorMainPage/index.js.map +1 -1
  20. package/dist/utils/EditorUtil/EditorUtil.d.ts +4 -2
  21. package/dist/utils/EditorUtil/index.js +81 -28
  22. package/dist/utils/EditorUtil/index.js.map +1 -1
  23. package/dist/utils/SequenceEditorStandardConfigUtil/SequenceEditorStandardConfigUtil.d.ts +2 -1
  24. package/dist/utils/SequenceEditorStandardConfigUtil/index.js +0 -1
  25. package/dist/utils/SequenceEditorStandardConfigUtil/index.js.map +1 -1
  26. package/package.json +3 -3
  27. 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 { withDialog as E } from "@gen-epix/ui-core-components/hoc/withDialog";
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 D(e, t, n, r) {
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 O = () => {
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+)$/, ee = E(({ onActionsChange: e, onClose: t, onGotoPosition: n }) => {
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
- }), A = () => {
177
- let _ = t(e, (e) => e.rawFasta), v = t(e, (e) => e.setLatestMessage), E = t(e, (e) => e.setMeta), k = t(e, (e) => e.setSelection), A = m(null), j = p(() => b.resolve(l), []), M = m(null), N = m(null), P = m(null), F = m(null), I = m(null), L = m(null), [R, te] = h({
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
- }), [ne, re] = h(() => b.resolve(w).data), [ie, ae] = h(0), [oe, se] = h(0), z = p(() => new C({
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
- }), []), ce = m(R), B = p(() => new C(null), []), V = p(() => new C(null), []), H = m(null), U = m(null), W = p(() => new C(n), []), G = p(() => new C(null), []), K = m(null), q = m(0), J = m(null), le = m(!1), Y = y(), X = d(() => {
184
- let e = W.data, t = B.data;
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
- se(n), ae(r);
188
- }, [W, B]), Z = d(async () => {
188
+ le(n), se(r);
189
+ }, [U, z]), Z = d(async () => {
189
190
  let e = await b.resolve(l).getMetaData();
190
- B.next(e);
191
- }, [B]), Q = d(() => {
192
- let e = W.data, t = B.data;
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 } = z.data, { height: i, width: a } = ce.current, o = c.getVisibleGridRange({
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
- V.next({
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
- W,
213
- B,
213
+ U,
214
214
  z,
215
- V
216
- ]), ue = D((e, t) => {
217
- te({
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
- ce.current = R, Q();
224
- }, [R, Q]);
225
- let $ = R.width > 0 ? R.width / 2 : 120;
224
+ ue.current = L, Q();
225
+ }, [L, Q]);
226
+ let $ = L.width > 0 ? L.width / 2 : 120;
226
227
  f(() => {
227
- let e = [B.subscribe((e) => {
228
- E(e);
229
- }), G.subscribe((e) => {
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), E(null), k(null);
234
+ e.forEach((e) => e()), v(null), D(null), k(null);
234
235
  };
235
236
  }, [
236
- B,
237
- G,
237
+ z,
238
+ W,
238
239
  v,
239
- E,
240
+ D,
240
241
  k
241
242
  ]), f(() => {
242
- if (R.width <= 0) return;
243
- let e = W.data;
244
- e.labelWidth > $ && W.next({
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
- R.width,
250
- W,
250
+ L.width,
251
+ U,
251
252
  $
252
253
  ]), f(() => {
253
- let e = L.current;
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
- ue(n, t);
259
+ de(n, t);
259
260
  });
260
261
  return t.observe(e), () => t.disconnect();
261
- }, [j, ue]), f(() => {
262
+ }, [A, de]), f(() => {
262
263
  (async () => {
263
- H.current = null, U.current = null, z.next({
264
+ V.current = null, H.current = null, R.next({
264
265
  scrollLeft: 0,
265
266
  scrollTop: 0
266
- }), G.next(null), await j.initialize(), await j.loadFasta(_), await Z(), Q();
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
- j,
272
+ A,
272
273
  _,
273
- z,
274
- G,
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 && !le.current) {
280
- le.current = !0;
280
+ if (n && !J.current) {
281
+ J.current = !0;
281
282
  try {
282
- for (; n && J.current;) {
283
- let a = J.current;
284
- J.current = null;
285
- let o = q.current;
286
- if (!U.current || !c.isWithinGridRange({
287
- cachedGridRange: U.current.range,
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 j.name(t));
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
- U.current = {
294
+ H.current = {
294
295
  range: a.visibleGridRange.cache,
295
296
  rowNames: e
296
297
  };
297
298
  }
298
- if (!H.current || !c.isWithinGridRange({
299
- cachedGridRange: H.current.range,
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
- H.current = {
310
+ V.current = {
310
311
  range: a.visibleGridRange.cache,
311
312
  viewportResult: e
312
313
  };
313
314
  }
314
- o === q.current && (t !== null && cancelAnimationFrame(t), t = requestAnimationFrame(() => {
315
- n && o === q.current && M.current && e.getState().nucleotidePalette && H.current && B.data && U.current && (N.current = c.drawCanvas({
316
- canvasElement: M.current,
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: B.data,
320
+ meta: z.data,
320
321
  palette: e.getState().nucleotidePalette,
321
- rowNames: U.current.rowNames,
322
- rowNamesStartRow: U.current.range.startRow,
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: G.data,
328
- viewport: H.current.viewportResult,
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
- le.current = !1, n && J.current && a();
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: W.data,
342
- scrollContainer: L.current,
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
- }), V.subscribe((e) => {
347
- e && (J.current = e, q.current += 1, a());
347
+ }), B.subscribe((e) => {
348
+ e && (q.current = e, K.current += 1, a());
348
349
  })];
349
350
  return () => {
350
- n = !1, J.current = null, t !== null && cancelAnimationFrame(t), q.current += 1, o.forEach((e) => e());
351
+ n = !1, q.current = null, t !== null && cancelAnimationFrame(t), K.current += 1, o.forEach((e) => e());
351
352
  };
352
353
  }, [
353
- j,
354
+ A,
355
+ U,
356
+ z,
354
357
  W,
355
- B,
356
- G,
357
358
  Q,
358
- V
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
- W.subscribe(() => {
365
+ U.subscribe(() => {
365
366
  X(), Q();
366
367
  }),
367
- z.subscribe(() => Q()),
368
- B.subscribe((e) => {
368
+ R.subscribe(() => Q()),
369
+ z.subscribe((e) => {
369
370
  e && (X(), Q());
370
371
  }),
371
- G.subscribe(() => Q()),
372
+ W.subscribe(() => Q()),
372
373
  b.resolve(w).subscribe((e) => {
373
- re(e), X(), Q();
374
+ ae(e), X(), Q();
374
375
  })
375
376
  ];
376
377
  return () => {
377
378
  t.forEach((e) => e());
378
379
  };
379
380
  }, [
380
- j,
381
- W,
382
- B,
381
+ A,
382
+ U,
383
383
  z,
384
- G,
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: I.current,
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: I.current
424
+ element: F.current
424
425
  }),
425
426
  b.resolve(T).registerShortcut({
426
427
  callback: e,
427
- element: I.current,
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(), H.current = null, U.current = null, await Z(), Q(), n) {
439
+ if (await t(), V.current = null, H.current = null, await Z(), Q(), n) {
439
440
  let e = n();
440
- G.next(e), K.current = e;
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 (!B.data) return;
447
- let n = c.getMutateArguments(G.data, B.data);
447
+ if (!z.data) return;
448
+ let n = c.getMutateArguments(W.data, z.data);
448
449
  n && await t({ command: async () => {
449
- for (let t = n.startCol; t <= n.endCol; t += 1) await j.mutate(n.rows, t, e);
450
+ await A.mutate(n.rows, n.columns, e);
450
451
  } });
451
452
  }, r = (e) => {
452
- if (!B.data) return;
453
- let t = c.getMovedSelection(G.data, e, B.data);
453
+ if (!z.data) return;
454
+ let t = c.getMovedSelection(W.data, e, z.data);
454
455
  if (t) {
455
- if (G.next(t), K.current) {
456
- let t = c.getMovedSelection(K.current, e, B.data);
457
- K.current = t;
458
- } else K.current = t;
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 (!B.data || !K.current || !G.data) return;
462
- let t = c.getExpandedSelection(G.data, K.current, e, B.data);
463
- t && G.next(t);
464
- }, s = async (e) => {}, l = async (e) => {
465
- if (!B.data) return;
466
- let n = c.getRowsToMove(G.data, e, B.data);
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 j.moveRowsUp(n) : await j.moveRowsDown(n);
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.getMovedSelection(G.data, e, B.data)
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 j.search(t, !0);
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", () => A.current?.open({})),
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 = L.current;
502
+ let e = I.current;
493
503
  e && (e.scrollLeft = 0);
494
504
  }),
495
505
  d.addEventListener("onScrollToLineEnd", () => {
496
- let e = L.current;
506
+ let e = I.current;
497
507
  e && (e.scrollLeft = e.scrollWidth - e.clientWidth);
498
508
  }),
499
509
  d.addEventListener("onScrollPageUp", () => {
500
- let e = L.current;
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 = L.current;
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 (!B.data) return;
510
- let e = c.getUpsertArguments(G.data, B.data);
519
+ if (!z.data) return;
520
+ let e = c.getUpsertArguments(W.data, z.data);
511
521
  e && await t({
512
- command: async () => j.insert(e.rows, e.col),
513
- getSelectionPostCommand: () => c.getPostUpsertSelection(G.data, a.RIGHT)
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 (!B.data) return;
520
- let e = c.getUpsertArguments(G.data, B.data, -1);
529
+ if (!z.data) return;
530
+ let e = c.getUpsertArguments(W.data, z.data, -1);
521
531
  e && await t({
522
- command: async () => j.delete(e.rows, e.col),
523
- getSelectionPostCommand: () => c.getPostUpsertSelection(G.data, a.LEFT)
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 () => j.undo(),
542
+ command: async () => A.undo(),
533
543
  getSelectionPostCommand: () => null
534
544
  });
535
545
  }),
536
546
  d.addEventListener("onRedo", () => {
537
547
  t({
538
- command: async () => j.redo(),
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
- j,
548
- G,
567
+ A,
568
+ W,
549
569
  Z,
550
570
  Q,
551
- B
571
+ z
552
572
  ]), f(() => {
553
573
  Q();
554
574
  }, [Q]);
555
- let de = d((e) => {
575
+ let fe = d((e) => {
556
576
  let t = e.currentTarget;
557
- z.next({
577
+ R.next({
558
578
  scrollLeft: t.scrollLeft,
559
579
  scrollTop: t.scrollTop
560
580
  });
561
- }, [z]), fe = d((e) => {
562
- I.current?.focus();
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 = M.current, s = N.current, l = b.resolve(w).data;
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 = G.data?.rows ?? [], n = t.includes(u.row) ? t.filter((e) => e !== u.row) : [...t, u.row].sort((e, t) => e - t);
577
- if (e.preventDefault(), F.current = null, n.length === 0) {
578
- G.next(null), K.current = null;
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
- G.next({ rows: n }), K.current = { rows: n };
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(), F.current = u, G.next(t), K.current = t;
590
- } else e.preventDefault(), F.current = null, P.current = {
591
- startLabelWidth: W.data.labelWidth,
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
- }, [W, G]), pe = d((e) => {
596
- let t = M.current, n = I.current, r = b.resolve(w).data, i = P.current;
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
- W.next({
601
- ...W.data,
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 = F.current;
626
+ let a = P.current;
607
627
  if (a) {
608
- let n = N.current;
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 && (G.next(o), K.current = o);
641
+ o && (W.next(o), G.current = o);
622
642
  return;
623
643
  }
624
- let s = N.current;
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
- W,
654
+ U,
635
655
  $,
636
- G
637
- ]), me = d(() => {
638
- P.current = null, F.current = null;
639
- }, []), he = d((e, t) => {
656
+ W
657
+ ]), he = d(() => {
658
+ N.current = null, P.current = null;
659
+ }, []), ge = d((e, t) => {
640
660
  c.scrollToPosition({
641
- geometry: W.data,
642
- scrollContainer: L.current,
661
+ geometry: U.data,
662
+ scrollContainer: I.current,
643
663
  x: e,
644
664
  y: t
645
665
  });
646
- }, [W]), ge = Math.max(1, Math.floor(R.width * ne)), _e = Math.max(1, Math.floor(R.height * ne));
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: me,
659
- ref: I,
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: fe,
670
- onMouseMove: pe,
671
- onScroll: de,
672
- ref: L,
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(ie, R.height)}px`,
702
+ height: `${Math.max(oe, L.height)}px`,
683
703
  pointerEvents: "none",
684
- width: `${Math.max(oe, R.width)}px`
704
+ width: `${Math.max(ce, L.width)}px`
685
705
  } })
686
706
  }),
687
707
  /* @__PURE__ */ x("canvas", {
688
- height: _e,
689
- ref: M,
708
+ height: ve,
709
+ ref: j,
690
710
  style: {
691
711
  display: "block",
692
- height: `${R.height}px`,
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: `${R.width}px`,
718
+ width: `${L.width}px`,
699
719
  zIndex: 0
700
720
  },
701
- width: ge
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(O, {})
732
+ children: /* @__PURE__ */ x(ee, {})
713
733
  })
714
734
  ]
715
735
  }),
716
- /* @__PURE__ */ x(ee, {
717
- onGotoPosition: he,
718
- ref: A
736
+ /* @__PURE__ */ x(te, {
737
+ onGotoPosition: ge,
738
+ ref: ne
719
739
  })
720
740
  ]
721
741
  });
722
742
  };
723
743
  //#endregion
724
- export { A as t };
744
+ export { ne as t };
725
745
 
726
746
  //# sourceMappingURL=SequenceEditor.js.map