All files / src/graph-runtime assemble.ts

100% Statements 30/30
77.77% Branches 7/9
100% Functions 7/7
100% Lines 30/30

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 311x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x  
import { GRAPH_RUNTIME_BOOTSTRAP } from "./bootstrap.js"
import { GRAPH_RUNTIME_INPUT } from "./input.js"
import { GRAPH_RUNTIME_LAYOUT } from "./layout.js"
import { GRAPH_RUNTIME_MODEL } from "./model.js"
import { GRAPH_RUNTIME_PHYSICS } from "./physics.js"
import { GRAPH_RUNTIME_RENDER } from "./render.js"
 
/** Assembles the inline webview runtime from single-responsibility modules. */
export function assembleForceGraphRuntime(): string {
  return `
(function () {
  const vscode = window.__MERIDIAN_VSCODE__ || null;
  const payload = window.__GRAPH_PAYLOAD__;
  const canvas = document.getElementById("forceGraph");
  if (!canvas || !payload) return;
 
  const ctx = canvas.getContext("2d");
  const dpr = window.devicePixelRatio || 1;
  let width = 0;
  let height = 0;
 
  ${GRAPH_RUNTIME_MODEL}
  ${GRAPH_RUNTIME_LAYOUT}
  ${GRAPH_RUNTIME_PHYSICS}
  ${GRAPH_RUNTIME_RENDER}
  ${GRAPH_RUNTIME_INPUT}
  ${GRAPH_RUNTIME_BOOTSTRAP}
})();
`.trim()
}