@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.
Files changed (272) hide show
  1. package/dist/AppShell/AppShell.d.ts.map +1 -1
  2. package/dist/AppShell/AppShell.js +23 -3
  3. package/dist/Avatar/Avatar.d.ts.map +1 -1
  4. package/dist/Avatar/Avatar.js +1 -1
  5. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  6. package/dist/BottomSheet/BottomSheetPanel.js +16 -9
  7. package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
  8. package/dist/Breadcrumbs/BreadcrumbItem.js +2 -1
  9. package/dist/Button/Button.d.ts.map +1 -1
  10. package/dist/Button/Button.js +3 -2
  11. package/dist/Chat/ChatComposerInput.d.ts +9 -0
  12. package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
  13. package/dist/Chat/ChatComposerInput.js +2 -0
  14. package/dist/Chat/ChatMessage.js +2 -2
  15. package/dist/Chat/chatMessage.vars.stylex.d.ts +8 -8
  16. package/dist/Chat/chatMessage.vars.stylex.js +8 -8
  17. package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
  18. package/dist/CommandPalette/CommandPaletteInput.js +8 -1
  19. package/dist/DateInput/MonthScroller.d.ts.map +1 -1
  20. package/dist/DateInput/MonthScroller.js +72 -2
  21. package/dist/DateInput/Wheel.d.ts +17 -1
  22. package/dist/DateInput/Wheel.d.ts.map +1 -1
  23. package/dist/DateInput/Wheel.js +179 -19
  24. package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
  25. package/dist/DateRangeInput/DateRangeInput.js +63 -49
  26. package/dist/Dialog/Dialog.d.ts.map +1 -1
  27. package/dist/Dialog/Dialog.js +37 -1
  28. package/dist/Drawer/Drawer.d.ts.map +1 -1
  29. package/dist/Drawer/Drawer.js +6 -0
  30. package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
  31. package/dist/Drawer/useDrawerDialogPresence.js +4 -0
  32. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  33. package/dist/DropdownMenu/DropdownMenu.js +20 -4
  34. package/dist/DropdownMenu/useMenuOverflow.d.ts +13 -3
  35. package/dist/DropdownMenu/useMenuOverflow.d.ts.map +1 -1
  36. package/dist/DropdownMenu/useMenuOverflow.js +31 -8
  37. package/dist/Field/PanelSearchInput.d.ts.map +1 -1
  38. package/dist/Field/PanelSearchInput.js +8 -1
  39. package/dist/Field/textEntryTraits.d.ts +6 -6
  40. package/dist/Field/textEntryTraits.js +6 -6
  41. package/dist/Layer/layerClickBoundary.d.ts +7 -1
  42. package/dist/Layer/layerClickBoundary.d.ts.map +1 -1
  43. package/dist/Layer/layerClickBoundary.js +2 -2
  44. package/dist/Layer/usePressPin.d.ts +95 -0
  45. package/dist/Layer/usePressPin.d.ts.map +1 -0
  46. package/dist/Layer/usePressPin.js +365 -0
  47. package/dist/Layer/useTouchTrigger.d.ts +23 -1
  48. package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
  49. package/dist/Layer/useTouchTrigger.js +45 -7
  50. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  51. package/dist/Lightbox/Lightbox.js +2 -1
  52. package/dist/Link/Link.d.ts.map +1 -1
  53. package/dist/Link/Link.js +1 -0
  54. package/dist/Popover/usePopover.d.ts.map +1 -1
  55. package/dist/Popover/usePopover.js +56 -7
  56. package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
  57. package/dist/PowerSearch/PowerSearch.js +38 -30
  58. package/dist/ProgressBar/ProgressBar.d.ts +1 -1
  59. package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
  60. package/dist/ProgressBar/ProgressBar.js +52 -14
  61. package/dist/ProgressBar/ProgressBarTouch.d.ts +29 -0
  62. package/dist/ProgressBar/ProgressBarTouch.d.ts.map +1 -0
  63. package/dist/ProgressBar/ProgressBarTouch.js +91 -0
  64. package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
  65. package/dist/SegmentedControl/SegmentedControlItem.js +2 -1
  66. package/dist/Selector/Selector.d.ts.map +1 -1
  67. package/dist/Selector/Selector.js +25 -13
  68. package/dist/Slider/Slider.d.ts.map +1 -1
  69. package/dist/Slider/Slider.js +404 -131
  70. package/dist/Slider/sliderTouchController.d.ts +189 -0
  71. package/dist/Slider/sliderTouchController.d.ts.map +1 -0
  72. package/dist/Slider/sliderTouchController.js +1017 -0
  73. package/dist/Slider/useSliderTouch.d.ts +22 -0
  74. package/dist/Slider/useSliderTouch.d.ts.map +1 -0
  75. package/dist/Slider/useSliderTouch.js +56 -0
  76. package/dist/Switch/Switch.d.ts +1 -1
  77. package/dist/Switch/Switch.d.ts.map +1 -1
  78. package/dist/Switch/Switch.js +200 -46
  79. package/dist/Switch/switchFill.d.ts +31 -0
  80. package/dist/Switch/switchFill.d.ts.map +1 -0
  81. package/dist/Switch/switchFill.js +88 -0
  82. package/dist/Switch/switchTouch.d.ts +81 -0
  83. package/dist/Switch/switchTouch.d.ts.map +1 -0
  84. package/dist/Switch/switchTouch.js +133 -0
  85. package/dist/Switch/useSwitchTouch.d.ts +285 -0
  86. package/dist/Switch/useSwitchTouch.d.ts.map +1 -0
  87. package/dist/Switch/useSwitchTouch.js +998 -0
  88. package/dist/TabList/Tab.d.ts.map +1 -1
  89. package/dist/TabList/Tab.js +4 -3
  90. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  91. package/dist/Tokenizer/Tokenizer.js +12 -5
  92. package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts +3 -0
  93. package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts.map +1 -0
  94. package/dist/Tokenizer/TokenizerItemRemovableContext.js +17 -0
  95. package/dist/Tooltip/Tooltip.d.ts +30 -6
  96. package/dist/Tooltip/Tooltip.d.ts.map +1 -1
  97. package/dist/Tooltip/Tooltip.js +5 -0
  98. package/dist/Tooltip/index.d.ts +1 -1
  99. package/dist/Tooltip/index.d.ts.map +1 -1
  100. package/dist/Tooltip/useTooltip.d.ts +31 -5
  101. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  102. package/dist/Tooltip/useTooltip.js +59 -18
  103. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  104. package/dist/Typeahead/BaseTypeahead.js +19 -9
  105. package/dist/Typeahead/Typeahead.d.ts.map +1 -1
  106. package/dist/Typeahead/Typeahead.js +26 -15
  107. package/dist/astryx.css +91 -8
  108. package/dist/gestures/GestureArena.d.ts +21 -2
  109. package/dist/gestures/GestureArena.d.ts.map +1 -1
  110. package/dist/gestures/GestureArena.js +23 -3
  111. package/dist/gestures/GestureHost.d.ts +123 -3
  112. package/dist/gestures/GestureHost.d.ts.map +1 -1
  113. package/dist/gestures/GestureHost.js +797 -15
  114. package/dist/gestures/GestureRecognizer.d.ts +15 -1
  115. package/dist/gestures/GestureRecognizer.d.ts.map +1 -1
  116. package/dist/gestures/GestureRecognizer.js +12 -0
  117. package/dist/gestures/PanGestureRecognizer.d.ts +8 -0
  118. package/dist/gestures/PanGestureRecognizer.d.ts.map +1 -1
  119. package/dist/gestures/PinchGestureRecognizer.d.ts +5 -1
  120. package/dist/gestures/PinchGestureRecognizer.d.ts.map +1 -1
  121. package/dist/gestures/PinchGestureRecognizer.js +10 -0
  122. package/dist/gestures/PressTracker.d.ts +6 -0
  123. package/dist/gestures/PressTracker.d.ts.map +1 -1
  124. package/dist/gestures/PressTracker.js +3 -0
  125. package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts +3 -3
  126. package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts.map +1 -1
  127. package/dist/gestures/ScreenEdgePanGestureRecognizer.js +7 -5
  128. package/dist/gestures/nativeScroll.d.ts +16 -2
  129. package/dist/gestures/nativeScroll.d.ts.map +1 -1
  130. package/dist/gestures/nativeScroll.js +39 -8
  131. package/dist/gestures/recognizerInternals.d.ts +4 -2
  132. package/dist/gestures/recognizerInternals.d.ts.map +1 -1
  133. package/dist/gestures/types.d.ts +17 -0
  134. package/dist/gestures/types.d.ts.map +1 -1
  135. package/dist/gestures/types.js +7 -0
  136. package/dist/gestures/usePressTracker.d.ts.map +1 -1
  137. package/dist/gestures/usePressTracker.js +1 -0
  138. package/dist/gestures/wheelSegmenter.d.ts +56 -0
  139. package/dist/gestures/wheelSegmenter.d.ts.map +1 -0
  140. package/dist/gestures/wheelSegmenter.js +122 -0
  141. package/dist/hooks/useAttachment.d.ts +16 -8
  142. package/dist/hooks/useAttachment.d.ts.map +1 -1
  143. package/dist/hooks/useAttachment.js +35 -15
  144. package/dist/hooks/useFocusTrap.d.ts +15 -0
  145. package/dist/hooks/useFocusTrap.d.ts.map +1 -1
  146. package/dist/hooks/useFocusTrap.js +13 -2
  147. package/dist/hooks/usePager.d.ts +261 -0
  148. package/dist/hooks/usePager.d.ts.map +1 -0
  149. package/dist/hooks/usePager.js +1169 -0
  150. package/dist/motion/animator.d.ts.map +1 -1
  151. package/dist/motion/animator.js +140 -19
  152. package/dist/motion/paging.d.ts +69 -0
  153. package/dist/motion/paging.d.ts.map +1 -0
  154. package/dist/motion/paging.js +148 -0
  155. package/dist/motion/uikit/index.d.ts +8 -4
  156. package/dist/motion/uikit/index.d.ts.map +1 -1
  157. package/dist/motion/uikit/index.js +8 -4
  158. package/dist/motion/uikit/paging.d.ts +171 -0
  159. package/dist/motion/uikit/paging.d.ts.map +1 -0
  160. package/dist/motion/uikit/paging.js +192 -0
  161. package/dist/motion/uikit/progressBar.d.ts +79 -0
  162. package/dist/motion/uikit/progressBar.d.ts.map +1 -0
  163. package/dist/motion/uikit/progressBar.js +102 -0
  164. package/dist/motion/uikit/scroll.d.ts +0 -19
  165. package/dist/motion/uikit/scroll.d.ts.map +1 -1
  166. package/dist/motion/uikit/scroll.js +2 -21
  167. package/dist/motion/uikit/slider.d.ts +97 -0
  168. package/dist/motion/uikit/slider.d.ts.map +1 -0
  169. package/dist/motion/uikit/slider.js +111 -0
  170. package/dist/motion/uikit/springs.d.ts +59 -30
  171. package/dist/motion/uikit/springs.d.ts.map +1 -1
  172. package/dist/motion/uikit/springs.js +64 -34
  173. package/dist/motion/uikit/switch.d.ts +166 -0
  174. package/dist/motion/uikit/switch.d.ts.map +1 -0
  175. package/dist/motion/uikit/switch.js +186 -0
  176. package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts +18 -0
  177. package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts.map +1 -0
  178. package/dist/privateAttributes/pressHoldsDrag.stylex.js +28 -0
  179. package/dist/utils/pressFeedback.d.ts.map +1 -1
  180. package/dist/utils/pressFeedback.js +5 -0
  181. package/dist/utils/selectionLock.d.ts +43 -0
  182. package/dist/utils/selectionLock.d.ts.map +1 -1
  183. package/dist/utils/selectionLock.js +394 -6
  184. package/package.json +5 -5
  185. package/src/AppShell/AppShell.doc.mjs +10 -0
  186. package/src/AppShell/AppShell.tsx +48 -2
  187. package/src/Avatar/Avatar.tsx +3 -1
  188. package/src/BottomSheet/BottomSheetPanel.tsx +16 -9
  189. package/src/Breadcrumbs/BreadcrumbItem.tsx +4 -1
  190. package/src/Button/Button.tsx +3 -2
  191. package/src/Chat/Chat.doc.mjs +1 -0
  192. package/src/Chat/ChatComposerInput.doc.mjs +11 -0
  193. package/src/Chat/ChatComposerInput.tsx +11 -0
  194. package/src/Chat/ChatMessage.tsx +2 -2
  195. package/src/Chat/chatMessage.vars.stylex.ts +8 -8
  196. package/src/CommandPalette/CommandPaletteInput.tsx +6 -0
  197. package/src/DateInput/MonthScroller.tsx +63 -5
  198. package/src/DateInput/Wheel.tsx +174 -14
  199. package/src/DateRangeInput/DateRangeInput.doc.mjs +3 -2
  200. package/src/DateRangeInput/DateRangeInput.tsx +117 -71
  201. package/src/Dialog/Dialog.tsx +37 -1
  202. package/src/Drawer/Drawer.tsx +6 -0
  203. package/src/Drawer/useDrawerDialogPresence.ts +4 -0
  204. package/src/DropdownMenu/DropdownMenu.tsx +28 -6
  205. package/src/DropdownMenu/useMenuOverflow.ts +44 -8
  206. package/src/Field/PanelSearchInput.tsx +6 -0
  207. package/src/Field/textEntryTraits.ts +6 -6
  208. package/src/Layer/layerClickBoundary.ts +2 -2
  209. package/src/Layer/usePressPin.ts +516 -0
  210. package/src/Layer/useTouchTrigger.ts +56 -6
  211. package/src/Lightbox/Lightbox.tsx +2 -1
  212. package/src/Link/Link.tsx +3 -0
  213. package/src/Popover/usePopover.tsx +71 -9
  214. package/src/PowerSearch/PowerSearch.tsx +38 -31
  215. package/src/ProgressBar/ProgressBar.doc.mjs +7 -5
  216. package/src/ProgressBar/ProgressBar.tsx +147 -16
  217. package/src/ProgressBar/ProgressBarTouch.ts +109 -0
  218. package/src/SegmentedControl/SegmentedControlItem.tsx +2 -1
  219. package/src/Selector/Selector.tsx +29 -2
  220. package/src/Slider/Slider.doc.mjs +11 -7
  221. package/src/Slider/Slider.tsx +539 -132
  222. package/src/Slider/sliderTouchController.ts +1209 -0
  223. package/src/Slider/useSliderTouch.ts +78 -0
  224. package/src/Switch/Switch.doc.mjs +3 -3
  225. package/src/Switch/Switch.tsx +412 -86
  226. package/src/Switch/switchFill.ts +106 -0
  227. package/src/Switch/switchTouch.ts +194 -0
  228. package/src/Switch/useSwitchTouch.ts +1121 -0
  229. package/src/TabList/Tab.tsx +5 -3
  230. package/src/Tokenizer/Tokenizer.tsx +15 -5
  231. package/src/Tokenizer/TokenizerItemRemovableContext.ts +22 -0
  232. package/src/Tooltip/Tooltip.doc.mjs +21 -6
  233. package/src/Tooltip/Tooltip.tsx +42 -5
  234. package/src/Tooltip/index.ts +1 -0
  235. package/src/Tooltip/useTooltip.doc.mjs +4 -2
  236. package/src/Tooltip/useTooltip.tsx +84 -21
  237. package/src/Typeahead/BaseTypeahead.tsx +16 -8
  238. package/src/Typeahead/Typeahead.tsx +29 -15
  239. package/src/gestures/GestureArena.ts +45 -4
  240. package/src/gestures/GestureHost.ts +958 -15
  241. package/src/gestures/GestureRecognizer.ts +28 -0
  242. package/src/gestures/PanGestureRecognizer.ts +8 -0
  243. package/src/gestures/PinchGestureRecognizer.ts +16 -1
  244. package/src/gestures/PressTracker.ts +10 -0
  245. package/src/gestures/README.md +82 -3
  246. package/src/gestures/ScreenEdgePanGestureRecognizer.ts +7 -5
  247. package/src/gestures/nativeScroll.ts +49 -9
  248. package/src/gestures/recognizerInternals.ts +9 -2
  249. package/src/gestures/types.ts +18 -0
  250. package/src/gestures/usePressTracker.ts +2 -0
  251. package/src/gestures/wheelSegmenter.ts +143 -0
  252. package/src/hooks/useAttachment.ts +56 -14
  253. package/src/hooks/useFocusTrap.ts +26 -2
  254. package/src/hooks/usePager.ts +1446 -0
  255. package/src/motion/MEASUREMENTS.md +36 -27
  256. package/src/motion/README.md +7 -3
  257. package/src/motion/animator.ts +193 -25
  258. package/src/motion/paging.ts +161 -0
  259. package/src/motion/uikit/index.ts +7 -4
  260. package/src/motion/uikit/paging.ts +193 -0
  261. package/src/motion/uikit/progressBar.ts +102 -0
  262. package/src/motion/uikit/scroll.ts +2 -18
  263. package/src/motion/uikit/slider.ts +105 -0
  264. package/src/motion/uikit/springs.ts +53 -32
  265. package/src/motion/uikit/switch.ts +174 -0
  266. package/src/privateAttributes/pressHoldsDrag.stylex.ts +28 -0
  267. package/src/utils/pressFeedback.ts +5 -0
  268. package/src/utils/selectionLock.ts +501 -6
  269. package/dist/motion/selectPage.d.ts +0 -26
  270. package/dist/motion/selectPage.d.ts.map +0 -1
  271. package/dist/motion/selectPage.js +0 -55
  272. package/src/motion/selectPage.ts +0 -55
