Skip to content

Commit c3954ea

Browse files
committed
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.
1 parent c26fcd5 commit c3954ea

4 files changed

Lines changed: 47 additions & 5 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/core': patch
3+
---
4+
5+
[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.
6+
7+
@vjeux

‎packages/core/src/internal/touch.test.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,28 @@ describe('internal/touch', () => {
8484
}
8585
});
8686

87+
it("re-exports by name what Lab's PageControl also reads", async () => {
88+
const entry: Record<string, unknown> = await import('./touch');
89+
const animator = await import('../motion/animator');
90+
const reduced = await import('../motion/reducedMotion');
91+
const hitArea = await import('../utils/touchHitArea');
92+
const hitAreaStyles = await import('../utils/touchHitArea.stylex');
93+
expect(entry.animatorFor).toBe(animator.animatorFor);
94+
expect(entry.reducedMotionFade).toBe(reduced.reducedMotionFade);
95+
expect(entry.useTouchHitArea).toBe(hitArea.useTouchHitArea);
96+
expect(entry.touchHitAreaStyles).toBe(hitAreaStyles.touchHitAreaStyles);
97+
// An identity check passes when both sides are undefined, so each name
98+
// must also be defined.
99+
for (const name of [
100+
'animatorFor',
101+
'reducedMotionFade',
102+
'useTouchHitArea',
103+
]) {
104+
expect(typeof entry[name], name).toBe('function');
105+
}
106+
expect(entry.touchHitAreaStyles).toBeDefined();
107+
});
108+
87109
it('attaches no window or document listeners when it loads', async () => {
88110
vi.resetModules();
89111
const onWindow = vi.spyOn(window, 'addEventListener');

‎packages/core/src/internal/touch.ts‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
/**
44
* @file touch.ts
55
* @input The gesture core: the arena, the recognizers, and their geometry;
6-
* the pan, the motion engine and math, and the touch-presentation and
7-
* direction helpers that Lab components read
6+
* the pan, the motion engine and math, and the touch-presentation,
7+
* direction and hit-area helpers that Lab components read
88
* @output `@astryxdesign/core/internal/touch`: the gesture core's primitives
9-
* and the motion, touch-presentation and direction modules for Lab
10-
* components, re-exported by name
9+
* and the motion, touch-presentation, direction and hit-area modules for
10+
* Lab components, re-exported by name
1111
* @position An internal entry reserved for Astryx's own packages:
1212
* undocumented, outside the public API and its compatibility promise
1313
* (spec:AST-017 FR21), versioned in lockstep with Core, and allowed only in
@@ -80,3 +80,10 @@ export {isRtlElement} from '../hooks/isRtlElement';
8080
export {UIKIT_GESTURES} from '../motion/uikit/gestures';
8181
export {useTouchPresentation} from '../utils/touchPresentation';
8282
export {TOUCH_QUERY} from '../utils/touchQueries';
83+
84+
// Lab's PageControl also reads an element's shared animator, the Reduce
85+
// Motion cross-fade, and the touch hit area's hook and layer.
86+
export {animatorFor} from '../motion/animator';
87+
export {reducedMotionFade} from '../motion/reducedMotion';
88+
export {useTouchHitArea} from '../utils/touchHitArea';
89+
export {touchHitAreaStyles} from '../utils/touchHitArea.stylex';

‎scripts/touch-support-bundle.test.mjs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ function exportsOf(entry) {
114114
* refresh pull reads the pan, its hook, the motion engine, its motion math and
115115
* companion curves, the scroll view's spring and the motion-role parsers.
116116
* Other Lab components read the UIKit gesture table, the touch presentation
117-
* and its query, and an element's direction.
117+
* and its query, and an element's direction. PageControl also reads an
118+
* element's shared animator, the Reduce Motion cross-fade, and the touch hit
119+
* area's hook and layer.
118120
*/
119121
const LAB_ONLY_NAMES = [
120122
'PanGestureRecognizer',
@@ -132,6 +134,10 @@ const LAB_ONLY_NAMES = [
132134
'UIKIT_GESTURES',
133135
'useTouchPresentation',
134136
'TOUCH_QUERY',
137+
'animatorFor',
138+
'reducedMotionFade',
139+
'useTouchHitArea',
140+
'touchHitAreaStyles',
135141
];
136142

137143
/** The inputs matching `pattern` that put bytes in `bytes`. */

0 commit comments

Comments
 (0)