@rivm-loculus-tools/sequence-editor 0.1.7 → 1.0.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 (85) hide show
  1. package/dist/_chunks/EngineErrorUtil.js +18 -0
  2. package/dist/_chunks/EngineErrorUtil.js.map +1 -0
  3. package/dist/_chunks/SequenceEditor.js +311 -318
  4. package/dist/_chunks/SequenceEditor.js.map +1 -1
  5. package/dist/_chunks/SequenceEditorEventBusService.js +21 -0
  6. package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -0
  7. package/dist/_chunks/SequenceEditorPageDrawer.js +112 -112
  8. package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -1
  9. package/dist/_chunks/comlink.js.map +1 -1
  10. package/dist/_chunks/react.js.map +1 -1
  11. package/dist/_chunks/sequenceEditorStore.js +4 -0
  12. package/dist/_chunks/sequenceEditorStore.js.map +1 -1
  13. package/dist/assets/{index-Dn92arD_.js → index-B5Du4hQk.js} +2 -2
  14. package/dist/assets/index-B5Du4hQk.js.map +1 -0
  15. package/dist/classes/services/EditorWorkerService/EditorWorkerService.d.ts +4 -6
  16. package/dist/classes/services/EditorWorkerService/index.js +112 -2
  17. package/dist/classes/services/EditorWorkerService/index.js.map +1 -0
  18. package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +2 -4
  19. package/dist/classes/services/SequenceEditorEventBusService/index.js +1 -16
  20. package/dist/classes/workers/EngineWorker/EngineWorker.d.ts +3 -2
  21. package/dist/classes/workers/EngineWorker/index.js +7 -8
  22. package/dist/classes/workers/EngineWorker/index.js.map +1 -1
  23. package/dist/components/app/App/App.d.ts +5 -1
  24. package/dist/components/app/App/index.js +7 -16
  25. package/dist/components/app/App/index.js.map +1 -1
  26. package/dist/components/ui/SequenceEditor/index.js +1 -2
  27. package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerColorForm.d.ts +1 -1
  28. package/dist/components/ui/SequenceEditorPageDrawer/index.js +1 -2
  29. package/dist/components/ui/SequenceEditorPageHeader/index.js +39 -38
  30. package/dist/components/ui/SequenceEditorPageHeader/index.js.map +1 -1
  31. package/dist/components/ui/SequenceEditorSearchBar/index.js +19 -18
  32. package/dist/components/ui/SequenceEditorSearchBar/index.js.map +1 -1
  33. package/dist/constants/editor.d.ts +1 -1
  34. package/dist/constants/editor.js.map +1 -1
  35. package/dist/constants/keyboard.js +36 -35
  36. package/dist/constants/keyboard.js.map +1 -1
  37. package/dist/constants/palette.d.ts +1 -1
  38. package/dist/constants/palette.js +138 -138
  39. package/dist/constants/palette.js.map +1 -1
  40. package/dist/models/config.models.d.ts +3 -0
  41. package/dist/models/config.models.js +0 -0
  42. package/dist/models/{model.d.ts → editor.models.d.ts} +8 -1
  43. package/dist/models/{model.js → editor.models.js} +6 -4
  44. package/dist/models/editor.models.js.map +1 -0
  45. package/dist/models/{palette.js → palette.models.js} +2 -2
  46. package/dist/models/palette.models.js.map +1 -0
  47. package/dist/{components/pages → pages}/SequenceEditorMainPage/index.js +25 -23
  48. package/dist/pages/SequenceEditorMainPage/index.js.map +1 -0
  49. package/dist/stores/sequenceEditorStore/index.js +1 -2
  50. package/dist/stores/sequenceEditorStore/sequenceEditorStore.d.ts +2 -1
  51. package/dist/utils/EditorUtil/EditorUtil.d.ts +3 -3
  52. package/dist/utils/EditorUtil/index.js +73 -64
  53. package/dist/utils/EditorUtil/index.js.map +1 -1
  54. package/dist/utils/EngineErrorUtil/index.d.ts +1 -0
  55. package/dist/utils/EngineErrorUtil/index.js +1 -0
  56. package/dist/utils/PaletteUtil/PaletteUtil.d.ts +1 -1
  57. package/dist/utils/PaletteUtil/index.js.map +1 -1
  58. package/dist/utils/SequenceEditorStandardConfigUtil/SequenceEditorStandardConfigUtil.d.ts +4 -0
  59. package/dist/utils/SequenceEditorStandardConfigUtil/index.d.ts +1 -0
  60. package/dist/utils/SequenceEditorStandardConfigUtil/index.js +19 -0
  61. package/dist/utils/SequenceEditorStandardConfigUtil/index.js.map +1 -0
  62. package/package.json +50 -46
  63. package/dist/_chunks/EditorWorkerService.js +0 -127
  64. package/dist/_chunks/EditorWorkerService.js.map +0 -1
  65. package/dist/assets/index-Dn92arD_.js.map +0 -1
  66. package/dist/classes/services/SequenceEditorEventBusService/index.js.map +0 -1
  67. package/dist/components/pages/EmptyWorkspace.d.ts +0 -3
  68. package/dist/components/pages/SequenceEditorErrorPage/SequenceEditorErrorPage.d.ts +0 -3
  69. package/dist/components/pages/SequenceEditorErrorPage/index.d.ts +0 -1
  70. package/dist/components/pages/SequenceEditorErrorPage/index.js +0 -12
  71. package/dist/components/pages/SequenceEditorErrorPage/index.js.map +0 -1
  72. package/dist/components/pages/SequenceEditorMainPage/index.js.map +0 -1
  73. package/dist/components/ui/SequenceEditorPage/SequenceEditorPage.d.ts +0 -5
  74. package/dist/components/ui/SequenceEditorPage/index.d.ts +0 -1
  75. package/dist/components/ui/SequenceEditorPage/index.js +0 -15
  76. package/dist/components/ui/SequenceEditorPage/index.js.map +0 -1
  77. package/dist/models/editor.d.ts +0 -6
  78. package/dist/models/editor.js +0 -8
  79. package/dist/models/editor.js.map +0 -1
  80. package/dist/models/index.d.ts +0 -3
  81. package/dist/models/model.js.map +0 -1
  82. package/dist/models/palette.js.map +0 -1
  83. /package/dist/models/{palette.d.ts → palette.models.d.ts} +0 -0
  84. /package/dist/{components/pages → pages}/SequenceEditorMainPage/SequenceEditorMainPage.d.ts +0 -0
  85. /package/dist/{components/pages → pages}/SequenceEditorMainPage/index.d.ts +0 -0
