The gogpu/ui toolkit is organized into a three-layer hierarchy designed to separate behavior, styling, and low-level primitives. This structure allows developers to build complex user applications by composing high-level widgets while maintaining control over the underlying foundation.
Layer 1: Foundation
Provides the core building blocks for all UI elements. This includes:
widget/: Core types like Widget, WidgetBase, Context, and Canvas, along with lifecycle and focus management.geometry/: Basic spatial types such as Point, Size, Rect, Constraints, and Insets.- Infrastructure: Essential services like
layout (Flex, Stack, Grid), state (Signals, Binding), focus management, animation, a11y (accessibility), and dnd (drag and drop).
Layer 2: Component Development Kit (CDK)
The cdk/ package provides intermediate abstractions (e.g., Content[C]) that facilitate the creation of more complex components. It acts as a bridge between raw foundation primitives and high-level widgets.
Layer 3: Widgets and Design Systems
This layer is where the actual user interface is constructed:
- Layer 3a: Generic Widgets: A collection of interactive components found in
core/ (e.g., button, checkbox, dropdown, listview, datatable) and primitives/ (e.g., Box, Text, Image). - Layer 3b: Design Systems: Styling layers that define the visual language, such as
theme/material3/, theme/cupertino/, theme/fluent/, and theme/devtools/.
/*
Architecture Overview:
Layer 3b: Design Systems (styling)
Layer 3a: Generic Widgets (behavior)
Layer 2: Component Development Kit (CDK)
Layer 1: Foundation (Widget, Event, Geometry, Infrastructure)
*/