Skip to main content

Module stepper

Module stepper 

Source
Expand description

day_pieces::stepper: a numeric stepper field, a text field with increment/decrement arrows, bound two-way to any Binding<f64> (docs/stepper.md).

Two idioms, decided automatically. Native realizes a leaf where the platform ships the widget: an NSTextField + NSStepper composite on AppKit (macOS has no combined control; the pair is the platform idiom, see any inspector in Keynote), GtkSpinButton, and a QDoubleSpinBox shim. Composed builds the same field from ordinary Day pieces (a − button, a text field, a + button), which is what every backend without an arm gets (uikit, mdc, arkui, dom, xaml and mock), so the piece works on all nine targets.

The native leaf also accepts Event::TextChanged (a typed value, dayscript’s input: step) and Event::ValueChanged/ValueCommitted (dayscript’s set_value:), and mirrors its state into the dayscript probe (assert_text sees the display text, assert_value the number); the frontend reports that explicitly, because day-core’s probe inspection only knows the builtin patch types.

Structs§

Stepper
A stepper field bound two-way to a numeric binding. Build with stepper.
StepperProps
Full props (realize) for the native leaf. Everything but value is set once at build.

Enums§

StepperIdiom
Which control this stepper renders as (the colorpicker’s idiom shape).
StepperPatch
The single imperative update: show value in the field.

Constants§

KIND
VALUE_TAG
The tag every in-process native arm reports a value under. Across a native boundary the tag arrives empty and only the payload matters (§8.2); the front-end reads the text either way.

Functions§

fmt_value
The display form of v at decimals fraction digits: what the field shows, what the probe’s text reports, and what the composed field parses back.
stepper
stepper(value): a numeric field with increment/decrement arrows. value is a Signal<f64>, a day-model Field, or any other two-way binding; a step click commits one unit through it (write_commit), so under an undo stack each click is one undoable step.
support
Whether the compiled backend has a native stepper arm, which is what StepperIdiom::Automatic resolves against. Support::Native on appkit, gtk and qt; Support::Emulated everywhere else, where Automatic composes the field instead.