@astryxdesign/core 0.7.8 → 0.7.9-canary.048476f

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 (213) hide show
  1. package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
  2. package/dist/BottomSheet/BottomSheet.js +5 -0
  3. package/dist/Calendar/styles.d.ts +1 -1
  4. package/dist/ClickableCard/ClickableCard.d.ts +1 -1
  5. package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
  6. package/dist/ClickableCard/ClickableCard.js +5 -1
  7. package/dist/DateInput/PickerWheel.d.ts.map +1 -1
  8. package/dist/DateInput/PickerWheel.js +7 -1
  9. package/dist/DateRangeInput/DateRangeInput.js +1 -1
  10. package/dist/Dialog/Dialog.d.ts +2 -1
  11. package/dist/Dialog/Dialog.d.ts.map +1 -1
  12. package/dist/Dialog/Dialog.js +12 -1
  13. package/dist/Drawer/useDrawerDialogPresence.d.ts +2 -1
  14. package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
  15. package/dist/Drawer/useDrawerDialogPresence.js +11 -2
  16. package/dist/DropdownMenu/DropdownMenu.d.ts +9 -1
  17. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  18. package/dist/DropdownMenu/DropdownMenu.js +9 -4
  19. package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
  20. package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +3 -2
  21. package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
  22. package/dist/DropdownMenu/DropdownMenuItem.js +3 -2
  23. package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
  24. package/dist/DropdownMenu/DropdownMenuRadioItem.js +3 -2
  25. package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
  26. package/dist/DropdownMenu/DropdownMenuSubMenu.js +3 -2
  27. package/dist/Field/inputDisabledFocus.d.ts +4 -4
  28. package/dist/Field/inputStyles.stylex.d.ts +1 -1
  29. package/dist/FileInput/FileInput.d.ts.map +1 -1
  30. package/dist/FileInput/FileInput.js +16 -2
  31. package/dist/Icon/Icon.d.ts +1 -1
  32. package/dist/InfoTip/InfoTip.d.ts +1 -0
  33. package/dist/InfoTip/InfoTip.d.ts.map +1 -1
  34. package/dist/InfoTip/InfoTip.js +1 -0
  35. package/dist/Item/Item.d.ts +2 -1
  36. package/dist/Item/Item.d.ts.map +1 -1
  37. package/dist/Item/Item.js +29 -6
  38. package/dist/Layer/holdEntranceInput.d.ts +24 -0
  39. package/dist/Layer/holdEntranceInput.d.ts.map +1 -0
  40. package/dist/Layer/holdEntranceInput.js +65 -0
  41. package/dist/Layer/inputHold.d.ts +49 -0
  42. package/dist/Layer/inputHold.d.ts.map +1 -0
  43. package/dist/Layer/inputHold.js +636 -0
  44. package/dist/Layer/preserveAnimations.d.ts +1 -5
  45. package/dist/Layer/preserveAnimations.d.ts.map +1 -1
  46. package/dist/Layer/preserveAnimations.js +12 -214
  47. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  48. package/dist/Lightbox/Lightbox.js +4 -0
  49. package/dist/MetadataList/MetadataList.js +1 -1
  50. package/dist/MobileNav/MobileNav.d.ts +11 -1
  51. package/dist/MobileNav/MobileNav.d.ts.map +1 -1
  52. package/dist/MobileNav/MobileNav.js +34 -1
  53. package/dist/MoreMenu/MoreMenu.d.ts +5 -3
  54. package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
  55. package/dist/RadioList/RadioListItem.d.ts.map +1 -1
  56. package/dist/RadioList/RadioListItem.js +4 -1
  57. package/dist/SelectableCard/SelectableCard.d.ts +1 -1
  58. package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
  59. package/dist/SelectableCard/SelectableCard.js +5 -1
  60. package/dist/Spinner/Spinner.d.ts.map +1 -1
  61. package/dist/Spinner/Spinner.js +12 -2
  62. package/dist/Table/plugins/sortable/useTableSortable.js +1 -1
  63. package/dist/Token/Token.d.ts.map +1 -1
  64. package/dist/Token/Token.js +9 -0
  65. package/dist/Token/TokenLink.d.ts +1 -1
  66. package/dist/Token/TokenLink.d.ts.map +1 -1
  67. package/dist/Token/TokenLink.js +4 -1
  68. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  69. package/dist/Tooltip/useTooltip.js +162 -59
  70. package/dist/TreeList/TreeListItem.d.ts +2 -1
  71. package/dist/TreeList/TreeListItem.d.ts.map +1 -1
  72. package/dist/TreeList/TreeListItem.js +27 -3
  73. package/dist/astryx.css +30 -7
  74. package/dist/gestures/GestureHost.d.ts +2 -2
  75. package/dist/gestures/GestureHost.d.ts.map +1 -1
  76. package/dist/gestures/GestureHost.js +21 -6
  77. package/dist/gestures/nativeScroll.d.ts +3 -6
  78. package/dist/gestures/nativeScroll.d.ts.map +1 -1
  79. package/dist/gestures/nativeScroll.js +7 -52
  80. package/dist/gestures/wheelSegmenter.d.ts +68 -1
  81. package/dist/gestures/wheelSegmenter.d.ts.map +1 -1
  82. package/dist/gestures/wheelSegmenter.js +199 -10
  83. package/dist/hooks/menuPressGesture.d.ts +133 -21
  84. package/dist/hooks/menuPressGesture.d.ts.map +1 -1
  85. package/dist/hooks/menuPressGesture.js +155 -30
  86. package/dist/hooks/menuPressValues.d.ts +16 -0
  87. package/dist/hooks/menuPressValues.d.ts.map +1 -0
  88. package/dist/hooks/menuPressValues.js +18 -0
  89. package/dist/hooks/useClickableContainer.d.ts +27 -5
  90. package/dist/hooks/useClickableContainer.d.ts.map +1 -1
  91. package/dist/hooks/useClickableContainer.js +41 -5
  92. package/dist/hooks/useFocusTrap.d.ts +10 -0
  93. package/dist/hooks/useFocusTrap.d.ts.map +1 -1
  94. package/dist/hooks/useFocusTrap.js +225 -132
  95. package/dist/hooks/useMenuPress.d.ts +34 -1
  96. package/dist/hooks/useMenuPress.d.ts.map +1 -1
  97. package/dist/hooks/useMenuPress.js +93 -5
  98. package/dist/hooks/usePressFeedback.d.ts +6 -6
  99. package/dist/hooks/usePressFeedback.js +6 -6
  100. package/dist/motion/carryAnimations.d.ts +58 -0
  101. package/dist/motion/carryAnimations.d.ts.map +1 -0
  102. package/dist/motion/carryAnimations.js +305 -0
  103. package/dist/motion/transientCopy.d.ts +4 -2
  104. package/dist/motion/transientCopy.d.ts.map +1 -1
  105. package/dist/motion/transientCopy.js +34 -5
  106. package/dist/motion/uikit/gestures.d.ts +41 -0
  107. package/dist/motion/uikit/gestures.d.ts.map +1 -1
  108. package/dist/motion/uikit/gestures.js +25 -0
  109. package/dist/motion/uikit/index.d.ts +1 -1
  110. package/dist/motion/uikit/index.d.ts.map +1 -1
  111. package/dist/motion/uikit/index.js +1 -1
  112. package/dist/privateAttributes/menuPressLit.stylex.d.ts +52 -0
  113. package/dist/privateAttributes/menuPressLit.stylex.d.ts.map +1 -0
  114. package/dist/privateAttributes/menuPressLit.stylex.js +99 -0
  115. package/dist/privateAttributes/press.stylex.d.ts +139 -0
  116. package/dist/privateAttributes/press.stylex.d.ts.map +1 -0
  117. package/dist/privateAttributes/press.stylex.js +98 -0
  118. package/dist/theme/tokens.stylex.d.ts +2 -2
  119. package/dist/theme/tokens.stylex.js +1 -1
  120. package/dist/utils/flatTree.d.ts +6 -3
  121. package/dist/utils/flatTree.d.ts.map +1 -1
  122. package/dist/utils/flatTree.js +13 -3
  123. package/dist/utils/hitArea.d.ts.map +1 -1
  124. package/dist/utils/hitArea.js +82 -5
  125. package/dist/utils/inputStream.d.ts +14 -1
  126. package/dist/utils/inputStream.d.ts.map +1 -1
  127. package/dist/utils/inputStream.js +40 -9
  128. package/dist/utils/interactionOverlay.stylex.d.ts +2 -1
  129. package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
  130. package/dist/utils/interactionOverlay.stylex.js +7 -2
  131. package/dist/utils/pressFeedback.d.ts +7 -0
  132. package/dist/utils/pressFeedback.d.ts.map +1 -1
  133. package/dist/utils/pressFeedback.js +32 -7
  134. package/dist/utils/pressGesture.d.ts +6 -0
  135. package/dist/utils/pressGesture.d.ts.map +1 -1
  136. package/dist/utils/pressGesture.js +17 -0
  137. package/dist/utils/rowPressLayer.stylex.d.ts +14 -0
  138. package/dist/utils/rowPressLayer.stylex.d.ts.map +1 -0
  139. package/dist/utils/rowPressLayer.stylex.js +25 -0
  140. package/dist/utils/scrollView.d.ts +25 -0
  141. package/dist/utils/scrollView.d.ts.map +1 -0
  142. package/dist/utils/scrollView.js +108 -0
  143. package/dist/utils/selectionLock.d.ts.map +1 -1
  144. package/dist/utils/selectionLock.js +1 -10
  145. package/dist/utils/triggerFocus.d.ts +5 -0
  146. package/dist/utils/triggerFocus.d.ts.map +1 -1
  147. package/dist/utils/triggerFocus.js +9 -2
  148. package/package.json +5 -5
  149. package/src/BottomSheet/BottomSheet.tsx +5 -0
  150. package/src/ClickableCard/ClickableCard.tsx +8 -1
  151. package/src/DateInput/PickerWheel.tsx +7 -2
  152. package/src/DateRangeInput/DateRangeInput.tsx +1 -1
  153. package/src/Dialog/Dialog.doc.mjs +1 -1
  154. package/src/Dialog/Dialog.tsx +12 -1
  155. package/src/Drawer/Drawer.doc.mjs +1 -1
  156. package/src/Drawer/useDrawerDialogPresence.ts +9 -2
  157. package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -2
  158. package/src/DropdownMenu/DropdownMenu.tsx +29 -5
  159. package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +5 -1
  160. package/src/DropdownMenu/DropdownMenuItem.tsx +8 -4
  161. package/src/DropdownMenu/DropdownMenuRadioItem.tsx +5 -1
  162. package/src/DropdownMenu/DropdownMenuSubMenu.tsx +5 -1
  163. package/src/FileInput/FileInput.tsx +16 -2
  164. package/src/InfoTip/InfoTip.doc.mjs +26 -2
  165. package/src/InfoTip/InfoTip.tsx +1 -0
  166. package/src/Item/Item.tsx +51 -9
  167. package/src/Layer/holdEntranceInput.ts +84 -0
  168. package/src/Layer/inputHold.ts +734 -0
  169. package/src/Layer/preserveAnimations.ts +12 -275
  170. package/src/Lightbox/Lightbox.tsx +4 -0
  171. package/src/MetadataList/MetadataList.tsx +1 -1
  172. package/src/MobileNav/MobileNav.doc.mjs +3 -3
  173. package/src/MobileNav/MobileNav.tsx +34 -1
  174. package/src/MoreMenu/MoreMenu.doc.mjs +2 -4
  175. package/src/MoreMenu/MoreMenu.tsx +5 -3
  176. package/src/RadioList/RadioListItem.tsx +4 -5
  177. package/src/SelectableCard/SelectableCard.tsx +8 -1
  178. package/src/Spinner/Spinner.tsx +13 -3
  179. package/src/Table/plugins/sortable/useTableSortable.tsx +1 -1
  180. package/src/Token/Token.tsx +18 -1
  181. package/src/Token/TokenLink.tsx +7 -1
  182. package/src/Tooltip/useTooltip.tsx +175 -79
  183. package/src/TreeList/TreeListItem.tsx +36 -2
  184. package/src/gestures/GestureHost.ts +21 -5
  185. package/src/gestures/README.md +12 -4
  186. package/src/gestures/nativeScroll.ts +12 -68
  187. package/src/gestures/wheelSegmenter.ts +243 -10
  188. package/src/hooks/menuPressGesture.ts +244 -38
  189. package/src/hooks/menuPressValues.ts +18 -0
  190. package/src/hooks/useClickableContainer.doc.mjs +8 -2
  191. package/src/hooks/useClickableContainer.ts +72 -6
  192. package/src/hooks/useFocusTrap.ts +268 -151
  193. package/src/hooks/useMenuPress.ts +118 -11
  194. package/src/hooks/usePressFeedback.doc.mjs +3 -3
  195. package/src/hooks/usePressFeedback.ts +6 -6
  196. package/src/motion/MEASUREMENTS.md +11 -0
  197. package/src/motion/carryAnimations.ts +389 -0
  198. package/src/motion/transientCopy.ts +45 -5
  199. package/src/motion/uikit/gestures.ts +22 -0
  200. package/src/motion/uikit/index.ts +1 -0
  201. package/src/privateAttributes/menuPressLit.stylex.ts +104 -0
  202. package/src/privateAttributes/press.stylex.ts +244 -0
  203. package/src/theme/tokens.stylex.ts +1 -1
  204. package/src/utils/flatTree.ts +15 -3
  205. package/src/utils/hitArea.ts +107 -5
  206. package/src/utils/inputStream.ts +47 -10
  207. package/src/utils/interactionOverlay.stylex.ts +7 -2
  208. package/src/utils/pressFeedback.ts +31 -6
  209. package/src/utils/pressGesture.ts +24 -1
  210. package/src/utils/rowPressLayer.stylex.ts +27 -0
  211. package/src/utils/scrollView.ts +135 -0
  212. package/src/utils/selectionLock.ts +5 -10
  213. package/src/utils/triggerFocus.ts +17 -4
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * @file flatTree.ts
3
3
  * @input A DOM node
