@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.
Files changed (101) hide show
  1. package/dist/AppShell/AppShell.d.ts.map +1 -1
  2. package/dist/AppShell/AppShell.js +23 -3
  3. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  4. package/dist/BottomSheet/BottomSheetPanel.js +16 -9
  5. package/dist/Chat/ChatComposerInput.d.ts +9 -0
  6. package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
  7. package/dist/Chat/ChatComposerInput.js +2 -0
  8. package/dist/Chat/ChatMessage.js +2 -2
  9. package/dist/Chat/chatMessage.vars.stylex.d.ts +8 -8
  10. package/dist/Chat/chatMessage.vars.stylex.js +8 -8
  11. package/dist/Drawer/Drawer.d.ts.map +1 -1
  12. package/dist/Drawer/Drawer.js +6 -0
  13. package/dist/DropdownMenu/useMenuOverflow.d.ts +13 -3
  14. package/dist/DropdownMenu/useMenuOverflow.d.ts.map +1 -1
  15. package/dist/DropdownMenu/useMenuOverflow.js +31 -8
  16. package/dist/Link/Link.d.ts.map +1 -1
  17. package/dist/Link/Link.js +1 -0
  18. package/dist/Selector/Selector.d.ts.map +1 -1
  19. package/dist/Selector/Selector.js +25 -13
  20. package/dist/Slider/Slider.d.ts.map +1 -1
  21. package/dist/Slider/Slider.js +404 -131
  22. package/dist/Slider/sliderTouchController.d.ts +189 -0
  23. package/dist/Slider/sliderTouchController.d.ts.map +1 -0
  24. package/dist/Slider/sliderTouchController.js +1017 -0
  25. package/dist/Slider/useSliderTouch.d.ts +22 -0
  26. package/dist/Slider/useSliderTouch.d.ts.map +1 -0
  27. package/dist/Slider/useSliderTouch.js +56 -0
  28. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  29. package/dist/Typeahead/BaseTypeahead.js +10 -8
  30. package/dist/astryx.css +33 -6
  31. package/dist/gestures/GestureArena.d.ts.map +1 -1
  32. package/dist/gestures/GestureArena.js +4 -1
  33. package/dist/gestures/GestureHost.d.ts +72 -2
  34. package/dist/gestures/GestureHost.d.ts.map +1 -1
  35. package/dist/gestures/GestureHost.js +643 -5
  36. package/dist/gestures/GestureRecognizer.d.ts +15 -1
  37. package/dist/gestures/GestureRecognizer.d.ts.map +1 -1
  38. package/dist/gestures/GestureRecognizer.js +12 -0
  39. package/dist/gestures/PanGestureRecognizer.d.ts +8 -0
  40. package/dist/gestures/PanGestureRecognizer.d.ts.map +1 -1
  41. package/dist/gestures/PinchGestureRecognizer.d.ts +5 -1
  42. package/dist/gestures/PinchGestureRecognizer.d.ts.map +1 -1
  43. package/dist/gestures/PinchGestureRecognizer.js +10 -0
  44. package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts +3 -3
  45. package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts.map +1 -1
  46. package/dist/gestures/ScreenEdgePanGestureRecognizer.js +7 -5
  47. package/dist/gestures/nativeScroll.d.ts +16 -2
  48. package/dist/gestures/nativeScroll.d.ts.map +1 -1
  49. package/dist/gestures/nativeScroll.js +39 -8
  50. package/dist/gestures/recognizerInternals.d.ts +4 -2
  51. package/dist/gestures/recognizerInternals.d.ts.map +1 -1
  52. package/dist/gestures/types.d.ts +11 -0
  53. package/dist/gestures/types.d.ts.map +1 -1
  54. package/dist/gestures/types.js +7 -0
  55. package/dist/gestures/wheelSegmenter.d.ts +45 -0
  56. package/dist/gestures/wheelSegmenter.d.ts.map +1 -0
  57. package/dist/gestures/wheelSegmenter.js +98 -0
  58. package/dist/motion/animator.d.ts.map +1 -1
  59. package/dist/motion/animator.js +77 -14
  60. package/dist/motion/uikit/index.d.ts +2 -1
  61. package/dist/motion/uikit/index.d.ts.map +1 -1
  62. package/dist/motion/uikit/index.js +2 -1
  63. package/dist/motion/uikit/slider.d.ts +97 -0
  64. package/dist/motion/uikit/slider.d.ts.map +1 -0
  65. package/dist/motion/uikit/slider.js +111 -0
  66. package/dist/motion/uikit/springs.d.ts +46 -1
  67. package/dist/motion/uikit/springs.d.ts.map +1 -1
  68. package/dist/motion/uikit/springs.js +48 -4
  69. package/package.json +5 -5
  70. package/src/AppShell/AppShell.doc.mjs +10 -0
  71. package/src/AppShell/AppShell.tsx +48 -2
  72. package/src/BottomSheet/BottomSheetPanel.tsx +16 -9
  73. package/src/Chat/Chat.doc.mjs +1 -0
  74. package/src/Chat/ChatComposerInput.doc.mjs +11 -0
  75. package/src/Chat/ChatComposerInput.tsx +11 -0
  76. package/src/Chat/ChatMessage.tsx +2 -2
  77. package/src/Chat/chatMessage.vars.stylex.ts +8 -8
  78. package/src/Drawer/Drawer.tsx +6 -0
  79. package/src/DropdownMenu/useMenuOverflow.ts +44 -8
  80. package/src/Link/Link.tsx +3 -0
  81. package/src/Selector/Selector.tsx +29 -2
  82. package/src/Slider/Slider.doc.mjs +11 -7
  83. package/src/Slider/Slider.tsx +539 -132
  84. package/src/Slider/sliderTouchController.ts +1209 -0
  85. package/src/Slider/useSliderTouch.ts +78 -0
  86. package/src/Typeahead/BaseTypeahead.tsx +9 -8
  87. package/src/gestures/GestureArena.ts +1 -0
  88. package/src/gestures/GestureHost.ts +765 -5
  89. package/src/gestures/GestureRecognizer.ts +28 -0
  90. package/src/gestures/PanGestureRecognizer.ts +8 -0
  91. package/src/gestures/PinchGestureRecognizer.ts +16 -1
  92. package/src/gestures/README.md +63 -0
  93. package/src/gestures/ScreenEdgePanGestureRecognizer.ts +7 -5
  94. package/src/gestures/nativeScroll.ts +49 -9
  95. package/src/gestures/recognizerInternals.ts +9 -2
  96. package/src/gestures/types.ts +12 -0
  97. package/src/gestures/wheelSegmenter.ts +114 -0
  98. package/src/motion/animator.ts +115 -19
  99. package/src/motion/uikit/index.ts +2 -1
  100. package/src/motion/uikit/slider.ts +105 -0
  101. package/src/motion/uikit/springs.ts +37 -2
