Repository navigation
Commit 06b7e61
authored
feat(core): the shared drag path takes a component's own drag (#9720)
* feat(core): the shared drag path takes a component's own drag
The public pan and snap-point drag keep their behavior (spec:AST-107
FR1, FR2). They now run on internal factories that a Core component can
use for a job the public layer does not expose (spec:AST-107 FR7):
- createPan, under createPanGesture: the recognizer's own options
(which pointers and scrolls start the drag, its claim distance, a
begin gate, a selection lock), and what drove the drag and its travel
from where the touch began in each report.
- createSnapDrag, under createDragToSnapPoints: a model of where a drag
draws its element (one for one, a spring, or nothing yet inside a dead
zone, the first target catching a settle in flight) and where a
release or a cancel lands; a custom property an x drag draws into (a y
drag that asks for one warns); settleTo
with a spring, a velocity and a touch release, returning the settle's
motion; and an onPass callback on the first frame the settle's curve
passes an offset (no timer).
- The animator draws x into a registered custom property (a length or a
number), on the main thread, for a component whose parts all read one
value, with an optional companion property drawn from x in the same
keyframes. Those keyframes are never shared with another call's.
architecture:react-component-runtime INV13 names these jobs among the
known public-API gaps, and spec:AST-107's path applicability links the
two internal factories.
* refactor(core): createPan and createSnapDrag live in the public modules
createPan moves into createPanGesture.ts, and createSnapDrag into
createDragToSnapPoints.ts, as internal named exports beside the public
factories. No package entry exports them, and no behavior changes.
The animator registers a custom property with no state of its own. It
catches only a second registration's InvalidModificationError, and
throws any other error.
The change gains its changeset, an internal chore: Core ships it, and
no consumer sees it.
* docs(AST-107): name the internal pan and snap-point drag
FR7 names createPan and createSnapDrag and the modules that hold them.
The path list follows them into those modules.
* docs(AST-107): say what the internal pan and snap-point drag add
FR7 says what each internal takes that its public factory does not.
createPan takes the recognizer's own options and reports the claim's
travel and the input; createPanGesture starts on every pointer and no
scroll. createSnapDrag takes a model, the pan's options and a custom
property; createDragToSnapPoints keeps Core's one release policy.
* Merge main
* Merge main1 parent a4fe015 commit 06b7e61
9 files changed
Lines changed: 1410 additions & 197 deletions
File tree
- .changeset
- docs
- architecture
- specs/AST-107-public-gesture-hooks
- packages/core/src
- dragToSnapPoints
- gestures
- __tests__
- motion
| 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 | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
315 | 321 | | |
316 | 322 | | |
317 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| |||
182 | 186 | | |
183 | 187 | | |
184 | 188 | | |
185 | | - | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
186 | 201 | | |
187 | 202 | | |
188 | 203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
20 | 18 | | |
21 | | - | |
| 19 | + | |
22 | 20 | | |
23 | 21 | | |
24 | | - | |
| 22 | + | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
| |||
102 | 100 | | |
103 | 101 | | |
104 | 102 | | |
105 | | - | |
106 | | - | |
107 | | - | |
| 103 | + | |
| 104 | + | |
108 | 105 | | |
109 | 106 | | |
110 | | - | |
| 107 | + | |
111 | 108 | | |
112 | 109 | | |
113 | 110 | | |
114 | 111 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 112 | + | |
119 | 113 | | |
120 | 114 | | |
121 | 115 | | |
| 116 | + | |
122 | 117 | | |
| 118 | + | |
123 | 119 | | |
124 | 120 | | |
125 | 121 | | |
| |||
0 commit comments