@@ -1,23 +1,22 @@
1
- import { EDITOR_DIRECTION as e } from "../models/editor.js";
2
- import { EDITOR_PATH_PROPERTIES_TYPE as t } from "../models/model.js";
1
+ import { t as e } from "./sequenceEditorStore.js";
2
+ import { t } from "./react.js";
3
3
  import { DEFAULT_GRID_GEOMETRY as n, IUPAC_KEYS as r } from "../constants/editor.js";
4
- import { SequenceEditorEventBusService as i } from "../classes/services/SequenceEditorEventBusService/index.js";
5
- import { KEYBOARD_SHORTCUTS as a } from "../constants/keyboard.js";
4
+ import { t as i } from "./SequenceEditorEventBusService.js";
5
+ import { EDITOR_DIRECTION as a, EDITOR_PATH_PROPERTIES_TYPE as o } from "../models/editor.models.js";
6
+ import { KEYBOARD_SHORTCUTS as s } from "../constants/keyboard.js";
6
7
  import "../constants/index.js";
7
- import { EditorUtil as o } from "../utils/EditorUtil/index.js";
8
- import { t as s } from "./sequenceEditorStore.js";
9
- import { t as c } from "./react.js";
10
- import { SequenceEditorSearchBar as l } from "../components/ui/SequenceEditorSearchBar/index.js";
11
- import { t as u } from "./EditorWorkerService.js";
8
+ import { EditorUtil as c } from "../utils/EditorUtil/index.js";
9
+ import { EditorWorkerService as l } from "../classes/services/EditorWorkerService/index.js";
10
+ import { SequenceEditorSearchBar as u } from "../components/ui/SequenceEditorSearchBar/index.js";
12
11
  import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
13
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
14
- import { Box as v, TextField as y, darken as b, useTheme as x } from "@mui/material";
15
- import { Subject as S } from "@gen-epix/ui-core/classes/Subject";
16
- import { DevicePixelRatioService as C } from "@gen-epix/ui-core/classes/services/DevicePixelRatioService";
17
- import { KeyboardShortcutService as w } from "@gen-epix/ui-core/classes/services/KeyboardShortcutService";
18
- import { withDialog as T } from "@gen-epix/ui-core-components/hoc/withDialog";
12
+ import { Box as g, TextField as _, darken as v, useTheme as y } from "@mui/material";
13
+ import { container as b } from "tsyringe";
14
+ import { jsx as x, jsxs as S } from "react/jsx-runtime";
15
+ import { Subject as C } from "@gen-epix/ui-core/classes/Subject";
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";
19
18
  //#region ../../../../node_modules/.pnpm/use-debounce@10.1.1_react@19.3.0/node_modules/use-debounce/dist/index.module.js
