#474

feat(canvas): slider source ranges, vertical flush button groups, and app input hooks

Openrdevwants to merge intofrom

Summary

  • App input hooks for app-built controls.
    • on_blur is a widget handler for keyboard focus leaving it. A click on another control resolves the blur against the previous tree before the click reaches its target in the rebuilt tree, so an editor can commit and the clicked control still activates.
    • on_widget_pointer and on_widget_keyboard see canvas events before normal routing and consume them when they return a Msg.
    • on_widget_pointer_observe sees unclaimed pointer events without consuming them.
    • on_widget_context_press claims secondary presses before the on_hold fallback. CanvasWidgetContextPressEvent carries the surface-local press point.
  • SliderRange. Widget.slider_range holds min, max, step, orientation, direction, and an optional reset value, set through Ui's slider_* options. The retained value stays the normalized fraction.
    • Pointer, keyboard, accessibility steps, and change dispatch all convert through one source/fraction pair, so on_change delivers source values snapped to the step.
    • Arrow keys follow orientation and direction, Shift moves ten steps, Home and End reach the ends, and a double-click restores the reset value.
    • on_commit fires once on release, after the final sample's on_change. Cancellation never commits.
    • Vertical sliders get vertical geometry.
    • Accessibility snapshots carry range, step, orientation, and direction, and AppKit exposes min, max, and orientation.
    • Sliders without a range behave as before.
  • Vertical flush button groups. WidgetLayoutStyle.vertical stacks a button_group (steppers, a + over a -). Both render walks stamp the axis beside the segment, so the first segment keeps its top corners and the last its bottom ones, and the shared seam drops the top border band.

Notes for review

  • The retained Widget footprint goes from 776 to 808 bytes (slider_range). group_vertical fits in the padding that leaves.

Verification

  • zig build test on macOS with Zig 0.16.0: passed.
  • scripts/gate.sh fast: every step passed except examples-mobile, which needs the Android NDK. The NDK isn't installed here, and upstream main fails the same way.
  • New tests: a slider source range maps, snaps, reverses, and steps in source space, a vertical flush group caps top and bottom corners and drops the top seam, and ui app delivers blur before the click that moves focus, and pointer hooks observe or claim.

Activity

5
vercel[bot]1mo ago

@rdev is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot]reviewed1mo ago