Repository navigation
Commit 288574e
committed
feat(lab): PageControl, UIPageControl's indicators: a tap steps a page, a finger scrubs, every pointer pages
PageControl is a row of page indicators, the current one highlighted, that
pages like UIPageControl on iOS 26 (measured on the iOS 26.2 simulator):
- What it draws: 9.67 px indicators 8 px apart, at most ten slots; with
more pages the row is a window whose edge slots shrink and slide on
UIKit's spring; the old indicator fades out after a change.
- How it pages: the app owns the page (`value`, `onChange`). A tap on
either side of the current indicator asks for the next or the previous
page (mirrored in RTL); a finger that travels 16 px scrubs to the
indicator under it and jogs past a window's edge; a press held 155 ms
shows the held platter and dims the others. A vertical swipe stays the
page's scroll.
- Every pointer: with a mouse or a pen a click steps one page
toward its side and a drag scrubs; the platter, the dimming, the window's
slide and the fades stay the touch presentation, on a coarse pointer.
- Reduce Motion: every change fades in 200 ms, nothing travels.
- Accessibility: one adjustable `slider` ("Page 3 of 5"); the arrow keys,
Home and End change the page. Under a coarse pointer an invisible hit area
grows the control toward 44 px, as far as its neighbours allow.
- A mouse scrub on a cropped long row holds the row still until the lift, so
the page stays the dot under the pointer.
Its measured values live in its own table (pageControlTable.ts): only
PageControl reads them, so they stay in Lab. It reaches Core's pan and tap
recognizers, each element's shared animator, the Reduce Motion cross-fade,
the hit-area watcher and the touch presentation through Core's internal
touch entry.
`astryx discover` lists it, and the registry has its route.
Its timing holds on a loaded runner. A jog step commits in the timer's own
task (`flushSync`): a render scheduled after it could wait behind a busy
page's other tasks past the next step, and two steps would show as one. A
jog step counts from when the previous one was due, so a timer that runs
late does not slow the run (after
a stall longer than a step, from the late step: no burst). The window's
slide starts 50 ms after the change at a start time on the document
timeline, for the strip and every dot, which a busy main thread cannot push
back as it would a timer. The held-platter proof dates each read on the
page's clock from the touch, the clock the 155 ms runs on, and the slide
proof dates the change at the lift's first event, the task the change
commits in, not by the next frame or the end of that task. The slide's
storyboard arms the harness's hold before the tap (`armHold`), so the page
holds the motion as it starts, however late the test reads it. The RTL
scrub holds the finger 6 px past the content's edge, where the jog steps
about once a second, so exactly one step comes before the lift with
hundreds of milliseconds to spare.
The unit tests' media-query stub answers from the case's pointer at every
read: Core's gesture host keeps the `(pointer: coarse)` list it asked for
when the document's host was created, so a stub that froze its answer let
an earlier mouse case's pointer reach a later touch case (that case failed
after any mouse case, and passed alone).1 parent 1ea5d3e commit 288574e
14 files changed
Lines changed: 3667 additions & 0 deletions
File tree
- .changeset
- apps/storybook/stories
- internal/shadcn-registry
- packages
- cli/assets/discover
- lab/src
- PageControl
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
627 | 627 | | |
628 | 628 | | |
629 | 629 | | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
630 | 635 | | |
631 | 636 | | |
632 | 637 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
0 commit comments