@@ -0,0 +1,174 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file switch.ts
5
+ * @input The springs table's measured switch travel (springs.ts)
6
+ * @output Exports `switchControl`: UISwitch's geometry, the springs of its
7
+ * Liquid Glass thumb and of its track color, the drag's rubber band and
8
+ * flip distance, and the release timing
9
+ * @position The switch domain of the UIKit constants table (motion/uikit)
10
+ *
11
+ * The values are UISwitch's on iOS 26.2, read in a UIKit host app on the
12
+ * simulator. Lengths are in pt (CSS px). uikit.test.ts checks each `@source`.
13
+ *
14
+ * SYNC: When modified, update /packages/core/src/motion/MEASUREMENTS.md.
15
+ */
16
+
17
+ import {registerMotionTable} from '../roles';
18
+ import {SWITCH_THUMB_MOVE_SPRING} from './springs';
19
+
20
+ /**
21
+ * UISwitch on iOS 26.2. Under a finger its white thumb lifts into a clear
22
+ * glass lens, and a drag moves it with a rubber band. The track colour slides
23
+ * on a spring of its own. UISwitch plays no haptic.
24
+ */
25
+ export const switchControl = {
26
+ /**
27
+ * The control's size (width × height): the track.
28
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
29
+ * iPhone 17 Pro, `UISwitch` frame 63 × 28 (intrinsic 61 × 28), track view
30
+ * 63 × 28 with corner radius 14, Oct 23 2026
31
+ */
32
+ trackSize: [63, 28],
33
+ /**
34
+ * The thumb at rest (width × height), inset equally from the track's top,
35
+ * bottom and nearer end; it never changes size between off and on.
36
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
37
+ * iPhone 17 Pro, `_UILiquidLensView` frame 37 × 24 at x 2 (off) and
38
+ * x 24 (on) inside the 63 × 28 track, Oct 23 2026
39
+ */
40
+ thumbSize: [37, 24],
41
+ /**
42
+ * The thumb lifted under a finger (width × height). The lens grows about
43
+ * its own center, past the track, and holds this size while the finger
44
+ * stays down.
45
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
46
+ * iPhone 17 Pro, lens bounds settled at 58 × 38.33 during a 1 s hold
47
+ * (center unmoved), Oct 23 2026
48
+ */
49
+ liftedThumbSize: [58, 38.333],
50
+ /**
51
+ * The lift: the thumb growing to `liftedThumbSize` while its white fill
52
+ * fades out and the clear glass fades in (one spring drives all three).
53
+ * Starts with the touch outside a scroll view, after its content delay
54
+ * inside one. UISwitch keeps it under Reduce Motion; core's Switch does not
55
+ * lift then.
56
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
57
+ * iPhone 17 Pro, per-frame lens bounds during a 1 s hold fitted with one
58
+ * spring for width and height (rms 0.29 pt; the fill's and the glass's
59
+ * opacity overshoot by the same 13 %; the lens's settings read on a tap
60
+ * say damping 0.625, response 0.27, whose 8 % overshoot is short of the
61
+ * frames' 12 %), Oct 23 2026
62
+ */
63
+ lift: {response: 0.23, dampingRatio: 0.55},
64
+ /**
65
+ * The settle after the finger lifts: the lens shrinking back to
66
+ * `thumbSize` while the white fill returns over the glass.
67
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
68
+ * iPhone 17 Pro, the lens's spring settings read on a tap (damping 0.7,
69
+ * response 0.5); per-frame lens bounds after the lift of a 1 s hold fit
70
+ * one spring at 0.49 / 0.70 (rms 0.065 pt; the opacities undershoot by
71
+ * the same 4.5 %), Oct 23 2026
72
+ */
73
+ settle: {response: 0.5, dampingRatio: 0.7},
74
+ /**
75
+ * The settle never starts sooner than this after the lift began, so a
76
+ * quick tap still shows the lifted lens, in ms.
77
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
78
+ * iPhone 17 Pro, a 50 ms tap: the lift→settle hand-off fitted at 235 ms
79
+ * after the lift began (rms 0.33 pt), Oct 23 2026
80
+ * @measure M-SW07
81
+ */
82
+ minimumLiftMs: 235,
83
+ /**
84
+ * The thumb travelling to the committed end after a release or a
85
+ * programmatic change. It starts from the thumb's own velocity.
86
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
87
+ * iPhone 17 Pro, the lens's position behavior read on a tap (damping 1,
88
+ * response 0.3); the lens center after a 50 ms tap and after a 1 s hold
89
+ * fits one spring at 0.31 / 1 (rms 0.11 pt), Oct 23 2026; the springs
90
+ * table's `SWITCH_THUMB_MOVE_SPRING` holds the one value
91
+ */
92
+ travel: SWITCH_THUMB_MOVE_SPRING,
93
+ /**
94
+ * During a drag the thumb chases the finger: each move retargets this
95
+ * spring at the finger's position, rubber-banded past either end.
96
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
97
+ * iPhone 17 Pro, a 4 s drag off → on → past both ends: the lens center
98
+ * simulated as this spring chasing the rubber-banded finger fits every
99
+ * frame (rms 0.21 pt), Oct 23 2026
100
+ */
101
+ tracking: {response: 0.36, dampingRatio: 1},
102
+ /**
103
+ * The drag's rubber band past either end: UIScrollView's
104
+ * `(1 − 1 ÷ (x·c ÷ d + 1))·d`. The coefficient c and the dimension d are in
105
+ * pt for the 28 pt control. Scale d with the track height.
106
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
107
+ * iPhone 17 Pro, the same drag fit: c 0.55, d 11.75–12 pt, the
108
+ * translation measured from where the finger landed, Oct 23 2026
109
+ */
110
+ rubberBand: {coefficient: 0.55, dimension: 12},
111
+ /**
112
+ * A drag flips the switch by the finger, not the thumb. Once the finger is
113
+ * this far from where it landed, toward the other end, the switch shows
114
+ * the other side. The distance is the track width minus the thumb width
115
+ * (63 − 37 pt). Back past where it landed, the starting side shows again.
116
+ * Flips happen on touch events only, so a fast swipe flips on the lift.
117
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
118
+ * iPhone 17 Pro, `UISwitchModernVisualElement` ivars per frame and the
119
+ * "SwitchWellPosition" springs during 1 pt-step drags: the same 26 pt for
120
+ * presses at x 8, 20.5 and 45, with and without a 400 ms hold, mirrored
121
+ * on an on switch; flipping back at the press point, Oct 23 2026
122
+ */
123
+ flipDistance: 26,
124
+ /**
125
+ * The track color turning on: the well image sliding in on a critically
126
+ * damped spring, starting when the switch flips (the lift of a tap).
127
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
128
+ * iPhone 17 Pro, `CASpringAnimation` "SwitchWellPosition" read: mass 1,
129
+ * stiffness 85.377, damping 18.480 (response 0.68 s), Oct 23 2026
130
+ */
131
+ wellOn: {mass: 1, stiffness: 85.37720070146501, damping: 18.47995678582231},
132
+ /**
133
+ * The track color turning off: the same well sliding back, faster.
134
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
135
+ * iPhone 17 Pro, `CASpringAnimation` "SwitchWellPosition" read: mass 1,
136
+ * stiffness 246.740, damping 31.416 (response 0.40 s), Oct 23 2026
137
+ */
138
+ wellOff: {mass: 1, stiffness: 246.74011002723395, damping: 31.41592653589793},
139
+ /**
140
+ * The lifted lens's drop shadow: y offset and radius in pt, then black
141
+ * alpha; none at rest.
142
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
143
+ * iPhone 17 Pro, the lens layer's presented `shadowOffset` (0, 7),
144
+ * `shadowRadius` 3, `shadowOpacity` 0.12 once lifted, 0 at rest,
145
+ * Oct 23 2026
146
+ */
147
+ liftedShadow: [7, 3, 0.12],
148
+ /**
149
+ * UISwitch plays no haptic on a tap, a hold or a drag.
150
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
151
+ * iPhone 17 Pro, every `UIFeedbackGenerator` entry point hooked: no call
152
+ * on tap, hold, drag or flip, Oct 23 2026
153
+ */
154
+ haptic: 'none',
155
+ } as const;
156
+
157
+ /**
158
+ * Registers the switch table's motion roles as internal roles. Nothing
159
+ * registers on import: Switch's touch presentation calls it once before its
160
+ * first animation, and a second call does nothing.
161
+ */
162
+ export function registerSwitchTable(): void {
163
+ registerMotionTable('switchControl', switchControl, {
164
+ roles: [
165
+ 'lift',
166
+ 'settle',
167
+ 'travel',
168
+ 'tracking',
169
+ 'wellOn',
170
+ 'wellOff',
171
+ 'minimumLiftMs',
172
+ ],
173
+ });
174
+ }
@@ -0,0 +1,28 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ /**
3
+ * @file privateAttributes/pressHoldsDrag.stylex.ts
4
+ * @input Whether a pressable's own drag moves under the finger
5
+ * @output pressHoldsDragProps, which marks such a pressable, and
6
+ * holdsPressThroughDrag, which reads the mark
7
+ * @position Owner module of the private press-holds-drag attribute: the only
8
+ * file that writes its name. Switch marks its row; the press controller
9
+ * (utils/pressFeedback.ts) keeps the press painted through that row's
10
+ * drag. No package entry exports it.
11
+ */
12
+
13
+ const PRESS_HOLDS_DRAG = 'data-astryx-press-holds-drag';
14
+
15
+ /**
16
+ * Spread on a pressable whose own drag the finger moves, such as a Switch's
17
+ * thumb. The drag is not a scroll, so the press stays painted.
18
+ */
19
+ export function pressHoldsDragProps(
20
+ holdsDrag: boolean,
21
+ ): Readonly<Record<string, string>> {
22
+ return holdsDrag ? {[PRESS_HOLDS_DRAG]: ''} : {};
23
+ }
24
+
25
+ /** Whether the press on `element` stays painted through its drag. */
26
+ export function holdsPressThroughDrag(element: Element): boolean {
27
+ return element.hasAttribute(PRESS_HOLDS_DRAG);
28
+ }
@@ -45,6 +45,7 @@ import {
45
45
  import {isCoarsePointer, watchCoarsePointer} from './coarsePointer';
46
46
  import {subscribeInput} from './inputStream';
47
47
  import {TOUCH_QUERY} from './touchPresentation';
48
+ import {holdsPressThroughDrag} from '../privateAttributes/pressHoldsDrag.stylex';
48
49
 
49
50
  /**
50
51
  * The marker the controller finds with `closest()`. Every Astryx component
@@ -441,6 +442,10 @@ function onPointerMove(event: PointerEvent): void {
441
442
  ) {
442
443
  return;
443
444
  }
445
+ // The finger drags the surface's own control: its travel keeps the press.
446
+ if (holdsPressThroughDrag(live.element)) {
447
+ return;
448
+ }
444
449
  apply(
445
450
  finger,
446
451
  pressGestureStep(live.gesture, {