@rivm-loculus-tools/sequence-editor 1.0.1 → 1.2.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 (44) hide show
  1. package/dist/_chunks/EngineErrorUtil.js +1 -2
  2. package/dist/_chunks/SequenceEditor.js +208 -177
  3. package/dist/_chunks/SequenceEditor.js.map +1 -1
  4. package/dist/_chunks/SequenceEditorEventBusService.js +2 -4
  5. package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -1
  6. package/dist/_chunks/SequenceEditorPageDrawer.js +1 -2
  7. package/dist/_chunks/comlink.js +1 -2
  8. package/dist/_chunks/react.js +2 -3
  9. package/dist/_chunks/react.js.map +1 -1
  10. package/dist/_chunks/sequenceEditorStore.js +3 -5
  11. package/dist/_chunks/sequenceEditorStore.js.map +1 -1
  12. package/dist/assets/{index-B5Du4hQk.js → index-CtQs0yk0.js} +3 -3
  13. package/dist/assets/index-CtQs0yk0.js.map +1 -0
  14. package/dist/classes/services/EditorWorkerService/EditorWorkerService.d.ts +8 -3
  15. package/dist/classes/services/EditorWorkerService/index.js +27 -3
  16. package/dist/classes/services/EditorWorkerService/index.js.map +1 -1
  17. package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +2 -0
  18. package/dist/classes/workers/EngineWorker/EngineWorker.d.ts +8 -3
  19. package/dist/classes/workers/EngineWorker/index.js +29 -4
  20. package/dist/classes/workers/EngineWorker/index.js.map +1 -1
  21. package/dist/components/app/App/index.js +1 -2
  22. package/dist/components/ui/SequenceEditorPageHeader/index.js +70 -40
  23. package/dist/components/ui/SequenceEditorPageHeader/index.js.map +1 -1
  24. package/dist/components/ui/SequenceEditorSearchBar/index.js +1 -2
  25. package/dist/constants/editor.js +1 -2
  26. package/dist/constants/keyboard.js +1 -2
  27. package/dist/constants/palette.js +1 -2
  28. package/dist/models/config.models.d.ts +2 -0
  29. package/dist/models/editor.models.d.ts +27 -11
  30. package/dist/models/editor.models.js +1 -2
  31. package/dist/models/editor.models.js.map +1 -1
  32. package/dist/models/palette.models.js +1 -2
  33. package/dist/models/palette.models.js.map +1 -1
  34. package/dist/pages/SequenceEditorMainPage/index.js +19 -41
  35. package/dist/pages/SequenceEditorMainPage/index.js.map +1 -1
  36. package/dist/utils/EditorUtil/EditorUtil.d.ts +4 -2
  37. package/dist/utils/EditorUtil/index.js +97 -38
  38. package/dist/utils/EditorUtil/index.js.map +1 -1
  39. package/dist/utils/PaletteUtil/index.js +1 -2
  40. package/dist/utils/SequenceEditorStandardConfigUtil/SequenceEditorStandardConfigUtil.d.ts +2 -1
  41. package/dist/utils/SequenceEditorStandardConfigUtil/index.js +1 -3
  42. package/dist/utils/SequenceEditorStandardConfigUtil/index.js.map +1 -1
  43. package/package.json +17 -17
  44. package/dist/assets/index-B5Du4hQk.js.map +0 -1
@@ -2,8 +2,8 @@ import { DEFAULT_GRID_GEOMETRY as e } from "../../constants/editor.js";
2
2
  import { EDITOR_DIRECTION as t, EDITOR_PATH_PROPERTIES_TYPE as n, MATRIX_TYPE as r } from "../../models/editor.models.js";
3
3
  import { PaletteUtil as i } from "../PaletteUtil/index.js";
4
4
  import "../../constants/index.js";