4
- * @output Exports parentAcrossShadow, and containsAlongFlatTree, which walks it
4
+ * @output Exports parentAcrossShadow, containsAlongFlatTree, which walks it,
5
+ * and deepActiveElement
5
6
  * @position The flat-tree parent the browser scrolls and dispatches
6
- * through, shared by the gesture host's native-scroll probe and the
7
+ * through, shared by the gesture host's native-scroll probe, the
7
8
  * selection lock (which the press feedback controller uses without the
8
- * gesture system)
9
+ * gesture system) and the Layer module's input hold
9
10
  */
10
11
  /** The node's parent, crossing out of shadow roots. */
11
12
  export declare function parentAcrossShadow(node: Node): Node | null;
@@ -14,4 +15,6 @@ export declare function parentAcrossShadow(node: Node): Node | null;
14
15
  * shadow root to its host, which `Node.contains` does not follow.
15
16
  */
16
17
  export declare function containsAlongFlatTree(ancestor: Node, node: Node): boolean;
18
+ /** The focused element of `doc`, inside open shadow roots too. */
19
+ export declare function deepActiveElement(doc: Document | null | undefined): Element | null;
17
20
  //# sourceMappingURL=flatTree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flatTree.d.ts","sourceRoot":"","sources":["../../src/utils/flatTree.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,uDAAuD;AACvD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAa1D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAOzE"}
