Architecture
How Yoga is layered, and where Cgo is used.
Dependency direction is strictly downward:
example/* app: Body(c) trees
yoga runtime: window, WebGPU, fonts, event loop
ui View DSL, Ctx, focus, widget store
layout theme Element tree, flex/grid/stack, design tokens
render DrawList, atlas, WGSL
input text syntax textedit mouse/kb, piece table, token classes, editing rulesCgo exists in the desktop GPU path (app_gpu.go, GLFW + wgpu-native) and macOS title-bar chrome. The browser path (app_js.go, GOOS=js) uses browser WebGPU via cogentcore’s JS bindings and skips CGO. Everything above the platform host is pure Go. layout.Element is the node type; Calculate solves then flattens to absolute Frames; Dispatch delivers mouse events front-to-back.