Skip to content

Commit 8537352

Browse files
committed
chore(core): what Lab's RefreshControl reads from Core, and UIRefreshControl's values
Core's internal touch entry re-exports, by name, what Lab's RefreshControl reads: the pan recognizer and its hook, the motion math and UIKit tables of its pull, the touch presentation hook, and the page's scroll-style claims, which let a pull at the page's top compose with a scroll lock. The animator's factory keeps its internal name, `createMotionAnimator`. The UIKit constants table gains UIRefreshControl's measured values (`refreshControl`): the refreshing inset, the trigger, the pull after it, the indicator's reveal, spokes, spin and gradient, the trigger springs, and the end clock, each with its source. MEASUREMENTS.md lists the captures still open. The table-imports check lets an internal entry that no Core source imports re-export a component's table by name; an internal module that Core imports stays shared code. The locale catalog gains `@astryx.refreshControl.refreshing`.
1 parent 5a373df commit 8537352

11 files changed

Lines changed: 394 additions & 3 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/core': patch
3+
---
4+
5+
[chore] Internal: Core's internal touch entry re-exports what Lab's RefreshControl reads: the pan recognizer and its hook, the motion math and UIKit tables of its pull, and the page's scroll-style claims. The UIKit constants table gains UIRefreshControl's measured values (`refreshControl`), and the locale catalog gains `@astryx.refreshControl.refreshing` ("Refreshing"). Apps import nothing new.
6+
7+
@vjeux

