# 45474f52/displaynodes architecture

> Architecture diagram of the GitHub repository 45474f52/displaynodes, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/45474f52/displaynodes
- Repository: https://github.com/45474f52/displaynodes

## Overview

DisplayNodes is a declarative C# UI layout and rendering engine, with a Playground IDE for authoring and previewing UI scripts. The main workflow is to edit and compile a script, construct a fluent node tree, measure and arrange it, then render through a selected adapter. The graph also preserves reactive updates, layout/container capabilities, and both documented backends. Several implementation details are unsampled; those subsystem links are documented in the README rather than inferred from folder names.

Main entry points: [`Playground/Infrastructure/IPreviewHost.cs`](https://github.com/45474f52/displaynodes/blob/main/Playground/Infrastructure/IPreviewHost.cs) (Preview hosts), [`Kernel/Fluent/UI.cs`](https://github.com/45474f52/displaynodes/blob/main/Kernel/Fluent/UI.cs) (Fluent UI API), [`LibDisplayDrawingAdapter/RenderRoot.cs`](https://github.com/45474f52/displaynodes/blob/main/LibDisplayDrawingAdapter/RenderRoot.cs) (Drawing adapter), [`WinFormsAdapter/RenderRoot.cs`](https://github.com/45474f52/displaynodes/blob/main/WinFormsAdapter/RenderRoot.cs) (WinForms adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_playground["Playground IDE"]
  node_app["IDE shell<br/>[AppForm.cs]"]
  node_editor["Script editor<br/>[CodeEditor.cs]"]
  node_compiler["Script compilation<br/>[ScriptRunner.cs]"]
  node_preview["Preview hosts<br/>[IPreviewHost.cs]"]
end

subgraph group_api["UI Definition"]
  node_fluent["Fluent UI API<br/>[UI.cs]"]
end

subgraph group_kernel["Layout and Runtime"]
  node_layout["Layout containers"]
  node_layoutnode["Measure and arrange<br/>[LayoutNode.cs]"]
  node_widgets["Leaf widgets"]
  node_reactive["Reactive values<br/>[Observable.cs]"]
  node_labelnode["Label behavior<br/>[LabelNode.cs]"]
end

subgraph group_rendering["Rendering Backends"]
  node_rendercontracts["Render contracts"]
  node_gdi["GDI wrappers<br/>[GdiConversions.cs]"]
  node_libadapter["Drawing adapter<br/>[RenderRoot.cs]"]
  node_winadapter["WinForms adapter<br/>[RenderRoot.cs]"]
end

node_developer(("UI author"))
node_bitmap["Preview image"]
node_screen["Rendered UI"]

node_developer -->|"edits script"| node_editor
node_app -->|"hosts editor"| node_editor
node_app -->|"runs scripts"| node_compiler
node_compiler -.->|"builds UI"| node_fluent
node_fluent -->|"creates containers"| node_layout
node_fluent -->|"creates widgets"| node_widgets
node_layout -.->|"measures and arranges"| node_layoutnode
node_widgets -->|"participate in layout"| node_layoutnode
node_reactive -->|"updates bindings"| node_labelnode
node_labelnode -->|"uses component contracts"| node_rendercontracts
node_preview -->|"builds tree"| node_layoutnode
node_preview -->|"selects backend"| node_libadapter
node_preview -->|"selects backend"| node_winadapter
node_libadapter -.->|"renders controls"| node_screen
node_winadapter -.->|"renders controls"| node_screen
node_libadapter -->|"produces bitmap"| node_bitmap
node_winadapter -->|"exports image"| node_bitmap
node_gdi -->|"implements abstractions"| node_rendercontracts

click node_app "https://github.com/45474f52/displaynodes/blob/main/Playground/AppForm.cs"
click node_editor "https://github.com/45474f52/displaynodes/blob/main/Playground/Editor/CodeEditor.cs"
click node_compiler "https://github.com/45474f52/displaynodes/blob/main/Playground/Compilation/ScriptRunner.cs"
click node_preview "https://github.com/45474f52/displaynodes/blob/main/Playground/Infrastructure/IPreviewHost.cs"
click node_fluent "https://github.com/45474f52/displaynodes/blob/main/Kernel/Fluent/UI.cs"
click node_layout "https://github.com/45474f52/displaynodes/tree/main/Kernel/Core"
click node_layoutnode "https://github.com/45474f52/displaynodes/blob/main/Kernel/Core/LayoutNode.cs"
click node_widgets "https://github.com/45474f52/displaynodes/tree/main/Kernel/Widgets"
click node_reactive "https://github.com/45474f52/displaynodes/blob/main/Kernel/Core/Observable.cs"
click node_rendercontracts "https://github.com/45474f52/displaynodes/tree/main/Kernel/Core/Rendering"
click node_labelnode "https://github.com/45474f52/displaynodes/blob/main/Kernel/Widgets/LabelNode.cs"
click node_gdi "https://github.com/45474f52/displaynodes/blob/main/Gdi/GdiConversions.cs"
click node_libadapter "https://github.com/45474f52/displaynodes/blob/main/LibDisplayDrawingAdapter/RenderRoot.cs"
click node_winadapter "https://github.com/45474f52/displaynodes/blob/main/WinFormsAdapter/RenderRoot.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_editor,node_compiler,node_preview,node_developer,node_bitmap,node_screen toneBlue
class node_fluent toneAmber
class node_layout,node_layoutnode,node_widgets,node_reactive,node_labelnode toneMint
class node_rendercontracts,node_gdi,node_libadapter,node_winadapter toneRose
```

## Components

### Playground IDE

- [IDE shell](https://github.com/45474f52/displaynodes/blob/main/Playground/AppForm.cs): `Playground/AppForm.cs`
- [Script editor](https://github.com/45474f52/displaynodes/blob/main/Playground/Editor/CodeEditor.cs): `Playground/Editor/CodeEditor.cs`
- [Script compilation](https://github.com/45474f52/displaynodes/blob/main/Playground/Compilation/ScriptRunner.cs): `Playground/Compilation/ScriptRunner.cs`
- [Preview hosts](https://github.com/45474f52/displaynodes/blob/main/Playground/Infrastructure/IPreviewHost.cs): `Playground/Infrastructure/IPreviewHost.cs`

### UI Definition

- [Fluent UI API](https://github.com/45474f52/displaynodes/blob/main/Kernel/Fluent/UI.cs): `Kernel/Fluent/UI.cs`

### Layout and Runtime

- [Layout containers](https://github.com/45474f52/displaynodes/tree/main/Kernel/Core): `Kernel/Core`
- [Measure and arrange](https://github.com/45474f52/displaynodes/blob/main/Kernel/Core/LayoutNode.cs): `Kernel/Core/LayoutNode.cs`
- [Leaf widgets](https://github.com/45474f52/displaynodes/tree/main/Kernel/Widgets): `Kernel/Widgets`
- [Reactive values](https://github.com/45474f52/displaynodes/blob/main/Kernel/Core/Observable.cs): `Kernel/Core/Observable.cs`
- [Label behavior](https://github.com/45474f52/displaynodes/blob/main/Kernel/Widgets/LabelNode.cs): `Kernel/Widgets/LabelNode.cs`

### Rendering Backends

- [Render contracts](https://github.com/45474f52/displaynodes/tree/main/Kernel/Core/Rendering): `Kernel/Core/Rendering`
- [GDI wrappers](https://github.com/45474f52/displaynodes/blob/main/Gdi/GdiConversions.cs): `Gdi/GdiConversions.cs`
- [Drawing adapter](https://github.com/45474f52/displaynodes/blob/main/LibDisplayDrawingAdapter/RenderRoot.cs): `LibDisplayDrawingAdapter/RenderRoot.cs`
- [WinForms adapter](https://github.com/45474f52/displaynodes/blob/main/WinFormsAdapter/RenderRoot.cs): `WinFormsAdapter/RenderRoot.cs`

### Other components

- **UI author**
- **Preview image**
- **Rendered UI**

## Connections

- UI author → Script editor: edits script
- IDE shell → Script editor: hosts editor (evidence: `Playground/AppForm.cs`)
- IDE shell → Script compilation: runs scripts (evidence: `Playground/AppForm.cs`)
- Script compilation → Fluent UI API: builds UI
- Fluent UI API → Layout containers: creates containers (evidence: `Kernel/Fluent/UI.cs`)
- Fluent UI API → Leaf widgets: creates widgets (evidence: `Kernel/Fluent/UI.cs`)
- Layout containers → Measure and arrange: measures and arranges (evidence: `Kernel/Core/LayoutNode.cs`)
- Leaf widgets → Measure and arrange: participate in layout (evidence: `Kernel/Widgets/WidgetNode.cs`)
- Reactive values → Label behavior: updates bindings (evidence: `Kernel/Widgets/LabelNode.cs`)
- Label behavior → Render contracts: uses component contracts (evidence: `Kernel/Widgets/LabelNode.cs`)
- Preview hosts → Measure and arrange: builds tree (evidence: `Playground/Infrastructure/LibDisplayDrawingPreviewHost.cs`)
- Preview hosts → Drawing adapter: selects backend
- Preview hosts → WinForms adapter: selects backend
- Drawing adapter → Rendered UI: renders controls
- WinForms adapter → Rendered UI: renders controls
- Drawing adapter → Preview image: produces bitmap
- WinForms adapter → Preview image: exports image
- GDI wrappers → Render contracts: implements abstractions (evidence: `Gdi/GdiConversions.cs`)
