jbrowse-plugin-graphgenomeviewer 4.0.13 → 4.0.14

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.
Files changed (53) hide show
  1. package/README.md +5 -1
  2. package/dist/chunks/{GbzBaseSyntenyAdapter-Y5NBXK7P.js → GbzBaseSyntenyAdapter-3ZTHTTHA.js} +2 -2
  3. package/dist/chunks/{GraphGenomeView-TTQEJJQD.js → GraphGenomeView-35HMVXRP.js} +2 -2
  4. package/dist/chunks/{GraphTrackSettingsDialog-3A2PKZRI.js → GraphTrackSettingsDialog-2QV6TPX7.js} +2 -2
  5. package/dist/chunks/{LinearGraphDisplay-MJ5XZFE5.js → LinearGraphDisplay-3M3LNC5H.js} +2 -2
  6. package/dist/chunks/{MinigraphBubbleAdapter-APC7JYOM.js → MinigraphBubbleAdapter-NRDD66AK.js} +2 -2
  7. package/dist/chunks/{RgfaTabixAdapter-4E365PXO.js → RgfaTabixAdapter-NQEERXXI.js} +2 -2
  8. package/dist/chunks/{chunk-5DP7IXD3.js → chunk-33VHHB43.js} +2 -2
  9. package/dist/chunks/{chunk-LA7MQS33.js → chunk-5E7TVPCI.js} +2 -2
  10. package/dist/chunks/chunk-IUIIYSGF.js +2 -0
  11. package/dist/chunks/{chunk-M4YEAXSR.js.map → chunk-IUIIYSGF.js.map} +3 -3
  12. package/dist/chunks/chunk-JXAJ7YLT.js +2 -0
  13. package/dist/chunks/chunk-JXAJ7YLT.js.map +7 -0
  14. package/dist/chunks/chunk-KULNKXPT.js +2 -0
  15. package/dist/chunks/chunk-KULNKXPT.js.map +7 -0
  16. package/dist/chunks/chunk-QSH263Y6.js +2 -0
  17. package/dist/chunks/chunk-QSH263Y6.js.map +7 -0
  18. package/dist/chunks/chunk-UQEPPJEO.js +2 -0
  19. package/dist/chunks/{chunk-VAGPKHHS.js.map → chunk-UQEPPJEO.js.map} +3 -3
  20. package/dist/chunks/chunk-YWJ3RWYB.js +4 -0
  21. package/dist/chunks/chunk-YWJ3RWYB.js.map +7 -0
  22. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +2 -2
  23. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +3 -3
  24. package/package.json +2 -2
  25. package/src/GraphGenomeView/components/BubbleHalos.tsx +67 -3
  26. package/src/GraphGenomeView/components/BubbleOverlay.tsx +6 -0
  27. package/src/GraphGenomeView/components/GraphCanvas.tsx +46 -9
  28. package/src/GraphGenomeView/components/LabelChip.tsx +9 -1
  29. package/src/GraphGenomeView/components/LabelLayer.tsx +3 -0
  30. package/src/GraphGenomeView/components/ReferenceStripOverlay.tsx +116 -0
  31. package/src/GraphGenomeView/components/TubeMapOverlay.tsx +109 -41
  32. package/src/GraphGenomeView/model.test.ts +3 -0
  33. package/src/GraphGenomeView/model.ts +204 -43
  34. package/src/LinearGraphDisplay/model.ts +2 -0
  35. package/src/version.ts +1 -1
  36. package/dist/chunks/chunk-CJ56O2VG.js +0 -2
  37. package/dist/chunks/chunk-CJ56O2VG.js.map +0 -7
  38. package/dist/chunks/chunk-IFRDWMQ2.js +0 -2
  39. package/dist/chunks/chunk-IFRDWMQ2.js.map +0 -7
  40. package/dist/chunks/chunk-M4YEAXSR.js +0 -2
  41. package/dist/chunks/chunk-MUK3KYB4.js +0 -2
  42. package/dist/chunks/chunk-MUK3KYB4.js.map +0 -7
  43. package/dist/chunks/chunk-VAGPKHHS.js +0 -2
  44. package/dist/chunks/chunk-XDOIZTY6.js +0 -4
  45. package/dist/chunks/chunk-XDOIZTY6.js.map +0 -7
  46. /package/dist/chunks/{GbzBaseSyntenyAdapter-Y5NBXK7P.js.map → GbzBaseSyntenyAdapter-3ZTHTTHA.js.map} +0 -0
  47. /package/dist/chunks/{GraphGenomeView-TTQEJJQD.js.map → GraphGenomeView-35HMVXRP.js.map} +0 -0
  48. /package/dist/chunks/{GraphTrackSettingsDialog-3A2PKZRI.js.map → GraphTrackSettingsDialog-2QV6TPX7.js.map} +0 -0
  49. /package/dist/chunks/{LinearGraphDisplay-MJ5XZFE5.js.map → LinearGraphDisplay-3M3LNC5H.js.map} +0 -0
  50. /package/dist/chunks/{MinigraphBubbleAdapter-APC7JYOM.js.map → MinigraphBubbleAdapter-NRDD66AK.js.map} +0 -0
  51. /package/dist/chunks/{RgfaTabixAdapter-4E365PXO.js.map → RgfaTabixAdapter-NQEERXXI.js.map} +0 -0
  52. /package/dist/chunks/{chunk-5DP7IXD3.js.map → chunk-33VHHB43.js.map} +0 -0
  53. /package/dist/chunks/{chunk-LA7MQS33.js.map → chunk-5E7TVPCI.js.map} +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["global-externals:@jbrowse/render-core/useRenderingBackend", "global-externals:@jbrowse/render-core/renderingBackendBase", "../../src/GraphGenomeView/components/GraphCanvas.tsx", "../../packages/core/src/util/SpatialIndex.ts", "../../packages/core/src/util/hitDetection.ts", "../../packages/core/src/util/wheelZoom.ts", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/Info.mjs", "../../src/GraphGenomeView/components/BubbleHalos.tsx", "../../src/GraphGenomeView/components/BubbleOverlay.tsx", "../../src/GraphGenomeView/components/GenePins.tsx", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/CropFree.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/ZoomIn.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/ZoomOut.mjs", "../../src/GraphGenomeView/components/GraphToolbar.tsx", "../../src/GraphGenomeView/components/ColorSchemeSelect.tsx", "../../src/GraphGenomeView/components/GraphStats.tsx", "../../src/GraphGenomeView/components/LayoutSelect.tsx", "../../src/GraphGenomeView/components/RepeatSelect.tsx", "../../src/GraphGenomeView/components/SettingsMenu.tsx", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/Delete.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/MoreVert.mjs", "../../src/GraphGenomeView/components/WalkSelect.tsx", "../../src/GraphGenomeView/components/LabelLayer.tsx", "../../src/GraphGenomeView/components/LabelChip.tsx", "../../src/GraphGenomeView/components/TubeMapOverlay.tsx", "../../src/GraphGenomeView/components/WalkRowsOverlay.tsx", "../../src/GraphGenomeView/components/referenceRampCss.ts", "../../packages/core/src/renderer/Canvas2DRenderer.ts", "../../src/GraphGenomeView/renderer/GraphRenderer.ts"],
4
- "sourcesContent": ["module.exports = JBrowseExports[\"@jbrowse/render-core/useRenderingBackend\"];", "module.exports = JBrowseExports[\"@jbrowse/render-core/renderingBackendBase\"];", "import { useEffect, useRef, useState } from 'react'\n\nimport { formatBp } from '@jbrowse/bandage-core/graphLabels'\nimport { LEGEND_INSET_PX } from '@jbrowse/bandage-core/labelLayout'\nimport {\n findHoveredEdge,\n findHoveredNode,\n} from '@jbrowse/bandage-core/util/hitDetection'\nimport { wheelZoomFactor } from '@jbrowse/bandage-core/util/wheelZoom'\nimport { ErrorBanner, LoadingOverlay, Menu } from '@jbrowse/core/ui'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\nimport { useRenderingBackend } from '@jbrowse/render-core/useRenderingBackend'\nimport InfoIcon from '@mui/icons-material/Info'\nimport { observer } from 'mobx-react'\n\nimport BubbleHalos from './BubbleHalos'\nimport BubbleOverlay from './BubbleOverlay'\nimport GenePins from './GenePins'\nimport GraphToolbar from './GraphToolbar'\nimport LabelLayer from './LabelLayer'\nimport TubeMapOverlay, { TubeMapLegend } from './TubeMapOverlay'\nimport WalkRowsOverlay, { WalkRowsLegend } from './WalkRowsOverlay'\nimport { RAMP_GRADIENT_CSS } from './referenceRampCss'\nimport { locLabel, nodeOwnLocation } from '../../launchFromGraph/contributors'\nimport { nodeLaunchMenuItems } from '../../launchFromGraph/graphMenuItems'\nimport { createGraphRenderer } from '../renderer/GraphRenderer'\n\nimport type { GraphPaneModel } from '../model'\n\n// Bottom RIGHT, not bottom left: the row labels of a row-structured layout are\n// pinned to the left edge, so a bottom-left tooltip lands on top of them and\n// covers the one thing that says which haplotype a row is. Nothing is drawn\n// against the right edge.\nconst tooltipStyle = {\n position: 'absolute' as const,\n bottom: 8,\n right: 8,\n background: 'rgba(0,0,0,0.75)',\n color: 'white',\n padding: '4px 8px',\n borderRadius: 4,\n fontSize: 12,\n pointerEvents: 'none' as const,\n}\n\nconst wrapperStyle = { position: 'relative' as const }\n\n// The overlay origin has to be the canvas, not the wrapper: the wrapper also\n// holds the toolbar, so anything positioned against it is offset by the\n// toolbar's height, and a row label lands a whole row off the row it names.\nconst canvasAreaStyle = { position: 'relative' as const, lineHeight: 0 }\n\n// Above the labels, pins and legends drawn over the canvas, and with the line\n// height the canvas area zeroes, which would collapse the overlay's label\nconst loadingLayerStyle = {\n position: 'absolute' as const,\n inset: 0,\n zIndex: 10,\n lineHeight: 'normal',\n pointerEvents: 'none' as const,\n}\n\nconst rowLabelStyle = {\n position: 'absolute' as const,\n left: 6,\n transform: 'translateY(-50%)',\n background: 'rgba(255,255,255,0.82)',\n padding: '0 4px',\n borderRadius: 3,\n fontSize: 11,\n // explicit, because the canvas container zeroes line-height to kill the\n // inline-block gap under the canvas. Inherited, that collapses the label to a\n // zero-height box: it still paints, but it has no layout, so anything asking\n // whether it is visible (a screenshot spec's waitForVisible, a11y tooling)\n // is told no.\n lineHeight: '16px',\n whiteSpace: 'nowrap' as const,\n pointerEvents: 'none' as const,\n zIndex: 4,\n}\n\n// Names the rows of a row-structured layout (anchored, sample rows). Without\n// them the layout draws real structure that cannot be read: a stack of bars\n// where every row means something and nothing says what.\n//\n// Positioned from the layout's own `rowLabels` through the same transform the\n// canvas draws with, so a label tracks its row across pan and zoom instead of\n// sitting at a measured pixel. It therefore has to be mounted in the canvas's\n// own positioning context (canvasAreaStyle) \u2014 against the wrapper it picks up\n// the toolbar's height and names the wrong row. Pinned to the left edge rather\n// than to the row's own x, because a row's leftmost node is wherever its first\n// allele happens to branch. Rows scrolled out of the canvas are dropped rather\n// than clamped to the edge, so a label never points at a row that is not\n// there.\nconst RowLabels = observer(function RowLabels({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const rowLabels = model.drawnRowLabels\n return (\n <>\n {rowLabels.map(({ label, y }) => {\n const screenY = y * model.scaleY + model.translateY\n return screenY >= 0 && screenY <= model.canvasHeight ? (\n // Keyed on the row, not on the label: two rows can carry the same\n // words. The sample-row layout names row 0 for the assembly the\n // backbone comes from and the rows below it for the samples\n // contributing alleles, and a diploid reference is in both lists \u2014\n // one haplotype is the reference path, the other walks alleles of its\n // own, and `parsePanSN` reduces both to one sample name.\n <div\n key={y}\n data-testid=\"graph-row-label\"\n style={{ ...rowLabelStyle, top: screenY }}\n >\n {label}\n </div>\n ) : null\n })}\n </>\n )\n})\n\n// Top RIGHT: the row labels own the left edge and the hover tooltip owns the\n// bottom right, so this is the one corner nothing else claims. A row-structured\n// layout draws its band across the middle, which is what the keys are for. The\n// two keys stack rather than each claiming the corner, since a path-coloured\n// graph can also be reference-position coloured.\nconst legendStackStyle = {\n position: 'absolute' as const,\n top: LEGEND_INSET_PX,\n right: LEGEND_INSET_PX,\n display: 'flex',\n flexDirection: 'column' as const,\n alignItems: 'flex-end',\n gap: 4,\n pointerEvents: 'none' as const,\n zIndex: 4,\n}\n\nconst legendBoxStyle = {\n background: 'rgba(255,255,255,0.82)',\n padding: '4px 6px',\n borderRadius: 3,\n fontSize: 11,\n lineHeight: '15px',\n whiteSpace: 'nowrap' as const,\n}\n\nconst pathLegendRowStyle = { display: 'flex', alignItems: 'center', gap: 5 }\n\nconst pathSwatchStyle = { width: 18, height: 3, borderRadius: 2 }\n\n// Which haplotype each ribbon colour is. The ribbons are one stroke per path\n// fanned across every edge the path crosses, so without this the drawing states\n// that the alleles are taken by *different* samples and never which.\nconst PathLegend = observer(function PathLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { pathLegend } = model\n return pathLegend.length > 0 ? (\n <div style={legendBoxStyle} data-testid=\"graph-path-legend\">\n {pathLegend.map(({ name, label, color }) => (\n <div key={name} style={pathLegendRowStyle}>\n <div style={{ ...pathSwatchStyle, backgroundColor: color }} />\n <span>{label}</span>\n </div>\n ))}\n </div>\n ) : null\n})\n\n// What the lifted walk carries through the window, against the reference walk\n// where the graph has one: the number the array's loops are drawn for.\nconst WalkReadout = observer(function WalkReadout({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const h = model.walkHighlight\n if (!h) {\n return null\n }\n const label = model.walkChoices.find(c => c.name === h.name)?.label ?? h.name\n const delta =\n h.referenceBp === undefined\n ? ''\n : h.bp === h.referenceBp\n ? ', the reference length'\n : `, ${h.bp > h.referenceBp ? '+' : '\u2212'}${Math.abs(h.bp - h.referenceBp).toLocaleString()} bp against the reference`\n return (\n <div style={legendBoxStyle} data-testid=\"graph-walk-readout\">\n <strong>{label}</strong>: {h.steps.toLocaleString()} steps,{' '}\n {h.bp.toLocaleString()} bp{delta}\n </div>\n )\n})\n\n// The reference-position ramp, as a strip labelled with the interval it runs\n// over. Nothing on screen used to say that red-to-magenta means left-to-right of\n// the cut window, so two tutorials carried that sentence in prose and a reader\n// arriving at a figure had no way to know it at all.\nconst rampStripStyle = {\n minWidth: 90,\n height: 8,\n borderRadius: 2,\n background: RAMP_GRADIENT_CSS,\n}\n\nconst rampEndsStyle = {\n display: 'flex',\n justifyContent: 'space-between',\n gap: 8,\n}\n\nconst ReferenceRampLegend = observer(function ReferenceRampLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const domain = model.referenceRampDomain\n return domain ? (\n <div style={legendBoxStyle} data-testid=\"graph-ramp-legend\">\n <div style={rampStripStyle} />\n <div style={rampEndsStyle}>\n <span>{domain.start.toLocaleString()}</span>\n <span>({formatBp(domain.end - domain.start)})</span>\n <span>{domain.end.toLocaleString()}</span>\n </div>\n </div>\n ) : null\n})\n\nconst nodeLabelStyle = {\n position: 'absolute' as const,\n transform: 'translate(-50%, -50%)',\n background: 'rgba(255,255,255,0.78)',\n padding: '0 3px',\n borderRadius: 3,\n fontSize: 10,\n lineHeight: '13px',\n whiteSpace: 'nowrap' as const,\n pointerEvents: 'none' as const,\n zIndex: 3,\n}\n\n// Matches EDGE_DELETION_COLOR, so the words and the arc they name are one thing.\nconst deletionLabelStyle = {\n ...nodeLabelStyle,\n color: '#18181c',\n fontWeight: 600,\n}\n\n// Under the labels (z 3) and over the canvas, so a leader runs beneath the text\n// it points from rather than across it. `overflow: visible` because a label\n// displaced past the canvas edge is culled by the placement, not clipped here.\nconst leaderStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'visible' as const,\n zIndex: 2,\n}\n\n// Measures itself for the model, so no label is placed under a legend and\n// none gives way to one that is not drawn.\nconst Legends = observer(function Legends({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLDivElement>(null)\n useEffect(() => {\n const el = ref.current\n if (!el) {\n return\n }\n // the last callback can land after the track is closed\n const observer = new ResizeObserver(() => {\n if (isAlive(model)) {\n model.setLegendSize({ width: el.offsetWidth, height: el.offsetHeight })\n }\n })\n observer.observe(el)\n return () => {\n observer.disconnect()\n }\n }, [model])\n return (\n <div ref={ref} style={legendStackStyle}>\n <ReferenceRampLegend model={model} />\n <PathLegend model={model} />\n <TubeMapLegend model={model} />\n <WalkRowsLegend model={model} />\n <WalkReadout model={model} />\n </div>\n )\n})\n\n// Writes each drawn thing's size onto it, which is what Bandage's Length label\n// does and what the tooltip alone could not: a graph you have to hover to read\n// is a graph nobody reads. graphLabels applies the same transform the canvas\n// draws with \u2014 so a label tracks its node across pan and zoom \u2014 and decides\n// which labels fit; this only paints them, mounted in the canvas's own\n// positioning context for the reason RowLabels is.\nconst GraphSizeLabels = observer(function GraphSizeLabels({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const labels = model.overlayLabels.sizes\n // A label too wide for the arc it names is placed clear of it and tethered\n // back; nothing else in the drawing carries one.\n const leaders = labels.flatMap(({ key, leader }) =>\n leader ? [{ key, ...leader }] : [],\n )\n return (\n <>\n {leaders.length > 0 ? (\n <svg\n style={leaderStyle}\n width={model.paneWidth}\n height={model.canvasHeight}\n >\n {leaders.map(({ key, arcX, arcY, labelX, labelY }) => (\n <line\n key={key}\n data-testid=\"graph-label-leader\"\n x1={arcX}\n y1={arcY}\n x2={labelX}\n y2={labelY}\n stroke=\"#18181c\"\n strokeWidth={1}\n />\n ))}\n </svg>\n ) : null}\n {labels.map(({ key, text, x, y, kind }) => (\n <div\n key={key}\n data-testid=\"graph-size-label\"\n style={{\n ...(kind === 'deletion' ? deletionLabelStyle : nodeLabelStyle),\n left: x,\n top: y,\n }}\n >\n {text}\n </div>\n ))}\n </>\n )\n})\n\nconst HoverTooltips = observer(function HoverTooltips({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const hoveredNodeData = model.hoveredNode\n ? model.nodeById?.get(model.hoveredNode)\n : null\n\n const hoveredEdgeData =\n model.hoveredEdge !== null && model.graph\n ? model.graph.edges[model.hoveredEdge]\n : null\n\n const ownLocation = hoveredNodeData\n ? nodeOwnLocation(hoveredNodeData)\n : undefined\n\n const hoveredDeletion =\n model.hoveredEdge === null\n ? undefined\n : model.deletions.find(d => d.edgeIndex === model.hoveredEdge)\n\n return (\n <>\n {hoveredNodeData ? (\n <div style={tooltipStyle}>\n <strong>{hoveredNodeData.name}</strong> \u2014 length:{' '}\n {hoveredNodeData.length.toLocaleString()}, depth:{' '}\n {hoveredNodeData.depth.toFixed(1)}\n {/* Which assembly contributed this segment, and where it sits on it.\n rGFA states both, and until now neither reached the screen: the\n node was a bare id in a picture. */}\n {ownLocation ? (\n <>\n <br />\n {ownLocation.sample} {locLabel(ownLocation)} (rank{' '}\n {hoveredNodeData.stable?.rank})\n </>\n ) : null}\n </div>\n ) : null}\n {hoveredEdgeData ? (\n <div style={tooltipStyle}>\n {/* A deletion edge is the one link that means something on its own \u2014\n the backbone it skips is sequence some haplotype does not carry \u2014\n so it says how much rather than just naming its endpoints. */}\n {hoveredDeletion ? (\n <>\n <strong>Deletion</strong> {hoveredDeletion.bp.toLocaleString()} bp\n <br />\n {hoveredDeletion.refName}:{hoveredDeletion.start.toLocaleString()}\n -{hoveredDeletion.end.toLocaleString()}\n </>\n ) : (\n <>\n Edge: {hoveredEdgeData.from} \u2192 {hoveredEdgeData.to}\n </>\n )}\n </div>\n ) : null}\n </>\n )\n})\n\n// Flat rather than under a \"Launch view\" submenu: this menu is two or three\n// items long and every one of them is contextual to the node just clicked. The\n// submenu grouping earns its keep in the long view and track menus.\nconst NodeContextMenu = observer(function NodeContextMenu({\n model,\n nodeId,\n top,\n left,\n onClose,\n}: {\n model: GraphPaneModel\n nodeId: string\n top: number\n left: number\n onClose: () => void\n}) {\n const { own, reference, highlight } = model.nodeLaunchTargets(nodeId)\n return (\n <Menu\n open\n anchorReference=\"anchorPosition\"\n anchorPosition={{ top, left }}\n onClose={() => {\n onClose()\n }}\n onMenuItemClick={callback => {\n callback()\n }}\n menuItems={[\n {\n label: 'Node details',\n icon: InfoIcon,\n onClick: () => {\n model.showNodeDetails(nodeId)\n },\n },\n ...nodeLaunchMenuItems({\n own,\n reference,\n highlight,\n onShowLinear: target => {\n model.showInLinearView(target)\n },\n onHighlight: model.canHighlightInLinearView\n ? target => {\n model.highlightInLinearView(target)\n }\n : undefined,\n }),\n ]}\n />\n )\n})\n\n// `ownChrome` false for a pane inside a track, whose controls, loading state\n// and errors are the track's. A hosted pane whose x the host places takes no pan or wheel of its\n// own: those are the linear view's, as on any other track. One drawing its\n// own coordinates inside a track keeps them, and keeps them from the view.\nconst GraphCanvas = observer(function GraphCanvas({\n model,\n ownChrome = true,\n}: {\n model: GraphPaneModel\n ownChrome?: boolean\n}) {\n const {\n canvasRef,\n canvas,\n error: renderError,\n retry: retryRender,\n } = useRenderingBackend(createGraphRenderer, model)\n // Where the pointer was last, and whether it has travelled since mousedown \u2014\n // per-gesture scratch that nothing renders from, which is what a ref is for.\n // Whether a drag is in progress is model state (`isPanning`/`draggingNode`),\n // because the cursor renders from it.\n const lastMouseRef = useRef({ x: 0, y: 0 })\n const hasMovedRef = useRef(false)\n // A pan and a hover are applied once per frame, not once per mousemove:\n // mousemove fires in bursts well above the frame rate, and each pan step\n // repainted the canvas and re-placed every overlay label, while each hover\n // step ran both hit indexes. The pending pan is the summed delta; the pending\n // hover is the last pointer position, since only the last one can be right.\n const pendingRef = useRef<{\n frame: number\n pan: { dx: number; dy: number } | null\n hover: { x: number; y: number } | null\n }>({ frame: 0, pan: null, hover: null })\n useEffect(\n () => () => {\n cancelAnimationFrame(pendingRef.current.frame)\n },\n [],\n )\n const [contextNode, setContextNode] = useState<\n { nodeId: string; top: number; left: number } | undefined\n >(undefined)\n\n // wheel events need passive:false to call preventDefault \u2014 React registers\n // wheel listeners as passive, so we must add this imperatively\n useEffect(() => {\n if (canvas) {\n const c = canvas\n function handleWheel(e: WheelEvent) {\n if (model.hostPlacesX) {\n return\n }\n if (model.host) {\n e.stopPropagation()\n }\n e.preventDefault()\n const rect = c.getBoundingClientRect()\n model.zoom(\n wheelZoomFactor(e),\n e.clientX - rect.left,\n e.clientY - rect.top,\n )\n }\n c.addEventListener('wheel', handleWheel, { passive: false })\n return () => {\n c.removeEventListener('wheel', handleWheel)\n }\n }\n return undefined\n }, [canvas, model])\n\n function screenToGraph(screenX: number, screenY: number) {\n return {\n x: (screenX - model.translateX) / model.scaleX,\n y: (screenY - model.translateY) / model.scaleY,\n }\n }\n\n function getMouseCoord(e: React.MouseEvent) {\n const rect = (e.currentTarget as HTMLCanvasElement).getBoundingClientRect()\n return screenToGraph(e.clientX - rect.left, e.clientY - rect.top)\n }\n\n // The node at a graph coordinate, which mousedown, mousemove and click all\n // need. Takes the coordinate rather than the event so a caller that already\n // has one does not pay for a second getBoundingClientRect.\n function nodeAt(x: number, y: number) {\n const { nodePositions } = model\n if (model.layoutResult?.tubeMap) {\n return model.tubeMapNodeAt(\n x * model.scaleX + model.translateX,\n y * model.scaleY + model.translateY,\n )\n }\n return nodePositions\n ? findHoveredNode(\n nodePositions,\n x,\n y,\n model.axisScale,\n model.positionsVersion,\n model.nodeInk,\n )\n : null\n }\n\n function handleMouseDown(e: React.MouseEvent) {\n if (e.button === 0) {\n hasMovedRef.current = false\n if (model.hostPlacesX) {\n return\n }\n if (model.host) {\n e.stopPropagation()\n }\n const { x, y } = getMouseCoord(e)\n // a tube map's boxes are the layout's, not positions to drag\n const node = model.layoutResult?.tubeMap ? null : nodeAt(x, y)\n if (node) {\n model.setDraggingNode(node)\n } else {\n model.setPanning(true)\n }\n lastMouseRef.current = { x: e.clientX, y: e.clientY }\n }\n }\n\n function applyPending() {\n const pending = pendingRef.current\n pending.frame = 0\n if (pending.pan) {\n model.setTransform(\n model.scale,\n model.translateX + pending.pan.dx,\n model.translateY + pending.pan.dy,\n )\n pending.pan = null\n }\n if (pending.hover && model.nodePositions && model.graph) {\n const { x, y } = screenToGraph(pending.hover.x, pending.hover.y)\n pending.hover = null\n const node = nodeAt(x, y)\n model.setHoveredNode(node)\n model.setHoveredEdge(\n node || model.layoutResult?.tubeMap\n ? null\n : findHoveredEdge(\n model.nodePositions,\n model.graph,\n x,\n y,\n model.axisScale,\n // resolved, so the hit index bounds the ribbons that are\n // actually drawn \u2014 see effectiveDrawPaths\n model.effectiveDrawPaths,\n model.positionsVersion,\n model.deletionEdgeIndexes,\n model.hiddenEdgeIndexes,\n ),\n )\n }\n }\n\n function scheduleFrame() {\n if (!pendingRef.current.frame) {\n pendingRef.current.frame = requestAnimationFrame(applyPending)\n }\n }\n\n function dropPending() {\n const pending = pendingRef.current\n cancelAnimationFrame(pending.frame)\n pending.frame = 0\n pending.pan = null\n pending.hover = null\n }\n\n function handleMouseMove(e: React.MouseEvent) {\n const dx = e.clientX - lastMouseRef.current.x\n const dy = e.clientY - lastMouseRef.current.y\n lastMouseRef.current = { x: e.clientX, y: e.clientY }\n\n if (Math.abs(dx) > 1 || Math.abs(dy) > 1) {\n hasMovedRef.current = true\n }\n\n const pending = pendingRef.current\n if (model.draggingNode) {\n model.moveNode(model.draggingNode, dx / model.scaleX, dy / model.scaleY)\n } else if (model.isPanning) {\n pending.pan = {\n dx: (pending.pan?.dx ?? 0) + dx,\n dy: (pending.pan?.dy ?? 0) + dy,\n }\n scheduleFrame()\n } else {\n const rect = (\n e.currentTarget as HTMLCanvasElement\n ).getBoundingClientRect()\n pending.hover = { x: e.clientX - rect.left, y: e.clientY - rect.top }\n scheduleFrame()\n }\n }\n\n function handleMouseUp() {\n model.stopDragging()\n }\n\n function handleMouseLeave() {\n dropPending()\n model.stopDragging()\n model.setHoveredNode(null)\n model.setHoveredEdge(null)\n }\n\n // Right-clicking a node is the gesture that asks \"where is this?\", and until\n // now the graph had no answer: a node named an assembly and an offset in its\n // tags that nothing surfaced. The items come from the model's launch targets,\n // so what is offered is what can actually be opened.\n function handleContextMenu(e: React.MouseEvent) {\n const { x, y } = getMouseCoord(e)\n const node = nodeAt(x, y)\n if (node) {\n e.preventDefault()\n setContextNode({ nodeId: node, top: e.clientY, left: e.clientX })\n }\n }\n\n function handleClick(e: React.MouseEvent) {\n // a click that ended a drag selects nothing\n if (!hasMovedRef.current) {\n const { x, y } = getMouseCoord(e)\n const node = nodeAt(x, y)\n model.setSelectedNode(node)\n if (node) {\n model.showNodeDetails(node)\n }\n }\n }\n\n return (\n <div style={wrapperStyle}>\n {ownChrome ? <GraphToolbar model={model} /> : null}\n\n <div style={canvasAreaStyle}>\n <canvas\n ref={canvasRef}\n data-testid=\"graph-genome-canvas\"\n style={{\n width: model.paneWidth,\n height: model.canvasHeight,\n cursor: model.isPanning || model.draggingNode ? 'grabbing' : 'grab',\n display: 'block',\n }}\n onMouseDown={handleMouseDown}\n onMouseMove={handleMouseMove}\n onMouseUp={handleMouseUp}\n onMouseLeave={handleMouseLeave}\n onClick={handleClick}\n onContextMenu={handleContextMenu}\n />\n\n <TubeMapOverlay model={model} />\n <RowLabels model={model} />\n <GraphSizeLabels model={model} />\n <BubbleHalos model={model} />\n <GenePins model={model} />\n <LabelLayer model={model} />\n <BubbleOverlay model={model} />\n <WalkRowsOverlay model={model} />\n <Legends model={model} />\n\n {ownChrome ? (\n <div style={loadingLayerStyle}>\n <LoadingOverlay\n isVisible={model.isLoading}\n immediate={!model.layoutResult}\n statusMessage={model.statusMessage}\n onCancel={\n model.canCancelLoad\n ? () => {\n model.cancelLoad()\n }\n : undefined\n }\n />\n </div>\n ) : null}\n </div>\n\n <HoverTooltips model={model} />\n\n {contextNode ? (\n <NodeContextMenu\n model={model}\n nodeId={contextNode.nodeId}\n top={contextNode.top}\n left={contextNode.left}\n onClose={() => {\n setContextNode(undefined)\n }}\n />\n ) : null}\n\n {renderError ? (\n <ErrorBanner error={renderError} onReset={retryRender} />\n ) : null}\n\n {ownChrome && model.error ? (\n <ErrorBanner\n error={model.error}\n onReset={\n model.canRetryLoad\n ? () => {\n model.retryLoad()\n }\n : undefined\n }\n />\n ) : null}\n </div>\n )\n})\n\nexport default GraphCanvas\n", "import { baseEdgeCurves } from './edgeCurves'\nimport { curveBounds, pathRibbonOffsets } from './geometry'\n\nimport type { EdgeCurves } from './edgeCurves'\nimport type { Graph, NodeSegment } from '../types'\nimport type { AxisScale } from './geometry'\n\ninterface CellEntry {\n nodeId: string\n segmentIdx: number\n}\n\n// A uniform grid only performs when its cells are about the size of the things\n// in them: too large and every query scans a crowd, too small and every item is\n// stamped into hundreds of cells. World units here are whatever the layout uses,\n// and the two differ by orders of magnitude \u2014 the force layout's are screen-ish\n// (nodes ~8 units long), while the reference-anchored layouts put x in bp, so a\n// 100 kb window is 100,000 units wide. A fixed 50 was tuned for the first and\n// left the second stamping each edge into hundreds of cells: measured 7.2 ms to\n// index 800 bp-scale edges, against 2.8 ms for 8,000 screen-scale ones.\n//\n// So the size is derived from the mean extent of the items being indexed \u2014\n// **per axis**, for the reason the query radius below is already per axis: on a\n// row layout x is bp and y is screen px, and one size taken from the two summed\n// is the x size. Applied to y it swallowed every row into one cell, so the grid\n// degenerated to a 1-D index on x and each query handed the distance loop every\n// row in the band. On HPRC's rGFA, whose mean segment is ~7 kb against a 20 px\n// row pitch, that is all of them.\nconst FALLBACK_CELL_SIZE = 50\n\nexport interface CellSize {\n x: number\n y: number\n}\n\nfunction meanExtentCellSize(extentTotal: number, count: number) {\n return count > 0 ? Math.max(1, extentTotal / count) : FALLBACK_CELL_SIZE\n}\n\n// The y size for the layouts whose items have no y extent of their own. Every\n// row there is a horizontal line, so the mean per-item extent is exactly zero\n// and says nothing about how the rows are spaced. What separates them is the\n// ROW PITCH, which is their spread over the number of rows they occupy.\nfunction rowPitchOf(boxes: { minY: number }[]) {\n const distinct = new Set<number>()\n let min = Infinity\n let max = -Infinity\n for (const box of boxes) {\n distinct.add(box.minY)\n min = Math.min(min, box.minY)\n max = Math.max(max, box.minY)\n }\n return distinct.size > 1 ? (max - min) / (distinct.size - 1) : undefined\n}\n\n// A row layout with one row has nothing to separate on y, so it takes the x\n// size and lands in one cell rather than being stamped across thousands.\nfunction cellSizeFrom(\n boxes: { minY: number }[],\n extentX: number,\n extentY: number,\n): CellSize {\n const x = meanExtentCellSize(extentX, boxes.length)\n return {\n x,\n y:\n extentY > 0\n ? meanExtentCellSize(extentY, boxes.length)\n : (rowPitchOf(boxes) ?? x),\n }\n}\n\nfunction resolveCellSize(\n given: number | CellSize | undefined,\n boxes: { minY: number }[],\n extentX: number,\n extentY: number,\n): CellSize {\n return given === undefined\n ? cellSizeFrom(boxes, extentX, extentY)\n : typeof given === 'number'\n ? { x: given, y: given }\n : given\n}\n\nfunction getOrCreateCell<T>(\n cells: Map<number, Map<number, T[]>>,\n cx: number,\n cy: number,\n) {\n let row = cells.get(cx)\n if (!row) {\n row = new Map()\n cells.set(cx, row)\n }\n let cell = row.get(cy)\n if (!cell) {\n cell = []\n row.set(cy, cell)\n }\n return cell\n}\n\nfunction addToGrid<T>(\n cells: Map<number, Map<number, T[]>>,\n cellSize: CellSize,\n minX: number,\n minY: number,\n maxX: number,\n maxY: number,\n entry: T,\n) {\n const cx0 = Math.floor(minX / cellSize.x)\n const cx1 = Math.floor(maxX / cellSize.x)\n const cy0 = Math.floor(minY / cellSize.y)\n const cy1 = Math.floor(maxY / cellSize.y)\n for (let cx = cx0; cx <= cx1; cx++) {\n for (let cy = cy0; cy <= cy1; cy++) {\n getOrCreateCell(cells, cx, cy).push(entry)\n }\n }\n}\n\n// The radius is per axis because the two axes need not be in the same units: a\n// row layout's x is bp and its y is screen px, so the same 5 px of slack is\n// hundreds of bp one way and 5 the other. Passing the x radius on both axes\n// would sweep every row in the band into the candidate set.\nfunction queryGrid<T>(\n cells: Map<number, Map<number, T[]>>,\n cellSize: CellSize,\n x: number,\n y: number,\n radiusX: number,\n radiusY: number,\n): T[] {\n const cx0 = Math.floor((x - radiusX) / cellSize.x)\n const cx1 = Math.floor((x + radiusX) / cellSize.x)\n const cy0 = Math.floor((y - radiusY) / cellSize.y)\n const cy1 = Math.floor((y + radiusY) / cellSize.y)\n const results: T[] = []\n const seen = new Set<T>()\n for (let cx = cx0; cx <= cx1; cx++) {\n const row = cells.get(cx)\n if (row) {\n for (let cy = cy0; cy <= cy1; cy++) {\n const cell = row.get(cy)\n if (cell) {\n for (const entry of cell) {\n if (!seen.has(entry)) {\n seen.add(entry)\n results.push(entry)\n }\n }\n }\n }\n }\n }\n return results\n}\n\nexport class SpatialIndex {\n private cellSize: CellSize\n private cells = new Map<number, Map<number, CellEntry[]>>()\n\n constructor(\n nodePositions: Record<string, NodeSegment[]>,\n // one number sets both axes, which is what a test that only cares about\n // bucketing wants\n cellSize?: number | CellSize,\n ) {\n // Segment boxes are collected first so the cell size can come from their\n // mean extent; the grid itself needs the size up front.\n const boxes: {\n entry: CellEntry\n minX: number\n minY: number\n maxX: number\n maxY: number\n }[] = []\n let extentX = 0\n let extentY = 0\n for (const [nodeId, segments] of Object.entries(nodePositions)) {\n for (let i = 0; i < segments.length - 1; i++) {\n const seg = segments[i]!\n const next = segments[i + 1]!\n const minX = Math.min(seg.x, next.x)\n const minY = Math.min(seg.y, next.y)\n const maxX = Math.max(seg.x, next.x)\n const maxY = Math.max(seg.y, next.y)\n extentX += maxX - minX\n extentY += maxY - minY\n boxes.push({ entry: { nodeId, segmentIdx: i }, minX, minY, maxX, maxY })\n }\n }\n\n this.cellSize = resolveCellSize(cellSize, boxes, extentX, extentY)\n for (const b of boxes) {\n addToGrid(\n this.cells,\n this.cellSize,\n b.minX,\n b.minY,\n b.maxX,\n b.maxY,\n b.entry,\n )\n }\n }\n\n query(x: number, y: number, radiusX: number, radiusY = radiusX) {\n return queryGrid(this.cells, this.cellSize, x, y, radiusX, radiusY)\n }\n}\n\nexport class EdgeSpatialIndex {\n private cellSize: CellSize\n private cells = new Map<number, Map<number, number[]>>()\n // Base curves (offset 0) by edge index \u2014 the shared derivation, which the\n // geometry builder draws the same edges from. findHoveredEdge reuses them on\n // every mousemove; path-offset variants translate them (pure translation).\n private edgeCurves: EdgeCurves\n\n constructor(\n nodePositions: Record<string, NodeSegment[]>,\n graph: Graph,\n drawPaths: boolean,\n // The transform the curves indexed here were drawn under, so hit detection\n // tests the shape on screen. See AxisScale.\n axis: AxisScale,\n cellSize?: number | CellSize,\n // Bypassed backbone ids per deletion edge, i.e. what GeometryBuilder is\n // given. Without it a deletion is indexed and hit-tested on the STRAIGHT\n // chord between its endpoints while it is drawn as an arc bowed off that\n // chord, so the shape on screen is not hoverable and the empty space where\n // the chord runs is \u2014 and the tutorial tells the reader to hover it for the\n // interval and the bp. Bowing is part of the drawn geometry, so it has to be\n // part of the geometry hit detection uses.\n deletions?: Map<number, string[]>,\n // Bumped when a drag moves the positions in place; see baseEdgeCurves.\n version = 0,\n ) {\n this.edgeCurves = baseEdgeCurves(\n nodePositions,\n graph,\n axis,\n deletions,\n version,\n )\n const boxes: {\n ei: number\n minX: number\n minY: number\n maxX: number\n maxY: number\n }[] = []\n let extentX = 0\n let extentY = 0\n for (let ei = 0; ei < graph.edges.length; ei++) {\n const edge = graph.edges[ei]!\n const fromSegments = nodePositions[edge.from]\n const toSegments = nodePositions[edge.to]\n const curves = this.edgeCurves.get(ei)\n if (fromSegments?.length && toSegments?.length && curves) {\n // The control polygon's box, which contains the curve \u2014 the same\n // measure the geometry builder culls by, from the one function that\n // takes it.\n let { minX, minY, maxX, maxY } = curveBounds(curves)\n\n // Ribbons sit off the edge itself, so the box has to hold them too. Per\n // axis and off the offsets actually used, rather than one number on\n // both: the fan is perpendicular to the edge, so an edge running along\n // x spends all of it on y and none on x, and on a row layout the two\n // axes are not even in the same units.\n const numPaths = edge.pathIds?.length ?? 0\n if (drawPaths && numPaths > 0) {\n let padX = 0\n let padY = 0\n for (const o of pathRibbonOffsets(\n fromSegments,\n toSegments,\n numPaths,\n axis,\n )) {\n padX = Math.max(padX, Math.abs(o.x))\n padY = Math.max(padY, Math.abs(o.y))\n }\n minX -= padX\n minY -= padY\n maxX += padX\n maxY += padY\n }\n\n extentX += maxX - minX\n extentY += maxY - minY\n boxes.push({ ei, minX, minY, maxX, maxY })\n }\n }\n\n this.cellSize = resolveCellSize(cellSize, boxes, extentX, extentY)\n for (const b of boxes) {\n addToGrid(this.cells, this.cellSize, b.minX, b.minY, b.maxX, b.maxY, b.ei)\n }\n }\n\n getCurves(ei: number) {\n return this.edgeCurves.get(ei)\n }\n\n query(x: number, y: number, radiusX: number, radiusY = radiusX) {\n return queryGrid(this.cells, this.cellSize, x, y, radiusX, radiusY)\n }\n}\n", "import { EdgeSpatialIndex, SpatialIndex } from './SpatialIndex'\nimport { pathRibbonOffsets, translateCurves, yToXOf } from './geometry'\n\nimport type { Graph, NodeSegment } from '../types'\nimport type { AxisScale, BezierCurve } from './geometry'\n\nexport function distanceToSegment(\n px: number,\n py: number,\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n) {\n const dx = x2 - x1\n const dy = y2 - y1\n const lenSq = dx * dx + dy * dy\n if (lenSq === 0) {\n return Math.hypot(px - x1, py - y1)\n }\n const t = Math.max(0, Math.min(1, ((px - x1) * dx + (py - y1) * dy) / lenSq))\n return Math.hypot(px - (x1 + t * dx), py - (y1 + t * dy))\n}\n\nexport function distanceToCubicBezier(\n px: number,\n py: number,\n x1: number,\n y1: number,\n cx1: number,\n cy1: number,\n cx2: number,\n cy2: number,\n x2: number,\n y2: number,\n) {\n // To the chords between samples, not to the samples: on a long curve they\n // are tens of px apart, and a cursor on the curve between two of them\n // measured as far off it as half that gap.\n let minDist = Infinity\n const samples = 20\n let lastX = x1\n let lastY = y1\n for (let i = 1; i <= samples; i++) {\n const t = i / samples\n const u = 1 - t\n const bx =\n u * u * u * x1 +\n 3 * u * u * t * cx1 +\n 3 * u * t * t * cx2 +\n t * t * t * x2\n const by =\n u * u * u * y1 +\n 3 * u * u * t * cy1 +\n 3 * u * t * t * cy2 +\n t * t * t * y2\n minDist = Math.min(minDist, distanceToSegment(px, py, lastX, lastY, bx, by))\n lastX = bx\n lastY = by\n }\n return minDist\n}\n\nfunction distanceToBezierCurve(px: number, py: number, c: BezierCurve) {\n return distanceToCubicBezier(\n px,\n py,\n c.x0,\n c.y0,\n c.cx0,\n c.cy0,\n c.cx1,\n c.cy1,\n c.x1,\n c.y1,\n )\n}\n\nfunction distanceToEdgeCurves(\n px: number,\n py: number,\n curves: BezierCurve[],\n yToX = 1,\n) {\n let minDist = Infinity\n for (const c of curves) {\n const d = distanceToBezierCurve(\n px,\n py,\n yToX === 1\n ? c\n : {\n x0: c.x0,\n y0: c.y0 * yToX,\n cx0: c.cx0,\n cy0: c.cy0 * yToX,\n cx1: c.cx1,\n cy1: c.cy1 * yToX,\n x1: c.x1,\n y1: c.y1 * yToX,\n },\n )\n if (d < minDist) {\n minDist = d\n }\n }\n return minDist\n}\n\n// Indexes are cached against the layout they were built from, in a WeakMap\n// rather than a module-level slot. A single slot meant two graph views in one\n// session evicted each other's index on alternating mousemoves, and held the last\n// graph's positions alive for as long as the tab lived. Keyed this way each view\n// keeps its own, and an entry becomes collectable when its layout is replaced.\n//\n// `version` still has to be compared: a node drag mutates the position objects in\n// place, so the identity of `nodePositions` cannot report that it changed.\nconst nodeCache = new WeakMap<\n Record<string, NodeSegment[]>,\n { version: number; index: SpatialIndex }\n>()\n\nfunction getSpatialIndex(\n nodePositions: Record<string, NodeSegment[]>,\n version: number,\n) {\n const cached = nodeCache.get(nodePositions)\n if (cached?.version === version) {\n return cached.index\n }\n const index = new SpatialIndex(nodePositions)\n nodeCache.set(nodePositions, { version, index })\n return index\n}\n\nconst edgeCache = new WeakMap<\n Record<string, NodeSegment[]>,\n {\n graph: Graph\n drawPaths: boolean\n // compared by VALUE, not by the AxisScale's identity: the model rebuilds\n // that object whenever either scale changes, so identity would miss a cache\n // hit on every mousemove\n scaleX: number\n scaleY: number\n version: number\n index: EdgeSpatialIndex\n deletions?: Map<number, string[]>\n }\n>()\n\nfunction getEdgeSpatialIndex(\n nodePositions: Record<string, NodeSegment[]>,\n graph: Graph,\n drawPaths: boolean,\n axis: AxisScale,\n version: number,\n deletions?: Map<number, string[]>,\n) {\n const cached = edgeCache.get(nodePositions)\n if (\n cached?.graph === graph &&\n cached.drawPaths === drawPaths &&\n cached.scaleX === axis.scaleX &&\n cached.scaleY === axis.scaleY &&\n cached.version === version &&\n cached.deletions === deletions\n ) {\n return cached.index\n }\n const index = new EdgeSpatialIndex(\n nodePositions,\n graph,\n drawPaths,\n axis,\n undefined,\n deletions,\n version,\n )\n edgeCache.set(nodePositions, {\n graph,\n drawPaths,\n scaleX: axis.scaleX,\n scaleY: axis.scaleY,\n version,\n index,\n deletions,\n })\n return index\n}\n\n// Every distance below is measured with y converted into x units by `yToX` (the\n// model's scaleY / scaleX), because on a row layout the two axes are bp and\n// screen px and a raw hypot over them is not a distance at all \u2014 5 bp of x and\n// 5 px of y are nothing alike. The thresholds stay screen px over the x scale,\n// which is what they always were; on an isotropic layout yToX is 1 and this is\n// the arithmetic it has always done.\n//\n// `ink` is how far from its centreline each node is drawn, in screen px, and\n// the most any node is. A node drawn thick by its depth is 18 px across at the\n// defaults, and a fixed tolerance missed the pointer on its outer ink, where\n// the link beside it took the hover instead. MIN_NODE_REACH_PX keeps a thin\n// node catchable.\nconst MIN_NODE_REACH_PX = 5\n\nexport interface NodeInk {\n halfWidthPx: (nodeId: string) => number\n maxHalfWidthPx: number\n}\n\nexport function findHoveredNode(\n nodePositions: Record<string, NodeSegment[]>,\n graphX: number,\n graphY: number,\n axis: AxisScale,\n version = 0,\n ink?: NodeInk,\n) {\n const yToX = yToXOf(axis)\n const index = getSpatialIndex(nodePositions, version)\n const reach = (px: number) => Math.max(MIN_NODE_REACH_PX, px) / axis.scaleX\n // the query has to cover the thickest node there could be\n const queryReach = reach(ink?.maxHalfWidthPx ?? 0)\n const candidates = index.query(graphX, graphY, queryReach, queryReach / yToX)\n\n // The nearest candidate, not the first one inside its reach. The reach is in\n // world units, so when zoomed out it covers several nodes at once and \"first\"\n // meant whichever the grid happened to visit first \u2014 the cursor could sit on\n // one node and highlight its neighbour.\n let hovered: string | null = null\n let best = Infinity\n for (const { nodeId, segmentIdx } of candidates) {\n const segments = nodePositions[nodeId]!\n const dist = distanceToSegment(\n graphX,\n graphY * yToX,\n segments[segmentIdx]!.x,\n segments[segmentIdx]!.y * yToX,\n segments[segmentIdx + 1]!.x,\n segments[segmentIdx + 1]!.y * yToX,\n )\n if (dist < best && dist < reach(ink?.halfWidthPx(nodeId) ?? 0)) {\n best = dist\n hovered = nodeId\n }\n }\n return hovered\n}\n\nexport function findHoveredEdge(\n nodePositions: Record<string, NodeSegment[]>,\n graph: Graph,\n graphX: number,\n graphY: number,\n axis: AxisScale,\n drawPaths: boolean,\n version = 0,\n deletions?: Map<number, string[]>,\n hiddenEdges?: ReadonlySet<number>,\n) {\n const yToX = yToXOf(axis)\n const edgeThreshold = 10 / axis.scaleX\n const edgeIndex = getEdgeSpatialIndex(\n nodePositions,\n graph,\n drawPaths,\n axis,\n version,\n deletions,\n )\n const candidates = edgeIndex.query(\n graphX,\n graphY,\n edgeThreshold,\n edgeThreshold / yToX,\n )\n\n // Nearest, not first \u2014 same reason as findHoveredNode.\n let hovered: number | null = null\n let best = edgeThreshold\n for (const edgeIdx of candidates) {\n const edge = graph.edges[edgeIdx]!\n const fromSegments = nodePositions[edge.from]\n const toSegments = nodePositions[edge.to]\n if (\n !fromSegments?.length ||\n !toSegments?.length ||\n hiddenEdges?.has(edgeIdx)\n ) {\n continue\n }\n\n const numPaths = edge.pathIds?.length ?? 0\n const baseCurves = edgeIndex.getCurves(edgeIdx)\n if (!baseCurves) {\n continue\n }\n let dist: number\n\n if (!drawPaths || numPaths === 0) {\n dist = distanceToEdgeCurves(graphX, graphY * yToX, baseCurves, yToX)\n } else {\n // The same offsets GeometryBuilder drew the ribbons at, from the one\n // function that decides them, so a ribbon is hoverable where it is drawn.\n let minDist = Infinity\n for (const offset of pathRibbonOffsets(\n fromSegments,\n toSegments,\n numPaths,\n axis,\n )) {\n const curves =\n offset.x === 0 && offset.y === 0\n ? baseCurves\n : translateCurves(baseCurves, offset.x, offset.y)\n const d = distanceToEdgeCurves(graphX, graphY * yToX, curves, yToX)\n if (d < minDist) {\n minDist = d\n }\n }\n dist = minDist\n }\n\n if (dist < best) {\n best = dist\n hovered = edgeIdx\n }\n }\n return hovered\n}\n", "const ZOOM_PER_NOTCH = 1.1\nconst NOTCH_PX = 100\nconst LINE_PX = 40\nconst PAGE_PX = 800\nconst PINCH_GAIN = 10\nconst MAX_NOTCHES_PER_EVENT = 2\n\n// Zoom by how far the wheel moved rather than by one step per event. A mouse\n// sends one event of about NOTCH_PX per notch and still zooms ZOOM_PER_NOTCH;\n// a trackpad sends sixty small ones a second, which at a step each compounded\n// to hundreds of times per second. A pinch arrives as ctrl+wheel with deltas a\n// tenth the size. The delta is normalized here rather than with core's\n// normalizeWheelDelta, which a released host may not export.\nexport function wheelZoomFactor(e: {\n deltaY: number\n deltaMode: number\n ctrlKey: boolean\n}) {\n const px =\n e.deltaY * (e.deltaMode === 1 ? LINE_PX : e.deltaMode === 2 ? PAGE_PX : 1)\n const notches = ((e.ctrlKey ? PINCH_GAIN : 1) * px) / NOTCH_PX\n return (\n ZOOM_PER_NOTCH **\n -Math.max(-MAX_NOTCHES_PER_EVENT, Math.min(MAX_NOTCHES_PER_EVENT, notches))\n )\n}\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z\"\n}), 'Info');", "import { BUBBLE_KIND_COLORS } from '@jbrowse/bandage-core/bubbles/classifyBubble'\nimport { HALO_FACTOR } from '@jbrowse/bandage-core/labelLayout'\nimport { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\nimport type { BubbleHalo } from '@jbrowse/bandage-core/bubbles/bubbleHalos'\n\n// The bubbles over a node drawing: each a translucent halo along its nodes,\n// drawn once in layout units and moved with the canvas by one transform. The\n// halo takes no pointer events, so the nodes under it still hover and drag;\n// its name and its routes' chips are LabelLayer's.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 2,\n}\n\nconst BubbleHalos = observer(function BubbleHalos({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { bubbleHalos, walkHighlight } = model\n if (bubbleHalos.length === 0) {\n return null\n }\n const {\n scaleX,\n scaleY,\n translateX,\n translateY,\n paneWidth: width,\n canvasHeight,\n } = model\n const halo = model.contigThickness * HALO_FACTOR\n // a lifted walk dims the bubbles it never enters\n const dimmedBubble = (h: BubbleHalo) =>\n walkHighlight !== undefined &&\n !h.nodeIds.some(id => walkHighlight.nodeIds.has(id))\n\n return (\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-bubble-halos\"\n >\n <g\n transform={`translate(${translateX} ${translateY}) scale(${scaleX} ${scaleY})`}\n >\n {bubbleHalos\n .filter(h => !h.whole)\n .map(h => (\n <path\n key={`${h.bubble.start}-${h.bubble.end}`}\n d={h.path}\n fill=\"none\"\n stroke={BUBBLE_KIND_COLORS[h.kind]}\n strokeOpacity={dimmedBubble(h) ? 0.06 : 0.22}\n strokeWidth={halo}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n vectorEffect=\"non-scaling-stroke\"\n />\n ))}\n </g>\n </svg>\n )\n})\n\nexport default BubbleHalos\n", "import { BUBBLE_KIND_COLORS } from '@jbrowse/bandage-core/bubbles/classifyBubble'\nimport { LABEL_PAD } from '@jbrowse/bandage-core/overlayLabels'\nimport { Button } from '@mui/material'\nimport { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\n// The variant map's glyphs: one lens per bubble on the reference line the\n// canvas draws, sized by the longest route through it, coloured and labelled\n// by what kind of variation it is. SVG over the canvas rather than geometry in\n// it, because a glyph is text plus a shape that reads at one screen size\n// whatever the zoom, which is what the row labels are too.\n//\n// Height is in screen px and adapts to the room above the line, so a pane of\n// any height shows every glyph; a bubble shorter than the reference it\n// replaces also gets a dashed chord under the line, the deletion's side.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'visible' as const,\n zIndex: 3,\n}\n\nconst backButtonStyle = {\n position: 'absolute' as const,\n left: 8,\n top: 8,\n zIndex: 5,\n background: 'rgba(255,255,255,0.9)',\n textTransform: 'none' as const,\n}\n\nconst MIN_GLYPH_PX = 10\n\nfunction glyphHeight(bp: number, room: number) {\n const raw = 12 + 26 * Math.log10(1 + bp)\n return Math.min(raw, room)\n}\n\nconst BubbleOverlay = observer(function BubbleOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { bubbleGlyphs, poppedFrom } = model\n const back = poppedFrom ? (\n <Button\n size=\"small\"\n variant=\"outlined\"\n style={backButtonStyle}\n data-testid=\"graph-unpop-bubble\"\n onClick={() => {\n void model.unpopBubble()\n }}\n >\n \u25C0 Back to {poppedFrom.label}\n </Button>\n ) : null\n if (bubbleGlyphs.length === 0) {\n return back\n }\n const {\n scaleX,\n translateX,\n translateY,\n paneWidth: width,\n canvasHeight,\n } = model\n const lineY = translateY\n const X = (bp: number) => bp * scaleX + translateX\n const labels = model.overlayLabels.glyphs\n // glyphs take whatever the names leave above the line\n const labelsBottom = Math.max(0, ...labels.map(l => l.y + LABEL_PAD))\n const room = Math.max(24, lineY - labelsBottom - 14)\n const glyphs = [...bubbleGlyphs].sort(\n (a, b) => b.bubble.end - b.bubble.start - (a.bubble.end - a.bubble.start),\n )\n\n return (\n <>\n {back}\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-bubble-overlay\"\n >\n {glyphs.map(({ bubble, kind, label }) => {\n const x0 = X(bubble.start)\n const x1 = X(bubble.end)\n const w = Math.max(x1 - x0, MIN_GLYPH_PX)\n const cx = (x0 + x1) / 2\n const h = glyphHeight(bubble.longestAlleleLength, room)\n const color = BUBBLE_KIND_COLORS[kind]\n const refSpan = bubble.end - bubble.start\n const skipped = refSpan - bubble.shortestAlleleLength\n const dip = skipped > 0 ? 6 + 10 * Math.log10(1 + skipped) : 0\n const key = `${bubble.start}-${bubble.end}`\n return (\n <g key={key}>\n <path\n d={`M${cx - w / 2},${lineY} C${cx - w / 2},${lineY - h} ${cx + w / 2},${lineY - h} ${cx + w / 2},${lineY} Z`}\n fill={color}\n fillOpacity={0.18}\n stroke={color}\n strokeWidth={2}\n style={{ pointerEvents: 'auto', cursor: 'pointer' }}\n onClick={() => {\n void model.popBubble(bubble)\n }}\n >\n <title>{`${label}\\n${bubble.segmentCount} segments \u00B7 click to open`}</title>\n </path>\n {dip > 0 ? (\n <path\n d={`M${cx - w / 2},${lineY} C${cx - w / 2},${lineY + dip} ${cx + w / 2},${lineY + dip} ${cx + w / 2},${lineY}`}\n fill=\"none\"\n stroke={color}\n strokeWidth={2}\n strokeDasharray=\"4 3\"\n />\n ) : null}\n </g>\n )\n })}\n {labels.map(({ item: { glyph: g, glyphX }, x, y }) => {\n const color = BUBBLE_KIND_COLORS[g.kind]\n const top = lineY - glyphHeight(g.bubble.longestAlleleLength, room)\n return (\n <g key={`${g.bubble.start}-${g.bubble.end}-label`}>\n <line\n x1={glyphX}\n x2={glyphX}\n y1={y + 4}\n y2={top - 2}\n stroke={color}\n strokeWidth={0.7}\n strokeOpacity={0.5}\n />\n <text\n x={x}\n y={y}\n fontSize={11}\n fontFamily=\"sans-serif\"\n fill={color}\n textAnchor=\"middle\"\n >\n {g.label}\n </text>\n </g>\n )\n })}\n </svg>\n </>\n )\n})\n\nexport default BubbleOverlay\n", "import { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\n// The session's genes drawn onto the graph: exons as dark stretches along the\n// backbone nodes that carry them, in layout units, moved by the same transform\n// the halos use. Their names are LabelLayer's.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 2,\n}\n\nexport const EXON_COLOR = '#1c1c22'\n\nconst GenePins = observer(function GenePins({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { genePins } = model\n if (genePins.length === 0) {\n return null\n }\n const {\n scaleX,\n scaleY,\n translateX,\n translateY,\n paneWidth: width,\n canvasHeight,\n contigThickness,\n } = model\n return (\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-gene-pins\"\n >\n <g\n transform={`translate(${translateX} ${translateY}) scale(${scaleX} ${scaleY})`}\n >\n {genePins.map(pin =>\n pin.exons ? (\n <path\n key={`${pin.gene.name}-${pin.gene.start}`}\n d={pin.exons}\n fill=\"none\"\n stroke={EXON_COLOR}\n strokeOpacity={0.9}\n strokeWidth={contigThickness * 0.55}\n strokeLinecap=\"round\"\n vectorEffect=\"non-scaling-stroke\"\n />\n ) : null,\n )}\n </g>\n </svg>\n )\n})\n\nexport default GenePins\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2\"\n}), 'CropFree');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon([/*#__PURE__*/_jsx(\"path\", {\n d: \"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14\"\n}, \"0\"), /*#__PURE__*/_jsx(\"path\", {\n d: \"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z\"\n}, \"1\")], 'ZoomIn');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z\"\n}), 'ZoomOut');", "import CropFreeIcon from '@mui/icons-material/CropFree'\nimport ZoomInIcon from '@mui/icons-material/ZoomIn'\nimport ZoomOutIcon from '@mui/icons-material/ZoomOut'\nimport { IconButton, Tooltip, Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport ColorSchemeSelect from './ColorSchemeSelect'\nimport GraphStats from './GraphStats'\nimport LayoutSelect from './LayoutSelect'\nimport RepeatSelect from './RepeatSelect'\nimport SettingsMenu from './SettingsMenu'\nimport WalkSelect from './WalkSelect'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n toolbar: {\n display: 'flex',\n alignItems: 'center',\n gap: 4,\n padding: '2px 4px',\n borderBottom: '1px solid #ddd',\n },\n})\n\nconst ZoomDisplay = observer(function ZoomDisplay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n return <Typography variant=\"body2\">{model.zoomPercent}</Typography>\n})\n\nconst GraphToolbar = observer(function GraphToolbar({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n return (\n <div className={classes.toolbar}>\n <LayoutSelect model={model} />\n <ColorSchemeSelect model={model} />\n <WalkSelect model={model} />\n <RepeatSelect model={model} />\n <Tooltip title=\"Zoom in\">\n <IconButton\n size=\"small\"\n onClick={() => {\n model.zoom(1.5, model.paneWidth / 2, model.canvasHeight / 2)\n }}\n >\n <ZoomInIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title=\"Zoom out\">\n <IconButton\n size=\"small\"\n onClick={() => {\n model.zoom(1 / 1.5, model.paneWidth / 2, model.canvasHeight / 2)\n }}\n >\n <ZoomOutIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title=\"Zoom to fit\">\n <IconButton\n size=\"small\"\n onClick={() => {\n model.zoomToFit()\n }}\n >\n <CropFreeIcon />\n </IconButton>\n </Tooltip>\n <ZoomDisplay model={model} />\n <GraphStats model={model} />\n <SettingsMenu model={model} />\n </div>\n )\n})\n\nexport default GraphToolbar\n", "import { COLOR_SCHEMES } from '@jbrowse/bandage-core/colorSchemes'\nimport { FormControl, InputLabel, MenuItem, Select } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 100,\n },\n})\n\nconst ColorSchemeSelect = observer(function ColorSchemeSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel>Color</InputLabel>\n <Select\n value={model.chosenColorScheme}\n label=\"Color\"\n onChange={e => {\n model.setColorScheme(e.target.value)\n }}\n >\n {COLOR_SCHEMES.map(({ value, label }) => (\n <MenuItem key={value} value={value}>\n {label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default ColorSchemeSelect\n", "import { Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n stats: {\n marginLeft: 'auto',\n },\n perf: {\n color: '#888',\n fontVariantNumeric: 'tabular-nums',\n },\n})\n\nfunction fmtMs(ms: number | undefined) {\n return ms === undefined ? '\u2013' : `${Math.round(ms)}ms`\n}\n\n// The perf READOUT, off by default: it sat in the toolbar of every published\n// graph figure, where one machine's fetch time is a number a reader has to work\n// out is not about them. `showPerf` is in the settings menu.\n//\n// The numbers themselves are not conditional \u2014 they ride the stats element's\n// data-* attributes either way (see GraphStats), so a browser test asserting a\n// timing budget never depends on a display setting, and turning the text off\n// costs no coverage. They live there rather than on this element so that\n// switching the text off leaves no empty node behind to carry them.\nconst GraphPerf = observer(function GraphPerf({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { lastFetchMs, lastLayoutMs, lastGeometryMs } = model\n const hasMetrics =\n lastFetchMs !== undefined ||\n lastLayoutMs !== undefined ||\n lastGeometryMs !== undefined\n return model.showPerf && hasMetrics ? (\n <Typography\n variant=\"caption\"\n className={classes.perf}\n data-testid=\"graph-perf-stats\"\n >\n fetch {fmtMs(lastFetchMs)} \u00B7 layout {fmtMs(lastLayoutMs)} \u00B7 geom{' '}\n {fmtMs(lastGeometryMs)}\n </Typography>\n ) : null\n})\n\nconst GraphStats = observer(function GraphStats({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n return (\n <div\n className={classes.stats}\n data-testid=\"graph-stats\"\n data-node-count={model.nodeCount}\n data-edge-count={model.edgeCount}\n data-path-count={model.pathCount}\n // unconditional, whatever `showPerf` is doing to the text beside them \u2014\n // see GraphPerf\n data-fetch-ms={model.lastFetchMs ?? ''}\n data-layout-ms={model.lastLayoutMs ?? ''}\n data-geometry-ms={model.lastGeometryMs ?? ''}\n data-geometry-strokes={model.lastGeometryStrokeCount ?? ''}\n >\n <Typography variant=\"body2\" component=\"span\">\n {model.nodeCount} nodes, {model.edgeCount} edges\n {model.pathCount > 0 ? `, ${model.pathCount} paths` : ''}\n </Typography>{' '}\n <GraphPerf model={model} />\n </div>\n )\n})\n\nexport default GraphStats\n", "import { LAYOUT_MODES } from '@jbrowse/bandage-core/layoutModes'\nimport {\n FormControl,\n InputLabel,\n MenuItem,\n Select,\n Tooltip,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 150,\n },\n})\n\nconst LayoutSelect = observer(function LayoutSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { graph } = model\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel>Layout</InputLabel>\n <Select\n value={model.chosenLayoutMode}\n label=\"Layout\"\n data-testid=\"graph-layout-select\"\n onChange={e => {\n void model.switchLayout(e.target.value)\n }}\n >\n {LAYOUT_MODES.map(({ value, label, description, available }) => (\n <MenuItem\n key={value}\n value={value}\n disabled={graph ? !available(graph) : false}\n >\n <Tooltip title={description} placement=\"right\">\n <span>{label}</span>\n </Tooltip>\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default LayoutSelect\n", "import { FormControl, InputLabel, MenuItem, Select } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 130,\n maxWidth: 240,\n },\n})\n\n// Which tandem repeat array the walk rows measure between and tile by, from\n// the session's repeat annotation over the window. Only the walk rows read it.\nconst RepeatSelect = observer(function RepeatSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { repeatChoices } = model\n if (model.chosenLayoutMode !== 'walkrows' || repeatChoices.length === 0) {\n return null\n }\n const keys = new Set(repeatChoices.map(r => r.key))\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel>Repeat</InputLabel>\n <Select\n value={keys.has(model.repeatKey) ? model.repeatKey : ''}\n label=\"Repeat\"\n data-testid=\"graph-repeat-select\"\n onChange={e => {\n model.setRepeatKey(e.target.value)\n }}\n >\n <MenuItem value=\"\">\n <em>Whole window</em>\n </MenuItem>\n {repeatChoices.map(({ key, name, unit }) => (\n <MenuItem key={key} value={key}>\n {name} \u00B7 {unit.toLocaleString()} bp unit\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default RepeatSelect\n", "import { useState } from 'react'\n\nimport { CascadingMenuButton } from '@jbrowse/core/ui'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport MoreVertIcon from '@mui/icons-material/MoreVert'\nimport SettingsIcon from '@mui/icons-material/Settings'\nimport { observer } from 'mobx-react'\n\nimport GraphSettingsDialog from './GraphSettingsDialog'\n\nimport type { GraphPaneModel } from '../model'\n\nconst SettingsMenu = observer(function SettingsMenu({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const [settingsOpen, setSettingsOpen] = useState(false)\n\n return (\n <>\n <CascadingMenuButton\n size=\"small\"\n menuItems={[\n {\n type: 'checkbox' as const,\n label: 'Linear layout',\n checked: model.linearLayout,\n onClick: () => {\n model.setLinearLayout(!model.linearLayout)\n void model.recomputeLayout()\n },\n },\n {\n type: 'checkbox' as const,\n label: 'Show deletion edges',\n checked: model.showDeletionEdges,\n onClick: () => {\n model.setShowDeletionEdges(!model.showDeletionEdges)\n },\n },\n {\n type: 'checkbox' as const,\n label: 'Show timings',\n checked: model.showPerf,\n onClick: () => {\n model.setShowPerf(!model.showPerf)\n },\n },\n { type: 'divider' as const },\n {\n label: 'Settings',\n icon: SettingsIcon,\n onClick: () => {\n setSettingsOpen(true)\n },\n },\n { type: 'divider' as const },\n {\n label: 'Return to import form',\n icon: DeleteIcon,\n onClick: () => {\n model.clearGraph()\n },\n },\n ]}\n >\n <MoreVertIcon />\n </CascadingMenuButton>\n\n <GraphSettingsDialog\n model={model}\n open={settingsOpen}\n onClose={() => {\n setSettingsOpen(false)\n }}\n />\n </>\n )\n})\n\nexport default SettingsMenu\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z\"\n}), 'Delete');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2\"\n}), 'MoreVert');", "import { FormControl, InputLabel, MenuItem, Select } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 130,\n maxWidth: 220,\n },\n})\n\n// Which walk to lift out of the drawing: Bandage's path highlight, with the\n// haplotypes a GBZ cut carries. Absent from a graph with no walks.\nconst WalkSelect = observer(function WalkSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { walkChoices } = model\n if (walkChoices.length === 0) {\n return null\n }\n const names = new Set(walkChoices.map(c => c.name))\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel>Walk</InputLabel>\n <Select\n value={names.has(model.highlightedPath) ? model.highlightedPath : ''}\n label=\"Walk\"\n data-testid=\"graph-walk-select\"\n onChange={e => {\n model.setHighlightedPath(e.target.value)\n }}\n >\n <MenuItem value=\"\">\n <em>None</em>\n </MenuItem>\n {walkChoices.map(({ name, label }) => (\n <MenuItem key={name} value={name}>\n {label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default WalkSelect\n", "import { BUBBLE_KIND_COLORS } from '@jbrowse/bandage-core/bubbles/classifyBubble'\nimport { LABEL_PX } from '@jbrowse/bandage-core/overlayLabels'\nimport { observer } from 'mobx-react'\n\nimport { EXON_COLOR } from './GenePins'\nimport LabelChip from './LabelChip'\n\nimport type { GraphPaneModel } from '../model'\nimport type {\n BubbleHalo,\n RouteLabel,\n} from '@jbrowse/bandage-core/bubbles/bubbleHalos'\n\n// Every chip drawn over the graph, above all of its ink: bubble names, gene\n// names on their pins, and the routes' walkers. `overlayLabels` has placed\n// them against each other and against the row labels already.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 3,\n}\n\nconst LabelLayer = observer(function LabelLayer({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { bubbles, genes, routes } = model.overlayLabels\n if (bubbles.length + genes.length + routes.length === 0) {\n return null\n }\n const { walkHighlight, scaleY, translateY, contigThickness } = model\n // a lifted walk dims the bubbles it never enters and the routes it does not\n // take\n const dimmedBubble = (h: BubbleHalo) =>\n walkHighlight !== undefined &&\n !h.nodeIds.some(id => walkHighlight.nodeIds.has(id))\n const dimmedRoute = (r: RouteLabel) =>\n walkHighlight !== undefined && !r.route.walks.includes(walkHighlight.name)\n\n return (\n <svg\n style={svgStyle}\n width={model.paneWidth}\n height={model.canvasHeight}\n data-testid=\"graph-label-layer\"\n >\n {genes.map(({ item: pin, x, y, w, text }) => (\n <g key={`${pin.gene.name}-${pin.gene.start}`}>\n <line\n x1={x}\n x2={x}\n y1={y - LABEL_PX - 2}\n y2={pin.at.y * scaleY + translateY + contigThickness / 2}\n stroke={EXON_COLOR}\n strokeWidth={0.8}\n strokeOpacity={0.6}\n />\n <LabelChip\n x={x}\n y={y}\n w={w}\n text={text}\n color={EXON_COLOR}\n italic\n title={`${pin.gene.name} ${pin.gene.refName}:${pin.gene.start.toLocaleString()}-${pin.gene.end.toLocaleString()}${pin.covered < 0.98 ? ', runs past the cut' : ''}`}\n testId=\"graph-gene-pin-label\"\n />\n </g>\n ))}\n {routes.map(({ item: { halo: h, route }, x, y, w, text }) => (\n <LabelChip\n key={`${h.bubble.start}-${h.bubble.end}-${route.route.steps.join(',')}`}\n x={x}\n y={y}\n w={w}\n text={text}\n color={BUBBLE_KIND_COLORS[h.kind]}\n small\n dimmed={dimmedRoute(route)}\n title={`${route.route.walks.length} walk(s): ${route.route.walks.join(', ')}`}\n testId=\"graph-route-label\"\n />\n ))}\n {bubbles.map(({ item: h, x, y, w, text }) => (\n <LabelChip\n key={`${h.bubble.start}-${h.bubble.end}`}\n x={x}\n y={y}\n w={w}\n text={text}\n color={BUBBLE_KIND_COLORS[h.kind]}\n dimmed={dimmedBubble(h)}\n title={`${h.label}\\n${h.bubble.segmentCount} segments \u00B7 click to open`}\n testId=\"graph-bubble-halo-label\"\n onClick={() => {\n void model.popBubble(h.bubble)\n }}\n />\n ))}\n </svg>\n )\n})\n\nexport default LabelLayer\n", "import { LABEL_PAD, LABEL_PX } from '@jbrowse/bandage-core/overlayLabels'\n\n// One label on an overlay: a white chip with a coloured edge and text, its\n// baseline at y and centred on x.\nexport default function LabelChip({\n x,\n y,\n w,\n text,\n color,\n italic,\n small,\n dimmed,\n title,\n testId,\n onClick,\n}: {\n x: number\n y: number\n w: number\n text: string\n color: string\n italic?: boolean\n small?: boolean\n dimmed?: boolean\n title?: string\n testId?: string\n onClick?: () => void\n}) {\n return (\n <g\n style={{\n pointerEvents: onClick ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : undefined,\n opacity: dimmed ? 0.35 : 1,\n }}\n data-testid={testId}\n onClick={onClick}\n >\n {title ? <title>{title}</title> : null}\n <rect\n x={x - w / 2}\n y={y - LABEL_PX - LABEL_PAD + 2}\n width={w}\n height={LABEL_PX + LABEL_PAD * 2 - 2}\n rx={3}\n fill=\"rgba(255,255,255,0.85)\"\n stroke={color}\n strokeWidth={small ? 0.6 : 1}\n />\n <text\n x={x}\n y={y}\n fontSize={small ? LABEL_PX - 1 : LABEL_PX}\n fontFamily=\"sans-serif\"\n fontStyle={italic ? 'italic' : undefined}\n fontWeight={italic ? 600 : undefined}\n fill={color}\n textAnchor=\"middle\"\n >\n {text}\n </text>\n </g>\n )\n}\n", "import { useEffect, useRef } from 'react'\n\nimport { formatBp } from '@jbrowse/bandage-core/graphLabels'\nimport {\n ZIGZAG_AMPLITUDE_PX,\n ZIGZAG_PX,\n drawTubeMapRuler,\n rulerInk,\n} from '@jbrowse/bandage-core/tubeMap/axis'\nimport { drawTubeMapConnectors } from '@jbrowse/bandage-core/tubeMap/connectors'\nimport {\n deviationInk,\n drawDeviationMarks,\n} from '@jbrowse/bandage-core/tubeMap/deviations'\nimport { drawTubeMap } from '@jbrowse/bandage-core/tubeMap/draw'\nimport { drawTubeMapGenes } from '@jbrowse/bandage-core/tubeMap/genes'\nimport { getDpr } from '@jbrowse/render-core/canvas2dUtils'\nimport { autorun } from 'mobx'\nimport { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\nconst canvasStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n zIndex: 1,\n}\n\n// The tube map's ink, over the canvas, which draws nothing under a tube map\n// layout. Above the tubes go the session's genes in a view of its own, or in\n// a linear view the bands tying each reference box to its bp there; under\n// them a reference ruler, unless the linear view's is already the axis.\n// Repainted by an autorun on every change of transform, so a pan in the linear\n// view above moves the tubes in the same frame as its other tracks.\nconst TubeMapOverlay = observer(function TubeMapOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLCanvasElement>(null)\n const { tubeMapPicture, paneWidth, canvasHeight } = model\n useEffect(\n () =>\n autorun(() => {\n const canvas = ref.current\n const picture = model.tubeMapPicture\n const frame = model.tubeMapFrame\n const ctx = canvas?.getContext('2d')\n if (canvas && ctx && picture && frame) {\n const dpr = getDpr()\n const width = model.paneWidth\n const height = model.canvasHeight\n canvas.width = Math.round(width * dpr)\n canvas.height = Math.round(height * dpr)\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0)\n ctx.clearRect(0, 0, width, height)\n const tubeFrame = {\n ...frame,\n width,\n highlightNode: model.hoveredNode ?? model.selectedNode,\n darkMode: model.darkMode,\n }\n drawTubeMap(ctx, picture, tubeFrame)\n drawDeviationMarks(ctx, model.tubeMapDeviations, tubeFrame)\n drawTubeMapConnectors(\n ctx,\n model.tubeMapConnectors,\n model.connectorZoneBottom,\n tubeFrame,\n )\n const { bounds } = picture\n drawTubeMapGenes(\n ctx,\n model.tubeMapGenes,\n tubeFrame,\n frame.y(bounds.minY) - 2,\n )\n const boxes = model.tubeMapRulerBoxes\n if (boxes) {\n drawTubeMapRuler(ctx, boxes, tubeFrame, frame.y(bounds.maxY) + 4)\n }\n }\n }),\n [model],\n )\n // Mounted whether or not there is a tube map, so the autorun above has its\n // canvas the moment a layout brings one.\n return (\n <canvas\n ref={ref}\n data-testid={tubeMapPicture ? 'graph-tube-map' : undefined}\n style={{\n ...canvasStyle,\n width: paneWidth,\n height: canvasHeight,\n display: tubeMapPicture ? 'block' : 'none',\n }}\n />\n )\n})\n\nexport default TubeMapOverlay\n\nconst legendBoxStyle = {\n background: 'rgba(255,255,255,0.82)',\n padding: '4px 6px',\n borderRadius: 3,\n fontSize: 11,\n lineHeight: '15px',\n whiteSpace: 'nowrap' as const,\n}\nconst legendRowStyle = { display: 'flex', alignItems: 'center', gap: 5 }\nconst SWATCH_PX = 18\n\n// The ruler's own zigzag, tooth for tooth\nfunction ZigzagSwatch() {\n const teeth = Math.round(SWATCH_PX / ZIGZAG_PX)\n const dx = SWATCH_PX / teeth\n const mid = ZIGZAG_AMPLITUDE_PX + 1\n const points = [`0,${mid}`]\n for (let i = 0; i < teeth; i++) {\n points.push(\n `${(i + 0.5) * dx},${mid + (i % 2 ? 1 : -1) * ZIGZAG_AMPLITUDE_PX}`,\n )\n }\n points.push(`${SWATCH_PX},${mid}`)\n return (\n <svg width={SWATCH_PX} height={mid * 2} style={{ flex: 'none' }}>\n <polyline\n points={points.join(' ')}\n fill=\"none\"\n stroke={rulerInk()}\n strokeWidth={1}\n />\n </svg>\n )\n}\n\nconst tubeSwatchStyle = {\n width: SWATCH_PX,\n height: 7,\n flex: 'none',\n display: 'flex',\n justifyContent: 'center',\n backgroundColor: '#b8b8c0',\n}\n\nfunction TickSwatch() {\n return (\n <div style={tubeSwatchStyle}>\n <div style={{ width: 2, backgroundColor: deviationInk() }} />\n </div>\n )\n}\n\n// The two marks a tube map draws that nothing else on screen explains, each\n// listed only while it is drawn\nexport const TubeMapLegend = observer(function TubeMapLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { squeezed, foldBp } = model.tubeMapKeys\n return squeezed || foldBp !== undefined ? (\n <div style={legendBoxStyle} data-testid=\"graph-tube-map-legend\">\n {foldBp !== undefined ? (\n <div style={legendRowStyle}>\n <TickSwatch />\n <span>a haplotype's variant under {formatBp(foldBp)}</span>\n </div>\n ) : null}\n {squeezed ? (\n <div style={legendRowStyle}>\n <ZigzagSwatch />\n <span>ruler not to scale, box length below</span>\n </div>\n ) : null}\n </div>\n ) : null\n})\n", "import { useId } from 'react'\n\nimport { ROW_HEIGHT_PX } from '@jbrowse/bandage-core/layout/rowSpacing'\nimport { LABEL_CHAR_PX } from '@jbrowse/bandage-core/overlayLabels'\nimport { REFERENCE_RAMP_ALT_CSS } from '@jbrowse/bandage-core/renderer/GeometryBuilder'\nimport { observer } from 'mobx-react'\n\nimport { RAMP_GRADIENT_CSS, rampHueCss, rampStops } from './referenceRampCss'\nimport { CALL_TOLERANCE } from '../repeats/walkCalls'\n\nimport type { GraphPaneModel } from '../model'\nimport type { RepeatSequence, RepeatUnit } from '../repeats/repeatFeatures'\nimport type { WalkCall } from '../repeats/walkCalls'\nimport type { WalkRun } from '@jbrowse/bandage-core/layout/walkRows'\n\n// The walk-rows layout's bars: one per haplotype walk under the reference line\n// the canvas draws, each on its own bp axis from the window's left edge. Blue\n// marks sequence shared with the reference walk and purple sequence only the\n// haplotypes carry. Under the reference-position ramp, shared sequence takes\n// the hue of the reference it is threaded through and haplotype-only sequence\n// the charcoal the ramp reserves for rGFA's off-reference ranks. In a tandem\n// array the threading is the aligner's pick among near-identical copies, so\n// the hue there says which reference copy the graph used, not which one a copy\n// resembles. The readout at the end of a bar is what it carries against the\n// reference, which for a repeat array is the expansion.\n//\n// A repeat record that states each allele's runs (VCF 4.5 <CNV:TR> RN, RUS,\n// RUC, RB) paints every bar by unit instead: the allele paired with THAT walk,\n// one colour per unit the record names. A record stating only a length marks\n// it with a tick. The walk rows pair them \u2014 see repeats/walkCalls.ts, which\n// also holds the threshold this reads a red readout off.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'visible' as const,\n zIndex: 3,\n}\n\nconst ON_REFERENCE = '#2f8fd6'\nconst CALL_TICK = '#111'\nconst UNBACKED_TICK = '#9e9e9e'\nconst DISAGREES = '#c62828'\nconst OFF_REFERENCE = '#8e3fbf'\nconst BAR_PX = 12\n\n// Tableau 10, whose leading hues stay apart in lightness as well as hue\nconst UNIT_COLORS = [\n '#4e79a7',\n '#f28e2b',\n '#59a14f',\n '#e15759',\n '#76b7b2',\n '#edc948',\n '#b07aa1',\n '#ff9da7',\n '#9c755f',\n '#bab0ac',\n]\nconst NO_ALLELE = '#d0d0d0'\n// the canvas's grey scheme, for the backbone past the array when no ramp is\n// drawn anywhere else\nconst BACKBONE = 'rgb(160, 160, 160)'\n\nfunction unitColor(units: RepeatUnit[], unit: string) {\n const i = units.findIndex(u => u.unit === unit)\n return i < 0 ? NO_ALLELE : UNIT_COLORS[i % UNIT_COLORS.length]!\n}\n\nconst legendBoxStyle = {\n background: 'rgba(255,255,255,0.82)',\n padding: '4px 6px',\n borderRadius: 3,\n fontSize: 11,\n lineHeight: '15px',\n whiteSpace: 'nowrap' as const,\n}\nconst legendRowStyle = { display: 'flex', alignItems: 'center', gap: 5 }\nconst swatchStyle = { width: 18, height: BAR_PX - 4, borderRadius: 2 }\nconst tickSwatchStyle = {\n ...swatchStyle,\n display: 'flex',\n justifyContent: 'center',\n}\n\nfunction TickSwatch({ color }: { color: string }) {\n return (\n <div style={tickSwatchStyle}>\n <div style={{ width: 2, backgroundColor: color }} />\n </div>\n )\n}\n\n// What the bar colours and the ticks mean, in the legend stack with the other\n// keys. The reference row is named, so \"the reference\" here reads as that row.\n// Each tick row appears once the rows hold one, so a catalogue with no\n// genotypes keeps the two-colour key it had.\nexport const WalkRowsLegend = observer(function WalkRowsLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const bars = model.walkRowBars\n if (!bars) {\n return null\n }\n const ramp = model.referenceRampDomain\n const units = model.walkRowUnits\n const drawn = [bars.reference, ...bars.rows]\n const calls = drawn.flatMap(row =>\n row.call && !row.call.sequences ? row.call : [],\n )\n return (\n <div style={legendBoxStyle} data-testid=\"graph-walk-rows-legend\">\n {units ? (\n <>\n {units.map((unit, i) => (\n <div key={unit.unit} style={legendRowStyle}>\n <div\n style={{\n ...swatchStyle,\n backgroundColor: unitColor(units, unit.unit),\n }}\n />\n <span>\n unit {i + 1} \u00B7 {unit.unitLength.toLocaleString()} bp\n </span>\n </div>\n ))}\n {drawn.some(row => !row.call?.sequences) ? (\n <div style={legendRowStyle}>\n <div style={{ ...swatchStyle, backgroundColor: NO_ALLELE }} />\n <span>no allele in the repeat track</span>\n </div>\n ) : null}\n </>\n ) : (\n <>\n <div style={legendRowStyle}>\n <div\n style={{\n ...swatchStyle,\n background: ramp ? RAMP_GRADIENT_CSS : ON_REFERENCE,\n }}\n />\n <span>shared with {bars.reference.label}</span>\n </div>\n <div style={legendRowStyle}>\n <div\n style={{\n ...swatchStyle,\n backgroundColor: ramp ? REFERENCE_RAMP_ALT_CSS : OFF_REFERENCE,\n }}\n />\n <span>carried by haplotypes only</span>\n </div>\n </>\n )}\n {calls.some(call => call.spanningReads !== 0) ? (\n <div style={legendRowStyle}>\n <TickSwatch color={CALL_TICK} />\n <span>allele length called for this walk</span>\n </div>\n ) : null}\n {calls.some(call => call.spanningReads === 0) ? (\n <div style={legendRowStyle}>\n <TickSwatch color={UNBACKED_TICK} />\n <span>called with no read spanning it</span>\n </div>\n ) : null}\n {calls.some(call => call.agrees === false) ? (\n <div style={legendRowStyle}>\n <div style={swatchStyle} />\n <span style={{ color: DISAGREES }}>\n walk and call over {Math.round(CALL_TOLERANCE * 100)}% apart\n </span>\n </div>\n ) : null}\n </div>\n )\n})\n\nfunction kb(bp: number) {\n return `${(bp / 1000).toFixed(bp < 10_000 ? 1 : 0)} kb`\n}\n\nfunction units(bp: number, unit: number | undefined) {\n return unit ? ` \u2248 ${Math.round(bp / unit)} units` : ''\n}\n\n// A call stating its runs counts its copies outright; otherwise the bar's\n// length in units is the estimate.\nfunction copies(bp: number, unit: number | undefined, call?: WalkCall) {\n if (!call?.sequences) {\n return units(bp, unit)\n }\n const n = call.sequences.reduce((sum, run) => sum + run.count, 0)\n return ` \u00B7 ${Number.isInteger(n) ? n : n.toFixed(1)} copies`\n}\n\nfunction readout(\n row: { bp: number; complete: boolean; call?: WalkCall },\n referenceBp: number,\n unit: number | undefined,\n) {\n const { bp, complete, call } = row\n const delta = bp - referenceBp\n const against =\n delta === 0 ? '' : ` (${delta > 0 ? '+' : '\u2212'}${kb(Math.abs(delta))})`\n const called = call && !call.sequences ? calledReadout(call) : ''\n return `${kb(bp)}${copies(bp, unit, call)}${against}${complete ? '' : ' \u00B7 partial walk'}${called}`\n}\n\nfunction calledReadout(call: { bp: number; spanningReads?: number }) {\n const unbacked = call.spanningReads === 0 ? ' \u00B7 no spanning read' : ''\n return ` \u00B7 called ${kb(call.bp)}${unbacked}`\n}\n\n// Each run's extent from the bar's left end, and where each of its copies\n// starts: RUB's lengths where the record gives them, else the unit's.\nfunction runsOf(sequences: RepeatSequence[]) {\n let at = 0\n return sequences.map(run => {\n const start = at\n const lengths =\n run.copyBp ??\n Array.from({ length: Math.ceil(run.count) }, () => run.unitLength)\n const copyStarts: number[] = []\n let copy = start\n for (const bp of lengths) {\n copyStarts.push(copy)\n copy += bp\n }\n at += run.bp\n return { start, bp: run.bp, unit: run.unit, copyStarts }\n })\n}\n\n// One separator per unit along a bar, so copies are countable, dropped when a\n// unit is under a few px. The reference bar is the canvas's, so it gets none.\nconst MIN_TILE_PX = 3\n\nfunction tileSeparators(bp: number, unit: number, X: (bp: number) => number) {\n if (X(unit) - X(0) < MIN_TILE_PX) {\n return []\n }\n const xs: number[] = []\n for (let k = unit; k < bp; k += unit) {\n xs.push(k)\n }\n return xs\n}\n\n// A shared run covers its reference contiguously, so a gradient along it\n// paints the hue of every base.\nfunction runFill(\n run: WalkRun,\n ramp: { start: number; end: number } | undefined,\n gradientId: string,\n) {\n if (!ramp) {\n return { fill: run.onReference ? ON_REFERENCE : OFF_REFERENCE }\n }\n if (run.referenceStart === undefined) {\n return { fill: REFERENCE_RAMP_ALT_CSS }\n }\n const stops = rampStops({ ...run, start: run.referenceStart }, ramp)\n if (stops.length === 1) {\n return { fill: rampHueCss(stops[0]!) }\n }\n return {\n fill: `url(#${gradientId})`,\n gradient: (\n <linearGradient id={gradientId}>\n {stops.map((hue, i) => (\n <stop\n key={i}\n offset={i / (stops.length - 1)}\n stopColor={rampHueCss(hue)}\n />\n ))}\n </linearGradient>\n ),\n }\n}\n\nconst WalkRowsOverlay = observer(function WalkRowsOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const idPrefix = useId().replace(/[^\\w-]/g, '')\n const { walkRowBars, referenceRampDomain: ramp } = model\n if (!walkRowBars) {\n return null\n }\n const {\n scaleX,\n scaleY,\n translateX,\n translateY,\n paneWidth: width,\n canvasHeight,\n } = model\n const X = (bp: number) => bp * scaleX + translateX\n const Y = (row: number) => row * ROW_HEIGHT_PX * scaleY + translateY\n const { origin, unit, reference, rows } = walkRowBars\n const units = model.walkRowUnits\n // The backbone the canvas draws spans the cut window, which reaches past a\n // selected array on both sides, so the reference readout sits after it.\n const backboneStart = Math.min(origin, model.graphRegion?.start ?? origin)\n const backboneEnd = Math.max(\n origin + reference.bp,\n model.graphRegion?.end ?? 0,\n )\n // A readout that would leave the pane is written inside the end of its bar.\n const label = (text: string, endBp: number, y: number, fill = '#333') => {\n const x = X(endBp) + 6\n const fits = x + text.length * LABEL_CHAR_PX < width\n return (\n <text\n x={fits ? x : X(endBp) - 6}\n y={y + 4}\n fontSize={11}\n fontFamily=\"sans-serif\"\n fill={fill}\n stroke={fits ? undefined : 'white'}\n strokeWidth={fits ? undefined : 3}\n paintOrder=\"stroke\"\n textAnchor={fits ? 'start' : 'end'}\n >\n {text}\n </text>\n )\n }\n const separators = (starts: number[], bp: number, y: number) =>\n starts\n .filter(k => k > 0 && k < bp)\n .map(k => (\n <line\n key={k}\n x1={X(origin + k)}\n x2={X(origin + k)}\n y1={y - BAR_PX / 2}\n y2={y + BAR_PX / 2}\n stroke=\"white\"\n strokeWidth={1}\n />\n ))\n const rect = (start: number, bp: number, y: number, fill: string) => (\n <rect\n key={start}\n x={X(origin + start)}\n y={y - BAR_PX / 2}\n width={Math.max(1, bp * scaleX)}\n height={BAR_PX}\n fill={fill}\n />\n )\n // The paired allele's runs, cut at the end of the walk, over grey where it\n // states none.\n const unitBar = (\n row: { bp: number; call?: WalkCall },\n y: number,\n painted: RepeatUnit[],\n ) => {\n const runs = row.call?.sequences ? runsOf(row.call.sequences) : []\n const tiled = unit !== undefined && unit * scaleX >= MIN_TILE_PX\n return (\n <>\n {rect(0, row.bp, y, NO_ALLELE)}\n {runs\n .filter(run => run.start < row.bp)\n .map(run =>\n rect(\n run.start,\n Math.min(run.bp, row.bp - run.start),\n y,\n unitColor(painted, run.unit),\n ),\n )}\n {tiled\n ? separators(\n runs.flatMap(run => run.copyStarts),\n row.bp,\n y,\n )\n : null}\n </>\n )\n }\n return (\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-walk-rows\"\n >\n {units ? (\n <>\n <rect\n x={X(backboneStart) - BAR_PX / 2}\n y={Y(0) - BAR_PX / 2}\n width={(backboneEnd - backboneStart) * scaleX + BAR_PX}\n height={BAR_PX}\n rx={BAR_PX / 2}\n fill={BACKBONE}\n />\n {unitBar(reference, Y(0), units)}\n </>\n ) : null}\n {label(\n `${kb(reference.bp)}${copies(reference.bp, unit, reference.call)}`,\n backboneEnd,\n Y(0),\n )}\n {rows.map((row, i) => {\n const y = Y(i + 1)\n if (y < -BAR_PX || y > canvasHeight + BAR_PX) {\n return null\n }\n const { call } = row\n return (\n <g key={row.name} data-testid=\"graph-walk-row\">\n {units ? (\n unitBar(row, y, units)\n ) : (\n <>\n {row.runs.map(run => {\n const { fill, gradient } = runFill(\n run,\n ramp,\n `${idPrefix}-${i}-${run.start}`,\n )\n return (\n <g key={run.start}>\n {gradient}\n {rect(run.start, run.bp, y, fill)}\n </g>\n )\n })}\n {unit\n ? separators(\n tileSeparators(row.bp, unit, bp => bp * scaleX),\n row.bp,\n y,\n )\n : null}\n </>\n )}\n {call && !call.sequences ? (\n <rect\n data-testid=\"graph-walk-call\"\n x={X(origin + call.bp) - 1}\n y={y - BAR_PX / 2 - 3}\n width={2}\n height={BAR_PX + 6}\n fill={call.spanningReads === 0 ? UNBACKED_TICK : CALL_TICK}\n />\n ) : null}\n {label(\n readout(row, reference.bp, unit),\n origin + row.bp,\n y,\n call?.agrees === false ? DISAGREES : undefined,\n )}\n </g>\n )\n })}\n </svg>\n )\n})\n\nexport default WalkRowsOverlay\n", "import { REFERENCE_RAMP_MAX_HUE } from '@jbrowse/bandage-core/renderer/GeometryBuilder'\n\n// The reference-position ramp in CSS, from the same three numbers\n// `getNodeColor` paints with (hue 0 to REFERENCE_RAMP_MAX_HUE at 70%/50%), so\n// a key or an overlay cannot come to describe a ramp the canvas stopped using.\n\nexport function rampHueCss(hue: number) {\n return `hsl(${hue}, 70%, 50%)`\n}\n\nexport function rampHue(bp: number, domain: { start: number; end: number }) {\n const frac = (bp - domain.start) / (domain.end - domain.start)\n return Math.max(0, Math.min(1, frac)) * REFERENCE_RAMP_MAX_HUE\n}\n\n// hue degrees one gradient stop spans, since SVG interpolates stops in RGB\nconst HUE_STOP_DEG = 30\n\n// The hues a gradient across `bp` of reference paints, evenly spaced along it\n// and walked from `to`'s end when reversed. One hue means the span reads flat.\nexport function rampStops(\n { start, bp, reversed }: { start: number; bp: number; reversed?: boolean },\n domain: { start: number; end: number },\n) {\n const low = rampHue(start, domain)\n const high = rampHue(start + bp, domain)\n if (high - low < 1) {\n return [(low + high) / 2]\n }\n const n = Math.ceil((high - low) / HUE_STOP_DEG)\n return Array.from({ length: n + 1 }, (_, i) =>\n rampHue(start + (bp * (reversed ? n - i : i)) / n, domain),\n )\n}\n\nexport const RAMP_GRADIENT_CSS = `linear-gradient(to right, ${Array.from(\n { length: 7 },\n (_, i) => `${rampHueCss((i / 6) * REFERENCE_RAMP_MAX_HUE)} ${(i / 6) * 100}%`,\n).join(', ')})`\n", "import {\n abgrToCssRgba,\n normalizedRgbToCssRgba,\n} from '@jbrowse/core/util/colorBits'\nimport { syncCanvasSize } from '@jbrowse/render-core/canvas2dUtils'\nimport { Canvas2DRenderingBackendBase } from '@jbrowse/render-core/renderingBackendBase'\n\nimport { brightenAbgr } from './colorBits'\n\nimport type {\n Arrowhead,\n RenderBatch,\n Renderer,\n TransformUniform,\n} from './types'\n\n// Everything is drawn as a handful of paths, one per distinct (colour, weight),\n// rather than one path per thing. A drawing is mostly runs of one colour, and\n// Canvas2D's cost is per path verb and per fill or stroke, not per pixel: the\n// same 15k-node graph took 414 ms a frame as one fill per mesh triangle and 11\n// ms as batched strokes (agent-docs/GRAPH_SCALE_AND_LOD.md). Highlighted things\n// are drawn last, in their own paths, so they sit on top of what they brighten.\n//\n// Extends the shared Canvas2D base rather than standing alone, which is how\n// `setErrorHandler` arrives \u2014 `useRenderingBackend` requires it. The base's\n// no-op implementation is the correct one here: Canvas2D allocates no GPU\n// resources, so there is no OOM channel to forward.\nexport class Canvas2DRenderer\n extends Canvas2DRenderingBackendBase\n implements Renderer\n{\n private transform: TransformUniform | null = null\n private batch: RenderBatch | null = null\n private nodeHighlights: ReadonlyMap<string, number> = new Map()\n private highlightedEdge: number | null = null\n private highlightFactor = 1\n\n // render-core's, not a local `width * devicePixelRatio`: it clamps the\n // backing store at MAX_CANVAS_DIM_PX, reads the ratio through `getDpr()` so\n // this agrees with the transform the model builds, and writes the css size\n // independently of the backing size.\n resize(width: number, height: number) {\n syncCanvasSize(this.ctx.canvas, width, height)\n }\n\n uploadGeometry(batch: RenderBatch) {\n this.batch = batch\n // A rebuild renumbers the strokes, so the old edge no longer addresses the\n // same run; the model re-applies the current hover against the new batch.\n this.highlightedEdge = null\n }\n\n setNodeHighlights(factors: ReadonlyMap<string, number>) {\n this.nodeHighlights = factors\n }\n\n setEdgeHighlight(edgeIndex: number | null, factor: number) {\n this.highlightedEdge = edgeIndex\n this.highlightFactor = factor\n }\n\n updateTransform(transform: TransformUniform) {\n this.transform = transform\n }\n\n render(clearColor: [number, number, number, number]) {\n const t = this.transform\n if (!t) {\n return\n }\n const ctx = this.ctx\n const { width, height } = ctx.canvas\n\n ctx.fillStyle = normalizedRgbToCssRgba(\n [clearColor[0], clearColor[1], clearColor[2]],\n clearColor[3],\n )\n ctx.fillRect(0, 0, width, height)\n\n const batch = this.batch\n if (!batch) {\n return\n }\n ctx.lineCap = 'round'\n ctx.lineJoin = 'round'\n this.renderEdges(batch)\n this.renderNodes(batch)\n this.renderArrows(batch)\n }\n\n private renderEdges(batch: RenderBatch) {\n const t = this.transform!\n const ctx = this.ctx\n const hl =\n this.highlightedEdge === null\n ? undefined\n : batch.edgeCurveRuns.get(this.highlightedEdge)\n for (const { color, items } of groupByPaint(batch.edgeCurves, (e, i) => ({\n color: inRun(hl, i)\n ? brightenAbgr(e.color, this.highlightFactor)\n : e.color,\n weight: e.thickness,\n last: inRun(hl, i),\n }))) {\n ctx.strokeStyle = abgrToCssRgba(color)\n // thickness is the half-width in css px, so the stroke is twice it at\n // the device ratio the transform already carries\n ctx.lineWidth = items[0]!.thickness * 2 * t.dpr\n ctx.beginPath()\n for (const e of items) {\n const first = e.curves[0]!\n ctx.moveTo(\n first.x0 * t.scaleX + t.translateX,\n first.y0 * t.scaleY + t.translateY,\n )\n for (const c of e.curves) {\n ctx.bezierCurveTo(\n c.cx0 * t.scaleX + t.translateX,\n c.cy0 * t.scaleY + t.translateY,\n c.cx1 * t.scaleX + t.translateX,\n c.cy1 * t.scaleY + t.translateY,\n c.x1 * t.scaleX + t.translateX,\n c.y1 * t.scaleY + t.translateY,\n )\n }\n }\n ctx.stroke()\n }\n }\n\n private renderNodes(batch: RenderBatch) {\n const t = this.transform!\n const ctx = this.ctx\n // stroke index -> brighten factor, for the nodes the model lifted\n const lifted = new Map<number, number>()\n for (const [nodeId, factor] of this.nodeHighlights) {\n const run = batch.nodeStrokeRuns.get(nodeId)\n if (run) {\n for (let i = run.start; i < run.start + run.count; i++) {\n lifted.set(i, factor)\n }\n }\n }\n for (const { color, items } of groupByPaint(batch.nodeStrokes, (s, i) => {\n const factor = lifted.get(i)\n return {\n color: factor === undefined ? s.color : brightenAbgr(s.color, factor),\n weight: s.thickness,\n last: factor !== undefined,\n }\n })) {\n ctx.strokeStyle = abgrToCssRgba(color)\n ctx.lineWidth = items[0]!.thickness * 2 * t.dpr\n ctx.beginPath()\n for (const s of items) {\n const p0 = s.points[0]!\n ctx.moveTo(\n p0.x * t.scaleX + t.translateX,\n p0.y * t.scaleY + t.translateY,\n )\n for (let i = 1, l = s.points.length; i < l; i++) {\n const p = s.points[i]!\n ctx.lineTo(\n p.x * t.scaleX + t.translateX,\n p.y * t.scaleY + t.translateY,\n )\n }\n }\n ctx.stroke()\n }\n }\n\n private renderArrows(batch: RenderBatch) {\n const t = this.transform!\n const ctx = this.ctx\n const hl =\n this.highlightedEdge === null\n ? undefined\n : batch.arrowRuns.get(this.highlightedEdge)\n for (const { color, items } of groupByPaint(batch.arrows, (a, i) => ({\n color: inRun(hl, i)\n ? brightenAbgr(a.color, this.highlightFactor)\n : a.color,\n weight: 0,\n last: inRun(hl, i),\n }))) {\n ctx.fillStyle = abgrToCssRgba(color)\n ctx.beginPath()\n for (const a of items) {\n const [tip, left, notch, right] = arrowheadOutline(a, t)\n ctx.moveTo(tip.x, tip.y)\n ctx.lineTo(left.x, left.y)\n ctx.lineTo(notch.x, notch.y)\n ctx.lineTo(right.x, right.y)\n ctx.closePath()\n }\n ctx.fill()\n }\n }\n\n override dispose() {\n super.dispose()\n this.batch = null\n this.nodeHighlights = new Map()\n this.highlightedEdge = null\n }\n}\n\n// How far the back of the head is cut in toward the tip, as a fraction of its\n// length. The notch leaves the edge showing through the back of the head, so\n// the head reads as the end of the edge rather than a triangle laid over it.\nconst ARROW_NOTCH = 0.25\n\n// Tip, left barb, notch and right barb in backing-store px.\nexport function arrowheadOutline(a: Arrowhead, t: TransformUniform) {\n const ux = Math.cos(a.angle)\n const uy = Math.sin(a.angle)\n const tipX = a.x * t.scaleX + t.translateX\n const tipY = a.y * t.scaleY + t.translateY\n const length = a.length * t.dpr\n const halfWidth = a.halfWidth * t.dpr\n const backX = tipX - ux * length\n const backY = tipY - uy * length\n const notchBack = length * (1 - ARROW_NOTCH)\n return [\n { x: tipX, y: tipY },\n { x: backX - uy * halfWidth, y: backY + ux * halfWidth },\n { x: tipX - ux * notchBack, y: tipY - uy * notchBack },\n { x: backX + uy * halfWidth, y: backY - ux * halfWidth },\n ] as const\n}\n\nfunction inRun(run: { start: number; count: number } | undefined, i: number) {\n return run !== undefined && i >= run.start && i < run.start + run.count\n}\n\ninterface Paint {\n color: number\n weight: number\n // drawn after everything else, so a highlight lands on top of its neighbours\n last: boolean\n}\n\n// Items bucketed by what they are painted with, in first-seen order, with the\n// `last` ones after the rest.\nfunction groupByPaint<T>(\n items: T[],\n paintOf: (item: T, index: number) => Paint,\n) {\n const groups = new Map<string, { color: number; items: T[] }>()\n const deferred = new Map<string, { color: number; items: T[] }>()\n for (let i = 0, l = items.length; i < l; i++) {\n const item = items[i]!\n const { color, weight, last } = paintOf(item, i)\n const into = last ? deferred : groups\n const key = `${color}:${weight}`\n const group = into.get(key)\n if (group) {\n group.items.push(item)\n } else {\n into.set(key, { color, items: [item] })\n }\n }\n return [...groups.values(), ...deferred.values()]\n}\n", "import { Canvas2DRenderer } from '@jbrowse/bandage-core/renderer/Canvas2DRenderer'\n\n// Canvas2D only, and deliberately not through render-core's GPU ladder. The\n// batch is strokes and arrowheads in layout units, and stroking them batched by\n// colour is inside a frame budget at the node counts this view caps itself at\n// (agent-docs/GRAPH_SCALE_AND_LOD.md), so a GPU backend would buy a few\n// milliseconds for ~30 KB of bundled HAL and a shader toolchain. If one is ever\n// wanted, it should take the same `Renderer` interface and draw the batch as\n// instances \u2014 a capsule per node segment, a bezier ribbon per edge stroke \u2014\n// rather than reviving a triangle mesh; agent-docs/IDEAS.md scopes it.\nexport function createGraphRenderer(canvas: HTMLCanvasElement) {\n return Promise.resolve(new Canvas2DRenderer(canvas))\n}\n"],
5
- "mappings": "+gBAAA,IAAAA,GAAAC,GAAA,CAAAC,GAAAC,KAAA,CAAAA,GAAO,QAAU,eAAe,0CAA0C,ICA1E,IAAAC,GAAAC,GAAA,CAAAC,GAAAC,KAAA,CAAAA,GAAO,QAAU,eAAe,2CAA2C,ICA3E,IAAAC,EAA4C,UC4B5C,IAAMC,GAAqB,GAO3B,SAASC,GAAmBC,EAAqBC,EAAe,CAC9D,OAAOA,EAAQ,EAAI,KAAK,IAAI,EAAGD,EAAcC,CAAK,EAAIH,EACxD,CAMA,SAASI,GAAWC,EAA2B,CAC7C,IAAMC,EAAW,IAAI,IACjBC,EAAM,IACNC,EAAM,KACV,QAAWC,KAAOJ,EAChBC,EAAS,IAAIG,EAAI,IAAI,EACrBF,EAAM,KAAK,IAAIA,EAAKE,EAAI,IAAI,EAC5BD,EAAM,KAAK,IAAIA,EAAKC,EAAI,IAAI,EAE9B,OAAOH,EAAS,KAAO,GAAKE,EAAMD,IAAQD,EAAS,KAAO,GAAK,MACjE,CAIA,SAASI,GACPL,EACAM,EACAC,EACU,CACV,IAAMC,EAAIZ,GAAmBU,EAASN,EAAM,MAAM,EAClD,MAAO,CACL,EAAAQ,EACA,EACED,EAAU,EACNX,GAAmBW,EAASP,EAAM,MAAM,EACvCD,GAAWC,CAAK,GAAKQ,CAC9B,CACF,CAEA,SAASC,GACPC,EACAV,EACAM,EACAC,EACU,CACV,OAAOG,IAAU,OACbL,GAAaL,EAAOM,EAASC,C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OA,EAAM,MACb,QACEA,EAAM,aACF,IAAM,CACJA,EAAM,UAAU,CAClB,EACA,OAER,EACE,MACN,CAEJ,CAAC,EAEM4G,GAAQ3C",
6
- "names": ["require_useRenderingBackend", "__commonJSMin", "exports", "module", "require_renderingBackendBase", "__commonJSMin", "exports", "module", "import_react", "FALLBACK_CELL_SIZE", "meanExtentCellSize", "extentTotal", "count", "rowPitchOf", "boxes", "distinct", "min", "max", "box", "cellSizeFrom", "extentX", "extentY", "x", "resolveCellSize", "given", "getOrCreateCell", "cells", "cx", "cy", "row", "cell", "addToGrid", "cellSize", "minX", "minY", "maxX", "maxY", "entry", "cx0", "cx1", "cy0", "cy1", "queryGrid", "y", "radiusX", "radiusY", "results", "seen", "SpatialIndex", "nodePositions", "nodeId", "segments", "i", "seg", "next", "b", "EdgeSpatialIndex", "graph", "drawPaths", "axis", "deletions", "version", "baseEdgeCurves", "ei", "edge", "fromSegments", "toSegments", "curves", "curveBounds", "numPaths", "padX", "padY", "o", "pathRibbonOffsets", "distanceToSegment", "px", "py", "x1", "y1", "x2", "y2", "dx", "dy", "lenSq", "t", "distanceToCubicBezier", "cx1", "cy1", "cx2", "cy2", "minDist", "samples", "lastX", "lastY", "i", "u", "bx", "by", "distanceToBezierCurve", "c", "distanceToEdgeCurves", "curves", "yToX", "d", "nodeCache", "getSpatialIndex", "nodePositions", "version", "cached", "index", "SpatialIndex", "edgeCache", "getEdgeSpatialIndex", "graph", "drawPaths", "axis", "deletions", "EdgeSpatialIndex", "MIN_NODE_REACH_PX", "findHoveredNode", "graphX", "graphY", "ink", "yToXOf", "reach", "queryReach", "candidates", "hovered", "best", "nodeId", "segmentIdx", "segments", "dist", "findHoveredEdge", "hiddenEdges", "edgeThreshold", "edgeIndex", "edgeIdx", "edge", "fromSegments", "toSegments", "numPaths", "baseCurves", "offset", "pathRibbonOffsets", "translateCurves", "wheelZoomFactor", "e", "px", "notches", "import_ui", "import_mobx_state_tree", "import_useRenderingBackend", "import_jsx_runtime", "Info_default", "_jsx", "import_mobx_react", "import_mobx_react", "import_jsx_runtime", "svgStyle", "BubbleHalos", "model", "bubbleHalos", "walkHighlight", "scaleX", "scaleY", "translateX", "translateY", "width", "canvasHeight", "halo", "HALO_FACTOR", "dimmedBubble", "id", "BUBBLE_KIND_COLORS", "BubbleHalos_default", "import_material", "import_mobx_react", "import_jsx_runtime", "svgStyle", "backButtonStyle", "MIN_GLYPH_PX", "glyphHeight", "bp", "room", "raw", "BubbleOverlay", "model", "bubbleGlyphs", "poppedFrom", "back", "scaleX", "translateX", "translateY", "width", "canvasHeight", "lineY", "X", "labels", "labelsBottom", "l", "glyphs", "a", "b", "bubble", "kind", "label", "x0", "x1", "w", "cx", "h", "color", "BUBBLE_KIND_COLORS", "skipped", "dip", "key", "glyphX", "x", "y", "top", "BubbleOverlay_default", "import_mobx_react", "import_jsx_runtime", "svgStyle", "EXON_COLOR", "GenePins", "model", "genePins", "scaleX", "scaleY", "translateX", "translateY", "width", "canvasHeight", "contigThickness", "pin", "GenePins_default", "import_jsx_runtime", "CropFree_default", "_jsx", "import_jsx_runtime", "ZoomIn_default", "_jsx", "import_jsx_runtime", "ZoomOut_default", "_jsx", "import_material", "import_mobx_react", "import_mui", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "ColorSchemeSelect", "model", "classes", "e", "COLOR_SCHEMES", "value", "label", "ColorSchemeSelect_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "fmtMs", "ms", "GraphPerf", "model", "classes", "lastFetchMs", "lastLayoutMs", "lastGeometryMs", "hasMetrics", "GraphStats", "GraphStats_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "LayoutSelect", "model", "classes", "graph", "e", "LAYOUT_MODES", "value", "label", "description", "available", "LayoutSelect_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "RepeatSelect", "model", "classes", "repeatChoices", "keys", "r", "e", "key", "name", "unit", "RepeatSelect_default", "import_react", "import_ui", "import_jsx_runtime", "Delete_default", "_jsx", "import_jsx_runtime", "MoreVert_default", "_jsx", "import_mobx_react", "import_jsx_runtime", "SettingsMenu", "model", "settingsOpen", "setSettingsOpen", "Settings_default", "Delete_default", "MoreVert_default", "GraphSettingsDialog_default", "SettingsMenu_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "WalkSelect", "model", "classes", "walkChoices", "names", "c", "e", "name", "label", "WalkSelect_default", "import_jsx_runtime", "useStyles", "ZoomDisplay", "model", "GraphToolbar", "classes", "LayoutSelect_default", "ColorSchemeSelect_default", "WalkSelect_default", "RepeatSelect_default", "ZoomIn_default", "ZoomOut_default", "CropFree_default", "GraphStats_default", "SettingsMenu_default", "GraphToolbar_default", "import_mobx_react", "import_jsx_runtime", "LabelChip", "x", "y", "w", "text", "color", "italic", "small", "dimmed", "title", "testId", "onClick", "import_jsx_runtime", "svgStyle", "LabelLayer", "model", "bubbles", "genes", "routes", "walkHighlight", "scaleY", "translateY", "contigThickness", "dimmedBubble", "h", "id", "dimmedRoute", "r", "pin", "x", "y", "w", "text", "EXON_COLOR", "LabelChip", "route", "BUBBLE_KIND_COLORS", "LabelLayer_default", "import_react", "import_canvas2dUtils", "import_mobx", "import_mobx_react", "import_jsx_runtime", "canvasStyle", "TubeMapOverlay", "model", "ref", "tubeMapPicture", "paneWidth", "canvasHeight", "canvas", "picture", "frame", "ctx", "dpr", "width", "height", "tubeFrame", "drawTubeMap", "drawDeviationMarks", "drawTubeMapConnectors", "bounds", "drawTubeMapGenes", "boxes", "drawTubeMapRuler", "TubeMapOverlay_default", "legendBoxStyle", "legendRowStyle", "SWATCH_PX", "ZigzagSwatch", "teeth", "ZIGZAG_PX", "dx", "mid", "ZIGZAG_AMPLITUDE_PX", "points", "i", "rulerInk", "tubeSwatchStyle", "TickSwatch", "deviationInk", "TubeMapLegend", "squeezed", "foldBp", "formatBp", "import_react", "import_mobx_react", "rampHueCss", "hue", "rampHue", "bp", "domain", "frac", "REFERENCE_RAMP_MAX_HUE", "HUE_STOP_DEG", "rampStops", "start", "reversed", "low", "high", "n", "_", "i", "RAMP_GRADIENT_CSS", "import_jsx_runtime", "svgStyle", "ON_REFERENCE", "CALL_TICK", "UNBACKED_TICK", "DISAGREES", "OFF_REFERENCE", "BAR_PX", "UNIT_COLORS", "NO_ALLELE", "BACKBONE", "unitColor", "units", "unit", "i", "u", "legendBoxStyle", "legendRowStyle", "swatchStyle", "tickSwatchStyle", "TickSwatch", "color", "WalkRowsLegend", "model", "bars", "ramp", "drawn", "calls", "row", "RAMP_GRADIENT_CSS", "REFERENCE_RAMP_ALT_CSS", "call", "kb", "bp", "copies", "sum", "run", "readout", "referenceBp", "complete", "delta", "against", "called", "calledReadout", "unbacked", "runsOf", "sequences", "at", "start", "lengths", "copyStarts", "copy", "MIN_TILE_PX", "tileSeparators", "X", "xs", "k", "runFill", "gradientId", "stops", "rampStops", "rampHueCss", "hue", "WalkRowsOverlay", "idPrefix", "walkRowBars", "scaleX", "scaleY", "translateX", "translateY", "width", "canvasHeight", "Y", "origin", "reference", "rows", "backboneStart", "backboneEnd", "label", "text", "endBp", "y", "fill", "x", "fits", "separators", "starts", "rect", "unitBar", "painted", "runs", "tiled", "gradient", "WalkRowsOverlay_default", "import_colorBits", "import_canvas2dUtils", "import_renderingBackendBase", "Canvas2DRenderer", "width", "height", "batch", "factors", "edgeIndex", "factor", "transform", "clearColor", "ctx", "t", "hl", "color", "items", "groupByPaint", "e", "i", "inRun", "brightenAbgr", "first", "c", "lifted", "nodeId", "run", "s", "p0", "l", "p", "a", "tip", "left", "notch", "right", "arrowheadOutline", "ARROW_NOTCH", "ux", "uy", "tipX", "tipY", "length", "halfWidth", "backX", "backY", "notchBack", "paintOf", "groups", "deferred", "item", "weight", "last", "into", "key", "group", "createGraphRenderer", "canvas", "Canvas2DRenderer", "import_jsx_runtime", "tooltipStyle", "wrapperStyle", "canvasAreaStyle", "loadingLayerStyle", "rowLabelStyle", "RowLabels", "model", "rowLabels", "label", "y", "screenY", "legendStackStyle", "LEGEND_INSET_PX", "legendBoxStyle", "pathLegendRowStyle", "pathSwatchStyle", "PathLegend", "pathLegend", "name", "color", "WalkReadout", "h", "c", "delta", "rampStripStyle", "RAMP_GRADIENT_CSS", "rampEndsStyle", "ReferenceRampLegend", "domain", "formatBp", "nodeLabelStyle", "deletionLabelStyle", "leaderStyle", "Legends", "ref", "el", "observer", "TubeMapLegend", "WalkRowsLegend", "GraphSizeLabels", "labels", "leaders", "key", "leader", "arcX", "arcY", "labelX", "labelY", "text", "x", "kind", "HoverTooltips", "hoveredNodeData", "hoveredEdgeData", "ownLocation", "nodeOwnLocation", "hoveredDeletion", "d", "locLabel", "NodeContextMenu", "nodeId", "top", "left", "onClose", "own", "reference", "highlight", "callback", "Info_default", "nodeLaunchMenuItems", "target", "GraphCanvas", "ownChrome", "canvasRef", "canvas", "renderError", "retryRender", "createGraphRenderer", "lastMouseRef", "hasMovedRef", "pendingRef", "contextNode", "setContextNode", "handleWheel", "e", "rect", "wheelZoomFactor", "screenToGraph", "screenX", "getMouseCoord", "nodeAt", "nodePositions", "findHoveredNode", "handleMouseDown", "node", "applyPending", "pending", "findHoveredEdge", "scheduleFrame", "dropPending", "handleMouseMove", "dx", "dy", "handleMouseUp", "handleMouseLeave", "handleContextMenu", "handleClick", "GraphToolbar_default", "TubeMapOverlay_default", "BubbleHalos_default", "GenePins_default", "LabelLayer_default", "BubbleOverlay_default", "WalkRowsOverlay_default", "GraphCanvas_default"]
7
- }