@startuml
title Zivro: компонентная архитектура

skinparam componentStyle rectangle
skinparam shadowing false

package "UI Layer" {
  [main.zig\nEvent Loop]
  [ui/*\nMenu/Tab/Panels]
  [Canvas.zig\nViewport + Redraw]
}

package "Application State" {
  [WindowContext.zig\nOpenDocument tabs]
  [models/Document.zig\nObject tree]
  [models/Object.zig\nProperties + Children]
}

package "Render Layer" {
  [RenderEngine.zig\nInterface]
  [CpuRenderEngine.zig\nCPU backend]
  [cpu/draw.zig\nRecursive draw]
  [cpu/pipeline.zig\nTransforms + blend]
  [cpu/line.zig]
  [cpu/ellipse.zig]
  [cpu/broken.zig]
}

package "Persistence" {
  [persistence/json_io.zig]
}

[main.zig\nEvent Loop] --> [WindowContext.zig\nOpenDocument tabs]
[ui/*\nMenu/Tab/Panels] --> [WindowContext.zig\nOpenDocument tabs]
[Canvas.zig\nViewport + Redraw] --> [RenderEngine.zig\nInterface]
[Canvas.zig\nViewport + Redraw] --> [models/Document.zig\nObject tree]
[WindowContext.zig\nOpenDocument tabs] --> [Canvas.zig\nViewport + Redraw]
[WindowContext.zig\nOpenDocument tabs] --> [CpuRenderEngine.zig\nCPU backend]

[RenderEngine.zig\nInterface] <|.. [CpuRenderEngine.zig\nCPU backend]
[CpuRenderEngine.zig\nCPU backend] --> [cpu/draw.zig\nRecursive draw]
[cpu/draw.zig\nRecursive draw] --> [cpu/pipeline.zig\nTransforms + blend]
[cpu/draw.zig\nRecursive draw] --> [cpu/line.zig]
[cpu/draw.zig\nRecursive draw] --> [cpu/ellipse.zig]
[cpu/draw.zig\nRecursive draw] --> [cpu/broken.zig]
[models/Document.zig\nObject tree] --> [models/Object.zig\nProperties + Children]
[persistence/json_io.zig] ..> [models/Document.zig\nObject tree] : save/load

@enduml
