@rivm-loculus-tools/sequence-editor 0.1.3 → 0.1.5

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 (144) hide show
  1. package/dist/_chunks/Box.js +6737 -0
  2. package/dist/_chunks/Box.js.map +1 -0
  3. package/dist/_chunks/Close.js +7 -0
  4. package/dist/_chunks/Close.js.map +1 -0
  5. package/dist/_chunks/EditorWorkerService.js +126 -0
  6. package/dist/_chunks/EditorWorkerService.js.map +1 -0
  7. package/dist/_chunks/KeyboardArrowDown.js +1023 -0
  8. package/dist/_chunks/KeyboardArrowDown.js.map +1 -0
  9. package/dist/_chunks/Redo.js +2559 -0
  10. package/dist/_chunks/Redo.js.map +1 -0
  11. package/dist/_chunks/SequenceEditor.js +860 -0
  12. package/dist/_chunks/SequenceEditor.js.map +1 -0
  13. package/dist/_chunks/SequenceEditorEventBusService.js +102 -0
  14. package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -0
  15. package/dist/_chunks/SequenceEditorMainPage.js +552 -0
  16. package/dist/_chunks/SequenceEditorMainPage.js.map +1 -0
  17. package/dist/_chunks/SequenceEditorPageDrawer.js +49842 -0
  18. package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -0
  19. package/dist/_chunks/SequenceEditorPageHeader.js +236 -0
  20. package/dist/_chunks/SequenceEditorPageHeader.js.map +1 -0
  21. package/dist/_chunks/SequenceEditorSearchBar.js +143 -0
  22. package/dist/_chunks/SequenceEditorSearchBar.js.map +1 -0
  23. package/dist/_chunks/TestIdUtil.js +4695 -0
  24. package/dist/_chunks/TestIdUtil.js.map +1 -0
  25. package/dist/_chunks/TextField.js +3083 -0
  26. package/dist/_chunks/TextField.js.map +1 -0
  27. package/dist/_chunks/rolldown-runtime.js +13 -0
  28. package/dist/_chunks/sequenceEditorStore.js +407 -0
  29. package/dist/_chunks/sequenceEditorStore.js.map +1 -0
  30. package/dist/_chunks/sequence_editor.js +517 -0
  31. package/dist/_chunks/sequence_editor.js.map +1 -0
  32. package/dist/_chunks/withDialog.js +289 -0
  33. package/dist/_chunks/withDialog.js.map +1 -0
  34. package/dist/assets/index-C5rc-pJV.js +8 -0
  35. package/dist/assets/index-C5rc-pJV.js.map +1 -0
  36. package/dist/classes/services/EditorWorkerService/EditorWorkerService.d.ts +27 -0
  37. package/dist/classes/services/EditorWorkerService/index.js +2 -0
  38. package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +25 -0
  39. package/dist/classes/services/SequenceEditorEventBusService/index.js +2 -0
  40. package/dist/classes/workers/EngineWorker/EngineWorker.d.ts +46 -0
  41. package/dist/classes/workers/EngineWorker/index.js +110 -0
  42. package/dist/classes/workers/EngineWorker/index.js.map +1 -0
  43. package/dist/components/app/App/App.d.ts +1 -0
  44. package/dist/components/app/App/index.js +957 -0
  45. package/dist/components/app/App/index.js.map +1 -0
  46. package/dist/components/pages/EmptyWorkspace.d.ts +3 -0
  47. package/dist/components/pages/SequenceEditorErrorPage/SequenceEditorErrorPage.d.ts +3 -0
  48. package/dist/components/pages/SequenceEditorErrorPage/index.js +12 -0
  49. package/dist/components/pages/SequenceEditorErrorPage/index.js.map +1 -0
  50. package/dist/components/pages/SequenceEditorMainPage/SequenceEditorMainPage.d.ts +1 -0
  51. package/dist/components/pages/SequenceEditorMainPage/index.js +2 -0
  52. package/dist/components/ui/SequenceEditor/SequenceEditor.d.ts +1 -0
  53. package/dist/components/ui/SequenceEditor/SequenceEditorGotoPositionDialog.d.ts +8 -0
  54. package/dist/components/ui/SequenceEditor/SequenceEditorStatusBar.d.ts +1 -0
  55. package/dist/components/ui/SequenceEditor/index.js +2 -0
  56. package/dist/components/ui/SequenceEditorPage/SequenceEditorPage.d.ts +5 -0
  57. package/dist/components/ui/SequenceEditorPage/index.js +15 -0
  58. package/dist/components/ui/SequenceEditorPage/index.js.map +1 -0
  59. package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawer.d.ts +1 -0
  60. package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerColorForm.d.ts +7 -0
  61. package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerKeyboardShortcuts.d.ts +1 -0
  62. package/dist/components/ui/SequenceEditorPageDrawer/index.js +2 -0
  63. package/dist/components/ui/SequenceEditorPageHeader/SequenceEditorPageHeader.d.ts +1 -0
  64. package/dist/components/ui/SequenceEditorPageHeader/index.js +2 -0
  65. package/dist/components/ui/SequenceEditorSearchBar/SequenceEditorSearchBar.d.ts +1 -0
  66. package/dist/components/ui/SequenceEditorSearchBar/index.js +2 -0
  67. package/dist/constants/editor.d.ts +4 -0
  68. package/dist/constants/editor.js +14 -0
  69. package/dist/constants/editor.js.map +1 -0
  70. package/dist/constants/index.js +4 -0
  71. package/dist/constants/keyboard.d.ts +10 -0
  72. package/dist/constants/keyboard.js +179 -0
  73. package/dist/constants/keyboard.js.map +1 -0
  74. package/dist/constants/palette.d.ts +15 -0
  75. package/dist/constants/palette.js +196 -0
  76. package/dist/constants/palette.js.map +1 -0
  77. package/dist/models/editor.d.ts +6 -0
  78. package/dist/models/editor.js +8 -0
  79. package/dist/models/editor.js.map +1 -0
  80. package/dist/models/model.d.ts +250 -0
  81. package/dist/models/model.js +10 -0
  82. package/dist/models/model.js.map +1 -0
  83. package/dist/models/palette.d.ts +61 -0
  84. package/dist/models/palette.js +10 -0
  85. package/dist/models/palette.js.map +1 -0
  86. package/dist/stores/sequenceEditorStore/index.js +2 -0
  87. package/dist/stores/sequenceEditorStore/sequenceEditorStore.d.ts +36 -0
  88. package/dist/utils/EditorUtil/EditorUtil.d.ts +96 -0
  89. package/dist/utils/EditorUtil/index.js +544 -0
  90. package/dist/utils/EditorUtil/index.js.map +1 -0
  91. package/dist/utils/EngineErrorUtil/EngineErrorUtil.d.ts +4 -0
  92. package/dist/utils/PaletteUtil/PaletteUtil.d.ts +6 -0
  93. package/dist/utils/PaletteUtil/index.js +19 -0
  94. package/dist/utils/PaletteUtil/index.js.map +1 -0
  95. package/package.json +6 -3
  96. package/.gitkeep +0 -0
  97. package/CHANGELOG.md +0 -30
  98. package/eslint.config.js +0 -16
  99. package/scripts/update-exports.js +0 -9
  100. package/src/classes/services/EditorWorkerService/EditorWorkerService.ts +0 -163
  101. package/src/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.ts +0 -37
  102. package/src/classes/workers/EngineWorker/EngineWorker.ts +0 -196
  103. package/src/components/app/App/App.tsx +0 -22
  104. package/src/components/pages/EmptyWorkspace.tsx +0 -43
  105. package/src/components/pages/SequenceEditorErrorPage/SequenceEditorErrorPage.tsx +0 -16
  106. package/src/components/pages/SequenceEditorMainPage/SequenceEditorMainPage.tsx +0 -76
  107. package/src/components/ui/SequenceEditor/SequenceEditor.tsx +0 -896
  108. package/src/components/ui/SequenceEditor/SequenceEditorGotoPositionDialog.tsx +0 -108
  109. package/src/components/ui/SequenceEditor/SequenceEditorStatusBar.tsx +0 -72
  110. package/src/components/ui/SequenceEditorPage/SequenceEditorPage.tsx +0 -23
  111. package/src/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawer.tsx +0 -234
  112. package/src/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerColorForm.tsx +0 -73
  113. package/src/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerKeyboardShortcuts.tsx +0 -230
  114. package/src/components/ui/SequenceEditorPageHeader/SequenceEditorPageHeader.tsx +0 -71
  115. package/src/components/ui/SequenceEditorSearchBar/SequenceEditorSearchBar.tsx +0 -35
  116. package/src/constants/editor.ts +0 -15
  117. package/src/constants/keyboard.ts +0 -154
  118. package/src/constants/palette.ts +0 -227
  119. package/src/models/editor.ts +0 -6
  120. package/src/models/model.ts +0 -295
  121. package/src/models/palette.ts +0 -68
  122. package/src/stores/sequenceEditorStore/sequenceEditorStore.ts +0 -103
  123. package/src/utils/EditorUtil/EditorUtil.ts +0 -892
  124. package/src/utils/EngineErrorUtil/EngineErrorUtil.ts +0 -25
  125. package/src/utils/PaletteUtil/PaletteUtil.ts +0 -31
  126. package/tsconfig.build.json +0 -14
  127. package/tsconfig.json +0 -32
  128. package/vite.config.ts +0 -177
  129. /package/{src/classes/services/EditorWorkerService/index.ts → dist/classes/services/EditorWorkerService/index.d.ts} +0 -0
  130. /package/{src/classes/services/SequenceEditorEventBusService/index.ts → dist/classes/services/SequenceEditorEventBusService/index.d.ts} +0 -0
  131. /package/{src/classes/workers/EngineWorker/index.ts → dist/classes/workers/EngineWorker/index.d.ts} +0 -0
  132. /package/{src/components/app/App/index.ts → dist/components/app/App/index.d.ts} +0 -0
  133. /package/{src/components/pages/SequenceEditorErrorPage/index.ts → dist/components/pages/SequenceEditorErrorPage/index.d.ts} +0 -0
  134. /package/{src/components/pages/SequenceEditorMainPage/index.ts → dist/components/pages/SequenceEditorMainPage/index.d.ts} +0 -0
  135. /package/{src/components/ui/SequenceEditor/index.ts → dist/components/ui/SequenceEditor/index.d.ts} +0 -0
  136. /package/{src/components/ui/SequenceEditorPage/index.ts → dist/components/ui/SequenceEditorPage/index.d.ts} +0 -0
  137. /package/{src/components/ui/SequenceEditorPageDrawer/index.ts → dist/components/ui/SequenceEditorPageDrawer/index.d.ts} +0 -0
  138. /package/{src/components/ui/SequenceEditorPageHeader/index.ts → dist/components/ui/SequenceEditorPageHeader/index.d.ts} +0 -0
  139. /package/{src/components/ui/SequenceEditorSearchBar/index.ts → dist/components/ui/SequenceEditorSearchBar/index.d.ts} +0 -0
  140. /package/{src/constants/index.ts → dist/constants/index.d.ts} +0 -0
  141. /package/{src/models/index.ts → dist/models/index.d.ts} +0 -0
  142. /package/{src/stores/sequenceEditorStore/index.ts → dist/stores/sequenceEditorStore/index.d.ts} +0 -0
  143. /package/{src/utils/EditorUtil/index.ts → dist/utils/EditorUtil/index.d.ts} +0 -0
  144. /package/{src/utils/PaletteUtil/index.ts → dist/utils/PaletteUtil/index.d.ts} +0 -0
