Repository navigation
chore(core): Lab's PageControl reaches the shared animator, the Reduce Motion cross-fade and the touch hit area through Core's internal touch entry - #9669
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC |
|---|---|---|
| lab/NavigationScreen | 78.3 kB (+242 B) · 1.5 kB CSS (0) | — |
| lab/NavigationStack | 78.3 kB (+242 B) · 1.5 kB CSS (0) | — |
Package size: @astryxdesign/core 6.71 MB packed (+243 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 19 rows, core 24 rows; run pnpm api:report.
Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the PanGestureRecognizer re-export: architecture:react-component-runtime INV13 opens @astryxdesign/core/internal/touch only for its listed public-API gaps, which name no pan, and spec:AST-107 FR7 sends a drag to the public usePanGesture/createPanGesture, which is not built yet. An engineering owner needs to provide or identify the governing spec for reaching PanGestureRecognizer through the internal entry until then (for example an amended INV13 gap list), or decide that the re-export waits for the public pan factory; they record the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner. Independently, these changes are needed:
- The diff against
mainis 7,234 authored lines because it carries all of #9399; land #9399 first and rebase so this pull request holds only its own 26-line change. packages/lab/src/SearchField/SearchFieldTouch.ts(lines 495-547) adds its own document-level stray-click swallower after a claimed tap instead of extending Core's click guard (armClickGuardinutils/clickGuard.ts), which the gesture host already arms for claimed touches.packages/lab/src/SearchField/SearchFieldTouch.ts(lines 604-633) creates aResizeObserverper field instead of using Core's sharedobserveResizefrom@astryxdesign/core/utils.
[Automated review]
| unwrapAngle, | ||
| } from '../gestures/geometry'; | ||
| export {LongPressGestureRecognizer} from '../gestures/LongPressGestureRecognizer'; | ||
| export {PanGestureRecognizer} from '../gestures/PanGestureRecognizer'; |
There was a problem hiding this comment.
PanGestureRecognizer serves PageControl's scrub, a drag that spec:AST-107 FR1, FR6 and FR7 assign to the public usePanGesture/createPanGesture; INV13's list of known public-API gaps names no pan. This needs an engineering owner's decision: amend INV13's gap list for the interim, or wait for the public pan factory.
| /** | ||
| * @file touch.ts | ||
| * @input The gesture core: the arena, the recognizers, and their geometry | ||
| * @input The gesture core: the arena, the recognizers, their geometry and |
There was a problem hiding this comment.
Non-blocking: the header is now 23 lines (file headers stay near 12), and @output still says "the gesture core's primitives" although the entry now carries the motion core too. Suggested: @input Core's gesture, motion and touch-presentation modules and @output @astryxdesign/core/internal/touch: those modules for Lab, by name.
| // lets go (its click, the next press, or its window), the late events are | ||
| // over, and this swallow lets go too. | ||
| const disarmRef = useRef<(() => void) | null>(null); | ||
| const armSwallow = useCallback((doc: Document) => { |
There was a problem hiding this comment.
This adds a second stray-click swallower: document capture listeners for mousedown, mouseup and click that stay armed until the next click, touch, pointer or key, with no time limit. Core's armClickGuard (utils/clickGuard.ts) already owns the click after a claimed touch, and the gesture host arms it for claimed contacts. Suggest extending the guard with an option that also swallows the compatibility mousedown/mouseup, re-exporting it through internal/touch, arming it here, and deleting armSwallow and its unmount Effect.
| if (field == null || Observer == null || placement === 'tab') { | ||
| return; | ||
| } | ||
| const observer = new Observer(() => { |
There was a problem hiding this comment.
This creates one ResizeObserver per field. Core's shared observeResize (from @astryxdesign/core/utils, which this component already imports from) provides the same fact: return observeResize(field, onResize);. Its first synchronous call only re-places the settled pose.
0a0243a to
e740f3b
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the PanGestureRecognizer re-export: architecture:react-component-runtime INV13 opens @astryxdesign/core/internal/touch only for its listed public-API gaps, which name no pan, and spec:AST-107 FR7 sends a drag to the public usePanGesture/createPanGesture, which is not built yet. An engineering owner needs to provide or identify the governing spec for reaching PanGestureRecognizer through the internal entry until then (for example an amended INV13 gap list), or decide that the re-export waits for the public pan factory; they record the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner. The animatorFor, reducedMotionFade and watchHitArea re-exports match INV13's listed gaps. Independently, these changes are needed:
- The diff against
mainis 7,237 authored lines because it carries all of #9399; land #9399 first and rebase so this pull request holds only its own 29-line change. packages/lab/src/SearchField/SearchFieldTouch.ts(lines 495-547) adds its own document-level stray-click swallower after a claimed tap instead of extending Core's click guard (armClickGuardinutils/clickGuard.ts), which the gesture host already arms for claimed touches.packages/lab/src/SearchField/SearchFieldTouch.ts(lines 604-633) creates aResizeObserverper field instead of using Core's sharedobserveResizefrom@astryxdesign/core/utils.
[Automated review]
| unwrapAngle, | ||
| } from '../gestures/geometry'; | ||
| export {LongPressGestureRecognizer} from '../gestures/LongPressGestureRecognizer'; | ||
| export {PanGestureRecognizer} from '../gestures/PanGestureRecognizer'; |
There was a problem hiding this comment.
PanGestureRecognizer serves PageControl's scrub, a drag that spec:AST-107 FR1, FR6 and FR7 assign to the public usePanGesture/createPanGesture, which is not built yet. INV13's list of known public-API gaps names no pan, so this re-export waits on an engineering owner's decision (for example an amended INV13 gap list).
| // An element's one shared animator, as Core's components reach it (no public | ||
| // API has the name), and the Reduce Motion cross-fade's timing. |
There was a problem hiding this comment.
Non-blocking: this comment restates the names below it. Delete it.
| // lets go (its click, the next press, or its window), the late events are | ||
| // over, and this swallow lets go too. | ||
| const disarmRef = useRef<(() => void) | null>(null); | ||
| const armSwallow = useCallback((doc: Document) => { |
There was a problem hiding this comment.
This adds a second stray-click swallower: document capture listeners for mousedown, mouseup and click after a claimed tap, with no time limit. Core's click guard (armClickGuard, utils/clickGuard.ts) already owns the click after a claimed touch, and the gesture host arms it. Extend the guard to also swallow the compatibility mousedown/mouseup, arm it here, and delete armSwallow and its unmount Effect.
|
|
||
| // A resize while settled (the window turning, a host relaying out) moves | ||
| // the narrowed end to the new width at once. | ||
| useLayoutEffect(() => { |
There was a problem hiding this comment.
This creates one ResizeObserver per field. Core's shared observeResize (exported from @astryxdesign/core/utils, which SearchField.tsx already imports) owns this: return observeResize(field, onResize); with the same callback.
e740f3b to
769ed35
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the PanGestureRecognizer re-export: architecture:react-component-runtime INV13 opens @astryxdesign/core/internal/touch only for its listed public-API gaps, which name no pan, and spec:AST-107 FR7 sends a drag to the public usePanGesture/createPanGesture, which is not built yet. An engineering owner needs to provide or identify the governing spec for reaching PanGestureRecognizer through the internal entry until then (for example an amended INV13 gap list), or decide that the re-export waits for the public pan factory; they record the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner. The animatorFor, reducedMotionFade and watchHitArea re-exports match INV13's listed gaps, and the earlier SearchField resize-observer and stray-click findings are resolved. Independently, this change is needed:
- The diff against
mainis 7,362 authored lines because it carries all of #9399; land #9399 first and rebase so this pull request holds only its own 22-line change.
[Automated review]
769ed35 to
1ea5d3e
Compare
There was a problem hiding this comment.
This looks ready to approve. Each new name on @astryxdesign/core/internal/touch fills a gap that architecture:react-component-runtime INV13 lists, or, for PanGestureRecognizer, the engineering owners' interim decision recorded on this pull request, and the engine rename leaves no old reference on current main.
Two non-blocking comment suggestions:
packages/core/src/motion/animator.ts: the "Options ofcreateMotionEngine." JSDoc sits aboveSetOptions's own JSDoc, so it documents nothing; move it ontoAnimatorOptionsor drop it.packages/core/src/internal/touch.ts: the header's@outputstill says "the gesture core's primitives"; a shorter header that names the gesture, motion, touch and direction modules would match the entry.
Because the branch is stacked, it should merge after #9754.
[Automated review]
|
|
||
| /** | ||
| * Options of `createMotionAnimator`. | ||
| * Options of `createMotionEngine`. |
There was a problem hiding this comment.
Non-blocking: this JSDoc sits above SetOptions's own JSDoc, so it documents nothing, and AnimatorOptions (line 318) has none. Move it onto AnimatorOptions, or delete it.
| * @input The gesture core: the arena, the recognizers, and their geometry | ||
| * @input The gesture core and the motion, touch and direction modules Lab | ||
| * uses | ||
| * @output `@astryxdesign/core/internal/touch`: the gesture core's primitives |
There was a problem hiding this comment.
Non-blocking: @output still says "the gesture core's primitives", but the entry now also carries the motion engine, curve helpers, hit-area watcher and direction read, and the header is 20 lines (file headers stay near 12). Suggested: @input Core's gesture, motion, touch and direction modules and @output @astryxdesign/core/internal/touch: those modules for Lab, by name.
1ea5d3e to
691bf8b
Compare
|
/approve-spec 691bf8b |
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #9684.
…e Motion cross-fade and the touch hit area through Core's internal touch entry Internal entries land with their first user. Lab's PageControl animates its strip and dots with each element's one shared animator, where the strip's slide and a dot's size and fade compose. It reads the Reduce Motion cross-fade's timing, and it grows toward a 44 px target under a finger with the touch hit area that Core's own controls use. So `@astryxdesign/core/internal/touch` also re-exports, by name: - `animatorFor`, an element's shared animator, as Core's components reach it (no public API has the name); - `reducedMotionFade`; - `useTouchHitArea` and `touchHitAreaStyles`, the touch hit area's hook and its layer. Named re-exports only, of code already on main: no behavior change, no docs, no root re-export, no new entry, and the `@astryx/no-core-internal-import` lint rule already limits the entry to Core and Lab. The entry's test checks it re-exports the same values Core imports by path, and the touch bundle test lists the four names among those the public entry does not export.
691bf8b to
c3954ea
Compare
|
/approve-spec c3954ea |
|
/approve-spec 68ab6e5 |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet.
Each new name on @astryxdesign/core/internal/touch (animatorFor, reducedMotionFade, useTouchHitArea, touchHitAreaStyles) fills a gap that architecture:react-component-runtime INV13 lists. The root entry stays unchanged. The new entry and bundle tests fail without the re-exports and pass with them.
Non-blocking:
packages/core/src/internal/touch.ts:84-85: the group comment restates the names below it.// Lab's PageControl reads these.keeps only the reason (INV29).
[Automated review]
| // Lab's PageControl also reads an element's shared animator, the Reduce | ||
| // Motion cross-fade, and the touch hit area's hook and layer. |
There was a problem hiding this comment.
Non-blocking (INV29): this comment restates the four names below it in words. Keep only the reason:
// Lab's PageControl reads these.# Conflicts: # packages/core/src/internal/touch.test.ts # packages/core/src/internal/touch.ts # scripts/touch-support-bundle.test.mjs
|
/approve-spec 1a209d8 |
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #9684.
|
/approve-spec 39d3a83 |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet.
Each new name on @astryxdesign/core/internal/touch (animatorFor, reducedMotionFade, useTouchHitArea, touchHitAreaStyles) fills a gap that architecture:react-component-runtime INV13 lists, and the public root entry is unchanged. The new entry and bundle test cases fail without the re-exports and pass with them.
Non-blocking:
packages/core/src/internal/touch.ts:99-100: the group comment restates the four names below it;// Lab's PageControl reads these.keeps only the reason (INV29).packages/core/src/internal/touch.ts: the file header is 22 lines, past the guide of about 12; a shorter@inputand@outputwould fit it.
[Automated review]
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet.
Each new name on @astryxdesign/core/internal/touch (animatorFor, reducedMotionFade, useTouchHitArea, touchHitAreaStyles) fills a gap that architecture:react-component-runtime INV13 lists, and the public root entry is unchanged. The merge of main keeps its finger-scroll group and adds PageControl's after it, and the new entry and bundle test cases fail without the re-exports and pass with them.
Non-blocking:
packages/core/src/internal/touch.ts:103-104: the group comment restates the four names below it;// Lab's PageControl reads these.keeps only the reason (INV29).packages/core/src/internal/touch.ts: the file header is 22 lines, past the guide of about 12; a shorter@inputand@outputwould fit it.
[Automated review]
|
/approve-spec 2ca0ea0 |
|
/approve-spec 6646a51 |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet.
Each new name on @astryxdesign/core/internal/touch (animatorFor, reducedMotionFade, useTouchHitArea, touchHitAreaStyles) fills a gap that architecture:react-component-runtime INV13 lists, and the public root entry is unchanged. The latest merge of main leaves the change as it was, and the new entry and bundle test cases fail without the re-exports and pass with them.
Non-blocking:
packages/core/src/internal/touch.ts:103-104: the group comment restates the four names below it;// Lab's PageControl reads these.keeps only the reason (INV29).packages/core/src/internal/touch.ts: the file header is 22 lines, past the guide of about 12; a shorter@inputand@outputwould fit it.
[Automated review]
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #9684.
|
/approve-spec 7c2eaa7 |
Batch: L1 · Lab: iOS chrome (TabBar, SearchField, NavigationStack, PageControl)
Primary intent
Core's internal touch entry gains four named re-exports for Lab's PageControl, their first user: an element's shared animator, the Reduce Motion cross-fade, and the touch hit area's hook and layer. The pan recognizer and gesture hook that PageControl also reads are already on the entry. It is its own small Core PR so that the PageControl batch stays Lab-only. No other template fits: it adds no public capability and changes no behavior.
User or maintainer impact
None for product builders.
@astryxdesign/core/internal/touchis reserved for Astryx's own packages, outside the public API. Lab's PageControl imports these four names.Problem and solution fit
Authority
architecture:react-component-runtimeINV13: Core and Lab reach the internal touch modules only for its known public-API gaps, through this entry, which the@astryx/no-core-internal-importlint rule limits to Core and Lab.spec:AST-017FR21: outside the public API's compatibility promise. Each re-export's gap:reducedMotionFade: "the Reduce Motion cross-fade constants".animatorFor: "the animator's jobs beyond the public handle". The strip's slide and a dot's size and fade compose on one element's shared animator: a companion on its clock.useTouchHitAreaandtouchHitAreaStyles: the touch hit area's hook and layer, which the public gesture layer doesn't cover ("the touch hit-area expansion").Internal entries land with their first user: the PageControl Lab batch, #9684. This PR merges right before it.
Change and evidence
internal/touch.tsre-exportsanimatorFor,reducedMotionFade,useTouchHitAreaandtouchHitAreaStylesby name, in PageControl's own group, as the entry groups names by reader. Its header names the hit-area helper.internal/touch.test.tschecks, in its own case, that each is the same value Core imports by path.scripts/touch-support-bundle.test.mjslists the four names among those the public entry does not export, as the entry's SYNC line asks.[chore]changeset.No behavior change.
Scope
Testing
internaltests andutils/touchHitArea.test.tsx, 31 passed (the entry's 5 included);scripts/touch-support-bundle.test.mjs, 11 passed.CI=true pnpm lintover the repository passes. Prettier passes. Core tsc: 0 errors.check:changesetsandcheck:knowledgepass.architecture:react-component-runtimeINV13;spec:AST-017FR21;architecture:knowledge-contractsINV29 (comments); and the global recordspnpm specs:for --difflists. No record changes, no public API change, no owner-gated paths.Stack: #9669 → #9684
Merge group: #9669, #9684