@astryxdesign/core 0.7.7-canary.fc68123 → 0.7.7
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/CHANGELOG.md +104 -0
- package/dist/AlertDialog/AlertDialog.d.ts +1 -4
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +6 -36
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +4 -23
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +1 -3
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +1 -17
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +2 -13
- package/dist/ComplexSelector/ComplexSelector.d.ts +1 -4
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +4 -14
- package/dist/ContextMenu/ContextMenu.js +2 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +31 -7
- package/dist/Field/Field.js +2 -2
- package/dist/HoverCard/HoverCard.d.ts +3 -4
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +2 -27
- package/dist/HoverCard/useHoverCard.d.ts +4 -5
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +31 -17
- package/dist/Icon/Icon.d.ts +1 -5
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +2 -5
- package/dist/Layer/usePressPin.d.ts +5 -17
- package/dist/Layer/usePressPin.d.ts.map +1 -1
- package/dist/Layer/usePressPin.js +12 -62
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +0 -18
- package/dist/PowerSearch/PowerSearch.d.ts +3 -36
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +127 -433
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +1 -32
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +6 -17
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +3 -38
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +61 -170
- package/dist/PowerSearch/formatFilterValue.d.ts +0 -7
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +1 -11
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +2 -3
- package/dist/RadioList/RadioListItem.d.ts +1 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +3 -5
- package/dist/Resizable/ResizeHandle.d.ts +1 -2
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +77 -99
- package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -1
- package/dist/SegmentedControl/useSegmentedSelectionMotion.js +3 -3
- package/dist/Slider/sliderTouchController.js +2 -2
- package/dist/Spinner/Spinner.d.ts +1 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +58 -60
- package/dist/Switch/useSwitchTouch.js +4 -4
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +8 -29
- package/dist/TextInput/TextInput.d.ts +2 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +7 -10
- package/dist/Toast/Toast.d.ts +1 -11
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +15 -25
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +34 -94
- package/dist/Toast/types.d.ts +3 -9
- package/dist/Toast/types.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +1 -19
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +53 -34
- package/dist/Typeahead/TypeaheadItem.d.ts +1 -2
- package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
- package/dist/astryx.css +6 -35
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +3 -4
- package/dist/hooks/actionGroupTracker.d.ts +1 -4
- package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
- package/dist/hooks/actionGroupTracker.js +3 -13
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/useAttachment.d.ts +1 -1
- package/dist/hooks/useAttachment.js +1 -1
- package/dist/hooks/useInputStatusIcon.d.ts +1 -1
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +2 -2
- package/dist/hooks/useLongPress.d.ts +2 -6
- package/dist/hooks/useLongPress.d.ts.map +1 -1
- package/dist/hooks/useLongPress.js +15 -95
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.js +0 -6
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +0 -30
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +0 -30
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +6 -5
- package/dist/motion/animator.d.ts +14 -14
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +18 -41
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +0 -12
- package/dist/utils/focusReturn.d.ts +0 -15
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +0 -28
- package/dist/utils/interactionOverlay.stylex.d.ts +2 -3
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +2 -3
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +6 -19
- package/locales/en.json +0 -120
- package/locales/pseudo.json +0 -90
- package/package.json +5 -10
- package/src/AlertDialog/AlertDialog.doc.mjs +2 -2
- package/src/AlertDialog/AlertDialog.tsx +5 -37
- package/src/BottomSheet/BottomSheetPanel.tsx +3 -37
- package/src/BottomSheet/useSheetGestures.ts +1 -3
- package/src/Button/Button.tsx +4 -26
- package/src/CheckboxInput/CheckboxInput.doc.mjs +0 -18
- package/src/CheckboxInput/CheckboxInput.tsx +9 -36
- package/src/ComplexSelector/ComplexSelector.tsx +5 -20
- package/src/ContextMenu/ContextMenu.tsx +2 -2
- package/src/Dialog/Dialog.tsx +31 -10
- package/src/Field/Field.tsx +2 -2
- package/src/HoverCard/HoverCard.doc.mjs +2 -4
- package/src/HoverCard/HoverCard.tsx +4 -35
- package/src/HoverCard/useHoverCard.doc.mjs +36 -178
- package/src/HoverCard/useHoverCard.tsx +52 -46
- package/src/Icon/Icon.doc.mjs +8 -49
- package/src/Icon/Icon.tsx +7 -15
- package/src/Layer/usePressPin.ts +15 -81
- package/src/Lightbox/Lightbox.tsx +0 -18
- package/src/PowerSearch/PowerSearch.doc.mjs +5 -54
- package/src/PowerSearch/PowerSearch.tsx +155 -609
- package/src/PowerSearch/PowerSearchEditPopover.tsx +6 -28
- package/src/PowerSearch/PowerSearchValueEditor.tsx +38 -203
- package/src/PowerSearch/formatFilterValue.ts +1 -18
- package/src/RadioList/RadioList.tsx +2 -3
- package/src/RadioList/RadioListItem.tsx +3 -5
- package/src/Resizable/Resizable.doc.mjs +4 -5
- package/src/Resizable/ResizeHandle.tsx +109 -167
- package/src/SegmentedControl/useSegmentedSelectionMotion.ts +3 -6
- package/src/Slider/sliderTouchController.ts +2 -2
- package/src/Spinner/Spinner.tsx +63 -77
- package/src/Switch/useSwitchTouch.ts +4 -4
- package/src/Table/BaseTable.tsx +12 -46
- package/src/TextInput/TextInput.tsx +10 -11
- package/src/Toast/Toast.doc.mjs +3 -4
- package/src/Toast/Toast.tsx +32 -52
- package/src/Toast/ToastViewport.tsx +35 -121
- package/src/Toast/types.ts +3 -9
- package/src/Tooltip/useTooltip.doc.mjs +0 -24
- package/src/Tooltip/useTooltip.tsx +56 -61
- package/src/Typeahead/TypeaheadItem.doc.mjs +3 -6
- package/src/Typeahead/TypeaheadItem.tsx +1 -2
- package/src/gestures/PressTracker.ts +3 -4
- package/src/gestures/README.md +1 -7
- package/src/hooks/actionGroupTracker.ts +5 -20
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useAttachment.ts +1 -1
- package/src/hooks/useInputStatusIcon.tsx +2 -3
- package/src/hooks/useLongPress.doc.mjs +2 -2
- package/src/hooks/useLongPress.ts +15 -136
- package/src/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.ts +0 -6
- package/src/i18n/generated-locales/en.generated.ts +0 -41
- package/src/i18n/generated-locales/pseudo.generated.ts +0 -42
- package/src/index.ts +0 -13
- package/src/motion/README.md +5 -9
- package/src/motion/animatedLayout.ts +4 -5
- package/src/motion/animator.ts +29 -61
- package/src/utils/dateParser.ts +0 -16
- package/src/utils/focusReturn.ts +0 -30
- package/src/utils/interactionOverlay.stylex.ts +2 -3
- package/src/utils/pressFeedback.ts +6 -19
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +0 -100
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +0 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.js +0 -1913
- package/dist/PowerSearch/formatTokenValue.d.ts +0 -28
- package/dist/PowerSearch/formatTokenValue.d.ts.map +0 -1
- package/dist/PowerSearch/formatTokenValue.js +0 -160
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts +0 -65
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts.map +0 -1
- package/dist/PowerSearch/powerSearchSheetUtils.js +0 -168
- package/dist/animator/createAnimator.d.ts +0 -98
- package/dist/animator/createAnimator.d.ts.map +0 -1
- package/dist/animator/createAnimator.js +0 -259
- package/dist/hooks/pressGroupContext.d.ts +0 -6
- package/dist/hooks/pressGroupContext.d.ts.map +0 -1
- package/dist/hooks/pressGroupContext.js +0 -20
- package/dist/hooks/useActionGroupTracking.d.ts +0 -53
- package/dist/hooks/useActionGroupTracking.d.ts.map +0 -1
- package/dist/hooks/useActionGroupTracking.js +0 -174
- package/dist/hooks/useAnimator.d.ts +0 -41
- package/dist/hooks/useAnimator.d.ts.map +0 -1
- package/dist/hooks/useAnimator.js +0 -70
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts +0 -8
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +0 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +0 -42
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts +0 -8
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts.map +0 -1
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.js +0 -14
- package/dist/internal/indicatorPress.stylex.d.ts +0 -20
- package/dist/internal/indicatorPress.stylex.d.ts.map +0 -1
- package/dist/internal/indicatorPress.stylex.js +0 -26
- package/dist/motion/progress.d.ts +0 -88
- package/dist/motion/progress.d.ts.map +0 -1
- package/dist/motion/progress.js +0 -128
- package/dist/motion/uikit/alert.d.ts +0 -41
- package/dist/motion/uikit/alert.d.ts.map +0 -1
- package/dist/motion/uikit/alert.js +0 -43
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts +0 -15
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +0 -1
- package/dist/privateAttributes/pressGroupItem.stylex.js +0 -23
- package/dist/utils/triggerFocus.d.ts +0 -36
- package/dist/utils/triggerFocus.d.ts.map +0 -1
- package/dist/utils/triggerFocus.js +0 -65
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +0 -2515
- package/src/PowerSearch/formatTokenValue.ts +0 -215
- package/src/PowerSearch/powerSearchSheetUtils.ts +0 -224
- package/src/animator/createAnimator.doc.mjs +0 -153
- package/src/animator/createAnimator.ts +0 -324
- package/src/hooks/pressGroupContext.ts +0 -21
- package/src/hooks/useActionGroupTracking.ts +0 -224
- package/src/hooks/useAnimator.doc.mjs +0 -109
- package/src/hooks/useAnimator.ts +0 -67
- package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +0 -43
- package/src/i18n/generated-english/PowerSearch/formatTokenValue.generated.ts +0 -15
- package/src/internal/indicatorPress.stylex.ts +0 -24
- package/src/motion/progress.ts +0 -155
- package/src/motion/uikit/alert.ts +0 -43
- package/src/privateAttributes/pressGroupItem.stylex.ts +0 -23
- package/src/utils/triggerFocus.ts +0 -80
package/src/motion/animator.ts
CHANGED
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
* @file animator.ts
|
|
5
5
|
* @input An element, target values, and a spring, momentum curves (coast.ts)
|
|
6
6
|
* or any closed-form curve
|
|
7
|
-
* @output Exports `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Reduced Motion substitution.
|
|
7
|
+
* @output Exports `createAnimator`: a compositor animator for translate,
|
|
8
|
+
* rotate, scale and opacity, with presentation values and velocities read
|
|
9
|
+
* from the analytic curves, velocity-preserving retargeting, freeze-in-place
|
|
10
|
+
* `stop`, completion promises, a shared clock, and UIKit's Reduced Motion
|
|
11
|
+
* substitution; plus its option, handle and transition types
|
|
13
12
|
* @position Motion foundation (DOM). Internal to core: components use it for
|
|
14
13
|
* every touch-presentation animation; not exported from the package entry
|
|
15
14
|
*
|
|
@@ -245,18 +244,18 @@ export interface AnimateOptions {
|
|
|
245
244
|
crossfadeAs?: 'entrance' | 'exit';
|
|
246
245
|
/**
|
|
247
246
|
* When the call's animations start. By default a call from rest starts
|
|
248
|
-
* when the browser commits it
|
|
249
|
-
* retarget) starts now, from the value on screen.
|
|
250
|
-
* already shows as at rest counts as rest. Ignored with `at`.
|
|
247
|
+
* when the browser commits it, and a call that continues motion on screen
|
|
248
|
+
* (a retarget) starts now, from the value on screen. Ignored with `at`.
|
|
251
249
|
* - `'commit'`: a call that continues motion also starts when the browser
|
|
252
|
-
* commits it
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
250
|
+
* commits it, dated by the browser rather than by the main thread, as a
|
|
251
|
+
* call from rest is.
|
|
252
|
+
* - `'presented'`: a call from rest leaves its element at rest and creates
|
|
253
|
+
* its animations two frames later, once the frame that carries the
|
|
254
|
+
* element at rest has been presented; they then start at their commit. A
|
|
255
|
+
* busy UI process delays the motion instead of skipping into it, for two
|
|
256
|
+
* frames more before an idle start. Any other change to the animator
|
|
257
|
+
* before then creates the animations first, in call order. A call that
|
|
258
|
+
* continues motion on screen (a retarget) starts now, as by default.
|
|
260
259
|
*/
|
|
261
260
|
start?: 'commit' | 'presented';
|
|
262
261
|
/**
|
|
@@ -298,7 +297,7 @@ export interface MotionCurve {
|
|
|
298
297
|
}
|
|
299
298
|
|
|
300
299
|
/**
|
|
301
|
-
* Options of `
|
|
300
|
+
* Options of `createAnimator`.
|
|
302
301
|
*/
|
|
303
302
|
/** How `set` puts values in place. */
|
|
304
303
|
export interface SetOptions {
|
|
@@ -653,18 +652,6 @@ const SAMPLE_TOLERANCE: Record<MotionProperty, number> = {
|
|
|
653
652
|
/** Keyframes start on this grid (ms) and are split where the curve needs it. */
|
|
654
653
|
const SAMPLE_GRID_MS = 1000 / 30;
|
|
655
654
|
|
|
656
|
-
/**
|
|
657
|
-
* A curve within this many sample tolerances of its target can show as at
|
|
658
|
-
* rest. A call on it then starts as one from rest does, at the browser's start.
|
|
659
|
-
*/
|
|
660
|
-
const REST_DISTANCE_TOLERANCES = 2;
|
|
661
|
-
|
|
662
|
-
/**
|
|
663
|
-
* A curve shows as at rest only while it moves at most one `SAMPLE_TOLERANCE`
|
|
664
|
-
* a frame at this rate.
|
|
665
|
-
*/
|
|
666
|
-
const REST_FRAMES_PER_SECOND = 60;
|
|
667
|
-
|
|
668
655
|
/** A curve that has not settled by then (an undamped spring) snaps. */
|
|
669
656
|
const MAX_DURATION_MS = 30_000;
|
|
670
657
|
|
|
@@ -816,7 +803,7 @@ export function animatorFor(
|
|
|
816
803
|
const key = options.pseudoElement ?? '';
|
|
817
804
|
let animator = byPseudo.get(key);
|
|
818
805
|
if (animator == null) {
|
|
819
|
-
animator =
|
|
806
|
+
animator = createAnimator(element, options);
|
|
820
807
|
byPseudo.set(key, animator);
|
|
821
808
|
}
|
|
822
809
|
return animator;
|
|
@@ -933,7 +920,7 @@ const REDUCED_TRANSITION: SpringTransition = {
|
|
|
933
920
|
*
|
|
934
921
|
* @example
|
|
935
922
|
* ```
|
|
936
|
-
* const animator =
|
|
923
|
+
* const animator = createAnimator(sheet);
|
|
937
924
|
* // finger lifts at 1200 px/s heading for the detent at 0 (a component
|
|
938
925
|
* // passes the spring of its motion role):
|
|
939
926
|
* animator.animate({y: 0}, {spring: {response: 0.45, dampingRatio: 0.9}, velocity: {y: 1200}});
|
|
@@ -942,7 +929,7 @@ const REDUCED_TRANSITION: SpringTransition = {
|
|
|
942
929
|
* animator.stop(['y']);
|
|
943
930
|
* ```
|
|
944
931
|
*/
|
|
945
|
-
export function
|
|
932
|
+
export function createAnimator(
|
|
946
933
|
element: HTMLElement | null,
|
|
947
934
|
options: AnimatorOptions = {},
|
|
948
935
|
): Animator {
|
|
@@ -1178,22 +1165,6 @@ export function createMotionAnimator(
|
|
|
1178
1165
|
return curveAt(property, time);
|
|
1179
1166
|
};
|
|
1180
1167
|
|
|
1181
|
-
/**
|
|
1182
|
-
* Whether a curve's tail already shows as at rest at `time`. Under a
|
|
1183
|
-
* starved main thread the browser commits a call late. A call that starts
|
|
1184
|
-
* at its own time then skips that far into its curve. One that starts at
|
|
1185
|
-
* the commit holds an element that hardly moves.
|
|
1186
|
-
*/
|
|
1187
|
-
const showsAtRest = (
|
|
1188
|
-
property: MotionProperty,
|
|
1189
|
-
segment: Segment,
|
|
1190
|
-
time: number,
|
|
1191
|
-
): boolean =>
|
|
1192
|
-
Math.abs(valueAt(property, time) - segment.target) <=
|
|
1193
|
-
REST_DISTANCE_TOLERANCES * SAMPLE_TOLERANCE[property] &&
|
|
1194
|
-
Math.abs(velocityAt(property, time)) <=
|
|
1195
|
-
SAMPLE_TOLERANCE[property] * REST_FRAMES_PER_SECOND;
|
|
1196
|
-
|
|
1197
1168
|
const velocityAt = (property: MotionProperty, time: number): number => {
|
|
1198
1169
|
const held = segments.get(property);
|
|
1199
1170
|
if (held != null && isHeld(held)) {
|
|
@@ -2062,10 +2033,10 @@ export function createMotionAnimator(
|
|
|
2062
2033
|
// -- starting from rest ---------------------------------------------------
|
|
2063
2034
|
|
|
2064
2035
|
/**
|
|
2065
|
-
* A call starts from rest when nothing on the channels it drives
|
|
2066
|
-
*
|
|
2067
|
-
*
|
|
2068
|
-
*
|
|
2036
|
+
* A call starts from rest when nothing on the channels it drives is moving
|
|
2037
|
+
* (a curve still waiting for its first frame counts as rest) and nothing
|
|
2038
|
+
* pins its clock (`at`). Returns its start group, or null for an explicit
|
|
2039
|
+
* start.
|
|
2069
2040
|
*/
|
|
2070
2041
|
const beginGroup = (
|
|
2071
2042
|
time: number,
|
|
@@ -2099,12 +2070,10 @@ export function createMotionAnimator(
|
|
|
2099
2070
|
}
|
|
2100
2071
|
return null;
|
|
2101
2072
|
}
|
|
2102
|
-
// A call that continues motion starts now
|
|
2103
|
-
// browser's start (`commit`). `presented` asks only for a call from rest
|
|
2104
|
-
//
|
|
2105
|
-
//
|
|
2106
|
-
// counts as rest, so a call on it waits, under `presented` for its two
|
|
2107
|
-
// frames.
|
|
2073
|
+
// A call that continues motion starts now unless it asks for the
|
|
2074
|
+
// browser's start (`commit`). `presented` asks only for a call from rest:
|
|
2075
|
+
// an element still moving is not at rest, so a retarget starts now, from
|
|
2076
|
+
// the value and velocity on screen (spec:AST-094 FR6).
|
|
2108
2077
|
for (const channel of start === 'commit' ? [] : channels) {
|
|
2109
2078
|
for (const property of CHANNELS[channel]) {
|
|
2110
2079
|
const segment = segments.get(property);
|
|
@@ -2115,8 +2084,7 @@ export function createMotionAnimator(
|
|
|
2115
2084
|
time < endOf(property, segment) &&
|
|
2116
2085
|
(segment.group == null ||
|
|
2117
2086
|
segment.group.resolved ||
|
|
2118
|
-
shownSince(property, segment) != null)
|
|
2119
|
-
!showsAtRest(property, segment, time)
|
|
2087
|
+
shownSince(property, segment) != null)
|
|
2120
2088
|
) {
|
|
2121
2089
|
return null;
|
|
2122
2090
|
}
|
package/src/utils/dateParser.ts
CHANGED
|
@@ -32,11 +32,6 @@ export function isLocaleDayFirst(locale: Locale = 'en'): boolean {
|
|
|
32
32
|
return dayIndex < monthIndex;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
// Built at run time: a Unicode property escape in a literal fails a source
|
|
36
|
-
// build whose Babel lacks the Unicode data.
|
|
37
|
-
const LETTER_FREE = new RegExp('^[^\\p{L}]+$', 'u');
|
|
38
|
-
const YEAR_FIRST = new RegExp('^\\d{4}[^\\p{L}\\d]', 'u');
|
|
39
|
-
|
|
40
35
|
/**
|
|
41
36
|
* Parses user input into a PlainDate.
|
|
42
37
|
*
|
|
@@ -143,17 +138,6 @@ export function parseDateInput(
|
|
|
143
138
|
if (/^\d+$/.test(trimmed)) {
|
|
144
139
|
return null;
|
|
145
140
|
}
|
|
146
|
-
// In a day-first locale, letter-free text that no form above matched is not
|
|
147
|
-
// a date. Native `Date` reads `a/b/c` month first. It also takes a year of
|
|
148
|
-
// one to three digits. So "12/01/2" gives a wrong date. A four-digit year
|
|
149
|
-
// written first is not ambiguous.
|
|
150
|
-
if (
|
|
151
|
-
isLocaleDayFirst(locale) &&
|
|
152
|
-
LETTER_FREE.test(trimmed) &&
|
|
153
|
-
!YEAR_FIRST.test(trimmed)
|
|
154
|
-
) {
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
141
|
|
|
158
142
|
const parsed = new Date(trimmed);
|
|
159
143
|
if (!isNaN(parsed.getTime())) {
|
package/src/utils/focusReturn.ts
CHANGED
|
@@ -151,33 +151,3 @@ export function focusForLastInput(
|
|
|
151
151
|
}
|
|
152
152
|
element.focus({...options, focusVisible: false});
|
|
153
153
|
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Prepares the focus return for an open surface that may be removed while
|
|
157
|
-
* open (rendered only while open, or removed with its view). Removing a
|
|
158
|
-
* `<dialog>` runs no close and no browser focus return. Call this while the
|
|
159
|
-
* surface is mounted: it reads the frame that hosts the surface now, because a
|
|
160
|
-
* removed frame's document has no window. Call the returned function from the
|
|
161
|
-
* effect cleanup with the opener.
|
|
162
|
-
*
|
|
163
|
-
* Once the commit has finished, focus moves to the opener only when the
|
|
164
|
-
* surface really left the document (StrictMode's simulated unmount keeps it),
|
|
165
|
-
* the opener is still on the page, and the removal lost focus, both in the
|
|
166
|
-
* surface's document and in the document that hosts its frame. A control the
|
|
167
|
-
* user pressed outside the surface, or outside its frame, keeps its focus.
|
|
168
|
-
*/
|
|
169
|
-
export function prepareFocusReturnOnRemoval(
|
|
170
|
-
surface: Element,
|
|
171
|
-
): (opener: Element | null) => void {
|
|
172
|
-
const host = surface.ownerDocument.defaultView?.frameElement ?? null;
|
|
173
|
-
return opener => {
|
|
174
|
-
queueMicrotask(() => {
|
|
175
|
-
if (surface.isConnected || opener == null || !opener.isConnected) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
if (isFocusLost(surface) && (host == null || isFocusLost(host))) {
|
|
179
|
-
focusForLastInput(opener as HTMLElement);
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
}
|
|
@@ -15,9 +15,8 @@
|
|
|
15
15
|
* SYNC: When modified, update pressFeedback.ts, pressGesture.ts (the fade
|
|
16
16
|
* clock), hooks/usePressFeedback.doc.mjs, the components that paint the touch
|
|
17
17
|
* press off an ancestor scope or a pseudo-element (Switch, Tab,
|
|
18
|
-
* CheckboxInput, RadioListItem, ClickableCard, SelectableCard, Thumbnail)
|
|
19
|
-
*
|
|
20
|
-
* scripts/build-css.test.mjs.
|
|
18
|
+
* CheckboxInput, RadioListItem, ClickableCard, SelectableCard, Thumbnail)
|
|
19
|
+
* and scripts/build-css.test.mjs.
|
|
21
20
|
*/
|
|
22
21
|
|
|
23
22
|
// Every surface that paints a press uses one of these styles, so a change to
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file pressFeedback.ts
|
|
5
|
-
* @input The press state machine (pressGesture.ts), the menu-press
|
|
6
|
-
*
|
|
5
|
+
* @input The press state machine (pressGesture.ts), the menu-press marker
|
|
6
|
+
* (hooks/menuPressMarker.ts) and the document's pointer, keyboard, scroll and
|
|
7
7
|
* visibility events
|
|
8
8
|
* @output PRESSABLE_ATTRIBUTE, PRESSED_ATTRIBUTE, pressableProps and
|
|
9
9
|
* installPressFeedback
|
|
@@ -46,7 +46,6 @@ import {isCoarsePointer, watchCoarsePointer} from './coarsePointer';
|
|
|
46
46
|
import {subscribeInput} from './inputStream';
|
|
47
47
|
import {TOUCH_QUERY} from './touchPresentation';
|
|
48
48
|
import {holdsPressThroughDrag} from '../privateAttributes/pressHoldsDrag.stylex';
|
|
49
|
-
import {isTrackedByGroup} from '../privateAttributes/pressGroupItem.stylex';
|
|
50
49
|
|
|
51
50
|
/**
|
|
52
51
|
* The marker the controller finds with `closest()`. Every Astryx component
|
|
@@ -326,9 +325,8 @@ function stylesheetDroppedActive(): boolean {
|
|
|
326
325
|
|
|
327
326
|
/**
|
|
328
327
|
* The surface a mouse button's or the Space key's press paints, if any: the
|
|
329
|
-
* innermost marked surface, outside a menu
|
|
330
|
-
*
|
|
331
|
-
* `:active` does.
|
|
328
|
+
* innermost marked surface, outside a menu. A key's press paints only a
|
|
329
|
+
* focused element that is itself the surface, as `:active` does.
|
|
332
330
|
*/
|
|
333
331
|
function buttonSurfaceAt(
|
|
334
332
|
target: EventTarget | null,
|
|
@@ -338,10 +336,6 @@ function buttonSurfaceAt(
|
|
|
338
336
|
if (element == null || element.closest(MENU_PRESS_ROOT) != null) {
|
|
339
337
|
return null;
|
|
340
338
|
}
|
|
341
|
-
// A group's tracker follows pointers only, so a key's press stays here.
|
|
342
|
-
if (pointerId != null && isTrackedByGroup(element)) {
|
|
343
|
-
return null;
|
|
344
|
-
}
|
|
345
339
|
if (pointerId == null && element !== target) {
|
|
346
340
|
return null;
|
|
347
341
|
}
|
|
@@ -420,9 +414,7 @@ function onPointerDown(event: PointerEvent): void {
|
|
|
420
414
|
const braking = element != null && scrollerIsBraking(element);
|
|
421
415
|
lastTouchAt = Date.now();
|
|
422
416
|
lastTouchTarget = event.target instanceof Node ? event.target : null;
|
|
423
|
-
|
|
424
|
-
// other's paint. The touch still counts for the brake above.
|
|
425
|
-
if (element == null || braking || isTrackedByGroup(element)) {
|
|
417
|
+
if (element == null || braking) {
|
|
426
418
|
return;
|
|
427
419
|
}
|
|
428
420
|
takeOver(button, element);
|
|
@@ -568,11 +560,6 @@ function activatesOnSpace(target: EventTarget | null): boolean {
|
|
|
568
560
|
);
|
|
569
561
|
}
|
|
570
562
|
|
|
571
|
-
/** A tracked action takes no `:active` paint, so a key's press paints here. */
|
|
572
|
-
function isTrackedAction(target: EventTarget | null): boolean {
|
|
573
|
-
return target instanceof Element && isTrackedByGroup(target);
|
|
574
|
-
}
|
|
575
|
-
|
|
576
563
|
/**
|
|
577
564
|
* Space went down on a focused button that is itself a pressable surface.
|
|
578
565
|
* Heard in the BUBBLE phase, after the page's own handlers, so a press the
|
|
@@ -586,7 +573,7 @@ function onKeyDown(event: KeyboardEvent): void {
|
|
|
586
573
|
event.isComposing ||
|
|
587
574
|
event.defaultPrevented ||
|
|
588
575
|
!activatesOnSpace(event.target) ||
|
|
589
|
-
!
|
|
576
|
+
!stylesheetDroppedActive()
|
|
590
577
|
) {
|
|
591
578
|
return;
|
|
592
579
|
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file PowerSearchBottomSheet.tsx
|
|
3
|
-
* @input The field's InternalConfig, filters, onChange, the field typeahead
|
|
4
|
-
* source, and the sheet options PowerSearch forwards; BottomSheet,
|
|
5
|
-
* Button, EmptyState, Heading, Icon, IconButton, Indicator, List,
|
|
6
|
-
* RadioList, Text, TextInput, PowerSearchValueEditor, the internal sheet
|
|
7
|
-
* confirmation and search-drag owners, i18n
|
|
8
|
-
* @output Exports PowerSearchBottomSheet — the touch surface of
|
|
9
|
-
* `PowerSearch experimental.presentation="bottom-sheet"`: a Filters sheet
|
|
10
|
-
* with editable rows and trailing remove actions, Add filter in its fixed
|
|
11
|
-
* header and Clear all / Done in its fixed footer, an Add filter sheet with
|
|
12
|
-
* grouped field rows or the content search with inline suggestions, and a
|
|
13
|
-
* value step that stages field → operator → value and confirms from its
|
|
14
|
-
* footer
|
|
15
|
-
* @position Internal presentation surface of PowerSearch. Loaded on demand by
|
|
16
|
-
* PowerSearch.tsx so the popover presentation never carries it. The
|
|
17
|
-
* trigger lives in PowerSearch.tsx.
|
|
18
|
-
*
|
|
19
|
-
* The three steps are sibling standalone BottomSheets that stack: each step
|
|
20
|
-
* opens above the sheet that led to it, which stays open beneath as a covered
|
|
21
|
-
* sheet, so no sheet needs a Back action. A dismissal closes only the top
|
|
22
|
-
* sheet and reveals the step beneath; dismissing the bottom sheet ends the
|
|
23
|
-
* flow. A list value's Tokenizer opens its own sheet above the value step, as
|
|
24
|
-
* the top sheet of the stack.
|
|
25
|
-
*
|
|
26
|
-
* The sheets pad their own content (`padding={0}` on BottomSheet). The
|
|
27
|
-
* Filters and Add filter sheets keep their header and footer fixed around a
|
|
28
|
-
* scroll viewport that reaches the sheet edge; its content publishes the
|
|
29
|
-
* padding as container padding so `edge="bleed"` lists run edge to edge with
|
|
30
|
-
* row text on the header's inset. The sheets are pinned tall: the field list
|
|
31
|
-
* resizes as it is searched and the editor changes with the operator, and
|
|
32
|
-
* only a fully expanded tall sheet gives mobile-keyboard accommodation.
|
|
33
|
-
*
|
|
34
|
-
* SYNC: When modified, update:
|
|
35
|
-
* - /packages/core/src/PowerSearch/PowerSearch.tsx (the trigger and the lazy host)
|
|
36
|
-
* - /docs/specs/components/PowerSearch/PowerSearch.spec.md (FR10–FR21, AR4–AR6, PR5)
|
|
37
|
-
*/
|
|
38
|
-
import React, { type RefObject } from 'react';
|
|
39
|
-
import type { SearchSource } from '../Typeahead/types.js';
|
|
40
|
-
import type { buildRelativeDateOptions, PowerSearchValueEditor } from './PowerSearchValueEditor.js';
|
|
41
|
-
import type { NestedEditor } from './PowerSearchEditPopover.js';
|
|
42
|
-
import type { InternalConfig } from './useInternalConfig.js';
|
|
43
|
-
import type { PowerSearchChangeType, PowerSearchComponents, PowerSearchConfig, PowerSearchFilter, PowerSearchItem } from './types.js';
|
|
44
|
-
/**
|
|
45
|
-
* The popover presentation's editors, which the value step reuses. They come
|
|
46
|
-
* from PowerSearch.tsx, whose module graph already loads them for the popover
|
|
47
|
-
* presentation. Imported here, they and every component they reach would join
|
|
48
|
-
* this lazily imported graph, whose modules must import Core directly and
|
|
49
|
-
* never through a barrel.
|
|
50
|
-
*/
|
|
51
|
-
export interface PowerSearchSheetEditors {
|
|
52
|
-
NestedEditor: typeof NestedEditor;
|
|
53
|
-
PowerSearchValueEditor: typeof PowerSearchValueEditor;
|
|
54
|
-
buildRelativeDateOptions: typeof buildRelativeDateOptions;
|
|
55
|
-
}
|
|
56
|
-
export interface PowerSearchBottomSheetProps {
|
|
57
|
-
/** Whether the flow is open; the trigger in PowerSearch.tsx owns it. */
|
|
58
|
-
isOpen: boolean;
|
|
59
|
-
onOpenChange: (isOpen: boolean) => void;
|
|
60
|
-
/**
|
|
61
|
-
* The trigger: where focus returns when the flow closes, whichever step
|
|
62
|
-
* closed it and however it opened (a tap on a token included).
|
|
63
|
-
*/
|
|
64
|
-
finalFocusRef: RefObject<HTMLElement | null>;
|
|
65
|
-
/**
|
|
66
|
-
* The field's formatted result count, announced from inside the open
|
|
67
|
-
* sheet's dialog when it changes while the flow is open. `useAnnounce`
|
|
68
|
-
* routes a message by where its caller is, so the owner above the sheets
|
|
69
|
-
* cannot reach the dialog's region.
|
|
70
|
-
*/
|
|
71
|
-
resultCountText?: string | null;
|
|
72
|
-
config: InternalConfig;
|
|
73
|
-
/** The caller's config, handed to Editor overrides as they expect it. */
|
|
74
|
-
configProp: PowerSearchConfig;
|
|
75
|
-
filters: ReadonlyArray<PowerSearchFilter>;
|
|
76
|
-
onChange: (filters: ReadonlyArray<PowerSearchFilter>, changeType: PowerSearchChangeType, index: number) => void;
|
|
77
|
-
/** The field typeahead source; the content search lists its suggestions. */
|
|
78
|
-
searchSource: SearchSource<PowerSearchItem>;
|
|
79
|
-
/** Placeholder of the content search. */
|
|
80
|
-
placeholder: string;
|
|
81
|
-
isReadOnly: boolean;
|
|
82
|
-
isDisabled: boolean;
|
|
83
|
-
hasClear: boolean;
|
|
84
|
-
maxOperatorMenuItems?: number;
|
|
85
|
-
maxSearchResults: number;
|
|
86
|
-
/** The caller's confirm label; the step picks a default per mode. */
|
|
87
|
-
saveButtonLabel?: string;
|
|
88
|
-
components?: PowerSearchComponents;
|
|
89
|
-
editors: PowerSearchSheetEditors;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* The sheet flow of PowerSearch's touch presentation: Filters, Add filter,
|
|
93
|
-
* and the value step, as standalone sheets that stack, each open beneath the
|
|
94
|
-
* step it led to.
|
|
95
|
-
*/
|
|
96
|
-
export declare function PowerSearchBottomSheet({ isOpen, onOpenChange, finalFocusRef, resultCountText, config, configProp, filters, onChange, searchSource, placeholder, isReadOnly, isDisabled, hasClear, maxOperatorMenuItems, maxSearchResults, saveButtonLabel: saveButtonLabelFromProps, components: componentOverrides, editors, }: PowerSearchBottomSheetProps): React.JSX.Element;
|
|
97
|
-
export declare namespace PowerSearchBottomSheet {
|
|
98
|
-
var displayName: string;
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=PowerSearchBottomSheet.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PowerSearchBottomSheet.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearchBottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,EASZ,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAoBf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAkCrD,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAe3D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAIV,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EAEjB,iBAAiB,EACjB,eAAe,EAEhB,MAAM,SAAS,CAAC;AAajB;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,sBAAsB,EAAE,OAAO,sBAAsB,CAAC;IACtD,wBAAwB,EAAE,OAAO,wBAAwB,CAAC;CAC3D;AAED,MAAM,WAAW,2BAA2B;IAC1C,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,aAAa,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC7C;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,cAAc,CAAC;IACvB,yEAAyE;IACzE,UAAU,EAAE,iBAAiB,CAAC;IAC9B,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC1C,QAAQ,EAAE,CACR,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,EACzC,UAAU,EAAE,qBAAqB,EACjC,KAAK,EAAE,MAAM,KACV,IAAI,CAAC;IACV,4EAA4E;IAC5E,YAAY,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;IAC5C,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,OAAO,EAAE,uBAAuB,CAAC;CAClC;AAymBD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,YAAY,EACZ,aAAa,EACb,eAAe,EACf,MAAM,EACN,UAAU,EACV,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,UAAU,EACV,UAAU,EACV,QAAQ,EACR,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EAAE,wBAAwB,EACzC,UAAU,EAAE,kBAAkB,EAC9B,OAAO,GACR,EAAE,2BAA2B,qBAqoD7B;yBAxpDe,sBAAsB"}
|