@astryxdesign/core 0.7.6 → 0.7.7-canary.0eb44a2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +23 -3
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +1 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +16 -9
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +2 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +3 -2
- package/dist/Chat/ChatComposerInput.d.ts +9 -0
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +2 -0
- package/dist/Chat/ChatMessage.js +2 -2
- package/dist/Chat/chatMessage.vars.stylex.d.ts +8 -8
- package/dist/Chat/chatMessage.vars.stylex.js +8 -8
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +8 -1
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +72 -2
- package/dist/DateInput/Wheel.d.ts +17 -1
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +179 -19
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +63 -49
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +37 -1
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +6 -0
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
- package/dist/Drawer/useDrawerDialogPresence.js +4 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +20 -4
- package/dist/DropdownMenu/useMenuOverflow.d.ts +13 -3
- package/dist/DropdownMenu/useMenuOverflow.d.ts.map +1 -1
- package/dist/DropdownMenu/useMenuOverflow.js +31 -8
- package/dist/Field/PanelSearchInput.d.ts.map +1 -1
- package/dist/Field/PanelSearchInput.js +8 -1
- package/dist/Field/textEntryTraits.d.ts +6 -6
- package/dist/Field/textEntryTraits.js +6 -6
- package/dist/Layer/layerClickBoundary.d.ts +7 -1
- package/dist/Layer/layerClickBoundary.d.ts.map +1 -1
- package/dist/Layer/layerClickBoundary.js +2 -2
- package/dist/Layer/usePressPin.d.ts +95 -0
- package/dist/Layer/usePressPin.d.ts.map +1 -0
- package/dist/Layer/usePressPin.js +365 -0
- package/dist/Layer/useTouchTrigger.d.ts +23 -1
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +45 -7
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +2 -1
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +1 -0
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +56 -7
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +38 -30
- package/dist/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +52 -14
- package/dist/ProgressBar/ProgressBarTouch.d.ts +29 -0
- package/dist/ProgressBar/ProgressBarTouch.d.ts.map +1 -0
- package/dist/ProgressBar/ProgressBarTouch.js +91 -0
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +2 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +25 -13
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +404 -131
- package/dist/Slider/sliderTouchController.d.ts +189 -0
- package/dist/Slider/sliderTouchController.d.ts.map +1 -0
- package/dist/Slider/sliderTouchController.js +1017 -0
- package/dist/Slider/useSliderTouch.d.ts +22 -0
- package/dist/Slider/useSliderTouch.d.ts.map +1 -0
- package/dist/Slider/useSliderTouch.js +56 -0
- package/dist/Switch/Switch.d.ts +1 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +200 -46
- package/dist/Switch/switchFill.d.ts +31 -0
- package/dist/Switch/switchFill.d.ts.map +1 -0
- package/dist/Switch/switchFill.js +88 -0
- package/dist/Switch/switchTouch.d.ts +81 -0
- package/dist/Switch/switchTouch.d.ts.map +1 -0
- package/dist/Switch/switchTouch.js +133 -0
- package/dist/Switch/useSwitchTouch.d.ts +285 -0
- package/dist/Switch/useSwitchTouch.d.ts.map +1 -0
- package/dist/Switch/useSwitchTouch.js +998 -0
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +4 -3
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +12 -5
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts +3 -0
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts.map +1 -0
- package/dist/Tokenizer/TokenizerItemRemovableContext.js +17 -0
- package/dist/Tooltip/Tooltip.d.ts +30 -6
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +5 -0
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +31 -5
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +59 -18
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +19 -9
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +26 -15
- package/dist/astryx.css +91 -8
- package/dist/gestures/GestureArena.d.ts +21 -2
- package/dist/gestures/GestureArena.d.ts.map +1 -1
- package/dist/gestures/GestureArena.js +23 -3
- package/dist/gestures/GestureHost.d.ts +123 -3
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +797 -15
- package/dist/gestures/GestureRecognizer.d.ts +15 -1
- package/dist/gestures/GestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/GestureRecognizer.js +12 -0
- package/dist/gestures/PanGestureRecognizer.d.ts +8 -0
- package/dist/gestures/PanGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/PinchGestureRecognizer.d.ts +5 -1
- package/dist/gestures/PinchGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/PinchGestureRecognizer.js +10 -0
- package/dist/gestures/PressTracker.d.ts +6 -0
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +3 -0
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts +3 -3
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/ScreenEdgePanGestureRecognizer.js +7 -5
- package/dist/gestures/nativeScroll.d.ts +16 -2
- package/dist/gestures/nativeScroll.d.ts.map +1 -1
- package/dist/gestures/nativeScroll.js +39 -8
- package/dist/gestures/recognizerInternals.d.ts +4 -2
- package/dist/gestures/recognizerInternals.d.ts.map +1 -1
- package/dist/gestures/types.d.ts +17 -0
- package/dist/gestures/types.d.ts.map +1 -1
- package/dist/gestures/types.js +7 -0
- package/dist/gestures/usePressTracker.d.ts.map +1 -1
- package/dist/gestures/usePressTracker.js +1 -0
- package/dist/gestures/wheelSegmenter.d.ts +56 -0
- package/dist/gestures/wheelSegmenter.d.ts.map +1 -0
- package/dist/gestures/wheelSegmenter.js +122 -0
- package/dist/hooks/useAttachment.d.ts +16 -8
- package/dist/hooks/useAttachment.d.ts.map +1 -1
- package/dist/hooks/useAttachment.js +35 -15
- package/dist/hooks/useFocusTrap.d.ts +15 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +13 -2
- package/dist/hooks/usePager.d.ts +261 -0
- package/dist/hooks/usePager.d.ts.map +1 -0
- package/dist/hooks/usePager.js +1169 -0
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +140 -19
- package/dist/motion/paging.d.ts +69 -0
- package/dist/motion/paging.d.ts.map +1 -0
- package/dist/motion/paging.js +148 -0
- package/dist/motion/uikit/index.d.ts +8 -4
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +8 -4
- package/dist/motion/uikit/paging.d.ts +171 -0
- package/dist/motion/uikit/paging.d.ts.map +1 -0
- package/dist/motion/uikit/paging.js +192 -0
- package/dist/motion/uikit/progressBar.d.ts +79 -0
- package/dist/motion/uikit/progressBar.d.ts.map +1 -0
- package/dist/motion/uikit/progressBar.js +102 -0
- package/dist/motion/uikit/scroll.d.ts +0 -19
- package/dist/motion/uikit/scroll.d.ts.map +1 -1
- package/dist/motion/uikit/scroll.js +2 -21
- package/dist/motion/uikit/slider.d.ts +97 -0
- package/dist/motion/uikit/slider.d.ts.map +1 -0
- package/dist/motion/uikit/slider.js +111 -0
- package/dist/motion/uikit/springs.d.ts +59 -30
- package/dist/motion/uikit/springs.d.ts.map +1 -1
- package/dist/motion/uikit/springs.js +64 -34
- package/dist/motion/uikit/switch.d.ts +166 -0
- package/dist/motion/uikit/switch.d.ts.map +1 -0
- package/dist/motion/uikit/switch.js +186 -0
- package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts +18 -0
- package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/pressHoldsDrag.stylex.js +28 -0
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +5 -0
- package/dist/utils/selectionLock.d.ts +43 -0
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +394 -6
- package/package.json +5 -5
- package/src/AppShell/AppShell.doc.mjs +10 -0
- package/src/AppShell/AppShell.tsx +48 -2
- package/src/Avatar/Avatar.tsx +3 -1
- package/src/BottomSheet/BottomSheetPanel.tsx +16 -9
- package/src/Breadcrumbs/BreadcrumbItem.tsx +4 -1
- package/src/Button/Button.tsx +3 -2
- package/src/Chat/Chat.doc.mjs +1 -0
- package/src/Chat/ChatComposerInput.doc.mjs +11 -0
- package/src/Chat/ChatComposerInput.tsx +11 -0
- package/src/Chat/ChatMessage.tsx +2 -2
- package/src/Chat/chatMessage.vars.stylex.ts +8 -8
- package/src/CommandPalette/CommandPaletteInput.tsx +6 -0
- package/src/DateInput/MonthScroller.tsx +63 -5
- package/src/DateInput/Wheel.tsx +174 -14
- package/src/DateRangeInput/DateRangeInput.doc.mjs +3 -2
- package/src/DateRangeInput/DateRangeInput.tsx +117 -71
- package/src/Dialog/Dialog.tsx +37 -1
- package/src/Drawer/Drawer.tsx +6 -0
- package/src/Drawer/useDrawerDialogPresence.ts +4 -0
- package/src/DropdownMenu/DropdownMenu.tsx +28 -6
- package/src/DropdownMenu/useMenuOverflow.ts +44 -8
- package/src/Field/PanelSearchInput.tsx +6 -0
- package/src/Field/textEntryTraits.ts +6 -6
- package/src/Layer/layerClickBoundary.ts +2 -2
- package/src/Layer/usePressPin.ts +516 -0
- package/src/Layer/useTouchTrigger.ts +56 -6
- package/src/Lightbox/Lightbox.tsx +2 -1
- package/src/Link/Link.tsx +3 -0
- package/src/Popover/usePopover.tsx +71 -9
- package/src/PowerSearch/PowerSearch.tsx +38 -31
- package/src/ProgressBar/ProgressBar.doc.mjs +7 -5
- package/src/ProgressBar/ProgressBar.tsx +147 -16
- package/src/ProgressBar/ProgressBarTouch.ts +109 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +2 -1
- package/src/Selector/Selector.tsx +29 -2
- package/src/Slider/Slider.doc.mjs +11 -7
- package/src/Slider/Slider.tsx +539 -132
- package/src/Slider/sliderTouchController.ts +1209 -0
- package/src/Slider/useSliderTouch.ts +78 -0
- package/src/Switch/Switch.doc.mjs +3 -3
- package/src/Switch/Switch.tsx +412 -86
- package/src/Switch/switchFill.ts +106 -0
- package/src/Switch/switchTouch.ts +194 -0
- package/src/Switch/useSwitchTouch.ts +1121 -0
- package/src/TabList/Tab.tsx +5 -3
- package/src/Tokenizer/Tokenizer.tsx +15 -5
- package/src/Tokenizer/TokenizerItemRemovableContext.ts +22 -0
- package/src/Tooltip/Tooltip.doc.mjs +21 -6
- package/src/Tooltip/Tooltip.tsx +42 -5
- package/src/Tooltip/index.ts +1 -0
- package/src/Tooltip/useTooltip.doc.mjs +4 -2
- package/src/Tooltip/useTooltip.tsx +84 -21
- package/src/Typeahead/BaseTypeahead.tsx +16 -8
- package/src/Typeahead/Typeahead.tsx +29 -15
- package/src/gestures/GestureArena.ts +45 -4
- package/src/gestures/GestureHost.ts +958 -15
- package/src/gestures/GestureRecognizer.ts +28 -0
- package/src/gestures/PanGestureRecognizer.ts +8 -0
- package/src/gestures/PinchGestureRecognizer.ts +16 -1
- package/src/gestures/PressTracker.ts +10 -0
- package/src/gestures/README.md +82 -3
- package/src/gestures/ScreenEdgePanGestureRecognizer.ts +7 -5
- package/src/gestures/nativeScroll.ts +49 -9
- package/src/gestures/recognizerInternals.ts +9 -2
- package/src/gestures/types.ts +18 -0
- package/src/gestures/usePressTracker.ts +2 -0
- package/src/gestures/wheelSegmenter.ts +143 -0
- package/src/hooks/useAttachment.ts +56 -14
- package/src/hooks/useFocusTrap.ts +26 -2
- package/src/hooks/usePager.ts +1446 -0
- package/src/motion/MEASUREMENTS.md +36 -27
- package/src/motion/README.md +7 -3
- package/src/motion/animator.ts +193 -25
- package/src/motion/paging.ts +161 -0
- package/src/motion/uikit/index.ts +7 -4
- package/src/motion/uikit/paging.ts +193 -0
- package/src/motion/uikit/progressBar.ts +102 -0
- package/src/motion/uikit/scroll.ts +2 -18
- package/src/motion/uikit/slider.ts +105 -0
- package/src/motion/uikit/springs.ts +53 -32
- package/src/motion/uikit/switch.ts +174 -0
- package/src/privateAttributes/pressHoldsDrag.stylex.ts +28 -0
- package/src/utils/pressFeedback.ts +5 -0
- package/src/utils/selectionLock.ts +501 -6
- package/dist/motion/selectPage.d.ts +0 -26
- package/dist/motion/selectPage.d.ts.map +0 -1
- package/dist/motion/selectPage.js +0 -55
- package/src/motion/selectPage.ts +0 -55
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* @file index.ts
|
|
5
5
|
* @input The domain files of the UIKit constants table
|
|
6
6
|
* @output Re-exports `springs` and one constant per spring (`SHEET_PRESENT_SPRING`,
|
|
7
|
-
* …), `scroll`, `timing`, `navigation` and
|
|
8
|
-
*
|
|
9
|
-
* `UIKIT_GESTURES`, and the
|
|
7
|
+
* …), `scroll`, `timing`, `navigation`, `progressBar`, the `slider` and
|
|
8
|
+
* switch (`switchControl`) domains, and the gesture thresholds (one
|
|
9
|
+
* `UIKIT_*` group per recognizer, their union `UIKIT_GESTURES`, and the
|
|
10
|
+
* haptic tables)
|
|
10
11
|
* @position Entry of the UIKit constants table (motion/uikit). Internal to
|
|
11
12
|
* core: not exported from the package entry point
|
|
12
13
|
*
|
|
@@ -39,7 +40,9 @@ export {
|
|
|
39
40
|
type HapticFeedbackKind,
|
|
40
41
|
} from './gestures';
|
|
41
42
|
export {navigation, registerNavigationTable} from './navigation';
|
|
43
|
+
export {progressBar, registerProgressBarTable} from './progressBar';
|
|
42
44
|
export {registerScrollTable, scroll} from './scroll';
|
|
45
|
+
export {slider} from './slider';
|
|
43
46
|
export {
|
|
44
47
|
ACTION_SHEET_DISMISS_SPRING,
|
|
45
48
|
ACTION_SHEET_PRESENT_SPRING,
|
|
@@ -72,10 +75,10 @@ export {
|
|
|
72
75
|
SUB_MENU_BACK_SPRING,
|
|
73
76
|
SUB_MENU_OPEN_SPRING,
|
|
74
77
|
SWITCH_THUMB_MOVE_SPRING,
|
|
75
|
-
SWITCH_THUMB_STRETCH_SPRING,
|
|
76
78
|
TIMED_CHANGE_SPRING,
|
|
77
79
|
VIEW_CHANGE_SPRING,
|
|
78
80
|
registerSpringsTable,
|
|
79
81
|
springs,
|
|
80
82
|
} from './springs';
|
|
83
|
+
export {switchControl} from './switch';
|
|
81
84
|
export {registerTimingTable, timing} from './timing';
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file paging.ts
|
|
5
|
+
* @input Nothing; data only
|
|
6
|
+
* @output Exports `paging`, the measured constants of a paging UIScrollView,
|
|
7
|
+
* and `registerPagingTable`, which registers them with the motion registry
|
|
8
|
+
* @position The paging domain of the UIKit constants table (motion/uikit). Only
|
|
9
|
+
* core reads it, so the `uikit` namespace does not re-export it
|
|
10
|
+
*
|
|
11
|
+
* SYNC: When modified, update:
|
|
12
|
+
* - /packages/core/src/motion/MEASUREMENTS.md (measurement tasks)
|
|
13
|
+
* - /packages/core/src/motion/paging.ts and paging.test.ts
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import {registerMotionTable} from '../roles';
|
|
17
|
+
|
|
18
|
+
export const paging = {
|
|
19
|
+
/**
|
|
20
|
+
* After the lift, one model moves the content: the settle onto the chosen
|
|
21
|
+
* page and the return from an overscroll. Each display frame runs floor(frame
|
|
22
|
+
* interval in ms) steps of 1 ms:
|
|
23
|
+
*
|
|
24
|
+
* v = (v + (target − x) · springPull) · friction; x += v (v: pt per step)
|
|
25
|
+
*
|
|
26
|
+
* A 60 Hz frame runs 16 steps, not 16.67. With these values, the model
|
|
27
|
+
* replays eight captured releases to 0.20 pt RMS. It replays five overscroll
|
|
28
|
+
* returns to 0.16–0.33 pt RMS (402 pt pages, iOS 26.2, 3× screen). Without
|
|
29
|
+
* the floor, the error is 1.0 pt RMS, with a systematic shape.
|
|
30
|
+
*/
|
|
31
|
+
integrator: {
|
|
32
|
+
/**
|
|
33
|
+
* Velocity added per 1 ms step, per point of distance to the target page
|
|
34
|
+
* (pt per step²).
|
|
35
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, Oct 23 2026.
|
|
36
|
+
* `_pagingSpringPull` reads the same on a 402 pt paging UIScrollView and
|
|
37
|
+
* on UIPageViewController's scroll view. It replays 8 captured settles to
|
|
38
|
+
* 0.20 pt RMS.
|
|
39
|
+
*/
|
|
40
|
+
springPull: 0.000284858,
|
|
41
|
+
/**
|
|
42
|
+
* Velocity kept per step after the pull (`_pagingFriction`, equal to
|
|
43
|
+
* `_defaultPagingFriction`).
|
|
44
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, Oct 23 2026. Both read
|
|
45
|
+
* the same on the two scroll views of `springPull`, and they replay with
|
|
46
|
+
* it.
|
|
47
|
+
*/
|
|
48
|
+
friction: 0.970815,
|
|
49
|
+
/**
|
|
50
|
+
* Integration steps per second: floor(16.67 ms) = 16 steps per 60 Hz frame,
|
|
51
|
+
* and floor(8.33 ms) = 8 per 120 Hz frame, so 960.
|
|
52
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, Oct 23 2026. In a 60 fps
|
|
53
|
+
* log of 8 releases at rest, floored stepping fits to 0.20 pt RMS.
|
|
54
|
+
* Unfloored stepping fits to 1.0 pt RMS.
|
|
55
|
+
*/
|
|
56
|
+
stepsPerSecond: 960,
|
|
57
|
+
/**
|
|
58
|
+
* A settle ends exactly on the page once the remaining distance is below
|
|
59
|
+
* this many points and the step velocity is below `restSpeed`.
|
|
60
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, Oct 23 2026. The
|
|
61
|
+
* captured settles jump the last 0.33 pt onto the page about 0.35 s after
|
|
62
|
+
* a release at rest.
|
|
63
|
+
*/
|
|
64
|
+
restDistance: 0.5,
|
|
65
|
+
/**
|
|
66
|
+
* Step velocity (pt per step) below which a settle may end.
|
|
67
|
+
* @source GUESS — the captured settles end at about 0.04 pt per step;
|
|
68
|
+
* the threshold is not observable more finely at 60 fps
|
|
69
|
+
* @measure M-PG12
|
|
70
|
+
*/
|
|
71
|
+
restSpeed: 0.05,
|
|
72
|
+
},
|
|
73
|
+
release: {
|
|
74
|
+
/**
|
|
75
|
+
* Released slower than `advanceSpeed`, the scroll view settles on the page
|
|
76
|
+
* nearest the content position: past half a page, the next one. The pager
|
|
77
|
+
* keeps the start page instead for a release that moves back toward it.
|
|
78
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, Oct 23 2026. In releases
|
|
79
|
+
* at rest from page 1, content at 48.5 % of the page stays, and 57.5 %
|
|
80
|
+
* goes to the next page. On a second 402 pt pager, 45 % stays and 55 %
|
|
81
|
+
* advances.
|
|
82
|
+
*/
|
|
83
|
+
commitFraction: 0.5,
|
|
84
|
+
/**
|
|
85
|
+
* Released at least this fast (pt/s), the scroll view pages in the
|
|
86
|
+
* direction of the velocity, from any content position. A flick from 6 % of
|
|
87
|
+
* the page advances. The speed is UIPanGestureRecognizer's velocity at the
|
|
88
|
+
* last movement, and it never decays. The scroll view's
|
|
89
|
+
* `_horizontalVelocity` equals it at every sample. A drag held still for
|
|
90
|
+
* 397 ms before the lift still pages at the speed it had.
|
|
91
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, Oct 23 2026. Steady
|
|
92
|
+
* releases at 10, 25 and 40 % of a 402 pt page: 292.7, 295.3 and 298.6
|
|
93
|
+
* pt/s stay; 310.7, 316.4 and 329.9 advance. The result is the same at
|
|
94
|
+
* every position: a threshold, not a projection.
|
|
95
|
+
*/
|
|
96
|
+
advanceSpeed: 300,
|
|
97
|
+
/**
|
|
98
|
+
* A settle velocity slower than this (pt/s) is zeroed, so the settle starts
|
|
99
|
+
* at rest. It is paging's own tuning on the one release velocity that every
|
|
100
|
+
* gesture reads.
|
|
101
|
+
* @source GUESS — the middle of the measured (200, 249] bracket. In the
|
|
102
|
+
* UIKit lab (iOS 26.2 simulator, Oct 23 2026),
|
|
103
|
+
* `scrollViewWillEndDragging` reads 0 for steady releases at 175 and 200
|
|
104
|
+
* pt/s. It reads 0.249 pt/ms for a release at 249 pt/s.
|
|
105
|
+
* @measure M-PG13
|
|
106
|
+
*/
|
|
107
|
+
velocityFloor: 225,
|
|
108
|
+
/**
|
|
109
|
+
* Pages a release may travel from the page the drag started on, at any
|
|
110
|
+
* speed and drag distance.
|
|
111
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, Oct 23 2026. A drag of
|
|
112
|
+
* 1.5 pages from page 1 lands on page 2 at release speeds of 0, 600 and
|
|
113
|
+
* 3000 pt/s.
|
|
114
|
+
*/
|
|
115
|
+
maxPagesFromStart: 1,
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* A finger that lands on a settling pager does not stop it at once. The
|
|
119
|
+
* settle runs on for about this long, then the content holds under the
|
|
120
|
+
* finger. Lifted without a move, the content settles again on the nearest
|
|
121
|
+
* page.
|
|
122
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, Oct 23 2026. After
|
|
123
|
+
* touch-downs 60 and 160 ms into a settle, the content moved on for 82.6
|
|
124
|
+
* and 87.5 ms (5 frames), then held.
|
|
125
|
+
*/
|
|
126
|
+
catchStopMs: 85,
|
|
127
|
+
/**
|
|
128
|
+
* In a sheet, a horizontal pager's pan begins only for a drag within atan(1 ÷
|
|
129
|
+
* this) of horizontal (26.6° for 2). A steeper drag goes to the sheet.
|
|
130
|
+
* Between 26.6° and 45°, neither moves.
|
|
131
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, Oct 23 2026. A scroll
|
|
132
|
+
* view's directional lock holds the major axis up to 25° and frees it from
|
|
133
|
+
* 30°. An inline calendar pager in a sheet pages at 20° from horizontal. At
|
|
134
|
+
* 35° and 45°, it moves neither itself nor the sheet, and it leaves 55° to
|
|
135
|
+
* the sheet.
|
|
136
|
+
*/
|
|
137
|
+
panAxisRatio: 2,
|
|
138
|
+
/**
|
|
139
|
+
* Inside a vertical scroll view, exactly one of the pager and the scroll view
|
|
140
|
+
* takes a drag, decided once by its dominant axis. The pager takes it when
|
|
141
|
+
* |dx| ≥ this × |dy|, 45° and the tie included. The scroll view takes any
|
|
142
|
+
* other drag.
|
|
143
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, Oct 24 2026. A 402 × 300
|
|
144
|
+
* paging view sits in a full-screen vertical scroll view, with 150 pt drags
|
|
145
|
+
* at 0–90°. The pager takes 0–45°, and the page takes 50–90°. At 35°, the
|
|
146
|
+
* outer view stays at 0 through 86 pt of vertical travel. The choice
|
|
147
|
+
* happens at 10–15 pt of travel.
|
|
148
|
+
*/
|
|
149
|
+
nestedPanAxisRatio: 1,
|
|
150
|
+
animatedScroll: {
|
|
151
|
+
/**
|
|
152
|
+
* `setContentOffset(_:animated:)` duration in milliseconds. It is the same
|
|
153
|
+
* for one page and for five, as for a page control's tap.
|
|
154
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, Oct 23 2026.
|
|
155
|
+
* `_contentOffsetAnimationDuration` reads 0.3, and five animated moves of
|
|
156
|
+
* 1 to 5 pages each last 0.30 s.
|
|
157
|
+
*/
|
|
158
|
+
durationMs: 300,
|
|
159
|
+
/**
|
|
160
|
+
* Its curve is a sinusoidal ease-in-out: x = from + (to − from) · (1 − cos
|
|
161
|
+
* πu) ÷ 2, for u = t ÷ duration. This cubic bézier matches it to 0.02 % of
|
|
162
|
+
* the distance (0.09 pt over a 402 pt page).
|
|
163
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, Oct 23 2026. The five
|
|
164
|
+
* moves fit the sinusoid to 0.14–0.51 pt RMS, and a 2010 pt move fits to
|
|
165
|
+
* 0.20 pt. The curve easeInEaseOut (0.42, 0, 0.58, 1) misses by 7.7 pt.
|
|
166
|
+
*/
|
|
167
|
+
curve: [0.364212, 0, 0.635788, 1],
|
|
168
|
+
},
|
|
169
|
+
/**
|
|
170
|
+
* Past the first or last page, the content follows the finger through the
|
|
171
|
+
* scroll view's rubber band (scroll.rubberBand.coefficient), with d = the
|
|
172
|
+
* page width. It returns on the integrator above.
|
|
173
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, Oct 23 2026. A pan of 90
|
|
174
|
+
* pt past page 0 shows 42.7–45 pt, and 290 pt shows 114.3 pt. The formula
|
|
175
|
+
* gives 44.1 and 114.2, with c 0.55 and d 402. The return replays on the
|
|
176
|
+
* integrator to 0.16–0.33 pt RMS.
|
|
177
|
+
*/
|
|
178
|
+
rubberBandDimension: 'pageWidth',
|
|
179
|
+
} as const;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Registers this table with the motion registry (motion/roles.ts). The pager
|
|
183
|
+
* then reads `setContentOffset(_:animated:)`'s duration and curve through
|
|
184
|
+
* `resolveMotion`, as it reads every touch motion. The table lists no role,
|
|
185
|
+
* because no motion role names any of its values, so each plays as measured.
|
|
186
|
+
* Nothing registers on import, and a second call does nothing.
|
|
187
|
+
*/
|
|
188
|
+
export function registerPagingTable(): void {
|
|
189
|
+
registerMotionTable('paging', paging, {
|
|
190
|
+
// Who gets the touch, not how anything moves.
|
|
191
|
+
exclude: ['catchStopMs'],
|
|
192
|
+
});
|
|
193
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file progressBar.ts
|
|
5
|
+
* @input Nothing: data only
|
|
6
|
+
* @output Exports `progressBar` (UIProgressView's fill: the whole-track
|
|
7
|
+
* duration and curve, its minimum length and its empty alpha; and the
|
|
8
|
+
* reduced-motion pulse) and `registerProgressBarTable`
|
|
9
|
+
* @position ProgressBar's rows of the UIKit constants table (motion/uikit).
|
|
10
|
+
* Lengths are in pt (CSS px), durations in ms, alphas in 0..1. Tests check
|
|
11
|
+
* each leaf's `@source`, and each GUESS's `@measure`.
|
|
12
|
+
*
|
|
13
|
+
* SYNC: When modified, update
|
|
14
|
+
* /packages/core/src/ProgressBar/ProgressBarTouch.ts and
|
|
15
|
+
* /packages/core/src/ProgressBar/ProgressBar.test.tsx.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import {registerMotionTable} from '../roles';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* UIProgressView's values, for ProgressBar. Three values are motion roles in
|
|
22
|
+
* the generated motion role table: the whole-track duration,
|
|
23
|
+
* `progress.fillTrackMs`, its curve, `progress.curves.fill`, and the
|
|
24
|
+
* reduced-motion pulse, `progress.reducedMotionPulseMs`. Every other value is
|
|
25
|
+
* an internal constant.
|
|
26
|
+
*/
|
|
27
|
+
export const progressBar = {
|
|
28
|
+
/**
|
|
29
|
+
* setProgress(_:animated: true) runs this long for a change of the whole
|
|
30
|
+
* track (0 → 1). A smaller change runs in proportion, measured on the model
|
|
31
|
+
* values: 0.2 → 0.8 takes 0.6 s. A retargeted fill starts from wherever it
|
|
32
|
+
* is drawn.
|
|
33
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
34
|
+
* iPhone 17 Pro, UIView animation on the fill's frame (duration,
|
|
35
|
+
* beginFromCurrentState) for jumps of 0.6, 0.4 and 0.6, Oct 23 2026
|
|
36
|
+
*/
|
|
37
|
+
fillTrackMs: 1000,
|
|
38
|
+
curves: {
|
|
39
|
+
/**
|
|
40
|
+
* That animation's curve: linear, and Reduce Motion leaves it unchanged.
|
|
41
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
42
|
+
* iPhone 17 Pro, the fill's position animation (timing function
|
|
43
|
+
* linear), with Reduce Motion off and on, Oct 23 2026
|
|
44
|
+
*/
|
|
45
|
+
fill: [0, 0, 1, 1],
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Under reduced motion the indeterminate fill stops travelling and pulses
|
|
49
|
+
* its opacity in place. Each way takes this long, on the `timing.curves.move`
|
|
50
|
+
* curve. A busy loop, so tempo does not scale it.
|
|
51
|
+
* @source GUESS — An owner value, not a UIKit number. iOS Safari pulses its
|
|
52
|
+
* indeterminate bar for 1 s between 0.30 and 0.60 opacity. ProgressBar
|
|
53
|
+
* pulses slower, at a floor that keeps the bar visible.
|
|
54
|
+
* @measure M-PB1
|
|
55
|
+
*/
|
|
56
|
+
reducedMotionPulseMs: 2000,
|
|
57
|
+
/**
|
|
58
|
+
* That pulse's lowest opacity. It is the lowest at which every tone that
|
|
59
|
+
* reaches 3:1 against the track at full opacity still does. That holds in
|
|
60
|
+
* the light and dark default themes.
|
|
61
|
+
* @source GUESS — An owner value, not a UIKit number.
|
|
62
|
+
* @measure M-PB1
|
|
63
|
+
*/
|
|
64
|
+
reducedMotionPulseFloor: 0.84,
|
|
65
|
+
progressView: {
|
|
66
|
+
/**
|
|
67
|
+
* The track's height in the `.default` style; the fill is as tall.
|
|
68
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
69
|
+
* iPhone 17 Pro, intrinsic size of UIProgressView(progressViewStyle:
|
|
70
|
+
* .default), Oct 23 2026
|
|
71
|
+
*/
|
|
72
|
+
heightPt: 4,
|
|
73
|
+
/**
|
|
74
|
+
* Above zero progress, the fill is never narrower than this many track
|
|
75
|
+
* heights: 8 pt on the 4 pt track. At 0.005 of a 300 pt track it is 8 pt
|
|
76
|
+
* wide; at 0.05 it is 15 pt.
|
|
77
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
78
|
+
* iPhone 17 Pro, the fill image view's frame at progress 0, 0.005,
|
|
79
|
+
* 0.01, 0.05, 0.5 and 1, Oct 23 2026
|
|
80
|
+
*/
|
|
81
|
+
minimumFillHeights: 2,
|
|
82
|
+
/**
|
|
83
|
+
* At progress 0 the fill is transparent (alpha 0, still at its minimum
|
|
84
|
+
* width).
|
|
85
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
86
|
+
* iPhone 17 Pro, the fill image view's alpha at progress 0, Oct 23 2026
|
|
87
|
+
*/
|
|
88
|
+
emptyFillAlpha: 0,
|
|
89
|
+
},
|
|
90
|
+
} as const;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Registers the table's three roles, for the generated motion role table and
|
|
94
|
+
* its test, which call it. Nothing at runtime reads the registry:
|
|
95
|
+
* `resolveMotion` returns the table value. Idempotent, and nothing runs on
|
|
96
|
+
* import.
|
|
97
|
+
*/
|
|
98
|
+
export function registerProgressBarTable(): void {
|
|
99
|
+
registerMotionTable('progress', progressBar, {
|
|
100
|
+
roles: ['fillTrackMs', 'curves.fill', 'reducedMotionPulseMs'],
|
|
101
|
+
});
|
|
102
|
+
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @file scroll.ts
|
|
5
5
|
* @input Nothing; data only
|
|
6
6
|
* @output Exports `scroll`, the UIScrollView constants: deceleration rates,
|
|
7
|
-
* the rubber-band coefficient, the bounce-back spring
|
|
8
|
-
*
|
|
7
|
+
* the rubber-band coefficient, the bounce-back spring and the content-touch
|
|
8
|
+
* delay
|
|
9
9
|
* @position The scroll domain of the UIKit constants table (motion/uikit);
|
|
10
10
|
* read by the motion math and components
|
|
11
11
|
*
|
|
@@ -82,22 +82,6 @@ export const scroll = {
|
|
|
82
82
|
* @measure M-S3
|
|
83
83
|
*/
|
|
84
84
|
bounce: {duration: 0.5, bounce: 0},
|
|
85
|
-
paging: {
|
|
86
|
-
/**
|
|
87
|
-
* Deceleration rate a paging release is projected with to pick the next
|
|
88
|
-
* page.
|
|
89
|
-
* @source GUESS — UIScrollView paging behaves like a fast scroll view;
|
|
90
|
-
* the rate it uses internally is not documented
|
|
91
|
-
* @measure M-PG1
|
|
92
|
-
*/
|
|
93
|
-
projectionRate: 0.99,
|
|
94
|
-
/**
|
|
95
|
-
* The spring that carries a paging scroll view onto its page.
|
|
96
|
-
* @source GUESS — SwiftUI `.smooth` default until measured
|
|
97
|
-
* @measure M-PG1
|
|
98
|
-
*/
|
|
99
|
-
snap: {duration: 0.5, bounce: 0},
|
|
100
|
-
},
|
|
101
85
|
/**
|
|
102
86
|
* `delaysContentTouches`: how long a scroll view holds a touch-down from
|
|
103
87
|
* its content while it decides whether the touch is a scroll (no highlight
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file slider.ts
|
|
5
|
+
* @input Nothing: data only
|
|
6
|
+
* @output Exports `slider`: UISlider's hit target, tracking rule, release
|
|
7
|
+
* coast, lift, drop and end haptic, measured on the iOS 26.2 simulator
|
|
8
|
+
* @position The slider domain of the UIKit constants table (motion/uikit).
|
|
9
|
+
* Lengths are in pt (CSS px). Tests check each leaf's `@source`.
|
|
10
|
+
*
|
|
11
|
+
* SYNC: When modified, update:
|
|
12
|
+
* - /packages/core/src/Slider/sliderTouchController.ts
|
|
13
|
+
* - /packages/core/src/Slider/Slider.tsx
|
|
14
|
+
* - /packages/core/src/motion/uikit/slider.test.ts
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {SLIDER_RELEASE_SPRING} from './springs';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* UISlider's touch values: hit target, tracking, release coast, lift, drop
|
|
21
|
+
* and the end-of-track haptic.
|
|
22
|
+
*/
|
|
23
|
+
export const slider = {
|
|
24
|
+
/**
|
|
25
|
+
* The thumb's touch target, a square in pt centered on the thumb. It is
|
|
26
|
+
* the 37 × 24 pt thumb grown by its hit edge insets: 12 pt above and
|
|
27
|
+
* below, 5.5 pt left and right. UIKit hit-tests inside the control's frame
|
|
28
|
+
* first, so the lab's 40 pt frame clipped it to 48 × 40.
|
|
29
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro.
|
|
30
|
+
* `_thumbHitEdgeInsets` reads {−12, −5.5, −12, −5.5}. Touch-downs on a
|
|
31
|
+
* 4 pt grid take the thumb from −24 to +20 pt in x. A track tap away
|
|
32
|
+
* from the thumb moves nothing. Oct 23 2026
|
|
33
|
+
*/
|
|
34
|
+
thumbHitTarget: 48,
|
|
35
|
+
/**
|
|
36
|
+
* Value range per track length of finger travel. The value moves by
|
|
37
|
+
* (max − min) × translation ÷ the track's full length. The translation
|
|
38
|
+
* counts from the pan's threshold: the touch-down point plus 10 pt along
|
|
39
|
+
* the track. 1 means one full range per track length.
|
|
40
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. In
|
|
41
|
+
* drags at 120 to 2000 pt/s, each event's value is v0 plus the
|
|
42
|
+
* translation past 10 pt ÷ 300. Past the max end, the value leaves 1
|
|
43
|
+
* only once the finger comes back past where it reached 1. Oct 23 2026
|
|
44
|
+
*/
|
|
45
|
+
trackingGain: 1,
|
|
46
|
+
/**
|
|
47
|
+
* The coast after the lift. The thumb and the value spring from where the
|
|
48
|
+
* finger left them to the projected target, with the release velocity.
|
|
49
|
+
* Critically damped, it never overshoots a target ahead of it.
|
|
50
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
51
|
+
* `UIViewSpringAnimationBehavior` at the lift reads response 0.4 and
|
|
52
|
+
* damping ratio 1. Four releases fit it per frame, at rms 0.11 pt or
|
|
53
|
+
* less. Oct 23 2026
|
|
54
|
+
*/
|
|
55
|
+
releaseSpring: SLIDER_RELEASE_SPRING,
|
|
56
|
+
/**
|
|
57
|
+
* The deceleration rate of the coast's momentum projection, per ms
|
|
58
|
+
* (WWDC18's `project`). It is not UIScrollView's normal rate (0.998), so
|
|
59
|
+
* pass it to the projection explicitly.
|
|
60
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
61
|
+
* release behavior's projection deceleration reads 0.996. Oct 23 2026
|
|
62
|
+
*/
|
|
63
|
+
releaseProjectionRate: 0.996,
|
|
64
|
+
/**
|
|
65
|
+
* How much of the projection the coast travels. The target is the lift
|
|
66
|
+
* value plus this share of the projected distance. A finger lifted outside
|
|
67
|
+
* the control's tracking bounds coasts back to the lift value instead.
|
|
68
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
69
|
+
* release behavior's target smoothing reads 0.4. A 126.9 pt/s release
|
|
70
|
+
* travels 12.56 pt, against 12.64 predicted. Oct 23 2026
|
|
71
|
+
*/
|
|
72
|
+
releaseProjectionShare: 0.4,
|
|
73
|
+
/**
|
|
74
|
+
* The thumb's growth under a finger, uniform about its center (37 × 24 to
|
|
75
|
+
* 57.35 × 37.2 pt).
|
|
76
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The lens
|
|
77
|
+
* frame settled during an 800 ms hold. Oct 23 2026
|
|
78
|
+
*/
|
|
79
|
+
liftScale: 1.55,
|
|
80
|
+
/**
|
|
81
|
+
* The lift: the thumb grows to `liftScale` when the finger lands.
|
|
82
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The lens
|
|
83
|
+
* width per frame in an 800 ms hold fits one spring at rms 0.31 pt.
|
|
84
|
+
* Oct 23 2026
|
|
85
|
+
*/
|
|
86
|
+
liftSpring: {response: 0.215, dampingRatio: 0.6},
|
|
87
|
+
/**
|
|
88
|
+
* The drop: the thumb shrinks back to its rest size when the finger lifts,
|
|
89
|
+
* while the coast runs.
|
|
90
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
91
|
+
* lens's spring at the lift of an 800 ms hold reads response 0.5 s and
|
|
92
|
+
* damping ratio 0.7. The width per frame fits it at rms 0.10 pt.
|
|
93
|
+
* Oct 23 2026
|
|
94
|
+
*/
|
|
95
|
+
dropSpring: {response: 0.5, dampingRatio: 0.7},
|
|
96
|
+
/**
|
|
97
|
+
* The feedback each time the value reaches an end, once per entry. It
|
|
98
|
+
* re-arms when the value leaves the end, in the drag and the coast. UIKit
|
|
99
|
+
* plays "Micro Tap Medium", and the web stand-in is the closest kind.
|
|
100
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
101
|
+
* haptics log of drags into both ends shows the fluid slider generator's
|
|
102
|
+
* "Micro Tap Medium" once per entry. Oct 23 2026
|
|
103
|
+
*/
|
|
104
|
+
endHaptic: 'impactMedium',
|
|
105
|
+
} as const;
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
* uikit.test.ts enforces both.
|
|
17
17
|
*
|
|
18
18
|
* Most springs are measured on iOS 26.2 or documented by Apple; two are still
|
|
19
|
-
* GUESSES (`segmentedThumb`, `banner`)
|
|
20
|
-
*
|
|
21
|
-
* nearest sourced spring and names it
|
|
22
|
-
*
|
|
19
|
+
* GUESSES (`segmentedThumb`, `banner`). `switchThumbMove` is the switch's
|
|
20
|
+
* measured travel, which uikit/switch.ts reads. A guess starts from the
|
|
21
|
+
* nearest sourced spring and names it. A component built on the table gets
|
|
22
|
+
* the measured value the moment it lands, without changing.
|
|
23
23
|
*
|
|
24
24
|
* Press highlight in/out are fades, not springs: see timing.ts.
|
|
25
25
|
*
|
|
@@ -388,38 +388,25 @@ export const MENU_REDUCED_MOTION_SPRING = {
|
|
|
388
388
|
// ---------------------------------------------------------------------
|
|
389
389
|
|
|
390
390
|
/**
|
|
391
|
-
* UISwitch thumb travelling between off and on
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
* switch frames differ, and a switch reads its measured table instead.
|
|
398
|
-
* @measure M-SW02
|
|
391
|
+
* UISwitch thumb travelling between off and on, measured: the switch table's
|
|
392
|
+
* `travel` reads this row, so the value has one home.
|
|
393
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
394
|
+
* iPhone 17 Pro, the lens's position behavior read on a tap (damping 1,
|
|
395
|
+
* response 0.3); the lens center after a 50 ms tap and after a 1 s hold
|
|
396
|
+
* fits one spring at 0.31 / 1 (rms 0.11 pt), Oct 23 2026
|
|
399
397
|
*/
|
|
400
398
|
export const SWITCH_THUMB_MOVE_SPRING = {
|
|
401
399
|
response: 0.3,
|
|
402
|
-
dampingRatio:
|
|
403
|
-
} as const;
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* UISwitch thumb stretching while pressed and relaxing on release.
|
|
407
|
-
* @source webkit Source/WebCore/rendering/cocoa/RenderThemeCocoa.mm
|
|
408
|
-
* `thumbPressSpring = SpringSolver(1.0, 322.272…, 31.2364…)`, "Values
|
|
409
|
-
* chosen for consistency with UIKit" (= response 0.35 s, ratio 0.87);
|
|
410
|
-
* settles in WebKit's held duration 0.50740 s (RenderThemeIOS.h). As
|
|
411
|
-
* for `switchThumbMove`, UIKit's own frames differ.
|
|
412
|
-
* @measure M-SW03
|
|
413
|
-
*/
|
|
414
|
-
export const SWITCH_THUMB_STRETCH_SPRING = {
|
|
415
|
-
response: 0.35,
|
|
416
|
-
dampingRatio: 0.87,
|
|
400
|
+
dampingRatio: 1,
|
|
417
401
|
} as const;
|
|
418
402
|
|
|
419
403
|
/**
|
|
420
404
|
* UISegmentedControl selection thumb sliding to a new segment.
|
|
421
|
-
* @source GUESS — WebKit's UIKit-matched switch thumb spring
|
|
422
|
-
*
|
|
405
|
+
* @source GUESS — WebKit's UIKit-matched switch thumb spring
|
|
406
|
+
* (RenderThemeCocoa.mm `thumbMoveSpring`: response 0.30 s, ratio 0.75),
|
|
407
|
+
* kept only until UISegmentedControl's measured spring replaces it;
|
|
408
|
+
* UISwitch's measured travel (`SWITCH_THUMB_MOVE_SPRING`)
|
|
409
|
+
* belongs to another control
|
|
423
410
|
* @measure M-SG02
|
|
424
411
|
* @measure M-SG03
|
|
425
412
|
*/
|
|
@@ -454,6 +441,33 @@ export const KEYBOARD_SPRING = {
|
|
|
454
441
|
*/
|
|
455
442
|
export const BANNER_SPRING = {mass: 3, stiffness: 1000, damping: 500} as const;
|
|
456
443
|
|
|
444
|
+
/**
|
|
445
|
+
* UISlider's release: after a finger lifts, the thumb settles on this spring
|
|
446
|
+
* toward 0.4 of the release's momentum projection. It is critically damped,
|
|
447
|
+
* so it never overshoots a target ahead of it.
|
|
448
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
449
|
+
* `UIViewSpringAnimationBehavior` at the lift reads response 0.4 and
|
|
450
|
+
* damping ratio 1. Four releases fit it per frame (the UIKit slider
|
|
451
|
+
* table). Oct 23 2026
|
|
452
|
+
*/
|
|
453
|
+
export const SLIDER_RELEASE_SPRING = {response: 0.4, dampingRatio: 1} as const;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* UISlider's lift: a finger's touch-down scales the thumb up on this spring.
|
|
457
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
458
|
+
* thumb's scale per frame after touch-down (the UIKit slider table).
|
|
459
|
+
* Oct 23 2026
|
|
460
|
+
*/
|
|
461
|
+
export const SLIDER_LIFT_SPRING = {response: 0.215, dampingRatio: 0.6} as const;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* UISlider's drop: the lift's end scales the thumb back down on this spring.
|
|
465
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
466
|
+
* thumb's scale per frame after the lift (the UIKit slider table).
|
|
467
|
+
* Oct 23 2026
|
|
468
|
+
*/
|
|
469
|
+
export const SLIDER_DROP_SPRING = {response: 0.5, dampingRatio: 0.7} as const;
|
|
470
|
+
|
|
457
471
|
/**
|
|
458
472
|
* Every spring above, by row name: the table the existing readers use. A
|
|
459
473
|
* component imports only the rows it plays (`architecture:component-style-authoring`
|
|
@@ -490,14 +504,18 @@ export const springs = {
|
|
|
490
504
|
contextMenuMorph: CONTEXT_MENU_MORPH_SPRING,
|
|
491
505
|
menuReducedMotion: MENU_REDUCED_MOTION_SPRING,
|
|
492
506
|
switchThumbMove: SWITCH_THUMB_MOVE_SPRING,
|
|
493
|
-
switchThumbStretch: SWITCH_THUMB_STRETCH_SPRING,
|
|
494
507
|
segmentedThumb: SEGMENTED_THUMB_SPRING,
|
|
495
508
|
keyboard: KEYBOARD_SPRING,
|
|
496
509
|
banner: BANNER_SPRING,
|
|
510
|
+
sliderRelease: SLIDER_RELEASE_SPRING,
|
|
511
|
+
sliderLift: SLIDER_LIFT_SPRING,
|
|
512
|
+
sliderDrop: SLIDER_DROP_SPRING,
|
|
497
513
|
} as const;
|
|
498
514
|
|
|
499
515
|
/**
|
|
500
|
-
* The
|
|
516
|
+
* The only springs that are motion roles. The touch presentations' record
|
|
517
|
+
* names some, and a component's own record names others, such as Slider's
|
|
518
|
+
* three. The generated motion role table lists each with its record.
|
|
501
519
|
* The registry takes these rows alone, so registering ships no other spring.
|
|
502
520
|
*/
|
|
503
521
|
const SPRING_ROLES = {
|
|
@@ -516,10 +534,13 @@ const SPRING_ROLES = {
|
|
|
516
534
|
contextMenuLift: CONTEXT_MENU_LIFT_SPRING,
|
|
517
535
|
contextMenuDismiss: CONTEXT_MENU_DISMISS_SPRING,
|
|
518
536
|
contextMenuMorph: CONTEXT_MENU_MORPH_SPRING,
|
|
537
|
+
sliderRelease: SLIDER_RELEASE_SPRING,
|
|
538
|
+
sliderLift: SLIDER_LIFT_SPRING,
|
|
539
|
+
sliderDrop: SLIDER_DROP_SPRING,
|
|
519
540
|
};
|
|
520
541
|
|
|
521
542
|
/**
|
|
522
|
-
* Registers the springs
|
|
543
|
+
* Registers the role springs (`SPRING_ROLES`) as internal motion roles
|
|
523
544
|
* (motion/roles.ts), by their row names (`springs.settle`). Every other
|
|
524
545
|
* spring, UIKit's menu spring under Reduce Motion and the keyboard's
|
|
525
546
|
* included, is not a role. Nothing registers on import: the touch code that
|