UNPKG

taxonium-component

Version:

React component for exploring large phylogenetic trees in the browser

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