OVERVIEW
Monorepo/Frameworks & UI/libs/ui
v0.1.0 • ActiveSource Code
libs/ui/

libs/ui

Immediate-Mode GPU Widget Toolkit

A fast, immediate-mode GUI toolkit tailored for developer tooling and high-frame-rate user interfaces. Eliminates synchronization headaches between UI state and widget trees by generating layout and drawing commands synchronously on every frame.

ModelImmediate Mode
LayoutsRow / Col / Flex Stacks
WidgetsButtons, Inputs, Sliders, Scrollers
MilestoneM6 Complete
libs/ui
Frame Budget & Event Loop
Target: 144 FPS (6.94ms per frame)
1. Input Polling (0.2ms)
Raw keyboard & mouse events polled via GLFW3 callbacks
2. Piece Table Mutation (0.4ms)
Append-only buffer edit with instant O(1) undo/redo stack
3. GPU Batched Quad Draw (0.8ms)
Dynamic font atlas textures rendered in single GPU draw call
Graphics Engine Architecture
Piece Table Buffer Engine

Sub-Millisecond Multi-Cursor Editing

Unlike line-array or gap-buffer architectures, the Kale Piece Table holds an immutable original file buffer coupled with an append-only edit buffer. Loading a 100MB file takes under 1ms because no memory copying occurs.

Buffer Type: Immutable File Span + Append-Only Log
Undo/Redo: Zero heap copy • O(1) pointer adjustment
ui_demo.kl
kale
import "libs/ui/context.kl" as ui;

fn draw_control_panel(ctx: *ui.UIContext) -> void {
    ui.begin_panel(ctx, "Command Center", 20.0, 20.0, 300.0, 400.0);
    
    ui.label(ctx, "Build Configuration:");
    if ui.button(ctx, "Compile Kale Monorepo") {
        trigger_build();
    }
    
    ui.slider_f32(ctx, "Optimization Level", &opt_level, 0.0, 3.0);
    ui.checkbox(ctx, "Emit LLVM IR Assembly", &emit_ir_flag);
    
    ui.end_panel(ctx);
}
Compilation & Linker Directives

Deterministic command-line invocations to build, link native dynamic dependencies, and run automated regression tests:

$kale build tests/test_ui_widgets.kl -o bin/test_ui.exe -lglfw3 -lopengl32
$./bin/test_ui.exe
Monorepo Governance

GPG Key 1B917D4779A6102E • Continuous integration with automated symbol verification.

Architectural Capabilities
ID Hashing & Interaction State

Stateless API powered by Murmur/FNV widget ID hashes tracking hovered, active, focused, and dragged controls.

Declarative Flow Layout

Automatic bounding box calculation with padding, gap, alignment, and auto-wrapping containers.

Themeable Renaissance Styling

Built-in support for classical dark midnight navy styling, imperial red accents, and gold active states.