@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.
- package/dist/_chunks/Box.js +6737 -0
- package/dist/_chunks/Box.js.map +1 -0
- package/dist/_chunks/Close.js +7 -0
- package/dist/_chunks/Close.js.map +1 -0
- package/dist/_chunks/EditorWorkerService.js +126 -0
- package/dist/_chunks/EditorWorkerService.js.map +1 -0
- package/dist/_chunks/KeyboardArrowDown.js +1023 -0
- package/dist/_chunks/KeyboardArrowDown.js.map +1 -0
- package/dist/_chunks/Redo.js +2559 -0
- package/dist/_chunks/Redo.js.map +1 -0
- package/dist/_chunks/SequenceEditor.js +860 -0
- package/dist/_chunks/SequenceEditor.js.map +1 -0
- package/dist/_chunks/SequenceEditorEventBusService.js +102 -0
- package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -0
- package/dist/_chunks/SequenceEditorMainPage.js +552 -0
- package/dist/_chunks/SequenceEditorMainPage.js.map +1 -0
- package/dist/_chunks/SequenceEditorPageDrawer.js +49842 -0
- package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -0
- package/dist/_chunks/SequenceEditorPageHeader.js +236 -0
- package/dist/_chunks/SequenceEditorPageHeader.js.map +1 -0
- package/dist/_chunks/SequenceEditorSearchBar.js +143 -0
- package/dist/_chunks/SequenceEditorSearchBar.js.map +1 -0
- package/dist/_chunks/TestIdUtil.js +4695 -0
- package/dist/_chunks/TestIdUtil.js.map +1 -0
- package/dist/_chunks/TextField.js +3083 -0
- package/dist/_chunks/TextField.js.map +1 -0
- package/dist/_chunks/rolldown-runtime.js +13 -0
- package/dist/_chunks/sequenceEditorStore.js +407 -0
- package/dist/_chunks/sequenceEditorStore.js.map +1 -0
- package/dist/_chunks/sequence_editor.js +517 -0
- package/dist/_chunks/sequence_editor.js.map +1 -0
- package/dist/_chunks/withDialog.js +289 -0
- package/dist/_chunks/withDialog.js.map +1 -0
- package/dist/assets/index-C5rc-pJV.js +8 -0
- package/dist/assets/index-C5rc-pJV.js.map +1 -0
- package/dist/classes/services/EditorWorkerService/EditorWorkerService.d.ts +27 -0
- package/dist/classes/services/EditorWorkerService/index.js +2 -0
- package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +25 -0
- package/dist/classes/services/SequenceEditorEventBusService/index.js +2 -0
- package/dist/classes/workers/EngineWorker/EngineWorker.d.ts +46 -0
- package/dist/classes/workers/EngineWorker/index.js +110 -0
- package/dist/classes/workers/EngineWorker/index.js.map +1 -0
- package/dist/components/app/App/App.d.ts +1 -0
- package/dist/components/app/App/index.js +957 -0
- package/dist/components/app/App/index.js.map +1 -0
- package/dist/components/pages/EmptyWorkspace.d.ts +3 -0
- package/dist/components/pages/SequenceEditorErrorPage/SequenceEditorErrorPage.d.ts +3 -0
- package/dist/components/pages/SequenceEditorErrorPage/index.js +12 -0
- package/dist/components/pages/SequenceEditorErrorPage/index.js.map +1 -0
- package/dist/components/pages/SequenceEditorMainPage/SequenceEditorMainPage.d.ts +1 -0
- package/dist/components/pages/SequenceEditorMainPage/index.js +2 -0
- package/dist/components/ui/SequenceEditor/SequenceEditor.d.ts +1 -0
- package/dist/components/ui/SequenceEditor/SequenceEditorGotoPositionDialog.d.ts +8 -0
- package/dist/components/ui/SequenceEditor/SequenceEditorStatusBar.d.ts +1 -0
- package/dist/components/ui/SequenceEditor/index.js +2 -0
- package/dist/components/ui/SequenceEditorPage/SequenceEditorPage.d.ts +5 -0
- package/dist/components/ui/SequenceEditorPage/index.js +15 -0
- package/dist/components/ui/SequenceEditorPage/index.js.map +1 -0
- package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawer.d.ts +1 -0
- package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerColorForm.d.ts +7 -0
- package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerKeyboardShortcuts.d.ts +1 -0
- package/dist/components/ui/SequenceEditorPageDrawer/index.js +2 -0
- package/dist/components/ui/SequenceEditorPageHeader/SequenceEditorPageHeader.d.ts +1 -0
- package/dist/components/ui/SequenceEditorPageHeader/index.js +2 -0
- package/dist/components/ui/SequenceEditorSearchBar/SequenceEditorSearchBar.d.ts +1 -0
- package/dist/components/ui/SequenceEditorSearchBar/index.js +2 -0
- package/dist/constants/editor.d.ts +4 -0
- package/dist/constants/editor.js +14 -0
- package/dist/constants/editor.js.map +1 -0
- package/dist/constants/index.js +4 -0
- package/dist/constants/keyboard.d.ts +10 -0
- package/dist/constants/keyboard.js +179 -0
- package/dist/constants/keyboard.js.map +1 -0
- package/dist/constants/palette.d.ts +15 -0
- package/dist/constants/palette.js +196 -0
- package/dist/constants/palette.js.map +1 -0
- package/dist/models/editor.d.ts +6 -0
- package/dist/models/editor.js +8 -0
- package/dist/models/editor.js.map +1 -0
- package/dist/models/model.d.ts +250 -0
- package/dist/models/model.js +10 -0
- package/dist/models/model.js.map +1 -0
- package/dist/models/palette.d.ts +61 -0
- package/dist/models/palette.js +10 -0
- package/dist/models/palette.js.map +1 -0
- package/dist/stores/sequenceEditorStore/index.js +2 -0
- package/dist/stores/sequenceEditorStore/sequenceEditorStore.d.ts +36 -0
- package/dist/utils/EditorUtil/EditorUtil.d.ts +96 -0
- package/dist/utils/EditorUtil/index.js +544 -0
- package/dist/utils/EditorUtil/index.js.map +1 -0
- package/dist/utils/EngineErrorUtil/EngineErrorUtil.d.ts +4 -0
- package/dist/utils/PaletteUtil/PaletteUtil.d.ts +6 -0
- package/dist/utils/PaletteUtil/index.js +19 -0
- package/dist/utils/PaletteUtil/index.js.map +1 -0
- package/package.json +6 -3
- package/.gitkeep +0 -0
- package/CHANGELOG.md +0 -30
- package/eslint.config.js +0 -16
- package/scripts/update-exports.js +0 -9
- package/src/classes/services/EditorWorkerService/EditorWorkerService.ts +0 -163
- package/src/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.ts +0 -37
- package/src/classes/workers/EngineWorker/EngineWorker.ts +0 -196
- package/src/components/app/App/App.tsx +0 -22
- package/src/components/pages/EmptyWorkspace.tsx +0 -43
- package/src/components/pages/SequenceEditorErrorPage/SequenceEditorErrorPage.tsx +0 -16
- package/src/components/pages/SequenceEditorMainPage/SequenceEditorMainPage.tsx +0 -76
- package/src/components/ui/SequenceEditor/SequenceEditor.tsx +0 -896
- package/src/components/ui/SequenceEditor/SequenceEditorGotoPositionDialog.tsx +0 -108
- package/src/components/ui/SequenceEditor/SequenceEditorStatusBar.tsx +0 -72
- package/src/components/ui/SequenceEditorPage/SequenceEditorPage.tsx +0 -23
- package/src/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawer.tsx +0 -234
- package/src/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerColorForm.tsx +0 -73
- package/src/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerKeyboardShortcuts.tsx +0 -230
- package/src/components/ui/SequenceEditorPageHeader/SequenceEditorPageHeader.tsx +0 -71
- package/src/components/ui/SequenceEditorSearchBar/SequenceEditorSearchBar.tsx +0 -35
- package/src/constants/editor.ts +0 -15
- package/src/constants/keyboard.ts +0 -154
- package/src/constants/palette.ts +0 -227
- package/src/models/editor.ts +0 -6
- package/src/models/model.ts +0 -295
- package/src/models/palette.ts +0 -68
- package/src/stores/sequenceEditorStore/sequenceEditorStore.ts +0 -103
- package/src/utils/EditorUtil/EditorUtil.ts +0 -892
- package/src/utils/EngineErrorUtil/EngineErrorUtil.ts +0 -25
- package/src/utils/PaletteUtil/PaletteUtil.ts +0 -31
- package/tsconfig.build.json +0 -14
- package/tsconfig.json +0 -32
- package/vite.config.ts +0 -177
- /package/{src/classes/services/EditorWorkerService/index.ts → dist/classes/services/EditorWorkerService/index.d.ts} +0 -0
- /package/{src/classes/services/SequenceEditorEventBusService/index.ts → dist/classes/services/SequenceEditorEventBusService/index.d.ts} +0 -0
- /package/{src/classes/workers/EngineWorker/index.ts → dist/classes/workers/EngineWorker/index.d.ts} +0 -0
- /package/{src/components/app/App/index.ts → dist/components/app/App/index.d.ts} +0 -0
- /package/{src/components/pages/SequenceEditorErrorPage/index.ts → dist/components/pages/SequenceEditorErrorPage/index.d.ts} +0 -0
- /package/{src/components/pages/SequenceEditorMainPage/index.ts → dist/components/pages/SequenceEditorMainPage/index.d.ts} +0 -0
- /package/{src/components/ui/SequenceEditor/index.ts → dist/components/ui/SequenceEditor/index.d.ts} +0 -0
- /package/{src/components/ui/SequenceEditorPage/index.ts → dist/components/ui/SequenceEditorPage/index.d.ts} +0 -0
- /package/{src/components/ui/SequenceEditorPageDrawer/index.ts → dist/components/ui/SequenceEditorPageDrawer/index.d.ts} +0 -0
- /package/{src/components/ui/SequenceEditorPageHeader/index.ts → dist/components/ui/SequenceEditorPageHeader/index.d.ts} +0 -0
- /package/{src/components/ui/SequenceEditorSearchBar/index.ts → dist/components/ui/SequenceEditorSearchBar/index.d.ts} +0 -0
- /package/{src/constants/index.ts → dist/constants/index.d.ts} +0 -0
- /package/{src/models/index.ts → dist/models/index.d.ts} +0 -0
- /package/{src/stores/sequenceEditorStore/index.ts → dist/stores/sequenceEditorStore/index.d.ts} +0 -0
- /package/{src/utils/EditorUtil/index.ts → dist/utils/EditorUtil/index.d.ts} +0 -0
- /package/{src/utils/PaletteUtil/index.ts → dist/utils/PaletteUtil/index.d.ts} +0 -0
|
@@ -0,0 +1,860 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime.js";
|
|
2
|
+
import { EDITOR_DIRECTION as t } from "../models/editor.js";
|
|
3
|
+
import { EDITOR_PATH_PROPERTIES_TYPE as n } from "../models/model.js";
|
|
4
|
+
import { DEFAULT_GRID_GEOMETRY as r, IUPAC_KEYS as i } from "../constants/editor.js";
|
|
5
|
+
import { n as a, t as o } from "./SequenceEditorEventBusService.js";
|
|
6
|
+
import { KEYBOARD_SHORTCUTS as s } from "../constants/keyboard.js";
|
|
7
|
+
import "../constants/index.js";
|
|
8
|
+
import { EditorUtil as c } from "../utils/EditorUtil/index.js";
|
|
9
|
+
import { t as l } from "./sequenceEditorStore.js";
|
|
10
|
+
import { Dt as u, It as d, Lt as f, P as p, nt as m, t as h } from "./Box.js";
|
|
11
|
+
import { t as g } from "./TextField.js";
|
|
12
|
+
import { t as _ } from "./withDialog.js";
|
|
13
|
+
import { t as v } from "./SequenceEditorSearchBar.js";
|
|
14
|
+
import { t as y } from "./EditorWorkerService.js";
|
|
15
|
+
//#region ../../../../node_modules/.pnpm/@gen-epix+ui-core@3.8.1_react@19.3.0/node_modules/@gen-epix/ui-core/dist/classes/Subject/index.js
|
|
16
|
+
var b = /* @__PURE__ */ e(f()), x = class {
|
|
17
|
+
data;
|
|
18
|
+
subscriptions = [];
|
|
19
|
+
constructor(e) {
|
|
20
|
+
this.data = e;
|
|
21
|
+
}
|
|
22
|
+
next(e) {
|
|
23
|
+
let t = this.data;
|
|
24
|
+
this.data = e, this.subscriptions.forEach((n) => {
|
|
25
|
+
n(e, t);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
subscribe(e) {
|
|
29
|
+
return this.subscriptions.push(e), () => {
|
|
30
|
+
this.subscriptions = this.subscriptions.filter((t) => t !== e);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region ../../../../node_modules/.pnpm/use-debounce@10.1.1_react@19.3.0/node_modules/use-debounce/dist/index.module.js
|
|
36
|
+
function S(e, t, n, r) {
|
|
37
|
+
var i = this, a = (0, b.useRef)(null), o = (0, b.useRef)(0), s = (0, b.useRef)(0), c = (0, b.useRef)(null), l = (0, b.useRef)([]), u = (0, b.useRef)(), d = (0, b.useRef)(), f = (0, b.useRef)(e), p = (0, b.useRef)(!0), m = (0, b.useRef)(), h = (0, b.useRef)();
|
|
38
|
+
f.current = e;
|
|
39
|
+
var g = typeof window < "u", _ = !t && t !== 0 && g;
|
|
40
|
+
if (typeof e != "function") throw TypeError("Expected a function");
|
|
41
|
+
t = +t || 0;
|
|
42
|
+
var v = !!(n ||= {}).leading, y = !("trailing" in n) || !!n.trailing, x = !!n.flushOnExit && y, S = "maxWait" in n, C = "debounceOnServer" in n && !!n.debounceOnServer, w = S ? Math.max(+n.maxWait || 0, t) : null, T = (0, b.useMemo)(function() {
|
|
43
|
+
var e = function(e) {
|
|
44
|
+
var t = l.current, n = u.current;
|
|
45
|
+
return l.current = u.current = null, o.current = e, s.current = s.current || e, d.current = f.current.apply(n, t);
|
|
46
|
+
}, n = function(e, t) {
|
|
47
|
+
_ && cancelAnimationFrame(c.current), c.current = _ ? requestAnimationFrame(e) : setTimeout(e, t);
|
|
48
|
+
}, b = function(e) {
|
|
49
|
+
if (!p.current) return !1;
|
|
50
|
+
var n = e - a.current;
|
|
51
|
+
return !a.current || n >= t || n < 0 || S && e - o.current >= w;
|
|
52
|
+
}, T = function(t) {
|
|
53
|
+
return c.current = null, y && l.current ? e(t) : (l.current = u.current = null, d.current);
|
|
54
|
+
}, E = function e() {
|
|
55
|
+
var r = Date.now();
|
|
56
|
+
if (v && s.current === o.current && D(), b(r)) return T(r);
|
|
57
|
+
if (p.current) {
|
|
58
|
+
var i = t - (r - a.current);
|
|
59
|
+
n(e, S ? Math.min(i, w - (r - o.current)) : i);
|
|
60
|
+
}
|
|
61
|
+
}, D = function() {
|
|
62
|
+
r && r({});
|
|
63
|
+
}, O = function() {
|
|
64
|
+
if (g || C) {
|
|
65
|
+
var r, s = Date.now(), f = b(s);
|
|
66
|
+
if (l.current = [].slice.call(arguments), u.current = i, a.current = s, x && !m.current && (m.current = function() {
|
|
67
|
+
globalThis.document?.visibilityState === "hidden" && h.current.flush();
|
|
68
|
+
}, (r = globalThis.document) == null || r.addEventListener == null || r.addEventListener("visibilitychange", m.current)), f) {
|
|
69
|
+
if (!c.current && p.current) return o.current = a.current, n(E, t), v ? e(a.current) : d.current;
|
|
70
|
+
if (S) return n(E, t), e(a.current);
|
|
71
|
+
}
|
|
72
|
+
return c.current || n(E, t), d.current;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return O.cancel = function() {
|
|
76
|
+
var e = c.current;
|
|
77
|
+
e && (_ ? cancelAnimationFrame(c.current) : clearTimeout(c.current)), o.current = 0, l.current = a.current = u.current = c.current = null, e && r && r({});
|
|
78
|
+
}, O.isPending = function() {
|
|
79
|
+
return !!c.current;
|
|
80
|
+
}, O.flush = function() {
|
|
81
|
+
return c.current ? T(Date.now()) : d.current;
|
|
82
|
+
}, O;
|
|
83
|
+
}, [
|
|
84
|
+
v,
|
|
85
|
+
S,
|
|
86
|
+
t,
|
|
87
|
+
w,
|
|
88
|
+
y,
|
|
89
|
+
x,
|
|
90
|
+
_,
|
|
91
|
+
g,
|
|
92
|
+
C,
|
|
93
|
+
r
|
|
94
|
+
]);
|
|
95
|
+
return h.current = T, (0, b.useEffect)(function() {
|
|
96
|
+
return p.current = !0, function() {
|
|
97
|
+
var e;
|
|
98
|
+
x && h.current.flush(), m.current &&= ((e = globalThis.document) == null || e.removeEventListener == null || e.removeEventListener("visibilitychange", m.current), null), p.current = !1;
|
|
99
|
+
};
|
|
100
|
+
}, [x]), T;
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region ../../../../node_modules/.pnpm/@gen-epix+ui-core@3.8.1_react@19.3.0/node_modules/@gen-epix/ui-core/dist/classes/services/WindowService/index.js
|
|
104
|
+
var C = class e {
|
|
105
|
+
static __instance;
|
|
106
|
+
get body() {
|
|
107
|
+
return this.document ? this.document.body : null;
|
|
108
|
+
}
|
|
109
|
+
get document() {
|
|
110
|
+
return this.window ? this.window.document : null;
|
|
111
|
+
}
|
|
112
|
+
get window() {
|
|
113
|
+
return globalThis;
|
|
114
|
+
}
|
|
115
|
+
constructor() {}
|
|
116
|
+
static getInstance() {
|
|
117
|
+
return e.__instance = a.getHmrSingleton("windowService", e.__instance, () => new e()), e.__instance;
|
|
118
|
+
}
|
|
119
|
+
}, w = class {
|
|
120
|
+
get data() {
|
|
121
|
+
return this.subject.data;
|
|
122
|
+
}
|
|
123
|
+
subject;
|
|
124
|
+
constructor(e) {
|
|
125
|
+
this.subject = e;
|
|
126
|
+
}
|
|
127
|
+
next(e) {
|
|
128
|
+
return this.subject.next(e);
|
|
129
|
+
}
|
|
130
|
+
subscribe(e) {
|
|
131
|
+
return this.subject.subscribe(e);
|
|
132
|
+
}
|
|
133
|
+
}, T = class e extends w {
|
|
134
|
+
static __instance;
|
|
135
|
+
constructor() {
|
|
136
|
+
super(new x(C.getInstance().window.devicePixelRatio));
|
|
137
|
+
let e = () => {
|
|
138
|
+
let t = C.getInstance().window, n = t.matchMedia(`(resolution: ${t.devicePixelRatio}dppx)`), r = () => {
|
|
139
|
+
this.subject.next(t.devicePixelRatio), n.removeEventListener("change", r), e();
|
|
140
|
+
};
|
|
141
|
+
n.addEventListener("change", r);
|
|
142
|
+
};
|
|
143
|
+
e();
|
|
144
|
+
}
|
|
145
|
+
static getInstance() {
|
|
146
|
+
return e.__instance = a.getHmrSingleton("devicePixelRatioService", e.__instance, () => new e()), e.__instance;
|
|
147
|
+
}
|
|
148
|
+
}, E = [
|
|
149
|
+
"form",
|
|
150
|
+
"input",
|
|
151
|
+
"label",
|
|
152
|
+
"select",
|
|
153
|
+
"textarea",
|
|
154
|
+
"button",
|
|
155
|
+
"fieldset",
|
|
156
|
+
"legend",
|
|
157
|
+
"datalist",
|
|
158
|
+
"output",
|
|
159
|
+
"option",
|
|
160
|
+
"optgroup"
|
|
161
|
+
], D = [
|
|
162
|
+
"Alt",
|
|
163
|
+
"AltGraph",
|
|
164
|
+
"Control",
|
|
165
|
+
"Meta",
|
|
166
|
+
"Shift"
|
|
167
|
+
], O = class e {
|
|
168
|
+
static __instance;
|
|
169
|
+
configs = [];
|
|
170
|
+
constructor() {
|
|
171
|
+
window.addEventListener("keydown", this.handleWindowKeyDown);
|
|
172
|
+
}
|
|
173
|
+
static getInstance() {
|
|
174
|
+
return e.__instance = a.getHmrSingleton("keyboardShortcutService", e.__instance, () => new e()), e.__instance;
|
|
175
|
+
}
|
|
176
|
+
static shouldIgnoreShortcut(e) {
|
|
177
|
+
let t = document.activeElement;
|
|
178
|
+
if (e?.contains(t)) return !1;
|
|
179
|
+
let n = t;
|
|
180
|
+
for (; n;) {
|
|
181
|
+
if (E.includes(n.tagName.toLowerCase())) return !0;
|
|
182
|
+
n = n.parentElement;
|
|
183
|
+
}
|
|
184
|
+
return !1;
|
|
185
|
+
}
|
|
186
|
+
registerShortcut({ callback: e, code: t, element: n, key: r, modifiers: i }) {
|
|
187
|
+
let a = {
|
|
188
|
+
callback: e,
|
|
189
|
+
code: t,
|
|
190
|
+
element: n,
|
|
191
|
+
key: r,
|
|
192
|
+
modifiers: i
|
|
193
|
+
};
|
|
194
|
+
return this.configs.push(a), (n ?? window).addEventListener("keydown", n ? this.handleElementKeyDown : this.handleWindowKeyDown), () => {
|
|
195
|
+
let e = this.configs.indexOf(a);
|
|
196
|
+
e !== -1 && (this.configs.splice(e, 1), this.configs.some((e) => e.element === n) || (n ?? window).removeEventListener("keydown", n ? this.handleElementKeyDown : this.handleWindowKeyDown));
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
handleElementKeyDown = (e) => {
|
|
200
|
+
this.handleKeyDown(e, e.currentTarget);
|
|
201
|
+
};
|
|
202
|
+
handleKeyDown = (t, n) => {
|
|
203
|
+
for (let r of this.configs) {
|
|
204
|
+
let { callback: i, code: a, key: o, modifiers: s } = r;
|
|
205
|
+
if (n === r.element && !(o && t.key !== o || a && t.code !== a) && (s?.length ? s : [[]]).some((e) => D.every((n) => e.includes(n) === t.getModifierState(n)))) {
|
|
206
|
+
if (e.shouldIgnoreShortcut(n)) return;
|
|
207
|
+
i(t);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
handleWindowKeyDown = (e) => {
|
|
213
|
+
this.handleKeyDown(e, void 0);
|
|
214
|
+
};
|
|
215
|
+
}, k = u(), ee = () => {
|
|
216
|
+
let e = p(), t = d(l, (e) => e.latestMessage), n = d(l, (e) => e.meta), r = d(l, (e) => e.selection), i = (0, b.useMemo)(() => c.getStatusBarSelectionStats(r, n), [n, r]);
|
|
217
|
+
return /* @__PURE__ */ (0, k.jsx)(h, {
|
|
218
|
+
sx: {
|
|
219
|
+
backgroundColor: m(e.palette.background.paper, .1),
|
|
220
|
+
borderTop: `1px solid ${m(e.palette.background.paper, .2)}`,
|
|
221
|
+
fontSize: e.typography.caption,
|
|
222
|
+
height: "100%",
|
|
223
|
+
width: "100%"
|
|
224
|
+
},
|
|
225
|
+
children: /* @__PURE__ */ (0, k.jsxs)(h, {
|
|
226
|
+
sx: {
|
|
227
|
+
"& > div": {
|
|
228
|
+
alignItems: "center",
|
|
229
|
+
borderLeft: `1px solid ${m(e.palette.background.paper, .2)}`,
|
|
230
|
+
display: "flex",
|
|
231
|
+
paddingLeft: e.spacing(1)
|
|
232
|
+
},
|
|
233
|
+
"& > div:first-of-type": { borderLeft: "none" },
|
|
234
|
+
display: "grid",
|
|
235
|
+
gap: 4,
|
|
236
|
+
gridTemplateColumns: "1fr repeat(5, max-content)",
|
|
237
|
+
paddingLeft: e.spacing(1),
|
|
238
|
+
paddingRight: e.spacing(1)
|
|
239
|
+
},
|
|
240
|
+
children: [
|
|
241
|
+
/* @__PURE__ */ (0, k.jsx)(h, { children: t ?? "" }),
|
|
242
|
+
/* @__PURE__ */ (0, k.jsx)(h, { children: `Pos: ${i.pos}` }),
|
|
243
|
+
/* @__PURE__ */ (0, k.jsx)(h, { children: `Selected seqs: ${i.selectedSeqs}` }),
|
|
244
|
+
/* @__PURE__ */ (0, k.jsx)(h, { children: `Cols: ${i.cols}` }),
|
|
245
|
+
/* @__PURE__ */ (0, k.jsx)(h, { children: `Total selected chars: ${i.totalSelectedChars}` }),
|
|
246
|
+
/* @__PURE__ */ (0, k.jsx)(h, { children: `Alignment: ${n?.alignmentWidth ?? "0"} sequences ${n?.sequenceCount ?? "0"} pos.` })
|
|
247
|
+
]
|
|
248
|
+
})
|
|
249
|
+
});
|
|
250
|
+
}, A = /^(?:\d+|,\d+|\d+,\d+)$/, te = _(({ onActionsChange: e, onClose: t, onGotoPosition: n }) => {
|
|
251
|
+
let [r, i] = (0, b.useState)(""), a = (0, b.useRef)(null), o = r === "" || A.test(r);
|
|
252
|
+
(0, b.useEffect)(() => {
|
|
253
|
+
a.current?.focus();
|
|
254
|
+
}, []);
|
|
255
|
+
let s = (0, b.useCallback)((e) => {
|
|
256
|
+
i(e.target.value);
|
|
257
|
+
}, []), c = (0, b.useCallback)(() => {
|
|
258
|
+
if (!o) return;
|
|
259
|
+
let [e, i] = r.split(",");
|
|
260
|
+
n(e ? Number(e) : null, i ? Number(i) : null), t?.();
|
|
261
|
+
}, [
|
|
262
|
+
o,
|
|
263
|
+
t,
|
|
264
|
+
n,
|
|
265
|
+
r
|
|
266
|
+
]), l = (0, b.useCallback)((e) => {
|
|
267
|
+
e.key === "Enter" && (e.preventDefault(), c());
|
|
268
|
+
}, [c]);
|
|
269
|
+
return (0, b.useEffect)(() => {
|
|
270
|
+
let n = [];
|
|
271
|
+
n.push({
|
|
272
|
+
color: "secondary",
|
|
273
|
+
label: "Close",
|
|
274
|
+
onClick: t,
|
|
275
|
+
variant: "outlined"
|
|
276
|
+
}), n.push({
|
|
277
|
+
color: "primary",
|
|
278
|
+
disabled: !o,
|
|
279
|
+
label: "Ok",
|
|
280
|
+
onClick: c,
|
|
281
|
+
variant: "contained"
|
|
282
|
+
}), e?.(n);
|
|
283
|
+
}, [
|
|
284
|
+
o,
|
|
285
|
+
e,
|
|
286
|
+
t,
|
|
287
|
+
c
|
|
288
|
+
]), /* @__PURE__ */ (0, k.jsx)(g, {
|
|
289
|
+
error: !o,
|
|
290
|
+
fullWidth: !0,
|
|
291
|
+
helperText: "Use x, ,y, or x,y.",
|
|
292
|
+
inputRef: a,
|
|
293
|
+
label: "Position",
|
|
294
|
+
onChange: s,
|
|
295
|
+
onKeyDown: l,
|
|
296
|
+
placeholder: "x or ,y or x,y",
|
|
297
|
+
value: r
|
|
298
|
+
});
|
|
299
|
+
}, {
|
|
300
|
+
defaultTitle: "Goto position (x) or (,y) or (x,y)",
|
|
301
|
+
fullWidth: !0,
|
|
302
|
+
maxWidth: "xs",
|
|
303
|
+
testId: "SequenceEditorGotoPositionDialog"
|
|
304
|
+
}), j = () => {
|
|
305
|
+
let e = d(l, (e) => e.rawFasta), a = d(l, (e) => e.setLatestMessage), u = d(l, (e) => e.setMeta), f = d(l, (e) => e.setSelection), m = (0, b.useRef)(null), g = (0, b.useMemo)(() => y.getInstance(), []), _ = (0, b.useRef)(null), C = (0, b.useRef)(null), w = (0, b.useRef)(null), E = (0, b.useRef)(null), D = (0, b.useRef)(null), A = (0, b.useRef)(null), [j, ne] = (0, b.useState)({
|
|
306
|
+
height: 0,
|
|
307
|
+
width: 0
|
|
308
|
+
}), [M, N] = (0, b.useState)(() => T.getInstance().data), [P, re] = (0, b.useState)(0), [ie, ae] = (0, b.useState)(0), F = (0, b.useMemo)(() => new x({
|
|
309
|
+
scrollLeft: 0,
|
|
310
|
+
scrollTop: 0
|
|
311
|
+
}), []), I = (0, b.useRef)(j), L = (0, b.useMemo)(() => new x(null), []), R = (0, b.useMemo)(() => new x(null), []), z = (0, b.useRef)(null), B = (0, b.useRef)(null), V = (0, b.useMemo)(() => new x(r), []), H = (0, b.useMemo)(() => new x(null), []), U = (0, b.useRef)(null), W = (0, b.useRef)(0), G = (0, b.useRef)(null), K = (0, b.useRef)(!1), q = p(), J = (0, b.useCallback)(() => {
|
|
312
|
+
let e = V.data, t = L.data;
|
|
313
|
+
if (!e || !t) return;
|
|
314
|
+
let n = e.labelWidth + e.cellWidth + t.alignmentWidth * e.cellWidth, r = e.rulerHeight + t.sequenceCount * e.cellHeight;
|
|
315
|
+
ae(n), re(r);
|
|
316
|
+
}, [V, L]), Y = (0, b.useCallback)(async () => {
|
|
317
|
+
let e = await y.getInstance().getMetaData();
|
|
318
|
+
L.next(e);
|
|
319
|
+
}, [L]), X = (0, b.useCallback)(() => {
|
|
320
|
+
let e = V.data, t = L.data;
|
|
321
|
+
if (!t || !e) return;
|
|
322
|
+
let { scrollLeft: n, scrollTop: r } = F.data, { height: i, width: a } = I.current, o = c.getVisibleGridRange({
|
|
323
|
+
geometry: e,
|
|
324
|
+
numCols: t.alignmentWidth,
|
|
325
|
+
numRows: t.sequenceCount,
|
|
326
|
+
scrollLeft: n,
|
|
327
|
+
scrollTop: r,
|
|
328
|
+
viewportHeight: i,
|
|
329
|
+
viewportWidth: a
|
|
330
|
+
});
|
|
331
|
+
R.next({
|
|
332
|
+
geometry: e,
|
|
333
|
+
scrollLeft: n,
|
|
334
|
+
scrollTop: r,
|
|
335
|
+
viewportHeight: i,
|
|
336
|
+
viewportWidth: a,
|
|
337
|
+
visibleGridRange: o
|
|
338
|
+
});
|
|
339
|
+
}, [
|
|
340
|
+
V,
|
|
341
|
+
L,
|
|
342
|
+
F,
|
|
343
|
+
R
|
|
344
|
+
]), Z = S((e, t) => {
|
|
345
|
+
ne({
|
|
346
|
+
height: t,
|
|
347
|
+
width: e
|
|
348
|
+
});
|
|
349
|
+
}, 0, { trailing: !0 });
|
|
350
|
+
(0, b.useEffect)(() => {
|
|
351
|
+
I.current = j, X();
|
|
352
|
+
}, [j, X]);
|
|
353
|
+
let Q = j.width > 0 ? j.width / 2 : 120;
|
|
354
|
+
(0, b.useEffect)(() => {
|
|
355
|
+
let e = [L.subscribe((e) => {
|
|
356
|
+
u(e);
|
|
357
|
+
}), H.subscribe((e) => {
|
|
358
|
+
f(e);
|
|
359
|
+
})];
|
|
360
|
+
return () => {
|
|
361
|
+
e.forEach((e) => e()), a(null), u(null), f(null);
|
|
362
|
+
};
|
|
363
|
+
}, [
|
|
364
|
+
L,
|
|
365
|
+
H,
|
|
366
|
+
a,
|
|
367
|
+
u,
|
|
368
|
+
f
|
|
369
|
+
]), (0, b.useEffect)(() => {
|
|
370
|
+
if (j.width <= 0) return;
|
|
371
|
+
let e = V.data;
|
|
372
|
+
e.labelWidth > Q && V.next({
|
|
373
|
+
...e,
|
|
374
|
+
labelWidth: Q
|
|
375
|
+
});
|
|
376
|
+
}, [
|
|
377
|
+
j.width,
|
|
378
|
+
V,
|
|
379
|
+
Q
|
|
380
|
+
]), (0, b.useEffect)(() => {
|
|
381
|
+
let e = A.current;
|
|
382
|
+
if (!e) return;
|
|
383
|
+
let t = new ResizeObserver(([e]) => {
|
|
384
|
+
if (!e) return;
|
|
385
|
+
let t = Math.max(1, e.contentRect.height), n = Math.max(1, e.contentRect.width);
|
|
386
|
+
Z(n, t);
|
|
387
|
+
});
|
|
388
|
+
return t.observe(e), () => t.disconnect();
|
|
389
|
+
}, [g, Z]), (0, b.useEffect)(() => {
|
|
390
|
+
(async () => {
|
|
391
|
+
z.current = null, B.current = null, F.next({
|
|
392
|
+
scrollLeft: 0,
|
|
393
|
+
scrollTop: 0
|
|
394
|
+
}), H.next(null), await g.initialize(), await g.loadFasta(e), await Y(), X();
|
|
395
|
+
})().catch((e) => {
|
|
396
|
+
console.error(e);
|
|
397
|
+
});
|
|
398
|
+
}, [
|
|
399
|
+
g,
|
|
400
|
+
e,
|
|
401
|
+
F,
|
|
402
|
+
H,
|
|
403
|
+
Y,
|
|
404
|
+
X
|
|
405
|
+
]), (0, b.useEffect)(() => {
|
|
406
|
+
let e = null, t = !0, n = null, r = null, i = async () => {
|
|
407
|
+
if (t && !K.current) {
|
|
408
|
+
K.current = !0;
|
|
409
|
+
try {
|
|
410
|
+
for (; t && G.current;) {
|
|
411
|
+
let i = G.current;
|
|
412
|
+
G.current = null;
|
|
413
|
+
let a = W.current;
|
|
414
|
+
if (!B.current || !c.isWithinGridRange({
|
|
415
|
+
cachedGridRange: B.current.range,
|
|
416
|
+
visibleGridRange: i.visibleGridRange.visible
|
|
417
|
+
})) {
|
|
418
|
+
let e = [];
|
|
419
|
+
for (let t = i.visibleGridRange.cache.startRow; t <= i.visibleGridRange.cache.endRow; t++) e.push(await g.name(t));
|
|
420
|
+
if (!t) return;
|
|
421
|
+
B.current = {
|
|
422
|
+
range: i.visibleGridRange.cache,
|
|
423
|
+
rowNames: e
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
if (!z.current || !c.isWithinGridRange({
|
|
427
|
+
cachedGridRange: z.current.range,
|
|
428
|
+
visibleGridRange: i.visibleGridRange.visible
|
|
429
|
+
})) {
|
|
430
|
+
let e = await y.getInstance().viewport({
|
|
431
|
+
endCol: i.visibleGridRange.cache.endCol,
|
|
432
|
+
endRow: i.visibleGridRange.cache.endRow,
|
|
433
|
+
startCol: i.visibleGridRange.cache.startCol,
|
|
434
|
+
startRow: i.visibleGridRange.cache.startRow
|
|
435
|
+
});
|
|
436
|
+
if (!t) return;
|
|
437
|
+
z.current = {
|
|
438
|
+
range: i.visibleGridRange.cache,
|
|
439
|
+
viewportResult: e
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
a === W.current && (e !== null && cancelAnimationFrame(e), e = requestAnimationFrame(() => {
|
|
443
|
+
t && a === W.current && _.current && l.getState().nucleotidePalette && z.current && L.data && B.current && (C.current = c.drawCanvas({
|
|
444
|
+
canvasElement: _.current,
|
|
445
|
+
devicePixelRatio: T.getInstance().data,
|
|
446
|
+
geometry: i.geometry,
|
|
447
|
+
meta: L.data,
|
|
448
|
+
palette: l.getState().nucleotidePalette,
|
|
449
|
+
rowNames: B.current.rowNames,
|
|
450
|
+
rowNamesStartRow: B.current.range.startRow,
|
|
451
|
+
scrollLeft: i.scrollLeft,
|
|
452
|
+
scrollTop: i.scrollTop,
|
|
453
|
+
searchResult: n,
|
|
454
|
+
searchResultHighlightedIndex: r,
|
|
455
|
+
selection: H.data,
|
|
456
|
+
viewport: z.current.viewportResult,
|
|
457
|
+
viewportHeight: i.viewportHeight,
|
|
458
|
+
viewportWidth: i.viewportWidth
|
|
459
|
+
}));
|
|
460
|
+
}));
|
|
461
|
+
}
|
|
462
|
+
} finally {
|
|
463
|
+
K.current = !1, t && G.current && i();
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}, a = [l.subscribe((e, t) => {
|
|
467
|
+
let i = !1;
|
|
468
|
+
e.searchResult !== t.searchResult && (n = e.searchResult, i = !0), e.searchResultHighlightedIndex !== t.searchResultHighlightedIndex && (r = e.searchResultHighlightedIndex, c.scrollToSearchResult({
|
|
469
|
+
geometry: V.data,
|
|
470
|
+
scrollContainer: A.current,
|
|
471
|
+
searchResult: e.searchResult,
|
|
472
|
+
searchResultHighlightedIndex: e.searchResultHighlightedIndex
|
|
473
|
+
}), i = !0), i && X();
|
|
474
|
+
}), R.subscribe((e) => {
|
|
475
|
+
e && (G.current = e, W.current += 1, i());
|
|
476
|
+
})];
|
|
477
|
+
return () => {
|
|
478
|
+
t = !1, G.current = null, e !== null && cancelAnimationFrame(e), W.current += 1, a.forEach((e) => e());
|
|
479
|
+
};
|
|
480
|
+
}, [
|
|
481
|
+
g,
|
|
482
|
+
V,
|
|
483
|
+
L,
|
|
484
|
+
H,
|
|
485
|
+
X,
|
|
486
|
+
R
|
|
487
|
+
]), (0, b.useEffect)(() => {
|
|
488
|
+
let e = [
|
|
489
|
+
l.subscribe((e, t) => {
|
|
490
|
+
e.nucleotidePalette?.name !== t.nucleotidePalette?.name && X();
|
|
491
|
+
}),
|
|
492
|
+
V.subscribe(() => {
|
|
493
|
+
J(), X();
|
|
494
|
+
}),
|
|
495
|
+
F.subscribe(() => X()),
|
|
496
|
+
L.subscribe((e) => {
|
|
497
|
+
e && (J(), X());
|
|
498
|
+
}),
|
|
499
|
+
H.subscribe(() => X()),
|
|
500
|
+
T.getInstance().subscribe((e) => {
|
|
501
|
+
N(e), J(), X();
|
|
502
|
+
})
|
|
503
|
+
];
|
|
504
|
+
return () => {
|
|
505
|
+
e.forEach((e) => e());
|
|
506
|
+
};
|
|
507
|
+
}, [
|
|
508
|
+
g,
|
|
509
|
+
V,
|
|
510
|
+
L,
|
|
511
|
+
F,
|
|
512
|
+
H,
|
|
513
|
+
J,
|
|
514
|
+
X
|
|
515
|
+
]), (0, b.useEffect)(() => {
|
|
516
|
+
let e = (e) => {
|
|
517
|
+
let t = e.key.toUpperCase();
|
|
518
|
+
i.has(t) && (e.preventDefault(), o.getInstance().emit("onMutateSelection", t));
|
|
519
|
+
}, t = (e) => O.getInstance().registerShortcut({
|
|
520
|
+
callback: e.callback,
|
|
521
|
+
element: D.current,
|
|
522
|
+
...e.shortcut
|
|
523
|
+
}), n = [
|
|
524
|
+
t(s.expandSelectionLeft),
|
|
525
|
+
t(s.expandSelectionRight),
|
|
526
|
+
t(s.expandSelectionUp),
|
|
527
|
+
t(s.expandSelectionDown),
|
|
528
|
+
t(s.moveSelectionLeft),
|
|
529
|
+
t(s.moveSelectionRight),
|
|
530
|
+
t(s.moveSelectionUp),
|
|
531
|
+
t(s.moveSelectionDown),
|
|
532
|
+
t(s.moveRowUp),
|
|
533
|
+
t(s.moveRowDown),
|
|
534
|
+
t(s.moveRowToStart),
|
|
535
|
+
t(s.moveRowToEnd),
|
|
536
|
+
t(s.moveCellLeft),
|
|
537
|
+
t(s.moveCellRight),
|
|
538
|
+
t(s.scrollToLineStart),
|
|
539
|
+
t(s.scrollToLineEnd),
|
|
540
|
+
t(s.scrollPageUp),
|
|
541
|
+
t(s.scrollPageDown),
|
|
542
|
+
t(s.insertGap),
|
|
543
|
+
t(s.deleteBackward),
|
|
544
|
+
t(s.deleteSelection),
|
|
545
|
+
t(s.deleteBase),
|
|
546
|
+
t(s.undo),
|
|
547
|
+
t(s.redo),
|
|
548
|
+
t(s.gotoPosition),
|
|
549
|
+
O.getInstance().registerShortcut({
|
|
550
|
+
callback: e,
|
|
551
|
+
element: D.current
|
|
552
|
+
}),
|
|
553
|
+
O.getInstance().registerShortcut({
|
|
554
|
+
callback: e,
|
|
555
|
+
element: D.current,
|
|
556
|
+
modifiers: [["Shift"]]
|
|
557
|
+
})
|
|
558
|
+
];
|
|
559
|
+
return () => {
|
|
560
|
+
n.forEach((e) => e());
|
|
561
|
+
};
|
|
562
|
+
}, []), (0, b.useEffect)(() => {
|
|
563
|
+
let e = async (e) => {
|
|
564
|
+
let { command: t, getSelectionPostCommand: n } = e;
|
|
565
|
+
try {
|
|
566
|
+
if (await t(), z.current = null, B.current = null, await Y(), X(), n) {
|
|
567
|
+
let e = n();
|
|
568
|
+
H.next(e), U.current = e;
|
|
569
|
+
}
|
|
570
|
+
} catch (e) {
|
|
571
|
+
console.error("Failed to post command:", e);
|
|
572
|
+
}
|
|
573
|
+
}, n = async (t) => {
|
|
574
|
+
if (!L.data) return;
|
|
575
|
+
let n = c.getMutateArguments(H.data, L.data);
|
|
576
|
+
n && await e({ command: async () => {
|
|
577
|
+
for (let e = n.startCol; e <= n.endCol; e += 1) await g.mutate(n.rows, e, t);
|
|
578
|
+
} });
|
|
579
|
+
}, r = (e) => {
|
|
580
|
+
if (!L.data) return;
|
|
581
|
+
let t = c.getMovedSelection(H.data, e, L.data);
|
|
582
|
+
if (t) {
|
|
583
|
+
if (H.next(t), U.current) {
|
|
584
|
+
let t = c.getMovedSelection(U.current, e, L.data);
|
|
585
|
+
U.current = t;
|
|
586
|
+
} else U.current = t;
|
|
587
|
+
}
|
|
588
|
+
}, i = (e) => {
|
|
589
|
+
if (!L.data || !U.current || !H.data) return;
|
|
590
|
+
let t = c.getExpandedSelection(H.data, U.current, e, L.data);
|
|
591
|
+
t && H.next(t);
|
|
592
|
+
}, a = async (e) => {}, s = async (n) => {
|
|
593
|
+
if (!L.data) return;
|
|
594
|
+
let r = c.getRowsToMove(H.data, n, L.data);
|
|
595
|
+
r && await e({
|
|
596
|
+
command: async () => {
|
|
597
|
+
n === t.UP ? await g.moveRowsUp(r) : await g.moveRowsDown(r);
|
|
598
|
+
},
|
|
599
|
+
getSelectionPostCommand: () => c.getMovedSelection(H.data, n, L.data)
|
|
600
|
+
});
|
|
601
|
+
}, u = async (e) => {}, d = o.getInstance(), f = [
|
|
602
|
+
d.addEventListener("onSearch", async (e) => {
|
|
603
|
+
if (!e) return;
|
|
604
|
+
let t = await g.search(e, !1);
|
|
605
|
+
l.getState().setSearchResult(t);
|
|
606
|
+
}),
|
|
607
|
+
d.addEventListener("onExpandSelection", (e) => i(e)),
|
|
608
|
+
d.addEventListener("onGotoPosition", () => m.current?.open({})),
|
|
609
|
+
d.addEventListener("onMoveSelection", (e) => r(e)),
|
|
610
|
+
d.addEventListener("onMoveRows", (e) => {
|
|
611
|
+
s(e);
|
|
612
|
+
}),
|
|
613
|
+
d.addEventListener("onMoveRowsEnd", (e) => {
|
|
614
|
+
a(e);
|
|
615
|
+
}),
|
|
616
|
+
d.addEventListener("onMoveCells", (e) => {
|
|
617
|
+
u(e);
|
|
618
|
+
}),
|
|
619
|
+
d.addEventListener("onScrollToLineStart", () => {
|
|
620
|
+
let e = A.current;
|
|
621
|
+
e && (e.scrollLeft = 0);
|
|
622
|
+
}),
|
|
623
|
+
d.addEventListener("onScrollToLineEnd", () => {
|
|
624
|
+
let e = A.current;
|
|
625
|
+
e && (e.scrollLeft = e.scrollWidth - e.clientWidth);
|
|
626
|
+
}),
|
|
627
|
+
d.addEventListener("onScrollPageUp", () => {
|
|
628
|
+
let e = A.current;
|
|
629
|
+
e && (e.scrollTop = Math.max(0, e.scrollTop - e.clientHeight));
|
|
630
|
+
}),
|
|
631
|
+
d.addEventListener("onScrollPageDown", () => {
|
|
632
|
+
let e = A.current;
|
|
633
|
+
e && (e.scrollTop = Math.min(e.scrollHeight - e.clientHeight, e.scrollTop + e.clientHeight));
|
|
634
|
+
}),
|
|
635
|
+
d.addEventListener("onInsert", () => {
|
|
636
|
+
(async () => {
|
|
637
|
+
if (!L.data) return;
|
|
638
|
+
let n = c.getUpsertArguments(H.data, L.data);
|
|
639
|
+
n && await e({
|
|
640
|
+
command: async () => g.insert(n.rows, n.col),
|
|
641
|
+
getSelectionPostCommand: () => c.getPostUpsertSelection(H.data, t.RIGHT)
|
|
642
|
+
});
|
|
643
|
+
})();
|
|
644
|
+
}),
|
|
645
|
+
d.addEventListener("onDeleteBackward", () => {
|
|
646
|
+
(async () => {
|
|
647
|
+
if (!L.data) return;
|
|
648
|
+
let n = c.getUpsertArguments(H.data, L.data, -1);
|
|
649
|
+
n && await e({
|
|
650
|
+
command: async () => g.delete(n.rows, n.col),
|
|
651
|
+
getSelectionPostCommand: () => c.getPostUpsertSelection(H.data, t.LEFT)
|
|
652
|
+
});
|
|
653
|
+
})();
|
|
654
|
+
}),
|
|
655
|
+
d.addEventListener("onMutateSelection", (e) => {
|
|
656
|
+
n(e);
|
|
657
|
+
}),
|
|
658
|
+
d.addEventListener("onUndo", () => {
|
|
659
|
+
e({
|
|
660
|
+
command: async () => g.undo(),
|
|
661
|
+
getSelectionPostCommand: () => null
|
|
662
|
+
});
|
|
663
|
+
}),
|
|
664
|
+
d.addEventListener("onRedo", () => {
|
|
665
|
+
e({
|
|
666
|
+
command: async () => g.redo(),
|
|
667
|
+
getSelectionPostCommand: () => null
|
|
668
|
+
});
|
|
669
|
+
})
|
|
670
|
+
];
|
|
671
|
+
return () => {
|
|
672
|
+
f.forEach((e) => e());
|
|
673
|
+
};
|
|
674
|
+
}, [
|
|
675
|
+
g,
|
|
676
|
+
H,
|
|
677
|
+
Y,
|
|
678
|
+
X,
|
|
679
|
+
L
|
|
680
|
+
]), (0, b.useEffect)(() => {
|
|
681
|
+
X();
|
|
682
|
+
}, [X]);
|
|
683
|
+
let oe = (0, b.useCallback)((e) => {
|
|
684
|
+
let t = e.currentTarget;
|
|
685
|
+
F.next({
|
|
686
|
+
scrollLeft: t.scrollLeft,
|
|
687
|
+
scrollTop: t.scrollTop
|
|
688
|
+
});
|
|
689
|
+
}, [F]), se = (0, b.useCallback)((e) => {
|
|
690
|
+
D.current?.focus();
|
|
691
|
+
let t = e.currentTarget, r = t.getBoundingClientRect(), i = e.clientX >= r.left + t.clientWidth, a = e.clientY >= r.top + t.clientHeight;
|
|
692
|
+
if (i || a) return;
|
|
693
|
+
let o = _.current, s = C.current, l = T.getInstance().data;
|
|
694
|
+
if (!o || !s) return;
|
|
695
|
+
let u = c.getPathPropertiesFromCanvas({
|
|
696
|
+
canvas: o,
|
|
697
|
+
devicePixelRatio: l,
|
|
698
|
+
editorAssembly: s,
|
|
699
|
+
event: e.nativeEvent
|
|
700
|
+
});
|
|
701
|
+
if (u) {
|
|
702
|
+
if (u.type !== n.DIVIDER) {
|
|
703
|
+
if (u.type === n.LABEL && (e.metaKey || e.ctrlKey)) {
|
|
704
|
+
let t = H.data?.rows ?? [], n = t.includes(u.row) ? t.filter((e) => e !== u.row) : [...t, u.row].sort((e, t) => e - t);
|
|
705
|
+
if (e.preventDefault(), E.current = null, n.length === 0) {
|
|
706
|
+
H.next(null), U.current = null;
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
H.next({ rows: n }), U.current = { rows: n };
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
let t = c.getSelectionFromPathProperties({
|
|
713
|
+
endPath: u,
|
|
714
|
+
startPath: u
|
|
715
|
+
});
|
|
716
|
+
if (!t) return;
|
|
717
|
+
e.preventDefault(), E.current = u, H.next(t), U.current = t;
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
e.preventDefault(), E.current = null, w.current = {
|
|
721
|
+
startLabelWidth: V.data.labelWidth,
|
|
722
|
+
startX: e.clientX
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
}, [V, H]), ce = (0, b.useCallback)((e) => {
|
|
726
|
+
let t = _.current, r = D.current, i = T.getInstance().data, a = w.current;
|
|
727
|
+
if (!r || !t) return;
|
|
728
|
+
if (a) {
|
|
729
|
+
let t = Math.min(Q, Math.max(120, a.startLabelWidth + e.clientX - a.startX));
|
|
730
|
+
V.next({
|
|
731
|
+
...V.data,
|
|
732
|
+
labelWidth: t
|
|
733
|
+
}), r.style.cursor = "col-resize";
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
let o = E.current;
|
|
737
|
+
if (o) {
|
|
738
|
+
let n = C.current;
|
|
739
|
+
if (!n) return;
|
|
740
|
+
let r = c.getPathPropertiesFromCanvas({
|
|
741
|
+
canvas: t,
|
|
742
|
+
devicePixelRatio: i,
|
|
743
|
+
editorAssembly: n,
|
|
744
|
+
event: e.nativeEvent
|
|
745
|
+
});
|
|
746
|
+
if (!r) return;
|
|
747
|
+
let a = c.getSelectionFromPathProperties({
|
|
748
|
+
endPath: r,
|
|
749
|
+
startPath: o
|
|
750
|
+
});
|
|
751
|
+
a && (H.next(a), U.current = a);
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
let s = C.current;
|
|
755
|
+
if (!s) return;
|
|
756
|
+
let l = c.getPathPropertiesFromCanvas({
|
|
757
|
+
canvas: t,
|
|
758
|
+
devicePixelRatio: i,
|
|
759
|
+
editorAssembly: s,
|
|
760
|
+
event: e.nativeEvent
|
|
761
|
+
});
|
|
762
|
+
if (!l) {
|
|
763
|
+
r.style.cursor = "default";
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
l.type === n.DIVIDER ? r.style.cursor = "col-resize" : r.style.cursor = "default";
|
|
767
|
+
}, [
|
|
768
|
+
V,
|
|
769
|
+
Q,
|
|
770
|
+
H
|
|
771
|
+
]), le = (0, b.useCallback)(() => {
|
|
772
|
+
w.current = null, E.current = null;
|
|
773
|
+
}, []), $ = (0, b.useCallback)((e, t) => {
|
|
774
|
+
c.scrollToPosition({
|
|
775
|
+
geometry: V.data,
|
|
776
|
+
scrollContainer: A.current,
|
|
777
|
+
x: e,
|
|
778
|
+
y: t
|
|
779
|
+
});
|
|
780
|
+
}, [V]), ue = Math.max(1, Math.floor(j.width * M)), de = Math.max(1, Math.floor(j.height * M));
|
|
781
|
+
return /* @__PURE__ */ (0, k.jsxs)(h, {
|
|
782
|
+
sx: {
|
|
783
|
+
display: "grid",
|
|
784
|
+
gridTemplateRows: "max-content auto",
|
|
785
|
+
height: "100%",
|
|
786
|
+
position: "relative",
|
|
787
|
+
width: "100%"
|
|
788
|
+
},
|
|
789
|
+
children: [
|
|
790
|
+
/* @__PURE__ */ (0, k.jsx)(v, {}),
|
|
791
|
+
/* @__PURE__ */ (0, k.jsxs)(h, {
|
|
792
|
+
onMouseUp: le,
|
|
793
|
+
ref: D,
|
|
794
|
+
sx: {
|
|
795
|
+
height: `calc(100% - ${q.spacing(3)})`,
|
|
796
|
+
marginBottom: q.spacing(3),
|
|
797
|
+
position: "relative",
|
|
798
|
+
width: "100%"
|
|
799
|
+
},
|
|
800
|
+
tabIndex: 0,
|
|
801
|
+
children: [
|
|
802
|
+
/* @__PURE__ */ (0, k.jsx)(h, {
|
|
803
|
+
onMouseDown: se,
|
|
804
|
+
onMouseMove: ce,
|
|
805
|
+
onScroll: oe,
|
|
806
|
+
ref: A,
|
|
807
|
+
sx: {
|
|
808
|
+
height: "100%",
|
|
809
|
+
overflowX: "scroll",
|
|
810
|
+
overflowY: "scroll",
|
|
811
|
+
position: "absolute",
|
|
812
|
+
width: "100%",
|
|
813
|
+
zIndex: 1
|
|
814
|
+
},
|
|
815
|
+
children: /* @__PURE__ */ (0, k.jsx)(h, { sx: {
|
|
816
|
+
height: `${Math.max(P, j.height)}px`,
|
|
817
|
+
pointerEvents: "none",
|
|
818
|
+
width: `${Math.max(ie, j.width)}px`
|
|
819
|
+
} })
|
|
820
|
+
}),
|
|
821
|
+
/* @__PURE__ */ (0, k.jsx)("canvas", {
|
|
822
|
+
height: de,
|
|
823
|
+
ref: _,
|
|
824
|
+
style: {
|
|
825
|
+
display: "block",
|
|
826
|
+
height: `${j.height}px`,
|
|
827
|
+
imageRendering: "pixelated",
|
|
828
|
+
left: 0,
|
|
829
|
+
pointerEvents: "auto",
|
|
830
|
+
position: "absolute",
|
|
831
|
+
top: 0,
|
|
832
|
+
width: `${j.width}px`,
|
|
833
|
+
zIndex: 0
|
|
834
|
+
},
|
|
835
|
+
width: ue
|
|
836
|
+
}),
|
|
837
|
+
/* @__PURE__ */ (0, k.jsx)(h, {
|
|
838
|
+
sx: {
|
|
839
|
+
bottom: q.spacing(-3),
|
|
840
|
+
height: q.spacing(3),
|
|
841
|
+
left: 0,
|
|
842
|
+
position: "absolute",
|
|
843
|
+
width: "100%",
|
|
844
|
+
zIndex: 2
|
|
845
|
+
},
|
|
846
|
+
children: /* @__PURE__ */ (0, k.jsx)(ee, {})
|
|
847
|
+
})
|
|
848
|
+
]
|
|
849
|
+
}),
|
|
850
|
+
/* @__PURE__ */ (0, k.jsx)(te, {
|
|
851
|
+
onGotoPosition: $,
|
|
852
|
+
ref: m
|
|
853
|
+
})
|
|
854
|
+
]
|
|
855
|
+
});
|
|
856
|
+
};
|
|
857
|
+
//#endregion
|
|
858
|
+
export { C as n, j as t };
|
|
859
|
+
|
|
860
|
+
//# sourceMappingURL=SequenceEditor.js.map
|