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