@astryxdesign/core 0.7.6 → 0.7.7-canary.36f8ea1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +23 -3
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +16 -9
- package/dist/Chat/ChatComposerInput.d.ts +9 -0
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +2 -0
- package/dist/Chat/ChatMessage.js +2 -2
- package/dist/Chat/chatMessage.vars.stylex.d.ts +8 -8
- package/dist/Chat/chatMessage.vars.stylex.js +8 -8
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +6 -0
- package/dist/DropdownMenu/useMenuOverflow.d.ts +13 -3
- package/dist/DropdownMenu/useMenuOverflow.d.ts.map +1 -1
- package/dist/DropdownMenu/useMenuOverflow.js +31 -8
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +1 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +25 -13
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +404 -131
- package/dist/Slider/sliderTouchController.d.ts +189 -0
- package/dist/Slider/sliderTouchController.d.ts.map +1 -0
- package/dist/Slider/sliderTouchController.js +1017 -0
- package/dist/Slider/useSliderTouch.d.ts +22 -0
- package/dist/Slider/useSliderTouch.d.ts.map +1 -0
- package/dist/Slider/useSliderTouch.js +56 -0
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +10 -8
- package/dist/astryx.css +33 -6
- package/dist/gestures/GestureArena.d.ts.map +1 -1
- package/dist/gestures/GestureArena.js +4 -1
- package/dist/gestures/GestureHost.d.ts +72 -2
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +643 -5
- package/dist/gestures/GestureRecognizer.d.ts +15 -1
- package/dist/gestures/GestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/GestureRecognizer.js +12 -0
- package/dist/gestures/PanGestureRecognizer.d.ts +8 -0
- package/dist/gestures/PanGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/PinchGestureRecognizer.d.ts +5 -1
- package/dist/gestures/PinchGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/PinchGestureRecognizer.js +10 -0
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts +3 -3
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/ScreenEdgePanGestureRecognizer.js +7 -5
- package/dist/gestures/nativeScroll.d.ts +16 -2
- package/dist/gestures/nativeScroll.d.ts.map +1 -1
- package/dist/gestures/nativeScroll.js +39 -8
- package/dist/gestures/recognizerInternals.d.ts +4 -2
- package/dist/gestures/recognizerInternals.d.ts.map +1 -1
- package/dist/gestures/types.d.ts +11 -0
- package/dist/gestures/types.d.ts.map +1 -1
- package/dist/gestures/types.js +7 -0
- package/dist/gestures/wheelSegmenter.d.ts +45 -0
- package/dist/gestures/wheelSegmenter.d.ts.map +1 -0
- package/dist/gestures/wheelSegmenter.js +98 -0
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +77 -14
- package/dist/motion/uikit/index.d.ts +2 -1
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +2 -1
- package/dist/motion/uikit/slider.d.ts +97 -0
- package/dist/motion/uikit/slider.d.ts.map +1 -0
- package/dist/motion/uikit/slider.js +111 -0
- package/dist/motion/uikit/springs.d.ts +46 -1
- package/dist/motion/uikit/springs.d.ts.map +1 -1
- package/dist/motion/uikit/springs.js +48 -4
- package/package.json +5 -5
- package/src/AppShell/AppShell.doc.mjs +10 -0
- package/src/AppShell/AppShell.tsx +48 -2
- package/src/BottomSheet/BottomSheetPanel.tsx +16 -9
- package/src/Chat/Chat.doc.mjs +1 -0
- package/src/Chat/ChatComposerInput.doc.mjs +11 -0
- package/src/Chat/ChatComposerInput.tsx +11 -0
- package/src/Chat/ChatMessage.tsx +2 -2
- package/src/Chat/chatMessage.vars.stylex.ts +8 -8
- package/src/Drawer/Drawer.tsx +6 -0
- package/src/DropdownMenu/useMenuOverflow.ts +44 -8
- package/src/Link/Link.tsx +3 -0
- package/src/Selector/Selector.tsx +29 -2
- package/src/Slider/Slider.doc.mjs +11 -7
- package/src/Slider/Slider.tsx +539 -132
- package/src/Slider/sliderTouchController.ts +1209 -0
- package/src/Slider/useSliderTouch.ts +78 -0
- package/src/Typeahead/BaseTypeahead.tsx +9 -8
- package/src/gestures/GestureArena.ts +1 -0
- package/src/gestures/GestureHost.ts +765 -5
- package/src/gestures/GestureRecognizer.ts +28 -0
- package/src/gestures/PanGestureRecognizer.ts +8 -0
- package/src/gestures/PinchGestureRecognizer.ts +16 -1
- package/src/gestures/README.md +63 -0
- package/src/gestures/ScreenEdgePanGestureRecognizer.ts +7 -5
- package/src/gestures/nativeScroll.ts +49 -9
- package/src/gestures/recognizerInternals.ts +9 -2
- package/src/gestures/types.ts +12 -0
- package/src/gestures/wheelSegmenter.ts +114 -0
- package/src/motion/animator.ts +115 -19
- package/src/motion/uikit/index.ts +2 -1
- package/src/motion/uikit/slider.ts +105 -0
- package/src/motion/uikit/springs.ts +37 -2
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @file index.ts
|
|
5
5
|
* @input The domain files of the UIKit constants table
|
|
6
6
|
* @output Re-exports `springs` and one constant per spring (`SHEET_PRESENT_SPRING`,
|
|
7
|
-
* …), `scroll`, `timing`, `navigation` and the
|
|
7
|
+
* …), `scroll`, `timing`, `navigation`, the `slider` domain and the
|
|
8
8
|
* gesture thresholds (one `UIKIT_*` group per recognizer, their union
|
|
9
9
|
* `UIKIT_GESTURES`, and the haptic tables)
|
|
10
10
|
* @position Entry of the UIKit constants table (motion/uikit). Internal to
|
|
@@ -40,6 +40,7 @@ export {
|
|
|
40
40
|
} from './gestures';
|
|
41
41
|
export {navigation, registerNavigationTable} from './navigation';
|
|
42
42
|
export {registerScrollTable, scroll} from './scroll';
|
|
43
|
+
export {slider} from './slider';
|
|
43
44
|
export {
|
|
44
45
|
ACTION_SHEET_DISMISS_SPRING,
|
|
45
46
|
ACTION_SHEET_PRESENT_SPRING,
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file slider.ts
|
|
5
|
+
* @input Nothing: data only
|
|
6
|
+
* @output Exports `slider`: UISlider's hit target, tracking rule, release
|
|
7
|
+
* coast, lift, drop and end haptic, measured on the iOS 26.2 simulator
|
|
8
|
+
* @position The slider domain of the UIKit constants table (motion/uikit).
|
|
9
|
+
* Lengths are in pt (CSS px). Tests check each leaf's `@source`.
|
|
10
|
+
*
|
|
11
|
+
* SYNC: When modified, update:
|
|
12
|
+
* - /packages/core/src/Slider/sliderTouchController.ts
|
|
13
|
+
* - /packages/core/src/Slider/Slider.tsx
|
|
14
|
+
* - /packages/core/src/motion/uikit/slider.test.ts
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {SLIDER_RELEASE_SPRING} from './springs';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* UISlider's touch values: hit target, tracking, release coast, lift, drop
|
|
21
|
+
* and the end-of-track haptic.
|
|
22
|
+
*/
|
|
23
|
+
export const slider = {
|
|
24
|
+
/**
|
|
25
|
+
* The thumb's touch target, a square in pt centered on the thumb. It is
|
|
26
|
+
* the 37 × 24 pt thumb grown by its hit edge insets: 12 pt above and
|
|
27
|
+
* below, 5.5 pt left and right. UIKit hit-tests inside the control's frame
|
|
28
|
+
* first, so the lab's 40 pt frame clipped it to 48 × 40.
|
|
29
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro.
|
|
30
|
+
* `_thumbHitEdgeInsets` reads {−12, −5.5, −12, −5.5}. Touch-downs on a
|
|
31
|
+
* 4 pt grid take the thumb from −24 to +20 pt in x. A track tap away
|
|
32
|
+
* from the thumb moves nothing. Oct 23 2026
|
|
33
|
+
*/
|
|
34
|
+
thumbHitTarget: 48,
|
|
35
|
+
/**
|
|
36
|
+
* Value range per track length of finger travel. The value moves by
|
|
37
|
+
* (max − min) × translation ÷ the track's full length. The translation
|
|
38
|
+
* counts from the pan's threshold: the touch-down point plus 10 pt along
|
|
39
|
+
* the track. 1 means one full range per track length.
|
|
40
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. In
|
|
41
|
+
* drags at 120 to 2000 pt/s, each event's value is v0 plus the
|
|
42
|
+
* translation past 10 pt ÷ 300. Past the max end, the value leaves 1
|
|
43
|
+
* only once the finger comes back past where it reached 1. Oct 23 2026
|
|
44
|
+
*/
|
|
45
|
+
trackingGain: 1,
|
|
46
|
+
/**
|
|
47
|
+
* The coast after the lift. The thumb and the value spring from where the
|
|
48
|
+
* finger left them to the projected target, with the release velocity.
|
|
49
|
+
* Critically damped, it never overshoots a target ahead of it.
|
|
50
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
51
|
+
* `UIViewSpringAnimationBehavior` at the lift reads response 0.4 and
|
|
52
|
+
* damping ratio 1. Four releases fit it per frame, at rms 0.11 pt or
|
|
53
|
+
* less. Oct 23 2026
|
|
54
|
+
*/
|
|
55
|
+
releaseSpring: SLIDER_RELEASE_SPRING,
|
|
56
|
+
/**
|
|
57
|
+
* The deceleration rate of the coast's momentum projection, per ms
|
|
58
|
+
* (WWDC18's `project`). It is not UIScrollView's normal rate (0.998), so
|
|
59
|
+
* pass it to the projection explicitly.
|
|
60
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
61
|
+
* release behavior's projection deceleration reads 0.996. Oct 23 2026
|
|
62
|
+
*/
|
|
63
|
+
releaseProjectionRate: 0.996,
|
|
64
|
+
/**
|
|
65
|
+
* How much of the projection the coast travels. The target is the lift
|
|
66
|
+
* value plus this share of the projected distance. A finger lifted outside
|
|
67
|
+
* the control's tracking bounds coasts back to the lift value instead.
|
|
68
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
69
|
+
* release behavior's target smoothing reads 0.4. A 126.9 pt/s release
|
|
70
|
+
* travels 12.56 pt, against 12.64 predicted. Oct 23 2026
|
|
71
|
+
*/
|
|
72
|
+
releaseProjectionShare: 0.4,
|
|
73
|
+
/**
|
|
74
|
+
* The thumb's growth under a finger, uniform about its center (37 × 24 to
|
|
75
|
+
* 57.35 × 37.2 pt).
|
|
76
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The lens
|
|
77
|
+
* frame settled during an 800 ms hold. Oct 23 2026
|
|
78
|
+
*/
|
|
79
|
+
liftScale: 1.55,
|
|
80
|
+
/**
|
|
81
|
+
* The lift: the thumb grows to `liftScale` when the finger lands.
|
|
82
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The lens
|
|
83
|
+
* width per frame in an 800 ms hold fits one spring at rms 0.31 pt.
|
|
84
|
+
* Oct 23 2026
|
|
85
|
+
*/
|
|
86
|
+
liftSpring: {response: 0.215, dampingRatio: 0.6},
|
|
87
|
+
/**
|
|
88
|
+
* The drop: the thumb shrinks back to its rest size when the finger lifts,
|
|
89
|
+
* while the coast runs.
|
|
90
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
91
|
+
* lens's spring at the lift of an 800 ms hold reads response 0.5 s and
|
|
92
|
+
* damping ratio 0.7. The width per frame fits it at rms 0.10 pt.
|
|
93
|
+
* Oct 23 2026
|
|
94
|
+
*/
|
|
95
|
+
dropSpring: {response: 0.5, dampingRatio: 0.7},
|
|
96
|
+
/**
|
|
97
|
+
* The feedback each time the value reaches an end, once per entry. It
|
|
98
|
+
* re-arms when the value leaves the end, in the drag and the coast. UIKit
|
|
99
|
+
* plays "Micro Tap Medium", and the web stand-in is the closest kind.
|
|
100
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
101
|
+
* haptics log of drags into both ends shows the fluid slider generator's
|
|
102
|
+
* "Micro Tap Medium" once per entry. Oct 23 2026
|
|
103
|
+
*/
|
|
104
|
+
endHaptic: 'impactMedium',
|
|
105
|
+
} as const;
|
|
@@ -454,6 +454,33 @@ export const KEYBOARD_SPRING = {
|
|
|
454
454
|
*/
|
|
455
455
|
export const BANNER_SPRING = {mass: 3, stiffness: 1000, damping: 500} as const;
|
|
456
456
|
|
|
457
|
+
/**
|
|
458
|
+
* UISlider's release: after a finger lifts, the thumb settles on this spring
|
|
459
|
+
* toward 0.4 of the release's momentum projection. It is critically damped,
|
|
460
|
+
* so it never overshoots a target ahead of it.
|
|
461
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
462
|
+
* `UIViewSpringAnimationBehavior` at the lift reads response 0.4 and
|
|
463
|
+
* damping ratio 1. Four releases fit it per frame (the UIKit slider
|
|
464
|
+
* table). Oct 23 2026
|
|
465
|
+
*/
|
|
466
|
+
export const SLIDER_RELEASE_SPRING = {response: 0.4, dampingRatio: 1} as const;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* UISlider's lift: a finger's touch-down scales the thumb up on this spring.
|
|
470
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
471
|
+
* thumb's scale per frame after touch-down (the UIKit slider table).
|
|
472
|
+
* Oct 23 2026
|
|
473
|
+
*/
|
|
474
|
+
export const SLIDER_LIFT_SPRING = {response: 0.215, dampingRatio: 0.6} as const;
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* UISlider's drop: the lift's end scales the thumb back down on this spring.
|
|
478
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, iPhone 17 Pro. The
|
|
479
|
+
* thumb's scale per frame after the lift (the UIKit slider table).
|
|
480
|
+
* Oct 23 2026
|
|
481
|
+
*/
|
|
482
|
+
export const SLIDER_DROP_SPRING = {response: 0.5, dampingRatio: 0.7} as const;
|
|
483
|
+
|
|
457
484
|
/**
|
|
458
485
|
* Every spring above, by row name: the table the existing readers use. A
|
|
459
486
|
* component imports only the rows it plays (`architecture:component-style-authoring`
|
|
@@ -494,10 +521,15 @@ export const springs = {
|
|
|
494
521
|
segmentedThumb: SEGMENTED_THUMB_SPRING,
|
|
495
522
|
keyboard: KEYBOARD_SPRING,
|
|
496
523
|
banner: BANNER_SPRING,
|
|
524
|
+
sliderRelease: SLIDER_RELEASE_SPRING,
|
|
525
|
+
sliderLift: SLIDER_LIFT_SPRING,
|
|
526
|
+
sliderDrop: SLIDER_DROP_SPRING,
|
|
497
527
|
} as const;
|
|
498
528
|
|
|
499
529
|
/**
|
|
500
|
-
* The
|
|
530
|
+
* The only springs that are motion roles. The touch presentations' record
|
|
531
|
+
* names some, and a component's own record names others, such as Slider's
|
|
532
|
+
* three. The generated motion role table lists each with its record.
|
|
501
533
|
* The registry takes these rows alone, so registering ships no other spring.
|
|
502
534
|
*/
|
|
503
535
|
const SPRING_ROLES = {
|
|
@@ -516,10 +548,13 @@ const SPRING_ROLES = {
|
|
|
516
548
|
contextMenuLift: CONTEXT_MENU_LIFT_SPRING,
|
|
517
549
|
contextMenuDismiss: CONTEXT_MENU_DISMISS_SPRING,
|
|
518
550
|
contextMenuMorph: CONTEXT_MENU_MORPH_SPRING,
|
|
551
|
+
sliderRelease: SLIDER_RELEASE_SPRING,
|
|
552
|
+
sliderLift: SLIDER_LIFT_SPRING,
|
|
553
|
+
sliderDrop: SLIDER_DROP_SPRING,
|
|
519
554
|
};
|
|
520
555
|
|
|
521
556
|
/**
|
|
522
|
-
* Registers the springs
|
|
557
|
+
* Registers the role springs (`SPRING_ROLES`) as internal motion roles
|
|
523
558
|
* (motion/roles.ts), by their row names (`springs.settle`). Every other
|
|
524
559
|
* spring, UIKit's menu spring under Reduce Motion and the keyboard's
|
|
525
560
|
* included, is not a role. Nothing registers on import: the touch code that
|