@rivm-loculus-tools/sequence-editor 1.9.0 → 1.10.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/EngineWorker.js +1 -1
- package/dist/_chunks/EngineWorker.js.map +1 -1
- package/dist/_chunks/SequenceEditor.js +275 -262
- package/dist/_chunks/SequenceEditor.js.map +1 -1
- package/dist/_chunks/SequenceEditorEventBusService.js +1 -1
- package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -1
- package/dist/_chunks/SequenceEditorPageDrawer.js +4 -4
- package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -1
- package/dist/_chunks/SequenceEditorPageHeader.js +66 -54
- package/dist/_chunks/SequenceEditorPageHeader.js.map +1 -1
- package/dist/_chunks/react.js +1 -1
- package/dist/_chunks/react.js.map +1 -1
- package/dist/_chunks/sequenceEditorStore.js +54 -58
- package/dist/_chunks/sequenceEditorStore.js.map +1 -1
- package/dist/_chunks/sequence_editor.js +1 -1
- package/dist/_chunks/sequence_editor.js.map +1 -1
- package/dist/assets/AlignerWorker-ag-D8qid.js +8 -0
- package/dist/assets/{AlignerWorker-cbSDVRKB.js.map → AlignerWorker-ag-D8qid.js.map} +1 -1
- package/dist/assets/index-CN_G9YrF.js +8 -0
- package/dist/assets/{index--BqOy4u7.js.map → index-CN_G9YrF.js.map} +1 -1
- package/dist/classes/services/EditorWorkerService/index.js +36 -36
- package/dist/classes/services/EditorWorkerService/index.js.map +1 -1
- package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +1 -0
- package/dist/components/app/SequenceEditorApp/index.js +4 -4
- package/dist/components/ui/SequenceEditorSearchBar/index.js +3 -3
- package/dist/components/ui/SequenceEditorSearchBar/index.js.map +1 -1
- package/dist/constants/palette.js +147 -147
- package/dist/models/config.models.d.ts +1 -0
- package/dist/pages/SequenceEditorMainPage/index.js +17 -17
- package/dist/pages/SequenceEditorMainPage/index.js.map +1 -1
- package/dist/stores/sequenceEditorStore/sequenceEditorStore.d.ts +1 -1
- package/package.json +14 -14
- package/dist/assets/AlignerWorker-cbSDVRKB.js +0 -8
- package/dist/assets/index--BqOy4u7.js +0 -8
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { t as e } from "./
|
|
2
|
-
import { t } from "
|
|
1
|
+
import { t as e } from "./react.js";
|
|
2
|
+
import { EditorWorkerService as t } from "../classes/services/EditorWorkerService/index.js";
|
|
3
3
|
import { DEFAULT_GRID_GEOMETRY as n, IUPAC_KEYS as r } from "../constants/editor.js";
|
|
4
4
|
import { t as i } from "./SequenceEditorEventBusService.js";
|
|
5
5
|
import { EDITOR_DIRECTION as a, EDITOR_PATH_PROPERTIES_TYPE as o } from "../models/editor.models.js";
|
|
6
6
|
import { KEYBOARD_SHORTCUTS as s } from "../constants/keyboard.js";
|
|
7
7
|
import "../constants/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { EditorUtil as c } from "../utils/EditorUtil/index.js";
|
|
9
|
+
import { t as l } from "./EngineErrorUtil.js";
|
|
10
|
+
import { t as u } from "./sequenceEditorStore.js";
|
|
11
11
|
import { SequenceEditorSearchBar as d } from "../components/ui/SequenceEditorSearchBar/index.js";
|
|
12
12
|
import { SequenceEditorRealignModal as f } from "../components/ui/SequenceEditorRealignModal/index.js";
|
|
13
13
|
import { useCallback as p, useEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
|
|
14
14
|
import { Box as v, CircularProgress as y, TextField as b, darken as x, useTheme as S } from "@mui/material";
|
|
15
15
|
import { container as C } from "tsyringe";
|
|
16
16
|
import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
17
|
+
import { useConfig as E } from "@rivm-loculus-tools/common-frontend/hooks/useConfig";
|
|
18
|
+
import { Subject as D } from "@gen-epix/ui-core/classes/Subject";
|
|
19
|
+
import { DevicePixelRatioService as O } from "@gen-epix/ui-core/classes/services/DevicePixelRatioService";
|
|
20
|
+
import { KeyboardShortcutService as ee } from "@gen-epix/ui-core/classes/services/KeyboardShortcutService";
|
|
21
|
+
import { ExportUtil as te } from "@rivm-loculus-tools/common-frontend/utils/ExportUtil";
|
|
22
|
+
import { UploadToLoculusModal as ne } from "@rivm-loculus-tools/common-frontend/components/loculus/UploadToLoculusModal";
|
|
23
|
+
import { WindowService as re } from "@gen-epix/ui-core/classes/services/WindowService";
|
|
23
24
|
import { withDialog as k } from "@gen-epix/ui-core-components/hoc/withDialog";
|
|
24
25
|
// ../../../../node_modules/.pnpm/use-debounce@10.1.1_react@19.3.1/node_modules/use-debounce/dist/index.module.js
|
|
25
|
-
function
|
|
26
|
+
function ie(e, t, n, r) {
|
|
26
27
|
var i = this, a = g(null), o = g(0), s = g(0), c = g(null), l = g([]), u = g(), d = g(), f = g(e), p = g(!0), _ = g(), v = g();
|
|
27
28
|
f.current = e;
|
|
28
29
|
var y = typeof window < "u", b = !t && t !== 0 && y;
|
|
@@ -89,13 +90,13 @@ function re(e, t, n, r) {
|
|
|
89
90
|
}, [C]), D;
|
|
90
91
|
}
|
|
91
92
|
// src/components/ui/SequenceEditor/SequenceEditorStatusBar.tsx
|
|
92
|
-
var
|
|
93
|
-
let
|
|
93
|
+
var ae = () => {
|
|
94
|
+
let t = S(), n = e(u, (e) => e.isRealigning), r = e(u, (e) => e.latestMessage), i = e(u, (e) => e.engineMeta), a = e(u, (e) => e.selection), o = h(() => c.getStatusBarSelectionStats(a, i), [i, a]);
|
|
94
95
|
return /* @__PURE__ */ w(v, {
|
|
95
96
|
sx: {
|
|
96
|
-
backgroundColor: x(
|
|
97
|
-
borderTop: `1px solid ${x(
|
|
98
|
-
fontSize:
|
|
97
|
+
backgroundColor: x(t.palette.background.paper, .1),
|
|
98
|
+
borderTop: `1px solid ${x(t.palette.background.paper, .2)}`,
|
|
99
|
+
fontSize: t.typography.caption,
|
|
99
100
|
height: "100%",
|
|
100
101
|
width: "100%"
|
|
101
102
|
},
|
|
@@ -103,16 +104,16 @@ var ie = () => {
|
|
|
103
104
|
sx: {
|
|
104
105
|
"& > div": {
|
|
105
106
|
alignItems: "center",
|
|
106
|
-
borderLeft: `1px solid ${x(
|
|
107
|
+
borderLeft: `1px solid ${x(t.palette.background.paper, .2)}`,
|
|
107
108
|
display: "flex",
|
|
108
|
-
paddingLeft:
|
|
109
|
+
paddingLeft: t.spacing(1)
|
|
109
110
|
},
|
|
110
111
|
"& > div:first-of-type": { borderLeft: "none" },
|
|
111
112
|
display: "grid",
|
|
112
113
|
gap: 4,
|
|
113
114
|
gridTemplateColumns: "1fr repeat(5, max-content)",
|
|
114
|
-
paddingLeft:
|
|
115
|
-
paddingRight:
|
|
115
|
+
paddingLeft: t.spacing(1),
|
|
116
|
+
paddingRight: t.spacing(1)
|
|
116
117
|
},
|
|
117
118
|
children: [
|
|
118
119
|
/* @__PURE__ */ T(v, {
|
|
@@ -121,21 +122,21 @@ var ie = () => {
|
|
|
121
122
|
display: "flex",
|
|
122
123
|
gap: 1
|
|
123
124
|
},
|
|
124
|
-
children: [
|
|
125
|
+
children: [n && /* @__PURE__ */ w(y, {
|
|
125
126
|
color: "inherit",
|
|
126
127
|
size: 12
|
|
127
|
-
}),
|
|
128
|
+
}), r ?? ""]
|
|
128
129
|
}),
|
|
129
|
-
/* @__PURE__ */ w(v, { children: `Pos: ${
|
|
130
|
-
/* @__PURE__ */ w(v, { children: `Selected seqs: ${
|
|
131
|
-
/* @__PURE__ */ w(v, { children: `Cols: ${
|
|
132
|
-
/* @__PURE__ */ w(v, { children: `Total selected chars: ${
|
|
133
|
-
/* @__PURE__ */ w(v, { children: `Alignment: ${
|
|
130
|
+
/* @__PURE__ */ w(v, { children: `Pos: ${o.pos}` }),
|
|
131
|
+
/* @__PURE__ */ w(v, { children: `Selected seqs: ${o.selectedSeqs}` }),
|
|
132
|
+
/* @__PURE__ */ w(v, { children: `Cols: ${o.cols}` }),
|
|
133
|
+
/* @__PURE__ */ w(v, { children: `Total selected chars: ${o.totalSelectedChars}` }),
|
|
134
|
+
/* @__PURE__ */ w(v, { children: `Alignment: ${i?.sequenceCount ?? "0"} sequences, ${i?.alignmentWidth ?? "0"} positions` })
|
|
134
135
|
]
|
|
135
136
|
})
|
|
136
137
|
});
|
|
137
|
-
},
|
|
138
|
-
let [r, i] = _(""), a = g(null), o = r === "" ||
|
|
138
|
+
}, A = /^(?:\d+|,\d+|\d+,\d+)$/, oe = k(({ onActionsChange: e, onClose: t, onGotoPosition: n }) => {
|
|
139
|
+
let [r, i] = _(""), a = g(null), o = r === "" || A.test(r);
|
|
139
140
|
m(() => {
|
|
140
141
|
a.current?.focus();
|
|
141
142
|
}, []);
|
|
@@ -189,33 +190,33 @@ var ie = () => {
|
|
|
189
190
|
maxWidth: "xs",
|
|
190
191
|
testId: "SequenceEditorGotoPositionDialog"
|
|
191
192
|
}), se = () => {
|
|
192
|
-
let y =
|
|
193
|
+
let y = E(), b = e(u, (e) => e.isRealigning), x = e(u, (e) => e.rawFasta), k = e(u, (e) => e.setEngineMeta), A = e(u, (e) => e.setSelection), se = g(null), ce = g(null), le = g(null), j = h(() => C.resolve(t), []), M = g(null), N = g(null), P = g(null), F = g(null), I = g(null), L = g(null), ue = g(null), [R, de] = _({
|
|
193
194
|
height: 0,
|
|
194
195
|
width: 0
|
|
195
|
-
}), [fe, pe] = _(() => C.resolve(
|
|
196
|
+
}), [fe, pe] = _(() => C.resolve(O).data), me = g(0), he = g(0), z = h(() => new D({
|
|
196
197
|
scrollLeft: 0,
|
|
197
198
|
scrollTop: 0
|
|
198
|
-
}), []),
|
|
199
|
+
}), []), ge = g(R), B = h(() => new D(null), []), V = h(() => new D(null), []), H = g(null), U = g(null), W = h(() => new D(n), []), G = h(() => new D(null), []), K = g(null), q = g(0), J = g(null), _e = g(!1), Y = S();
|
|
199
200
|
m(() => {
|
|
200
|
-
|
|
201
|
-
}, [
|
|
201
|
+
b ? le.current?.open() : le.current?.close();
|
|
202
|
+
}, [b]);
|
|
202
203
|
let X = p(() => {
|
|
203
204
|
let e = ue.current;
|
|
204
205
|
if (!e) return;
|
|
205
206
|
let t = W.data, n = B.data;
|
|
206
207
|
if (t && n) {
|
|
207
208
|
let e = t.labelWidth + t.cellWidth + n.alignmentWidth * t.cellWidth, r = t.rulerHeight + n.sequenceCount * t.cellHeight;
|
|
208
|
-
|
|
209
|
+
he.current !== e && (he.current = e), me.current !== r && (me.current = r);
|
|
209
210
|
}
|
|
210
|
-
let { height: r, width: i } =
|
|
211
|
+
let { height: r, width: i } = ge.current, a = `${Math.max(he.current, i)}px`, o = `${Math.max(me.current, r)}px`;
|
|
211
212
|
e.style.width !== a && (e.style.width = a), e.style.height !== o && (e.style.height = o);
|
|
212
213
|
}, [W, B]), Z = p(async (e) => {
|
|
213
|
-
let
|
|
214
|
-
return
|
|
214
|
+
let n = C.resolve(t).getMetaData(e), r = await n;
|
|
215
|
+
return n.abortSignal?.aborted ? null : (B.next(r), r);
|
|
215
216
|
}, [B]), Q = p(() => {
|
|
216
217
|
let e = W.data, t = B.data;
|
|
217
218
|
if (!t || !e) return;
|
|
218
|
-
let { scrollLeft: n, scrollTop: r } = z.data, { height: i, width: a } =
|
|
219
|
+
let { scrollLeft: n, scrollTop: r } = z.data, { height: i, width: a } = ge.current, o = c.getVisibleGridRange({
|
|
219
220
|
geometry: e,
|
|
220
221
|
numCols: t.alignmentWidth,
|
|
221
222
|
numRows: t.sequenceCount,
|
|
@@ -237,168 +238,168 @@ var ie = () => {
|
|
|
237
238
|
B,
|
|
238
239
|
z,
|
|
239
240
|
V
|
|
240
|
-
]),
|
|
241
|
+
]), ve = ie((e, t) => {
|
|
241
242
|
de({
|
|
242
243
|
height: t,
|
|
243
244
|
width: e
|
|
244
245
|
});
|
|
245
246
|
}, 0, { trailing: !0 });
|
|
246
247
|
m(() => {
|
|
247
|
-
|
|
248
|
+
ge.current = R, X(), Q();
|
|
248
249
|
}, [
|
|
249
|
-
|
|
250
|
+
R,
|
|
250
251
|
X,
|
|
251
252
|
Q
|
|
252
253
|
]);
|
|
253
|
-
let $ =
|
|
254
|
+
let $ = R.width > 0 ? R.width / 2 : 120;
|
|
254
255
|
m(() => {
|
|
255
|
-
let
|
|
256
|
-
x(e);
|
|
257
|
-
}), G.subscribe((e) => {
|
|
256
|
+
let e = [B.subscribe((e) => {
|
|
258
257
|
k(e);
|
|
258
|
+
}), G.subscribe((e) => {
|
|
259
|
+
A(e);
|
|
259
260
|
})];
|
|
260
261
|
return () => {
|
|
261
|
-
|
|
262
|
+
e.forEach((e) => e()), u.getState().setLatestMessage(null), k(null), A(null);
|
|
262
263
|
};
|
|
263
264
|
}, [
|
|
264
265
|
B,
|
|
265
266
|
G,
|
|
266
|
-
|
|
267
|
-
|
|
267
|
+
k,
|
|
268
|
+
A
|
|
268
269
|
]), m(() => {
|
|
269
|
-
if (
|
|
270
|
+
if (R.width <= 0) return;
|
|
270
271
|
let e = W.data;
|
|
271
272
|
e.labelWidth > $ && W.next({
|
|
272
273
|
...e,
|
|
273
274
|
labelWidth: $
|
|
274
275
|
});
|
|
275
276
|
}, [
|
|
276
|
-
|
|
277
|
+
R.width,
|
|
277
278
|
W,
|
|
278
279
|
$
|
|
279
280
|
]), m(() => {
|
|
280
|
-
let e =
|
|
281
|
+
let e = L.current;
|
|
281
282
|
if (!e) return;
|
|
282
283
|
let t = new ResizeObserver(([e]) => {
|
|
283
284
|
if (!e) return;
|
|
284
285
|
let t = Math.max(1, e.contentRect.height), n = Math.max(1, e.contentRect.width);
|
|
285
|
-
|
|
286
|
+
ve(n, t);
|
|
286
287
|
});
|
|
287
288
|
return t.observe(e), () => t.disconnect();
|
|
288
|
-
}, [
|
|
289
|
+
}, [j, ve]), m(() => {
|
|
289
290
|
let e = new AbortController();
|
|
290
291
|
return (async () => {
|
|
291
292
|
H.current = null, U.current = null, z.next({
|
|
292
293
|
scrollLeft: 0,
|
|
293
294
|
scrollTop: 0
|
|
294
295
|
}), G.next(null);
|
|
295
|
-
let t =
|
|
296
|
+
let t = j.initialize(e.signal);
|
|
296
297
|
if (await t, t.abortSignal?.aborted) return;
|
|
297
|
-
let n =
|
|
298
|
+
let n = j.reset(e.signal);
|
|
298
299
|
if (await n, n.abortSignal?.aborted) return;
|
|
299
|
-
let r =
|
|
300
|
-
await r,
|
|
300
|
+
let r = j.loadFasta(x, e.signal);
|
|
301
|
+
await r, r.abortSignal?.aborted || await Z(e.signal);
|
|
301
302
|
})().catch((t) => {
|
|
302
303
|
e.signal.aborted || console.error(t);
|
|
303
304
|
}), () => e.abort();
|
|
304
305
|
}, [
|
|
305
|
-
|
|
306
|
-
|
|
306
|
+
j,
|
|
307
|
+
x,
|
|
307
308
|
z,
|
|
308
309
|
G,
|
|
309
310
|
Z,
|
|
310
311
|
Q
|
|
311
312
|
]), m(() => {
|
|
312
|
-
let
|
|
313
|
-
if (
|
|
314
|
-
|
|
313
|
+
let e = null, t = !0, n = null, r = null, i = null, a = async () => {
|
|
314
|
+
if (t && !_e.current) {
|
|
315
|
+
_e.current = !0;
|
|
315
316
|
try {
|
|
316
|
-
for (;
|
|
317
|
-
let
|
|
317
|
+
for (; t && J.current;) {
|
|
318
|
+
let a = J.current;
|
|
318
319
|
J.current = null;
|
|
319
|
-
let
|
|
320
|
-
if (!
|
|
321
|
-
if (!U.current || !
|
|
320
|
+
let o = q.current, s = n;
|
|
321
|
+
if (!s || s.signal.aborted) return;
|
|
322
|
+
if (!U.current || !c.isWithinGridRange({
|
|
322
323
|
cachedGridRange: U.current.range,
|
|
323
|
-
visibleGridRange:
|
|
324
|
+
visibleGridRange: a.visibleGridRange.visible
|
|
324
325
|
})) {
|
|
325
326
|
let e = [];
|
|
326
|
-
for (let t =
|
|
327
|
-
let n =
|
|
327
|
+
for (let t = a.visibleGridRange.cache.startRow; t <= a.visibleGridRange.cache.endRow; t++) {
|
|
328
|
+
let n = j.name(t, s.signal);
|
|
328
329
|
if (e.push(await n), n.abortSignal?.aborted) return;
|
|
329
330
|
}
|
|
330
|
-
if (!
|
|
331
|
+
if (!t || s.signal.aborted) return;
|
|
331
332
|
U.current = {
|
|
332
|
-
range:
|
|
333
|
+
range: a.visibleGridRange.cache,
|
|
333
334
|
rowNames: e
|
|
334
335
|
};
|
|
335
336
|
}
|
|
336
|
-
if (!H.current || !
|
|
337
|
+
if (!H.current || !c.isWithinGridRange({
|
|
337
338
|
cachedGridRange: H.current.range,
|
|
338
|
-
visibleGridRange:
|
|
339
|
+
visibleGridRange: a.visibleGridRange.visible
|
|
339
340
|
})) {
|
|
340
|
-
let e =
|
|
341
|
-
endCol:
|
|
342
|
-
endRow:
|
|
343
|
-
startCol:
|
|
344
|
-
startRow:
|
|
345
|
-
},
|
|
346
|
-
if (!
|
|
341
|
+
let e = j.viewport({
|
|
342
|
+
endCol: a.visibleGridRange.cache.endCol,
|
|
343
|
+
endRow: a.visibleGridRange.cache.endRow,
|
|
344
|
+
startCol: a.visibleGridRange.cache.startCol,
|
|
345
|
+
startRow: a.visibleGridRange.cache.startRow
|
|
346
|
+
}, s.signal), n = await e;
|
|
347
|
+
if (!t || e.abortSignal?.aborted) return;
|
|
347
348
|
H.current = {
|
|
348
|
-
range:
|
|
349
|
-
viewportResult:
|
|
349
|
+
range: a.visibleGridRange.cache,
|
|
350
|
+
viewportResult: n
|
|
350
351
|
};
|
|
351
352
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
canvasElement:
|
|
355
|
-
devicePixelRatio: C.resolve(
|
|
356
|
-
geometry:
|
|
353
|
+
o === q.current && (e !== null && cancelAnimationFrame(e), e = requestAnimationFrame(() => {
|
|
354
|
+
t && o === q.current && M.current && u.getState().nucleotidePalette && H.current && B.data && U.current && (N.current = c.drawCanvas({
|
|
355
|
+
canvasElement: M.current,
|
|
356
|
+
devicePixelRatio: C.resolve(O).data,
|
|
357
|
+
geometry: a.geometry,
|
|
357
358
|
meta: B.data,
|
|
358
|
-
palette:
|
|
359
|
+
palette: u.getState().nucleotidePalette,
|
|
359
360
|
rowNames: U.current.rowNames,
|
|
360
361
|
rowNamesStartRow: U.current.range.startRow,
|
|
361
|
-
scrollLeft:
|
|
362
|
-
scrollTop:
|
|
363
|
-
searchResult:
|
|
364
|
-
searchResultHighlightedIndex:
|
|
362
|
+
scrollLeft: a.scrollLeft,
|
|
363
|
+
scrollTop: a.scrollTop,
|
|
364
|
+
searchResult: r,
|
|
365
|
+
searchResultHighlightedIndex: i,
|
|
365
366
|
selection: G.data,
|
|
366
367
|
viewport: H.current.viewportResult,
|
|
367
|
-
viewportHeight:
|
|
368
|
-
viewportWidth:
|
|
368
|
+
viewportHeight: a.viewportHeight,
|
|
369
|
+
viewportWidth: a.viewportWidth
|
|
369
370
|
}));
|
|
370
371
|
}));
|
|
371
372
|
}
|
|
372
373
|
} catch (e) {
|
|
373
374
|
if (!(e instanceof DOMException && e.name === "AbortError")) throw e;
|
|
374
375
|
} finally {
|
|
375
|
-
|
|
376
|
+
_e.current = !1, t && J.current && a();
|
|
376
377
|
}
|
|
377
378
|
}
|
|
378
|
-
},
|
|
379
|
+
}, o = [u.subscribe((e, t) => {
|
|
379
380
|
let n = !1;
|
|
380
|
-
e.searchResult !== t.searchResult && (
|
|
381
|
+
e.searchResult !== t.searchResult && (r = e.searchResult, n = !0), e.searchResultHighlightedIndex !== t.searchResultHighlightedIndex && (i = e.searchResultHighlightedIndex, c.scrollToSearchResult({
|
|
381
382
|
geometry: W.data,
|
|
382
|
-
scrollContainer:
|
|
383
|
+
scrollContainer: L.current,
|
|
383
384
|
searchResult: e.searchResult,
|
|
384
385
|
searchResultHighlightedIndex: e.searchResultHighlightedIndex
|
|
385
386
|
}), n = !0), n && Q();
|
|
386
387
|
}), V.subscribe((e) => {
|
|
387
|
-
e && (
|
|
388
|
+
e && (n?.abort(), n = new AbortController(), J.current = e, q.current += 1, a());
|
|
388
389
|
})];
|
|
389
390
|
return () => {
|
|
390
|
-
|
|
391
|
+
t = !1, n?.abort(), J.current = null, e !== null && cancelAnimationFrame(e), q.current += 1, o.forEach((e) => e());
|
|
391
392
|
};
|
|
392
393
|
}, [
|
|
393
|
-
|
|
394
|
+
j,
|
|
394
395
|
W,
|
|
395
396
|
B,
|
|
396
397
|
G,
|
|
397
398
|
Q,
|
|
398
399
|
V
|
|
399
400
|
]), m(() => {
|
|
400
|
-
let
|
|
401
|
-
|
|
401
|
+
let e = [
|
|
402
|
+
u.subscribe((e, t) => {
|
|
402
403
|
e.nucleotidePalette !== t.nucleotidePalette && Q();
|
|
403
404
|
}),
|
|
404
405
|
W.subscribe(() => {
|
|
@@ -409,15 +410,15 @@ var ie = () => {
|
|
|
409
410
|
e && (X(), Q());
|
|
410
411
|
}),
|
|
411
412
|
G.subscribe(() => Q()),
|
|
412
|
-
C.resolve(
|
|
413
|
+
C.resolve(O).subscribe((e) => {
|
|
413
414
|
pe(e), X(), Q();
|
|
414
415
|
})
|
|
415
416
|
];
|
|
416
417
|
return () => {
|
|
417
|
-
|
|
418
|
+
e.forEach((e) => e());
|
|
418
419
|
};
|
|
419
420
|
}, [
|
|
420
|
-
|
|
421
|
+
j,
|
|
421
422
|
W,
|
|
422
423
|
B,
|
|
423
424
|
z,
|
|
@@ -428,9 +429,9 @@ var ie = () => {
|
|
|
428
429
|
let e = (e) => {
|
|
429
430
|
let t = e.key.toUpperCase();
|
|
430
431
|
r.has(t) && (e.preventDefault(), C.resolve(i).emit("onMutateSelection", t));
|
|
431
|
-
}, t = (e) => C.resolve(
|
|
432
|
+
}, t = (e) => C.resolve(ee).registerShortcut({
|
|
432
433
|
callback: e.callback,
|
|
433
|
-
element:
|
|
434
|
+
element: I.current,
|
|
434
435
|
...e.shortcut
|
|
435
436
|
}), n = [
|
|
436
437
|
t(s.copySelection),
|
|
@@ -462,13 +463,13 @@ var ie = () => {
|
|
|
462
463
|
t(s.undo),
|
|
463
464
|
t(s.redo),
|
|
464
465
|
t(s.gotoPosition),
|
|
465
|
-
C.resolve(
|
|
466
|
+
C.resolve(ee).registerShortcut({
|
|
466
467
|
callback: e,
|
|
467
|
-
element:
|
|
468
|
+
element: I.current
|
|
468
469
|
}),
|
|
469
|
-
C.resolve(
|
|
470
|
+
C.resolve(ee).registerShortcut({
|
|
470
471
|
callback: e,
|
|
471
|
-
element:
|
|
472
|
+
element: I.current,
|
|
472
473
|
modifiers: [["Shift"]]
|
|
473
474
|
})
|
|
474
475
|
];
|
|
@@ -476,7 +477,7 @@ var ie = () => {
|
|
|
476
477
|
n.forEach((e) => e());
|
|
477
478
|
};
|
|
478
479
|
}, []), m(() => {
|
|
479
|
-
let
|
|
480
|
+
let e = async (e) => {
|
|
480
481
|
let { abortSignal: t, command: n, getSelectionPostCommand: r, invalidateRowNames: i } = e;
|
|
481
482
|
try {
|
|
482
483
|
let e = B.data?.undoDepth;
|
|
@@ -491,73 +492,73 @@ var ie = () => {
|
|
|
491
492
|
} catch (e) {
|
|
492
493
|
t?.aborted || console.error("Failed to post command:", e);
|
|
493
494
|
}
|
|
494
|
-
},
|
|
495
|
+
}, t = async (t) => {
|
|
495
496
|
if (!B.data) return;
|
|
496
|
-
let n =
|
|
497
|
-
n && await
|
|
498
|
-
await
|
|
497
|
+
let n = c.getMutateArguments(G.data, B.data);
|
|
498
|
+
n && await e({ command: async () => {
|
|
499
|
+
await j.mutate(n.rows, n.columns, t);
|
|
499
500
|
} });
|
|
500
|
-
},
|
|
501
|
+
}, n = (e) => {
|
|
501
502
|
if (!B.data) return;
|
|
502
|
-
let t =
|
|
503
|
+
let t = c.getMovedSelection(G.data, e, B.data);
|
|
503
504
|
if (t) {
|
|
504
505
|
if (G.next(t), K.current) {
|
|
505
|
-
let t =
|
|
506
|
+
let t = c.getMovedSelection(K.current, e, B.data);
|
|
506
507
|
K.current = t;
|
|
507
508
|
} else K.current = t;
|
|
508
509
|
}
|
|
509
|
-
},
|
|
510
|
+
}, r = (e) => {
|
|
510
511
|
if (!B.data || !K.current || !G.data) return;
|
|
511
|
-
let t =
|
|
512
|
+
let t = c.getExpandedSelection(G.data, K.current, e, B.data);
|
|
512
513
|
t && G.next(t);
|
|
513
|
-
},
|
|
514
|
+
}, o = async (t) => {
|
|
514
515
|
if (!B.data) return;
|
|
515
|
-
let n =
|
|
516
|
-
n && await
|
|
516
|
+
let n = c.getRowsToMove(G.data, t, B.data);
|
|
517
|
+
n && await e({
|
|
517
518
|
command: async () => {
|
|
518
|
-
|
|
519
|
+
t === a.UP ? (await j.moveRowsToTop(n), L.current && (L.current.scrollTop = 0)) : (await j.moveRowsToBottom(n), L.current && (L.current.scrollTop = L.current.scrollHeight - L.current.clientHeight));
|
|
519
520
|
},
|
|
520
|
-
getSelectionPostCommand: () =>
|
|
521
|
+
getSelectionPostCommand: () => c.getMovedRowsEndSelection(G.data, t, B.data),
|
|
521
522
|
invalidateRowNames: !0
|
|
522
523
|
});
|
|
523
|
-
},
|
|
524
|
+
}, s = async (t) => {
|
|
524
525
|
if (!B.data) return;
|
|
525
|
-
let n =
|
|
526
|
-
n && await
|
|
526
|
+
let n = c.getRowsToMove(G.data, t, B.data);
|
|
527
|
+
n && await e({
|
|
527
528
|
command: async () => {
|
|
528
|
-
|
|
529
|
+
t === a.UP ? await j.moveRowsUp(n) : await j.moveRowsDown(n);
|
|
529
530
|
},
|
|
530
|
-
getSelectionPostCommand: () =>
|
|
531
|
+
getSelectionPostCommand: () => c.getMovedRowsRelativeSelection(G.data, t, B.data),
|
|
531
532
|
invalidateRowNames: !0
|
|
532
533
|
});
|
|
533
|
-
}, d = async (
|
|
534
|
-
if (!B.data ||
|
|
535
|
-
let n =
|
|
536
|
-
n && n.columns.length !== 0 && n.rows.length !== 0 && await
|
|
534
|
+
}, d = async (t) => {
|
|
535
|
+
if (!B.data || t !== a.LEFT && t !== a.RIGHT || !G.data?.cells && (!G.data?.cols || G.data.cols.length === 0)) return;
|
|
536
|
+
let n = c.getMutateArguments(G.data, B.data);
|
|
537
|
+
n && n.columns.length !== 0 && n.rows.length !== 0 && await e({
|
|
537
538
|
command: async () => {
|
|
538
|
-
await
|
|
539
|
+
await j.moveHorizontal(n.rows, n.columns, t);
|
|
539
540
|
},
|
|
540
|
-
getSelectionPostCommand: () =>
|
|
541
|
+
getSelectionPostCommand: () => c.getPostUpsertSelection(G.data, t)
|
|
541
542
|
});
|
|
542
|
-
}, f = C.resolve(i), p = null, m = null, h = async (
|
|
543
|
-
if (
|
|
543
|
+
}, f = C.resolve(i), p = null, m = null, h = async (t) => {
|
|
544
|
+
if (u.getState().isRealigning || !t.trimStart().startsWith(">")) return;
|
|
544
545
|
m?.abort();
|
|
545
|
-
let
|
|
546
|
-
m =
|
|
546
|
+
let n = new AbortController();
|
|
547
|
+
m = n;
|
|
547
548
|
try {
|
|
548
|
-
await
|
|
549
|
-
abortSignal:
|
|
549
|
+
await e({
|
|
550
|
+
abortSignal: n.signal,
|
|
550
551
|
command: async () => {
|
|
551
|
-
let
|
|
552
|
-
await
|
|
552
|
+
let e = j.loadFasta(t, n.signal);
|
|
553
|
+
await e, e.abortSignal?.aborted || (u.getState().searchQuery && f.emit("onSearch", u.getState().searchQuery), u.getState().setLatestMessage("Pasted sequences from clipboard"));
|
|
553
554
|
},
|
|
554
|
-
getSelectionPostCommand: () =>
|
|
555
|
+
getSelectionPostCommand: () => c.getPostPasteSequencesSelection(G.data, t),
|
|
555
556
|
invalidateRowNames: !0
|
|
556
557
|
});
|
|
557
|
-
} catch (
|
|
558
|
-
|
|
558
|
+
} catch (e) {
|
|
559
|
+
n.signal.aborted || (console.error("Failed to load FASTA from clipboard:", e), u.getState().setLatestMessage("Failed to load FASTA from clipboard."));
|
|
559
560
|
} finally {
|
|
560
|
-
m ===
|
|
561
|
+
m === n && (m = null);
|
|
561
562
|
}
|
|
562
563
|
}, g = (e) => {
|
|
563
564
|
let t = e.target;
|
|
@@ -565,34 +566,34 @@ var ie = () => {
|
|
|
565
566
|
let n = e.clipboardData?.getData("text/plain") ?? "";
|
|
566
567
|
n.trimStart().startsWith(">") && (e.preventDefault(), h(n));
|
|
567
568
|
};
|
|
568
|
-
C.resolve(
|
|
569
|
+
C.resolve(re).window.addEventListener("paste", g);
|
|
569
570
|
let _ = [
|
|
570
|
-
() => C.resolve(
|
|
571
|
-
f.addEventListener("onSearch", async (
|
|
572
|
-
if (!
|
|
571
|
+
() => C.resolve(re).window.removeEventListener("paste", g),
|
|
572
|
+
f.addEventListener("onSearch", async (e) => {
|
|
573
|
+
if (!e) {
|
|
573
574
|
p?.abort();
|
|
574
575
|
return;
|
|
575
576
|
}
|
|
576
577
|
p?.abort();
|
|
577
|
-
let
|
|
578
|
-
p =
|
|
579
|
-
let
|
|
578
|
+
let t = new AbortController();
|
|
579
|
+
p = t;
|
|
580
|
+
let n = j.search(e, !0, t.signal);
|
|
580
581
|
try {
|
|
581
|
-
let
|
|
582
|
-
|
|
582
|
+
let e = await n;
|
|
583
|
+
n.abortSignal?.aborted || u.getState().setSearchResult(e);
|
|
583
584
|
} catch (e) {
|
|
584
|
-
|
|
585
|
+
t.signal.aborted || console.error("Failed to search sequences:", e);
|
|
585
586
|
}
|
|
586
587
|
}),
|
|
587
|
-
f.addEventListener("onExpandSelection", (e) =>
|
|
588
|
+
f.addEventListener("onExpandSelection", (e) => r(e)),
|
|
588
589
|
f.addEventListener("onCopySelection", async () => {
|
|
589
|
-
let
|
|
590
|
-
if (
|
|
591
|
-
let
|
|
592
|
-
if (!
|
|
593
|
-
await navigator.clipboard.writeText(
|
|
594
|
-
} catch (
|
|
595
|
-
console.error("Failed to copy selected sequences:",
|
|
590
|
+
let e = G.data;
|
|
591
|
+
if (e) try {
|
|
592
|
+
let t = await j.exportGappedFasta(), n = c.getSelectedFasta(t, e);
|
|
593
|
+
if (!n) return;
|
|
594
|
+
await navigator.clipboard.writeText(n), u.getState().setLatestMessage("Copied selected sequences to clipboard");
|
|
595
|
+
} catch (e) {
|
|
596
|
+
console.error("Failed to copy selected sequences:", e), u.getState().setLatestMessage("Failed to copy selected sequences to clipboard.");
|
|
596
597
|
}
|
|
597
598
|
}),
|
|
598
599
|
f.addEventListener("onPasteFasta", async () => {
|
|
@@ -600,149 +601,161 @@ var ie = () => {
|
|
|
600
601
|
console.log("Reading FASTA from clipboard");
|
|
601
602
|
let e = await navigator.clipboard.readText();
|
|
602
603
|
await h(e);
|
|
603
|
-
} catch (
|
|
604
|
-
console.error("Failed to read FASTA from clipboard:",
|
|
604
|
+
} catch (e) {
|
|
605
|
+
console.error("Failed to read FASTA from clipboard:", e), u.getState().setLatestMessage("Failed to read FASTA from clipboard.");
|
|
605
606
|
}
|
|
606
607
|
}),
|
|
607
|
-
f.addEventListener("onGotoPosition", () =>
|
|
608
|
-
f.addEventListener("onMoveSelection", (e) =>
|
|
608
|
+
f.addEventListener("onGotoPosition", () => ce.current?.open({})),
|
|
609
|
+
f.addEventListener("onMoveSelection", (e) => n(e)),
|
|
609
610
|
f.addEventListener("onMoveRows", (e) => {
|
|
610
|
-
|
|
611
|
+
s(e);
|
|
611
612
|
}),
|
|
612
613
|
f.addEventListener("onMoveRowsEnd", (e) => {
|
|
613
|
-
|
|
614
|
+
o(e);
|
|
614
615
|
}),
|
|
615
616
|
f.addEventListener("onMoveCells", (e) => {
|
|
616
617
|
d(e);
|
|
617
618
|
}),
|
|
618
619
|
f.addEventListener("onScrollToLineStart", () => {
|
|
619
|
-
let e =
|
|
620
|
+
let e = L.current;
|
|
620
621
|
e && (e.scrollLeft = 0);
|
|
621
622
|
}),
|
|
622
623
|
f.addEventListener("onScrollToLineEnd", () => {
|
|
623
|
-
let e =
|
|
624
|
+
let e = L.current;
|
|
624
625
|
e && (e.scrollLeft = e.scrollWidth - e.clientWidth);
|
|
625
626
|
}),
|
|
626
627
|
f.addEventListener("onScrollPageUp", () => {
|
|
627
|
-
let e =
|
|
628
|
+
let e = L.current;
|
|
628
629
|
e && (e.scrollTop = Math.max(0, e.scrollTop - e.clientHeight));
|
|
629
630
|
}),
|
|
630
631
|
f.addEventListener("onScrollPageDown", () => {
|
|
631
|
-
let e =
|
|
632
|
+
let e = L.current;
|
|
632
633
|
e && (e.scrollTop = Math.min(e.scrollHeight - e.clientHeight, e.scrollTop + e.clientHeight));
|
|
633
634
|
}),
|
|
634
635
|
f.addEventListener("onInsert", () => {
|
|
635
636
|
(async () => {
|
|
636
637
|
if (!B.data) return;
|
|
637
|
-
let
|
|
638
|
-
|
|
639
|
-
command: async () =>
|
|
640
|
-
getSelectionPostCommand: () =>
|
|
638
|
+
let t = c.getUpsertArguments(G.data, B.data);
|
|
639
|
+
t && await e({
|
|
640
|
+
command: async () => j.insert(t.rows, t.col),
|
|
641
|
+
getSelectionPostCommand: () => c.getPostUpsertSelection(G.data, a.RIGHT)
|
|
641
642
|
});
|
|
642
643
|
})();
|
|
643
644
|
}),
|
|
644
645
|
f.addEventListener("onDeleteBackward", () => {
|
|
645
646
|
(async () => {
|
|
646
647
|
if (!B.data) return;
|
|
647
|
-
let
|
|
648
|
-
|
|
649
|
-
command: async () =>
|
|
650
|
-
getSelectionPostCommand: () =>
|
|
648
|
+
let t = c.getUpsertArguments(G.data, B.data, -1);
|
|
649
|
+
t && await e({
|
|
650
|
+
command: async () => j.delete(t.rows, t.col),
|
|
651
|
+
getSelectionPostCommand: () => c.getPostUpsertSelection(G.data, a.LEFT)
|
|
651
652
|
});
|
|
652
653
|
})();
|
|
653
654
|
}),
|
|
654
655
|
f.addEventListener("onDeleteRows", () => {
|
|
655
656
|
(async () => {
|
|
656
|
-
let
|
|
657
|
-
|
|
658
|
-
command: async () =>
|
|
659
|
-
getSelectionPostCommand: () =>
|
|
657
|
+
let t = G.data, n = t?.rows, r = B.data;
|
|
658
|
+
n?.length && r && (await e({
|
|
659
|
+
command: async () => j.deleteRows(n),
|
|
660
|
+
getSelectionPostCommand: () => c.getPostDeleteRowsSelection(t, r.sequenceCount),
|
|
660
661
|
invalidateRowNames: !0
|
|
661
|
-
}),
|
|
662
|
+
}), u.getState().setLatestMessage(`${n.length} row${n.length > 1 ? "s" : ""} deleted`));
|
|
662
663
|
})();
|
|
663
664
|
}),
|
|
664
665
|
f.addEventListener("onMutateSelection", (e) => {
|
|
665
|
-
|
|
666
|
+
t(e);
|
|
666
667
|
}),
|
|
667
668
|
f.addEventListener("onUndo", () => {
|
|
668
|
-
|
|
669
|
-
command: async () =>
|
|
669
|
+
e({
|
|
670
|
+
command: async () => j.undo(),
|
|
670
671
|
getSelectionPostCommand: () => null,
|
|
671
672
|
invalidateRowNames: !0
|
|
672
673
|
});
|
|
673
674
|
}),
|
|
674
675
|
f.addEventListener("onCancelRealign", () => {
|
|
675
|
-
|
|
676
|
+
j.cancelRealign();
|
|
676
677
|
}),
|
|
677
678
|
f.addEventListener("onRealign", () => {
|
|
678
|
-
|
|
679
|
-
let
|
|
680
|
-
|
|
679
|
+
u.getState().setIsRealigning(!0);
|
|
680
|
+
let t = !1;
|
|
681
|
+
e({
|
|
681
682
|
command: async () => {
|
|
682
683
|
try {
|
|
683
|
-
await
|
|
684
|
-
} catch (
|
|
685
|
-
if (
|
|
686
|
-
else throw
|
|
684
|
+
await j.realign();
|
|
685
|
+
} catch (e) {
|
|
686
|
+
if (e instanceof DOMException && e.name === "AbortError") t = !0;
|
|
687
|
+
else throw u.getState().setLatestMessage(l.getEngineErrorMessage(e)), e;
|
|
687
688
|
} finally {
|
|
688
|
-
|
|
689
|
+
u.getState().setIsRealigning(!1);
|
|
689
690
|
}
|
|
690
691
|
},
|
|
691
|
-
getSelectionPostCommand: () =>
|
|
692
|
+
getSelectionPostCommand: () => t ? G.data : null,
|
|
692
693
|
invalidateRowNames: !0
|
|
693
694
|
});
|
|
694
695
|
}),
|
|
695
696
|
f.addEventListener("onRedo", () => {
|
|
696
|
-
|
|
697
|
-
command: async () =>
|
|
697
|
+
e({
|
|
698
|
+
command: async () => j.redo(),
|
|
698
699
|
getSelectionPostCommand: () => null,
|
|
699
700
|
invalidateRowNames: !0
|
|
700
701
|
});
|
|
701
702
|
}),
|
|
702
703
|
f.addEventListener("onExportGappedFasta", async () => {
|
|
703
|
-
let e = await
|
|
704
|
-
|
|
704
|
+
let e = await j.exportGappedFasta();
|
|
705
|
+
te.downloadFastaFile(e, "sequence.gapped.fasta");
|
|
705
706
|
}),
|
|
706
707
|
f.addEventListener("onExportUngappedFasta", async () => {
|
|
707
|
-
let e = await
|
|
708
|
-
|
|
708
|
+
let e = await j.exportUngappedFasta();
|
|
709
|
+
te.downloadFastaFile(e, "sequence.ungapped.fasta");
|
|
709
710
|
}),
|
|
710
711
|
f.addEventListener("onExportToLoculus", async () => {
|
|
711
|
-
let
|
|
712
|
-
|
|
713
|
-
fasta:
|
|
714
|
-
metaData:
|
|
715
|
-
rawFasta:
|
|
712
|
+
let e = await j.exportUngappedFasta(), { parsedMetadata: t, rawFasta: n } = u.getState();
|
|
713
|
+
se.current?.open({
|
|
714
|
+
fasta: e,
|
|
715
|
+
metaData: t,
|
|
716
|
+
rawFasta: n
|
|
716
717
|
});
|
|
718
|
+
}),
|
|
719
|
+
f.addEventListener("onOpenInPhylogenyViewer", async () => {
|
|
720
|
+
if (!y.phylogenyViewerUrl) return;
|
|
721
|
+
let e = await j.exportUngappedFasta(), t = u.getState().rawMetadata, n = new URL(y.phylogenyViewerUrl).origin, r = C.resolve(re).window, i = null, a = (o) => {
|
|
722
|
+
o.origin === n && o.source === i && typeof o.data == "object" && o.data !== null && "type" in o.data && o.data.type === "data-receiver-ready" && (r.removeEventListener("message", a), i?.postMessage({
|
|
723
|
+
fasta: e,
|
|
724
|
+
metaData: t,
|
|
725
|
+
type: "import-data"
|
|
726
|
+
}, n));
|
|
727
|
+
};
|
|
728
|
+
r.addEventListener("message", a), i = r.open(y.phylogenyViewerUrl), i || r.removeEventListener("message", a);
|
|
717
729
|
})
|
|
718
730
|
];
|
|
719
731
|
return () => {
|
|
720
|
-
window.removeEventListener("paste", g), p?.abort(), m?.abort(), _.forEach((e) => e()),
|
|
732
|
+
window.removeEventListener("paste", g), p?.abort(), m?.abort(), _.forEach((e) => e()), j.cancelRealign();
|
|
721
733
|
};
|
|
722
734
|
}, [
|
|
723
|
-
|
|
735
|
+
j,
|
|
724
736
|
G,
|
|
725
737
|
Z,
|
|
726
738
|
Q,
|
|
727
|
-
B
|
|
739
|
+
B,
|
|
740
|
+
y.phylogenyViewerUrl
|
|
728
741
|
]), m(() => {
|
|
729
742
|
Q();
|
|
730
743
|
}, [Q]);
|
|
731
|
-
let
|
|
744
|
+
let ye = p((e) => {
|
|
732
745
|
let t = e.currentTarget;
|
|
733
746
|
z.next({
|
|
734
747
|
scrollLeft: t.scrollLeft,
|
|
735
748
|
scrollTop: t.scrollTop
|
|
736
749
|
});
|
|
737
|
-
}, [z]),
|
|
738
|
-
|
|
750
|
+
}, [z]), be = p((e) => {
|
|
751
|
+
I.current?.focus();
|
|
739
752
|
let t = e.currentTarget, n = t.getBoundingClientRect(), r = e.clientX >= n.left + t.clientWidth, i = e.clientY >= n.top + t.clientHeight;
|
|
740
753
|
if (r || i) return;
|
|
741
|
-
let a =
|
|
754
|
+
let a = M.current, s = N.current, l = C.resolve(O).data;
|
|
742
755
|
if (!a || !s) return;
|
|
743
|
-
let u =
|
|
756
|
+
let u = c.getPathPropertiesFromCanvas({
|
|
744
757
|
canvas: a,
|
|
745
|
-
devicePixelRatio:
|
|
758
|
+
devicePixelRatio: l,
|
|
746
759
|
editorAssembly: s,
|
|
747
760
|
event: e.nativeEvent
|
|
748
761
|
});
|
|
@@ -750,26 +763,26 @@ var ie = () => {
|
|
|
750
763
|
if (u.type !== o.DIVIDER) {
|
|
751
764
|
if (u.type === o.LABEL && (e.metaKey || e.ctrlKey)) {
|
|
752
765
|
let t = G.data?.rows ?? [], n = t.includes(u.row) ? t.filter((e) => e !== u.row) : [...t, u.row].sort((e, t) => e - t);
|
|
753
|
-
if (e.preventDefault(),
|
|
766
|
+
if (e.preventDefault(), F.current = null, n.length === 0) {
|
|
754
767
|
G.next(null), K.current = null;
|
|
755
768
|
return;
|
|
756
769
|
}
|
|
757
770
|
G.next({ rows: n }), K.current = { rows: n };
|
|
758
771
|
return;
|
|
759
772
|
}
|
|
760
|
-
let t =
|
|
773
|
+
let t = c.getSelectionFromPathProperties({
|
|
761
774
|
endPath: u,
|
|
762
775
|
startPath: u
|
|
763
776
|
});
|
|
764
777
|
if (!t) return;
|
|
765
|
-
e.preventDefault(),
|
|
766
|
-
} else e.preventDefault(),
|
|
778
|
+
e.preventDefault(), F.current = u, G.next(t), K.current = t;
|
|
779
|
+
} else e.preventDefault(), F.current = null, P.current = {
|
|
767
780
|
startLabelWidth: W.data.labelWidth,
|
|
768
781
|
startX: e.clientX
|
|
769
782
|
};
|
|
770
783
|
}
|
|
771
|
-
}, [W, G]),
|
|
772
|
-
let t =
|
|
784
|
+
}, [W, G]), xe = p((e) => {
|
|
785
|
+
let t = M.current, n = I.current, r = C.resolve(O).data, i = P.current;
|
|
773
786
|
if (!n || !t) return;
|
|
774
787
|
if (i) {
|
|
775
788
|
let t = Math.min($, Math.max(120, i.startLabelWidth + e.clientX - i.startX));
|
|
@@ -779,47 +792,47 @@ var ie = () => {
|
|
|
779
792
|
}), n.style.cursor = "col-resize";
|
|
780
793
|
return;
|
|
781
794
|
}
|
|
782
|
-
let a =
|
|
795
|
+
let a = F.current;
|
|
783
796
|
if (a) {
|
|
784
|
-
let n =
|
|
797
|
+
let n = N.current;
|
|
785
798
|
if (!n) return;
|
|
786
|
-
let i =
|
|
799
|
+
let i = c.getPathPropertiesFromCanvas({
|
|
787
800
|
canvas: t,
|
|
788
801
|
devicePixelRatio: r,
|
|
789
802
|
editorAssembly: n,
|
|
790
803
|
event: e.nativeEvent
|
|
791
804
|
});
|
|
792
805
|
if (!i) return;
|
|
793
|
-
let o =
|
|
806
|
+
let o = c.getSelectionFromPathProperties({
|
|
794
807
|
endPath: i,
|
|
795
808
|
startPath: a
|
|
796
809
|
});
|
|
797
810
|
o && (G.next(o), K.current = o);
|
|
798
811
|
return;
|
|
799
812
|
}
|
|
800
|
-
let s =
|
|
813
|
+
let s = N.current;
|
|
801
814
|
if (!s) return;
|
|
802
|
-
let
|
|
815
|
+
let l = c.getPathPropertiesFromCanvas({
|
|
803
816
|
canvas: t,
|
|
804
817
|
devicePixelRatio: r,
|
|
805
818
|
editorAssembly: s,
|
|
806
819
|
event: e.nativeEvent
|
|
807
820
|
});
|
|
808
|
-
|
|
821
|
+
l && l.type === o.DIVIDER ? n.style.cursor = "col-resize" : n.style.cursor = "default";
|
|
809
822
|
}, [
|
|
810
823
|
W,
|
|
811
824
|
$,
|
|
812
825
|
G
|
|
813
|
-
]),
|
|
814
|
-
|
|
815
|
-
}, []),
|
|
816
|
-
|
|
826
|
+
]), Se = p(() => {
|
|
827
|
+
P.current = null, F.current = null;
|
|
828
|
+
}, []), Ce = p((e, t) => {
|
|
829
|
+
c.scrollToPosition({
|
|
817
830
|
geometry: W.data,
|
|
818
|
-
scrollContainer:
|
|
831
|
+
scrollContainer: L.current,
|
|
819
832
|
x: e,
|
|
820
833
|
y: t
|
|
821
834
|
});
|
|
822
|
-
}, [W]),
|
|
835
|
+
}, [W]), we = Math.max(1, Math.floor(R.width * fe)), Te = Math.max(1, Math.floor(R.height * fe));
|
|
823
836
|
return /* @__PURE__ */ T(v, {
|
|
824
837
|
sx: {
|
|
825
838
|
display: "grid",
|
|
@@ -831,8 +844,8 @@ var ie = () => {
|
|
|
831
844
|
children: [
|
|
832
845
|
/* @__PURE__ */ w(d, {}),
|
|
833
846
|
/* @__PURE__ */ T(v, {
|
|
834
|
-
onMouseUp:
|
|
835
|
-
ref:
|
|
847
|
+
onMouseUp: Se,
|
|
848
|
+
ref: I,
|
|
836
849
|
sx: {
|
|
837
850
|
height: `calc(100% - ${Y.spacing(3)})`,
|
|
838
851
|
marginBottom: Y.spacing(3),
|
|
@@ -842,10 +855,10 @@ var ie = () => {
|
|
|
842
855
|
tabIndex: 0,
|
|
843
856
|
children: [
|
|
844
857
|
/* @__PURE__ */ w(v, {
|
|
845
|
-
onMouseDown:
|
|
846
|
-
onMouseMove:
|
|
847
|
-
onScroll:
|
|
848
|
-
ref:
|
|
858
|
+
onMouseDown: be,
|
|
859
|
+
onMouseMove: xe,
|
|
860
|
+
onScroll: ye,
|
|
861
|
+
ref: L,
|
|
849
862
|
sx: {
|
|
850
863
|
height: "100%",
|
|
851
864
|
overflowX: "scroll",
|
|
@@ -860,20 +873,20 @@ var ie = () => {
|
|
|
860
873
|
})
|
|
861
874
|
}),
|
|
862
875
|
/* @__PURE__ */ w("canvas", {
|
|
863
|
-
height:
|
|
864
|
-
ref:
|
|
876
|
+
height: Te,
|
|
877
|
+
ref: M,
|
|
865
878
|
style: {
|
|
866
879
|
display: "block",
|
|
867
|
-
height: `${
|
|
880
|
+
height: `${R.height}px`,
|
|
868
881
|
imageRendering: "pixelated",
|
|
869
882
|
left: 0,
|
|
870
883
|
pointerEvents: "auto",
|
|
871
884
|
position: "absolute",
|
|
872
885
|
top: 0,
|
|
873
|
-
width: `${
|
|
886
|
+
width: `${R.width}px`,
|
|
874
887
|
zIndex: 0
|
|
875
888
|
},
|
|
876
|
-
width:
|
|
889
|
+
width: we
|
|
877
890
|
}),
|
|
878
891
|
/* @__PURE__ */ w(v, {
|
|
879
892
|
sx: {
|
|
@@ -884,16 +897,16 @@ var ie = () => {
|
|
|
884
897
|
width: "100%",
|
|
885
898
|
zIndex: 2
|
|
886
899
|
},
|
|
887
|
-
children: /* @__PURE__ */ w(
|
|
900
|
+
children: /* @__PURE__ */ w(ae, {})
|
|
888
901
|
})
|
|
889
902
|
]
|
|
890
903
|
}),
|
|
891
904
|
/* @__PURE__ */ w(oe, {
|
|
892
|
-
onGotoPosition:
|
|
893
|
-
ref:
|
|
905
|
+
onGotoPosition: Ce,
|
|
906
|
+
ref: ce
|
|
894
907
|
}),
|
|
895
|
-
/* @__PURE__ */ w(f, { ref:
|
|
896
|
-
/* @__PURE__ */ w(
|
|
908
|
+
/* @__PURE__ */ w(f, { ref: le }),
|
|
909
|
+
/* @__PURE__ */ w(ne, { ref: se })
|
|
897
910
|
]
|
|
898
911
|
});
|
|
899
912
|
};
|