Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

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)

Christopher Chedeau6750b668838f
diff --git a/.changeset/core-internal-entries-page-control.md b/.changeset/core-internal-entries-page-control.md
new file mode 100644
index 0000000000..f6c12bf08f
--- /dev/null
+++ b/.changeset/core-internal-entries-page-control.md
@@ -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
diff --git a/packages/core/src/internal/touch.test.ts b/packages/core/src/internal/touch.test.ts
index c440bf8cb9..2e5233336b 100644
--- a/packages/core/src/internal/touch.test.ts
+++ b/packages/core/src/internal/touch.test.ts
@@ -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');
diff --git a/packages/core/src/internal/touch.ts b/packages/core/src/internal/touch.ts
index f4e8d2f3da..3b812d8ddd 100644
--- a/packages/core/src/internal/touch.ts
+++ b/packages/core/src/internal/touch.ts
@@ -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
- * 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
@@ -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.
+export {animatorFor} from '../motion/animator';
+export {reducedMotionFade} from '../motion/reducedMotion';
+export {useTouchHitArea} from '../utils/touchHitArea';
+export {touchHitAreaStyles} from '../utils/touchHitArea.stylex';
diff --git a/scripts/touch-support-bundle.test.mjs b/scripts/touch-support-bundle.test.mjs
index 8617cce829..04893260aa 100644
--- a/scripts/touch-support-bundle.test.mjs
+++ b/scripts/touch-support-bundle.test.mjs
@@ -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',
@@ -149,6 +151,10 @@ const LAB_ONLY_NAMES = [
'focusForLastInput',
'isFocusLost',
'useInteractionModalityTracking',
+ 'animatorFor',
+ 'reducedMotionFade',
+ 'useTouchHitArea',
+ 'touchHitAreaStyles',
];
/** The inputs matching `pattern` that put bytes in `bytes`. */