@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,186 @@
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.js";
18
+ import { SWITCH_THUMB_MOVE_SPRING } from "./springs.js";
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: {
64
+ response: 0.23,
65
+ dampingRatio: 0.55
66
+ },
67
+ /**
68
+ * The settle after the finger lifts: the lens shrinking back to
69
+ * `thumbSize` while the white fill returns over the glass.
70
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
71
+ * iPhone 17 Pro, the lens's spring settings read on a tap (damping 0.7,
72
+ * response 0.5); per-frame lens bounds after the lift of a 1 s hold fit
73
+ * one spring at 0.49 / 0.70 (rms 0.065 pt; the opacities undershoot by
74
+ * the same 4.5 %), Oct 23 2026
75
+ */
76
+ settle: {
77
+ response: 0.5,
78
+ dampingRatio: 0.7
79
+ },
80
+ /**
81
+ * The settle never starts sooner than this after the lift began, so a
82
+ * quick tap still shows the lifted lens, in ms.
83
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
84
+ * iPhone 17 Pro, a 50 ms tap: the lift→settle hand-off fitted at 235 ms
85
+ * after the lift began (rms 0.33 pt), Oct 23 2026
86
+ * @measure M-SW07
87
+ */
88
+ minimumLiftMs: 235,
89
+ /**
90
+ * The thumb travelling to the committed end after a release or a
91
+ * programmatic change. It starts from the thumb's own velocity.
92
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
93
+ * iPhone 17 Pro, the lens's position behavior read on a tap (damping 1,
94
+ * response 0.3); the lens center after a 50 ms tap and after a 1 s hold
95
+ * fits one spring at 0.31 / 1 (rms 0.11 pt), Oct 23 2026; the springs
96
+ * table's `SWITCH_THUMB_MOVE_SPRING` holds the one value
97
+ */
98
+ travel: SWITCH_THUMB_MOVE_SPRING,
99
+ /**
100
+ * During a drag the thumb chases the finger: each move retargets this
101
+ * spring at the finger's position, rubber-banded past either end.
102
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
103
+ * iPhone 17 Pro, a 4 s drag off → on → past both ends: the lens center
104
+ * simulated as this spring chasing the rubber-banded finger fits every
105
+ * frame (rms 0.21 pt), Oct 23 2026
106
+ */
107
+ tracking: {
108
+ response: 0.36,
109
+ dampingRatio: 1
110
+ },
111
+ /**
112
+ * The drag's rubber band past either end: UIScrollView's
113
+ * `(1 − 1 ÷ (x·c ÷ d + 1))·d`. The coefficient c and the dimension d are in
114
+ * pt for the 28 pt control. Scale d with the track height.
115
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
116
+ * iPhone 17 Pro, the same drag fit: c 0.55, d 11.75–12 pt, the
117
+ * translation measured from where the finger landed, Oct 23 2026
118
+ */
119
+ rubberBand: {
120
+ coefficient: 0.55,
121
+ dimension: 12
122
+ },
123
+ /**
124
+ * A drag flips the switch by the finger, not the thumb. Once the finger is
125
+ * this far from where it landed, toward the other end, the switch shows
126
+ * the other side. The distance is the track width minus the thumb width
127
+ * (63 − 37 pt). Back past where it landed, the starting side shows again.
128
+ * Flips happen on touch events only, so a fast swipe flips on the lift.
129
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
130
+ * iPhone 17 Pro, `UISwitchModernVisualElement` ivars per frame and the
131
+ * "SwitchWellPosition" springs during 1 pt-step drags: the same 26 pt for
132
+ * presses at x 8, 20.5 and 45, with and without a 400 ms hold, mirrored
133
+ * on an on switch; flipping back at the press point, Oct 23 2026
134
+ */
135
+ flipDistance: 26,
136
+ /**
137
+ * The track color turning on: the well image sliding in on a critically
138
+ * damped spring, starting when the switch flips (the lift of a tap).
139
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
140
+ * iPhone 17 Pro, `CASpringAnimation` "SwitchWellPosition" read: mass 1,
141
+ * stiffness 85.377, damping 18.480 (response 0.68 s), Oct 23 2026
142
+ */
143
+ wellOn: {
144
+ mass: 1,
145
+ stiffness: 85.37720070146501,
146
+ damping: 18.47995678582231
147
+ },
148
+ /**
149
+ * The track color turning off: the same well sliding back, faster.
150
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
151
+ * iPhone 17 Pro, `CASpringAnimation` "SwitchWellPosition" read: mass 1,
152
+ * stiffness 246.740, damping 31.416 (response 0.40 s), Oct 23 2026
153
+ */
154
+ wellOff: {
155
+ mass: 1,
156
+ stiffness: 246.74011002723395,
157
+ damping: 31.41592653589793
158
+ },
159
+ /**
160
+ * The lifted lens's drop shadow: y offset and radius in pt, then black
161
+ * alpha; none at rest.
162
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
163
+ * iPhone 17 Pro, the lens layer's presented `shadowOffset` (0, 7),
164
+ * `shadowRadius` 3, `shadowOpacity` 0.12 once lifted, 0 at rest,
165
+ * Oct 23 2026
166
+ */
167
+ liftedShadow: [7, 3, 0.12],
168
+ /**
169
+ * UISwitch plays no haptic on a tap, a hold or a drag.
170
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
171
+ * iPhone 17 Pro, every `UIFeedbackGenerator` entry point hooked: no call
172
+ * on tap, hold, drag or flip, Oct 23 2026
173
+ */
174
+ haptic: 'none'
175
+ };
176
+
177
+ /**
178
+ * Registers the switch table's motion roles as internal roles. Nothing
179
+ * registers on import: Switch's touch presentation calls it once before its
180
+ * first animation, and a second call does nothing.
181
+ */
182
+ export function registerSwitchTable() {
183
+ registerMotionTable('switchControl', switchControl, {
184
+ roles: ['lift', 'settle', 'travel', 'tracking', 'wellOn', 'wellOff', 'minimumLiftMs']
185
+ });
186
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @file privateAttributes/pressHoldsDrag.stylex.ts
3
+ * @input Whether a pressable's own drag moves under the finger
4
+ * @output pressHoldsDragProps, which marks such a pressable, and
5
+ * holdsPressThroughDrag, which reads the mark
6
+ * @position Owner module of the private press-holds-drag attribute: the only
7
+ * file that writes its name. Switch marks its row; the press controller
8
+ * (utils/pressFeedback.ts) keeps the press painted through that row's
9
+ * drag. No package entry exports it.
10
+ */
11
+ /**
12
+ * Spread on a pressable whose own drag the finger moves, such as a Switch's
13
+ * thumb. The drag is not a scroll, so the press stays painted.
14
+ */
15
+ export declare function pressHoldsDragProps(holdsDrag: boolean): Readonly<Record<string, string>>;
16
+ /** Whether the press on `element` stays painted through its drag. */
17
+ export declare function holdsPressThroughDrag(element: Element): boolean;
18
+ //# sourceMappingURL=pressHoldsDrag.stylex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pressHoldsDrag.stylex.d.ts","sourceRoot":"","sources":["../../src/privateAttributes/pressHoldsDrag.stylex.ts"],"names":[],"mappings":"AACA;;;;;;;;;GASG;AAIH;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,OAAO,GACjB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAElC;AAED,qEAAqE;AACrE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAE/D"}
@@ -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(holdsDrag) {
20
+ return holdsDrag ? {
21
+ [PRESS_HOLDS_DRAG]: ''
22
+ } : {};
23
+ }
24
+
25
+ /** Whether the press on `element` stays painted through its drag. */
26
+ export function holdsPressThroughDrag(element) {
27
+ return element.hasAttribute(PRESS_HOLDS_DRAG);
28
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"pressFeedback.d.ts","sourceRoot":"","sources":["../../src/utils/pressFeedback.ts"],"names":[],"mappings":"AAgDA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,qDAAqD;AACrD,eAAO,MAAM,cAAc,EAAE;IAAC,QAAQ,CAAC,CAAC,mBAAmB,CAAC,EAAE,EAAE,CAAA;CAE/D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAwnB5C;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,IAAI,CA0BjD"}
1
+ {"version":3,"file":"pressFeedback.d.ts","sourceRoot":"","sources":["../../src/utils/pressFeedback.ts"],"names":[],"mappings":"AAiDA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,qDAAqD;AACrD,eAAO,MAAM,cAAc,EAAE;IAAC,QAAQ,CAAC,CAAC,mBAAmB,CAAC,EAAE,EAAE,CAAA;CAE/D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AA4nB5C;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,IAAI,CA0BjD"}
@@ -37,6 +37,7 @@ import { idlePressGesture, PRESS_FADE_MS, PRESS_FLASH_MS, PRESS_ONSET_MS, PRESS_
37
37
  import { isCoarsePointer, watchCoarsePointer } from "./coarsePointer.js";
38
38
  import { subscribeInput } from "./inputStream.js";
39
39
  import { TOUCH_QUERY } from "./touchPresentation.js";
40
+ import { holdsPressThroughDrag } from "../privateAttributes/pressHoldsDrag.stylex.js";
40
41
 
41
42
  /**
42
43
  * The marker the controller finds with `closest()`. Every Astryx component
@@ -399,6 +400,10 @@ function onPointerMove(event) {
399
400
  if (live == null || live.pointerId != null && event.pointerId !== live.pointerId) {
400
401
  return;
401
402
  }
403
+ // The finger drags the surface's own control: its travel keeps the press.
404
+ if (holdsPressThroughDrag(live.element)) {
405
+ return;
406
+ }
402
407
  apply(finger, pressGestureStep(live.gesture, {
403
408
  kind: 'move',
404
409
  x: event.clientX,
@@ -10,4 +10,47 @@ export declare function locksSelectionFor(pointerType: string): boolean;
10
10
  * any holder holds. Idempotent release.
11
11
  */
12
12
  export declare function lockSelection(elements: Iterable<Element>, target: EventTarget | null): () => void;
13
+ /** How a drag's selection hold ends: at a lift, or at a cancel. */
14
+ export interface DragSelectionReleaseOptions {
15
+ /**
16
+ * The press was cancelled (a pointercancel, a blur, a detach), so no
17
+ * mouseup or click follows: the hold ends at once. Called again after a
18
+ * lift, it ends the hold's last task at once too.
19
+ */
20
+ isCancel?: boolean;
21
+ }
22
+ /**
23
+ * Refuse a new selection while a mouse or pen drag that a recognizer claimed
24
+ * runs, until the returned function runs. `kept` is the page's selection
25
+ * when the press began, and it stays. Anything that replaces it while the
26
+ * drag runs is put back to it. That includes the press's own collapse and a
27
+ * selection the drag started before its claim. So the drag takes no new
28
+ * selection and never clears an existing one. `elements` refuse a
29
+ * selection with inline styles, on every engine. The document refuses one
30
+ * too, because WebKit extends a drag's selection over text outside the
31
+ * elements without another `selectstart`. So a `selectstart` anywhere is
32
+ * refused, and the selection is put back. A `selectstart` does not leave its
33
+ * shadow tree. So the document refuses only one that starts outside every
34
+ * shadow tree, and a claiming element inside one refuses its own. The
35
+ * press's own `mouseup` and `click` come after its `pointerup` in the same
36
+ * task, and WebKit settles the drag's selection there. So the document's
37
+ * hold ends a task after a lift. A cancel ends it at once, because nothing
38
+ * follows a cancel. `onReleased` runs once the document's hold has ended.
39
+ * The page listeners exist only during a press. Idempotent.
40
+ */
41
+ export declare function lockDragSelection(elements: Iterable<Element>, view: Window | null | undefined, kept: ReadonlyArray<AbstractRange>, onReleased?: () => void): (options?: DragSelectionReleaseOptions) => void;
42
+ /**
43
+ * The page's selection now, its ranges copied; none for a collapsed or empty
44
+ * one. A drag's hold keeps what this read when the press began.
45
+ */
46
+ export declare function selectionRangesOf(view: Window | null | undefined): ReadonlyArray<AbstractRange>;
47
+ /**
48
+ * Whether a press at (`x`, `y`) lands on text a drag would select. That is a
49
+ * text field, or a character of non-empty text whose element allows a
50
+ * selection. A native button's label, slotted or not, is not selectable text,
51
+ * because the engine starts no selection from a drag inside a button. A point
52
+ * beside text, which a caret query snaps to the nearest character, lands on
53
+ * none. Where the engine has no caret query, nothing is selectable text.
54
+ */
55
+ export declare function startsOnSelectableText(doc: Document, x: number, y: number, target: EventTarget | null): boolean;
13
56
  //# sourceMappingURL=selectionLock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"selectionLock.d.ts","sourceRoot":"","sources":["../../src/utils/selectionLock.ts"],"names":[],"mappings":"AAkDA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAE9D;AAWD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,EAC3B,MAAM,EAAE,WAAW,GAAG,IAAI,GACzB,MAAM,IAAI,CAyEZ"}
1
+ {"version":3,"file":"selectionLock.d.ts","sourceRoot":"","sources":["../../src/utils/selectionLock.ts"],"names":[],"mappings":"AAoDA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAE9D;AAWD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,EAC3B,MAAM,EAAE,WAAW,GAAG,IAAI,GACzB,MAAM,IAAI,CA4BZ;AAED,mEAAmE;AACnE,MAAM,WAAW,2BAA2B;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,EAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,IAAI,EAAE,aAAa,CAAC,aAAa,CAAC,EAClC,UAAU,CAAC,EAAE,MAAM,IAAI,GACtB,CAAC,OAAO,CAAC,EAAE,2BAA2B,KAAK,IAAI,CA+EjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC9B,aAAa,CAAC,aAAa,CAAC,CAiB9B;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,QAAQ,EACb,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,MAAM,EAAE,WAAW,GAAG,IAAI,GACzB,OAAO,CA+CT"}