Skip to content

axon-ui

Immediate-mode GUI framework for Axon.

axon-ui is a declarative, immediate-mode GUI framework written in pure Axon. It provides OS window creation, GPU-accelerated rendering, a flexbox layout engine, input handling, and a standard widget library β€” all targeting the M11/M12/M19 milestones.

PhaseStatusNotes
Scaffolding (M11.0)βœ… This PRDirectory structure, module stubs, docs
UI Framework (M11)πŸ“‹ PlannedWindow, GPU backend, flexbox, input
Widgets (M12)πŸ“‹ PlannedButton, Label, TextInput, containers
Theming🚧 WIPPython reference impl in axon_ui/theme.py
WASM (M19)πŸ“‹ PlannedBrowser deployment
axon-ui/
β”œβ”€β”€ src/ # Axon source files (the framework itself)
β”‚ β”œβ”€β”€ context.axs # UI state management (M11)
β”‚ β”œβ”€β”€ layout.axs # Flexbox layout engine (M11)
β”‚ β”œβ”€β”€ input.axs # Event handling & hit-testing (M11)
β”‚ └── widgets.axs # Standard widget library (M12)
β”‚
β”œβ”€β”€ tests/ # Tests
β”‚ β”œβ”€β”€ test_layout.axs # Layout engine tests (Axon)
β”‚ β”œβ”€β”€ test_input.axs # Event handling tests (Axon)
β”‚ β”œβ”€β”€ test_golden_runner.py # Golden file test harness (Python)
β”‚ β”œβ”€β”€ test_theme.py # Theme API tests (Python reference)
β”‚ β”œβ”€β”€ test_theme_api.py # Theme inheritance tests
β”‚ β”œβ”€β”€ test_theme_properties.py # Property-based theme tests
β”‚ β”œβ”€β”€ test_widgets.py # Widget tests (Python reference)
β”‚ β”œβ”€β”€ test_widget_contracts.py # Widget contract tests
β”‚ β”œβ”€β”€ test_widgets_properties.py # Property-based widget tests
β”‚ β”œβ”€β”€ test_layout_properties.py # Property-based layout tests
β”‚ β”œβ”€β”€ test_metrics.py # Metrics collection tests
β”‚ β”œβ”€β”€ golden/ # Golden files for snapshot tests
β”‚ └── conftest.py # Pytest fixtures
β”‚
β”œβ”€β”€ axon_ui/ # Python reference implementation
β”‚ β”œβ”€β”€ __init__.py
β”‚ β”œβ”€β”€ theme.py # Theme + ThemeResolver (M12 theming)
β”‚ └── widgets.py # Widget base + standard widgets
β”‚
β”œβ”€β”€ docs/
β”‚ β”œβ”€β”€ architecture.md # Framework architecture overview
β”‚ β”œβ”€β”€ theming.md # Theme API reference
β”‚ β”œβ”€β”€ widgets.md # Widget reference
β”‚ β”œβ”€β”€ api/ # Planned API docs (Axon formatter strips comments)
β”‚ β”‚ β”œβ”€β”€ README.md
β”‚ β”‚ β”œβ”€β”€ context.md
β”‚ β”‚ β”œβ”€β”€ layout.md
β”‚ β”‚ β”œβ”€β”€ input.md
β”‚ β”‚ └── widgets.md
β”‚ β”œβ”€β”€ TESTING.md # Test workflow
β”‚ β”œβ”€β”€ CONTRIBUTING.md # Contributor guide
β”‚ β”œβ”€β”€ ci-pipeline.md # CI pipeline reference
β”‚ └── metrics.md # Metrics collection
β”‚
β”œβ”€β”€ metrics/ # Collected metrics output
β”œβ”€β”€ tools/ # Build/CI helper scripts
β”œβ”€β”€ requirements-dev.txt # Python dev dependencies
β”œβ”€β”€ .gitlab-ci.yml # CI configuration
└── README.md # This file

Application-level state management: stores, signals, and reactive updates.

Planned API:

  • (store initial-state) β€” create a new state store
  • (get store) β€” read current state
  • (set store value) β€” replace state
  • (update store fn) β€” transform state via fn
  • (signal initial-value) β€” create a reactive signal
  • (bind signal view-fn) β€” bind a view to a signal

CSS flexbox subset for laying out widget trees. Takes widgets with layout properties and produces absolute positions/sizes.

Planned API:

  • (layout root-widget max-width max-height) β€” compute layout
  • (flex-direction "row" | "column")
  • (justify-content "start" | "center" | "end" | "space-between")
  • (align-items "start" | "center" | "end" | "stretch")
  • (gap px)

Event dispatch for user input: mouse clicks, keyboard, focus, form submit. Events bubble up the widget tree with preventDefault/stopPropagation.

Planned API:

  • (event-loop) β€” start the event loop
  • (dispatch event widget-tree) β€” dispatch a single event
  • (on-click widget handler) β€” register click handler
  • (on-change widget handler) β€” register change handler
  • (on-submit widget handler) β€” register submit handler
  • (on-key widget handler) β€” register key handler

