@genomicx/ui 0.7.0 → 0.7.1
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/components/NavBar.d.ts +3 -1
- package/dist/index.js +44 -44
- package/package.json +1 -1
|
@@ -5,9 +5,11 @@ export interface NavBarProps {
|
|
|
5
5
|
version?: string;
|
|
6
6
|
/** Custom SVG icon element. Defaults to GenomicX rings logo. */
|
|
7
7
|
icon?: ReactNode;
|
|
8
|
+
/** GitHub repository URL shown in the nav header */
|
|
9
|
+
githubUrl?: string;
|
|
8
10
|
/** Extra items in the desktop nav (right side, before theme toggle) */
|
|
9
11
|
actions?: ReactNode;
|
|
10
12
|
/** Extra items in the mobile dropdown */
|
|
11
13
|
mobileActions?: ReactNode;
|
|
12
14
|
}
|
|
13
|
-
export declare function NavBar({ appName, appSubtitle, version, icon, actions, mobileActions }: NavBarProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function NavBar({ appName, appSubtitle, version, icon, githubUrl, actions, mobileActions }: NavBarProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as l, jsx as e, Fragment as p } from "react/jsx-runtime";
|
|
2
|
-
import { useState as f, useRef as
|
|
2
|
+
import { useState as f, useRef as b, useCallback as x } from "react";
|
|
3
3
|
import { Link as g } from "react-router-dom";
|
|
4
4
|
import v from "react-hot-toast";
|
|
5
5
|
function N({ disabled: n = !1 }) {
|
|
6
6
|
const [a, o] = f(
|
|
7
7
|
() => document.documentElement.getAttribute("data-theme") || "dark"
|
|
8
|
-
), r = (
|
|
9
|
-
o(
|
|
8
|
+
), r = (s) => {
|
|
9
|
+
o(s), document.documentElement.setAttribute("data-theme", s), localStorage.setItem("gx-theme", s);
|
|
10
10
|
};
|
|
11
11
|
return /* @__PURE__ */ l("div", { className: `gx-theme-toggle${n ? " disabled" : ""}`, title: n ? "Theme switching disabled" : void 0, children: [
|
|
12
12
|
/* @__PURE__ */ e(
|
|
@@ -36,8 +36,8 @@ const y = () => /* @__PURE__ */ l("svg", { className: "gx-nav-logo-icon", viewBo
|
|
|
36
36
|
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "6" }),
|
|
37
37
|
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "2" })
|
|
38
38
|
] });
|
|
39
|
-
function M({ appName: n, appSubtitle: a, version: o, icon: r, actions:
|
|
40
|
-
const [
|
|
39
|
+
function M({ appName: n, appSubtitle: a, version: o, icon: r, githubUrl: s, actions: i, mobileActions: c }) {
|
|
40
|
+
const [t, m] = f(!1);
|
|
41
41
|
return /* @__PURE__ */ l("nav", { className: "gx-nav", children: [
|
|
42
42
|
/* @__PURE__ */ e("div", { className: "gx-nav-inner", children: /* @__PURE__ */ l("div", { className: "gx-nav-row", children: [
|
|
43
43
|
/* @__PURE__ */ l(g, { to: "/", className: "gx-nav-logo", children: [
|
|
@@ -54,9 +54,9 @@ function M({ appName: n, appSubtitle: a, version: o, icon: r, actions: t, mobile
|
|
|
54
54
|
] })
|
|
55
55
|
] }),
|
|
56
56
|
/* @__PURE__ */ l("div", { className: "gx-nav-desktop", children: [
|
|
57
|
-
|
|
57
|
+
i,
|
|
58
58
|
/* @__PURE__ */ e(g, { to: "/about", className: "gx-nav-link", children: "About" }),
|
|
59
|
-
/* @__PURE__ */ l("a", { href:
|
|
59
|
+
s && /* @__PURE__ */ l("a", { href: s, target: "_blank", rel: "noopener noreferrer", className: "gx-nav-link", children: [
|
|
60
60
|
"GitHub",
|
|
61
61
|
/* @__PURE__ */ e("svg", { className: "gx-nav-link-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) })
|
|
62
62
|
] }),
|
|
@@ -64,13 +64,13 @@ function M({ appName: n, appSubtitle: a, version: o, icon: r, actions: t, mobile
|
|
|
64
64
|
] }),
|
|
65
65
|
/* @__PURE__ */ l("div", { className: "gx-nav-mobile-toggle", children: [
|
|
66
66
|
/* @__PURE__ */ e(N, {}),
|
|
67
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
67
|
+
/* @__PURE__ */ e("button", { onClick: () => m(!t), className: "gx-nav-hamburger", "aria-label": "Toggle menu", children: t ? /* @__PURE__ */ e("svg", { className: "gx-nav-hamburger-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ e("svg", { className: "gx-nav-hamburger-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 12h16M4 18h16" }) }) })
|
|
68
68
|
] })
|
|
69
69
|
] }) }),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
/* @__PURE__ */ e(g, { to: "/about", onClick: () =>
|
|
73
|
-
/* @__PURE__ */ e("a", { href:
|
|
70
|
+
t && /* @__PURE__ */ l("div", { className: "gx-nav-dropdown", children: [
|
|
71
|
+
c,
|
|
72
|
+
/* @__PURE__ */ e(g, { to: "/about", onClick: () => m(!1), className: "gx-nav-dropdown-link", children: "About" }),
|
|
73
|
+
s && /* @__PURE__ */ e("a", { href: s, target: "_blank", rel: "noopener noreferrer", className: "gx-nav-dropdown-link", children: "GitHub ↗" })
|
|
74
74
|
] })
|
|
75
75
|
] });
|
|
76
76
|
}
|
|
@@ -81,7 +81,7 @@ const B = [
|
|
|
81
81
|
"Steps to reproduce the issue"
|
|
82
82
|
];
|
|
83
83
|
function C({ onClose: n, bugReportEmail: a, bugReportUrl: o, bugReportItems: r }) {
|
|
84
|
-
const
|
|
84
|
+
const s = r ?? B;
|
|
85
85
|
return /* @__PURE__ */ e("div", { className: "gx-modal-overlay", onClick: n, children: /* @__PURE__ */ l("div", { className: "gx-modal", onClick: (i) => i.stopPropagation(), children: [
|
|
86
86
|
/* @__PURE__ */ l("div", { className: "gx-modal-header", children: [
|
|
87
87
|
/* @__PURE__ */ e("h3", { className: "gx-modal-title", children: "Report a Bug" }),
|
|
@@ -92,7 +92,7 @@ function C({ onClose: n, bugReportEmail: a, bugReportUrl: o, bugReportItems: r }
|
|
|
92
92
|
/* @__PURE__ */ e("p", { className: "gx-modal-email", children: /* @__PURE__ */ e("a", { href: `mailto:${a}`, children: a }) }),
|
|
93
93
|
/* @__PURE__ */ l("div", { className: "gx-modal-checklist", children: [
|
|
94
94
|
/* @__PURE__ */ e("p", { className: "gx-modal-checklist-title", children: "Please include:" }),
|
|
95
|
-
/* @__PURE__ */ e("ol", { className: "gx-modal-checklist-items", children:
|
|
95
|
+
/* @__PURE__ */ e("ol", { className: "gx-modal-checklist-items", children: s.map((i, c) => /* @__PURE__ */ e("li", { children: i }, c)) })
|
|
96
96
|
] }),
|
|
97
97
|
o && /* @__PURE__ */ l("p", { className: "gx-modal-github-hint", children: [
|
|
98
98
|
"You can also open an issue on",
|
|
@@ -103,10 +103,10 @@ function C({ onClose: n, bugReportEmail: a, bugReportUrl: o, bugReportItems: r }
|
|
|
103
103
|
] })
|
|
104
104
|
] }) });
|
|
105
105
|
}
|
|
106
|
-
function L({ appName: n = "GenomicX", bugReportEmail: a, bugReportUrl: o, onReportBug: r, bugReportItems:
|
|
107
|
-
const [i,
|
|
108
|
-
function
|
|
109
|
-
a ?
|
|
106
|
+
function L({ appName: n = "GenomicX", bugReportEmail: a, bugReportUrl: o, onReportBug: r, bugReportItems: s }) {
|
|
107
|
+
const [i, c] = f(!1);
|
|
108
|
+
function t() {
|
|
109
|
+
a ? c(!0) : r && r();
|
|
110
110
|
}
|
|
111
111
|
return /* @__PURE__ */ l(p, { children: [
|
|
112
112
|
/* @__PURE__ */ e("footer", { className: "gx-footer", children: /* @__PURE__ */ e("div", { className: "gx-footer-inner", children: /* @__PURE__ */ l("div", { className: "gx-footer-content", children: [
|
|
@@ -119,16 +119,16 @@ function L({ appName: n = "GenomicX", bugReportEmail: a, bugReportUrl: o, onRepo
|
|
|
119
119
|
] }),
|
|
120
120
|
/* @__PURE__ */ l("div", { className: "gx-footer-links", children: [
|
|
121
121
|
/* @__PURE__ */ e("a", { href: "https://genomicx.org", target: "_blank", rel: "noopener noreferrer", className: "gx-footer-link", children: "genomicx.org" }),
|
|
122
|
-
(a || o || r) && /* @__PURE__ */ e("button", { onClick:
|
|
122
|
+
(a || o || r) && /* @__PURE__ */ e("button", { onClick: t, className: "gx-footer-link", children: "Report Bug" })
|
|
123
123
|
] })
|
|
124
124
|
] }) }) }),
|
|
125
125
|
i && a && /* @__PURE__ */ e(
|
|
126
126
|
C,
|
|
127
127
|
{
|
|
128
|
-
onClose: () =>
|
|
128
|
+
onClose: () => c(!1),
|
|
129
129
|
bugReportEmail: a,
|
|
130
130
|
bugReportUrl: o,
|
|
131
|
-
bugReportItems:
|
|
131
|
+
bugReportItems: s
|
|
132
132
|
}
|
|
133
133
|
)
|
|
134
134
|
] });
|
|
@@ -141,7 +141,7 @@ function W({ children: n, onReportBug: a, ...o }) {
|
|
|
141
141
|
] });
|
|
142
142
|
}
|
|
143
143
|
function H({ logs: n, progress: a, title: o = "Console" }) {
|
|
144
|
-
const r =
|
|
144
|
+
const r = b(null), s = () => {
|
|
145
145
|
navigator.clipboard.writeText(n.join(`
|
|
146
146
|
`)).then(() => {
|
|
147
147
|
v.success("Logs copied to clipboard!");
|
|
@@ -170,12 +170,12 @@ function H({ logs: n, progress: a, title: o = "Console" }) {
|
|
|
170
170
|
" messages)"
|
|
171
171
|
] })
|
|
172
172
|
] }),
|
|
173
|
-
/* @__PURE__ */ l("button", { onClick:
|
|
173
|
+
/* @__PURE__ */ l("button", { onClick: s, className: "gx-console-copy", disabled: n.length === 0, children: [
|
|
174
174
|
/* @__PURE__ */ e("svg", { className: "gx-console-copy-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" }) }),
|
|
175
175
|
"Copy"
|
|
176
176
|
] })
|
|
177
177
|
] }),
|
|
178
|
-
/* @__PURE__ */ e("div", { ref: r, className: "gx-console-body", children: n.length === 0 ? /* @__PURE__ */ e("div", { className: "gx-console-empty", children: "No logs yet..." }) : n.map((
|
|
178
|
+
/* @__PURE__ */ e("div", { ref: r, className: "gx-console-body", children: n.length === 0 ? /* @__PURE__ */ e("div", { className: "gx-console-empty", children: "No logs yet..." }) : n.map((c, t) => /* @__PURE__ */ e("div", { className: "gx-console-line", children: c }, t)) })
|
|
179
179
|
] });
|
|
180
180
|
}
|
|
181
181
|
function R({
|
|
@@ -183,33 +183,33 @@ function R({
|
|
|
183
183
|
onFilesChange: a,
|
|
184
184
|
disabled: o = !1,
|
|
185
185
|
multiple: r = !0,
|
|
186
|
-
accept:
|
|
186
|
+
accept: s = ".fasta,.fa,.fna,.fsa,.fasta.gz,.fa.gz,.fna.gz",
|
|
187
187
|
label: i = "Drop files here or click to browse",
|
|
188
|
-
hint:
|
|
189
|
-
filterFn:
|
|
188
|
+
hint: c,
|
|
189
|
+
filterFn: t
|
|
190
190
|
}) {
|
|
191
191
|
const m = x(
|
|
192
192
|
(d) => {
|
|
193
193
|
if (!d.target.files) return;
|
|
194
194
|
let h = Array.from(d.target.files);
|
|
195
|
-
|
|
195
|
+
t && (h = h.filter(t)), h.length > 0 && a(h);
|
|
196
196
|
},
|
|
197
|
-
[a,
|
|
198
|
-
),
|
|
197
|
+
[a, t]
|
|
198
|
+
), w = x(
|
|
199
199
|
(d) => {
|
|
200
200
|
if (d.preventDefault(), !d.dataTransfer.files) return;
|
|
201
201
|
let h = Array.from(d.dataTransfer.files);
|
|
202
|
-
|
|
202
|
+
t && (h = h.filter(t)), h.length > 0 && a(h);
|
|
203
203
|
},
|
|
204
|
-
[a,
|
|
204
|
+
[a, t]
|
|
205
205
|
);
|
|
206
|
-
return /* @__PURE__ */ e("div", { className: "gx-file-upload", onDrop:
|
|
206
|
+
return /* @__PURE__ */ e("div", { className: "gx-file-upload", onDrop: w, onDragOver: (d) => d.preventDefault(), children: /* @__PURE__ */ l("label", { className: "gx-file-upload-area", children: [
|
|
207
207
|
/* @__PURE__ */ e(
|
|
208
208
|
"input",
|
|
209
209
|
{
|
|
210
210
|
type: "file",
|
|
211
211
|
multiple: r,
|
|
212
|
-
accept:
|
|
212
|
+
accept: s,
|
|
213
213
|
onChange: m,
|
|
214
214
|
disabled: o
|
|
215
215
|
}
|
|
@@ -234,7 +234,7 @@ function R({
|
|
|
234
234
|
),
|
|
235
235
|
n.length === 0 ? /* @__PURE__ */ l(p, { children: [
|
|
236
236
|
/* @__PURE__ */ e("div", { className: "gx-file-upload-label", children: i }),
|
|
237
|
-
|
|
237
|
+
c && /* @__PURE__ */ e("div", { className: "gx-file-upload-hint", children: c })
|
|
238
238
|
] }) : /* @__PURE__ */ l(p, { children: [
|
|
239
239
|
/* @__PURE__ */ l("div", { className: "gx-file-upload-label", children: [
|
|
240
240
|
n.length,
|
|
@@ -267,26 +267,26 @@ const A = "https://static.genomicx.org/wasm", u = /* @__PURE__ */ new Map();
|
|
|
267
267
|
async function $(n, a = A) {
|
|
268
268
|
const o = `${a}/${n}`;
|
|
269
269
|
if (u.has(o)) return u.get(o);
|
|
270
|
-
const [r,
|
|
270
|
+
const [r, s] = await Promise.all([
|
|
271
271
|
fetch(`${a}/${n}.js`),
|
|
272
272
|
fetch(`${a}/${n}.wasm`)
|
|
273
273
|
]);
|
|
274
274
|
if (!r.ok) throw new Error(`Failed to fetch ${n}.js: ${r.status}`);
|
|
275
|
-
if (!
|
|
276
|
-
const [i,
|
|
275
|
+
if (!s.ok) throw new Error(`Failed to fetch ${n}.wasm: ${s.status}`);
|
|
276
|
+
const [i, c] = await Promise.all([
|
|
277
277
|
r.text(),
|
|
278
|
-
|
|
279
|
-
]), m = { factory: new Function("Module", i + "; return Module;")({}), wasmBinary:
|
|
278
|
+
s.arrayBuffer()
|
|
279
|
+
]), m = { factory: new Function("Module", i + "; return Module;")({}), wasmBinary: c };
|
|
280
280
|
return u.set(o, m), m;
|
|
281
281
|
}
|
|
282
282
|
async function S(n, a) {
|
|
283
|
-
const { factory: o, wasmBinary: r } = await $(n, a),
|
|
283
|
+
const { factory: o, wasmBinary: r } = await $(n, a), s = [], i = [], c = await o({
|
|
284
284
|
wasmBinary: r.slice(0),
|
|
285
|
-
print: (
|
|
286
|
-
printErr: (
|
|
285
|
+
print: (t) => s.push(t),
|
|
286
|
+
printErr: (t) => i.push(t),
|
|
287
287
|
noInitialRun: !0
|
|
288
288
|
});
|
|
289
|
-
return
|
|
289
|
+
return c._stdout = s, c._stderr = i, c;
|
|
290
290
|
}
|
|
291
291
|
function k(n, a) {
|
|
292
292
|
const o = URL.createObjectURL(n), r = document.createElement("a");
|