5
- //#region \0rolldown/runtime.js
6
- var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescriptor, c = Object.getOwnPropertyNames, l = Object.getPrototypeOf, u = Object.prototype.hasOwnProperty, d = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), f = (e, t, n, r) => {
5
+ // \0rolldown/runtime.js
6
+ var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescriptor, c = Object.getOwnPropertyNames, l = Object.getPrototypeOf, u = Object.prototype.hasOwnProperty, d = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), f = (e, t, n, r) => {
7
7
  if (t && typeof t == "object" || typeof t == "function") for (var i = c(t), a = 0, l = i.length, d; a < l; a++) d = i[a], !u.call(e, d) && d !== n && o(e, d, {
8
8
  get: ((e) => t[e]).bind(null, d),
9
9
  enumerable: !(r = s(t, d)) || r.enumerable
@@ -369,43 +369,91 @@ var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescr
369
369
  }
370
370
  return e.rows ? e : null;
371
371
  }
372
+ static getMovedRowsEndSelection(e, n, r) {
373
+ if (!e || !r) return null;
374
+ let i = n === t.UP ? 0 : r.sequenceCount;
375
+ return a.getMovedRowsGroupedSelection(e, i, r);
376
+ }
377
+ static getMovedRowsGroupedSelection(e, t, n) {
378
+ if (!e || !n) return null;
379
+ let r = e.cells;
380
+ if (r) {
381
+ let e = r.endRow - r.startRow + 1, i = Math.max(0, Math.min(t, n.sequenceCount - e));
382
+ return { cells: {
383
+ ...r,
384
+ endRow: i + e - 1,
385
+ startRow: i
386
+ } };
387
+ }
388
+ let i = e.rows;
389
+ if (i && i.length > 0) {
390
+ let e = i.length, r = Math.max(0, Math.min(t, n.sequenceCount - e));
391
+ return { rows: Array.from({ length: e }, (e, t) => r + t) };
392
+ }
393
+ return null;
394
+ }
395
+ static getMovedRowsRelativeSelection(e, n, r) {
396
+ if (!e || !r) return null;
397
+ let i = e.cells;
398
+ if (i) {
399
+ let a = n === t.UP && i.startRow > 0, o = n === t.DOWN && i.endRow < r.sequenceCount - 1;
400
+ if (!a && !o) return e;
401
+ let s = n === t.UP ? -1 : 1;
402
+ return { cells: {
403
+ ...i,
404
+ endRow: i.endRow + s,
405
+ startRow: i.startRow + s
406
+ } };
407
+ }
408
+ let a = e.rows;
409
+ if (a && a.length > 0) {
410
+ let e = [...new Set(a)].sort((e, t) => e - t), i = e.length;
411
+ if (n === t.UP) return { rows: e.map((e, t) => Math.max(t, e - 1)) };
412
+ if (n === t.DOWN) {
413
+ let t = r.sequenceCount - i;
414
+ return { rows: e.map((e, n) => Math.min(t + n, e + 1)) };
415
+ }
416
+ return null;
417
+ }
418
+ return null;
419
+ }
372
420
  static getMovedSelection(e, n, r) {
373
421
  if (!e || !r) return null;
374
- let i = n === t.LEFT || n === t.UP ? -1 : 1, a = (e, t, n) => i < 0 ? e > 0 : t < n - 1, o = e.cells;
375
- if (o) return n === t.LEFT || n === t.RIGHT ? a(o.startCol, o.endCol, r.alignmentWidth) ? { cells: {
376
- endCol: o.endCol + i,
377
- endRow: o.endRow,
378
- startCol: o.startCol + i,
379
- startRow: o.startRow
380
- } } : null : a(o.startRow, o.endRow, r.sequenceCount) ? { cells: {
381
- endCol: o.endCol,
382
- endRow: o.endRow + i,
383
- startCol: o.startCol,
384
- startRow: o.startRow + i
422
+ let i = n === t.LEFT || n === t.UP ? -1 : 1, o = (e, t, n) => i < 0 ? e > 0 : t < n - 1, s = e.cells;
423
+ if (s) return n === t.LEFT || n === t.RIGHT ? o(s.startCol, s.endCol, r.alignmentWidth) ? { cells: {
424
+ endCol: s.endCol + i,
425
+ endRow: s.endRow,
426
+ startCol: s.startCol + i,
427
+ startRow: s.startRow
428
+ } } : null : o(s.startRow, s.endRow, r.sequenceCount) ? { cells: {
429
+ endCol: s.endCol,
430
+ endRow: s.endRow + i,
431
+ startCol: s.startCol,
432
+ startRow: s.startRow + i
385
433
  } } : null;
386
- let s = e.cols;
387
- if (s) return n !== t.LEFT && n !== t.RIGHT || s.length === 0 || !a(Math.min(...s), Math.max(...s), r.alignmentWidth) ? null : { cols: s.map((e) => e + i) };
388
- let c = e.rows;
389
- return c ? n !== t.UP && n !== t.DOWN || c.length === 0 || !a(Math.min(...c), Math.max(...c), r.sequenceCount) ? null : { rows: c.map((e) => e + i) } : null;
434
+ let c = e.cols;
435
+ if (c) return n !== t.LEFT && n !== t.RIGHT || c.length === 0 || !o(Math.min(...c), Math.max(...c), r.alignmentWidth) ? null : { cols: c.map((e) => e + i) };
436
+ let l = e.rows;
437
+ return l ? n !== t.UP && n !== t.DOWN || l.length === 0 ? null : a.getMovedRowsRelativeSelection(e, n, r) : null;
390
438
  }
391
439
  static getMutateArguments(e, t, n = 0) {
392
440
  let r = e?.cells;
393
- if (r) return {
394
- endCol: r.endCol + n,
395
- rows: Array.from({ length: r.endRow - r.startRow + 1 }, (e, t) => r.startRow + t),
396
- startCol: r.startCol + n
397
- };
441
+ if (r) {
442
+ let e = r.startCol + n, t = r.endCol + n;
443
+ return {
444
+ columns: Array.from({ length: t - e + 1 }, (t, n) => e + n),
445
+ rows: Array.from({ length: r.endRow - r.startRow + 1 }, (e, t) => r.startRow + t)
446
+ };
447
+ }
398
448
  let i = e?.cols;
399
449
  if (i) return {
400
- endCol: i[i.length - 1] + n,
401
- rows: Array.from({ length: t.sequenceCount }, (e, t) => t),
402
- startCol: i[0] + n
450
+ columns: i.map((e) => e + n),
451
+ rows: Array.from({ length: t.sequenceCount }, (e, t) => t)
403
452
  };
404
453
  let a = e?.rows;
405
454
  if (a) return {
406
- endCol: t.alignmentWidth - 1 + n,
407
- rows: a,
408
- startCol: 0 + n
455
+ columns: Array.from({ length: t.alignmentWidth }, (e, t) => t + n),
456
+ rows: a
409
457
  };
410
458
  }
411
459
  static getPathPropertiesFromCanvas(e) {
@@ -417,23 +465,35 @@ var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescr
417
465
  }
418
466
  static getPostUpsertSelection(e, n) {
419
467
  if (!e) return null;
468
+ if (n !== t.LEFT && n !== t.RIGHT) return e;
420
469
  let r = n === t.LEFT ? -1 : 1, i = e.cells;
421
- if (i) return { cells: {
422
- endCol: i.endCol + r,
423
- endRow: i.endRow,
424
- startCol: i.startCol + r,
425
- startRow: i.startRow
426
- } };
470
+ if (i) {
471
+ let t = i.startCol + r, n = i.endCol + r;
472
+ return t < 0 ? e : { cells: {
473
+ endCol: n,
474
+ endRow: i.endRow,
475
+ startCol: t,
476
+ startRow: i.startRow
477
+ } };
478
+ }
427
479
  let a = e.cols;
428
- if (a) return { cols: a.map((e) => e + r) };
480
+ if (a) {
481
+ let t = a.map((e) => e + r);
482
+ return t.some((e) => e < 0) ? e : { cols: t };
483
+ }
429
484
  let o = e.rows;
430
485
  return o ? { rows: o } : null;
431
486
  }
432
487
  static getRowsToMove(e, n, r) {
433
488
  let i = e?.cells, a = e?.rows ?? (i ? Array.from({ length: i.endRow - i.startRow + 1 }, (e, t) => i.startRow + t) : void 0);
434
489
  if (!a || a.length === 0) return;
435
- let o = Math.min(...a), s = Math.max(...a);
436
- if ((n !== t.UP || o !== 0) && (n !== t.DOWN || s !== r.sequenceCount - 1)) return a;
490
+ let o = [...new Set(a)].sort((e, t) => e - t), s = o.length;
491
+ if (s !== 0 && s !== r.sequenceCount) {
492
+ if (n === t.UP) {
493
+ if (o.every((e, t) => e === t)) return;
494
+ } else if (n === t.DOWN && o.every((e, t) => e === r.sequenceCount - s + t)) return;
495
+ return a;
496
+ }
437
497
  }
438
498
  static getSelectionFromPathProperties(e) {
439
499
  let { endPath: t, startPath: r } = e;
@@ -555,7 +615,6 @@ var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescr
555
615
  return e.matrix_type === r.NUCLEOTIDE && e.row === n && i >= e.col && i < e.col + Math.max(1, t.length);
556
616
  }
557
617
  };
558
- //#endregion
559
618
  export { G as EditorUtil };
560
619
 
561
620
  //# sourceMappingURL=index.js.map