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
7 changes: 7 additions & 0 deletions .changeset/core-internal-entries-page-control.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch
---

[chore] Internal: `@astryxdesign/core/internal/touch` also re-exports an element's shared animator, the Reduce Motion cross-fade, and the coarse-pointer touch hit area's hook and layer, for Lab's PageControl. It is an internal entry reserved for Astryx's own packages, outside the public API.

@vjeux
22 changes: 22 additions & 0 deletions packages/core/src/internal/touch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,28 @@ describe('internal/touch', () => {
expect(entry.navigation).toBeDefined();
});

it("re-exports by name what Lab's PageControl also reads", async () => {
const entry: Record<string, unknown> = await import('./touch');
const animator = await import('../motion/animator');
const reduced = await import('../motion/reducedMotion');
const hitArea = await import('../utils/touchHitArea');
const hitAreaStyles = await import('../utils/touchHitArea.stylex');
expect(entry.animatorFor).toBe(animator.animatorFor);
expect(entry.reducedMotionFade).toBe(reduced.reducedMotionFade);
expect(entry.useTouchHitArea).toBe(hitArea.useTouchHitArea);
expect(entry.touchHitAreaStyles).toBe(hitAreaStyles.touchHitAreaStyles);
// An identity check passes when both sides are undefined, so each name
// must also be defined.
for (const name of [
'animatorFor',
'reducedMotionFade',
'useTouchHitArea',
]) {
expect(typeof entry[name], name).toBe('function');
}
expect(entry.touchHitAreaStyles).toBeDefined();
});

it("re-exports by name what NavigationStack's bars and scroll edge effect read", async () => {
const entry: Record<string, unknown> = await import('./touch');
const host = await import('../gestures/GestureHost');
Expand Down
12 changes: 9 additions & 3 deletions packages/core/src/internal/touch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* @file touch.ts
* @input The gesture core: the arena, the recognizers and their geometry.
* Also the pan, the motion engine and math, and the touch-presentation,
* direction and focus helpers that Lab components read
* direction, focus and hit-area helpers that Lab components read
* @output `@astryxdesign/core/internal/touch`: the gesture core's primitives

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

* and the motion, touch-presentation, direction and focus modules for Lab
* components, re-exported by name
* and the motion, touch-presentation, direction, focus and hit-area
* modules for Lab components, re-exported by name
* @position An internal entry reserved for Astryx's own packages:
* undocumented, outside the public API and its compatibility promise
* (spec:AST-017 FR21), versioned in lockstep with Core, and allowed only in
Expand Down Expand Up @@ -107,3 +107,9 @@ export type {UseFingerScrollOptions} from '../gestures/useFingerScroll';
// coarse-pointer check.
export {getGestureHost} from '../gestures/GestureHost';
export {isCoarsePointer} from '../utils/coarsePointer';
// Lab's PageControl also reads an element's shared animator, the Reduce
// Motion cross-fade, and the touch hit area's hook and layer.
Comment on lines +110 to +111

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (INV29): this comment restates the four names below it in words. Keep only the reason:

// Lab's PageControl reads these.

export {animatorFor} from '../motion/animator';
export {reducedMotionFade} from '../motion/reducedMotion';
export {useTouchHitArea} from '../utils/touchHitArea';
export {touchHitAreaStyles} from '../utils/touchHitArea.stylex';
8 changes: 7 additions & 1 deletion scripts/touch-support-bundle.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ function exportsOf(entry) {
* screen-edge pan, the spring solver, the motion resolver, UIKit's
* navigation table and its four navigation springs. It also reads the focus
* helpers that follow the last input. Lab components that watch a finger's
* scroll read the finger-scroll watch.
* scroll read the finger-scroll watch. PageControl reads an element's shared
* animator, the Reduce Motion cross-fade, and the touch hit area's hook and
* layer.
*/
const LAB_ONLY_NAMES = [
'PanGestureRecognizer',
Expand Down Expand Up @@ -149,6 +151,10 @@ const LAB_ONLY_NAMES = [
'focusForLastInput',
'isFocusLost',
'useInteractionModalityTracking',
'animatorFor',
'reducedMotionFade',
'useTouchHitArea',
'touchHitAreaStyles',
];

/** The inputs matching `pattern` that put bytes in `bytes`. */
Expand Down
Loading