Event types: click, dblclick, change, submit, keydown, keyup, focus, blur.

Standard UI widgets, all inheriting from a common base and supporting theming.

Planned widgets:

  • (button "text" (on-click handler)) β€” clickable button
  • (label "text") β€” static text display
  • (text-input placeholder value handler) β€” single-line text field
  • (checkbox checked handler) β€” boolean toggle
  • (select options selected handler) β€” dropdown selector
  • (vstack children) β€” vertical stack container
  • (hstack children) β€” horizontal stack container
  • (container child) β€” generic container with padding

The axon_ui/ directory contains a Python reference implementation of the theming and widget subsystems. This serves as:

  1. A specification for the Axon implementation (what the API should look like)
  2. A testable target β€” the Python tests verify the API contract
  3. A fallback β€” apps that need UI now can use the Python version while the Axon version is under construction

The Python and Axon implementations should stay in sync API-wise.

A standards-based i18n/l10n layer β€” ICU MessageFormat catalogs, CLDR plural rules, locale-aware number/currency/percent formatting, RTL layout mirroring, and a reactive LocaleProvider for runtime locale switching. Pure-Python with zero required dependencies (optional Babel backend for full CLDR). See docs/i18n.md and the runnable Arabic/Hebrew demo examples/i18n_demo.py.

A declarative animation layer (Issue #24) β€” the full Robert-Penner easing set plus a CSS-style cubic_bezier solver, a shape-agnostic Tween (scalars, vectors/colours, dicts), damped-harmonic Spring physics with mid-flight interruption, Sequence/Parallel timelines, and a fixed-timestep Driver for reproducible sampling. Pure-Python, deterministic, no GPU/windowing dependency. GPU-accelerated compositing of the animated properties is a follow-up (needs the renderer backend #9). See docs/animation.md.

A semantic drag-and-drop model (Issue #16) β€” DragData payloads (text, files, text/uri-list, arbitrary MIME), DropTarget regions with half-open hit-testing and payload-type acceptance, and a DragDropManager that turns pointer motion into edge-triggered on_drag_enter/over/leave/on_drop callbacks with topmost-wins z-order and source↔target effect negotiation. Pure-Python, deterministic. The native OS drag FFI is a follow-up (needs the window/event loop #8); this ships the model + the DND_PLATFORM_MAP protocol spec the binding layer targets. See docs/drag-drop.md.

A semantic model for OS file/message dialogs (Issue #15) β€” FileDialog (open / open-files / save / pick-directory) with FileDialogFilter glob matching and save-mode extension enforcement, MessageDialog (info / warning / error / question) with stock DialogButton sets and default / cancel button routing, a DialogResponse carrying paths-or-button plus the accepted/cancelled/path conveniences, and a DialogManager that owns the in-flight dialog and validates native-layer responses before accepting. Pure-Python, deterministic, zero third-party deps. The native OS FFI (NSOpenPanel/NSSavePanel, IFileDialog, GtkFileChooserDialog / xdg-desktop-portal) is a follow-up (needs the window/event loop #8); this ships the model + the DIALOG_PLATFORM_MAP backend spec the binding layer targets. See docs/dialogs.md.

JobTemplateStatusPurpose
pipeline:statusβ€”βœ… ActiveVerifies CI connectivity, counts .axs files
test:axon-e2eaxon-library.ymlβœ… ActiveRuns golden file tests on .axs files
test:axon-checkaxon-library.ymlβœ… ActiveAxon type checking on .axs files
test:axon-formataxon-library.ymlβœ… ActiveCode formatting check on .axs files
test:pythonβ€”βœ… ActiveRuns the Python test suite (theme, widgets, etc.)
metrics:librarymetrics-collector.ymlβœ… ActiveCollects lines-of-code and module count metrics
performance:regression-checkperf-thresholds.yml⚠️ allow_failureBinary size and compile time gates

The test:axon-* jobs are now active because .axs source files exist (in stub form). They will run the golden file tests and type/format checks as the stubs grow into real implementations.

MilestoneFocusKey Tickets
M11UI Framework corecontext/state, flexbox, input/hit-test, window, GPU backend
M12Widgets & toolingwidget set, font/text, theming, bundler
M19WASM canvas backendWASM backend for browser deployment

See the GitLab issues for detailed acceptance criteria on each ticket.

Terminal window
# Python tests (theme, widgets, properties)
pip install -r requirements-dev.txt
python -m pytest tests/ -v
# Axon tests (when .axs files have real implementations)
# CI runs these automatically via test:axon-e2e, test:axon-check, test:axon-format

See docs/TESTING.md for the full test workflow.

See docs/CONTRIBUTING.md for contributor onboarding, and docs/architecture.md for the planned architecture.

PackageDescriptionStatus
axon-langCompiler & runtimeβœ… Active
axon-stdStandard libraryβœ… Active
axon-pkgPackage manager🚧 WIP
axon-uiGUI frameworkπŸ“‹ Scaffolding
axon-webHTTP framework (M14)πŸ“‹ Scaffolding

See project license file.