‎packages/core/locales/en.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,10 @@
747747
"defaultMessage": "Copy link to {heading}",
748748
"description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."
749749
},
750+
"@astryx.refreshControl.refreshing": {
751+
"defaultMessage": "Refreshing",
752+
"description": "Announced to screen readers when a pull to refresh (or a programmatic refresh) starts."
753+
},
750754
"@astryx.richTextEditor.tabEscapeHint": {
751755
"defaultMessage": "Press Escape then Tab to move focus out of the editor.",
752756
"description": "Screen-reader-only hint attached to the RichTextEditor text area. Tab indents text inside the editor, so this tells keyboard users the two-key sequence that moves focus out of it."

‎packages/core/src/gestures/README.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,13 @@ and cancels the touch's moves for its whole length if so. A second finger is
465465
never cancelled, so pinch-zoom keeps working. With no hold, the listener is
466466
gone and every touch scrolls as without the system.
467467

468+
A gesture that pulls an edge of the page, such as a pull to refresh on the
469+
document, sets the page's `overscroll-behavior-y` through
470+
`claimRootScrollStyle` (`../hooks/rootScrollStyles.ts`). It never writes the
471+
style itself: each property keeps a claim stack, so a scroll lock and a pull
472+
compose. `isScrollLockActive` and `subscribeScrollLock` tell such a gesture to
473+
stand down while a lock holds the page.
474+
468475
### Multiple fingers
469476

470477
A drag a recognizer has claimed keeps its finger: a second finger never

‎packages/core/src/internal/touch.test.ts‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,42 @@ describe('internal/touch', () => {
3333
expect(entry).not.toHaveProperty('touchModule');
3434
});
3535

36+
it("re-exports by name what Lab's RefreshControl reads", async () => {
37+
const entry: Record<string, unknown> = await import('./touch');
38+
const pan = await import('../gestures/PanGestureRecognizer');
39+
const hook = await import('../gestures/useGestureRecognizer');
40+
const styles = await import('../hooks/rootScrollStyles');
41+
const animator = await import('../motion/animator');
42+
const bezier = await import('../motion/bezier');
43+
const resolve = await import('../motion/resolveMotion');
44+
const band = await import('../motion/rubberBand');
45+
const spring = await import('../motion/spring');
46+
const refresh = await import('../motion/uikit/refresh');
47+
const scroll = await import('../motion/uikit/scroll');
48+
const timing = await import('../motion/uikit/timing');
49+
const presentation = await import('../utils/touchPresentation');
50+
expect(entry.PanGestureRecognizer).toBe(pan.PanGestureRecognizer);
51+
expect(entry.useGestureRecognizer).toBe(hook.useGestureRecognizer);
52+
expect(entry.claimRootScrollStyle).toBe(styles.claimRootScrollStyle);
53+
expect(entry.isScrollLockActive).toBe(styles.isScrollLockActive);
54+
expect(entry.subscribeScrollLock).toBe(styles.subscribeScrollLock);
55+
expect(entry.createMotionAnimator).toBe(animator.createMotionAnimator);
56+
expect(entry.SETTLE_THRESHOLD).toBe(animator.SETTLE_THRESHOLD);
57+
expect(entry.cubicBezier).toBe(bezier.cubicBezier);
58+
expect(entry.resolveMotion).toBe(resolve.resolveMotion);
59+
expect(entry.rubberBand).toBe(band.rubberBand);
60+
expect(entry.rubberBandInverse).toBe(band.rubberBandInverse);
61+
expect(entry.solveSpring).toBe(spring.solveSpring);
62+
expect(entry.toSpring).toBe(spring.toSpring);
63+
expect(entry.refreshControl).toBe(refresh.refreshControl);
64+
expect(entry.scroll).toBe(scroll.scroll);
65+
expect(entry.registerTimingTable).toBe(timing.registerTimingTable);
66+
expect(entry.timing).toBe(timing.timing);
67+
expect(entry.useTouchPresentation).toBe(presentation.useTouchPresentation);
68+
// No internal factory shares a public factory's name.
69+
expect(entry).not.toHaveProperty('createAnimator');
70+
});
71+
3672
it('attaches no window or document listeners when it loads', async () => {
3773
vi.resetModules();
3874
const onWindow = vi.spyOn(window, 'addEventListener');

‎packages/core/src/internal/touch.ts‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
/**
44
* @file touch.ts
5-
* @input The gesture core: the arena, the recognizers, and their geometry
5+
* @input The gesture core: the arena, the recognizers, and their geometry;
6+
* the motion math and UIKit tables that Lab's RefreshControl reads; the
7+
* page's scroll-style claims
68
* @output `@astryxdesign/core/internal/touch`: the gesture core's primitives
79
* for Lab components, re-exported by name
810
* @position An internal entry reserved for Astryx's own packages:
@@ -39,3 +41,35 @@ export {
3941
export {LongPressGestureRecognizer} from '../gestures/LongPressGestureRecognizer';
4042
export {TapGestureRecognizer} from '../gestures/TapGestureRecognizer';
4143
export {DEFAULT_ENVIRONMENT} from '../gestures/types';
44+
45+
// Lab's RefreshControl reads these. The scroll-style claims let a pull at
46+
// the page's top compose with a scroll lock.
47+
export {PanGestureRecognizer} from '../gestures/PanGestureRecognizer';
48+
export type {PanGestureRecognizerOptions} from '../gestures/PanGestureRecognizer';
49+
export type {
50+
GestureEventContext,
51+
GestureTouch,
52+
PointerKind,
53+
} from '../gestures/types';
54+
export {useGestureRecognizer} from '../gestures/useGestureRecognizer';
55+
export {
56+
claimRootScrollStyle,
57+
isScrollLockActive,
58+
subscribeScrollLock,
59+
} from '../hooks/rootScrollStyles';
60+
// The animator's internal factory. The public one, `createAnimator`, plays
61+
// only the theme's state-change motion.
62+
export {createMotionAnimator, SETTLE_THRESHOLD} from '../motion/animator';
63+
export type {
64+
Animator as MotionAnimator,
65+
AnimatorOptions as MotionAnimatorOptions,
66+
MotionCurve,
67+
} from '../motion/animator';
68+
export {cubicBezier} from '../motion/bezier';
69+
export {resolveMotion} from '../motion/resolveMotion';
70+
export {rubberBand, rubberBandInverse} from '../motion/rubberBand';
71+
export {solveSpring, toSpring} from '../motion/spring';
72+
export {refreshControl} from '../motion/uikit/refresh';
73+
export {scroll} from '../motion/uikit/scroll';
74+
export {registerTimingTable, timing} from '../motion/uikit/timing';
75+
export {useTouchPresentation} from '../utils/touchPresentation';

‎packages/core/src/motion/MEASUREMENTS.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,3 +304,32 @@ scroll view coasts with 0.25 × the pan's velocity plus 0.75 × its value one
304304
event earlier (four HID releases; `velocity.scrollReleaseWeight`, which a
305305
pan's `scrollVelocity()` reads). On UIKit, Reduce Motion with Prefer Cross-Fade changes
306306
nothing on a picker; the Wheel follows design:reduced-motion instead.
307+
308+
## Refresh control (UIRefreshControl)
309+
310+
Values the refresh control reads from its own table (`uikit/refresh.ts`); its
311+
release onto the inset is `scroll.bounce` (M-S3) and its pull past the
312+
control's height is `scroll.rubberBand`. Subject: RefreshLab, a UIKit host app
313+
with a `UIRefreshControl` on a table view (334, 400, 874 and 1366 pt tall on
314+
the iPhone 17 Pro simulator) and buttons for `beginRefreshing` and
315+
`endRefreshing`.
316+
317+
Done (iOS 26.2 simulator, Oct 23 2026; in the refresh control's table): the
318+
height and refreshing inset, the one-to-one pull up to the height, the trigger
319+
distance against the view's height (and its floor), the trigger moment (finger
320+
down), the step after it, the release onto the inset, the reveal (a paused
321+
replicator scrubbed by overscroll ÷ trigger distance; 8 spokes), the spin and
322+
trigger springs, the spokes' geometry and the refreshing gradient (alpha
323+
offset 0.08, first alpha 0, springing in with `allowsOverdamping` off; Oct 24
324+
2026), the end clock (three runs at rest, identical), that a
325+
momentum overshoot never triggers, that a pull while refreshing fires
326+
`valueChanged` again, and that the trigger makes no feedback-generator call
327+
(at 50, 150 and 400 pt/s).
328+
329+
| ID | What | App and gesture | Extract | Method |
330+
| ----- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------ |
331+
| M-RC2 | Indicator placement | RefreshLab: slow pulls to 2 × the trigger distance on the 400 and 874 pt views, a screen recording beside the layer log | the control's frame and the spinner's position against the overscroll (moves with the content, pinned, or centred in the gap) | B, C |
332+
| M-RC3 | Pull after the trigger | RefreshLab: pulls to 300 pt at 150 and 50 pt/s on the 334 and 874 pt views; a second pull while refreshing | the offset against the finger past 2 × `height` (is the step back systematic?), and the distance at which a pull while refreshing fires | C |
333+
| M-RC4 | Trigger springs | RefreshLab: pulls through the trigger at 50, 150 and 400 pt/s | the turn spring's stiffness against the release speed (its overdamping and the gradient's targets are measured) | A |
334+
| M-RC5 | End of a refresh | RefreshLab: `endRefreshing` while scrolled 300 pt away, while dragging, with a touch 100 ms into it, and 50 ms after a begin | what moves when scrolled away, the end under a finger, what a touch during the end does, any minimum visible time; a screen recording | A, B |
335+
| M-RC7 | Programmatic begin | RefreshLab: `beginRefreshing` at the top and when scrolled 300 pt | whether the content moves to reveal the control, and its curve | A, C |

‎packages/core/src/motion/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ roles through `resolveMotion`.
2626
| `uikit/picker.ts` | UIPickerView: row pitch, height and rubber band, velocity floor, the coast's stop speed, snap at rest, tap spin, tick. |
2727
| `uikit/segmented.ts` | UISegmentedControl: the selection indicator's spring; under Reduce Motion the animator's cross-fade replaces it. |
2828
| `uikit/switch.ts` | UISwitch on iOS 26.2: geometry, the lift, settle, travel and tracking springs, the flip distance, the track colour. |
29+
| `uikit/refresh.ts` | UIRefreshControl: the refreshing inset, the trigger, the pull after it, the indicator's reveal, spokes and spin, the trigger springs, the end clock. |
2930
| `roles.ts` | The internal motion roles: the springs, durations and curves `spec:AST-094` FR4 names, registered by the shared tables, and a role's CSS form read back. |
3031
| `roleValue.ts` | A role's CSS form, written: a spring's duration and bounce, a duration in ms, a curve's `cubic-bezier()`. |
3132
| `resolveMotion.ts` | A role's value: its table value, as the per-role tables stay internal (`spec:AST-094` DEC-15). |

‎packages/core/src/motion/uikit/index.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
* @output Re-exports `springs` and one constant per spring (`SHEET_PRESENT_SPRING`,
77
* …), `scroll`, `timing`, `navigation`, `picker`, `progressBar`,
88
* `segmentedControl`, the `slider` and switch (`switchControl`) domains, and
9-
* the gesture thresholds (one `UIKIT_*` group per recognizer, their union
9+
* the refresh control (`refreshControl`). It also re-exports the gesture
10+
* thresholds (one `UIKIT_*` group per recognizer, their union
1011
* `UIKIT_GESTURES`, and the haptic tables)
1112
* @position Entry of the UIKit constants table (motion/uikit). Internal to
1213
* core: not exported from the package entry point
@@ -42,6 +43,7 @@ export {
4243
export {navigation, registerNavigationTable} from './navigation';
4344
export {picker} from './picker';
4445
export {progressBar, registerProgressBarTable} from './progressBar';
46+
export {refreshControl} from './refresh';
4547
export {registerScrollTable, scroll} from './scroll';
4648
export {segmentedControl} from './segmented';
4749
export {slider} from './slider';
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) Meta Platforms, Inc. and affiliates.
2+
3+
/**
4+
* @file refresh.test.ts
5+
* @input vitest, the refresh-control table and the motion role registry
6+
* @output Covers the refresh-control table staying internal constants: none
7+
* of its values is a motion role
8+
* @position Testing; colocated with refresh.ts
9+
*/
10+
11+
import {describe, expect, it} from 'vitest';
12+
import {listMotionRoles} from '../roles';
13+
import {refreshControl} from './refresh';
14+
15+
describe('refreshControl', () => {
16+
it('is internal constants, read as they are: none is a motion role', () => {
17+
expect(refreshControl.endMs).toBe(300);
18+
expect(
19+
listMotionRoles().filter(role => role.id.startsWith('refreshControl.')),
20+
).toEqual([]);
21+
});
22+
});

0 commit comments

Comments
 (0)