From c3954ea3805253619d30542d4ae3bbfa2a8f0186 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sun, 1 Nov 2026 18:56:18 -0800 Subject: [PATCH] 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 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. --- .../core-internal-entries-page-control.md | 7 ++++++ packages/core/src/internal/touch.test.ts | 22 +++++++++++++++++++ packages/core/src/internal/touch.ts | 15 +++++++++---- scripts/touch-support-bundle.test.mjs | 8 ++++++- 4 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 .changeset/core-internal-entries-page-control.md diff --git a/.changeset/core-internal-entries-page-control.md b/.changeset/core-internal-entries-page-control.md new file mode 100644 index 0000000000000..f6c12bf08f3d2 --- /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 02e63f68e064a..fc335af3111a3 100644 --- a/packages/core/src/internal/touch.test.ts +++ b/packages/core/src/internal/touch.test.ts @@ -84,6 +84,28 @@ describe('internal/touch', () => { } }); + it("re-exports by name what Lab's PageControl also reads", async () => { + const entry: Record = 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('attaches no window or document listeners when it loads', async () => { vi.resetModules(); const onWindow = vi.spyOn(window, 'addEventListener'); diff --git a/packages/core/src/internal/touch.ts b/packages/core/src/internal/touch.ts index c46d3d5a8342e..910e44d33eb1c 100644 --- a/packages/core/src/internal/touch.ts +++ b/packages/core/src/internal/touch.ts @@ -3,11 +3,11 @@ /** * @file touch.ts * @input The gesture core: the arena, the recognizers, and their geometry; - * the pan, the motion engine and math, and the touch-presentation and - * direction helpers that Lab components read + * the pan, the motion engine and math, and the touch-presentation, + * direction and hit-area helpers that Lab components read * @output `@astryxdesign/core/internal/touch`: the gesture core's primitives - * and the motion, touch-presentation and direction modules for Lab - * components, re-exported by name + * and the motion, touch-presentation, direction 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 @@ -80,3 +80,10 @@ export {isRtlElement} from '../hooks/isRtlElement'; export {UIKIT_GESTURES} from '../motion/uikit/gestures'; export {useTouchPresentation} from '../utils/touchPresentation'; export {TOUCH_QUERY} from '../utils/touchQueries'; + +// 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 83963a726938b..7f26f52bd40c5 100644 --- a/scripts/touch-support-bundle.test.mjs +++ b/scripts/touch-support-bundle.test.mjs @@ -114,7 +114,9 @@ function exportsOf(entry) { * refresh pull reads the pan, its hook, the motion engine, its motion math and * companion curves, the scroll view's spring and the motion-role parsers. * Other Lab components read the UIKit gesture table, the touch presentation - * and its query, and an element's direction. + * and its query, and an element's direction. PageControl also 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', @@ -132,6 +134,10 @@ const LAB_ONLY_NAMES = [ 'UIKIT_GESTURES', 'useTouchPresentation', 'TOUCH_QUERY', + 'animatorFor', + 'reducedMotionFade', + 'useTouchHitArea', + 'touchHitAreaStyles', ]; /** The inputs matching `pattern` that put bytes in `bytes`. */