@genomicx/ui 0.3.0 → 0.4.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.
@@ -1,6 +1,7 @@
1
1
  interface AppFooterProps {
2
2
  appName?: string;
3
3
  onReportBug?: () => void;
4
+ bugReportUrl?: string;
4
5
  }
5
- export declare function AppFooter({ appName, onReportBug }: AppFooterProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function AppFooter({ appName, onReportBug, bugReportUrl }: AppFooterProps): import("react/jsx-runtime").JSX.Element;
6
7
  export {};
@@ -3,9 +3,11 @@ export interface NavBarProps {
3
3
  appName: string;
4
4
  appSubtitle?: string;
5
5
  version?: string;
6
+ /** Custom SVG icon element. Defaults to GenomicX rings logo. */
7
+ icon?: ReactNode;
6
8
  /** Extra items in the desktop nav (right side, before theme toggle) */
7
9
  actions?: ReactNode;
8
10
  /** Extra items in the mobile dropdown */
9
11
  mobileActions?: ReactNode;
10
12
  }
11
- export declare function NavBar({ appName, appSubtitle, version, actions, mobileActions }: NavBarProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function NavBar({ appName, appSubtitle, version, icon, actions, mobileActions }: NavBarProps): import("react/jsx-runtime").JSX.Element;
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
- import { useState as v, useRef as p } from "react";
2
+ import { useState as x, useRef as p } from "react";
3
3
  import { Link as d } from "react-router-dom";
4
4
  import g from "react-hot-toast";
5
5
  function u({ disabled: n = !1 }) {
6
- const [o, t] = v(
6
+ const [o, t] = x(
7
7
  () => document.documentElement.getAttribute("data-theme") || "dark"
8
8
  ), l = (r) => {
9
9
  t(r), document.documentElement.setAttribute("data-theme", r), localStorage.setItem("gx-theme", r);
@@ -31,16 +31,17 @@ function u({ disabled: n = !1 }) {
31
31
  )
32
32
  ] });
33
33
  }
34
- function f({ appName: n, appSubtitle: o, version: t, actions: l, mobileActions: r }) {
35
- const [c, s] = v(!1);
34
+ const f = () => /* @__PURE__ */ a("svg", { className: "gx-nav-logo-icon", viewBox: "0 0 24 24", fill: "none", stroke: "var(--gx-accent)", strokeWidth: "2", children: [
35
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
36
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "6" }),
37
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "2" })
38
+ ] });
39
+ function N({ appName: n, appSubtitle: o, version: t, icon: l, actions: r, mobileActions: i }) {
40
+ const [c, s] = x(!1);
36
41
  return /* @__PURE__ */ a("nav", { className: "gx-nav", children: [
37
42
  /* @__PURE__ */ e("div", { className: "gx-nav-inner", children: /* @__PURE__ */ a("div", { className: "gx-nav-row", children: [
38
43
  /* @__PURE__ */ a(d, { to: "/", className: "gx-nav-logo", children: [
39
- /* @__PURE__ */ a("svg", { className: "gx-nav-logo-icon", viewBox: "0 0 24 24", fill: "none", stroke: "var(--gx-accent)", strokeWidth: "2", children: [
40
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
41
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "6" }),
42
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "2" })
43
- ] }),
44
+ l ?? /* @__PURE__ */ e(f, {}),
44
45
  /* @__PURE__ */ a("div", { children: [
45
46
  /* @__PURE__ */ a("h1", { className: "gx-nav-logo-name", children: [
46
47
  n,
@@ -53,7 +54,7 @@ function f({ appName: n, appSubtitle: o, version: t, actions: l, mobileActions:
53
54
  ] })
54
55
  ] }),
55
56
  /* @__PURE__ */ a("div", { className: "gx-nav-desktop", children: [
56
- l,
57
+ r,
57
58
  /* @__PURE__ */ e(d, { to: "/about", className: "gx-nav-link", children: "About" }),
58
59
  /* @__PURE__ */ a("a", { href: "https://github.com/happykhan", target: "_blank", rel: "noopener noreferrer", className: "gx-nav-link", children: [
59
60
  "GitHub",
@@ -67,13 +68,13 @@ function f({ appName: n, appSubtitle: o, version: t, actions: l, mobileActions:
67
68
  ] })
68
69
  ] }) }),
69
70
  c && /* @__PURE__ */ a("div", { className: "gx-nav-dropdown", children: [
70
- r,
71
+ i,
71
72
  /* @__PURE__ */ e(d, { to: "/about", onClick: () => s(!1), className: "gx-nav-dropdown-link", children: "About" }),
72
73
  /* @__PURE__ */ e("a", { href: "https://github.com/happykhan", target: "_blank", rel: "noopener noreferrer", className: "gx-nav-dropdown-link", children: "GitHub ↗" })
73
74
  ] })
74
75
  ] });
75
76
  }
76
- function N({ appName: n = "GenomicX", onReportBug: o }) {
77
+ function k({ appName: n = "GenomicX", onReportBug: o, bugReportUrl: t }) {
77
78
  return /* @__PURE__ */ e("footer", { className: "gx-footer", children: /* @__PURE__ */ e("div", { className: "gx-footer-inner", children: /* @__PURE__ */ a("div", { className: "gx-footer-content", children: [
78
79
  /* @__PURE__ */ a("div", { className: "gx-footer-text", children: [
79
80
  /* @__PURE__ */ a("p", { className: "gx-footer-text-title", children: [
@@ -84,18 +85,19 @@ function N({ appName: n = "GenomicX", onReportBug: o }) {
84
85
  ] }),
85
86
  /* @__PURE__ */ a("div", { className: "gx-footer-links", children: [
86
87
  /* @__PURE__ */ e("a", { href: "https://genomicx.org", target: "_blank", rel: "noopener noreferrer", className: "gx-footer-link", children: "genomicx.org" }),
87
- o && /* @__PURE__ */ e("button", { onClick: o, className: "gx-footer-link", children: "Report Bug" })
88
+ t && /* @__PURE__ */ e("a", { href: t, target: "_blank", rel: "noopener noreferrer", className: "gx-footer-link", children: "Report Bug" }),
89
+ o && !t && /* @__PURE__ */ e("button", { onClick: o, className: "gx-footer-link", children: "Report Bug" })
88
90
  ] })
89
91
  ] }) }) });
90
92
  }
91
- function B({ children: n, onReportBug: o, ...t }) {
93
+ function C({ children: n, onReportBug: o, ...t }) {
92
94
  return /* @__PURE__ */ a("div", { style: { minHeight: "100vh", display: "flex", flexDirection: "column", background: "var(--gx-bg)" }, children: [
93
- /* @__PURE__ */ e(f, { ...t }),
95
+ /* @__PURE__ */ e(N, { ...t }),
94
96
  /* @__PURE__ */ e("main", { style: { flex: 1 }, children: n }),
95
- /* @__PURE__ */ e(N, { appName: t.appName, onReportBug: o })
97
+ /* @__PURE__ */ e(k, { appName: t.appName, onReportBug: o })
96
98
  ] });
97
99
  }
98
- function C({ logs: n, progress: o, title: t = "Console" }) {
100
+ function $({ logs: n, progress: o, title: t = "Console" }) {
99
101
  const l = p(null), r = () => {
100
102
  navigator.clipboard.writeText(n.join(`
101
103
  `)).then(() => {
@@ -103,9 +105,9 @@ function C({ logs: n, progress: o, title: t = "Console" }) {
103
105
  }).catch(() => {
104
106
  g.error("Failed to copy logs");
105
107
  });
106
- }, c = o && o.step !== "idle" && o.step !== "Complete!";
108
+ }, i = o && o.step !== "idle" && o.step !== "Complete!";
107
109
  return /* @__PURE__ */ a("div", { className: "gx-console", children: [
108
- c && /* @__PURE__ */ a("div", { className: "gx-console-progress", children: [
110
+ i && /* @__PURE__ */ a("div", { className: "gx-console-progress", children: [
109
111
  /* @__PURE__ */ a("div", { className: "gx-console-progress-row", children: [
110
112
  /* @__PURE__ */ e("span", { className: "gx-console-progress-step", children: o.step }),
111
113
  /* @__PURE__ */ a("span", { className: "gx-console-progress-pct", children: [
@@ -130,11 +132,11 @@ function C({ logs: n, progress: o, title: t = "Console" }) {
130
132
  "Copy"
131
133
  ] })
132
134
  ] }),
133
- /* @__PURE__ */ e("div", { ref: l, className: "gx-console-body", children: n.length === 0 ? /* @__PURE__ */ e("div", { className: "gx-console-empty", children: "No logs yet..." }) : n.map((s, i) => /* @__PURE__ */ e("div", { className: "gx-console-line", children: s }, i)) })
135
+ /* @__PURE__ */ e("div", { ref: l, className: "gx-console-body", children: n.length === 0 ? /* @__PURE__ */ e("div", { className: "gx-console-empty", children: "No logs yet..." }) : n.map((c, s) => /* @__PURE__ */ e("div", { className: "gx-console-line", children: c }, s)) })
134
136
  ] });
135
137
  }
136
- const k = "https://static.genomicx.org/wasm", h = /* @__PURE__ */ new Map();
137
- async function b(n, o = k) {
138
+ const b = "https://static.genomicx.org/wasm", h = /* @__PURE__ */ new Map();
139
+ async function w(n, o = b) {
138
140
  const t = `${o}/${n}`;
139
141
  if (h.has(t)) return h.get(t);
140
142
  const [l, r] = await Promise.all([
@@ -143,40 +145,40 @@ async function b(n, o = k) {
143
145
  ]);
144
146
  if (!l.ok) throw new Error(`Failed to fetch ${n}.js: ${l.status}`);
145
147
  if (!r.ok) throw new Error(`Failed to fetch ${n}.wasm: ${r.status}`);
146
- const [c, s] = await Promise.all([
148
+ const [i, c] = await Promise.all([
147
149
  l.text(),
148
150
  r.arrayBuffer()
149
- ]), m = { factory: new Function("Module", c + "; return Module;")({}), wasmBinary: s };
151
+ ]), m = { factory: new Function("Module", i + "; return Module;")({}), wasmBinary: c };
150
152
  return h.set(t, m), m;
151
153
  }
152
- async function $(n, o) {
153
- const { factory: t, wasmBinary: l } = await b(n, o), r = [], c = [], s = await t({
154
+ async function j(n, o) {
155
+ const { factory: t, wasmBinary: l } = await w(n, o), r = [], i = [], c = await t({
154
156
  wasmBinary: l.slice(0),
155
- print: (i) => r.push(i),
156
- printErr: (i) => c.push(i),
157
+ print: (s) => r.push(s),
158
+ printErr: (s) => i.push(s),
157
159
  noInitialRun: !0
158
160
  });
159
- return s._stdout = r, s._stderr = c, s;
161
+ return c._stdout = r, c._stderr = i, c;
160
162
  }
161
- function x(n, o) {
163
+ function v(n, o) {
162
164
  const t = URL.createObjectURL(n), l = document.createElement("a");
163
165
  l.href = t, l.download = o, l.click(), URL.revokeObjectURL(t);
164
166
  }
165
- function j(n, o, t = "text/plain") {
166
- x(new Blob([n], { type: t }), o);
167
+ function A(n, o, t = "text/plain") {
168
+ v(new Blob([n], { type: t }), o);
167
169
  }
168
- function A(n, o) {
169
- x(new Blob([n]), o);
170
+ function z(n, o) {
171
+ v(new Blob([n]), o);
170
172
  }
171
173
  export {
172
- N as AppFooter,
173
- B as AppShell,
174
- C as LogConsole,
175
- f as NavBar,
174
+ k as AppFooter,
175
+ C as AppShell,
176
+ $ as LogConsole,
177
+ N as NavBar,
176
178
  u as ThemeToggle,
177
- $ as createModuleInstance,
178
- x as downloadBlob,
179
- A as downloadBuffer,
180
- j as downloadText,
181
- b as loadWasmModule
179
+ j as createModuleInstance,
180
+ v as downloadBlob,
181
+ z as downloadBuffer,
182
+ A as downloadText,
183
+ w as loadWasmModule
182
184
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genomicx/ui",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Shared UI components, styles, and WASM loader for GenomicX tools",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,6 +20,7 @@
20
20
  --gx-code-bg: #f1f5f9;
21
21
  --gx-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
22
22
  --gx-transition: 0.2s ease;
23
+ --gx-max-width: 1280px;
23
24
  --gx-radius: 8px;
24
25
  --gx-radius-lg: 12px;
25
26
  }