iris-aiandClaude Opus 5 de9ddc0ad4 Resolve a declared length where the widget is drawn, not inside it
SetSize took its declared length out of UiRegion::FULL, which is the box
it was already given, so a span that had sized that box from the same
hint had the fraction taken twice: .width(rel(0.5)) in a 400-wide span
drew its child 100 wide. It held under a Pad or the root, which do not
honour a hint, and hid under px, where 200 of a 200-wide box is all of
it. The text example was 111,923 pixels from upstream/main because of
it.

Whoever draws a widget now takes its declared length, in its own box,
which is what a fraction of one means, and is the identity for a caller
that already reserved the space. rest is not taken: a share of what is
left over is only a length to the widget dividing one, so it passes up
in the size as it does out of a span. SetSize keeps only what it
declares.

A declared length is then part of the box its parent decided, so
changing one has to redraw the parent; the lengths resolved into a box
are kept beside it and compared. Assuming instead that any dirty widget
which declares a length needs its parent costs 17% of a frame that
dirties 130 of 260 widgets, and buys nothing.

All five reference renders, the resize render and the image replay are
byte-identical to upstream/main, the 100-seed sweep passes, and the
resize fixture is 1.286 ms against 1.289 before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 13:37:34 -04:00
2026-01-05 17:01:09 -05:00
2025-11-17 16:08:29 -05:00
2026-01-29 16:39:19 -05:00
2026-09-13 00:24:29 -04:00

iris

My experimental attempt at a rust ui library (also my first ui library).

It's currently designed around using retained data structures (widgets), rather than diffing generated trees from data like xilem or iced. This is an experiment and I'm not sure if it's a good idea or not.

Examples are in examples, eg. cargo run --example tabs.

Goals, in general order:

  1. does what I want it to (text, images, video, animations)
  2. very easy to use ignoring ergonomic ref counting
  3. reasonably fast / efficient (a lot faster than electron, save battery life, try to beat iced and xilem)

dev details

not targeting web rn cause wanna use actual nice gpu features & entire point of this is to make desktop apps / not need a web browser

general ideas trynna use rn / experiment with:

  • retained mode
  • specifically designed around wgpu so there's no translation
  • postfix functions for most things to prevent unreadable indentation (going very well)
  • events can be done directly where you draw the widgets
  • almost no macros in user code & actual LSP typechecking (variadic generics if you can hear me please save us)
  • relative anchor + absolute offset coord system (+ "rest" / leftover during widget layout)
  • single threaded ui & pass context around to make non async usage straightforward (pretty unsure about this)
  • widgets store outside of the actual rendering so they can be moved around and swapped easily (unsure about this but seems to work good for now)

under heavy initial development so not gonna try to explain status, maybe check TODO for that; sizable chance it gets a rewrite once I know everything I need and what seems to work best

it's called iris because it's the structure around what you actually want to display and colorful

S
Description
No description provided
Readme
4.1 MiB
0 Stars 1 Watchers 0 Forks
Languages
Rust 96.3%
Shell 2.1%
WGSL 1.6%