UNPKG

taxonium-component

Version:

React component for exploring large phylogenetic trees in the browser

45 lines (44 loc) 2.23 kB
import { jsxs as n, jsx as e } from "react/jsx-runtime"; import { useState as s } from "react"; import { u as y, a as h, D as z, T as C, d as E, B as f, C as F, c as k } from "./JBrowsePanel-BNE3gNW1.js"; import { M as D } from "./MenuItem-DAMdxuDJ.js"; import { F as j } from "./FormControlLabel-CfHqydvH.js"; import { C as w } from "./Checkbox-D7_LksK2.js"; function M() { return n("div", { children: [e(F, { size: 20, style: { marginRight: 20 } }), e(C, { display: "inline", children: "Creating SVG" })] }); } function p({ children: a, ...t }) { return e("div", { children: e(k, { ...t, children: a }) }); } function v(a, t) { return y.useLocalStorage(`svg-${a}`, t); } function A({ model: a, handleClose: t }) { const o = y.getSession(a), i = typeof OffscreenCanvas < "u", [l, b] = s(i), [x, c] = s(!1), [m, u] = s(), [d, S] = v("file", "jbrowse.svg"), [g, T] = v("theme", o.themeName || "default"); return n(h.Dialog, { open: !0, onClose: t, title: "Export SVG", children: [n(z, { children: [m ? e(h.ErrorMessage, { error: m }) : x ? e(M, {}) : null, e(p, { helperText: "filename", value: d, onChange: (r) => { S(r.target.value); } }), o.allThemes ? e(p, { select: !0, label: "Theme", value: g, onChange: (r) => { T(r.target.value); }, children: Object.entries(o.allThemes()).map(([r, L]) => e(D, { value: r, children: L.name || "(Unknown name)" }, r)) }) : null, i ? e(j, { control: e(w, { checked: l, onChange: () => { b((r) => !r); } }), label: "Rasterize canvas based tracks? File may be much larger if this is turned off" }) : e(C, { children: "Note: rasterizing layers not yet supported in this browser, so SVG size may be large" })] }), n(E, { children: [e(f, { variant: "contained", color: "secondary", onClick: () => { t(); }, children: "Cancel" }), e(f, { variant: "contained", color: "primary", type: "submit", onClick: async () => { c(!0), u(void 0); try { await a.exportSvg({ rasterizeLayers: l, filename: d, themeName: g }), t(); } catch (r) { console.error(r), u(r); } finally { c(!1); } }, children: "Submit" })] })] }); } export { A as default }; //# sourceMappingURL=ExportSvgDialog-DsDN2DAJ.js.map