Skip to content

Commit

Permalink
feat(Dagre): Expose access to Dagre Graph instance via bind:graph
Browse files Browse the repository at this point in the history
  • Loading branch information
techniq committed Feb 13, 2025
1 parent 04ac7a6 commit 48bc672
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-rockets-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'layerchart': minor
---

feat(Dagre): Expose access to Dagre Graph instance via `bind:graph`
5 changes: 3 additions & 2 deletions packages/layerchart/src/lib/components/Dagre.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
/** Filter nodes */
export let filterNodes: (nodeId: string, graph: dagre.graphlib.Graph) => boolean = () => true;
let graph: dagre.graphlib.Graph;
/** Exposed to access to Dagre Graph instance via `bind:graph` */
export let graph: dagre.graphlib.Graph | undefined = undefined;
$: {
let g = new dagre.graphlib.Graph({ directed, multigraph, compound });
Expand Down Expand Up @@ -148,4 +149,4 @@
>;
</script>

<slot nodes={graphNodes} edges={graphEdges} />
<slot nodes={graphNodes} edges={graphEdges} {graph} />

0 comments on commit 48bc672

Please # to comment.