@astryxdesign/core 0.7.7-canary.550ff21 → 0.7.7-canary.559b005

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 (264) hide show
  1. package/dist/Avatar/Avatar.d.ts.map +1 -1
  2. package/dist/Avatar/Avatar.js +1 -1
  3. package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
  4. package/dist/Breadcrumbs/BreadcrumbItem.js +2 -1
  5. package/dist/Button/Button.d.ts.map +1 -1
  6. package/dist/Button/Button.js +3 -2
  7. package/dist/DateInput/Wheel.d.ts +17 -1
  8. package/dist/DateInput/Wheel.d.ts.map +1 -1
  9. package/dist/DateInput/Wheel.js +179 -19
  10. package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
  11. package/dist/DateRangeInput/DateRangeInput.js +63 -49
  12. package/dist/Dialog/Dialog.d.ts.map +1 -1
  13. package/dist/Dialog/Dialog.js +49 -12
  14. package/dist/Drawer/Drawer.d.ts.map +1 -1
  15. package/dist/Drawer/Drawer.js +15 -10
  16. package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
  17. package/dist/Drawer/useDrawerDialogPresence.js +4 -0
  18. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  19. package/dist/DropdownMenu/DropdownMenu.js +20 -4
  20. package/dist/InfoTip/InfoTip.d.ts +63 -0
  21. package/dist/InfoTip/InfoTip.d.ts.map +1 -0
  22. package/dist/InfoTip/InfoTip.js +126 -0
  23. package/dist/InfoTip/index.d.ts +10 -0
  24. package/dist/InfoTip/index.d.ts.map +1 -0
  25. package/dist/InfoTip/index.js +12 -0
  26. package/dist/Layer/layerClickBoundary.d.ts +7 -1
  27. package/dist/Layer/layerClickBoundary.d.ts.map +1 -1
  28. package/dist/Layer/layerClickBoundary.js +2 -2
  29. package/dist/Layer/useBackdropPress.d.ts +27 -0
  30. package/dist/Layer/useBackdropPress.d.ts.map +1 -0
  31. package/dist/Layer/useBackdropPress.js +53 -0
  32. package/dist/Layer/usePressPin.d.ts +95 -0
  33. package/dist/Layer/usePressPin.d.ts.map +1 -0
  34. package/dist/Layer/usePressPin.js +365 -0
  35. package/dist/Layer/useTouchTrigger.d.ts +23 -1
  36. package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
  37. package/dist/Layer/useTouchTrigger.js +45 -7
  38. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  39. package/dist/Lightbox/Lightbox.js +2 -1
  40. package/dist/Popover/usePopover.d.ts.map +1 -1
  41. package/dist/Popover/usePopover.js +56 -7
  42. package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
  43. package/dist/PowerSearch/PowerSearch.js +38 -30
  44. package/dist/ProgressBar/ProgressBar.d.ts +1 -1
  45. package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
  46. package/dist/ProgressBar/ProgressBar.js +33 -6
  47. package/dist/SegmentedControl/SegmentedControl.d.ts +3 -1
  48. package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  49. package/dist/SegmentedControl/SegmentedControl.js +115 -8
  50. package/dist/SegmentedControl/SegmentedControlContext.d.ts +6 -0
  51. package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
  52. package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -0
  53. package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
  54. package/dist/SegmentedControl/SegmentedControlItem.js +10 -2
  55. package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts +357 -0
  56. package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -0
  57. package/dist/SegmentedControl/useSegmentedSelectionMotion.js +1349 -0
  58. package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts +70 -0
  59. package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts.map +1 -0
  60. package/dist/SegmentedControl/useSegmentedTouchTracking.js +264 -0
  61. package/dist/Selector/Selector.d.ts.map +1 -1
  62. package/dist/Selector/Selector.js +96 -67
  63. package/dist/Selector/optionShape.d.ts +24 -0
  64. package/dist/Selector/optionShape.d.ts.map +1 -0
  65. package/dist/Selector/optionShape.js +48 -0
  66. package/dist/Selector/selectableOptionEntries.d.ts +20 -0
  67. package/dist/Selector/selectableOptionEntries.d.ts.map +1 -0
  68. package/dist/Selector/selectableOptionEntries.js +38 -0
  69. package/dist/Selector/utils.d.ts +2 -17
  70. package/dist/Selector/utils.d.ts.map +1 -1
  71. package/dist/Selector/utils.js +3 -51
  72. package/dist/Switch/Switch.d.ts +1 -1
  73. package/dist/Switch/Switch.d.ts.map +1 -1
  74. package/dist/Switch/Switch.js +200 -46
  75. package/dist/Switch/switchFill.d.ts +31 -0
  76. package/dist/Switch/switchFill.d.ts.map +1 -0
  77. package/dist/Switch/switchFill.js +88 -0
  78. package/dist/Switch/switchTouch.d.ts +74 -0
  79. package/dist/Switch/switchTouch.d.ts.map +1 -0
  80. package/dist/Switch/switchTouch.js +125 -0
  81. package/dist/Switch/useSwitchTouch.d.ts +276 -0
  82. package/dist/Switch/useSwitchTouch.d.ts.map +1 -0
  83. package/dist/Switch/useSwitchTouch.js +939 -0
  84. package/dist/TabList/Tab.d.ts.map +1 -1
  85. package/dist/TabList/Tab.js +4 -3
  86. package/dist/Toast/Toast.d.ts.map +1 -1
  87. package/dist/Toast/Toast.js +5 -0
  88. package/dist/Token/Token.d.ts.map +1 -1
  89. package/dist/Token/Token.js +1 -0
  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/Typeahead.d.ts.map +1 -1
  104. package/dist/Typeahead/Typeahead.js +26 -15
  105. package/dist/astryx.css +125 -2
  106. package/dist/gestures/GestureHost.d.ts.map +1 -1
  107. package/dist/gestures/GestureHost.js +71 -14
  108. package/dist/gestures/PressTracker.d.ts +6 -0
  109. package/dist/gestures/PressTracker.d.ts.map +1 -1
  110. package/dist/gestures/PressTracker.js +3 -0
  111. package/dist/gestures/types.d.ts +6 -0
  112. package/dist/gestures/types.d.ts.map +1 -1
  113. package/dist/gestures/usePressTracker.d.ts.map +1 -1
  114. package/dist/gestures/usePressTracker.js +1 -0
  115. package/dist/gestures/wheelSegmenter.d.ts +14 -3
  116. package/dist/gestures/wheelSegmenter.d.ts.map +1 -1
  117. package/dist/gestures/wheelSegmenter.js +32 -8
  118. package/dist/hooks/actionGroupTracker.d.ts +3 -3
  119. package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
  120. package/dist/hooks/actionGroupTracker.js +6 -53
  121. package/dist/hooks/useAttachment.d.ts +16 -8
  122. package/dist/hooks/useAttachment.d.ts.map +1 -1
  123. package/dist/hooks/useAttachment.js +35 -15
  124. package/dist/hooks/useFocusTrap.d.ts +15 -0
  125. package/dist/hooks/useFocusTrap.d.ts.map +1 -1
  126. package/dist/hooks/useFocusTrap.js +13 -2
  127. package/dist/hooks/useHighlightedOptionScroll.d.ts.map +1 -1
  128. package/dist/hooks/useHighlightedOptionScroll.js +14 -11
  129. package/dist/hooks/useMediaQuery.d.ts +2 -1
  130. package/dist/hooks/useMediaQuery.d.ts.map +1 -1
  131. package/dist/hooks/useMediaQuery.js +7 -4
  132. package/dist/hooks/usePager.d.ts +261 -0
  133. package/dist/hooks/usePager.d.ts.map +1 -0
  134. package/dist/hooks/usePager.js +1169 -0
  135. package/dist/i18n/generated-english/InfoTip/InfoTip.generated.d.ts +8 -0
  136. package/dist/i18n/generated-english/InfoTip/InfoTip.generated.d.ts.map +1 -0
  137. package/dist/i18n/generated-english/InfoTip/InfoTip.generated.js +12 -0
  138. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  139. package/dist/i18n/generated-locales/en.generated.js +2 -1
  140. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  141. package/dist/i18n/generated-locales/pseudo.generated.js +2 -1
  142. package/dist/index.d.ts +1 -0
  143. package/dist/index.d.ts.map +1 -1
  144. package/dist/index.js +1 -0
  145. package/dist/motion/paging.d.ts +16 -5
  146. package/dist/motion/paging.d.ts.map +1 -1
  147. package/dist/motion/paging.js +34 -14
  148. package/dist/motion/roles.d.ts +7 -1
  149. package/dist/motion/roles.d.ts.map +1 -1
  150. package/dist/motion/roles.js +20 -1
  151. package/dist/motion/uikit/index.d.ts +7 -4
  152. package/dist/motion/uikit/index.d.ts.map +1 -1
  153. package/dist/motion/uikit/index.js +7 -4
  154. package/dist/motion/uikit/paging.d.ts +31 -20
  155. package/dist/motion/uikit/paging.d.ts.map +1 -1
  156. package/dist/motion/uikit/paging.js +41 -11
  157. package/dist/motion/uikit/progressBar.d.ts +27 -7
  158. package/dist/motion/uikit/progressBar.d.ts.map +1 -1
  159. package/dist/motion/uikit/progressBar.js +31 -11
  160. package/dist/motion/uikit/segmented.d.ts +55 -0
  161. package/dist/motion/uikit/segmented.d.ts.map +1 -0
  162. package/dist/motion/uikit/segmented.js +77 -0
  163. package/dist/motion/uikit/springs.d.ts +8 -42
  164. package/dist/motion/uikit/springs.d.ts.map +1 -1
  165. package/dist/motion/uikit/springs.js +12 -42
  166. package/dist/motion/uikit/switch.d.ts +166 -0
  167. package/dist/motion/uikit/switch.d.ts.map +1 -0
  168. package/dist/motion/uikit/switch.js +186 -0
  169. package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts +18 -0
  170. package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts.map +1 -0
  171. package/dist/privateAttributes/pressHoldsDrag.stylex.js +28 -0
  172. package/dist/privateAttributes/segmentTitle.stylex.d.ts +5 -0
  173. package/dist/privateAttributes/segmentTitle.stylex.d.ts.map +1 -0
  174. package/dist/privateAttributes/segmentTitle.stylex.js +22 -0
  175. package/dist/utils/browserClickWait.d.ts +35 -0
  176. package/dist/utils/browserClickWait.d.ts.map +1 -0
  177. package/dist/utils/browserClickWait.js +123 -0
  178. package/dist/utils/clickGuard.d.ts +7 -1
  179. package/dist/utils/clickGuard.d.ts.map +1 -1
  180. package/dist/utils/clickGuard.js +23 -1
  181. package/dist/utils/pressFeedback.d.ts.map +1 -1
  182. package/dist/utils/pressFeedback.js +5 -0
  183. package/locales/en.json +4 -0
  184. package/locales/pseudo.json +3 -0
  185. package/package.json +9 -4
  186. package/src/Avatar/Avatar.tsx +3 -1
  187. package/src/Breadcrumbs/BreadcrumbItem.tsx +4 -1
  188. package/src/Button/Button.tsx +3 -2
  189. package/src/DateInput/Wheel.tsx +174 -14
  190. package/src/DateRangeInput/DateRangeInput.doc.mjs +3 -2
  191. package/src/DateRangeInput/DateRangeInput.tsx +117 -71
  192. package/src/Dialog/Dialog.tsx +62 -11
  193. package/src/Drawer/Drawer.tsx +27 -10
  194. package/src/Drawer/useDrawerDialogPresence.ts +4 -0
  195. package/src/DropdownMenu/DropdownMenu.tsx +28 -6
  196. package/src/InfoTip/InfoTip.doc.mjs +192 -0
  197. package/src/InfoTip/InfoTip.tsx +186 -0
  198. package/src/InfoTip/index.ts +14 -0
  199. package/src/Layer/layerClickBoundary.ts +2 -2
  200. package/src/Layer/useBackdropPress.ts +81 -0
  201. package/src/Layer/usePressPin.ts +516 -0
  202. package/src/Layer/useTouchTrigger.ts +56 -6
  203. package/src/Lightbox/Lightbox.tsx +2 -1
  204. package/src/Popover/usePopover.tsx +71 -9
  205. package/src/PowerSearch/PowerSearch.tsx +38 -31
  206. package/src/ProgressBar/ProgressBar.doc.mjs +4 -2
  207. package/src/ProgressBar/ProgressBar.tsx +67 -7
  208. package/src/SegmentedControl/SegmentedControl.doc.mjs +3 -3
  209. package/src/SegmentedControl/SegmentedControl.tsx +179 -5
  210. package/src/SegmentedControl/SegmentedControlContext.ts +6 -0
  211. package/src/SegmentedControl/SegmentedControlItem.tsx +14 -2
  212. package/src/SegmentedControl/useSegmentedSelectionMotion.ts +1637 -0
  213. package/src/SegmentedControl/useSegmentedTouchTracking.ts +308 -0
  214. package/src/Selector/Selector.tsx +136 -89
  215. package/src/Selector/optionShape.ts +64 -0
  216. package/src/Selector/selectableOptionEntries.ts +39 -0
  217. package/src/Selector/utils.ts +9 -68
  218. package/src/Switch/Switch.doc.mjs +3 -3
  219. package/src/Switch/Switch.tsx +412 -86
  220. package/src/Switch/switchFill.ts +106 -0
  221. package/src/Switch/switchTouch.ts +186 -0
  222. package/src/Switch/useSwitchTouch.ts +1051 -0
  223. package/src/TabList/Tab.tsx +5 -3
  224. package/src/Toast/Toast.tsx +5 -0
  225. package/src/Token/Token.tsx +2 -0
  226. package/src/Tokenizer/Tokenizer.tsx +15 -5
  227. package/src/Tokenizer/TokenizerItemRemovableContext.ts +22 -0
  228. package/src/Tooltip/Tooltip.doc.mjs +21 -6
  229. package/src/Tooltip/Tooltip.tsx +42 -5
  230. package/src/Tooltip/index.ts +1 -0
  231. package/src/Tooltip/useTooltip.doc.mjs +4 -2
  232. package/src/Tooltip/useTooltip.tsx +84 -21
  233. package/src/Typeahead/Typeahead.tsx +29 -15
  234. package/src/gestures/GestureHost.ts +100 -11
  235. package/src/gestures/PressTracker.ts +10 -0
  236. package/src/gestures/types.ts +6 -0
  237. package/src/gestures/usePressTracker.ts +2 -0
  238. package/src/gestures/wheelSegmenter.ts +36 -7
  239. package/src/hooks/actionGroupTracker.ts +12 -56
  240. package/src/hooks/useAttachment.ts +56 -14
  241. package/src/hooks/useFocusTrap.ts +26 -2
  242. package/src/hooks/useHighlightedOptionScroll.ts +15 -11
  243. package/src/hooks/useMediaQuery.doc.mjs +2 -2
  244. package/src/hooks/useMediaQuery.ts +13 -4
  245. package/src/hooks/usePager.ts +1446 -0
  246. package/src/i18n/generated-english/InfoTip/InfoTip.generated.ts +13 -0
  247. package/src/i18n/generated-locales/en.generated.ts +1 -0
  248. package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
  249. package/src/index.ts +1 -0
  250. package/src/motion/MEASUREMENTS.md +36 -27
  251. package/src/motion/README.md +3 -1
  252. package/src/motion/paging.ts +37 -14
  253. package/src/motion/roles.ts +20 -1
  254. package/src/motion/uikit/index.ts +6 -5
  255. package/src/motion/uikit/paging.ts +41 -10
  256. package/src/motion/uikit/progressBar.ts +31 -11
  257. package/src/motion/uikit/segmented.ts +74 -0
  258. package/src/motion/uikit/springs.ts +12 -42
  259. package/src/motion/uikit/switch.ts +174 -0
  260. package/src/privateAttributes/pressHoldsDrag.stylex.ts +28 -0
  261. package/src/privateAttributes/segmentTitle.stylex.ts +22 -0
  262. package/src/utils/browserClickWait.ts +133 -0
  263. package/src/utils/clickGuard.ts +28 -1
  264. package/src/utils/pressFeedback.ts +5 -0