1
+ {"version":3,"file":"flatTree.d.ts","sourceRoot":"","sources":["../../src/utils/flatTree.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,uDAAuD;AACvD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAa1D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAOzE;AAED,kEAAkE;AAClE,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,GAC/B,OAAO,GAAG,IAAI,CAMhB"}
@@ -3,11 +3,12 @@
3
3
  /**
4
4
  * @file flatTree.ts
5
5
  * @input A DOM node
6
- * @output Exports parentAcrossShadow, and containsAlongFlatTree, which walks it
6
+ * @output Exports parentAcrossShadow, containsAlongFlatTree, which walks it,
7
+ * and deepActiveElement
7
8
  * @position The flat-tree parent the browser scrolls and dispatches
8
- * through, shared by the gesture host's native-scroll probe and the
9
+ * through, shared by the gesture host's native-scroll probe, the
9
10
  * selection lock (which the press feedback controller uses without the
10
- * gesture system)
11
+ * gesture system) and the Layer module's input hold
11
12
  */
12
13
 
13
14
  /** The node's parent, crossing out of shadow roots. */
@@ -35,4 +36,13 @@ export function containsAlongFlatTree(ancestor, node) {
35
36
  }
36
37
  }
37
38
  return false;
39
+ }
40
+
41
+ /** The focused element of `doc`, inside open shadow roots too. */
42
+ export function deepActiveElement(doc) {
43
+ let active = doc?.activeElement ?? null;
44
+ while (active?.shadowRoot?.activeElement != null) {
45
+ active = active.shadowRoot.activeElement;
46
+ }
47
+ return active;
38
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hitArea.d.ts","sourceRoot":"","sources":["../../src/utils/hitArea.ts"],"names":[],"mappings":"AA6BA,+BAA+B;AAC/B,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CAC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3C;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,EACrC,EAAC,OAA0B,EAAC,GAAE,mBAAwB,GACrD,MAAM,IAAI,CAyDZ"}
@@ -24,6 +24,9 @@
24
24
  // live control measures: only under a coarse primary pointer (AST-094), only on
25
25
  // screen, and in one read pass per frame within a 4 ms budget. Until the first
26
26
  // pass the insets are 0, so first paint never overlaps anything.
27
+ // The insets are lengths in the control's own box, so a pass measures in its
28
+ // layout px. A layer that opens from a smaller scale then keeps the insets of
29
+ // the size it settles at.
27
30
  import { observeContent } from "./sharedMutationObserver.js";
28
31
 
29
32
  /** A rect in client pixels. */
@@ -263,6 +266,74 @@ function plainRect(element) {
263
266
  bottom
264
267
  };
265
268
  }
