# types/figure.types.ts

> 70 lines of code and 12 definitions.

Tree: GovLab Docs
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/docs#file-docs-types-figure-types-ts
Source text: https://banes-lab.com/source/docs/types/figure.types.ts.txt

Listed in [types](https://banes-lab.com/api/source/docs/types.md), after [types/environment.types.ts](https://banes-lab.com/source/docs/types/environment.types.ts.md) and before [types/finding.types.ts](https://banes-lab.com/source/docs/types/finding.types.ts.md).

## Definitions

- `PackageShape` (type_alias_declaration, line 4, exported)
- `LayoutPolicy` (interface_declaration, line 6, exported)
- `DiagramSource` (interface_declaration, line 13, exported)
- `RenderedPart` (interface_declaration, line 19, exported)
- `RenderedDiagram` (interface_declaration, line 24, exported)
- `DiagramContext` (interface_declaration, line 31, exported)
- `DiagramKind` (interface_declaration, line 42, exported)
- `Charts` (interface_declaration, line 50, exported)
- `FlowScope` (interface_declaration, line 55, exported)
- `FlowModelInput` (interface_declaration, line 62, exported)
- `FlowPart` (interface_declaration, line 72, exported)
- `WorkspaceRow` (interface_declaration, line 77, exported)

## Contained in

- [types](https://banes-lab.com/anatomy/docs/folder-docs-types.md)

## Source

```typescript
import type { CodeGraph, CodeNode, TypeGraph } from "#types/graph.types";
import type { ModuleDep } from "#types/diagram.types";

export type PackageShape = "framework" | "full-stack" | "leaf";

export interface LayoutPolicy {
    direction: "LR" | "TD";
    nodeCap: number;
    cluster: boolean;
    perAxis: boolean;
}

export interface DiagramSource {
    label: string;
    file: string;
    line: number;
}

export interface RenderedPart {
    caption: string;
    mermaid: string;
}

export interface RenderedDiagram {
    mermaid: string;
    legend: readonly string[];
    sources: DiagramSource[];
    parts?: RenderedPart[];
}

export interface DiagramContext {
    moduleName: string;
    shape: PackageShape;
    layout: LayoutPolicy;
    codeGraph: CodeGraph | null;
    typeGraph?: TypeGraph | null | undefined;
    moduleDeps: ModuleDep[];
    keepIsolated?: boolean;
    scripts?: Record<string, string>;
}

export interface DiagramKind {
    id: string;
    order: number;
    title: string;
    appliesTo: (context: DiagramContext) => boolean;
    render: (context: DiagramContext) => RenderedDiagram | null;
}

export interface Charts {
    content: string;
    path: string;
}

export interface FlowScope {
    context: DiagramContext;
    graph: CodeGraph;
    adj: Map<string, string[]>;
    nodeById: Map<string, CodeNode>;
}

export interface FlowModelInput {
    keptIds: Set<string>;
    keptOrder: string[];
    graph: CodeGraph;
    nodeById: Map<string, CodeNode>;
    direction: "LR" | "TD";
    accTitle: string;
    truncated: number;
}

export interface FlowPart {
    part: RenderedPart;
    sources: DiagramSource[];
}

export interface WorkspaceRow {
    deps: string[];
    group: string;
    maturity: string;
    name: string;
}
```