20
- function E(e, t, n, r) {
19
+ function D(e, t, n, r) {
21
20
  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();
22
21
  h.current = e;
23
22
  var y = typeof window < "u", b = !t && t !== 0 && y;
@@ -85,43 +84,43 @@ function E(e, t, n, r) {
85
84
  }
86
85
  //#endregion
87
86
  //#region src/components/ui/SequenceEditor/SequenceEditorStatusBar.tsx
88
- var D = () => {
89
- let e = x(), t = c(s, (e) => e.latestMessage), n = c(s, (e) => e.meta), r = c(s, (e) => e.selection), i = p(() => o.getStatusBarSelectionStats(r, n), [n, r]);
90
- return /* @__PURE__ */ g(v, {
87
+ var O = () => {
88
+ 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
+ return /* @__PURE__ */ x(g, {
91
90
  sx: {
92
- backgroundColor: b(e.palette.background.paper, .1),
93
- borderTop: `1px solid ${b(e.palette.background.paper, .2)}`,
94
- fontSize: e.typography.caption,
91
+ backgroundColor: v(n.palette.background.paper, .1),
92
+ borderTop: `1px solid ${v(n.palette.background.paper, .2)}`,
93
+ fontSize: n.typography.caption,
95
94
  height: "100%",
96
95
  width: "100%"
97
96
  },
98
- children: /* @__PURE__ */ _(v, {
97
+ children: /* @__PURE__ */ S(g, {
99
98
  sx: {
100
99
  "& > div": {
101
100
  alignItems: "center",
102
- borderLeft: `1px solid ${b(e.palette.background.paper, .2)}`,
101
+ borderLeft: `1px solid ${v(n.palette.background.paper, .2)}`,
103
102
  display: "flex",
104
- paddingLeft: e.spacing(1)
103
+ paddingLeft: n.spacing(1)
105
104
  },
106
105
  "& > div:first-of-type": { borderLeft: "none" },
107
106
  display: "grid",
108
107
  gap: 4,
109
108
  gridTemplateColumns: "1fr repeat(5, max-content)",
110
- paddingLeft: e.spacing(1),
111
- paddingRight: e.spacing(1)
109
+ paddingLeft: n.spacing(1),
110
+ paddingRight: n.spacing(1)
112
111
  },
113
112
  children: [
114
- /* @__PURE__ */ g(v, { children: t ?? "" }),
115
- /* @__PURE__ */ g(v, { children: `Pos: ${i.pos}` }),
116
- /* @__PURE__ */ g(v, { children: `Selected seqs: ${i.selectedSeqs}` }),
117
- /* @__PURE__ */ g(v, { children: `Cols: ${i.cols}` }),
118
- /* @__PURE__ */ g(v, { children: `Total selected chars: ${i.totalSelectedChars}` }),
119
- /* @__PURE__ */ g(v, { children: `Alignment: ${n?.alignmentWidth ?? "0"} sequences ${n?.sequenceCount ?? "0"} pos.` })
113
+ /* @__PURE__ */ x(g, { children: r ?? "" }),
114
+ /* @__PURE__ */ x(g, { children: `Pos: ${o.pos}` }),
115
+ /* @__PURE__ */ x(g, { children: `Selected seqs: ${o.selectedSeqs}` }),
116
+ /* @__PURE__ */ x(g, { children: `Cols: ${o.cols}` }),
117
+ /* @__PURE__ */ x(g, { children: `Total selected chars: ${o.totalSelectedChars}` }),
118
+ /* @__PURE__ */ x(g, { children: `Alignment: ${i?.sequenceCount ?? "0"} sequences, ${i?.alignmentWidth ?? "0"} positions` })
120
119
  ]
121
120
  })
122
121
  });
123
- }, O = /^(?:\d+|,\d+|\d+,\d+)$/, ee = T(({ onActionsChange: e, onClose: t, onGotoPosition: n }) => {
124
- let [r, i] = h(""), a = m(null), o = r === "" || O.test(r);
122
+ }, k = /^(?:\d+|,\d+|\d+,\d+)$/, ee = E(({ onActionsChange: e, onClose: t, onGotoPosition: n }) => {
123
+ let [r, i] = h(""), a = m(null), o = r === "" || k.test(r);
125
124
  f(() => {
126
125
  a.current?.focus();
127
126
  }, []);
@@ -158,7 +157,7 @@ var D = () => {
158
157
  e,
159
158
  t,
160
159
  c
161
- ]), /* @__PURE__ */ g(y, {
160
+ ]), /* @__PURE__ */ x(_, {
162
161
  error: !o,
163
162
  fullWidth: !0,
164
163
  helperText: "Use x, ,y, or x,y.",
@@ -174,25 +173,25 @@ var D = () => {
174
173
  fullWidth: !0,
175
174
  maxWidth: "xs",
176
175
  testId: "SequenceEditorGotoPositionDialog"
177
- }), k = () => {
178
- let y = c(s, (e) => e.rawFasta), b = c(s, (e) => e.setLatestMessage), T = c(s, (e) => e.setMeta), O = c(s, (e) => e.setSelection), k = m(null), A = p(() => u.getInstance(), []), j = m(null), M = m(null), N = m(null), P = m(null), F = m(null), I = m(null), [L, te] = h({
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({
179
178
  height: 0,
180
179
  width: 0
181
- }), [ne, re] = h(() => C.getInstance().data), [ie, ae] = h(0), [oe, se] = h(0), R = p(() => new S({
180
+ }), [ne, re] = h(() => b.resolve(w).data), [ie, ae] = h(0), [oe, se] = h(0), z = p(() => new C({
182
181
  scrollLeft: 0,
183
182
  scrollTop: 0
184
- }), []), ce = m(L), z = p(() => new S(null), []), B = p(() => new S(null), []), V = m(null), H = m(null), U = p(() => new S(n), []), W = p(() => new S(null), []), G = m(null), K = m(0), q = m(null), J = m(!1), Y = x(), X = d(() => {
185
- let e = U.data, t = z.data;
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;
186
185
  if (!e || !t) return;
187
186
  let n = e.labelWidth + e.cellWidth + t.alignmentWidth * e.cellWidth, r = e.rulerHeight + t.sequenceCount * e.cellHeight;
188
187
  se(n), ae(r);
189
- }, [U, z]), Z = d(async () => {
190
- let e = await u.getInstance().getMetaData();
191
- z.next(e);
192
- }, [z]), Q = d(() => {
193
- let e = U.data, t = z.data;
188
+ }, [W, B]), Z = d(async () => {
189
+ let e = await b.resolve(l).getMetaData();
190
+ B.next(e);
191
+ }, [B]), Q = d(() => {
192
+ let e = W.data, t = B.data;
194
193
  if (!t || !e) return;
195
- let { scrollLeft: n, scrollTop: r } = R.data, { height: i, width: a } = ce.current, s = o.getVisibleGridRange({
194
+ let { scrollLeft: n, scrollTop: r } = z.data, { height: i, width: a } = ce.current, o = c.getVisibleGridRange({
196
195
  geometry: e,
197
196
  numCols: t.alignmentWidth,
198
197
  numRows: t.sequenceCount,
@@ -201,231 +200,231 @@ var D = () => {
201
200
  viewportHeight: i,
202
201
  viewportWidth: a
203
202
  });
204
- B.next({
203
+ V.next({
205
204
  geometry: e,
206
205
  scrollLeft: n,
207
206
  scrollTop: r,
208
207
  viewportHeight: i,
209
208
  viewportWidth: a,
210
- visibleGridRange: s
209
+ visibleGridRange: o
211
210
  });
212
211
  }, [
213
- U,
212
+ W,
213
+ B,
214
214
  z,
215
- R,
216
- B
217
- ]), le = E((e, t) => {
215
+ V
216
+ ]), ue = D((e, t) => {
218
217
  te({
219
218
  height: t,
220
219
  width: e
221
220
  });
222
221
  }, 0, { trailing: !0 });
223
222
  f(() => {
224
- ce.current = L, Q();
225
- }, [L, Q]);
226
- let $ = L.width > 0 ? L.width / 2 : 120;
223
+ ce.current = R, Q();
224
+ }, [R, Q]);
225
+ let $ = R.width > 0 ? R.width / 2 : 120;
227
226
  f(() => {
228
- let e = [z.subscribe((e) => {
229
- T(e);
230
- }), W.subscribe((e) => {
231
- O(e);
227
+ let e = [B.subscribe((e) => {
228
+ E(e);
229
+ }), G.subscribe((e) => {
230
+ k(e);
232
231
  })];
233
232
  return () => {
234
- e.forEach((e) => e()), b(null), T(null), O(null);
233
+ e.forEach((e) => e()), v(null), E(null), k(null);
235
234
  };
236
235
  }, [
237
- z,
238
- W,
239
- b,
240
- T,
241
- O
236
+ B,
237
+ G,
238
+ v,
239
+ E,
240
+ k
242
241
  ]), f(() => {
243
- if (L.width <= 0) return;
244
- let e = U.data;
245
- e.labelWidth > $ && U.next({
242
+ if (R.width <= 0) return;
243
+ let e = W.data;
244
+ e.labelWidth > $ && W.next({
246
245
  ...e,
247
246
  labelWidth: $
248
247
  });
249
248
  }, [
250
- L.width,
251
- U,
249
+ R.width,
250
+ W,
252
251
  $
253
252
  ]), f(() => {
254
- let e = I.current;
253
+ let e = L.current;
255
254
  if (!e) return;
256
255
  let t = new ResizeObserver(([e]) => {
257
256
  if (!e) return;
258
257
  let t = Math.max(1, e.contentRect.height), n = Math.max(1, e.contentRect.width);
259
- le(n, t);
258
+ ue(n, t);
260
259
  });
261
260
  return t.observe(e), () => t.disconnect();
262
- }, [A, le]), f(() => {
261
+ }, [j, ue]), f(() => {
263
262
  (async () => {
264
- V.current = null, H.current = null, R.next({
263
+ H.current = null, U.current = null, z.next({
265
264
  scrollLeft: 0,
266
265
  scrollTop: 0
267
- }), W.next(null), await A.initialize(), await A.loadFasta(y), await Z(), Q();
266
+ }), G.next(null), await j.initialize(), await j.loadFasta(_), await Z(), Q();
268
267
  })().catch((e) => {
269
268
  console.error(e);
270
269
  });
271
270
  }, [
272
- A,
273
- y,
274
- R,
275
- W,
271
+ j,
272
+ _,
273
+ z,
274
+ G,
276
275
  Z,
277
276
  Q
278
277
  ]), f(() => {
279
- let e = null, t = !0, n = null, r = null, i = async () => {
280
- if (t && !J.current) {
281
- J.current = !0;
278
+ let t = null, n = !0, r = null, i = null, a = async () => {
279
+ if (n && !le.current) {
280
+ le.current = !0;
282
281
  try {
283
- for (; t && q.current;) {
284
- let i = q.current;
285
- q.current = null;
286
- let a = K.current;
287
- if (!H.current || !o.isWithinGridRange({
288
- cachedGridRange: H.current.range,
289
- visibleGridRange: i.visibleGridRange.visible
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,
288
+ visibleGridRange: a.visibleGridRange.visible
290
289
  })) {
291
290
  let e = [];
292
- for (let t = i.visibleGridRange.cache.startRow; t <= i.visibleGridRange.cache.endRow; t++) e.push(await A.name(t));
293
- if (!t) return;
294
- H.current = {
295
- range: i.visibleGridRange.cache,
291
+ for (let t = a.visibleGridRange.cache.startRow; t <= a.visibleGridRange.cache.endRow; t++) e.push(await j.name(t));
292
+ if (!n) return;
293
+ U.current = {
294
+ range: a.visibleGridRange.cache,
296
295
  rowNames: e
297
296
  };
298
297
  }
299
- if (!V.current || !o.isWithinGridRange({
300
- cachedGridRange: V.current.range,
301
- visibleGridRange: i.visibleGridRange.visible
298
+ if (!H.current || !c.isWithinGridRange({
299
+ cachedGridRange: H.current.range,
300
+ visibleGridRange: a.visibleGridRange.visible
302
301
  })) {
303
- let e = await u.getInstance().viewport({
304
- endCol: i.visibleGridRange.cache.endCol,
305
- endRow: i.visibleGridRange.cache.endRow,
306
- startCol: i.visibleGridRange.cache.startCol,
307
- startRow: i.visibleGridRange.cache.startRow
302
+ let e = await b.resolve(l).viewport({
303
+ endCol: a.visibleGridRange.cache.endCol,
304
+ endRow: a.visibleGridRange.cache.endRow,
305
+ startCol: a.visibleGridRange.cache.startCol,
306
+ startRow: a.visibleGridRange.cache.startRow
308
307
  });
309
- if (!t) return;
310
- V.current = {
311
- range: i.visibleGridRange.cache,
308
+ if (!n) return;
309
+ H.current = {
310
+ range: a.visibleGridRange.cache,
312
311
  viewportResult: e
313
312
  };
314
313
  }
315
- a === K.current && (e !== null && cancelAnimationFrame(e), e = requestAnimationFrame(() => {
316
- t && a === K.current && j.current && s.getState().nucleotidePalette && V.current && z.data && H.current && (M.current = o.drawCanvas({
317
- canvasElement: j.current,
318
- devicePixelRatio: C.getInstance().data,
319
- geometry: i.geometry,
320
- meta: z.data,
321
- palette: s.getState().nucleotidePalette,
322
- rowNames: H.current.rowNames,
323
- rowNamesStartRow: H.current.range.startRow,
324
- scrollLeft: i.scrollLeft,
325
- scrollTop: i.scrollTop,
326
- searchResult: n,
327
- searchResultHighlightedIndex: r,
328
- selection: W.data,
329
- viewport: V.current.viewportResult,
330
- viewportHeight: i.viewportHeight,
331
- viewportWidth: i.viewportWidth
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,
317
+ devicePixelRatio: b.resolve(w).data,
318
+ geometry: a.geometry,
319
+ meta: B.data,
320
+ palette: e.getState().nucleotidePalette,
321
+ rowNames: U.current.rowNames,
322
+ rowNamesStartRow: U.current.range.startRow,
323
+ scrollLeft: a.scrollLeft,
324
+ scrollTop: a.scrollTop,
325
+ searchResult: r,
326
+ searchResultHighlightedIndex: i,
327
+ selection: G.data,
328
+ viewport: H.current.viewportResult,
329
+ viewportHeight: a.viewportHeight,
330
+ viewportWidth: a.viewportWidth
332
331
  }));
333
332
  }));
334
333
  }
335
334
  } finally {
336
- J.current = !1, t && q.current && i();
335
+ le.current = !1, n && J.current && a();
337
336
  }
338
337
  }
339
- }, a = [s.subscribe((e, t) => {
340
- let i = !1;
341
- e.searchResult !== t.searchResult && (n = e.searchResult, i = !0), e.searchResultHighlightedIndex !== t.searchResultHighlightedIndex && (r = e.searchResultHighlightedIndex, o.scrollToSearchResult({
342
- geometry: U.data,
343
- scrollContainer: I.current,
338
+ }, o = [e.subscribe((e, t) => {
339
+ let n = !1;
340
+ 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,
344
343
  searchResult: e.searchResult,
345
344
  searchResultHighlightedIndex: e.searchResultHighlightedIndex
346
- }), i = !0), i && Q();
347
- }), B.subscribe((e) => {
348
- e && (q.current = e, K.current += 1, i());
345
+ }), n = !0), n && Q();
346
+ }), V.subscribe((e) => {
347
+ e && (J.current = e, q.current += 1, a());
349
348
  })];
350
349
  return () => {
351
- t = !1, q.current = null, e !== null && cancelAnimationFrame(e), K.current += 1, a.forEach((e) => e());
350
+ n = !1, J.current = null, t !== null && cancelAnimationFrame(t), q.current += 1, o.forEach((e) => e());
352
351
  };
353
352
  }, [
354
- A,
355
- U,
356
- z,
353
+ j,
357
354
  W,
355
+ B,
356
+ G,
358
357
  Q,
359
- B
358
+ V
360
359
  ]), f(() => {
361
- let e = [
362
- s.subscribe((e, t) => {
360
+ let t = [
361
+ e.subscribe((e, t) => {
363
362
  e.nucleotidePalette?.name !== t.nucleotidePalette?.name && Q();
364
363
  }),
365
- U.subscribe(() => {
364
+ W.subscribe(() => {
366
365
  X(), Q();
367
366
  }),
368
- R.subscribe(() => Q()),
369
- z.subscribe((e) => {
367
+ z.subscribe(() => Q()),
368
+ B.subscribe((e) => {
370
369
  e && (X(), Q());
371
370
  }),
372
- W.subscribe(() => Q()),
373
- C.getInstance().subscribe((e) => {
371
+ G.subscribe(() => Q()),
372
+ b.resolve(w).subscribe((e) => {
374
373
  re(e), X(), Q();
375
374
  })
376
375
  ];
377
376
  return () => {
378
- e.forEach((e) => e());
377
+ t.forEach((e) => e());
379
378
  };
380
379
  }, [
381
- A,
382
- U,
383
- z,
384
- R,
380
+ j,
385
381
  W,
382
+ B,
383
+ z,
384
+ G,
386
385
  X,
387
386
  Q
388
387
  ]), f(() => {
389
388
  let e = (e) => {
390
389
  let t = e.key.toUpperCase();
391
- r.has(t) && (e.preventDefault(), i.getInstance().emit("onMutateSelection", t));
392
- }, t = (e) => w.getInstance().registerShortcut({
390
+ r.has(t) && (e.preventDefault(), b.resolve(i).emit("onMutateSelection", t));
391
+ }, t = (e) => b.resolve(T).registerShortcut({
393
392
  callback: e.callback,
394
- element: F.current,
393
+ element: I.current,
395
394
  ...e.shortcut
396
395
  }), n = [
397
- t(a.expandSelectionLeft),
398
- t(a.expandSelectionRight),
399
- t(a.expandSelectionUp),
400
- t(a.expandSelectionDown),
401
- t(a.moveSelectionLeft),
402
- t(a.moveSelectionRight),
403
- t(a.moveSelectionUp),
404
- t(a.moveSelectionDown),
405
- t(a.moveRowUp),
406
- t(a.moveRowDown),
407
- t(a.moveRowToStart),
408
- t(a.moveRowToEnd),
409
- t(a.moveCellLeft),
410
- t(a.moveCellRight),
411
- t(a.scrollToLineStart),
412
- t(a.scrollToLineEnd),
413
- t(a.scrollPageUp),
414
- t(a.scrollPageDown),
415
- t(a.insertGap),
416
- t(a.deleteBackward),
417
- t(a.deleteSelection),
418
- t(a.deleteBase),
419
- t(a.undo),
420
- t(a.redo),
421
- t(a.gotoPosition),
422
- w.getInstance().registerShortcut({
396
+ t(s.expandSelectionLeft),
397
+ t(s.expandSelectionRight),
398
+ t(s.expandSelectionUp),
399
+ t(s.expandSelectionDown),
400
+ t(s.moveSelectionLeft),
401
+ t(s.moveSelectionRight),
402
+ t(s.moveSelectionUp),
403
+ t(s.moveSelectionDown),
404
+ t(s.moveRowUp),
405
+ t(s.moveRowDown),
406
+ t(s.moveRowToStart),
407
+ t(s.moveRowToEnd),
408
+ t(s.moveCellLeft),
409
+ t(s.moveCellRight),
410
+ t(s.scrollToLineStart),
411
+ t(s.scrollToLineEnd),
412
+ t(s.scrollPageUp),
413
+ t(s.scrollPageDown),
414
+ t(s.insertGap),
415
+ t(s.deleteBackward),
416
+ t(s.deleteSelection),
417
+ t(s.deleteBase),
418
+ t(s.undo),
419
+ t(s.redo),
420
+ t(s.gotoPosition),
421
+ b.resolve(T).registerShortcut({
423
422
  callback: e,
424
- element: F.current
423
+ element: I.current
425
424
  }),
426
- w.getInstance().registerShortcut({
425
+ b.resolve(T).registerShortcut({
427
426
  callback: e,
428
- element: F.current,
427
+ element: I.current,
429
428
  modifiers: [["Shift"]]
430
429
  })
431
430
  ];
@@ -436,92 +435,92 @@ var D = () => {
436
435
  let t = async (e) => {
437
436
  let { command: t, getSelectionPostCommand: n } = e;
438
437
  try {
439
- if (await t(), V.current = null, H.current = null, await Z(), Q(), n) {
438
+ if (await t(), H.current = null, U.current = null, await Z(), Q(), n) {
440
439
  let e = n();
441
- W.next(e), G.current = e;
440
+ G.next(e), K.current = e;
442
441
  }
443
442
  } catch (e) {
444
443
  console.error("Failed to post command:", e);
445
444
  }
446
445
  }, n = async (e) => {
447
- if (!z.data) return;
448
- let n = o.getMutateArguments(W.data, z.data);
446
+ if (!B.data) return;
447
+ let n = c.getMutateArguments(G.data, B.data);
449
448
  n && await t({ command: async () => {
450
- for (let t = n.startCol; t <= n.endCol; t += 1) await A.mutate(n.rows, t, e);
449
+ for (let t = n.startCol; t <= n.endCol; t += 1) await j.mutate(n.rows, t, e);
451
450
  } });
452
451
  }, r = (e) => {
453
- if (!z.data) return;
454
- let t = o.getMovedSelection(W.data, e, z.data);
452
+ if (!B.data) return;
453
+ let t = c.getMovedSelection(G.data, e, B.data);
455
454
  if (t) {
456
- if (W.next(t), G.current) {
457
- let t = o.getMovedSelection(G.current, e, z.data);
458
- G.current = t;
459
- } else G.current = 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;
460
459
  }
461
- }, a = (e) => {
462
- if (!z.data || !G.current || !W.data) return;
463
- let t = o.getExpandedSelection(W.data, G.current, e, z.data);
464
- t && W.next(t);
465
- }, c = async (e) => {}, l = async (n) => {
466
- if (!z.data) return;
467
- let r = o.getRowsToMove(W.data, n, z.data);
468
- r && await t({
460
+ }, 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);
467
+ n && await t({
469
468
  command: async () => {
470
- n === e.UP ? await A.moveRowsUp(r) : await A.moveRowsDown(r);
469
+ e === a.UP ? await j.moveRowsUp(n) : await j.moveRowsDown(n);
471
470
  },
472
- getSelectionPostCommand: () => o.getMovedSelection(W.data, n, z.data)
471
+ getSelectionPostCommand: () => c.getMovedSelection(G.data, e, B.data)
473
472
  });
474
- }, u = async (e) => {}, d = i.getInstance(), f = [
475
- d.addEventListener("onSearch", async (e) => {
476
- if (!e) return;
477
- let t = await A.search(e, !1);
478
- s.getState().setSearchResult(t);
473
+ }, u = async (e) => {}, d = b.resolve(i), f = [
474
+ d.addEventListener("onSearch", async (t) => {
475
+ if (!t) return;
476
+ let n = await j.search(t, !0);
477
+ e.getState().setSearchResult(n);
479
478
  }),
480
- d.addEventListener("onExpandSelection", (e) => a(e)),
481
- d.addEventListener("onGotoPosition", () => k.current?.open({})),
479
+ d.addEventListener("onExpandSelection", (e) => o(e)),
480
+ d.addEventListener("onGotoPosition", () => A.current?.open({})),
482
481
  d.addEventListener("onMoveSelection", (e) => r(e)),
483
482
  d.addEventListener("onMoveRows", (e) => {
484
483
  l(e);
485
484
  }),
486
485
  d.addEventListener("onMoveRowsEnd", (e) => {
487
- c(e);
486
+ s(e);
488
487
  }),
489
488
  d.addEventListener("onMoveCells", (e) => {
490
489
  u(e);
491
490
  }),
492
491
  d.addEventListener("onScrollToLineStart", () => {
493
- let e = I.current;
492
+ let e = L.current;
494
493
  e && (e.scrollLeft = 0);
495
494
  }),
496
495
  d.addEventListener("onScrollToLineEnd", () => {
497
- let e = I.current;
496
+ let e = L.current;
498
497
  e && (e.scrollLeft = e.scrollWidth - e.clientWidth);
499
498
  }),
500
499
  d.addEventListener("onScrollPageUp", () => {
501
- let e = I.current;
500
+ let e = L.current;
502
501
  e && (e.scrollTop = Math.max(0, e.scrollTop - e.clientHeight));
503
502
  }),
504
503
  d.addEventListener("onScrollPageDown", () => {
505
- let e = I.current;
504
+ let e = L.current;
506
505
  e && (e.scrollTop = Math.min(e.scrollHeight - e.clientHeight, e.scrollTop + e.clientHeight));
507
506
  }),
508
507
  d.addEventListener("onInsert", () => {
509
508
  (async () => {
510
- if (!z.data) return;
511
- let n = o.getUpsertArguments(W.data, z.data);
512
- n && await t({
513
- command: async () => A.insert(n.rows, n.col),
514
- getSelectionPostCommand: () => o.getPostUpsertSelection(W.data, e.RIGHT)
509
+ if (!B.data) return;
510
+ let e = c.getUpsertArguments(G.data, B.data);
511
+ e && await t({
512
+ command: async () => j.insert(e.rows, e.col),
513
+ getSelectionPostCommand: () => c.getPostUpsertSelection(G.data, a.RIGHT)
515
514
  });
516
515
  })();
517
516
  }),
518
517
  d.addEventListener("onDeleteBackward", () => {
519
518
  (async () => {
520
- if (!z.data) return;
521
- let n = o.getUpsertArguments(W.data, z.data, -1);
522
- n && await t({
523
- command: async () => A.delete(n.rows, n.col),
524
- getSelectionPostCommand: () => o.getPostUpsertSelection(W.data, e.LEFT)
519
+ if (!B.data) return;
520
+ let e = c.getUpsertArguments(G.data, B.data, -1);
521
+ e && await t({
522
+ command: async () => j.delete(e.rows, e.col),
523
+ getSelectionPostCommand: () => c.getPostUpsertSelection(G.data, a.LEFT)
525
524
  });
526
525
  })();
527
526
  }),
@@ -530,13 +529,13 @@ var D = () => {
530
529
  }),
531
530
  d.addEventListener("onUndo", () => {
532
531
  t({
533
- command: async () => A.undo(),
532
+ command: async () => j.undo(),
534
533
  getSelectionPostCommand: () => null
535
534
  });
536
535
  }),
537
536
  d.addEventListener("onRedo", () => {
538
537
  t({
539
- command: async () => A.redo(),
538
+ command: async () => j.redo(),
540
539
  getSelectionPostCommand: () => null
541
540
  });
542
541
  })
@@ -545,113 +544,107 @@ var D = () => {
545
544
  f.forEach((e) => e());
546
545
  };
547
546
  }, [
548
- A,
549
- W,
547
+ j,
548
+ G,
550
549
  Z,
551
550
  Q,
552
- z
551
+ B
553
552
  ]), f(() => {
554
553
  Q();
555
554
  }, [Q]);
556
- let ue = d((e) => {
555
+ let de = d((e) => {
557
556
  let t = e.currentTarget;
558
- R.next({
557
+ z.next({
559
558
  scrollLeft: t.scrollLeft,
560
559
  scrollTop: t.scrollTop
561
560
  });
562
- }, [R]), de = d((e) => {
563
- F.current?.focus();
564
- let n = e.currentTarget, r = n.getBoundingClientRect(), i = e.clientX >= r.left + n.clientWidth, a = e.clientY >= r.top + n.clientHeight;
565
- if (i || a) return;
566
- let s = j.current, c = M.current, l = C.getInstance().data;
567
- if (!s || !c) return;
568
- let u = o.getPathPropertiesFromCanvas({
569
- canvas: s,
561
+ }, [z]), fe = d((e) => {
562
+ I.current?.focus();
563
+ let t = e.currentTarget, n = t.getBoundingClientRect(), r = e.clientX >= n.left + t.clientWidth, i = e.clientY >= n.top + t.clientHeight;
564
+ if (r || i) return;
565
+ let a = M.current, s = N.current, l = b.resolve(w).data;
566
+ if (!a || !s) return;
567
+ let u = c.getPathPropertiesFromCanvas({
568
+ canvas: a,
570
569
  devicePixelRatio: l,
571
- editorAssembly: c,
570
+ editorAssembly: s,
572
571
  event: e.nativeEvent
573
572
  });
574
573
  if (u) {
575
- if (u.type !== t.DIVIDER) {
576
- if (u.type === t.LABEL && (e.metaKey || e.ctrlKey)) {
577
- let t = W.data?.rows ?? [], n = t.includes(u.row) ? t.filter((e) => e !== u.row) : [...t, u.row].sort((e, t) => e - t);
578
- if (e.preventDefault(), P.current = null, n.length === 0) {
579
- W.next(null), G.current = null;
574
+ if (u.type !== o.DIVIDER) {
575
+ 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;
580
579
  return;
581
580
  }
582
- W.next({ rows: n }), G.current = { rows: n };
581
+ G.next({ rows: n }), K.current = { rows: n };
583
582
  return;
584
583
  }
585
- let n = o.getSelectionFromPathProperties({
584
+ let t = c.getSelectionFromPathProperties({
586
585
  endPath: u,
587
586
  startPath: u
588
587
  });
589
- if (!n) return;
590
- e.preventDefault(), P.current = u, W.next(n), G.current = n;
591
- return;
592
- }
593
- e.preventDefault(), P.current = null, N.current = {
594
- startLabelWidth: U.data.labelWidth,
588
+ 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,
595
592
  startX: e.clientX
596
593
  };
597
594
  }
598
- }, [U, W]), fe = d((e) => {
599
- let n = j.current, r = F.current, i = C.getInstance().data, a = N.current;
600
- if (!r || !n) return;
601
- if (a) {
602
- let t = Math.min($, Math.max(120, a.startLabelWidth + e.clientX - a.startX));
603
- U.next({
604
- ...U.data,
595
+ }, [W, G]), pe = d((e) => {
596
+ let t = M.current, n = I.current, r = b.resolve(w).data, i = P.current;
597
+ if (!n || !t) return;
598
+ if (i) {
599
+ let t = Math.min($, Math.max(120, i.startLabelWidth + e.clientX - i.startX));
600
+ W.next({
601
+ ...W.data,
605
602
  labelWidth: t
606
- }), r.style.cursor = "col-resize";
603
+ }), n.style.cursor = "col-resize";
607
604
  return;
608
605
  }
609
- let s = P.current;
610
- if (s) {
611
- let t = M.current;
612
- if (!t) return;
613
- let r = o.getPathPropertiesFromCanvas({
614
- canvas: n,
615
- devicePixelRatio: i,
616
- editorAssembly: t,
606
+ let a = F.current;
607
+ if (a) {
608
+ let n = N.current;
609
+ if (!n) return;
610
+ let i = c.getPathPropertiesFromCanvas({
611
+ canvas: t,
612
+ devicePixelRatio: r,
613
+ editorAssembly: n,
617
614
  event: e.nativeEvent
618
615
  });
619
- if (!r) return;
620
- let a = o.getSelectionFromPathProperties({
621
- endPath: r,
622
- startPath: s
616
+ if (!i) return;
617
+ let o = c.getSelectionFromPathProperties({
618
+ endPath: i,
619
+ startPath: a
623
620
  });
624
- a && (W.next(a), G.current = a);
621
+ o && (G.next(o), K.current = o);
625
622
  return;
626
623
  }
627
- let c = M.current;
628
- if (!c) return;
629
- let l = o.getPathPropertiesFromCanvas({
630
- canvas: n,
631
- devicePixelRatio: i,
632
- editorAssembly: c,
624
+ let s = N.current;
625
+ if (!s) return;
626
+ let l = c.getPathPropertiesFromCanvas({
627
+ canvas: t,
628
+ devicePixelRatio: r,
629
+ editorAssembly: s,
633
630
  event: e.nativeEvent
634
631
  });
635
- if (!l) {
636
- r.style.cursor = "default";
637
- return;
638
- }
639
- l.type === t.DIVIDER ? r.style.cursor = "col-resize" : r.style.cursor = "default";
632
+ l && l.type === o.DIVIDER ? n.style.cursor = "col-resize" : n.style.cursor = "default";
640
633
  }, [
641
- U,
634
+ W,
642
635
  $,
643
- W
644
- ]), pe = d(() => {
645
- N.current = null, P.current = null;
646
- }, []), me = d((e, t) => {
647
- o.scrollToPosition({
648
- geometry: U.data,
649
- scrollContainer: I.current,
636
+ G
637
+ ]), me = d(() => {
638
+ P.current = null, F.current = null;
639
+ }, []), he = d((e, t) => {
640
+ c.scrollToPosition({
641
+ geometry: W.data,
642
+ scrollContainer: L.current,
650
643
  x: e,
651
644
  y: t
652
645
  });
653
- }, [U]), he = Math.max(1, Math.floor(L.width * ne)), ge = Math.max(1, Math.floor(L.height * ne));
654
- return /* @__PURE__ */ _(v, {
646
+ }, [W]), ge = Math.max(1, Math.floor(R.width * ne)), _e = Math.max(1, Math.floor(R.height * ne));
647
+ return /* @__PURE__ */ S(g, {
655
648
  sx: {
656
649
  display: "grid",
657
650
  gridTemplateRows: "max-content auto",
@@ -660,10 +653,10 @@ var D = () => {
660
653
  width: "100%"
661
654
  },
662
655
  children: [
663
- /* @__PURE__ */ g(l, {}),
664
- /* @__PURE__ */ _(v, {
665
- onMouseUp: pe,
666
- ref: F,
656
+ /* @__PURE__ */ x(u, {}),
657
+ /* @__PURE__ */ S(g, {
658
+ onMouseUp: me,
659
+ ref: I,
667
660
  sx: {
668
661
  height: `calc(100% - ${Y.spacing(3)})`,
669
662
  marginBottom: Y.spacing(3),
@@ -672,11 +665,11 @@ var D = () => {
672
665
  },
673
666
  tabIndex: 0,
674
667
  children: [
675
- /* @__PURE__ */ g(v, {
676
- onMouseDown: de,
677
- onMouseMove: fe,
678
- onScroll: ue,
679
- ref: I,
668
+ /* @__PURE__ */ x(g, {
669
+ onMouseDown: fe,
670
+ onMouseMove: pe,
671
+ onScroll: de,
672
+ ref: L,
680
673
  sx: {
681
674
  height: "100%",
682
675
  overflowX: "scroll",
@@ -685,29 +678,29 @@ var D = () => {
685
678
  width: "100%",
686
679
  zIndex: 1
687
680
  },
688
- children: /* @__PURE__ */ g(v, { sx: {
689
- height: `${Math.max(ie, L.height)}px`,
681
+ children: /* @__PURE__ */ x(g, { sx: {
682
+ height: `${Math.max(ie, R.height)}px`,
690
683
  pointerEvents: "none",
691
- width: `${Math.max(oe, L.width)}px`
684
+ width: `${Math.max(oe, R.width)}px`
692
685
  } })
693
686
  }),
694
- /* @__PURE__ */ g("canvas", {
695
- height: ge,
696
- ref: j,
687
+ /* @__PURE__ */ x("canvas", {
688
+ height: _e,
689
+ ref: M,
697
690
  style: {
698
691
  display: "block",
699
- height: `${L.height}px`,
692
+ height: `${R.height}px`,
700
693
  imageRendering: "pixelated",
701
694
  left: 0,
702
695
  pointerEvents: "auto",
703
696
  position: "absolute",
704
697
  top: 0,
705
- width: `${L.width}px`,
698
+ width: `${R.width}px`,
706
699
  zIndex: 0
707
700
  },
708
- width: he
701
+ width: ge
709
702
  }),
710
- /* @__PURE__ */ g(v, {
703
+ /* @__PURE__ */ x(g, {
711
704
  sx: {
712
705
  bottom: Y.spacing(-3),
713
706
  height: Y.spacing(3),
@@ -716,18 +709,18 @@ var D = () => {
716
709
  width: "100%",
717
710
  zIndex: 2
718
711
  },
719
- children: /* @__PURE__ */ g(D, {})
712
+ children: /* @__PURE__ */ x(O, {})
720
713
  })
721
714
  ]
722
715
  }),
723
- /* @__PURE__ */ g(ee, {
724
- onGotoPosition: me,
725
- ref: k
716
+ /* @__PURE__ */ x(ee, {
717
+ onGotoPosition: he,
718
+ ref: A
726
719
  })
727
720
  ]
728
721
  });
729
722
  };
730
723
  //#endregion
731
- export { k as t };
724
+ export { A as t };
732
725
 
733
726
  //# sourceMappingURL=SequenceEditor.js.map