An open source design system that's fully customizable and agent ready
TypeScript
chore(core): Core's internal touch entry names, for Lab, the screen-edge pan, spring solver, motion resolver, UIKit navigation springs and focus helpers (#9696)
Christopher Chedeau539326657006
diff --git a/.changeset/core-internal-entries-lab-navigationstack.md b/.changeset/core-internal-entries-lab-navigationstack.mdnew file mode 100644index 0000000000..031c905564--- /dev/null+++ b/.changeset/core-internal-entries-lab-navigationstack.md@@ -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.++@vjeuxdiff --git a/packages/core/locales/en.json b/packages/core/locales/en.jsonindex 512a2f307f..61c99fd4bb 100644--- a/packages/core/locales/en.json+++ b/packages/core/locales/en.json@@ -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."}}diff --git a/packages/core/src/internal/touch.test.ts b/packages/core/src/internal/touch.test.tsindex 02e63f68e0..8c7d5dd507 100644--- a/packages/core/src/internal/touch.test.ts+++ b/packages/core/src/internal/touch.test.ts@@ -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');diff --git a/packages/core/src/internal/touch.ts b/packages/core/src/internal/touch.tsindex c46d3d5a83..7510fb184e 100644--- a/packages/core/src/internal/touch.ts+++ b/packages/core/src/internal/touch.ts@@ -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@@ -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';diff --git a/scripts/touch-support-bundle.test.mjs b/scripts/touch-support-bundle.test.mjsindex a7df56763c..994efc6214 100644--- a/scripts/touch-support-bundle.test.mjs+++ b/scripts/touch-support-bundle.test.mjs@@ -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',@@ -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`. */