@@ -15,11 +15,11 @@
15
15
  * that will confirm or replace them (MEASUREMENTS.md lists them all).
16
16
  * uikit.test.ts enforces both.
17
17
  *
18
- * Most springs are measured on iOS 26.2 or documented by Apple; two are still
19
- * GUESSES (`segmentedThumb`, `banner`) and two come from WebKit
20
- * (`switchThumbMove`, `switchThumbStretch`). A guess starts from the
21
- * nearest sourced spring and names it, so a component built on the table
22
- * gets the right value the moment its measurement lands, without changing.
18
+ * Most springs are measured on iOS 26.2 or documented by Apple; one is still
19
+ * a GUESS (`banner`). `switchThumbMove` is the switch's measured travel,
20
+ * which uikit/switch.ts reads. A guess starts from the nearest sourced
21
+ * spring and names it. A component built on the table gets the measured
22
+ * 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,44 +388,16 @@ export const MENU_REDUCED_MOTION_SPRING = {
388
388
  // ---------------------------------------------------------------------
389
389
 
390
390
  /**
391
- * UISwitch thumb travelling between off and on.
392
- * @source webkit Source/WebCore/rendering/cocoa/RenderThemeCocoa.mm
393
- * `thumbMoveSpring = SpringSolver(1.0, 438.649…, 31.4159…)`, "Values
394
- * chosen for consistency with UIKit" (= response 0.30 s, ratio 0.75);
395
- * its settling duration is WebKit's iOS switch duration 0.48801 s
396
- * (RenderThemeIOS.h). These are WebKit's iOS 18 values: UIKit's own
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: 0.75,
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,
417
- } as const;
418
-
419
- /**
420
- * UISegmentedControl selection thumb sliding to a new segment.
421
- * @source GUESS — WebKit's UIKit-matched switch thumb spring, the nearest
422
- * sourced control thumb
423
- * @measure M-SG02
424
- * @measure M-SG03
425
- */
426
- export const SEGMENTED_THUMB_SPRING = {
427
- response: 0.3,
428
- dampingRatio: 0.75,
400
+ dampingRatio: 1,
429
401
  } as const;
430
402
 
431
403
  // ---------------------------------------------------------------------
@@ -517,8 +489,6 @@ export const springs = {
517
489
  contextMenuMorph: CONTEXT_MENU_MORPH_SPRING,
518
490
  menuReducedMotion: MENU_REDUCED_MOTION_SPRING,
519
491
  switchThumbMove: SWITCH_THUMB_MOVE_SPRING,
520
- switchThumbStretch: SWITCH_THUMB_STRETCH_SPRING,
521
- segmentedThumb: SEGMENTED_THUMB_SPRING,
522
492
  keyboard: KEYBOARD_SPRING,
523
493
  banner: BANNER_SPRING,
524
494
  sliderRelease: SLIDER_RELEASE_SPRING,
@@ -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
+ }
@@ -0,0 +1,22 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file privateAttributes/segmentTitle.stylex.ts
5
+ * @input Nothing
6
+ * @output segmentTitleProps, which marks a SegmentedControl segment's title,
7
+ * and titleOfSegment, which finds that title in a segment
8
+ * @position Owner module of the private segment-title attribute: the only
9
+ * file that writes its name. No package entry exports it.
10
+ */
11
+
12
+ const SEGMENT_TITLE = 'data-astryx-segment-title';
13
+
14
+ /** Spread on a segment's title: marks it for the touch layer. */
15
+ export const segmentTitleProps: Readonly<Record<string, string>> = {
16
+ [SEGMENT_TITLE]: '',
17
+ };
18
+
19
+ /** The title inside `segment`, or null when the label is hidden. */
20
+ export function titleOfSegment(segment: Element): HTMLElement | null {
21
+ return segment.querySelector<HTMLElement>(`[${SEGMENT_TITLE}]`);
22
+ }
@@ -0,0 +1,133 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file browserClickWait.ts
5
+ * @input An element a tap's lift released on, and the control that acts on
6
+ * its click
7
+ * @output BROWSER_CLICK_WAIT_MS, awaitBrowserClick, clickForLift and
8
+ * clickAndReport
9
+ * @position The one wait for the browser's click after a tap, shared by
10
+ * Switch/useSwitchTouch.ts and SegmentedControl/useSegmentedTouchTracking.ts.
11
+ * It swallows nothing: utils/clickGuard.ts is the one guard for a late click.
12
+ *
13
+ * SYNC: When modified, update browserClickWait.test.ts.
14
+ */
15
+
16
+ import {armClickGuard, withoutClickGuard} from './clickGuard';
17
+ import {subscribeInput} from './inputStream';
18
+
19
+ /**
20
+ * How long a tap's lift waits for the browser's own click, ms. The browser
21
+ * sends that click with the lift when the page has no double-tap delay. The
22
+ * wait runs out for a lift that the browser does not count as a click, such
23
+ * as a hold. It also runs out when a busy main thread holds the click back.
24
+ */
25
+ export const BROWSER_CLICK_WAIT_MS = 300;
26
+
27
+ /** What a control does when the browser's click comes, or does not. */
28
+ export interface BrowserClickWaitHandlers {
29
+ /** The browser's click ran its handlers. `isCancelled`: one cancelled it. */
30
+ readonly onClicked: (isCancelled: boolean) => void;
31
+ /** No browser click came in time. */
32
+ readonly onNoClick: () => void;
33
+ }
34
+
35
+ /**
36
+ * Waits for the browser's own click inside `target` after a tap's lift. That
37
+ * click is the activation: `onClicked` runs once its handlers have run. With
38
+ * no click in time, `onNoClick` runs. The returned call ends the wait at once
39
+ * and leaves no listener or timer behind.
40
+ */
41
+ export function awaitBrowserClick(
42
+ target: Element,
43
+ {onClicked, onNoClick}: BrowserClickWaitHandlers,
44
+ ): () => void {
45
+ const view = target.ownerDocument.defaultView;
46
+ if (view == null) {
47
+ // A document with no window gets no click: the wait runs out at once.
48
+ let isEnded = false;
49
+ queueMicrotask(() => {
50
+ if (!isEnded) {
51
+ onNoClick();
52
+ }
53
+ });
54
+ return () => {
55
+ isEnded = true;
56
+ };
57
+ }
58
+ let isDone = false;
59
+ let report: number | null = null;
60
+ let timer: number | null = null;
61
+ let stopListening: (() => void) | null = null;
62
+ const stop = () => {
63
+ isDone = true;
64
+ stopListening?.();
65
+ stopListening = null;
66
+ if (timer != null) {
67
+ view.clearTimeout(timer);
68
+ timer = null;
69
+ }
70
+ };
71
+ stopListening = subscribeInput(view, 'click', event => {
72
+ if (
73
+ isDone ||
74
+ !event.isTrusted ||
75
+ !target.contains(event.target as Node | null)
76
+ ) {
77
+ return;
78
+ }
79
+ stop();
80
+ // After every handler has run: was it cancelled?
81
+ report = view.setTimeout(() => {
82
+ report = null;
83
+ onClicked(event.defaultPrevented);
84
+ }, 0);
85
+ });
86
+ timer = view.setTimeout(() => {
87
+ if (isDone) {
88
+ return;
89
+ }
90
+ stop();
91
+ onNoClick();
92
+ }, BROWSER_CLICK_WAIT_MS);
93
+ return () => {
94
+ stop();
95
+ if (report != null) {
96
+ view.clearTimeout(report);
97
+ report = null;
98
+ }
99
+ };
100
+ }
101
+
102
+ /**
103
+ * Click `element` (its own `click()`, so its activation behavior and every
104
+ * handler run as for any click) and report whether a handler cancelled it.
105
+ * The event is read from a capture listener that exists only for the call.
106
+ */
107
+ export function clickAndReport(element: HTMLElement): boolean {
108
+ const view = element.ownerDocument.defaultView;
109
+ let clicked: Event | null = null;
110
+ const grab = (event: Event) => {
111
+ if (clicked == null && event.target === element) {
112
+ clicked = event;
113
+ }
114
+ };
115
+ view?.addEventListener('click', grab, true);
116
+ try {
117
+ element.click();
118
+ } finally {
119
+ view?.removeEventListener('click', grab, true);
120
+ }
121
+ return (clicked as Event | null)?.defaultPrevented === true;
122
+ }
123
+
124
+ /**
125
+ * Clicks `element` for a lift the control decided itself, and reports
126
+ * whether a handler cancelled the click. The shared click guard swallows the
127
+ * browser's own click for the same lift, if it comes later, so the lift
128
+ * activates once.
129
+ */
130
+ export function clickForLift(element: HTMLElement): boolean {
131
+ armClickGuard(element.ownerDocument);
132
+ return withoutClickGuard(() => clickAndReport(element));
133
+ }
@@ -21,6 +21,11 @@
21
21
  // page adds later (AST-057, AST-094). If only the gesture host arms it, the
22
22
  // click listener stays only while the guard is armed.
23
23
  //
24
+ // An arm at a claimed touch's lift also takes that touch's late `mousedown`
25
+ // and `mouseup`. WebKit sends them a few ms after a held tap's cancelled
26
+ // `touchend`, aimed at whatever is under the finger by then. They go with
27
+ // the click, the next `pointerdown` or the window, as the guard does.
28
+ //
24
29
  // Some clicks always pass:
25
30
  // - a click with `detail` 0: a keyboard's, a screen reader's, or one that the
26
31
  // page dispatches;
@@ -45,6 +50,12 @@ export interface ClickGuardOptions {
45
50
  * @default false
46
51
  */
47
52
  readonly staysInstalled?: boolean;
53
+ /**
54
+ * The gesture host's arm at a claimed touch's lift: the guard also takes
55
+ * that touch's late `mousedown` and `mouseup` while it is armed.
56
+ * @default false
57
+ */
58
+ readonly takesLateMouse?: boolean;
48
59
  }
49
60
 
50
61
  interface Guard {
@@ -78,7 +89,7 @@ function listenForClicks(view: Window): () => void {
78
89
  /** Swallow the browser's next click on `doc` (see the file header). */
79
90
  export function armClickGuard(
80
91
  doc: Document,
81
- {staysInstalled = false}: ClickGuardOptions = {},
92
+ {staysInstalled = false, takesLateMouse = false}: ClickGuardOptions = {},
82
93
  ): void {
83
94
  const view = doc.defaultView;
84
95
  if (view == null) {
@@ -98,6 +109,13 @@ export function armClickGuard(
98
109
  // The next press is a new gesture: its click must never be eaten.
99
110
  subscribeInput(view, 'pointerdown', () => disarmClickGuard(doc)),
100
111
  );
112
+ if (takesLateMouse) {
113
+ for (const type of ['mousedown', 'mouseup'] as const) {
114
+ guard.unsubscribers.push(
115
+ subscribeInput(view, type, swallowLateMouse, {cancels: true}),
116
+ );
117
+ }
118
+ }
101
119
  guard.timer = setTimeout(() => disarmClickGuard(doc), CLICK_GUARD_WINDOW_MS);
102
120
  }
103
121
 
@@ -149,6 +167,15 @@ export function __resetClickGuardForTest(): void {
149
167
  }
150
168
  }
151
169
 
170
+ /** Swallows a claimed touch's late `mousedown` or `mouseup`. */
171
+ function swallowLateMouse(event: MouseEvent): void {
172
+ if (isExempt(event)) {
173
+ return;
174
+ }
175
+ event.preventDefault();
176
+ event.stopImmediatePropagation();
177
+ }
178
+
152
179
  function isExempt(event: MouseEvent): boolean {
153
180
  if (event.detail === 0 || unguardedDepth > 0) {
154
181
  return true;
@@ -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, {