@astryxdesign/core 0.7.6 → 0.7.7-canary.0eb44a2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +23 -3
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +1 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +16 -9
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +2 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +3 -2
- 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/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +8 -1
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +72 -2
- package/dist/DateInput/Wheel.d.ts +17 -1
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +179 -19
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +63 -49
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +37 -1
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +6 -0
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
- package/dist/Drawer/useDrawerDialogPresence.js +4 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +20 -4
- 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/Field/PanelSearchInput.d.ts.map +1 -1
- package/dist/Field/PanelSearchInput.js +8 -1
- package/dist/Field/textEntryTraits.d.ts +6 -6
- package/dist/Field/textEntryTraits.js +6 -6
- package/dist/Layer/layerClickBoundary.d.ts +7 -1
- package/dist/Layer/layerClickBoundary.d.ts.map +1 -1
- package/dist/Layer/layerClickBoundary.js +2 -2
- package/dist/Layer/usePressPin.d.ts +95 -0
- package/dist/Layer/usePressPin.d.ts.map +1 -0
- package/dist/Layer/usePressPin.js +365 -0
- package/dist/Layer/useTouchTrigger.d.ts +23 -1
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +45 -7
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +2 -1
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +1 -0
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +56 -7
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +38 -30
- package/dist/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +52 -14
- package/dist/ProgressBar/ProgressBarTouch.d.ts +29 -0
- package/dist/ProgressBar/ProgressBarTouch.d.ts.map +1 -0
- package/dist/ProgressBar/ProgressBarTouch.js +91 -0
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +2 -1
- 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/Switch/Switch.d.ts +1 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +200 -46
- package/dist/Switch/switchFill.d.ts +31 -0
- package/dist/Switch/switchFill.d.ts.map +1 -0
- package/dist/Switch/switchFill.js +88 -0
- package/dist/Switch/switchTouch.d.ts +81 -0
- package/dist/Switch/switchTouch.d.ts.map +1 -0
- package/dist/Switch/switchTouch.js +133 -0
- package/dist/Switch/useSwitchTouch.d.ts +285 -0
- package/dist/Switch/useSwitchTouch.d.ts.map +1 -0
- package/dist/Switch/useSwitchTouch.js +998 -0
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +4 -3
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +12 -5
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts +3 -0
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts.map +1 -0
- package/dist/Tokenizer/TokenizerItemRemovableContext.js +17 -0
- package/dist/Tooltip/Tooltip.d.ts +30 -6
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +5 -0
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +31 -5
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +59 -18
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +19 -9
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +26 -15
- package/dist/astryx.css +91 -8
- package/dist/gestures/GestureArena.d.ts +21 -2
- package/dist/gestures/GestureArena.d.ts.map +1 -1
- package/dist/gestures/GestureArena.js +23 -3
- package/dist/gestures/GestureHost.d.ts +123 -3
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +797 -15
- 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/PressTracker.d.ts +6 -0
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +3 -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 +17 -0
- package/dist/gestures/types.d.ts.map +1 -1
- package/dist/gestures/types.js +7 -0
- package/dist/gestures/usePressTracker.d.ts.map +1 -1
- package/dist/gestures/usePressTracker.js +1 -0
- package/dist/gestures/wheelSegmenter.d.ts +56 -0
- package/dist/gestures/wheelSegmenter.d.ts.map +1 -0
- package/dist/gestures/wheelSegmenter.js +122 -0
- package/dist/hooks/useAttachment.d.ts +16 -8
- package/dist/hooks/useAttachment.d.ts.map +1 -1
- package/dist/hooks/useAttachment.js +35 -15
- package/dist/hooks/useFocusTrap.d.ts +15 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +13 -2
- package/dist/hooks/usePager.d.ts +261 -0
- package/dist/hooks/usePager.d.ts.map +1 -0
- package/dist/hooks/usePager.js +1169 -0
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +140 -19
- package/dist/motion/paging.d.ts +69 -0
- package/dist/motion/paging.d.ts.map +1 -0
- package/dist/motion/paging.js +148 -0
- package/dist/motion/uikit/index.d.ts +8 -4
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +8 -4
- package/dist/motion/uikit/paging.d.ts +171 -0
- package/dist/motion/uikit/paging.d.ts.map +1 -0
- package/dist/motion/uikit/paging.js +192 -0
- package/dist/motion/uikit/progressBar.d.ts +79 -0
- package/dist/motion/uikit/progressBar.d.ts.map +1 -0
- package/dist/motion/uikit/progressBar.js +102 -0
- package/dist/motion/uikit/scroll.d.ts +0 -19
- package/dist/motion/uikit/scroll.d.ts.map +1 -1
- package/dist/motion/uikit/scroll.js +2 -21
- 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 +59 -30
- package/dist/motion/uikit/springs.d.ts.map +1 -1
- package/dist/motion/uikit/springs.js +64 -34
- package/dist/motion/uikit/switch.d.ts +166 -0
- package/dist/motion/uikit/switch.d.ts.map +1 -0
- package/dist/motion/uikit/switch.js +186 -0
- package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts +18 -0
- package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/pressHoldsDrag.stylex.js +28 -0
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +5 -0
- package/dist/utils/selectionLock.d.ts +43 -0
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +394 -6
- package/package.json +5 -5
- package/src/AppShell/AppShell.doc.mjs +10 -0
- package/src/AppShell/AppShell.tsx +48 -2
- package/src/Avatar/Avatar.tsx +3 -1
- package/src/BottomSheet/BottomSheetPanel.tsx +16 -9
- package/src/Breadcrumbs/BreadcrumbItem.tsx +4 -1
- package/src/Button/Button.tsx +3 -2
- 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/CommandPalette/CommandPaletteInput.tsx +6 -0
- package/src/DateInput/MonthScroller.tsx +63 -5
- package/src/DateInput/Wheel.tsx +174 -14
- package/src/DateRangeInput/DateRangeInput.doc.mjs +3 -2
- package/src/DateRangeInput/DateRangeInput.tsx +117 -71
- package/src/Dialog/Dialog.tsx +37 -1
- package/src/Drawer/Drawer.tsx +6 -0
- package/src/Drawer/useDrawerDialogPresence.ts +4 -0
- package/src/DropdownMenu/DropdownMenu.tsx +28 -6
- package/src/DropdownMenu/useMenuOverflow.ts +44 -8
- package/src/Field/PanelSearchInput.tsx +6 -0
- package/src/Field/textEntryTraits.ts +6 -6
- package/src/Layer/layerClickBoundary.ts +2 -2
- package/src/Layer/usePressPin.ts +516 -0
- package/src/Layer/useTouchTrigger.ts +56 -6
- package/src/Lightbox/Lightbox.tsx +2 -1
- package/src/Link/Link.tsx +3 -0
- package/src/Popover/usePopover.tsx +71 -9
- package/src/PowerSearch/PowerSearch.tsx +38 -31
- package/src/ProgressBar/ProgressBar.doc.mjs +7 -5
- package/src/ProgressBar/ProgressBar.tsx +147 -16
- package/src/ProgressBar/ProgressBarTouch.ts +109 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +2 -1
- 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/Switch/Switch.doc.mjs +3 -3
- package/src/Switch/Switch.tsx +412 -86
- package/src/Switch/switchFill.ts +106 -0
- package/src/Switch/switchTouch.ts +194 -0
- package/src/Switch/useSwitchTouch.ts +1121 -0
- package/src/TabList/Tab.tsx +5 -3
- package/src/Tokenizer/Tokenizer.tsx +15 -5
- package/src/Tokenizer/TokenizerItemRemovableContext.ts +22 -0
- package/src/Tooltip/Tooltip.doc.mjs +21 -6
- package/src/Tooltip/Tooltip.tsx +42 -5
- package/src/Tooltip/index.ts +1 -0
- package/src/Tooltip/useTooltip.doc.mjs +4 -2
- package/src/Tooltip/useTooltip.tsx +84 -21
- package/src/Typeahead/BaseTypeahead.tsx +16 -8
- package/src/Typeahead/Typeahead.tsx +29 -15
- package/src/gestures/GestureArena.ts +45 -4
- package/src/gestures/GestureHost.ts +958 -15
- package/src/gestures/GestureRecognizer.ts +28 -0
- package/src/gestures/PanGestureRecognizer.ts +8 -0
- package/src/gestures/PinchGestureRecognizer.ts +16 -1
- package/src/gestures/PressTracker.ts +10 -0
- package/src/gestures/README.md +82 -3
- 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 +18 -0
- package/src/gestures/usePressTracker.ts +2 -0
- package/src/gestures/wheelSegmenter.ts +143 -0
- package/src/hooks/useAttachment.ts +56 -14
- package/src/hooks/useFocusTrap.ts +26 -2
- package/src/hooks/usePager.ts +1446 -0
- package/src/motion/MEASUREMENTS.md +36 -27
- package/src/motion/README.md +7 -3
- package/src/motion/animator.ts +193 -25
- package/src/motion/paging.ts +161 -0
- package/src/motion/uikit/index.ts +7 -4
- package/src/motion/uikit/paging.ts +193 -0
- package/src/motion/uikit/progressBar.ts +102 -0
- package/src/motion/uikit/scroll.ts +2 -18
- package/src/motion/uikit/slider.ts +105 -0
- package/src/motion/uikit/springs.ts +53 -32
- package/src/motion/uikit/switch.ts +174 -0
- package/src/privateAttributes/pressHoldsDrag.stylex.ts +28 -0
- package/src/utils/pressFeedback.ts +5 -0
- package/src/utils/selectionLock.ts +501 -6
- package/dist/motion/selectPage.d.ts +0 -26
- package/dist/motion/selectPage.d.ts.map +0 -1
- package/dist/motion/selectPage.js +0 -55
- package/src/motion/selectPage.ts +0 -55
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animator.d.ts","sourceRoot":"","sources":["../../src/motion/animator.ts"],"names":[],"mappings":"AAsLA,OAAO,EAAwB,KAAK,iBAAiB,EAAC,MAAM,UAAU,CAAC;AASvE;;GAEG;AACH,MAAM,MAAM,cAAc,GACxB,GAAG,GAAG,GAAG,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,MAAM,EAAE,iBAAiB,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAClC;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC/B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,iBAAiB;IACjB,QAAQ,CAA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motion/animator.js
CHANGED
|
@@ -643,7 +643,7 @@ export function createAnimator(element, options = {}) {
|
|
|
643
643
|
if (segment == null) {
|
|
644
644
|
return null;
|
|
645
645
|
}
|
|
646
|
-
if (time >=
|
|
646
|
+
if (time >= endOf(property, segment)) {
|
|
647
647
|
return null;
|
|
648
648
|
}
|
|
649
649
|
return segment;
|
|
@@ -668,26 +668,84 @@ export function createAnimator(element, options = {}) {
|
|
|
668
668
|
};
|
|
669
669
|
|
|
670
670
|
/**
|
|
671
|
-
*
|
|
672
|
-
*
|
|
673
|
-
|
|
674
|
-
|
|
671
|
+
* A held curve's start once a frame dated its call, as the browser's start
|
|
672
|
+
* moves it: by that frame's lead over the call's own time.
|
|
673
|
+
*/
|
|
674
|
+
const datedFromLatest = (segment, latest) => latest == null || segment.group == null ? null : {
|
|
675
|
+
latest,
|
|
676
|
+
start: segment.start + latest - segment.group.provisional
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* When a waiting curve's call had its first frame, which put the curve on
|
|
681
|
+
* screen. Undefined for a curve that does not wait, or whose call has had
|
|
682
|
+
* no first frame.
|
|
683
|
+
*/
|
|
684
|
+
const shownSince = (property, segment) => segment.group?.resolved === false ? segment.group.latest?.get(CHANNEL_OF[property]) : undefined;
|
|
685
|
+
|
|
686
|
+
/** A curve's end, dated from its call's first frame while it waits. */
|
|
687
|
+
const endOf = (property, segment) => (datedFromLatest(segment, shownSince(property, segment))?.start ?? segment.start) + segment.duration;
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Takes a curve on screen out of the call that still waits for the
|
|
691
|
+
* browser's start. The curve keeps its course, dated from the call's first
|
|
692
|
+
* frame. A call that has no channel left starts at that frame.
|
|
693
|
+
*/
|
|
694
|
+
const leaveWaitingCall = (segment, channel, latest) => {
|
|
695
|
+
const group = segment.group;
|
|
696
|
+
if (group == null) {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
const index = group.segments.indexOf(segment);
|
|
700
|
+
if (index >= 0) {
|
|
701
|
+
group.segments.splice(index, 1);
|
|
702
|
+
}
|
|
703
|
+
segment.start += latest - group.provisional;
|
|
704
|
+
segment.group = undefined;
|
|
705
|
+
if (!CHANNELS[channel].some(p => segments.get(p)?.group === group)) {
|
|
706
|
+
group.latest?.delete(channel);
|
|
707
|
+
group.channels.delete(channel);
|
|
708
|
+
}
|
|
709
|
+
if (group.channels.size === 0 && group.segments.length === 0) {
|
|
710
|
+
resolveGroup(group, latest);
|
|
711
|
+
}
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* The value on screen at `time`. Until the browser reports its start, a
|
|
716
|
+
* held curve shows its first value. A frame that ran without that start
|
|
717
|
+
* dates the curve. Without that frame, a later time reads from the
|
|
718
|
+
* provisional start, so a companion that samples ahead follows the curve's
|
|
719
|
+
* shape.
|
|
675
720
|
*/
|
|
676
721
|
const valueAt = (property, time) => {
|
|
677
722
|
const segment = segments.get(property);
|
|
678
|
-
if (segment != null && isHeld(segment)
|
|
723
|
+
if (segment != null && isHeld(segment)) {
|
|
724
|
+
// The compositor starts the call near its first frame. The curve is
|
|
725
|
+
// dated as the browser's start would date it. A curve that joined by an
|
|
726
|
+
// older clock keeps its lead over the call's own time.
|
|
727
|
+
const latest = segment.group?.latest?.get(CHANNEL_OF[property]);
|
|
728
|
+
const dated = datedFromLatest(segment, latest);
|
|
729
|
+
if (dated != null) {
|
|
730
|
+
const elapsed = Math.max(time, dated.latest) - dated.start;
|
|
731
|
+
return elapsed >= segment.duration ? segment.target : segment.at(elapsed);
|
|
732
|
+
}
|
|
679
733
|
// Nothing has moved on screen until the browser starts the call.
|
|
680
|
-
|
|
734
|
+
if (time <= now()) {
|
|
735
|
+
return segment.at(0);
|
|
736
|
+
}
|
|
681
737
|
}
|
|
682
738
|
return curveAt(property, time);
|
|
683
739
|
};
|
|
684
740
|
const velocityAt = (property, time) => {
|
|
685
741
|
const held = segments.get(property);
|
|
686
742
|
if (held != null && isHeld(held)) {
|
|
687
|
-
// Still at its start on screen, but moving in the model
|
|
688
|
-
// carries the velocity the curve has reached by now
|
|
689
|
-
// moves all land before the browser starts any keeps its speed.
|
|
690
|
-
|
|
743
|
+
// Still at its start on screen, but moving in the model. A retarget
|
|
744
|
+
// carries the velocity the curve has reached by now. So a flick whose
|
|
745
|
+
// moves all land before the browser starts any keeps its speed. Past
|
|
746
|
+
// its first frame, it reads from that frame, as its value does.
|
|
747
|
+
const dated = datedFromLatest(held, held.group?.latest?.get(CHANNEL_OF[property]));
|
|
748
|
+
return held.speed(Math.max(0, dated != null && time > dated.latest ? time - dated.start : time - held.start));
|
|
691
749
|
}
|
|
692
750
|
const segment = segmentAt(property, time);
|
|
693
751
|
if (segment == null || time < segment.start) {
|
|
@@ -854,12 +912,49 @@ export function createAnimator(element, options = {}) {
|
|
|
854
912
|
// Settled curves become resting values.
|
|
855
913
|
for (const property of properties) {
|
|
856
914
|
const segment = segments.get(property);
|
|
857
|
-
if (segment != null && time >=
|
|
915
|
+
if (segment != null && time >= endOf(property, segment)) {
|
|
858
916
|
resting[property] = segment.target;
|
|
859
917
|
segments.delete(property);
|
|
860
918
|
}
|
|
861
919
|
}
|
|
862
920
|
const moving = properties.filter(p => segments.has(p));
|
|
921
|
+
if (callGroup == null) {
|
|
922
|
+
// A call that starts now rebuilds a channel the compositor has moving
|
|
923
|
+
// since a first frame without a known start. The channel carries on
|
|
924
|
+
// from that frame, with a start of its own, instead of starting its
|
|
925
|
+
// curve again.
|
|
926
|
+
for (const property of moving) {
|
|
927
|
+
const segment = segments.get(property);
|
|
928
|
+
const latest = shownSince(property, segment);
|
|
929
|
+
if (latest != null) {
|
|
930
|
+
leaveWaitingCall(segment, channel, latest);
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
// An explicit call can rebuild a channel while one of its curves still
|
|
935
|
+
// waits for the browser's start. The animation then joins the current
|
|
936
|
+
// call, or else that waiting call, with no start of its own.
|
|
937
|
+
const waiting = callGroup ?? moving.map(p => segments.get(p).group).find(group => group != null && !group.resolved) ?? null;
|
|
938
|
+
const rebuiltAfterFirstFrame = waiting?.framed === true;
|
|
939
|
+
// The new animation starts at the frame that commits it, from its first
|
|
940
|
+
// keyframe. That holds for a waiting call it joins after that call's
|
|
941
|
+
// first frame, and for every waiting call it takes a curve from. So this
|
|
942
|
+
// channel's reads below, and until that frame, take that first value.
|
|
943
|
+
const restarted = new Set();
|
|
944
|
+
if (rebuiltAfterFirstFrame) {
|
|
945
|
+
restarted.add(waiting);
|
|
946
|
+
}
|
|
947
|
+
if (callGroup != null) {
|
|
948
|
+
for (const property of moving) {
|
|
949
|
+
const group = segments.get(property).group;
|
|
950
|
+
if (group != null && group !== callGroup && !group.resolved) {
|
|
951
|
+
restarted.add(group);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
for (const group of restarted) {
|
|
956
|
+
group.latest?.delete(channel);
|
|
957
|
+
}
|
|
863
958
|
if (channel === 'translate') {
|
|
864
959
|
// The animation built below starts from the value at `time` (its first
|
|
865
960
|
// keyframe); a rebase or a retarget builds a new one, so a new start.
|
|
@@ -887,10 +982,6 @@ export function createAnimator(element, options = {}) {
|
|
|
887
982
|
previous?.cancel();
|
|
888
983
|
return;
|
|
889
984
|
}
|
|
890
|
-
// A channel rebuilt by an explicit call (set, rebase, a retarget of
|
|
891
|
-
// another axis) while one of its curves still waits for the browser's
|
|
892
|
-
// start keeps that start: no explicit start for this animation.
|
|
893
|
-
const waiting = callGroup ?? moving.map(p => segments.get(p).group).find(group => group != null && !group.resolved) ?? null;
|
|
894
985
|
// The keyframes start where the animation will: at the waiting call's
|
|
895
986
|
// own time, which its start moves to the browser's (resolveGroup), so a
|
|
896
987
|
// write later in the task keeps the screen on the model's clock.
|
|
@@ -996,6 +1087,15 @@ export function createAnimator(element, options = {}) {
|
|
|
996
1087
|
waiting.channels.add(channel);
|
|
997
1088
|
// A cancel before the first frame rejects its ready promise.
|
|
998
1089
|
animation.ready?.catch(() => {});
|
|
1090
|
+
if (rebuiltAfterFirstFrame) {
|
|
1091
|
+
// The frame that commits it dates this channel's start again. The
|
|
1092
|
+
// call's other channels keep their own.
|
|
1093
|
+
requestFrame?.(() => {
|
|
1094
|
+
if (!waiting.resolved && running.get(channel) === animation && animation.startTime == null && animation.playState === 'running') {
|
|
1095
|
+
(waiting.latest ??= new Map()).set(channel, now());
|
|
1096
|
+
}
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
999
1099
|
} else {
|
|
1000
1100
|
// One clock: the keyframes were sampled from `time`.
|
|
1001
1101
|
animation.startTime = time;
|
|
@@ -1445,7 +1545,9 @@ export function createAnimator(element, options = {}) {
|
|
|
1445
1545
|
for (const channel of start === 'commit' ? [] : channels) {
|
|
1446
1546
|
for (const property of CHANNELS[channel]) {
|
|
1447
1547
|
const segment = segments.get(property);
|
|
1448
|
-
|
|
1548
|
+
// A call's first frame puts its channels on screen, even before the
|
|
1549
|
+
// browser reports the start. So such a channel is not at rest either.
|
|
1550
|
+
if (segment != null && time < endOf(property, segment) && (segment.group == null || segment.group.resolved || shownSince(property, segment) != null)) {
|
|
1449
1551
|
return null;
|
|
1450
1552
|
}
|
|
1451
1553
|
}
|
|
@@ -1614,6 +1716,17 @@ export function createAnimator(element, options = {}) {
|
|
|
1614
1716
|
if (!group.resolved && group.madeInFrame !== true && now() - (group.task?.first ?? group.provisional) <= LATE_START_MS && group.animations.some(animation => animation.startTime == null && animation.playState === 'running')) {
|
|
1615
1717
|
resolveGroup(group, now());
|
|
1616
1718
|
}
|
|
1719
|
+
// The browser's start is still unread. The compositor starts the call
|
|
1720
|
+
// near this frame, so each moving channel's reads take the curve from
|
|
1721
|
+
// now until the browser tells its start.
|
|
1722
|
+
if (!group.resolved) {
|
|
1723
|
+
for (const channel of group.channels) {
|
|
1724
|
+
const animation = running.get(channel);
|
|
1725
|
+
if (animation != null && group.animations.includes(animation) && animation.startTime == null && animation.playState === 'running') {
|
|
1726
|
+
(group.latest ??= new Map()).set(channel, now());
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1617
1730
|
});
|
|
1618
1731
|
ready.then(() => syncGroup(group), () => settleCancelled(group));
|
|
1619
1732
|
};
|
|
@@ -2822,8 +2935,10 @@ export function createAnimator(element, options = {}) {
|
|
|
2822
2935
|
}
|
|
2823
2936
|
owners.add(segment.owner);
|
|
2824
2937
|
// A curve still waiting for the browser's start stays in its call:
|
|
2825
|
-
// it starts with that call's commit.
|
|
2826
|
-
|
|
2938
|
+
// it starts with that call's commit. A curve whose call had its first
|
|
2939
|
+
// frame is on screen already, so it leaves the call (leaveWaitingCall).
|
|
2940
|
+
const latest = shownSince(property, segment);
|
|
2941
|
+
const group = latest == null && segment.group != null && !segment.group.resolved ? segment.group : undefined;
|
|
2827
2942
|
const replace = next => {
|
|
2828
2943
|
if (group != null) {
|
|
2829
2944
|
const index = group.segments.indexOf(segment);
|
|
@@ -2838,6 +2953,9 @@ export function createAnimator(element, options = {}) {
|
|
|
2838
2953
|
if (segment.spring != null) {
|
|
2839
2954
|
const from = valueAt(property, time) + delta;
|
|
2840
2955
|
const velocity = velocityAt(property, time);
|
|
2956
|
+
if (latest != null) {
|
|
2957
|
+
leaveWaitingCall(segment, CHANNEL_OF[property], latest);
|
|
2958
|
+
}
|
|
2841
2959
|
const curve = solveSpring(toSpring(segment.spring), {
|
|
2842
2960
|
from,
|
|
2843
2961
|
to: segment.target,
|
|
@@ -2857,6 +2975,9 @@ export function createAnimator(element, options = {}) {
|
|
|
2857
2975
|
spring: segment.spring
|
|
2858
2976
|
});
|
|
2859
2977
|
} else {
|
|
2978
|
+
if (latest != null) {
|
|
2979
|
+
leaveWaitingCall(segment, CHANNEL_OF[property], latest);
|
|
2980
|
+
}
|
|
2860
2981
|
replace({
|
|
2861
2982
|
...segment,
|
|
2862
2983
|
target: segment.target + delta,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file paging.ts
|
|
3
|
+
* @input A release velocity, a settle's start, end and velocity, and the UIKit
|
|
4
|
+
* paging constants
|
|
5
|
+
* @output Exports `pagingSettleVelocity`, `solvePaging` (UIKit's paging settle
|
|
6
|
+
* as a curve the animator plays) and `solveAnimatedPageScroll`
|
|
7
|
+
* @position Pure math, with no DOM and no React; hooks/usePager.ts reads it
|
|
8
|
+
*
|
|
9
|
+
* SYNC: When modified, update:
|
|
10
|
+
* - /packages/core/src/motion/paging.test.ts
|
|
11
|
+
* - /packages/core/src/motion/README.md
|
|
12
|
+
*/
|
|
13
|
+
import type { MotionCurve } from './animator.js';
|
|
14
|
+
import { type BezierPoints } from './bezier.js';
|
|
15
|
+
/**
|
|
16
|
+
* The velocity a paging settle starts at. It is the release velocity that every
|
|
17
|
+
* gesture reads, zeroed below `velocityFloor`. The page choice reads the
|
|
18
|
+
* release velocity itself.
|
|
19
|
+
*/
|
|
20
|
+
export declare function pagingSettleVelocity(velocity: number): number;
|
|
21
|
+
/** A paging settle: the curve and where it ends. */
|
|
22
|
+
export interface PagingCurve extends MotionCurve {
|
|
23
|
+
readonly from: number;
|
|
24
|
+
readonly to: number;
|
|
25
|
+
/** Integration steps the settle took. */
|
|
26
|
+
readonly steps: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* UIKit's paging settle from `from` (px), moving at `velocity` (px/s), onto
|
|
30
|
+
* `to`. It steps `paging.integrator` `stepsPerSecond` times a second and ends
|
|
31
|
+
* exactly on `to`. The same motion returns an overscrolled pager to its first
|
|
32
|
+
* or last page.
|
|
33
|
+
*
|
|
34
|
+
* Positions are content offsets along the paging axis, 0 at page 0 and growing
|
|
35
|
+
* toward later pages. Velocities are px/s of that offset.
|
|
36
|
+
*
|
|
37
|
+
* No closed form reproduces the per-frame stepping, so the settle integrates
|
|
38
|
+
* once into a table, and the curve reads the table. A release needs at most
|
|
39
|
+
* about 400 steps, well under a millisecond of work.
|
|
40
|
+
*
|
|
41
|
+
* The release velocity enters in px per millisecond per step, as UIKit hands it
|
|
42
|
+
* to the integrator. At 960 steps a second, the content starts at 96 % of the
|
|
43
|
+
* finger's speed, as in UIKit.
|
|
44
|
+
*/
|
|
45
|
+
export declare function solvePaging({ from, velocity, to, }: {
|
|
46
|
+
from: number;
|
|
47
|
+
velocity: number;
|
|
48
|
+
to: number;
|
|
49
|
+
}): PagingCurve;
|
|
50
|
+
/**
|
|
51
|
+
* `setContentOffset(_:animated:)`: `paging.animatedScroll.durationMs` on its
|
|
52
|
+
* curve, from the current offset, at any distance. The pager passes the
|
|
53
|
+
* duration and curve that `resolveMotion` gives, which are the measured values
|
|
54
|
+
* of the table.
|
|
55
|
+
*
|
|
56
|
+
* `velocity` (px/s) is the velocity of a move that this one retargets. The new
|
|
57
|
+
* curve starts at it and still ends on `to`, at rest and on time. A new target
|
|
58
|
+
* keeps the current velocity, where UIKit drops it. The carry is a Hermite
|
|
59
|
+
* term, v × duration × u(1 − u)², less the curve's own starting slope. So a
|
|
60
|
+
* move from rest is the curve itself.
|
|
61
|
+
*/
|
|
62
|
+
export declare function solveAnimatedPageScroll({ from, to, durationMs, curve, velocity, }: {
|
|
63
|
+
from: number;
|
|
64
|
+
to: number;
|
|
65
|
+
durationMs?: number;
|
|
66
|
+
curve?: BezierPoints;
|
|
67
|
+
velocity?: number;
|
|
68
|
+
}): MotionCurve;
|
|
69
|
+
//# sourceMappingURL=paging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paging.d.ts","sourceRoot":"","sources":["../../src/motion/paging.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAc,KAAK,YAAY,EAAC,MAAM,UAAU,CAAC;AAGxD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,oDAAoD;AACpD,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,QAAQ,EACR,EAAE,GACH,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ,GAAG,WAAW,CA6Cd;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,EAAE,EACF,UAA6C,EAC7C,KAAmC,EACnC,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,WAAW,CA4Bd"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file paging.ts
|
|
5
|
+
* @input A release velocity, a settle's start, end and velocity, and the UIKit
|
|
6
|
+
* paging constants
|
|
7
|
+
* @output Exports `pagingSettleVelocity`, `solvePaging` (UIKit's paging settle
|
|
8
|
+
* as a curve the animator plays) and `solveAnimatedPageScroll`
|
|
9
|
+
* @position Pure math, with no DOM and no React; hooks/usePager.ts reads it
|
|
10
|
+
*
|
|
11
|
+
* SYNC: When modified, update:
|
|
12
|
+
* - /packages/core/src/motion/paging.test.ts
|
|
13
|
+
* - /packages/core/src/motion/README.md
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { cubicBezier } from "./bezier.js";
|
|
17
|
+
import { paging } from "./uikit/paging.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The velocity a paging settle starts at. It is the release velocity that every
|
|
21
|
+
* gesture reads, zeroed below `velocityFloor`. The page choice reads the
|
|
22
|
+
* release velocity itself.
|
|
23
|
+
*/
|
|
24
|
+
export function pagingSettleVelocity(velocity) {
|
|
25
|
+
return Math.abs(velocity) < paging.release.velocityFloor ? 0 : velocity;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A paging settle: the curve and where it ends. */
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* UIKit's paging settle from `from` (px), moving at `velocity` (px/s), onto
|
|
32
|
+
* `to`. It steps `paging.integrator` `stepsPerSecond` times a second and ends
|
|
33
|
+
* exactly on `to`. The same motion returns an overscrolled pager to its first
|
|
34
|
+
* or last page.
|
|
35
|
+
*
|
|
36
|
+
* Positions are content offsets along the paging axis, 0 at page 0 and growing
|
|
37
|
+
* toward later pages. Velocities are px/s of that offset.
|
|
38
|
+
*
|
|
39
|
+
* No closed form reproduces the per-frame stepping, so the settle integrates
|
|
40
|
+
* once into a table, and the curve reads the table. A release needs at most
|
|
41
|
+
* about 400 steps, well under a millisecond of work.
|
|
42
|
+
*
|
|
43
|
+
* The release velocity enters in px per millisecond per step, as UIKit hands it
|
|
44
|
+
* to the integrator. At 960 steps a second, the content starts at 96 % of the
|
|
45
|
+
* finger's speed, as in UIKit.
|
|
46
|
+
*/
|
|
47
|
+
export function solvePaging({
|
|
48
|
+
from,
|
|
49
|
+
velocity,
|
|
50
|
+
to
|
|
51
|
+
}) {
|
|
52
|
+
const {
|
|
53
|
+
springPull,
|
|
54
|
+
friction,
|
|
55
|
+
stepsPerSecond,
|
|
56
|
+
restDistance,
|
|
57
|
+
restSpeed
|
|
58
|
+
} = paging.integrator;
|
|
59
|
+
const xs = [from];
|
|
60
|
+
const vs = [velocity / 1000];
|
|
61
|
+
let x = from;
|
|
62
|
+
let v = velocity / 1000;
|
|
63
|
+
// ~10 s of steps: far beyond any settle (≈ 0.35 s from rest).
|
|
64
|
+
const maxSteps = stepsPerSecond * 10;
|
|
65
|
+
let steps = 0;
|
|
66
|
+
while (steps < maxSteps) {
|
|
67
|
+
if (Math.abs(to - x) < restDistance && Math.abs(v) < restSpeed) {
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
v = (v + (to - x) * springPull) * friction;
|
|
71
|
+
x += v;
|
|
72
|
+
steps += 1;
|
|
73
|
+
xs.push(x);
|
|
74
|
+
vs.push(v);
|
|
75
|
+
}
|
|
76
|
+
xs[xs.length - 1] = to;
|
|
77
|
+
vs[vs.length - 1] = 0;
|
|
78
|
+
const duration = steps / stepsPerSecond;
|
|
79
|
+
const last = xs.length - 1;
|
|
80
|
+
const read = (table, t) => {
|
|
81
|
+
if (!(t > 0)) {
|
|
82
|
+
return table[0];
|
|
83
|
+
}
|
|
84
|
+
const s = t * stepsPerSecond;
|
|
85
|
+
if (s >= last) {
|
|
86
|
+
return table[last];
|
|
87
|
+
}
|
|
88
|
+
const i = Math.floor(s);
|
|
89
|
+
const f = s - i;
|
|
90
|
+
return table[i] + (table[i + 1] - table[i]) * f;
|
|
91
|
+
};
|
|
92
|
+
return {
|
|
93
|
+
from,
|
|
94
|
+
to,
|
|
95
|
+
steps,
|
|
96
|
+
duration,
|
|
97
|
+
at: t => read(xs, t),
|
|
98
|
+
// px per step × steps per second
|
|
99
|
+
velocity: t => read(vs, t) * stepsPerSecond
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* `setContentOffset(_:animated:)`: `paging.animatedScroll.durationMs` on its
|
|
105
|
+
* curve, from the current offset, at any distance. The pager passes the
|
|
106
|
+
* duration and curve that `resolveMotion` gives, which are the measured values
|
|
107
|
+
* of the table.
|
|
108
|
+
*
|
|
109
|
+
* `velocity` (px/s) is the velocity of a move that this one retargets. The new
|
|
110
|
+
* curve starts at it and still ends on `to`, at rest and on time. A new target
|
|
111
|
+
* keeps the current velocity, where UIKit drops it. The carry is a Hermite
|
|
112
|
+
* term, v × duration × u(1 − u)², less the curve's own starting slope. So a
|
|
113
|
+
* move from rest is the curve itself.
|
|
114
|
+
*/
|
|
115
|
+
export function solveAnimatedPageScroll({
|
|
116
|
+
from,
|
|
117
|
+
to,
|
|
118
|
+
durationMs = paging.animatedScroll.durationMs,
|
|
119
|
+
curve = paging.animatedScroll.curve,
|
|
120
|
+
velocity
|
|
121
|
+
}) {
|
|
122
|
+
const duration = durationMs / 1000;
|
|
123
|
+
const distance = to - from;
|
|
124
|
+
const ease = cubicBezier(curve);
|
|
125
|
+
const progress = u => ease(Math.min(1, Math.max(0, u)));
|
|
126
|
+
// The carry, in px: the retargeted velocity over the whole duration, less
|
|
127
|
+
// what the curve's own starting slope already gives.
|
|
128
|
+
const startSlope = progress(1e-4) / 1e-4;
|
|
129
|
+
const carry = velocity == null ? 0 : velocity * duration - distance * startSlope;
|
|
130
|
+
const at = t => {
|
|
131
|
+
const u = Math.min(1, Math.max(0, t / duration));
|
|
132
|
+
return from + distance * progress(u) + carry * u * (1 - u) * (1 - u);
|
|
133
|
+
};
|
|
134
|
+
return {
|
|
135
|
+
duration,
|
|
136
|
+
at,
|
|
137
|
+
velocity: t => {
|
|
138
|
+
if (t <= 0) {
|
|
139
|
+
return velocity ?? 0;
|
|
140
|
+
}
|
|
141
|
+
if (t >= duration) {
|
|
142
|
+
return 0;
|
|
143
|
+
}
|
|
144
|
+
const h = Math.min(1e-4, t / 2, (duration - t) / 2);
|
|
145
|
+
return (at(t + h) - at(t - h)) / (2 * h);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* @file index.ts
|
|
3
3
|
* @input The domain files of the UIKit constants table
|
|
4
4
|
* @output Re-exports `springs` and one constant per spring (`SHEET_PRESENT_SPRING`,
|
|
5
|
-
* …), `scroll`, `timing`, `navigation` and
|
|
6
|
-
*
|
|
7
|
-
* `UIKIT_GESTURES`, and the
|
|
5
|
+
* …), `scroll`, `timing`, `navigation`, `progressBar`, the `slider` and
|
|
6
|
+
* switch (`switchControl`) domains, and the gesture thresholds (one
|
|
7
|
+
* `UIKIT_*` group per recognizer, their union `UIKIT_GESTURES`, and the
|
|
8
|
+
* haptic tables)
|
|
8
9
|
* @position Entry of the UIKit constants table (motion/uikit). Internal to
|
|
9
10
|
* core: not exported from the package entry point
|
|
10
11
|
*
|
|
@@ -18,7 +19,10 @@
|
|
|
18
19
|
*/
|
|
19
20
|
export { HAPTIC_FEEDBACK_KINDS, HAPTIC_VIBRATION_PATTERNS, UIKIT_CLICK, UIKIT_CONTROL, UIKIT_GESTURES, UIKIT_LONG_PRESS, UIKIT_PAN, UIKIT_PINCH, UIKIT_PRESS, UIKIT_ROTATION, UIKIT_SCREEN_EDGE_PAN, UIKIT_SWIPE, UIKIT_TAP, UIKIT_VELOCITY, type GestureConstant, type GestureConstantUnit, type HapticFeedbackKind, } from './gestures.js';
|
|
20
21
|
export { navigation, registerNavigationTable } from './navigation.js';
|
|
22
|
+
export { progressBar, registerProgressBarTable } from './progressBar.js';
|
|
21
23
|
export { registerScrollTable, scroll } from './scroll.js';
|
|
22
|
-
export {
|
|
24
|
+
export { slider } from './slider.js';
|
|
25
|
+
export { ACTION_SHEET_DISMISS_SPRING, ACTION_SHEET_PRESENT_SPRING, ALERT_DISMISS_SPRING, ALERT_PRESENT_SPRING, BANNER_SPRING, CONTEXT_MENU_DISMISS_SPRING, CONTEXT_MENU_LIFT_SPRING, CONTEXT_MENU_MORPH_SPRING, DIRECT_CHANGE_SPRING, EMPHASIS_SPRING, FINGER_TRACKING_SPRING, KEYBOARD_SPRING, MENU_CLOSE_SPRING, MENU_OPEN_SPRING, MENU_REDUCED_MOTION_SPRING, NAVIGATION_BAR_ELEMENTS_SPRING, NAVIGATION_INTERACTIVE_POP_FINISH_SPRING, NAVIGATION_POP_SPRING, NAVIGATION_PUSH_SPRING, QUICK_CHANGE_SPRING, SEGMENTED_THUMB_SPRING, SETTLE_SPRING, SHEET_DETENT_SPRING, SHEET_DISMISS_SPRING, SHEET_DISMISS_SWIPE_SPRING, SHEET_PRESENT_SPRING, SHEET_RELEASE_FAST_SPRING, STATE_CHANGE_SPRING, SUB_MENU_BACK_SPRING, SUB_MENU_OPEN_SPRING, SWITCH_THUMB_MOVE_SPRING, TIMED_CHANGE_SPRING, VIEW_CHANGE_SPRING, registerSpringsTable, springs, } from './springs.js';
|
|
26
|
+
export { switchControl } from './switch.js';
|
|
23
27
|
export { registerTimingTable, timing } from './timing.js';
|
|
24
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/motion/uikit/index.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/motion/uikit/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,WAAW,EACX,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,UAAU,EAAE,uBAAuB,EAAC,MAAM,cAAc,CAAC;AACjE,OAAO,EAAC,WAAW,EAAE,wBAAwB,EAAC,MAAM,eAAe,CAAC;AACpE,OAAO,EAAC,mBAAmB,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,0BAA0B,EAC1B,8BAA8B,EAC9B,wCAAwC,EACxC,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,OAAO,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AACvC,OAAO,EAAC,mBAAmB,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC"}
|
|
@@ -4,9 +4,10 @@
|
|
|
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
|
|
8
|
-
*
|
|
9
|
-
* `UIKIT_GESTURES`, and the
|
|
7
|
+
* …), `scroll`, `timing`, `navigation`, `progressBar`, the `slider` and
|
|
8
|
+
* switch (`switchControl`) domains, and the gesture thresholds (one
|
|
9
|
+
* `UIKIT_*` group per recognizer, their union `UIKIT_GESTURES`, and the
|
|
10
|
+
* haptic tables)
|
|
10
11
|
* @position Entry of the UIKit constants table (motion/uikit). Internal to
|
|
11
12
|
* core: not exported from the package entry point
|
|
12
13
|
*
|
|
@@ -21,6 +22,9 @@
|
|
|
21
22
|
|
|
22
23
|
export { HAPTIC_FEEDBACK_KINDS, HAPTIC_VIBRATION_PATTERNS, UIKIT_CLICK, UIKIT_CONTROL, UIKIT_GESTURES, UIKIT_LONG_PRESS, UIKIT_PAN, UIKIT_PINCH, UIKIT_PRESS, UIKIT_ROTATION, UIKIT_SCREEN_EDGE_PAN, UIKIT_SWIPE, UIKIT_TAP, UIKIT_VELOCITY } from "./gestures.js";
|
|
23
24
|
export { navigation, registerNavigationTable } from "./navigation.js";
|
|
25
|
+
export { progressBar, registerProgressBarTable } from "./progressBar.js";
|
|
24
26
|
export { registerScrollTable, scroll } from "./scroll.js";
|
|
25
|
-
export {
|
|
27
|
+
export { slider } from "./slider.js";
|
|
28
|
+
export { ACTION_SHEET_DISMISS_SPRING, ACTION_SHEET_PRESENT_SPRING, ALERT_DISMISS_SPRING, ALERT_PRESENT_SPRING, BANNER_SPRING, CONTEXT_MENU_DISMISS_SPRING, CONTEXT_MENU_LIFT_SPRING, CONTEXT_MENU_MORPH_SPRING, DIRECT_CHANGE_SPRING, EMPHASIS_SPRING, FINGER_TRACKING_SPRING, KEYBOARD_SPRING, MENU_CLOSE_SPRING, MENU_OPEN_SPRING, MENU_REDUCED_MOTION_SPRING, NAVIGATION_BAR_ELEMENTS_SPRING, NAVIGATION_INTERACTIVE_POP_FINISH_SPRING, NAVIGATION_POP_SPRING, NAVIGATION_PUSH_SPRING, QUICK_CHANGE_SPRING, SEGMENTED_THUMB_SPRING, SETTLE_SPRING, SHEET_DETENT_SPRING, SHEET_DISMISS_SPRING, SHEET_DISMISS_SWIPE_SPRING, SHEET_PRESENT_SPRING, SHEET_RELEASE_FAST_SPRING, STATE_CHANGE_SPRING, SUB_MENU_BACK_SPRING, SUB_MENU_OPEN_SPRING, SWITCH_THUMB_MOVE_SPRING, TIMED_CHANGE_SPRING, VIEW_CHANGE_SPRING, registerSpringsTable, springs } from "./springs.js";
|
|
29
|
+
export { switchControl } from "./switch.js";
|
|
26
30
|
export { registerTimingTable, timing } from "./timing.js";
|