8000 Apple RadioGroup and Stepper: radio NSButtons / an iOS checkmark list; NSStepper / UIStepper (#150) by rleibman · Pull Request #153 · rleibman/thicket · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ accessibility comes with the control rather than being retrofitted onto a canvas
| | |
|---|---|
| Works today | Linux/GTK4, Android, macOS, iOS simulator — the same app on all four |
| Widgets | **26 of 32** as widgets: 24 measured on every renderer (`TabView` reached AppKit and UIKit in [#69](https://github.com/rleibman/thicket/issues/69)), and `RadioGroup` and `Stepper`, built as §12.2a exceptions on GTK and Android, with Apple's own controls to come ([#150](https://github.com/rleibman/thicket/issues/150)). **32 of 32** covered, counting the six the framework provides another way (SafeArea and Link as props, List as `LazyColumn`, NavigationStack as `Nav`, Menu as a context-menu prop, Toolbar as screen actions) → [docs/12](docs/12-component-status.md) |
| Widgets | **26 of 32** as widgets, all 26 measured on every renderer (`TabView` reached AppKit and UIKit in [#69](https://github.com/rleibman/thicket/issues/69); `RadioGroup` and `Stepper`, built as §12.2a exceptions, in [#150](https://github.com/rleibman/thicket/issues/150): radio `NSButton`s and an iOS checkmark list, `NSStepper` and `UIStepper`). **32 of 32** covered, counting the six the framework provides another way (SafeArea and Link as props, List as `LazyColumn`, NavigationStack as `Nav`, Menu as a context-menu prop, Toolbar as screen actions) → [docs/12](docs/12-component-status.md) |
| Navigation | Native container on all four: `AdwNavigationView`, a `FrameLayout` + `Slide`, `UINavigationController`, a macOS sidebar. Back gesture and title bar are the platform's own |
| Theming | By role, scoped to a subtree with `Provide` |
| Published artefacts | `net.leibman`, tagged **v0.1.0** — but not on Maven Central yet, so `publishLocal` is the only route. [docs/14](docs/14-releasing.md) |
| API stability | **None.** Expect breaking changes without notice |
| Windows | Not started, and out of the 0.1 scope |

This is early, and the honest shape of it is: the parts that exist are finished on all four
platforms rather than sketched on one. Twenty-four widgets on every renderer, with a self-test on each host that reads the tree back out of the real
platforms rather than sketched on one. Twenty-six widgets on every renderer, with a self-test on each host that reads the tree back out of the real
toolkit. Where a prop is handled but not yet honoured on a platform, docs/12 §12.4 says which.

What is genuinely missing: nothing from the v1 catalogue — its last two entries, Radio and
Stepper, fail §12.2a and are deliberately not built — and Maven Central publishing. An app can be built from
Stepper, are built as §12.2a exceptions (#150) — and Maven Central publishing. An app can be built from
outside this repo on GTK, macOS and the iOS simulator — `bin/verify-getting-started.sh` and
`bin/verify-getting-started-apple.sh` check exactly that, by building a template outside the
repo against published artefacts and running it.
Expand Down
14 changes: 8 additions & 6 deletions docs/12-component-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ Android gallery built, Apple gaps the review found filed as #73–#79).
|---|---|
| Widgets in the v1 catalogue (`docs/07` §7.10) | 32 |
| Widgets implemented on at least one renderer | **26** — `RadioGroup` and `Stepper`, the §12.2a exceptions, since 2026-11-03 |
| Widgets implemented on **every** renderer that exists | **24** — measured on all four since #45/#46, `Grid` since #62, `IconButton` since #66 and `TabView` since #69 |
| Widgets implemented on **every** renderer that exists | **26** — measured on all four since #45/#46, `Grid` since #62, `IconButton` since #66, `TabView` since #69, and `RadioGroup` and `Stepper` since #150 |
| Renderers | **4** (GTK4, Android, AppKit, UIKit) |
| Props in the contract | **39** |
| Props implemented on every renderer | **37** — `View`, the embedding point's (`docs/17` §17.3, 2026-11-02), is GTK and Android so far; Apple shows a label in its place until the Mac's half (#145). `Step` (2026-11-03) is GTK and Android; Apple's interim stepper ignores it (#150) |
| Props implemented on every renderer | **38** — `View`, the embedding point's (`docs/17` §17.3, 2026-11-02), is GTK and Android so far; Apple shows a label in its place until the Mac's half (#145). `Step` (2026-11-03) reached AppKit and UIKit in #150 |

**Twenty-four of thirty-two, every one on every renderer, and measured on every one.** `IconButton` reached AppKit and UIKit in #66, and `TabView` in #69. `Grid` reached AppKit and UIKit in #62: gallery **58/58** on macOS and **57/57** on the iOS simulator. `Picker` (#45), `ZStack`, `SegmentedControl` and `DatePicker` (#46) were written on Linux and first run on the Mac in #45/#46, which found one crash (below the table) and is otherwise what the gallery's new checks measure: **48/48** on macOS and **47/47** on the iOS simulator. The six phase 2 widgets landed on
**Twenty-six of thirty-two, every one on every renderer, and measured on every one.** `RadioGroup` and `Stepper` reached AppKit and UIKit in #150. `IconButton` reached AppKit and UIKit in #66, and `TabView` in #69. `Grid` reached AppKit and UIKit in #62: gallery **58/58** on macOS and **57/57** on the iOS simulator. `Picker` (#45), `ZStack`, `SegmentedControl` and `DatePicker` (#46) were written on Linux and first run on the Mac in #45/#46, which found one crash (below the table) and is otherwise what the gallery's new checks measure: **48/48** on macOS and **47/47** on the iOS simulator. The six phase 2 widgets landed on
AppKit and UIKit in #4 and the two presented ones, `Alert` and `Sheet`, in #18; context
menus followed in #19, and the Apple hosts render `AppRoot.pages` since #25. The Apple
self-test is **87/87** on macOS and **82/82** on the iOS simulator; the five iOS does not
Expand Down Expand Up @@ -173,8 +173,8 @@ Slice 2:
| `Grid` | `WidgetKind.Grid` | done | done | done | done | **A §12.2a exception** (#60, the project owner's decision): UIKit has no grid view. `GtkGrid` with cells placed through `GtkGridLayoutChild` / `GridLayout`'s own auto-flow / `NSGridView` / a constraint grid on UIKit. Children flow into `Prop.Columns` columns in child order; each column as wide as its widest cell |
| `DatePicker` | `WidgetKind.DatePicker` | done | done | done | done | The **compact** idiom on all four: a `GtkMenuButton` opening a `GtkCalendar` / a field opening `DatePickerDialog` / a text-field `NSDatePicker` / a `.compact` `UIDatePicker`. The value is a `CalendarDate` — a day, no time, no zone — and crosses the Apple ABI as an epoch day read at midnight UTC |
| `SegmentedControl` | `WidgetKind.SegmentedControl` | done | done | done | done | **The §12.2a exception**, by the project owner's decision on #50: native only on Apple (`NSSegmentedControl` / `UISegmentedControl`). GTK gets a `linked` box of grouped `GtkToggleButton`s, Android a horizontal `RadioGroup` — each platform's own construction, not an imitation of Apple's. Same props as `Picker` |
| `RadioGroup` | `WidgetKind.RadioGroup` | done | done | partial | partial | **A §12.2a exception** (owner's decision 2026-11-03): `Radio` as a group, since Android's exclusion is a container and UIKit has no radio control. Grouped `GtkCheckButton`s / a vertical `RadioGroup`; the props are `Picker`'s (an index, `-1` for none). AppKit is to be radio `NSButton`s and iOS a checkmark list (#150); until then Apple shows its `Picker` |
| `Stepper` | `WidgetKind.Stepper`, `Prop.Step` | done | done | partial | partial | **A §12.2a exception** (owner's decision 2026-11-03): `GtkSpinButton`; Android has none, so − / value / + from framework views, the value shown to the step's precision (`Steps.format`) and + / − disabled at the bounds. `NSStepper` / `UIStepper` with a label are #150; until then Apple shows its `Slider` |
| `RadioGroup` | `WidgetKind.RadioGroup` | done | done | done | done | **A §12.2a exception** (owner's decision 2026-11-03): `Radio` as a group, since Android's exclusion is a container and UIKit has no radio control. Grouped `GtkCheckButton`s / a vertical `RadioGroup`; the props are `Picker`'s (an index, `-1` for none). AppKit: radio `NSButton`s in one stack, which AppKit groups; UIKit: a checkmark list of rows, the exclusion the construction's (#150) |
| `Stepper` | `WidgetKind.Stepper`, `Prop.Step` | done | done | done | done | **A §12.2a exception** (owner's decision 2026-11-03): `GtkSpinButton`; Android has none, so − / value / + from framework views, the value shown to the step's precision (`Steps.format`) and + / − disabled at the bounds. AppKit and UIKit: `NSStepper` / `UIStepper` beside a label, which neither draws, showing `Steps.digits` decimals; the control clamps (#150) |
| `SecureField` | `WidgetKind.SecureField` | done | done | done | done | Entry visibility / password input type. A kind rather than a prop because `NSSecureTextField` is a separate class |

Slice 1:
Expand All @@ -198,7 +198,7 @@ UIKit. It is recorded as indeterminate and read back as such, rather than faked.
| Group | Left to do |
|---|---|
| Layout | — |
| Controls | — (`Radio` and `Stepper` built as §12.2a exceptions, 2026-11-03; their Apple controls are #150) |
| Controls | — (`Radio` and `Stepper` built as §12.2a exceptions, 2026-11-03; on every renderer since #150) |
| Containers | — |

`IconButton` and `Link` were held back for the same reason — one needed an icon system, the
Expand Down Expand Up @@ -410,6 +410,8 @@ The pickers and the camera were each measured on their own branch; the gallery w
2026-11-02 (#134): macOS **208**, the Share section's 8 included (**204** with the screen locked,
in `bin/verify-apple.sh`); iOS simulator ("iPhone 18 Pro") **216**, its 9 included.
Each measured on its own branch; the gallery with both sections has not been run yet.
2026-11-03 (#150, `bin/verify-apple.sh "iPhone Air"`, 20/20 steps): iOS simulator **246**, macOS
**231** with the screen locked, the RadioGroup and Stepper section's 13 included on each.

Four rules the migration established:

Expand Down
34 changes: 34 additions & 0 deletions docs/decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,40 @@ Go decision (see `08` §8.1) is made after S1, S2, S3 have reports.

## Decision log

- 2026-11-03 — **Apple `RadioGroup` and `Stepper`: radio `NSButton`s / an iOS checkmark list;
`NSStepper` / `UIStepper`** (#150, the Apple half of the entry below).
- **Shim kinds 26 and 27**, `RadioGroupView` / `RadioListView` and `StepperView` on both
shims. The radio group is driven by the picker's functions (`sui_picker_*`,
`sui_set_selected`, `sui_on_select`, the read-backs), the stepper by the slider's
(`sui_set_range`, `sui_set_value`, `sui_on_value_change`, `sui_get_value`). Two functions
are new: `sui_set_step(by, digits)`, whose `digits` is `Steps.digits(by)` from Scala so
the label uses the shared rule rather than a Swift copy of it, and `sui_step`, which
presses + or − for the self-test.
- **AppKit:** a vertical stack of `NSButton(radioButtonWithTitle:)`. AppKit groups them
because they share a superview, so the shim never turns a sibling off. Measured: a
different action per button still grouped them on macOS 27; a separate superview did not.
Beside it, an `NSStepper` (`valueWraps` off) and a label.
- **UIKit:** a stack of rows, each a `UIButton` with a trailing `checkmark` shown only on
the chosen row. The exclusion is the construction's own. Beside it, a `UIStepper` and a
`UILabel`.
- **Pressing a stepper from a test.** On AppKit, `sui_step` presses the arrow's
accessibility element (`NSAccessibilityStepperArrowButton`, the element VoiceOver
presses). `NSStepper.accessibilityPerformIncrement()` moved nothing. A synthesised
mouse-down moved it only in the half opposite the arrow it was aimed at. On UIKit, which
offers no public press, `sui_step` writes value ± `stepValue`, which the control's setter
clamps, and sends `.valueChanged` only when the value moved, the way the checkbox's click
sends its event.
- **Measured.** `bin/verify-apple.sh "iPhone Air"` passed 20/20 steps on 2a1e900 plus the
final self-test. iOS simulator gallery **246**. macOS gallery **231** with the screen locked,
each of its two runs. Earlier, unlocked and before the grouping check, macOS was **234**.
13 checks are new on each, the section heading among them. `shimGen/testFull` 51/51.
- **Falsified on both:** with the radios ungrouped, the check "with nothing written back,
only the clicked one stays chosen" fails (Small and Large both on). The check is new
because the app's own write-back otherwise re-exclusively selects and hid the
ungrouping. With the range opened to max + 100, "stops at 5" fails (7). With an app
write echoed as an event, the two "not reported back" checks fail (macOS). With 0
digits, the precision check fails (macOS: `2, 2`).

- 2026-11-03 — **`RadioGroup` and `Stepper`, the last two v1 widgets, as §12.2a exceptions**
(owner's decision; Apple's own controls are #150).
- **Owner's decision:** build both, each platform's own control where it has one and a
Expand Down
12 changes: 11 additions & 1 deletion examples/gallery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ three; unmounting is timed and printed, not checked). Grid on iOS went from 3.9
(2.1). The stack checks passed before the fix too (ratio 2.6–2.8, now 2.1–2.5), so for stacks
the check guards a regression to quadratic, not the small search the fix removed.

**#150** added the Apple checks for RadioGroup and Stepper, 13 on each toolkit. Each radio
control is clicked through its own action: a radio `NSButton`, or a checkmark-list row's
`.touchUpInside`. The steppers are pressed with `sui_step`, and the label beside each is read
for `2` / `1.50`, then `3` / `1.75`, then a stop at 5. The app's own `Selected` and `Value`
writes must not come back as events. A last click with a handler that only records shows
the platform's own grouping. The app's write-back would otherwise hide an ungrouped set.
**246** on the iOS simulator, **231** on macOS with the screen locked. Falsified: with the
radios ungrouped, with the range opened, and with an echoed write, the matching check
fails each time.

Entry symbols are checked without a Mac. An iOS example is three files in three languages
that meet only at link time, matched by name alone, so `shimGen`'s `HostEntrySpec` asserts
that Scala's `@exported`, the bridging header's `extern` and the Swift host's call all name
Expand Down Expand Up @@ -159,7 +169,7 @@ Labels in every `TextRole` and alignment, buttons by role and disabled, `TextFie
`SecureField`, `Checkbox`, `Toggle`, a `Picker` whose options can be swapped and its
selection cleared, every curated `Icon` as an `IconButton`, `SegmentedControl`, a
`DatePicker` on a leap day, `RadioGroup` and two `Stepper`s (one of step 0.25) built as §12.2a
exceptions — on Android a − / value / + row, two `Link`s (one also tappable), a tappable `Label`, `Slider`, determinate and
exceptions — on Android a − / value / + row, on iOS a checkmark list, `NSStepper` and `UIStepper` beside a label — two `Link`s (one also tappable), a tappable `Label`, `Slider`, determinate and
indeterminate `ProgressBar`, `ActivityIndicator`, `Divider`, `Spacer` in a Row and in a
Column, `Grow`, a two-column `Grid` with a row inserted in the middle, `ZStack` as a corner
badge and as a centred overlay, `Image` in all three fits from a file and from bytes, a
Expand Down
Loading
Loading
0