UNPKG

taxonium-component

Version:

React component for exploring large phylogenetic trees in the browser

38 lines (37 loc) 1.56 kB
import { jsxs as h, Fragment as m, jsx as e } from "react/jsx-runtime"; import { Fragment as B } from "react"; import { u as g, b as R, r as v, g as $ } from "./JBrowsePanel-BNE3gNW1.js"; async function F(t, d) { const { height: l, id: p } = t, { overrideHeight: x } = d, f = g.getContainingView(t), { offsetPx: w, roundedDynamicBlocks: u, width: y } = f, P = await Promise.all(u.map(async (r) => { const o = R.create({ key: r.key, region: r }), n = t.regionCannotBeRenderedText(r) || t.regionCannotBeRendered(r); if (n) return [ r, { reactElement: h(m, { children: [e("rect", { x: 0, y: 0, width: y, height: 20, fill: "#aaa" }), e("text", { x: 0, y: 15, children: n })] }) } ]; const { rpcManager: c, renderArgs: s, renderProps: i, rendererType: a } = v(o, t); return [ r, await a.renderInClient(c, { ...s, ...i, viewParams: g.getViewParams(t, !0), exportSVG: d, theme: d.theme || i.theme }) ]; })); return e(m, { children: P.map(([r, o], n) => { const { offsetPx: c, widthPx: s } = r, i = c - w, a = $(p, n); return h(B, { children: [e("defs", { children: e("clipPath", { id: a, children: e("rect", { x: 0, y: 0, width: s, height: x || l }) }) }), e("g", { transform: `translate(${i} 0)`, children: e("g", { clipPath: `url(#${a})`, children: e(g.ReactRendering, { rendering: o }) }) })] }, `frag-${n}`); }) }); } export { F as renderBaseLinearDisplaySvg }; //# sourceMappingURL=renderSvg-BzDS1-I2.js.map