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-lab-navigationstack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch
---

[chore] Internal: Core's internal touch entry also names, for Lab, the screen-edge pan recognizer, the spring solver, the motion resolver, UIKit's navigation table and four navigation springs, and the focus helpers that follow the last input. Core's English catalog gains `@astryx.navigationStack.back`. Apps import nothing new.

@vjeux
4 changes: 4 additions & 0 deletions packages/core/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2446,5 +2446,9 @@
"@astryx.infoTip.label": {
"defaultMessage": "More information",
"description": "Default accessible name of an InfoTip, the small info-icon button whose press reveals help about the label, value, or metric beside it."
},
"@astryx.navigationStack.back": {
"defaultMessage": "Back",
"description": "Label of the back button in a lab NavigationStack's bar when the screen it returns to has no title of its own. Returns to the previous screen; keep it short, as on an iOS navigation bar."
}
}
46 changes: 46 additions & 0 deletions packages/core/src/internal/touch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,52 @@ describe('internal/touch', () => {
}
});

it("re-exports by name what Lab's NavigationStack reads", async () => {
const entry: Record<string, unknown> = await import('./touch');
const edgePan = await import('../gestures/ScreenEdgePanGestureRecognizer');
const resolver = await import('../motion/resolveMotion');
const spring = await import('../motion/spring');
const uikitNavigation = await import('../motion/uikit/navigation');
const uikitSprings = await import('../motion/uikit/springs');
const focusReturn = await import('../utils/focusReturn');
const modality = await import('../utils/interactionModality');
expect(entry.ScreenEdgePanGestureRecognizer).toBe(
edgePan.ScreenEdgePanGestureRecognizer,
);
expect(entry.resolveMotion).toBe(resolver.resolveMotion);
expect(entry.solveSpring).toBe(spring.solveSpring);
expect(entry.toSpring).toBe(spring.toSpring);
expect(entry.navigation).toBe(uikitNavigation.navigation);
for (const name of [
'NAVIGATION_PUSH_SPRING',
'NAVIGATION_POP_SPRING',
'NAVIGATION_INTERACTIVE_POP_FINISH_SPRING',
'NAVIGATION_BAR_ELEMENTS_SPRING',
] as const) {
expect(entry[name], name).toBe(uikitSprings[name]);
expect(entry[name], name).toBeDefined();
}
// Only the navigation rows: the whole springs table stays out.
expect(entry).not.toHaveProperty('springs');
expect(entry.focusForLastInput).toBe(focusReturn.focusForLastInput);
expect(entry.isFocusLost).toBe(focusReturn.isFocusLost);
expect(entry.useInteractionModalityTracking).toBe(
modality.useInteractionModalityTracking,
);
for (const name of [
'ScreenEdgePanGestureRecognizer',
'resolveMotion',
'solveSpring',
'toSpring',
'focusForLastInput',
'isFocusLost',
'useInteractionModalityTracking',
]) {
expect(typeof entry[name], name).toBe('function');
}
expect(entry.navigation).toBeDefined();
});

it('attaches no window or document listeners when it loads', async () => {
vi.resetModules();
const onWindow = vi.spyOn(window, 'addEventListener');
Expand Down
23 changes: 19 additions & 4 deletions packages/core/src/internal/touch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,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
* @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
* @output `@astryxdesign/core/internal/touch`: the gesture core's primitives
* and the motion, touch-presentation and direction modules for Lab
* and the motion, touch-presentation, direction and focus 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
Expand Down Expand Up @@ -80,3 +80,18 @@ 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 NavigationStack reads these.
export {ScreenEdgePanGestureRecognizer} from '../gestures/ScreenEdgePanGestureRecognizer';
export {resolveMotion} from '../motion/resolveMotion';
export {solveSpring, toSpring} from '../motion/spring';
export type {SpringDescription} from '../motion/spring';
export {navigation} from '../motion/uikit/navigation';
export {
NAVIGATION_BAR_ELEMENTS_SPRING,
NAVIGATION_INTERACTIVE_POP_FINISH_SPRING,
NAVIGATION_POP_SPRING,
NAVIGATION_PUSH_SPRING,
} from '../motion/uikit/springs';
export {focusForLastInput, isFocusLost} from '../utils/focusReturn';
export {useInteractionModalityTracking} from '../utils/interactionModality';
17 changes: 16 additions & 1 deletion scripts/touch-support-bundle.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ 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. Lab's NavigationStack reads the
* 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.
*/
const LAB_ONLY_NAMES = [
'PanGestureRecognizer',
Expand All @@ -132,6 +135,18 @@ const LAB_ONLY_NAMES = [
'UIKIT_GESTURES',
'useTouchPresentation',
'TOUCH_QUERY',
'ScreenEdgePanGestureRecognizer',
'resolveMotion',
'solveSpring',
'toSpring',
'navigation',
'NAVIGATION_PUSH_SPRING',
'NAVIGATION_POP_SPRING',
'NAVIGATION_INTERACTIVE_POP_FINISH_SPRING',
'NAVIGATION_BAR_ELEMENTS_SPRING',
'focusForLastInput',
'isFocusLost',
'useInteractionModalityTracking',
];

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