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. - Stepper
Props - Full props (realize) for the native leaf. Everything but
valueis set once at build.
Enums§
- Stepper
Idiom - Which control this stepper renders as (the colorpicker’s idiom shape).
- Stepper
Patch - The single imperative update: show
valuein 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
vatdecimalsfraction 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.valueis aSignal<f64>, a day-modelField, 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::Automaticresolves against.Support::Nativeon appkit, gtk and qt;Support::Emulatedeverywhere else, whereAutomaticcomposes the field instead.