jbrowse-plugin-graphgenomeviewer 4.0.19 → 4.0.21

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 (38) hide show
  1. package/README.md +2 -1
  2. package/dist/chunks/{GbzBaseSyntenyAdapter-KKSNCZXY.js → GbzBaseSyntenyAdapter-7ZKFAEJG.js} +2 -2
  3. package/dist/chunks/{GbzBaseSyntenyAdapter-KKSNCZXY.js.map → GbzBaseSyntenyAdapter-7ZKFAEJG.js.map} +2 -2
  4. package/dist/chunks/{GraphGenomeView-37F7MLFQ.js → GraphGenomeView-CLUMXH4K.js} +2 -2
  5. package/dist/chunks/{GraphTrackSettingsDialog-2QV6TPX7.js → GraphTrackSettingsDialog-QF5OMTCH.js} +2 -2
  6. package/dist/chunks/{LinearGraphDisplay-CJHA56RB.js → LinearGraphDisplay-4CMVCEM5.js} +2 -2
  7. package/dist/chunks/chunk-3FGJLRG2.js +2 -0
  8. package/dist/chunks/chunk-3FGJLRG2.js.map +7 -0
  9. package/dist/chunks/chunk-3SZJ4AFI.js +3 -0
  10. package/dist/chunks/chunk-3SZJ4AFI.js.map +7 -0
  11. package/dist/chunks/{chunk-5E7TVPCI.js → chunk-CLRXQ6BM.js} +2 -2
  12. package/dist/chunks/chunk-VIFXYTIS.js +2 -0
  13. package/dist/chunks/chunk-VIFXYTIS.js.map +7 -0
  14. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +2 -2
  15. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +3 -3
  16. package/package.json +2 -2
  17. package/src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.ts +1 -1
  18. package/src/GetSubgraph.ts +3 -0
  19. package/src/GraphGenomeView/components/BubbleHalos.tsx +3 -4
  20. package/src/GraphGenomeView/components/GraphCanvas.tsx +51 -15
  21. package/src/GraphGenomeView/components/LabelLayer.tsx +5 -6
  22. package/src/GraphGenomeView/components/WalkSelect.tsx +26 -13
  23. package/src/GraphGenomeView/model.test.ts +48 -0
  24. package/src/GraphGenomeView/model.ts +75 -21
  25. package/src/GraphGenomeView/viewModel.ts +15 -0
  26. package/src/LinearGraphDisplay/LinearGraphDisplay.test.ts +23 -2
  27. package/src/LinearGraphDisplay/model.ts +7 -2
  28. package/src/version.ts +1 -1
  29. package/dist/chunks/chunk-BI3M6FZD.js +0 -2
  30. package/dist/chunks/chunk-BI3M6FZD.js.map +0 -7
  31. package/dist/chunks/chunk-IUIIYSGF.js +0 -2
  32. package/dist/chunks/chunk-IUIIYSGF.js.map +0 -7
  33. package/dist/chunks/chunk-MNOQXDMY.js +0 -3
  34. package/dist/chunks/chunk-MNOQXDMY.js.map +0 -7
  35. /package/dist/chunks/{GraphGenomeView-37F7MLFQ.js.map → GraphGenomeView-CLUMXH4K.js.map} +0 -0
  36. /package/dist/chunks/{GraphTrackSettingsDialog-2QV6TPX7.js.map → GraphTrackSettingsDialog-QF5OMTCH.js.map} +0 -0
  37. /package/dist/chunks/{LinearGraphDisplay-CJHA56RB.js.map → LinearGraphDisplay-4CMVCEM5.js.map} +0 -0
  38. /package/dist/chunks/{chunk-5E7TVPCI.js.map → chunk-CLRXQ6BM.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/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/ReferenceStripOverlay.tsx", "../../src/GraphGenomeView/components/TubeMapOverlay.tsx", "../../src/GraphGenomeView/components/UnpopButton.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, { HaloLegend } from './BubbleHalos'\nimport GenePins from './GenePins'\nimport GraphToolbar from './GraphToolbar'\nimport LabelLayer from './LabelLayer'\nimport ReferenceStripOverlay, {\n ReferenceStripLegend,\n} from './ReferenceStripOverlay'\nimport TubeMapOverlay, { TubeMapLegend } from './TubeMapOverlay'\nimport UnpopButton from './UnpopButton'\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 <br />\n paler: what {label} does not carry\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\n ref={ref}\n style={{\n ...legendStackStyle,\n top: LEGEND_INSET_PX + model.referenceStripZonePx,\n }}\n >\n <ReferenceRampLegend model={model} />\n <ReferenceStripLegend model={model} />\n <HaloLegend 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 const sx = x * model.scaleX + model.translateX\n const sy = y * model.scaleY + model.translateY\n if (model.layoutResult?.tubeMap) {\n return model.tubeMapNodeAt(sx, sy)\n }\n const onStrip = model.referenceStripNodeAt(sx, sy)\n if (onStrip) {\n return onStrip\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, and the strip's are bp, not\n // positions to drag\n const node =\n model.layoutResult?.tubeMap ||\n e.nativeEvent.offsetY < model.referenceStripZonePx\n ? null\n : 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 // also fired by the canvas unmounting under a resting pointer, after the\n // view closing it has destroyed the model\n function handleMouseLeave() {\n dropPending()\n if (!isAlive(model)) {\n return\n }\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\n style={canvasAreaStyle}\n onMouseEnter={() => {\n model.setPointerInPane(true)\n }}\n onMouseLeave={() => {\n if (isAlive(model)) {\n model.setPointerInPane(false)\n }\n }}\n >\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 <ReferenceStripOverlay model={model} />\n <RowLabels model={model} />\n <GraphSizeLabels model={model} />\n <BubbleHalos model={model} />\n <GenePins model={model} />\n <LabelLayer model={model} />\n <UnpopButton 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 { sameBubble } from '@jbrowse/bandage-core/bubbles/bubbleLine'\nimport {\n BUBBLE_KIND_COLORS,\n BUBBLE_KIND_NAMES,\n} 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, hoveredBubble } = 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={\n hoveredBubble && sameBubble(h.bubble, hoveredBubble)\n ? 0.45\n : dimmedBubble(h)\n ? 0.06\n : 0.22\n }\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\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 }\n\nfunction HaloSwatch({ color }: { color: string }) {\n return (\n <svg width={18} height={10} style={{ flex: 'none' }}>\n <line\n x1={5}\n y1={5}\n x2={13}\n y2={5}\n stroke={color}\n strokeOpacity={0.35}\n strokeWidth={8}\n strokeLinecap=\"round\"\n />\n </svg>\n )\n}\n\n// One row per halo colour on screen, naming the kinds it stands for\nexport const HaloLegend = observer(function HaloLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const kindsByColor = new Map<string, Set<string>>()\n for (const h of model.bubbleHalos) {\n if (!h.whole) {\n const color = BUBBLE_KIND_COLORS[h.kind]\n const kinds = kindsByColor.get(color) ?? new Set<string>()\n kinds.add(BUBBLE_KIND_NAMES[h.kind])\n kindsByColor.set(color, kinds)\n }\n }\n return kindsByColor.size > 0 ? (\n <div style={legendBoxStyle} data-testid=\"graph-halo-legend\">\n {[...kindsByColor].map(([color, kinds]) => (\n <div key={color} style={legendRowStyle}>\n <HaloSwatch color={color} />\n <span>bubble: {[...kinds].join(', ')}</span>\n </div>\n ))}\n </div>\n ) : null\n})\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 { isAlive } from '@jbrowse/mobx-state-tree'\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 // a leave also fires as the view closing it unmounts the chip\n onHover={hovered => {\n if (isAlive(model)) {\n model.setHoveredBubble(hovered ? h.bubble : null)\n }\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 onHover,\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 onHover?: (hovered: boolean) => void\n}) {\n return (\n <g\n style={{\n pointerEvents: onClick || onHover ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : undefined,\n opacity: dimmed ? 0.35 : 1,\n }}\n data-testid={testId}\n onClick={onClick}\n onMouseEnter={() => {\n onHover?.(true)\n }}\n onMouseLeave={() => {\n onHover?.(false)\n }}\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 { drawReferenceStrip } from '@jbrowse/bandage-core/referenceStrip'\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: 5,\n}\n\n// Each reference segment at its bp in the linear view, over a drawing that\n// has no bp axis of its own. Repainted by an autorun, so a pan in the linear\n// view moves the strip in the same frame as its other tracks.\nconst ReferenceStripOverlay = observer(function ReferenceStripOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLCanvasElement>(null)\n const { referenceStripShown, paneWidth, canvasHeight } = model\n useEffect(\n () =>\n autorun(() => {\n const canvas = ref.current\n const frame = model.referenceStripFrame\n const ctx = canvas?.getContext('2d')\n if (canvas && ctx && frame && model.referenceStripShown) {\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 drawReferenceStrip(ctx, model.referenceStripBlocks, frame, {\n width,\n lit: model.referenceStripLit,\n darkMode: model.darkMode,\n })\n }\n }),\n [model],\n )\n return (\n <canvas\n ref={ref}\n data-testid={referenceStripShown ? 'graph-reference-strip' : undefined}\n style={{\n ...canvasStyle,\n width: paneWidth,\n height: canvasHeight,\n display: referenceStripShown ? 'block' : 'none',\n }}\n />\n )\n})\n\nexport default ReferenceStripOverlay\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\nfunction StripSwatch() {\n return (\n <svg width={SWATCH_PX} height={4} style={{ flex: 'none' }}>\n <rect x={0} y={0} width={6} height={4} fill=\"hsl(0, 70%, 50%)\" />\n <rect x={6} y={0} width={5} height={4} fill=\"hsl(120, 70%, 50%)\" />\n <rect x={11} y={0} width={7} height={4} fill=\"hsl(240, 70%, 50%)\" />\n </svg>\n )\n}\n\nfunction OverhangSwatch() {\n return (\n <svg width={SWATCH_PX} height={8} style={{ flex: 'none' }}>\n <path d=\"M0,4 L5,0.5 L5,7.5 Z M18,4 L13,0.5 L13,7.5 Z\" fill=\"#18181c\" />\n </svg>\n )\n}\n\n// Hovering a node boxes its span on the strip and draws a leader to it\nexport const ReferenceStripLegend = observer(function ReferenceStripLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n return model.referenceStripShown ? (\n <div style={legendBoxStyle} data-testid=\"graph-reference-strip-legend\">\n <div style={legendRowStyle}>\n <StripSwatch />\n <span>top strip: reference segments at their bp</span>\n </div>\n {model.referenceStripOverhangs ? (\n <div style={legendRowStyle}>\n <OverhangSwatch />\n <span>the graph runs past this edge</span>\n </div>\n ) : null}\n </div>\n ) : null\n})\n", "import { useEffect, useRef } from 'react'\nimport type { ReactNode } from 'react'\n\nimport { formatBp } from '@jbrowse/bandage-core/graphLabels'\nimport { drawTubeMapRuler, rulerInk } 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 {\n FORWARD_READ_COLORS,\n REVERSE_READ_COLORS,\n} from '@jbrowse/bandage-core/tubeMap/reads'\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(\n ctx,\n boxes,\n tubeFrame,\n frame.y(bounds.maxY) + 4,\n model.layoutResult?.referenceAxis,\n )\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// Two boxes' brackets, as the ruler draws them under every box\nfunction BracketSwatch() {\n const brackets = [\n [0.5, 5.5],\n [8.5, SWATCH_PX - 0.5],\n ]\n return (\n <svg width={SWATCH_PX} height={7} style={{ flex: 'none' }}>\n <path\n d={brackets.map(([x0, x1]) => `M${x0},6 V1.5 H${x1} V6`).join(' ')}\n fill=\"none\"\n stroke={rulerInk()}\n strokeWidth={1}\n />\n </svg>\n )\n}\n\nconst barSwatchStyle = { width: SWATCH_PX, height: 7, flex: 'none' }\n\nconst tubeSwatchStyle = {\n ...barSwatchStyle,\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// A read takes one shade of its strand's palette, varied so neighbours differ\nfunction ReadSwatch({ colors }: { colors: readonly string[] }) {\n const step = 100 / colors.length\n const stops = colors.map((c, i) => `${c} ${i * step}% ${(i + 1) * step}%`)\n return (\n <div\n style={{\n ...barSwatchStyle,\n background: `linear-gradient(to right, ${stops.join(', ')})`,\n }}\n />\n )\n}\n\nconst glyphSwatchStyle = {\n width: SWATCH_PX,\n flex: 'none',\n textAlign: 'center' as const,\n fontFamily: 'monospace',\n fontSize: 12,\n}\n\nfunction DeletionSwatch() {\n return <div style={{ ...barSwatchStyle, backgroundColor: 'grey' }} />\n}\n\nfunction LegendRow({\n swatch,\n children,\n}: {\n swatch: ReactNode\n children: ReactNode\n}) {\n return (\n <div style={legendRowStyle}>\n {swatch}\n <span>{children}</span>\n </div>\n )\n}\n\n// What a tube map draws that nothing else on screen explains, each listed\n// only while it applies\nexport const TubeMapLegend = observer(function TubeMapLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { logWidths, foldBp, forwardReads, reverseReads, mismatches } =\n model.tubeMapKeys\n const rows = [\n forwardReads && (\n <LegendRow key=\"fwd\" swatch={<ReadSwatch colors={FORWARD_READ_COLORS} />}>\n read on the forward strand\n </LegendRow>\n ),\n reverseReads && (\n <LegendRow key=\"rev\" swatch={<ReadSwatch colors={REVERSE_READ_COLORS} />}>\n read on the reverse strand\n </LegendRow>\n ),\n mismatches.has('substitution') && (\n <LegendRow key=\"sub\" swatch={<span style={glyphSwatchStyle}>A</span>}>\n a read's base unlike the node's\n </LegendRow>\n ),\n mismatches.has('insertion') && (\n <LegendRow key=\"ins\" swatch={<span style={glyphSwatchStyle}>*</span>}>\n bases a read inserts\n </LegendRow>\n ),\n mismatches.has('deletion') && (\n <LegendRow key=\"del\" swatch={<DeletionSwatch />}>\n bases a read skips\n </LegendRow>\n ),\n foldBp !== undefined && (\n <LegendRow key=\"fold\" swatch={<TickSwatch />}>\n a haplotype's variant under {formatBp(foldBp)}\n </LegendRow>\n ),\n logWidths && (\n <LegendRow key=\"log\" swatch={<BracketSwatch />}>\n width grows with log of length\n </LegendRow>\n ),\n ].filter(Boolean)\n return rows.length > 0 ? (\n <div style={legendBoxStyle} data-testid=\"graph-tube-map-legend\">\n {rows}\n </div>\n ) : null\n})\n", "import { Button } from '@mui/material'\nimport { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\nconst style = {\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 UnpopButton = observer(function UnpopButton({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { poppedFrom } = model\n return poppedFrom ? (\n <Button\n size=\"small\"\n variant=\"outlined\"\n style={style}\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})\n\nexport default UnpopButton\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 { 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's allele for a walk marks its length with a tick. The walk\n// rows pair them \u2014 see repeats/walkCalls.ts, which also holds the threshold\n// this reads a red readout off. Colouring each copy by its unit is\n// jbrowse-plugin-tandem-repeat's.\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\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 calls = [bars.reference, ...bars.rows].flatMap(row => row.call ?? [])\n return (\n <div style={legendBoxStyle} data-testid=\"graph-walk-rows-legend\">\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 {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\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 ? calledReadout(call) : ''\n return `${kb(bp)}${units(bp, unit)}${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// 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 // 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 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 // The canvas rounds the backbone's ends, so its readout clears the cap.\n const label = (\n text: string,\n endBp: number,\n y: number,\n fill = '#333',\n gap = 6,\n ) => {\n const x = X(endBp) + gap\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 return (\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-walk-rows\"\n >\n {label(\n `${kb(reference.bp)}${units(reference.bp, unit)}`,\n backboneEnd,\n Y(0),\n undefined,\n 6 + BAR_PX / 2,\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 {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 {call ? (\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": "4kBAAA,IAAAA,GAAAC,GAAA,CAAAC,GAAAC,KAAA,CAAAA,GAAO,QAAU,eAAe,0CAA0C,ICA1E,IAAAC,GAAAC,GAAA,CAAAC,GAA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GAAA,CAAQ,MAAO3B,EAAO,EAEtBoE,KACC,OAAC,OAAI,MAAOvE,GACV,mBAAC,mBACC,UAAWG,EAAM,UACjB,UAAW,CAACA,EAAM,aAClB,cAAeA,EAAM,cACrB,SACEA,EAAM,cACF,IAAM,CACJA,EAAM,WAAW,CACnB,EACA,OAER,EACF,EACE,MACN,KAEA,OAAC+C,GAAA,CAAc,MAAO/C,EAAO,EAE5B6E,KACC,OAACtB,GAAA,CACC,MAAOvD,EACP,OAAQ6E,EAAY,OACpB,IAAKA,EAAY,IACjB,KAAMA,EAAY,KAClB,QAAS,IAAM,CACbC,EAAe,MAAS,CAC1B,EACF,EACE,KAEHP,KACC,OAAC,gBAAY,MAAOA,EAAa,QAASC,EAAa,EACrD,KAEHJ,GAAapE,EAAM,SAClB,OAAC,gBACC,MAAOA,EAAM,MACb,QACEA,EAAM,aACF,IAAM,CACJA,EAAM,UAAU,CAClB,EACA,OAER,EACE,MACN,CAEJ,CAAC,EAEMkH,GAAQ/C",
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", "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", "hoveredBubble", "scaleX", "scaleY", "translateX", "translateY", "width", "canvasHeight", "halo", "HALO_FACTOR", "dimmedBubble", "h", "id", "BUBBLE_KIND_COLORS", "sameBubble", "BubbleHalos_default", "legendBoxStyle", "legendRowStyle", "HaloSwatch", "color", "HaloLegend", "kindsByColor", "kinds", "BUBBLE_KIND_NAMES", "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_state_tree", "import_mobx_react", "import_jsx_runtime", "LabelChip", "x", "y", "w", "text", "color", "italic", "small", "dimmed", "title", "testId", "onClick", "onHover", "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", "hovered", "LabelLayer_default", "import_react", "import_canvas2dUtils", "import_mobx", "import_mobx_react", "import_jsx_runtime", "canvasStyle", "ReferenceStripOverlay", "model", "ref", "referenceStripShown", "paneWidth", "canvasHeight", "canvas", "frame", "ctx", "dpr", "width", "height", "drawReferenceStrip", "ReferenceStripOverlay_default", "legendBoxStyle", "legendRowStyle", "SWATCH_PX", "StripSwatch", "OverhangSwatch", "ReferenceStripLegend", "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", "BracketSwatch", "brackets", "x0", "x1", "rulerInk", "barSwatchStyle", "tubeSwatchStyle", "TickSwatch", "deviationInk", "ReadSwatch", "colors", "step", "stops", "c", "i", "glyphSwatchStyle", "DeletionSwatch", "LegendRow", "swatch", "children", "TubeMapLegend", "logWidths", "foldBp", "forwardReads", "reverseReads", "mismatches", "rows", "FORWARD_READ_COLORS", "REVERSE_READ_COLORS", "formatBp", "import_material", "import_mobx_react", "import_jsx_runtime", "style", "UnpopButton", "model", "poppedFrom", "UnpopButton_default", "import_react", "import_mobx_react", "rampHueCss", "hue", "rampHue", "bp", "domain", "frac", "REFERENCE_RAMP_MAX_HUE", "HUE_STOP_DEG", "rampStops", "start", "reversed", "low", "high", "n", "_", "RAMP_GRADIENT_CSS", "i", "import_jsx_runtime", "svgStyle", "ON_REFERENCE", "CALL_TICK", "UNBACKED_TICK", "DISAGREES", "OFF_REFERENCE", "BAR_PX", "legendBoxStyle", "legendRowStyle", "swatchStyle", "tickSwatchStyle", "TickSwatch", "color", "WalkRowsLegend", "model", "bars", "ramp", "calls", "row", "RAMP_GRADIENT_CSS", "REFERENCE_RAMP_ALT_CSS", "call", "kb", "bp", "units", "unit", "readout", "referenceBp", "complete", "delta", "against", "called", "calledReadout", "unbacked", "MIN_TILE_PX", "tileSeparators", "X", "xs", "k", "runFill", "run", "gradientId", "stops", "rampStops", "rampHueCss", "hue", "i", "WalkRowsOverlay", "idPrefix", "walkRowBars", "scaleX", "scaleY", "translateX", "translateY", "width", "canvasHeight", "Y", "origin", "reference", "rows", "backboneEnd", "label", "text", "endBp", "y", "fill", "gap", "x", "fits", "separators", "starts", "rect", "start", "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", "ReferenceStripLegend", "HaloLegend", "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", "sx", "sy", "onStrip", "findHoveredNode", "handleMouseDown", "node", "applyPending", "pending", "findHoveredEdge", "scheduleFrame", "dropPending", "handleMouseMove", "dx", "dy", "handleMouseUp", "handleMouseLeave", "handleContextMenu", "handleClick", "GraphToolbar_default", "TubeMapOverlay_default", "ReferenceStripOverlay_default", "BubbleHalos_default", "GenePins_default", "LabelLayer_default", "UnpopButton_default", "WalkRowsOverlay_default", "GraphCanvas_default"]
7
- }