@@ -0,0 +1,189 @@
1
+ import { type MotionCurve } from '../motion/animator.js';
2
+ import { type SpringDescription } from '../motion/spring.js';
3
+ /** The parts the controller moves. */
4
+ export interface SliderTouchParts {
5
+ readonly control: HTMLElement;
6
+ readonly thumbs: ReadonlyArray<HTMLElement>;
7
+ /** The fill's mover (a range's start) and the fill itself. */
8
+ readonly fillMover: HTMLElement | null;
9
+ readonly fill: HTMLElement | null;
10
+ }
11
+ /** What the controller needs from Slider. Read fresh on every use. */
12
+ export interface SliderTouchModel {
13
+ readonly min: number;
14
+ readonly max: number;
15
+ readonly isRange: boolean;
16
+ readonly isHorizontal: boolean;
17
+ readonly isDisabled: boolean;
18
+ /** The thumb's size along the travel, px: the travel is inset by half of it. */
19
+ readonly thumbSize: number;
20
+ /** The values the owner rendered. */
21
+ values(): ReadonlyArray<number>;
22
+ /** What thumb `index` becomes for `raw`: snapped, clamped, kept apart. */
23
+ constrain(index: number, raw: number): number;
24
+ /** The range thumb `index` may cover, unsnapped (its ends and the gap). */
25
+ bounds(index: number): readonly [number, number];
26
+ /**
27
+ * `onChange` for thumb `index`. `from` holds the start values when one
28
+ * move changes both range thumbs, as a drag passed between coincident
29
+ * thumbs does.
30
+ */
31
+ change(index: number, value: number, from?: ReadonlyArray<number>): void;
32
+ /** Thumb `index` is under a finger (pressed paint, focus, tooltip), or none. */
33
+ press(index: number | null): void;
34
+ /**
35
+ * The interaction ended. Report thumb `index`'s last `value` through
36
+ * `onChange`, or null when the interaction ends on no value of its own.
37
+ * Report it even when a frame's report already carried it: these handlers
38
+ * run outside React's events, so that report's render can be pending.
39
+ * Release the pressed paint. Then have the owner render it all now, so the
40
+ * parts can return to the stylesheet and `onChangeEnd` carries what the
41
+ * owner rendered.
42
+ */
43
+ commit(index: number, value: number | null): void;
44
+ /** `onChangeEnd`, with the values the owner rendered. */
45
+ reportEnd(): void;
46
+ /**
47
+ * The value a press at client point (`x`, `y`) on the track means: a
48
+ * mark's value on a mark, else the point along the travel.
49
+ */
50
+ valueAt(x: number, y: number): number;
51
+ /** The thumb a track press at `value` moves. */
52
+ thumbFor(value: number): number;
53
+ }
54
+ /**
55
+ * The release coast as a curve in the thumb's own px, clamped to the
56
+ * thumb's range. It is a spring from `from` to `to` with `velocity` (px/s).
57
+ * Its value stops at an end instead of passing it, as UISlider clamps its
58
+ * value and the thumb follows it.
59
+ */
60
+ export declare function sliderCoastCurve({ from, to, velocity, lower, upper, spring: description, }: {
61
+ from: number;
62
+ to: number;
63
+ velocity: number;
64
+ lower: number;
65
+ upper: number;
66
+ /** The release spring, as the thumb's theme resolves it. */
67
+ spring?: SpringDescription;
68
+ }): MotionCurve;
69
+ /** UISlider's touch tracking for one Slider (both thumbs of a range). */
70
+ export declare class SliderTouchController {
71
+ private model;
72
+ private readonly getParts;
73
+ private readonly interactions;
74
+ private readonly animators;
75
+ /** The owner unmounted the slider: a cancel reports nothing then. */
76
+ private disposed;
77
+ /** Thumbs whose current touch is a mouse: Slider's own handlers take it. */
78
+ private readonly mouseOwners;
79
+ /** The track's tap (see handleTrackTap). Null while detached. */
80
+ private trackTap;
81
+ constructor(model: SliderTouchModel, getParts: () => SliderTouchParts | null);
82
+ setModel(model: SliderTouchModel): void;
83
+ /**
84
+ * Attaches the recognizers to the thumbs for every pointer. Under a
85
+ * coarse primary pointer each thumb's `::before` is its touch target.
86
+ */
87
+ attach(): () => void;
88
+ /** Stops every interaction and animation without reporting (unmount). */
89
+ dispose(): void;
90
+ /**
91
+ * Ends every live interaction without a word to the owner, and returns
92
+ * them. It runs from an Effect cleanup, where `onChange`, `onChangeEnd` and
93
+ * a synchronous render have no place. A coast stops where it is drawn, and
94
+ * the parts return to the stylesheet at the value the owner last rendered.
95
+ */
96
+ private endSilently;
97
+ /**
98
+ * Ends the interactions a detach cancelled while the slider stays mounted,
99
+ * as when it is disabled mid-drag. Each releases its pressed paint. If any
100
+ * changed the value, `onChangeEnd` reports once. This waits until the
101
+ * cleanup's task ends, and an unmount in the same commit drops it.
102
+ */
103
+ private cancelLater;
104
+ /**
105
+ * After the owner rendered an ended interaction's final value, the thumb
106
+ * and the fill go back to the positions Slider's CSS gives them. Parts that
107
+ * a coast of another thumb still drives stay with it.
108
+ */
109
+ private handBack;
110
+ private handleControlEvent;
111
+ private handleHighlight;
112
+ private handlePan;
113
+ /** UISlider's veto: an ancestor's pan or swipe along the travel. */
114
+ private vetoes;
115
+ private begin;
116
+ private track;
117
+ /**
118
+ * Writes the moving thumb's and the fill's positions for the
119
+ * interaction's value straight to their translates: one visual update per
120
+ * move, with no component render. The parts go back to
121
+ * the stylesheet when the interaction ends (`handBack`).
122
+ */
123
+ private place;
124
+ /**
125
+ * Records a new value and plays the end haptic on entering an end.
126
+ * Reports it through `onChange` unless the interaction's end commits it.
127
+ * Returns whether the value changed.
128
+ */
129
+ private record;
130
+ private report;
131
+ private release;
132
+ /**
133
+ * A tap on the track: the thumb the tap's value picks springs there, on
134
+ * the release spring from rest. It reports as a coast does, and
135
+ * `onChangeEnd` follows. A tap on the thumb's own value changes nothing.
136
+ */
137
+ private handleTrackTap;
138
+ /**
139
+ * Springs the interaction's thumb from its value to `target`, on the
140
+ * compositor and clamped, starting at `velocityPx` (px/s along the
141
+ * travel). `onChange` follows from the coast's fourth frame, and the
142
+ * interaction ends (`onChangeEnd`) on its last. `touchRelease` means a
143
+ * finger's release started it. Then the coast continues the throw and
144
+ * keeps moving under Reduce Motion. A tap's spring never runs there
145
+ * (`handleTrackTap` sets the value at once).
146
+ */
147
+ private coastTo;
148
+ /** Ends the coast when its thumb's motion finishes, not when it stops. */
149
+ private endCoastWithThumb;
150
+ /**
151
+ * After the track's length changed: every live interaction measures it
152
+ * again. A drag writes its parts for the new length, and a coast plays
153
+ * on from where its curve is now, scaled to the new travel.
154
+ */
155
+ private followTrackLength;
156
+ /**
157
+ * Plays the coast on the thumb and the fill parts, on one clock that
158
+ * started at `at`. A re-mapped coast plays on from where its curve is.
159
+ */
160
+ private playCoast;
161
+ /**
162
+ * The parts that move with the interaction's thumb. Each has its translate
163
+ * as a function of the thumb's px along the travel (`p`), and that
164
+ * function's slope. The formulas are the same as Slider's CSS.
165
+ */
166
+ private partMaps;
167
+ /**
168
+ * Stops a coast where the browser draws the thumb in this frame. Returns
169
+ * the value there for `finish` to end on, or null when the travel has no
170
+ * length. The animator's own reading can run a frame ahead of or behind
171
+ * what is drawn, and a finger stops what it sees.
172
+ */
173
+ private stopCoast;
174
+ /**
175
+ * Ends an interaction from the handler that ends it: the lift, the cancel
176
+ * or the coast's last frame. The owner renders the last value at once, and
177
+ * the parts return to the stylesheet. `onChangeEnd` then reports what the
178
+ * owner rendered, unless the browser took the touch before any drag
179
+ * (`report` false).
180
+ */
181
+ private finish;
182
+ private lift;
183
+ private drop;
184
+ private measure;
185
+ private endOf;
186
+ private animatorFor;
187
+ private partsOf;
188
+ }
189
+ //# sourceMappingURL=sliderTouchController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sliderTouchController.d.ts","sourceRoot":"","sources":["../../src/Slider/sliderTouchController.ts"],"names":[],"mappings":"AA8BA,OAAO,EAGL,KAAK,WAAW,EAEjB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAwB,KAAK,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAiB/E,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAC5C,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC;AAED,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,g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