269
+
270
+ /** A box that the transforms around it leave at its layout size. */
271
+ const UNSCALED = {
272
+ x: 1,
273
+ y: 1
274
+ };
275
+
276
+ /** One axis of a box's scale on screen: its client size over its layout size. */
277
+ function axisScale(onScreen, layout) {
278
+ if (!(layout > 0) || !(onScreen > 0)) {
279
+ return 1;
280
+ }
281
+ const scale = onScreen / layout;
282
+ // Within rounding of 1 the box is at its layout size: no change to the rects.
283
+ return Math.abs(scale - 1) < 1e-3 ? 1 : scale;
284
+ }
285
+
286
+ /**
287
+ * How far the transforms around `element` scale its box on screen, per axis.
288
+ * A layer that opens from a smaller scale scales every rect inside it, while
289
+ * the layout box keeps the size the layer settles at. Only a scale is
290
+ * expected: a rotated or skewed box would read as a larger scale.
291
+ */
292
+ function screenScale(element, onScreen) {
293
+ // The offset size is the layout size in whole pixels, unaffected by
294
+ // transforms, and costs no style resolution. A box with none, such as an SVG
295
+ // element or a jsdom box, reads as unscaled.
296
+ const box = element;
297
+ const offsetWidth = box.offsetWidth ?? 0;
298
+ const offsetHeight = box.offsetHeight ?? 0;
299
+ if (offsetWidth === 0 || offsetHeight === 0) {
300
+ return UNSCALED;
301
+ }
302
+ // Within a pixel of its layout size the box reads as unscaled, which bounds
303
+ // the inset error at about a pixel. Only a box that a transform shrinks or
304
+ // grows reads its exact size from the computed style.
305
+ if (Math.abs(onScreen.right - onScreen.left - offsetWidth) <= 1 && Math.abs(onScreen.bottom - onScreen.top - offsetHeight) <= 1) {
306
+ return UNSCALED;
307
+ }
308
+ const style = element.ownerDocument.defaultView?.getComputedStyle(element);
309
+ if (style == null || !style.width.endsWith('px')) {
310
+ return UNSCALED;
311
+ }
312
+ const px = value => Number.parseFloat(value) || 0;
313
+ const isContentBox = style.boxSizing !== 'border-box';
314
+ const width = px(style.width) + (isContentBox ? px(style.paddingLeft) + px(style.paddingRight) + px(style.borderLeftWidth) + px(style.borderRightWidth) : 0);
315
+ const height = px(style.height) + (isContentBox ? px(style.paddingTop) + px(style.paddingBottom) + px(style.borderTopWidth) + px(style.borderBottomWidth) : 0);
316
+ return {
317
+ x: axisScale(onScreen.right - onScreen.left, width),
318
+ y: axisScale(onScreen.bottom - onScreen.top, height)
319
+ };
320
+ }
321
+
322
+ /**
323
+ * `rect` in the layout px of the box at `origin`: its offset from `origin`,
324
+ * divided by that box's scale on screen.
325
+ */
326
+ function inLayout(rect, origin, scale) {
327
+ if (scale.x === 1 && scale.y === 1) {
328
+ return rect;
329
+ }
330
+ return {
331
+ left: origin.left + (rect.left - origin.left) / scale.x,
332
+ top: origin.top + (rect.top - origin.top) / scale.y,
333
+ right: origin.left + (rect.right - origin.left) / scale.x,
334
+ bottom: origin.top + (rect.bottom - origin.top) / scale.y
335
+ };
336
+ }
266
337
  /** The watched element `element` belongs to, if any (itself included). */
