layerchart 0.98.2 → 0.99.0

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.
@@ -84,7 +84,8 @@
84
84
  /** Filter nodes */
85
85
  export let filterNodes: (nodeId: string, graph: dagre.graphlib.Graph) => boolean = () => true;
86
86
 
87
- let graph: dagre.graphlib.Graph;
87
+ /** Exposed to access to Dagre Graph instance via `bind:graph` */
88
+ export let graph: dagre.graphlib.Graph | undefined = undefined;
88
89
  $: {
89
90
  let g = new dagre.graphlib.Graph({ directed, multigraph, compound });
90
91
 
@@ -135,17 +136,17 @@
135
136
  );
136
137
  });
137
138
 
138
- g = filterNodes ? g.filterNodes((nodeId) => filterNodes(nodeId, graph)) : graph;
139
+ g = filterNodes ? g.filterNodes((nodeId) => filterNodes(nodeId, graph!)) : graph!;
139
140
 
140
141
  dagre.layout(g);
141
142
 
142
143
  graph = g;
143
144
  }
144
145
 
145
- $: graphNodes = graph.nodes().map((id) => graph.node(id));
146
- $: graphEdges = graph.edges().map((edge) => ({ ...edge, ...graph.edge(edge) })) as Array<
146
+ $: graphNodes = graph!.nodes().map((id) => graph!.node(id));
147
+ $: graphEdges = graph!.edges().map((edge) => ({ ...edge, ...graph!.edge(edge) })) as Array<
147
148
  Edge & EdgeConfig & GraphEdge // `EdgeConfig` is excluded when inferred from usage
148
149
  >;
149
150
  </script>
150
151
 
151
- <slot nodes={graphNodes} edges={graphEdges} />
152
+ <slot nodes={graphNodes} edges={graphEdges} {graph} />
@@ -52,6 +52,7 @@ declare const __propDef: {
52
52
  /** Default edge label height if not defined on edge */ edgeLabelPosition?: keyof typeof EdgeLabelPosition;
53
53
  /** Default pixels to move the label away from the edge if not defined on edge. Applies only when labelpos is l or r.*/ edgeLabelOffset?: number;
54
54
  /** Filter nodes */ filterNodes?: (nodeId: string, graph: dagre.graphlib.Graph) => boolean;
55
+ /** Exposed to access to Dagre Graph instance via `bind:graph` */ graph?: dagre.graphlib.Graph | undefined;
55
56
  };
56
57
  events: {
57
58
  [evt: string]: CustomEvent<any>;
@@ -74,6 +75,7 @@ declare const __propDef: {
74
75
  shape?: string | undefined;
75
76
  }[];
76
77
  edges: (dagre.Edge & dagre.EdgeConfig & dagre.GraphEdge)[];
78
+ graph: dagre.graphlib.Graph<{}> | undefined;
77
79
  };
78
80
  };
79
81
  };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "Sean Lynch <techniq35@gmail.com>",
5
5
  "license": "MIT",
6
6
  "repository": "techniq/layerchart",
7
- "version": "0.98.2",
7
+ "version": "0.99.0",
8
8
  "devDependencies": {
9
9
  "@changesets/cli": "^2.27.12",
10
10
  "@mdi/js": "^7.4.47",