framer-motion 6.3.11 → 6.3.12
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/cjs/index.js +2 -20
- package/dist/es/animation/use-animated-state.mjs +0 -1
- package/dist/es/animation/utils/transitions.mjs +0 -2
- package/dist/es/context/DeprecatedLayoutGroupContext.mjs +0 -1
- package/dist/es/context/LayoutGroupContext.mjs +0 -3
- package/dist/es/motion/index.mjs +0 -2
- package/dist/es/render/utils/animation.mjs +0 -3
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -4
- package/dist/es/value/use-inverted-scale.mjs +0 -1
- package/dist/es/value/utils/resolve-motion-value.mjs +0 -2
- package/dist/framer-motion.dev.js +2 -20
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +4118 -0
- package/dist/projection.dev.js +2 -9
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/three-entry.d.ts +2428 -0
- package/package.json +4 -4
- package/types/animation/animate.d.ts +0 -54
- package/types/animation/animation-controls.d.ts +0 -5
- package/types/animation/types.d.ts +0 -79
- package/types/animation/use-animated-state.d.ts +0 -6
- package/types/animation/use-animation.d.ts +0 -31
- package/types/animation/utils/default-transitions.d.ts +0 -19
- package/types/animation/utils/easing.d.ts +0 -3
- package/types/animation/utils/is-animatable.d.ts +0 -11
- package/types/animation/utils/is-animation-controls.d.ts +0 -2
- package/types/animation/utils/is-keyframes-target.d.ts +0 -2
- package/types/animation/utils/transitions.d.ts +0 -29
- package/types/animation/utils/variant-resolvers.d.ts +0 -12
- package/types/components/AnimatePresence/PresenceChild.d.ts +0 -12
- package/types/components/AnimatePresence/index.d.ts +0 -36
- package/types/components/AnimatePresence/types.d.ts +0 -61
- package/types/components/AnimatePresence/use-presence.d.ts +0 -52
- package/types/components/AnimateSharedLayout.d.ts +0 -2
- package/types/components/LayoutGroup/index.d.ts +0 -12
- package/types/components/LazyMotion/index.d.ts +0 -38
- package/types/components/LazyMotion/types.d.ts +0 -54
- package/types/components/MotionConfig/index.d.ts +0 -25
- package/types/components/Reorder/Group.d.ts +0 -297
- package/types/components/Reorder/Item.d.ts +0 -278
- package/types/components/Reorder/index.d.ts +0 -509
- package/types/components/Reorder/types.d.ts +0 -10
- package/types/components/Reorder/utils/check-reorder.d.ts +0 -2
- package/types/context/DeprecatedLayoutGroupContext.d.ts +0 -6
- package/types/context/LayoutGroupContext.d.ts +0 -11
- package/types/context/LazyContext.d.ts +0 -7
- package/types/context/MotionConfigContext.d.ts +0 -36
- package/types/context/MotionContext/create.d.ts +0 -3
- package/types/context/MotionContext/index.d.ts +0 -9
- package/types/context/MotionContext/utils.d.ts +0 -3
- package/types/context/PresenceContext.d.ts +0 -17
- package/types/context/ReorderContext.d.ts +0 -3
- package/types/context/SwitchLayoutGroupContext.d.ts +0 -23
- package/types/events/event-info.d.ts +0 -5
- package/types/events/types.d.ts +0 -10
- package/types/events/use-dom-event.d.ts +0 -24
- package/types/events/use-pointer-event.d.ts +0 -4
- package/types/events/utils.d.ts +0 -3
- package/types/gestures/PanSession.d.ts +0 -127
- package/types/gestures/drag/VisualElementDragControls.d.ts +0 -56
- package/types/gestures/drag/types.d.ts +0 -294
- package/types/gestures/drag/use-drag-controls.d.ts +0 -74
- package/types/gestures/drag/use-drag.d.ts +0 -7
- package/types/gestures/drag/utils/constraints.d.ts +0 -77
- package/types/gestures/drag/utils/lock.d.ts +0 -4
- package/types/gestures/types.d.ts +0 -225
- package/types/gestures/use-focus-gesture.d.ts +0 -8
- package/types/gestures/use-hover-gesture.d.ts +0 -2
- package/types/gestures/use-pan-gesture.d.ts +0 -14
- package/types/gestures/use-tap-gesture.d.ts +0 -6
- package/types/gestures/utils/event-type.d.ts +0 -2
- package/types/gestures/utils/is-node-or-child.d.ts +0 -8
- package/types/index.d.ts +0 -96
- package/types/motion/features/animations.d.ts +0 -2
- package/types/motion/features/definitions.d.ts +0 -3
- package/types/motion/features/drag.d.ts +0 -2
- package/types/motion/features/gestures.d.ts +0 -2
- package/types/motion/features/layout/MeasureLayout.d.ts +0 -3
- package/types/motion/features/layout/index.d.ts +0 -2
- package/types/motion/features/layout/types.d.ts +0 -75
- package/types/motion/features/types.d.ts +0 -52
- package/types/motion/features/use-features.d.ts +0 -8
- package/types/motion/features/use-projection.d.ts +0 -3
- package/types/motion/features/viewport/observers.d.ts +0 -3
- package/types/motion/features/viewport/types.d.ts +0 -21
- package/types/motion/features/viewport/use-viewport.d.ts +0 -2
- package/types/motion/index.d.ts +0 -25
- package/types/motion/types.d.ts +0 -279
- package/types/motion/utils/VisualElementHandler.d.ts +0 -18
- package/types/motion/utils/is-forced-motion-value.d.ts +0 -2
- package/types/motion/utils/make-renderless-component.d.ts +0 -2
- package/types/motion/utils/should-inherit-variant.d.ts +0 -2
- package/types/motion/utils/use-motion-ref.d.ts +0 -8
- package/types/motion/utils/use-visual-element.d.ts +0 -6
- package/types/motion/utils/use-visual-state.d.ts +0 -14
- package/types/motion/utils/valid-prop.d.ts +0 -9
- package/types/projection/animation/mix-values.d.ts +0 -2
- package/types/projection/geometry/conversion.d.ts +0 -14
- package/types/projection/geometry/copy.d.ts +0 -13
- package/types/projection/geometry/delta-apply.d.ts +0 -37
- package/types/projection/geometry/delta-calc.d.ts +0 -10
- package/types/projection/geometry/delta-remove.d.ts +0 -20
- package/types/projection/geometry/models.d.ts +0 -5
- package/types/projection/geometry/types.d.ts +0 -29
- package/types/projection/geometry/utils.d.ts +0 -3
- package/types/projection/index.d.ts +0 -14
- package/types/projection/node/DocumentProjectionNode.d.ts +0 -108
- package/types/projection/node/HTMLProjectionNode.d.ts +0 -112
- package/types/projection/node/create-projection-node.d.ts +0 -301
- package/types/projection/node/group.d.ts +0 -7
- package/types/projection/node/id.d.ts +0 -1
- package/types/projection/node/types.d.ts +0 -136
- package/types/projection/shared/stack.d.ts +0 -17
- package/types/projection/styles/scale-border-radius.d.ts +0 -11
- package/types/projection/styles/scale-box-shadow.d.ts +0 -2
- package/types/projection/styles/scale-correction.d.ts +0 -3
- package/types/projection/styles/transform-origin.d.ts +0 -0
- package/types/projection/styles/transform.d.ts +0 -4
- package/types/projection/styles/types.d.ts +0 -9
- package/types/projection/use-instant-layout-transition.d.ts +0 -1
- package/types/projection/use-reset-projection.d.ts +0 -1
- package/types/projection/utils/each-axis.d.ts +0 -3
- package/types/projection/utils/has-transform.d.ts +0 -3
- package/types/projection/utils/measure.d.ts +0 -4
- package/types/render/dom/create-visual-element.d.ts +0 -2
- package/types/render/dom/features-animation.d.ts +0 -5
- package/types/render/dom/features-max.d.ts +0 -5
- package/types/render/dom/motion-minimal.d.ts +0 -5
- package/types/render/dom/motion-proxy.d.ts +0 -30
- package/types/render/dom/motion.d.ts +0 -25
- package/types/render/dom/types.d.ts +0 -28
- package/types/render/dom/use-render.d.ts +0 -4
- package/types/render/dom/utils/camel-to-dash.d.ts +0 -4
- package/types/render/dom/utils/create-config.d.ts +0 -8
- package/types/render/dom/utils/css-variables-conversion.d.ts +0 -22
- package/types/render/dom/utils/filter-props.d.ts +0 -4
- package/types/render/dom/utils/is-css-variable.d.ts +0 -4
- package/types/render/dom/utils/is-svg-component.d.ts +0 -2
- package/types/render/dom/utils/parse-dom-variant.d.ts +0 -6
- package/types/render/dom/utils/unit-conversion.d.ts +0 -27
- package/types/render/dom/value-types/animatable-none.d.ts +0 -1
- package/types/render/dom/value-types/defaults.d.ts +0 -9
- package/types/render/dom/value-types/dimensions.d.ts +0 -8
- package/types/render/dom/value-types/find.d.ts +0 -9
- package/types/render/dom/value-types/get-as-type.d.ts +0 -5
- package/types/render/dom/value-types/number.d.ts +0 -2
- package/types/render/dom/value-types/test.d.ts +0 -5
- package/types/render/dom/value-types/type-auto.d.ts +0 -5
- package/types/render/dom/value-types/type-int.d.ts +0 -8
- package/types/render/dom/value-types/types.d.ts +0 -4
- package/types/render/html/config-motion.d.ts +0 -3
- package/types/render/html/supported-elements.d.ts +0 -7
- package/types/render/html/types.d.ts +0 -61
- package/types/render/html/use-props.d.ts +0 -8
- package/types/render/html/utils/build-styles.d.ts +0 -5
- package/types/render/html/utils/build-transform.d.ts +0 -15
- package/types/render/html/utils/create-render-state.d.ts +0 -7
- package/types/render/html/utils/render.d.ts +0 -4
- package/types/render/html/utils/scrape-motion-values.d.ts +0 -2
- package/types/render/html/utils/transform.d.ts +0 -15
- package/types/render/html/visual-element.d.ts +0 -6
- package/types/render/index.d.ts +0 -2
- package/types/render/svg/config-motion.d.ts +0 -3
- package/types/render/svg/lowercase-elements.d.ts +0 -5
- package/types/render/svg/supported-elements.d.ts +0 -7
- package/types/render/svg/types.d.ts +0 -44
- package/types/render/svg/use-props.d.ts +0 -7
- package/types/render/svg/utils/build-attrs.d.ts +0 -8
- package/types/render/svg/utils/camel-case-attrs.d.ts +0 -4
- package/types/render/svg/utils/create-render-state.d.ts +0 -2
- package/types/render/svg/utils/path.d.ts +0 -9
- package/types/render/svg/utils/render.d.ts +0 -4
- package/types/render/svg/utils/scrape-motion-values.d.ts +0 -2
- package/types/render/svg/utils/transform-origin.d.ts +0 -6
- package/types/render/svg/visual-element.d.ts +0 -2
- package/types/render/types.d.ts +0 -113
- package/types/render/utils/animation-state.d.ts +0 -31
- package/types/render/utils/animation.d.ts +0 -21
- package/types/render/utils/compare-by-depth.d.ts +0 -5
- package/types/render/utils/flat-tree.d.ts +0 -8
- package/types/render/utils/is-draggable.d.ts +0 -2
- package/types/render/utils/lifecycles.d.ts +0 -114
- package/types/render/utils/motion-values.d.ts +0 -3
- package/types/render/utils/setters.d.ts +0 -792
- package/types/render/utils/types.d.ts +0 -9
- package/types/render/utils/variants.d.ts +0 -20
- package/types/three-entry.d.ts +0 -19
- package/types/types.d.ts +0 -981
- package/types/utils/array.d.ts +0 -3
- package/types/utils/each-axis.d.ts +0 -1
- package/types/utils/is-browser.d.ts +0 -1
- package/types/utils/is-numerical-string.d.ts +0 -4
- package/types/utils/is-ref-object.d.ts +0 -2
- package/types/utils/is-zero-value-string.d.ts +0 -4
- package/types/utils/noop.d.ts +0 -1
- package/types/utils/process.d.ts +0 -1
- package/types/utils/resolve-value.d.ts +0 -3
- package/types/utils/shallow-compare.d.ts +0 -1
- package/types/utils/subscription-manager.d.ts +0 -9
- package/types/utils/time-conversion.d.ts +0 -7
- package/types/utils/transform.d.ts +0 -91
- package/types/utils/use-animation-frame.d.ts +0 -2
- package/types/utils/use-constant.d.ts +0 -10
- package/types/utils/use-cycle.d.ts +0 -30
- package/types/utils/use-force-update.d.ts +0 -1
- package/types/utils/use-id.d.ts +0 -6
- package/types/utils/use-instant-transition-state.d.ts +0 -3
- package/types/utils/use-instant-transition.d.ts +0 -1
- package/types/utils/use-is-mounted.d.ts +0 -2
- package/types/utils/use-isomorphic-effect.d.ts +0 -2
- package/types/utils/use-reduced-motion.d.ts +0 -28
- package/types/utils/use-unmount-effect.d.ts +0 -1
- package/types/utils/warn-once.d.ts +0 -2
- package/types/value/index.d.ts +0 -260
- package/types/value/scroll/use-element-scroll.d.ts +0 -28
- package/types/value/scroll/use-viewport-scroll.d.ts +0 -22
- package/types/value/scroll/utils.d.ts +0 -19
- package/types/value/use-combine-values.d.ts +0 -2
- package/types/value/use-inverted-scale.d.ts +0 -28
- package/types/value/use-motion-template.d.ts +0 -24
- package/types/value/use-motion-value.d.ts +0 -19
- package/types/value/use-on-change.d.ts +0 -3
- package/types/value/use-spring.d.ts +0 -22
- package/types/value/use-time.d.ts +0 -1
- package/types/value/use-transform.d.ts +0 -93
- package/types/value/use-velocity.d.ts +0 -13
- package/types/value/utils/is-motion-value.d.ts +0 -2
- package/types/value/utils/resolve-motion-value.d.ts +0 -10
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Axis, BoundingBox, Box, Point } from "../../../projection/geometry/types";
|
|
2
|
-
import { DragElastic, ResolvedConstraints } from "../types";
|
|
3
|
-
/**
|
|
4
|
-
* Apply constraints to a point. These constraints are both physical along an
|
|
5
|
-
* axis, and an elastic factor that determines how much to constrain the point
|
|
6
|
-
* by if it does lie outside the defined parameters.
|
|
7
|
-
*/
|
|
8
|
-
export declare function applyConstraints(point: number, { min, max }: Partial<Axis>, elastic?: Axis): number;
|
|
9
|
-
/**
|
|
10
|
-
* Calculates a min projection point based on a pointer, pointer progress
|
|
11
|
-
* within the drag target, and constraints.
|
|
12
|
-
*
|
|
13
|
-
* For instance if an element was 100px width, we were dragging from 0.25
|
|
14
|
-
* along this axis, the pointer is at 200px, and there were no constraints,
|
|
15
|
-
* we would calculate a min projection point of 175px.
|
|
16
|
-
*/
|
|
17
|
-
export declare function calcConstrainedMinPoint(point: number, length: number, progress: number, constraints?: Partial<Axis>, elastic?: Axis): number;
|
|
18
|
-
/**
|
|
19
|
-
* Calculate constraints in terms of the viewport when defined relatively to the
|
|
20
|
-
* measured axis. This is measured from the nearest edge, so a max constraint of 200
|
|
21
|
-
* on an axis with a max value of 300 would return a constraint of 500 - axis length
|
|
22
|
-
*/
|
|
23
|
-
export declare function calcRelativeAxisConstraints(axis: Axis, min?: number, max?: number): Partial<Axis>;
|
|
24
|
-
/**
|
|
25
|
-
* Calculate constraints in terms of the viewport when
|
|
26
|
-
* defined relatively to the measured bounding box.
|
|
27
|
-
*/
|
|
28
|
-
export declare function calcRelativeConstraints(layoutBox: Box, { top, left, bottom, right }: Partial<BoundingBox>): ResolvedConstraints;
|
|
29
|
-
/**
|
|
30
|
-
* Calculate viewport constraints when defined as another viewport-relative axis
|
|
31
|
-
*/
|
|
32
|
-
export declare function calcViewportAxisConstraints(layoutAxis: Axis, constraintsAxis: Axis): {
|
|
33
|
-
min: number;
|
|
34
|
-
max: number;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Calculate viewport constraints when defined as another viewport-relative box
|
|
38
|
-
*/
|
|
39
|
-
export declare function calcViewportConstraints(layoutBox: Box, constraintsBox: Box): {
|
|
40
|
-
x: {
|
|
41
|
-
min: number;
|
|
42
|
-
max: number;
|
|
43
|
-
};
|
|
44
|
-
y: {
|
|
45
|
-
min: number;
|
|
46
|
-
max: number;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Calculate a transform origin relative to the source axis, between 0-1, that results
|
|
51
|
-
* in an asthetically pleasing scale/transform needed to project from source to target.
|
|
52
|
-
*/
|
|
53
|
-
export declare function calcOrigin(source: Axis, target: Axis): number;
|
|
54
|
-
/**
|
|
55
|
-
* Calculate the relative progress of one constraints box relative to another.
|
|
56
|
-
* Imagine a page scroll bar. At the top, this would return 0, at the bottom, 1.
|
|
57
|
-
* Anywhere in-between, a value between 0 and 1.
|
|
58
|
-
*
|
|
59
|
-
* This also handles flipped constraints, for instance a draggable container within
|
|
60
|
-
* a smaller viewport like a scrollable view.
|
|
61
|
-
*/
|
|
62
|
-
export declare function calcProgressWithinConstraints(layoutBox: Box, constraintsBox: Box): Point;
|
|
63
|
-
/**
|
|
64
|
-
* Calculate the an axis position based on two axes and a progress value.
|
|
65
|
-
*/
|
|
66
|
-
export declare function calcPositionFromProgress(axis: Axis, constraints: Axis, progress: number): Axis;
|
|
67
|
-
/**
|
|
68
|
-
* Rebase the calculated viewport constraints relative to the layout.min point.
|
|
69
|
-
*/
|
|
70
|
-
export declare function rebaseAxisConstraints(layout: Axis, constraints: Partial<Axis>): Partial<Axis>;
|
|
71
|
-
export declare const defaultElastic = 0.35;
|
|
72
|
-
/**
|
|
73
|
-
* Accepts a dragElastic prop and returns resolved elastic values for each axis.
|
|
74
|
-
*/
|
|
75
|
-
export declare function resolveDragElastic(dragElastic?: DragElastic): Box;
|
|
76
|
-
export declare function resolveAxisElastic(dragElastic: DragElastic, minLabel: string, maxLabel: string): Axis;
|
|
77
|
-
export declare function resolvePointElastic(dragElastic: DragElastic, label: string): number;
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { EventInfo } from "../events/types";
|
|
2
|
-
import { VariantLabels } from "../motion/types";
|
|
3
|
-
import { Point } from "../projection/geometry/types";
|
|
4
|
-
import { TargetAndTransition } from "../types";
|
|
5
|
-
import { PanInfo } from "./PanSession";
|
|
6
|
-
export declare type RemoveEvent = () => void;
|
|
7
|
-
/**
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export interface FocusHandlers {
|
|
11
|
-
/**
|
|
12
|
-
* Properties or variant label to animate to while the focus gesture is recognised.
|
|
13
|
-
*
|
|
14
|
-
* ```jsx
|
|
15
|
-
* <motion.input whileFocus={{ scale: 1.2 }} />
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
whileFocus?: VariantLabels | TargetAndTransition;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Passed in to tap event handlers like `onTap` the `TapInfo` object contains
|
|
22
|
-
* information about the tap gesture such as it‘s location.
|
|
23
|
-
*
|
|
24
|
-
* ```jsx
|
|
25
|
-
* function onTap(event, info) {
|
|
26
|
-
* console.log(info.point.x, info.point.y)
|
|
27
|
-
* }
|
|
28
|
-
*
|
|
29
|
-
* <motion.div onTap={onTap} />
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
export interface TapInfo {
|
|
35
|
-
/**
|
|
36
|
-
* Contains `x` and `y` values for the tap gesture relative to the
|
|
37
|
-
* device or page.
|
|
38
|
-
*
|
|
39
|
-
* ```jsx
|
|
40
|
-
* function onTapStart(event, info) {
|
|
41
|
-
* console.log(info.point.x, info.point.y)
|
|
42
|
-
* }
|
|
43
|
-
*
|
|
44
|
-
* <motion.div onTapStart={onTapStart} />
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @public
|
|
48
|
-
*/
|
|
49
|
-
point: Point;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* @public
|
|
53
|
-
*/
|
|
54
|
-
export interface TapHandlers {
|
|
55
|
-
/**
|
|
56
|
-
* Callback when the tap gesture successfully ends on this element.
|
|
57
|
-
*
|
|
58
|
-
* ```jsx
|
|
59
|
-
* function onTap(event, info) {
|
|
60
|
-
* console.log(info.point.x, info.point.y)
|
|
61
|
-
* }
|
|
62
|
-
*
|
|
63
|
-
* <motion.div onTap={onTap} />
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* @param event - The originating pointer event.
|
|
67
|
-
* @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
|
|
68
|
-
*/
|
|
69
|
-
onTap?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
|
|
70
|
-
/**
|
|
71
|
-
* Callback when the tap gesture starts on this element.
|
|
72
|
-
*
|
|
73
|
-
* ```jsx
|
|
74
|
-
* function onTapStart(event, info) {
|
|
75
|
-
* console.log(info.point.x, info.point.y)
|
|
76
|
-
* }
|
|
77
|
-
*
|
|
78
|
-
* <motion.div onTapStart={onTapStart} />
|
|
79
|
-
* ```
|
|
80
|
-
*
|
|
81
|
-
* @param event - The originating pointer event.
|
|
82
|
-
* @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
|
|
83
|
-
*/
|
|
84
|
-
onTapStart?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
|
|
85
|
-
/**
|
|
86
|
-
* Callback when the tap gesture ends outside this element.
|
|
87
|
-
*
|
|
88
|
-
* ```jsx
|
|
89
|
-
* function onTapCancel(event, info) {
|
|
90
|
-
* console.log(info.point.x, info.point.y)
|
|
91
|
-
* }
|
|
92
|
-
*
|
|
93
|
-
* <motion.div onTapCancel={onTapCancel} />
|
|
94
|
-
* ```
|
|
95
|
-
*
|
|
96
|
-
* @param event - The originating pointer event.
|
|
97
|
-
* @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
|
|
98
|
-
*/
|
|
99
|
-
onTapCancel?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
|
|
100
|
-
/**
|
|
101
|
-
* Properties or variant label to animate to while the component is pressed.
|
|
102
|
-
*
|
|
103
|
-
* ```jsx
|
|
104
|
-
* <motion.div whileTap={{ scale: 0.8 }} />
|
|
105
|
-
* ```
|
|
106
|
-
*/
|
|
107
|
-
whileTap?: VariantLabels | TargetAndTransition;
|
|
108
|
-
}
|
|
109
|
-
export declare type PanHandler = (event: Event, info: PanInfo) => void;
|
|
110
|
-
/**
|
|
111
|
-
* @public
|
|
112
|
-
*/
|
|
113
|
-
export interface PanHandlers {
|
|
114
|
-
/**
|
|
115
|
-
* Callback function that fires when the pan gesture is recognised on this element.
|
|
116
|
-
*
|
|
117
|
-
* **Note:** For pan gestures to work correctly with touch input, the element needs
|
|
118
|
-
* touch scrolling to be disabled on either x/y or both axis with the
|
|
119
|
-
* [touch-action](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) CSS rule.
|
|
120
|
-
*
|
|
121
|
-
* ```jsx
|
|
122
|
-
* function onPan(event, info) {
|
|
123
|
-
* console.log(info.point.x, info.point.y)
|
|
124
|
-
* }
|
|
125
|
-
*
|
|
126
|
-
* <motion.div onPan={onPan} />
|
|
127
|
-
* ```
|
|
128
|
-
*
|
|
129
|
-
* @param event - The originating pointer event.
|
|
130
|
-
* @param info - A {@link PanInfo} object containing `x` and `y` values for:
|
|
131
|
-
*
|
|
132
|
-
* - `point`: Relative to the device or page.
|
|
133
|
-
* - `delta`: Distance moved since the last event.
|
|
134
|
-
* - `offset`: Offset from the original pan event.
|
|
135
|
-
* - `velocity`: Current velocity of the pointer.
|
|
136
|
-
*/
|
|
137
|
-
onPan?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
|
|
138
|
-
/**
|
|
139
|
-
* Callback function that fires when the pan gesture begins on this element.
|
|
140
|
-
*
|
|
141
|
-
* ```jsx
|
|
142
|
-
* function onPanStart(event, info) {
|
|
143
|
-
* console.log(info.point.x, info.point.y)
|
|
144
|
-
* }
|
|
145
|
-
*
|
|
146
|
-
* <motion.div onPanStart={onPanStart} />
|
|
147
|
-
* ```
|
|
148
|
-
*
|
|
149
|
-
* @param event - The originating pointer event.
|
|
150
|
-
* @param info - A {@link PanInfo} object containing `x`/`y` values for:
|
|
151
|
-
*
|
|
152
|
-
* - `point`: Relative to the device or page.
|
|
153
|
-
* - `delta`: Distance moved since the last event.
|
|
154
|
-
* - `offset`: Offset from the original pan event.
|
|
155
|
-
* - `velocity`: Current velocity of the pointer.
|
|
156
|
-
*/
|
|
157
|
-
onPanStart?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
|
|
158
|
-
/**
|
|
159
|
-
* Callback function that fires when we begin detecting a pan gesture. This
|
|
160
|
-
* is analogous to `onMouseStart` or `onTouchStart`.
|
|
161
|
-
*
|
|
162
|
-
* ```jsx
|
|
163
|
-
* function onPanSessionStart(event, info) {
|
|
164
|
-
* console.log(info.point.x, info.point.y)
|
|
165
|
-
* }
|
|
166
|
-
*
|
|
167
|
-
* <motion.div onPanSessionStart={onPanSessionStart} />
|
|
168
|
-
* ```
|
|
169
|
-
*
|
|
170
|
-
* @param event - The originating pointer event.
|
|
171
|
-
* @param info - An {@link EventInfo} object containing `x`/`y` values for:
|
|
172
|
-
*
|
|
173
|
-
* - `point`: Relative to the device or page.
|
|
174
|
-
*/
|
|
175
|
-
onPanSessionStart?(event: MouseEvent | TouchEvent | PointerEvent, info: EventInfo): void;
|
|
176
|
-
/**
|
|
177
|
-
* Callback function that fires when the pan gesture ends on this element.
|
|
178
|
-
*
|
|
179
|
-
* ```jsx
|
|
180
|
-
* function onPanEnd(event, info) {
|
|
181
|
-
* console.log(info.point.x, info.point.y)
|
|
182
|
-
* }
|
|
183
|
-
*
|
|
184
|
-
* <motion.div onPanEnd={onPanEnd} />
|
|
185
|
-
* ```
|
|
186
|
-
*
|
|
187
|
-
* @param event - The originating pointer event.
|
|
188
|
-
* @param info - A {@link PanInfo} object containing `x`/`y` values for:
|
|
189
|
-
*
|
|
190
|
-
* - `point`: Relative to the device or page.
|
|
191
|
-
* - `delta`: Distance moved since the last event.
|
|
192
|
-
* - `offset`: Offset from the original pan event.
|
|
193
|
-
* - `velocity`: Current velocity of the pointer.
|
|
194
|
-
*/
|
|
195
|
-
onPanEnd?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* @public
|
|
199
|
-
*/
|
|
200
|
-
export interface HoverHandlers {
|
|
201
|
-
/**
|
|
202
|
-
* Properties or variant label to animate to while the hover gesture is recognised.
|
|
203
|
-
*
|
|
204
|
-
* ```jsx
|
|
205
|
-
* <motion.div whileHover={{ scale: 1.2 }} />
|
|
206
|
-
* ```
|
|
207
|
-
*/
|
|
208
|
-
whileHover?: VariantLabels | TargetAndTransition;
|
|
209
|
-
/**
|
|
210
|
-
* Callback function that fires when pointer starts hovering over the component.
|
|
211
|
-
*
|
|
212
|
-
* ```jsx
|
|
213
|
-
* <motion.div onHoverStart={() => console.log('Hover starts')} />
|
|
214
|
-
* ```
|
|
215
|
-
*/
|
|
216
|
-
onHoverStart?(event: MouseEvent, info: EventInfo): void;
|
|
217
|
-
/**
|
|
218
|
-
* Callback function that fires when pointer stops hovering over the component.
|
|
219
|
-
*
|
|
220
|
-
* ```jsx
|
|
221
|
-
* <motion.div onHoverEnd={() => console.log("Hover ends")} />
|
|
222
|
-
* ```
|
|
223
|
-
*/
|
|
224
|
-
onHoverEnd?(event: MouseEvent, info: EventInfo): void;
|
|
225
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { FeatureProps } from "../motion/features/types";
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @param handlers -
|
|
5
|
-
* @param ref -
|
|
6
|
-
*
|
|
7
|
-
* @internalremarks
|
|
8
|
-
* Currently this sets new pan gesture functions every render. The memo route has been explored
|
|
9
|
-
* in the past but ultimately we're still creating new functions every render. An optimisation
|
|
10
|
-
* to explore is creating the pan gestures and loading them into a `ref`.
|
|
11
|
-
*
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
export declare function usePanGesture({ onPan, onPanStart, onPanEnd, onPanSessionStart, visualElement, }: FeatureProps): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Recursively traverse up the tree to check whether the provided child node
|
|
3
|
-
* is the parent or a descendant of it.
|
|
4
|
-
*
|
|
5
|
-
* @param parent - Element to find
|
|
6
|
-
* @param child - Element to test against parent
|
|
7
|
-
*/
|
|
8
|
-
export declare const isNodeOrChild: (parent: Element, child?: Element | null | undefined) => boolean;
|
package/types/index.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Components
|
|
3
|
-
*/
|
|
4
|
-
export { motion, createDomMotionComponent } from "./render/dom/motion";
|
|
5
|
-
export { m } from "./render/dom/motion-minimal";
|
|
6
|
-
export { AnimatePresence } from "./components/AnimatePresence";
|
|
7
|
-
export { AnimateSharedLayout } from "./components/AnimateSharedLayout";
|
|
8
|
-
export { MotionConfig } from "./components/MotionConfig";
|
|
9
|
-
export { LazyMotion } from "./components/LazyMotion";
|
|
10
|
-
export { LayoutGroup } from "./components/LayoutGroup";
|
|
11
|
-
export { Reorder } from "./components/Reorder";
|
|
12
|
-
/**
|
|
13
|
-
* Three
|
|
14
|
-
*/
|
|
15
|
-
export * from "./three-entry";
|
|
16
|
-
/**
|
|
17
|
-
* Features
|
|
18
|
-
*/
|
|
19
|
-
export { domAnimation } from "./render/dom/features-animation";
|
|
20
|
-
export { domMax } from "./render/dom/features-max";
|
|
21
|
-
/**
|
|
22
|
-
* Motion values
|
|
23
|
-
*/
|
|
24
|
-
export { useMotionValue } from "./value/use-motion-value";
|
|
25
|
-
export { useMotionTemplate } from "./value/use-motion-template";
|
|
26
|
-
export { MotionValue, motionValue, PassiveEffect, Subscriber } from "./value";
|
|
27
|
-
export { resolveMotionValue } from "./value/utils/resolve-motion-value";
|
|
28
|
-
export { useTransform } from "./value/use-transform";
|
|
29
|
-
export { useSpring } from "./value/use-spring";
|
|
30
|
-
export { useVelocity } from "./value/use-velocity";
|
|
31
|
-
export { useElementScroll } from "./value/scroll/use-element-scroll";
|
|
32
|
-
export { useViewportScroll } from "./value/scroll/use-viewport-scroll";
|
|
33
|
-
export { useTime } from "./value/use-time";
|
|
34
|
-
/**
|
|
35
|
-
* Accessibility
|
|
36
|
-
*/
|
|
37
|
-
export { useReducedMotion, useReducedMotionConfig, } from "./utils/use-reduced-motion";
|
|
38
|
-
/**
|
|
39
|
-
* Utils
|
|
40
|
-
*/
|
|
41
|
-
export { animationControls } from "./animation/animation-controls";
|
|
42
|
-
export { AnimationControls } from "./animation/types";
|
|
43
|
-
export { useAnimation } from "./animation/use-animation";
|
|
44
|
-
export { useAnimationFrame } from "./utils/use-animation-frame";
|
|
45
|
-
export { animate } from "./animation/animate";
|
|
46
|
-
export { animateVisualElement } from "./render/utils/animation";
|
|
47
|
-
export { HoverHandlers, TapHandlers, PanHandlers, FocusHandlers, TapInfo, } from "./gestures/types";
|
|
48
|
-
export { PanInfo } from "./gestures/PanSession";
|
|
49
|
-
export { useCycle } from "./utils/use-cycle";
|
|
50
|
-
export { transform } from "./utils/transform";
|
|
51
|
-
export { isValidMotionProp } from "./motion/utils/valid-prop";
|
|
52
|
-
export { usePresence, useIsPresent, } from "./components/AnimatePresence/use-presence";
|
|
53
|
-
export { useDragControls, DragControls, } from "./gestures/drag/use-drag-controls";
|
|
54
|
-
export { useDomEvent } from "./events/use-dom-event";
|
|
55
|
-
export { createMotionComponent } from "./motion";
|
|
56
|
-
export { visualElement } from "./render";
|
|
57
|
-
export { VisualElement } from "./render/types";
|
|
58
|
-
export { addScaleCorrector } from "./projection/styles/scale-correction";
|
|
59
|
-
export { useInstantTransition } from "./utils/use-instant-transition";
|
|
60
|
-
export { useInstantLayoutTransition } from "./projection/use-instant-layout-transition";
|
|
61
|
-
export { useResetProjection } from "./projection/use-reset-projection";
|
|
62
|
-
/**
|
|
63
|
-
* Contexts
|
|
64
|
-
*/
|
|
65
|
-
export { MotionContext } from "./context/MotionContext";
|
|
66
|
-
export { MotionConfigContext } from "./context/MotionConfigContext";
|
|
67
|
-
export { PresenceContext } from "./context/PresenceContext";
|
|
68
|
-
export { LayoutGroupContext } from "./context/LayoutGroupContext";
|
|
69
|
-
export { DeprecatedLayoutGroupContext } from "./context/DeprecatedLayoutGroupContext";
|
|
70
|
-
export { SwitchLayoutGroupContext } from "./context/SwitchLayoutGroupContext";
|
|
71
|
-
/**
|
|
72
|
-
* Types
|
|
73
|
-
*/
|
|
74
|
-
export { HTMLMotionProps, ForwardRefComponent } from "./render/html/types";
|
|
75
|
-
export { SVGMotionProps, SVGAttributesAsMotionValues } from "./render/svg/types";
|
|
76
|
-
export { AnimationOptions, AnimationPlaybackControls, } from "./animation/animate";
|
|
77
|
-
export { CustomDomComponent } from "./render/dom/motion-proxy";
|
|
78
|
-
export { ScrollMotionValues } from "./value/scroll/utils";
|
|
79
|
-
export { AnimationProps, MotionProps, MotionAdvancedProps, MotionStyle, MotionTransform, VariantLabels, RelayoutInfo, ResolveLayoutTransition, } from "./motion/types";
|
|
80
|
-
export { Orchestration, Repeat, Tween, Spring, Keyframes, Inertia, None, EasingFunction, Target, TargetAndTransition, Transition, ResolvedKeyframesTarget, KeyframesTarget, CustomValueType, ResolvedSingleTarget, SingleTarget, ResolvedValueTarget, ValueTarget, Variant, Variants, } from "./types";
|
|
81
|
-
export { EventInfo } from "./events/types";
|
|
82
|
-
export { VisualElementLifecycles } from "./render/utils/lifecycles";
|
|
83
|
-
export * from "./motion/features/types";
|
|
84
|
-
export { DraggableProps, DragHandlers, DragElastic, } from "./gestures/drag/types";
|
|
85
|
-
export { LayoutProps } from "./motion/features/layout/types";
|
|
86
|
-
export { AnimatePresenceProps } from "./components/AnimatePresence/types";
|
|
87
|
-
export { MotionConfigProps } from "./components/MotionConfig";
|
|
88
|
-
export { LazyProps } from "./components/LazyMotion/types";
|
|
89
|
-
export { FlatTree } from "./render/utils/flat-tree";
|
|
90
|
-
export * from "./projection/geometry/types";
|
|
91
|
-
export { IProjectionNode } from "./projection/node/types";
|
|
92
|
-
/**
|
|
93
|
-
* Deprecated
|
|
94
|
-
*/
|
|
95
|
-
export { useAnimatedState as useDeprecatedAnimatedState } from "./animation/use-animated-state";
|
|
96
|
-
export { useInvertedScale as useDeprecatedInvertedScale } from "./value/use-inverted-scale";
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @public
|
|
3
|
-
*/
|
|
4
|
-
export interface LayoutProps {
|
|
5
|
-
/**
|
|
6
|
-
* If `true`, this component will automatically animate to its new position when
|
|
7
|
-
* its layout changes.
|
|
8
|
-
*
|
|
9
|
-
* ```jsx
|
|
10
|
-
* <motion.div layout />
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* This will perform a layout animation using performant transforms. Part of this technique
|
|
14
|
-
* involved animating an element's scale. This can introduce visual distortions on children,
|
|
15
|
-
* `boxShadow` and `borderRadius`.
|
|
16
|
-
*
|
|
17
|
-
* To correct distortion on immediate children, add `layout` to those too.
|
|
18
|
-
*
|
|
19
|
-
* `boxShadow` and `borderRadius` will automatically be corrected if they are already being
|
|
20
|
-
* animated on this component. Otherwise, set them directly via the `initial` prop.
|
|
21
|
-
*
|
|
22
|
-
* If `layout` is set to `"position"`, the size of the component will change instantly and
|
|
23
|
-
* only its position will animate. If `layout` is set to `"size"`, the position of the
|
|
24
|
-
* component will change instantly but its size will animate.
|
|
25
|
-
*
|
|
26
|
-
* If `layout` is set to `"size"`, the position of the component will change instantly and
|
|
27
|
-
* only its size will animate.
|
|
28
|
-
*
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
layout?: boolean | "position" | "size";
|
|
32
|
-
/**
|
|
33
|
-
* Enable shared layout transitions between different components with the same `layoutId`.
|
|
34
|
-
*
|
|
35
|
-
* When a component with a layoutId is removed from the React tree, and then
|
|
36
|
-
* added elsewhere, it will visually animate from the previous component's bounding box
|
|
37
|
-
* and its latest animated values.
|
|
38
|
-
*
|
|
39
|
-
* ```jsx
|
|
40
|
-
* {items.map(item => (
|
|
41
|
-
* <motion.li layout>
|
|
42
|
-
* {item.name}
|
|
43
|
-
* {item.isSelected && <motion.div layoutId="underline" />}
|
|
44
|
-
* </motion.li>
|
|
45
|
-
* ))}
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* If the previous component remains in the tree it will crossfade with the new component.
|
|
49
|
-
*
|
|
50
|
-
* @public
|
|
51
|
-
*/
|
|
52
|
-
layoutId?: string;
|
|
53
|
-
/**
|
|
54
|
-
* A callback that will fire when a layout animation on this component starts.
|
|
55
|
-
*
|
|
56
|
-
* @public
|
|
57
|
-
*/
|
|
58
|
-
onLayoutAnimationStart?(): void;
|
|
59
|
-
/**
|
|
60
|
-
* A callback that will fire when a layout animation on this component completes.
|
|
61
|
-
*
|
|
62
|
-
* @public
|
|
63
|
-
*/
|
|
64
|
-
onLayoutAnimationComplete?(): void;
|
|
65
|
-
/**
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
68
|
-
layoutDependency?: any;
|
|
69
|
-
/**
|
|
70
|
-
* Wether a projection node should measure its scroll when it or its descendants update their layout.
|
|
71
|
-
*
|
|
72
|
-
* @public
|
|
73
|
-
*/
|
|
74
|
-
layoutScroll?: boolean;
|
|
75
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { MotionProps } from "../types";
|
|
3
|
-
import { VisualState } from "../utils/use-visual-state";
|
|
4
|
-
import { CreateVisualElement, VisualElement } from "../../render/types";
|
|
5
|
-
/**
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export interface FeatureProps extends MotionProps {
|
|
9
|
-
visualElement: VisualElement;
|
|
10
|
-
}
|
|
11
|
-
export declare type FeatureNames = {
|
|
12
|
-
animation: true;
|
|
13
|
-
exit: true;
|
|
14
|
-
drag: true;
|
|
15
|
-
tap: true;
|
|
16
|
-
focus: true;
|
|
17
|
-
hover: true;
|
|
18
|
-
pan: true;
|
|
19
|
-
inView: true;
|
|
20
|
-
measureLayout: true;
|
|
21
|
-
};
|
|
22
|
-
export declare type FeatureComponent = React.ComponentType<FeatureProps>;
|
|
23
|
-
/**
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
export interface FeatureDefinition {
|
|
27
|
-
isEnabled: (props: MotionProps) => boolean;
|
|
28
|
-
Component?: FeatureComponent;
|
|
29
|
-
}
|
|
30
|
-
export interface FeatureComponents {
|
|
31
|
-
animation?: FeatureComponent;
|
|
32
|
-
exit?: FeatureComponent;
|
|
33
|
-
drag?: FeatureComponent;
|
|
34
|
-
tap?: FeatureComponent;
|
|
35
|
-
focus?: FeatureComponent;
|
|
36
|
-
hover?: FeatureComponent;
|
|
37
|
-
pan?: FeatureComponent;
|
|
38
|
-
inView?: FeatureComponent;
|
|
39
|
-
measureLayout?: FeatureComponent;
|
|
40
|
-
}
|
|
41
|
-
export interface FeatureBundle extends FeatureComponents {
|
|
42
|
-
renderer: CreateVisualElement<any>;
|
|
43
|
-
projectionNodeConstructor?: any;
|
|
44
|
-
}
|
|
45
|
-
export declare type LazyFeatureBundle = () => Promise<FeatureBundle>;
|
|
46
|
-
export declare type FeatureDefinitions = {
|
|
47
|
-
[K in keyof FeatureNames]: FeatureDefinition;
|
|
48
|
-
};
|
|
49
|
-
export declare type LoadedFeatures = FeatureDefinitions & {
|
|
50
|
-
projectionNodeConstructor?: any;
|
|
51
|
-
};
|
|
52
|
-
export declare type RenderComponent<Instance, RenderState> = (Component: string | React.ComponentType, props: MotionProps, projectionId: number | undefined, ref: React.Ref<Instance>, visualState: VisualState<Instance, RenderState>, isStatic: boolean, visualElement?: VisualElement) => any;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { VisualElement } from "../../render/types";
|
|
3
|
-
import { MotionProps } from "../types";
|
|
4
|
-
import { FeatureBundle } from "./types";
|
|
5
|
-
/**
|
|
6
|
-
* Load features via renderless components based on the provided MotionProps.
|
|
7
|
-
*/
|
|
8
|
-
export declare function useFeatures(props: MotionProps, visualElement?: VisualElement, preloadedFeatures?: FeatureBundle): null | JSX.Element[];
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { VisualElement } from "../../render/types";
|
|
2
|
-
import { MotionProps } from "../types";
|
|
3
|
-
export declare function useProjection(projectionId: number | undefined, { layoutId, layout, drag, dragConstraints, layoutScroll }: MotionProps, visualElement?: VisualElement, ProjectionNodeConstructor?: any): void;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { RefObject } from "react";
|
|
2
|
-
import { TargetAndTransition } from "../../../types";
|
|
3
|
-
import { VariantLabels } from "../../types";
|
|
4
|
-
export declare type ViewportEventHandler = (entry: IntersectionObserverEntry | null) => void;
|
|
5
|
-
export interface ViewportOptions {
|
|
6
|
-
root?: RefObject<Element>;
|
|
7
|
-
once?: boolean;
|
|
8
|
-
margin?: string;
|
|
9
|
-
amount?: "some" | "all" | number;
|
|
10
|
-
fallback?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface ViewportProps {
|
|
13
|
-
whileInView?: VariantLabels | TargetAndTransition;
|
|
14
|
-
onViewportEnter?: ViewportEventHandler;
|
|
15
|
-
onViewportLeave?: ViewportEventHandler;
|
|
16
|
-
viewport?: ViewportOptions;
|
|
17
|
-
}
|
|
18
|
-
export declare type ViewportState = {
|
|
19
|
-
hasEnteredView: boolean;
|
|
20
|
-
isInView: boolean;
|
|
21
|
-
};
|