267
338
  function watchedOwner(element) {
268
339
  for (let node = element; node != null; node = node.parentElement) {
@@ -297,14 +368,15 @@ function readCandidates(doc) {
297
368
  /** A control's rect and clamped insets, from candidates already read. */
298
369
  function measureOne(watch, candidates) {
299
370
  const target = plainRect(watch.element);
371
+ const scale = screenScale(watch.element, target);
300
372
  // Two targets each growing up to half the minimum reach each other from a
301
373
  // minimum apart.
302
374
  const reach = Math.max(0, watch.minSize);
303
375
  const band = grown(target, {
304
- top: reach,
305
- right: reach,
306
- bottom: reach,
307
- left: reach
376
+ top: reach * scale.y,
377
+ right: reach * scale.x,
378
+ bottom: reach * scale.y,
379
+ left: reach * scale.x
308
380
  });
309
381
  const neighbours = candidates.filter(({
310
382
  element,
@@ -314,7 +386,12 @@ function measureOne(watch, candidates) {
314
386
  }) => rect);
315
387
  return {
316
388
  target,
317
- insets: clampedHitInsets(target, neighbours, watch.minSize),
389
+ // The insets are in the control's layout px. The returned rects stay in
390
+ // screen px for a touch's distance checks. A neighbour maps by the
391
+ // control's scale, as if it is in the same layer. A neighbour outside that
392
+ // layer then reads farther away. A touch compares screen distances, so it
393
+ // still counts that neighbour.
394
+ insets: clampedHitInsets(inLayout(target, target, scale), neighbours.map(rect => inLayout(rect, target, scale)), watch.minSize),
318
395
  neighbours
319
396
  };
320
397
  }
@@ -6,12 +6,25 @@ export interface InputSubscriptionOptions {
6
6
  * @default false
7
7
  */
8
8
  readonly cancels?: boolean;
9
+ /**
10
+ * The subscriber runs before every subscriber that is not first. When it
11
+ * returns `true`, no later subscriber hears the event.
12
+ * @default false
13
+ */
14
+ readonly first?: boolean;
9
15
  }
10
16
  /** The events a window's capture phase sees: its own, and the document's. */
11
17
  export type InputEventMap = WindowEventMap & DocumentEventMap;
18
+ /**
19
+ * The type of the latest pointer event `view`'s stream delivered: `mouse`,
20
+ * `pen` or `touch`, or `null` before any. The stream hears a pointer event
21
+ * type only while a subscriber listens to it, as press feedback does on any
22
+ * page with a pressable. Reading it adds no listener.
23
+ */
24
+ export declare function getLastPointerType(view: Window): string | null;
12
25
  /**
13
26
  * Listen to `type` on `view`'s capture phase through its shared native
14
27
  * listener. Returns the unsubscribe; calling it again does nothing.
15
28
  */
16
- export declare function subscribeInput<K extends keyof InputEventMap>(view: Window, type: K, listener: (event: InputEventMap[K]) => void, { cancels }?: InputSubscriptionOptions): () => void;
29
+ export declare function subscribeInput<K extends keyof InputEventMap>(view: Window, type: K, listener: (event: InputEventMap[K]) => unknown, { cancels, first }?: InputSubscriptionOptions): () => void;
17
30
  //# sourceMappingURL=inputStream.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inputStream.d.ts","sourceRoot":"","sources":["../../src/utils/inputStream.ts"],"names":[],"mappings":"AA4CA,0CAA0C;AAC1C,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,6EAA6E;AAC7E,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAI9D;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,aAAa,EAC1D,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3C,EAAC,OAAe,EAAC,GAAE,wBAA6B,GAC/C,MAAM,IAAI,CAoCZ"}
1
+ {"version":3,"file":"inputStream.d.ts","sourceRoot":"","sources":["../../src/utils/inputStream.ts"],"names":[],"mappings":"AAgDA,0CAA0C;AAC1C,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,6EAA6E;AAC7E,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAM9D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE9D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,aAAa,EAC1D,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,OAAO,EAC9C,EAAC,OAAe,EAAE,KAAa,EAAC,GAAE,wBAA6B,GAC9D,MAAM,IAAI,CA4CZ"}
@@ -4,7 +4,8 @@
4
4
  * @file inputStream.ts
5
5
  * @input A window, and subscribers to its input events (the press feedback
6
6
  * controller, the gesture host)
7
- * @output subscribeInput
7
+ * @output subscribeInput, and getLastPointerType: the type of the latest
8
+ * pointer event the stream delivered
8
9
  * @position The one entry for document-wide input listeners in core: one
9
10
  * native listener per event type on the window's capture phase, shared by
10
11
  * every subscriber
@@ -22,8 +23,10 @@
22
23
  // `blur` or `focus`. A subscriber for the window's own event checks
23
24
  // `event.target`.
24
25
  //
25
- // Subscribers run in subscription order. One that throws is reported, and
26
- // the rest still run.
26
+ // Subscribers run in subscription order, after the ones subscribed `first`.
27
+ // A first subscriber that returns `true` ends the dispatch: no later
28
+ // subscriber hears the event. One that throws is reported, and the rest still
29
+ // run.
27
30
  //
28
31
  // A type's native listener is passive, so it blocks no scroll. It is
29
32
  // non-passive only while a subscriber that cancels the event
@@ -34,13 +37,26 @@
34
37
  /** The events a window's capture phase sees: its own, and the document's. */
35
38
 
36
39
  const streams = new WeakMap();
40
+ /** The type of the latest pointer event each window's stream delivered. */
41
+ const lastPointerTypes = new WeakMap();
42
+
43
+ /**
44
+ * The type of the latest pointer event `view`'s stream delivered: `mouse`,
45
+ * `pen` or `touch`, or `null` before any. The stream hears a pointer event
46
+ * type only while a subscriber listens to it, as press feedback does on any
47
+ * page with a pressable. Reading it adds no listener.
48
+ */
49
+ export function getLastPointerType(view) {
50
+ return lastPointerTypes.get(view) ?? null;
51
+ }
37
52
 
38
53
  /**
39
54
  * Listen to `type` on `view`'s capture phase through its shared native
40
55
  * listener. Returns the unsubscribe; calling it again does nothing.
41
56
  */
42
57
  export function subscribeInput(view, type, listener, {
43
- cancels = false
58
+ cancels = false,
59
+ first = false
44
60
  } = {}) {
45
61
  let channels = streams.get(view);
46
62
  if (channels == null) {
@@ -57,9 +73,15 @@ export function subscribeInput(view, type, listener, {
57
73
  }
58
74
  const subscriber = {
59
75
  listener: listener,
60
- cancels
76
+ cancels,
77
+ isFirst: first
61
78
  };
62
- channel.subscribers.push(subscriber);
79
+ const firstLater = first ? channel.subscribers.findIndex(other => !other.isFirst) : -1;
80
+ if (firstLater === -1) {
81
+ channel.subscribers.push(subscriber);
82
+ } else {
83
+ channel.subscribers.splice(firstLater, 0, subscriber);
84
+ }
63
85
  register(view, type, channel);
64
86
  let isSubscribed = true;
65
87
  return () => {
@@ -101,7 +123,7 @@ function register(view, type, channel) {
101
123
  if (wanted == null) {
102
124
  return;
103
125
  }
104
- const listener = event => dispatch(channel, event);
126
+ const listener = event => dispatch(view, channel, event);
105
127
  view.addEventListener(type, listener, {
106
128
  capture: true,
107
129
  passive: !wanted
@@ -111,7 +133,14 @@ function register(view, type, channel) {
111
133
  cancels: wanted
112
134
  };
113
135
  }
114
- function dispatch(channel, event) {
136
+ function dispatch(view, channel, event) {
137
+ // Recorded before any subscriber runs, so each reads the pointer at hand.
138
+ const {
139
+ pointerType
140
+ } = event;
141
+ if (typeof pointerType === 'string' && pointerType !== '') {
142
+ lastPointerTypes.set(view, pointerType);
143
+ }
115
144
  // A subscriber may subscribe or unsubscribe while the event runs; the
116
145
  // event goes to those subscribed when it arrived.
117
146
  for (const subscriber of [...channel.subscribers]) {
@@ -119,7 +148,9 @@ function dispatch(channel, event) {
119
148
  continue;
120
149
  }
121
150
  try {
122
- subscriber.listener(event);
151
+ if (subscriber.listener(event) === true && subscriber.isFirst) {
152
+ return;
153
+ }
123
154
  } catch (error) {
124
155
  report(error);
125
156
  }
@@ -3,7 +3,8 @@
3
3
  * @input StyleX and the semantic interaction-overlay color tokens
4
4
  * @output Reusable background-color and background-image state styles, the
5
5
  * touch press's registered strength variable (`pressVars`) and its clocks
6
- * (`pressConsts`)
6
+ * (`pressConsts`). The list row's compositor press layer and its clocks
7
+ * are internal (privateAttributes/press.stylex.ts, utils/rowPressLayer.stylex.ts)
7
8
  * @position Internal styling utility for interactive core surfaces
8
9
  *
9
10
  * SYNC: When modified, update pressFeedback.ts, pressGesture.ts (the fade
@@ -1 +1 @@
1
- {"version":3,"file":"interactionOverlay.stylex.d.ts","sourceRoot":"","sources":["../../src/utils/interactionOverlay.stylex.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AAmCH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAG3C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;;WAEpB,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW;IACtB,iEAAiE;;CAEjE,CAAC;AA8HH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8HnC,CAAC"}
1
+ {"version":3,"file":"interactionOverlay.stylex.d.ts","sourceRoot":"","sources":["../../src/utils/interactionOverlay.stylex.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;GAeG;AAmCH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAG3C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;;WAEpB,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW;IACtB,iEAAiE;;CAEjE,CAAC;AAkIH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8HnC,CAAC"}
@@ -9,7 +9,8 @@
9
9
  * @input StyleX and the semantic interaction-overlay color tokens
10
10
  * @output Reusable background-color and background-image state styles, the
11
11
  * touch press's registered strength variable (`pressVars`) and its clocks
12
- * (`pressConsts`)
12
+ * (`pressConsts`). The list row's compositor press layer and its clocks
13
+ * are internal (privateAttributes/press.stylex.ts, utils/rowPressLayer.stylex.ts)
13
14
  * @position Internal styling utility for interactive core surfaces
14
15
  *
15
16
  * SYNC: When modified, update pressFeedback.ts, pressGesture.ts (the fade
@@ -142,7 +143,11 @@ const pressRelease = "x10jkm1t-B";
142
143
  * (strength ≈ 0.2 at the midpoint), which is what a deselect crossfade reads
143
144
  * as. Not the system's `--ease-standard`: that curve is for things that move,
144
145
  * and is so front-loaded (strength 0.05 at the midpoint) that the release
145
- * would read as half its clock.
146
+ * would read as half its clock. It is the constants table's
147
+ * `timing.press.highlightOutCurve`, which the list row's layer mirrors too
148
+ * (rowPressLayer.stylex.ts); interactionOverlay.cell.test.ts fails if either
149
+ * drifts. A copy, not an import: this module reaches nearly every component,
150
+ * and the row layer's constants stay with the rows.
146
151
  */
147
152
  const RELEASE_EASE = 'cubic-bezier(0, 0, 0.2, 1)';
148
153
 
@@ -29,6 +29,13 @@ export declare const PRESS_GESTURE_MEMORY_MS = 3000;
29
29
  * Reduce Motion a tempo may shorten the fade, never lengthen it past 200 ms.
30
30
  */
31
31
  export declare function pressFadeMs(element: Element): number;
32
+ /**
33
+ * Ends the press the controller follows on `element`, and its paint, at once.
34
+ * A clickable container calls it when a press starts on an interactive
35
+ * element inside it: that press does not activate the container, so the
36
+ * container shows no press.
37
+ */
38
+ export declare function cancelPress(element: Element): void;
32
39
  /**
33
40
  * Install the touch press controller on this document, once, however many
34
41
  * times it is called: the listeners exist while at least one caller holds it.
@@ -1 +1 @@
1
- {"version":3,"file":"pressFeedback.d.ts","sourceRoot":"","sources":["../../src/utils/pressFeedback.ts"],"names":[],"mappings":"AAkDA;;;;;;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;AA0E5C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAUpD;AAkoBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,IAAI,CA0BjD"}
1
+ {"version":3,"file":"pressFeedback.d.ts","sourceRoot":"","sources":["../../src/utils/pressFeedback.ts"],"names":[],"mappings":"AAuDA;;;;;;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;AA0E5C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAUpD;AA6ND;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAOlD;AA4aD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,IAAI,CA0BjD"}
@@ -3,10 +3,10 @@
3
3
  /**
4
4
  * @file pressFeedback.ts
5
5
  * @input The press state machine (pressGesture.ts), the menu-press and
6
- * press-group markers and the document's pointer, keyboard, scroll and
6
+ * press-group markers, the scroll-view test (scrollView.ts) and the document's pointer, keyboard, scroll and
7
7
  * visibility events
8
8
  * @output PRESSABLE_ATTRIBUTE, PRESSED_ATTRIBUTE, pressableProps,
9
- * pressFadeMs and installPressFeedback
9
+ * pressFadeMs, installPressFeedback and cancelPress
10
10
  * @position The DOM half of the touch press model. usePressFeedback installs
11
11
  * it, and the CSS arms live in interactionOverlay.stylex.ts.
12
12
  *
@@ -23,9 +23,13 @@
23
23
  // Where the primary pointer is fine, the controller ignores the mouse and the
24
24
  // keyboard, and CSS `:active` keeps their press. Under a coarse primary
25
25
  // pointer the CSS drops `:active`, so the controller paints every press. A
26
- // finger's press paints after the delay. A mouse, trackpad or Space press
27
- // paints at once. The controller reads the same query as the stylesheet, so
28
- // they agree.
26
+ // mouse, trackpad or Space press paints at once. The controller reads the
27
+ // same query as the stylesheet, so they agree.
28
+ //
29
+ // A finger waits only inside a scroller. Outside one, a surface highlights in
30
+ // the frame the finger lands, as a UIControl does. Inside one, it waits the
31
+ // content-touch delay, because the touch can become a scroll. Rows follow the
32
+ // same rule.
29
33
  //
30
34
  // A surface's hold does nothing, so it keeps the browser's long-press text
31
35
  // selection (AST-094). Only an element whose hold does something suppresses
@@ -36,6 +40,7 @@ import { MENU_PRESS_MARKER } from "../hooks/menuPressMarker.js";
36
40
  import { idlePressGesture, PRESS_FADE_MS, PRESS_FLASH_MS, PRESS_ONSET_MS, PRESS_SCROLL_BRAKE_MS, pressGestureStep } from "./pressGesture.js";
37
41
  import { isCoarsePointer, watchCoarsePointer } from "./coarsePointer.js";
38
42
  import { subscribeInput } from "./inputStream.js";
43
+ import { isInsideScrollView } from "./scrollView.js";
39
44
  import { TOUCH_QUERY } from "./touchPresentation.js";
40
45
  import { holdsPressThroughDrag } from "../privateAttributes/pressHoldsDrag.stylex.js";
41
46
  import { isTrackedByGroup } from "../privateAttributes/pressGroupItem.stylex.js";
@@ -208,7 +213,11 @@ function paintElement(element, paint) {
208
213
  element.removeAttribute(PRESSED_ATTRIBUTE);
209
214
  return;
210
215
  }
211
- element.setAttribute(PRESSED_ATTRIBUTE, paint);
216
+ // A step that keeps the paint writes nothing, so the element sees one
217
+ // change per paint.
218
+ if (element.getAttribute(PRESSED_ATTRIBUTE) !== paint) {
219
+ element.setAttribute(PRESSED_ATTRIBUTE, paint);
220
+ }
212
221
  }
213
222
  function clearTimer(slot) {
214
223
  if (slot.live?.timer != null) {
@@ -334,6 +343,21 @@ function finish(slot) {
334
343
  }
335
344
  }
336
345
 
346
+ /**
347
+ * Ends the press the controller follows on `element`, and its paint, at once.
348
+ * A clickable container calls it when a press starts on an interactive
349
+ * element inside it: that press does not activate the container, so the
350
+ * container shows no press.
351
+ */
352
+ export function cancelPress(element) {
353
+ if (finger.live?.element === element) {
354
+ finish(finger);
355
+ }
356
+ if (button.live?.element === element) {
357
+ finish(button);
358
+ }
359
+ }
360
+
337
361
  /** A new press on an element owns its paint: the other slot's gesture there ends. */
338
362
  function takeOver(other, element) {
339
363
  if (other.live?.element === element) {
@@ -466,7 +490,8 @@ function onPointerDown(event) {
466
490
  apply(finger, pressGestureStep(finger.live.gesture, {
467
491
  kind: 'down',
468
492
  x: event.clientX,
469
- y: event.clientY
493
+ y: event.clientY,
494
+ delayed: isInsideScrollView(element)
470
495
  }));
471
496
  }
472
497
  function onPointerMove(event) {
@@ -71,6 +71,12 @@ export type PressEvent = {
71
71
  kind: 'down';
72
72
  x: number;
73
73
  y: number;
74
+ /**
75
+ * Whether this touch waits {@link PRESS_ONSET_MS} before it paints:
76
+ * a surface inside a scroller. Defaults to
77
+ * `true`.
78
+ */
79
+ delayed?: boolean;
74
80
  }
75
81
  /**
76
82
  * A mouse button or the Space key went down on the surface. The
@@ -1 +1 @@
1
- {"version":3,"file":"pressGesture.d.ts","sourceRoot":"","sources":["../../src/utils/pressGesture.ts"],"names":[],"mappings":"AA4BA;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,KAAK,CAAC;AAEhC;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,MAA8B,CAAC;AAE3D;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,2EAA2E;AAC3E,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,UAAU,GACpB,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE5E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;IAAC,IAAI,EAAE,SAAS,CAAA;CAAC,CAAC;AAEtB,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;CACnD;AAkBD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,UAAU,GAChB,SAAS,CAsHX;AAED,wBAAgB,gBAAgB,IAAI,YAAY,CAE/C"}
@@ -21,6 +21,10 @@
21
21
  // primary pointer, so a mouse, trackpad or Space press on such a device comes
22
22
  // here as `buttonDown`: painted at once and faded on release.
23
23
  //
24
+ // Only a finger inside a scroller waits. The controller tells the machine
25
+ // which touch waits (`down`'s `delayed`), and a touch that does not wait goes
26
+ // straight to `pressed`. After that the machine is the same.
27
+ //
24
28
  // The constants were measured against native apps. The machine knows nothing
25
29
  // of the DOM, so {@link pressGestureStep}'s cases are the state diagram.
26
30
 
@@ -123,6 +127,19 @@ function step(gesture, phase, paint, timer) {
123
127
  */
124
128
  export function pressGestureStep(gesture, event) {
125
129
  if (event.kind === 'down') {
130
+ // A surface with no scroller above it: nothing can turn this touch into a
131
+ // scroll, so it paints in the frame it lands, as a UIControl highlights.
132
+ if (event.delayed === false) {
133
+ return {
134
+ gesture: {
135
+ originX: event.x,
136
+ originY: event.y,
137
+ phase: 'pressed'
138
+ },
139
+ paint: 'on',
140
+ timer: null
141
+ };
142
+ }
126
143
  // A new touch always starts armed and painting nothing, whatever the last
127
144
  // gesture ended as. This is the only way out of `dead`.
128
145
  return {
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A list row's release (`rowPressLayerStyles.cell`), mirrored for the
3
+ * stylesheet. StyleX evaluates a style at build time and cannot read the
4
+ * constants table, so these are the table's press release values
5
+ * (`timing.press`, motion/uikit/timing.ts). interactionOverlay.cell.test.ts
6
+ * fails if they drift.
7
+ */
8
+ export declare const cellPressConsts: {
9
+ /** `timing.press.highlightOutMs`, in ms. */
10
+ cellReleaseMs: number;
11
+ /** `timing.press.highlightOutCurve`, as CSS. */
12
+ cellReleaseEase: string;
13
+ };
14
+ //# sourceMappingURL=rowPressLayer.stylex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rowPressLayer.stylex.d.ts","sourceRoot":"","sources":["../../src/utils/rowPressLayer.stylex.ts"],"names":[],"mappings":"AAcA;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;IAC1B,4CAA4C;;IAE5C,gDAAgD;;CAEhD,CAAC"}
@@ -0,0 +1,25 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file rowPressLayer.stylex.ts
5
+ * @input StyleX
6
+ * @output The list row press layer's clocks (`cellPressConsts`)
7
+ * @position Internal to core: no package entry exports it. Only the row
8
+ * layer (privateAttributes/press.stylex.ts) reads it, so a component
9
+ * without a press row ships none of it; interactionOverlay.exports.test.ts
10
+ * keeps it off the published paths.
11
+ */
12
+
13
+ import * as stylex from '@stylexjs/stylex';
14
+
15
+ /**
16
+ * A list row's release (`rowPressLayerStyles.cell`), mirrored for the
17
+ * stylesheet. StyleX evaluates a style at build time and cannot read the
18
+ * constants table, so these are the table's press release values
19
+ * (`timing.press`, motion/uikit/timing.ts). interactionOverlay.cell.test.ts
20
+ * fails if they drift.
21
+ */
22
+ export const cellPressConsts = {
23
+ cellReleaseMs: 200,
24
+ cellReleaseEase: "cubic-bezier(0, 0, 0.2, 1)"
25
+ };
@@ -0,0 +1,25 @@
1
+ /** Overflow values that let a box scroll. */
2
+ export declare const SCROLLABLE_OVERFLOW: ReadonlySet<string>;
3
+ export interface AllowedPans {
4
+ readonly x: boolean;
5
+ readonly y: boolean;
6
+ }
7
+ /** Which pans a `touch-action` value lets the browser perform. */
8
+ export declare function parseTouchAction(value: string): AllowedPans;
9
+ /**
10
+ * The viewport's overflow on an axis. It scrolls unless the root or the body
11
+ * clips it, as a scroll lock does with `overflow: hidden`.
12
+ */
13
+ export declare function rootOverflow(doc: Document, axis: 'x' | 'y'): string;
14
+ /**
15
+ * Whether a touch on `element` lands inside a scroll view, UIKit's question
16
+ * for a touch: a box above it, the page included, overflows on an axis it
17
+ * scrolls, and `touch-action` on the way up leaves that axis to the browser.
18
+ * A `position: fixed` box ends the walk, because it does not move with any
19
+ * scroller above it. A wheel scrolls whatever `touch-action` says, so a
20
+ * wheel's question passes `readsTouchAction: false`.
21
+ */
22
+ export declare function isInsideScrollView(element: Element, { readsTouchAction }?: {
23
+ readsTouchAction?: boolean;
24
+ }): boolean;
25
+ //# sourceMappingURL=scrollView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scrollView.d.ts","sourceRoot":"","sources":["../../src/utils/scrollView.ts"],"names":[],"mappings":"AAgBA,6CAA6C;AAC7C,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAIlD,CAAC;AAKH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,kEAAkE;AAClE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAiB3D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,MAAM,CAgBnE;AAQD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,EAAC,gBAAuB,EAAC,GAAE;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAM,GAC3D,OAAO,CA4CT"}