@rivm-loculus-tools/sequence-editor 1.7.0 → 1.8.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/SequenceEditor.js +138 -120
- package/dist/_chunks/SequenceEditor.js.map +1 -1
- package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -1
- package/dist/_chunks/SequenceEditorPageDrawer.js +97 -96
- package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -1
- package/dist/_chunks/SequenceEditorPageHeader.js +120 -0
- package/dist/_chunks/SequenceEditorPageHeader.js.map +1 -0
- package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +1 -0
- package/dist/components/app/SequenceEditorApp/index.js +4 -1
- package/dist/components/app/SequenceEditorApp/index.js.map +1 -1
- package/dist/components/ui/SequenceEditorPageHeader/SequenceEditorUndoRedoButtons.d.ts +1 -0
- package/dist/components/ui/SequenceEditorPageHeader/index.js +1 -109
- package/dist/components/ui/SequenceEditorRealignModal/index.js +2 -2
- package/dist/components/ui/SequenceEditorRealignModal/index.js.map +1 -1
- package/dist/constants/index.js +5 -4
- package/dist/constants/keyboard.js +2 -2
- package/dist/constants/keyboard.js.map +1 -1
- package/dist/constants/palette.d.ts +1 -2
- package/dist/constants/palette.js +162 -204
- package/dist/constants/palette.js.map +1 -1
- package/dist/constants/paletteSchemaData.d.ts +4 -0
- package/dist/constants/paletteSchemaData.js +48 -0
- package/dist/constants/paletteSchemaData.js.map +1 -0
- package/dist/pages/SequenceEditorMainPage/index.js +1 -0
- package/dist/pages/SequenceEditorMainPage/index.js.map +1 -1
- package/dist/utils/EditorUtil/index.js +83 -83
- package/dist/utils/EditorUtil/index.js.map +1 -1
- package/dist/utils/SequenceEditorStandardConfigUtil/index.js +1 -1
- package/dist/vite/paletteSchemaPlugin/index.d.ts +1 -1
- package/dist/vite/paletteSchemaPlugin/index.js +1 -1
- package/dist/vite/paletteSchemaPlugin/index.js.map +1 -1
- package/package.json +6 -2
- package/dist/components/ui/SequenceEditorPageHeader/index.js.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { PALETTE_SCHEMA_URL_PATH as e } from "../constants/paletteSchemaData.js";
|
|
2
|
+
import { t } from "./sequenceEditorStore.js";
|
|
3
|
+
import { t as n } from "./react.js";
|
|
4
|
+
import { KEYBOARD_SHORTCUTS as r } from "../constants/keyboard.js";
|
|
5
|
+
import { CUSTOM_PALETTE_NAME as i } from "../models/palette.models.js";
|
|
6
|
+
import { HEX_COLOR_REGEX as a, PaletteUtil as o } from "../utils/PaletteUtil/index.js";
|
|
7
|
+
import { ALI_VIEW_CLUSTAL_X_AMINO_ACID_PALETTE as s, ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE as c, ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE as l, ALI_VIEW_FAST_NUCLEOTIDE_PALETTE as u, ALI_VIEW_SEA_VIEW_AMINO_ACID_PALETTE as d, ALI_VIEW_SEA_VIEW_NUCLEOTIDE_PALETTE as f, AMINO_ACID_SYMBOLS as p, AMINO_ACID_SYMBOL_LABELS as m, NUCLEOTIDE_SYMBOLS as h, NUCLEOTIDE_SYMBOL_LABELS as g } from "../constants/palette.js";
|
|
7
8
|
import "../constants/index.js";
|
|
8
9
|
import _, { useCallback as v, useEffect as y, useId as b, useMemo as x, useRef as S, useState as C } from "react";
|
|
9
10
|
import { Accordion as w, AccordionDetails as T, AccordionSummary as E, Alert as D, Box as O, Button as k, ListItemButton as A, ListItemText as j, Typography as M } from "@mui/material";
|
|
@@ -1118,68 +1119,68 @@ var dt = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
|
|
|
1118
1119
|
backgroundSelected: "Selected background",
|
|
1119
1120
|
foreground: "Text",
|
|
1120
1121
|
foregroundSelected: "Selected text"
|
|
1121
|
-
}, ht = ({ currentPalette:
|
|
1122
|
-
let
|
|
1123
|
-
let t = e === "Custom" ?
|
|
1124
|
-
t &&
|
|
1122
|
+
}, ht = ({ currentPalette: t, customPalette: n, exportFileName: r, label: o, onPaletteChange: s, palettes: c, parsePalette: l, symbolLabels: u, symbols: d }) => {
|
|
1123
|
+
let f = b(), p = S(null), [m, h] = C(null), g = v((e) => {
|
|
1124
|
+
let t = e === "Custom" ? n : c.find((t) => t.name === e);
|
|
1125
|
+
t && s(t);
|
|
1125
1126
|
}, [
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
]), _ = x(() => [...
|
|
1127
|
+
n,
|
|
1128
|
+
s,
|
|
1129
|
+
c
|
|
1130
|
+
]), _ = x(() => [...c.map((e) => ({
|
|
1130
1131
|
label: e.name,
|
|
1131
1132
|
value: e.name
|
|
1132
1133
|
})), {
|
|
1133
|
-
label:
|
|
1134
|
-
value:
|
|
1135
|
-
}], [
|
|
1134
|
+
label: i,
|
|
1135
|
+
value: i
|
|
1136
|
+
}], [c]), y = x(() => [{
|
|
1136
1137
|
definition: F.RADIO_GROUP,
|
|
1137
|
-
label:
|
|
1138
|
+
label: o,
|
|
1138
1139
|
name: "palette",
|
|
1139
1140
|
onChange: g,
|
|
1140
1141
|
options: _,
|
|
1141
1142
|
required: !0
|
|
1142
1143
|
}], [
|
|
1143
|
-
|
|
1144
|
+
o,
|
|
1144
1145
|
g,
|
|
1145
1146
|
_
|
|
1146
|
-
]), w = x(() => ({ palette:
|
|
1147
|
-
|
|
1148
|
-
...
|
|
1147
|
+
]), w = x(() => ({ palette: t.name }), [t.name]), T = I({ values: w }), { handleSubmit: E } = T, A = v((e) => {}, []), j = v((e, t, r) => {
|
|
1148
|
+
a.test(r) && s({
|
|
1149
|
+
...n,
|
|
1149
1150
|
paletteColors: {
|
|
1150
|
-
...
|
|
1151
|
+
...n.paletteColors,
|
|
1151
1152
|
[e]: {
|
|
1152
|
-
...
|
|
1153
|
-
[
|
|
1153
|
+
...n.paletteColors[e],
|
|
1154
|
+
[t]: r
|
|
1154
1155
|
}
|
|
1155
1156
|
}
|
|
1156
1157
|
});
|
|
1157
|
-
}, [
|
|
1158
|
-
let
|
|
1159
|
-
if (
|
|
1160
|
-
|
|
1161
|
-
...
|
|
1162
|
-
name:
|
|
1158
|
+
}, [n, s]), N = v(async (e) => {
|
|
1159
|
+
let t = e.currentTarget, n = t.files?.[0];
|
|
1160
|
+
if (t.value = "", n) try {
|
|
1161
|
+
s({
|
|
1162
|
+
...l(JSON.parse(await n.text())),
|
|
1163
|
+
name: i
|
|
1163
1164
|
}), h(null);
|
|
1164
1165
|
} catch (e) {
|
|
1165
1166
|
let t = e instanceof Error ? e.message : "Unexpected error while reading the file.";
|
|
1166
1167
|
h(`Could not import palette: ${t}`);
|
|
1167
1168
|
}
|
|
1168
|
-
}, [
|
|
1169
|
-
let
|
|
1170
|
-
...
|
|
1171
|
-
$schema:
|
|
1172
|
-
},
|
|
1173
|
-
ae.createDownloadUrl(
|
|
1174
|
-
}, [
|
|
1175
|
-
|
|
1169
|
+
}, [s, l]), ee = v(() => {
|
|
1170
|
+
let n = {
|
|
1171
|
+
...t,
|
|
1172
|
+
$schema: ie.getBaseURLWithPath() + e
|
|
1173
|
+
}, i = new Blob([JSON.stringify(n, null, 2)], { type: "application/json" }), a = URL.createObjectURL(i);
|
|
1174
|
+
ae.createDownloadUrl(a, r), URL.revokeObjectURL(a);
|
|
1175
|
+
}, [t, r]), te = v(() => {
|
|
1176
|
+
p.current?.click();
|
|
1176
1177
|
}, []);
|
|
1177
1178
|
return /* @__PURE__ */ z(O, {
|
|
1178
1179
|
sx: { "& + &": { mt: 2 } },
|
|
1179
1180
|
children: [
|
|
1180
1181
|
/* @__PURE__ */ R(P, {
|
|
1181
1182
|
formFieldDefinitions: y,
|
|
1182
|
-
formId:
|
|
1183
|
+
formId: f,
|
|
1183
1184
|
formMethods: T,
|
|
1184
1185
|
onSubmit: E(A)
|
|
1185
1186
|
}),
|
|
@@ -1204,9 +1205,9 @@ var dt = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
|
|
|
1204
1205
|
}),
|
|
1205
1206
|
/* @__PURE__ */ R("input", {
|
|
1206
1207
|
accept: ".json,application/json",
|
|
1207
|
-
"aria-label": `Import ${
|
|
1208
|
+
"aria-label": `Import ${o} JSON`,
|
|
1208
1209
|
onChange: N,
|
|
1209
|
-
ref:
|
|
1210
|
+
ref: p,
|
|
1210
1211
|
style: { display: "none" },
|
|
1211
1212
|
type: "file"
|
|
1212
1213
|
})
|
|
@@ -1217,15 +1218,15 @@ var dt = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
|
|
|
1217
1218
|
sx: { mt: 1 },
|
|
1218
1219
|
children: m
|
|
1219
1220
|
}),
|
|
1220
|
-
|
|
1221
|
+
t.name === "Custom" && /* @__PURE__ */ R(O, {
|
|
1221
1222
|
sx: {
|
|
1222
1223
|
display: "flex",
|
|
1223
1224
|
flexDirection: "column",
|
|
1224
1225
|
gap: 1,
|
|
1225
1226
|
mt: 2
|
|
1226
1227
|
},
|
|
1227
|
-
children:
|
|
1228
|
-
let t = String(e),
|
|
1228
|
+
children: d.map((e) => {
|
|
1229
|
+
let t = String(e), r = `${u[e]} (${t})`, i = n.paletteColors[e];
|
|
1229
1230
|
return /* @__PURE__ */ z(O, {
|
|
1230
1231
|
sx: {
|
|
1231
1232
|
borderBottom: "1px solid",
|
|
@@ -1238,7 +1239,7 @@ var dt = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
|
|
|
1238
1239
|
mb: 1
|
|
1239
1240
|
},
|
|
1240
1241
|
variant: "body2",
|
|
1241
|
-
children:
|
|
1242
|
+
children: r
|
|
1242
1243
|
}), /* @__PURE__ */ R(O, {
|
|
1243
1244
|
sx: {
|
|
1244
1245
|
display: "grid",
|
|
@@ -1247,7 +1248,7 @@ var dt = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
|
|
|
1247
1248
|
},
|
|
1248
1249
|
children: pt.map((t) => /* @__PURE__ */ R(ft, {
|
|
1249
1250
|
field: t,
|
|
1250
|
-
label: `${
|
|
1251
|
+
label: `${r} ${mt[t]}`,
|
|
1251
1252
|
onColorChange: j,
|
|
1252
1253
|
symbol: e,
|
|
1253
1254
|
value: i[t]
|
|
@@ -1295,50 +1296,50 @@ var dt = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
|
|
|
1295
1296
|
icon: ye,
|
|
1296
1297
|
label: "Space"
|
|
1297
1298
|
}]
|
|
1298
|
-
]), yt = typeof navigator < "u" &&
|
|
1299
|
+
]), yt = typeof navigator < "u" && /^(Mac|iPhone|iPad|iPod)/.test(navigator.userAgentData?.platform ?? navigator.platform), bt = [
|
|
1299
1300
|
{
|
|
1300
1301
|
name: "Selection",
|
|
1301
1302
|
shortcuts: [
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1303
|
+
r.moveSelectionLeft,
|
|
1304
|
+
r.moveSelectionRight,
|
|
1305
|
+
r.moveSelectionUp,
|
|
1306
|
+
r.moveSelectionDown,
|
|
1307
|
+
r.expandSelectionLeft,
|
|
1308
|
+
r.expandSelectionRight,
|
|
1309
|
+
r.expandSelectionUp,
|
|
1310
|
+
r.expandSelectionDown,
|
|
1311
|
+
r.moveCellLeft,
|
|
1312
|
+
r.moveCellRight
|
|
1312
1313
|
]
|
|
1313
1314
|
},
|
|
1314
1315
|
{
|
|
1315
1316
|
name: "Rows",
|
|
1316
1317
|
shortcuts: [
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1318
|
+
r.moveRowUp,
|
|
1319
|
+
r.moveRowDown,
|
|
1320
|
+
r.moveRowToStart,
|
|
1321
|
+
r.moveRowToEnd
|
|
1321
1322
|
]
|
|
1322
1323
|
},
|
|
1323
1324
|
{
|
|
1324
1325
|
name: "Navigation",
|
|
1325
1326
|
shortcuts: [
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1327
|
+
r.scrollToLineStart,
|
|
1328
|
+
r.scrollToLineEnd,
|
|
1329
|
+
r.scrollPageUp,
|
|
1330
|
+
r.scrollPageDown,
|
|
1331
|
+
r.gotoPosition
|
|
1331
1332
|
]
|
|
1332
1333
|
},
|
|
1333
1334
|
{
|
|
1334
1335
|
name: "Editing",
|
|
1335
1336
|
shortcuts: [
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1337
|
+
r.insertGap,
|
|
1338
|
+
r.deleteBackward,
|
|
1339
|
+
r.deleteSelection,
|
|
1340
|
+
r.deleteBase,
|
|
1341
|
+
r.undo,
|
|
1342
|
+
r.redo
|
|
1342
1343
|
]
|
|
1343
1344
|
}
|
|
1344
1345
|
], xt = (e) => {
|
|
@@ -1398,16 +1399,16 @@ var dt = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
|
|
|
1398
1399
|
})
|
|
1399
1400
|
});
|
|
1400
1401
|
}, wt = (e) => {
|
|
1401
|
-
let t = Object.values(
|
|
1402
|
+
let t = Object.values(r).find(({ description: t }) => t === e.currentTarget.dataset.shortcut);
|
|
1402
1403
|
if (!t) return;
|
|
1403
|
-
let { code: n, key:
|
|
1404
|
+
let { code: n, key: i, modifiers: a = [] } = t.shortcut, o = xt(a);
|
|
1404
1405
|
t.callback(new KeyboardEvent("keydown", {
|
|
1405
|
-
altKey:
|
|
1406
|
+
altKey: o.includes("Alt"),
|
|
1406
1407
|
code: n ?? "",
|
|
1407
|
-
ctrlKey:
|
|
1408
|
-
key:
|
|
1409
|
-
metaKey:
|
|
1410
|
-
shiftKey:
|
|
1408
|
+
ctrlKey: o.includes("Control"),
|
|
1409
|
+
key: i ?? n ?? "",
|
|
1410
|
+
metaKey: o.includes("Meta"),
|
|
1411
|
+
shiftKey: o.includes("Shift")
|
|
1411
1412
|
}));
|
|
1412
1413
|
}, Tt = () => /* @__PURE__ */ R(O, {
|
|
1413
1414
|
sx: {
|
|
@@ -1449,7 +1450,7 @@ var dt = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
|
|
|
1449
1450
|
}, e.description))
|
|
1450
1451
|
})] }, e.name))
|
|
1451
1452
|
}), Et = () => {
|
|
1452
|
-
let e =
|
|
1453
|
+
let e = n(t, (e) => e.parsedMetadata), r = n(t, (e) => e.aminoAcidPalette), i = n(t, (e) => e.customAminoAcidPalette), a = n(t, (e) => e.customNucleotidePalette), _ = n(t, (e) => e.nucleotidePalette), b = n(t, (e) => e.setAminoAcidPalette), S = n(t, (e) => e.setCustomAminoAcidPalette), D = n(t, (e) => e.setCustomNucleotidePalette), k = n(t, (e) => e.setNucleotidePalette), A = n(t, (e) => e.meta), [j, P] = C([]), F = v((e) => {
|
|
1453
1454
|
P((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
1454
1455
|
}, []), I = v((e) => {
|
|
1455
1456
|
P((t) => t.filter((t) => t !== e));
|
|
@@ -1462,13 +1463,13 @@ var dt = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
|
|
|
1462
1463
|
}, [D, k]), ce = v((e) => {
|
|
1463
1464
|
b(e), e.name === "Custom" && S(e);
|
|
1464
1465
|
}, [b, S]), le = x(() => [
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1466
|
+
l,
|
|
1467
|
+
u,
|
|
1468
|
+
f
|
|
1468
1469
|
], []), B = x(() => [
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1470
|
+
c,
|
|
1471
|
+
d,
|
|
1472
|
+
s
|
|
1472
1473
|
], []);
|
|
1473
1474
|
return /* @__PURE__ */ z(re, { children: [/* @__PURE__ */ R(O, {
|
|
1474
1475
|
sx: {
|
|
@@ -1556,24 +1557,24 @@ var dt = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
|
|
|
1556
1557
|
},
|
|
1557
1558
|
children: [/* @__PURE__ */ R(ht, {
|
|
1558
1559
|
currentPalette: _,
|
|
1559
|
-
customPalette:
|
|
1560
|
+
customPalette: a,
|
|
1560
1561
|
exportFileName: "nucleotide-palette.json",
|
|
1561
1562
|
label: "Nucleotide colors",
|
|
1562
1563
|
onPaletteChange: L,
|
|
1563
1564
|
palettes: le,
|
|
1564
|
-
parsePalette:
|
|
1565
|
-
symbolLabels:
|
|
1566
|
-
symbols:
|
|
1565
|
+
parsePalette: o.parseNucleotidePalette,
|
|
1566
|
+
symbolLabels: g,
|
|
1567
|
+
symbols: h
|
|
1567
1568
|
}), /* @__PURE__ */ R(ht, {
|
|
1568
|
-
currentPalette:
|
|
1569
|
-
customPalette:
|
|
1569
|
+
currentPalette: r,
|
|
1570
|
+
customPalette: i,
|
|
1570
1571
|
exportFileName: "amino-acid-palette.json",
|
|
1571
1572
|
label: "Amino-acid colors",
|
|
1572
1573
|
onPaletteChange: ce,
|
|
1573
1574
|
palettes: B,
|
|
1574
|
-
parsePalette:
|
|
1575
|
-
symbolLabels:
|
|
1576
|
-
symbols:
|
|
1575
|
+
parsePalette: o.parseAminoAcidPalette,
|
|
1576
|
+
symbolLabels: m,
|
|
1577
|
+
symbols: p
|
|
1577
1578
|
})]
|
|
1578
1579
|
})]
|
|
1579
1580
|
}),
|