@@ -1,230 +0,0 @@
1
- import {
2
- Box,
3
- ListItemButton,
4
- ListItemText,
5
- Typography,
6
- } from '@mui/material';
7
- import {
8
- KeyboardArrowDown,
9
- KeyboardArrowLeft,
10
- KeyboardArrowRight,
11
- KeyboardArrowUp,
12
- KeyboardCommandKey,
13
- KeyboardControlKey,
14
- KeyboardOptionKey,
15
- SpaceBar,
16
- } from '@mui/icons-material';
17
- import type { SvgIconProps } from '@mui/material/SvgIcon';
18
- import type {
19
- ComponentType,
20
- MouseEvent as ReactMouseEvent,
21
- } from 'react';
22
- import type { KeyboardModifier } from '@gen-epix/ui-core/classes/services/KeyboardShortcutService';
23
-
24
- import { KEYBOARD_SHORTCUTS } from '../../../constants';
25
-
26
- type ShortcutKey = {
27
- icon?: ComponentType<SvgIconProps>;
28
- label: string;
29
- };
30
-
31
- const MODIFIER_LABELS = new Map<KeyboardModifier, string>([
32
- ['Alt', 'Alt'],
33
- ['AltGraph', 'AltGr'],
34
- ['Control', 'Ctrl'],
35
- ['Meta', 'Cmd'],
36
- ['Shift', 'Shift'],
37
- ]);
38
-
39
- const MODIFIER_ICONS = new Map<KeyboardModifier, ComponentType<SvgIconProps>>([
40
- ['Alt', KeyboardOptionKey],
41
- ['Control', KeyboardControlKey],
42
- ['Meta', KeyboardCommandKey],
43
- ]);
44
-
45
- const CODE_KEYS = new Map<string, ShortcutKey>([
46
- ['ArrowDown', { icon: KeyboardArrowDown, label: 'Arrow down' }],
47
- ['ArrowLeft', { icon: KeyboardArrowLeft, label: 'Arrow left' }],
48
- ['ArrowRight', { icon: KeyboardArrowRight, label: 'Arrow right' }],
49
- ['ArrowUp', { icon: KeyboardArrowUp, label: 'Arrow up' }],
50
- ['Backspace', { label: 'Backspace' }],
51
- ['Delete', { label: 'Delete' }],
52
- ['End', { label: 'End' }],
53
- ['Home', { label: 'Home' }],
54
- ['PageDown', { label: 'Page down' }],
55
- ['PageUp', { label: 'Page up' }],
56
- ['Space', { icon: SpaceBar, label: 'Space' }],
57
- ]);
58
-
59
- type Shortcut = typeof KEYBOARD_SHORTCUTS[string];
60
-
61
- type ShortcutGroup = {
62
- name: string;
63
- shortcuts: Shortcut[];
64
- };
65
-
66
- const isMacOs = typeof navigator !== 'undefined' && /Mac|iPhone|iPad|iPod/.test(navigator.platform);
67
-
68
- const SHORTCUT_GROUPS: ShortcutGroup[] = [
69
- {
70
- name: 'Selection',
71
- shortcuts: [
72
- KEYBOARD_SHORTCUTS.moveSelectionLeft,
73
- KEYBOARD_SHORTCUTS.moveSelectionRight,
74
- KEYBOARD_SHORTCUTS.moveSelectionUp,
75
- KEYBOARD_SHORTCUTS.moveSelectionDown,
76
- KEYBOARD_SHORTCUTS.expandSelectionLeft,
77
- KEYBOARD_SHORTCUTS.expandSelectionRight,
78
- KEYBOARD_SHORTCUTS.expandSelectionUp,
79
- KEYBOARD_SHORTCUTS.expandSelectionDown,
80
- KEYBOARD_SHORTCUTS.moveCellLeft,
81
- KEYBOARD_SHORTCUTS.moveCellRight,
82
- ],
83
- },
84
- {
85
- name: 'Rows',
86
- shortcuts: [
87
- KEYBOARD_SHORTCUTS.moveRowUp,
88
- KEYBOARD_SHORTCUTS.moveRowDown,
89
- KEYBOARD_SHORTCUTS.moveRowToStart,
90
- KEYBOARD_SHORTCUTS.moveRowToEnd,
91
- ],
92
- },
93
- {
94
- name: 'Navigation',
95
- shortcuts: [
96
- KEYBOARD_SHORTCUTS.scrollToLineStart,
97
- KEYBOARD_SHORTCUTS.scrollToLineEnd,
98
- KEYBOARD_SHORTCUTS.scrollPageUp,
99
- KEYBOARD_SHORTCUTS.scrollPageDown,
100
- KEYBOARD_SHORTCUTS.gotoPosition,
101
- ],
102
- },
103
- {
104
- name: 'Editing',
105
- shortcuts: [
106
- KEYBOARD_SHORTCUTS.insertGap,
107
- KEYBOARD_SHORTCUTS.deleteBackward,
108
- KEYBOARD_SHORTCUTS.deleteSelection,
109
- KEYBOARD_SHORTCUTS.deleteBase,
110
- KEYBOARD_SHORTCUTS.undo,
111
- KEYBOARD_SHORTCUTS.redo,
112
- ],
113
- },
114
- ];
115
-
116
- const getActiveModifierGroup = (modifierGroups: KeyboardModifier[][]): KeyboardModifier[] => {
117
- const preferredModifier = isMacOs ? 'Meta' : 'Control';
118
- return modifierGroups.find((modifierGroup) => modifierGroup.includes(preferredModifier)) ?? modifierGroups[0] ?? [];
119
- };
120
-
121
- const getShortcutKeys = (shortcut: Shortcut): ShortcutKey[] => {
122
- const { code, key, modifiers = [] } = shortcut.shortcut;
123
- const keyLabel = code ? (CODE_KEYS.get(code) ?? { label: code }) : { label: key?.toUpperCase() ?? '' };
124
- const modifierGroup = getActiveModifierGroup(modifiers);
125
- return [
126
- ...modifierGroup.map((modifier) => ({
127
- icon: MODIFIER_ICONS.get(modifier),
128
- label: isMacOs && modifier === 'Alt' ? 'Option' : MODIFIER_LABELS.get(modifier) ?? modifier,
129
- })),
130
- keyLabel,
131
- ];
132
- };
133
-
134
- const renderShortcutKeys = (shortcut: Shortcut) => {
135
- const keyGroups = getShortcutKeys(shortcut);
136
-
137
- return (
138
- <Box
139
- aria-label={keyGroups.map(({ label }) => label).join(' ')}
140
- sx={{ alignItems: 'center', display: 'flex', flexShrink: 0, gap: 0.5 }}
141
- >
142
- <Box sx={{ alignItems: 'center', display: 'flex', gap: 0.5 }}>
143
- {keyGroups.map((keyItem) => {
144
- const KeyIcon = keyItem.icon;
145
- return (
146
- <Box
147
- aria-label={keyItem.label}
148
- component={'kbd'}
149
- key={keyItem.label}
150
- sx={{
151
- alignItems: 'center',
152
- backgroundColor: 'action.hover',
153
- border: '1px solid',
154
- borderColor: 'divider',
155
- borderRadius: 0.75,
156
- boxShadow: '0 1px 0 rgba(0, 0, 0, 0.2)',
157
- color: 'text.primary',
158
- display: 'flex',
159
- fontFamily: 'monospace',
160
- fontSize: '0.7rem',
161
- justifyContent: 'center',
162
- lineHeight: 1,
163
- minWidth: keyItem.label.length === 1 ? 24 : 'auto',
164
- px: 0.75,
165
- py: 0.5,
166
- textAlign: 'center',
167
- }}
168
- >
169
- {KeyIcon ? (
170
- <KeyIcon
171
- aria-hidden
172
- fontSize={'inherit'}
173
- />
174
- ) : keyItem.label}
175
- </Box>
176
- );
177
- })}
178
- </Box>
179
- </Box>
180
- );
181
- };
182
-
183
- const onClickShortcut = (event: ReactMouseEvent<HTMLElement>) => {
184
- const shortcut = Object.values(KEYBOARD_SHORTCUTS).find(({ description }) => description === event.currentTarget.dataset.shortcut);
185
- if (!shortcut) {
186
- return;
187
- }
188
-
189
- const { code, key, modifiers = [] } = shortcut.shortcut;
190
- const activeModifiers = getActiveModifierGroup(modifiers);
191
- shortcut.callback(new KeyboardEvent('keydown', {
192
- altKey: activeModifiers.includes('Alt'),
193
- code: code ?? '',
194
- ctrlKey: activeModifiers.includes('Control'),
195
- key: key ?? code ?? '',
196
- metaKey: activeModifiers.includes('Meta'),
197
- shiftKey: activeModifiers.includes('Shift'),
198
- }));
199
- };
200
-
201
- export const SequenceEditorPageDrawerKeyboardShortcuts = () => (
202
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2, px: 2, py: 2.5 }}>
203
- {SHORTCUT_GROUPS.map((group) => (
204
- <Box key={group.name}>
205
- <Typography
206
- sx={{ color: 'text.secondary', fontWeight: 700, mb: 0.5, textTransform: 'uppercase' }}
207
- variant={'caption'}
208
- >
209
- {group.name}
210
- </Typography>
211
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 0.5 }}>
212
- {group.shortcuts.map((shortcut) => (
213
- <ListItemButton
214
- data-shortcut={shortcut.description}
215
- key={shortcut.description}
216
- onClick={onClickShortcut}
217
- sx={{ borderRadius: 1, gap: 1, justifyContent: 'space-between', px: 1, py: 0.75 }}
218
- >
219
- <ListItemText
220
- primary={shortcut.description}
221
- sx={{ '& .MuiListItemText-primary': { typography: 'body2' } }}
222
- />
223
- {renderShortcutKeys(shortcut)}
224
- </ListItemButton>
225
- ))}
226
- </Box>
227
- </Box>
228
- ))}
229
- </Box>
230
- );
@@ -1,71 +0,0 @@
1
- import { FastaPageHeaderCenterComponent } from '@rivm-loculus-tools/common-frontend/components/FastaPageHeaderCenterComponent';
2
- import { FastaPageHeaderImportButton } from '@rivm-loculus-tools/common-frontend/components/FastaPageHeaderImportButton';
3
- import { FastaPageHeaderResetButton } from '@rivm-loculus-tools/common-frontend/components/FastaPageHeaderResetButton';
4
- import { PageCommonHeader } from '@rivm-loculus-tools/common-frontend/components/page';
5
- import { PageHeaderDocumentationButton } from '@rivm-loculus-tools/common-frontend/components/PageHeaderDocumentationButton';
6
- import { useCallback } from 'react';
7
- import { useStore } from 'zustand';
8
- import BiotechOutlinedIcon from '@mui/icons-material/BiotechOutlined';
9
- import UndoIcon from '@mui/icons-material/Undo';
10
- import RedoIcon from '@mui/icons-material/Redo';
11
- import {
12
- IconButton,
13
- Tooltip,
14
- } from '@mui/material';
15
-
16
- import { sequenceEditorStore } from '../../../stores/sequenceEditorStore';
17
- import { SequenceEditorEventBusService } from '../../../classes/services/SequenceEditorEventBusService';
18
-
19
- export const SequenceEditorPageHeader = () => {
20
- const resetDataset = useStore(sequenceEditorStore, (state) => state.resetDataset);
21
- const meta = useStore(sequenceEditorStore, (state) => state.meta);
22
-
23
- const onReset = useCallback(() => {
24
- resetDataset();
25
- }, [resetDataset]);
26
-
27
- const onUndoButtonClick = useCallback(() => {
28
- SequenceEditorEventBusService.getInstance().emit('onUndo');
29
- }, []);
30
-
31
- const onRedoButtonClick = useCallback(() => {
32
- SequenceEditorEventBusService.getInstance().emit('onRedo');
33
- }, []);
34
-
35
- return (
36
- <PageCommonHeader
37
- centerComponent={<FastaPageHeaderCenterComponent store={sequenceEditorStore} />}
38
- icon={<BiotechOutlinedIcon sx={{ fontSize: 24 }} />}
39
- rightComponent={(
40
- <>
41
- <FastaPageHeaderImportButton />
42
- <Tooltip title={'Undo last action'}>
43
- <IconButton
44
- color={'inherit'}
45
- disabled={meta?.undoDepth === 0}
46
- onClick={onUndoButtonClick}
47
- size={'small'}
48
- sx={{ opacity: 0.85 }}
49
- >
50
- <UndoIcon fontSize={'small'} />
51
- </IconButton>
52
- </Tooltip>
53
- <Tooltip title={'Redo last action'}>
54
- <IconButton
55
- color={'inherit'}
56
- disabled={meta?.redoDepth === 0}
57
- onClick={onRedoButtonClick}
58
- size={'small'}
59
- sx={{ opacity: 0.85 }}
60
- >
61
- <RedoIcon fontSize={'small'} />
62
- </IconButton>
63
- </Tooltip>
64
- <FastaPageHeaderResetButton onReset={onReset} />
65
- <PageHeaderDocumentationButton />
66
- </>
67
- )}
68
- title={'Sequence Editor'}
69
- />
70
- );
71
- };
@@ -1,35 +0,0 @@
1
- import { SearchBar } from '@rivm-loculus-tools/common-frontend/components/SearchBar';
2
- import { useCallback } from 'react';
3
- import { useStore } from 'zustand';
4
-
5
- import { sequenceEditorStore } from '../../../stores/sequenceEditorStore';
6
- import { SequenceEditorEventBusService } from '../../../classes/services/SequenceEditorEventBusService';
7
-
8
- export const SequenceEditorSearchBar = () => {
9
- const setSearchQuery = useStore(sequenceEditorStore, (state) => state.setSearchQuery);
10
- const setSearchHighlightedIndex = useStore(sequenceEditorStore, (state) => state.setSearchResultHighlightedIndex);
11
- const searchQuery = useStore(sequenceEditorStore, (state) => state.searchQuery);
12
- const searchResults = useStore(sequenceEditorStore, (state) => state.searchResult);
13
- const searchHighlightedIndex = useStore(sequenceEditorStore, (state) => state.searchResultHighlightedIndex);
14
-
15
- const onSearchQueryChange = useCallback((query: string) => {
16
- setSearchQuery(query);
17
- SequenceEditorEventBusService.getInstance().emit('onSearch', query);
18
- }, [setSearchQuery]);
19
-
20
- const onHighlightedIndexChange = useCallback((index: number) => {
21
- setSearchHighlightedIndex(index);
22
- }, [setSearchHighlightedIndex]);
23
-
24
- return (
25
- <SearchBar
26
- allowNavigation
27
- highlightedIndex={searchHighlightedIndex}
28
- numResults={searchResults?.num_matches}
29
- onHighlightedIndexChange={onHighlightedIndexChange}
30
- onSearchQueryChange={onSearchQueryChange}
31
- searchQuery={searchQuery}
32
- truncated={searchResults?.truncated}
33
- />
34
- );
35
- };
@@ -1,15 +0,0 @@
1
- import type { GridGeometry } from '../models';
2
-
3
- export const MIN_LABEL_WIDTH = 120;
4
-
5
- export const DEFAULT_GRID_GEOMETRY: GridGeometry = {
6
- cellHeight: 22,
7
- cellWidth: 18,
8
- dividerWidth: 4,
9
- labelWidth: 300,
10
- numOverscanCols: 128,
11
- numOverscanRows: 16,
12
- rulerHeight: 26,
13
- };
14
-
15
- export const IUPAC_KEYS = new Set('ACGTURYKMSWBDHVN');
@@ -1,154 +0,0 @@
1
- import type { KeyboardShortcutConfig } from '@gen-epix/ui-core/classes/services/KeyboardShortcutService';
2
-
3
- import { SequenceEditorEventBusService } from '../classes/services/SequenceEditorEventBusService';
4
- import { EDITOR_DIRECTION } from '../models/editor';
5
-
6
-
7
- type KeyboardShortcut = {
8
- callback: KeyboardShortcutConfig['callback'];
9
- description: string;
10
- shortcut: Pick<KeyboardShortcutConfig, 'code' | 'key' | 'modifiers'>;
11
- };
12
-
13
- const emitDirection = (eventName: 'onExpandSelection' | 'onMoveCells' | 'onMoveRows' | 'onMoveRowsEnd' | 'onMoveSelection', direction: EDITOR_DIRECTION): KeyboardShortcutConfig['callback'] => (event) => {
14
- event.preventDefault();
15
- SequenceEditorEventBusService.getInstance().emit(eventName, direction);
16
- };
17
-
18
- const emitVoid = (eventName: 'onDeleteBackward' | 'onGotoPosition' | 'onInsert' | 'onRedo' | 'onScrollPageDown' | 'onScrollPageUp' | 'onScrollToLineEnd' | 'onScrollToLineStart' | 'onUndo'): KeyboardShortcutConfig['callback'] => (event) => {
19
- event.preventDefault();
20
- SequenceEditorEventBusService.getInstance().emit(eventName);
21
- };
22
-
23
- const emitMutateSelection = (base: string): KeyboardShortcutConfig['callback'] => (event) => {
24
- event.preventDefault();
25
- SequenceEditorEventBusService.getInstance().emit('onMutateSelection', base);
26
- };
27
-
28
- export const KEYBOARD_SHORTCUTS: { [key: string]: KeyboardShortcut } = {
29
- deleteBackward: {
30
- callback: emitVoid('onDeleteBackward'),
31
- description: 'Delete backward',
32
- shortcut: { code: 'Backspace' },
33
- },
34
- deleteBase: {
35
- callback: emitMutateSelection('-'),
36
- description: 'Delete base',
37
- shortcut: { key: '-' },
38
- },
39
- deleteSelection: {
40
- callback: emitMutateSelection('-'),
41
- description: 'Delete selection',
42
- shortcut: { code: 'Delete' },
43
- },
44
- expandSelectionDown: {
45
- callback: emitDirection('onExpandSelection', EDITOR_DIRECTION.DOWN),
46
- description: 'Expand selection down',
47
- shortcut: { code: 'ArrowDown', modifiers: [['Shift']] },
48
- },
49
- expandSelectionLeft: {
50
- callback: emitDirection('onExpandSelection', EDITOR_DIRECTION.LEFT),
51
- description: 'Expand selection left',
52
- shortcut: { code: 'ArrowLeft', modifiers: [['Shift']] },
53
- },
54
- expandSelectionRight: {
55
- callback: emitDirection('onExpandSelection', EDITOR_DIRECTION.RIGHT),
56
- description: 'Expand selection right',
57
- shortcut: { code: 'ArrowRight', modifiers: [['Shift']] },
58
- },
59
- expandSelectionUp: {
60
- callback: emitDirection('onExpandSelection', EDITOR_DIRECTION.UP),
61
- description: 'Expand selection up',
62
- shortcut: { code: 'ArrowUp', modifiers: [['Shift']] },
63
- },
64
- gotoPosition: {
65
- callback: emitVoid('onGotoPosition'),
66
- description: 'Go to position',
67
- shortcut: { key: 'g', modifiers: [['Meta'], ['Control']] },
68
- },
69
- insertGap: {
70
- callback: emitVoid('onInsert'),
71
- description: 'Insert gap',
72
- shortcut: { code: 'Space' },
73
- },
74
- moveCellLeft: {
75
- callback: emitDirection('onMoveCells', EDITOR_DIRECTION.LEFT),
76
- description: 'Move cell left',
77
- shortcut: { code: 'ArrowLeft', modifiers: [['Alt']] },
78
- },
79
- moveCellRight: {
80
- callback: emitDirection('onMoveCells', EDITOR_DIRECTION.RIGHT),
81
- description: 'Move cell right',
82
- shortcut: { code: 'ArrowRight', modifiers: [['Alt']] },
83
- },
84
- moveRowDown: {
85
- callback: emitDirection('onMoveRows', EDITOR_DIRECTION.DOWN),
86
- description: 'Move row down',
87
- shortcut: { code: 'ArrowDown', modifiers: [['Control'], ['Meta']] },
88
- },
89
- moveRowToEnd: {
90
- callback: emitDirection('onMoveRowsEnd', EDITOR_DIRECTION.DOWN),
91
- description: 'Move row to end',
92
- shortcut: { code: 'ArrowDown', modifiers: [['Alt']] },
93
- },
94
- moveRowToStart: {
95
- callback: emitDirection('onMoveRowsEnd', EDITOR_DIRECTION.UP),
96
- description: 'Move row to start',
97
- shortcut: { code: 'ArrowUp', modifiers: [['Alt']] },
98
- },
99
- moveRowUp: {
100
- callback: emitDirection('onMoveRows', EDITOR_DIRECTION.UP),
101
- description: 'Move row up',
102
- shortcut: { code: 'ArrowUp', modifiers: [['Control'], ['Meta']] },
103
- },
104
- moveSelectionDown: {
105
- callback: emitDirection('onMoveSelection', EDITOR_DIRECTION.DOWN),
106
- description: 'Move selection down',
107
- shortcut: { code: 'ArrowDown' },
108
- },
109
- moveSelectionLeft: {
110
- callback: emitDirection('onMoveSelection', EDITOR_DIRECTION.LEFT),
111
- description: 'Move selection left',
112
- shortcut: { code: 'ArrowLeft' },
113
- },
114
- moveSelectionRight: {
115
- callback: emitDirection('onMoveSelection', EDITOR_DIRECTION.RIGHT),
116
- description: 'Move selection right',
117
- shortcut: { code: 'ArrowRight' },
118
- },
119
- moveSelectionUp: {
120
- callback: emitDirection('onMoveSelection', EDITOR_DIRECTION.UP),
121
- description: 'Move selection up',
122
- shortcut: { code: 'ArrowUp' },
123
- },
124
- redo: {
125
- callback: emitVoid('onRedo'),
126
- description: 'Redo',
127
- shortcut: { key: 'z', modifiers: [['Meta', 'Shift'], ['Control', 'Shift']] },
128
- },
129
- scrollPageDown: {
130
- callback: emitVoid('onScrollPageDown'),
131
- description: 'Scroll page down',
132
- shortcut: { code: 'PageDown' },
133
- },
134
- scrollPageUp: {
135
- callback: emitVoid('onScrollPageUp'),
136
- description: 'Scroll page up',
137
- shortcut: { code: 'PageUp' },
138
- },
139
- scrollToLineEnd: {
140
- callback: emitVoid('onScrollToLineEnd'),
141
- description: 'Scroll to line end',
142
- shortcut: { code: 'End' },
143
- },
144
- scrollToLineStart: {
145
- callback: emitVoid('onScrollToLineStart'),
146
- description: 'Scroll to line start',
147
- shortcut: { code: 'Home' },
148
- },
149
- undo: {
150
- callback: emitVoid('onUndo'),
151
- description: 'Undo',
152
- shortcut: { key: 'z', modifiers: [['Meta'], ['Control']] },
153
- },
154
- };