framer-motion 5.0.0 → 5.0.1-rc.1
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/es/animation/use-animated-state.mjs +2 -1
- package/dist/es/animation/use-animation.mjs +2 -1
- package/dist/es/components/AnimatePresence/PresenceChild.mjs +2 -2
- package/dist/es/components/AnimatePresence/index.mjs +2 -2
- package/dist/es/components/AnimatePresence/use-presence.mjs +2 -1
- package/dist/es/components/AnimateSharedLayout.mjs +1 -1
- package/dist/es/components/LayoutGroup/index.mjs +2 -2
- package/dist/es/components/LazyMotion/index.mjs +2 -2
- package/dist/es/components/MotionConfig/index.mjs +3 -6
- package/dist/es/components/Reorder/Group.mjs +2 -2
- package/dist/es/components/Reorder/Item.mjs +2 -2
- package/dist/es/context/DeprecatedLayoutGroupContext.mjs +2 -2
- package/dist/es/context/LayoutGroupContext.mjs +2 -2
- package/dist/es/context/LazyContext.mjs +4 -2
- package/dist/es/context/MotionConfigContext.mjs +2 -2
- package/dist/es/context/MotionContext/create.mjs +2 -1
- package/dist/es/context/MotionContext/index.mjs +3 -3
- package/dist/es/context/PresenceContext.mjs +2 -2
- package/dist/es/context/ReorderContext.mjs +2 -2
- package/dist/es/context/SwitchLayoutGroupContext.mjs +2 -2
- package/dist/es/events/use-dom-event.mjs +2 -2
- package/dist/es/gestures/drag/use-drag.mjs +2 -1
- package/dist/es/gestures/use-pan-gesture.mjs +2 -1
- package/dist/es/gestures/use-tap-gesture.mjs +2 -1
- package/dist/es/motion/features/animations.mjs +2 -1
- package/dist/es/motion/features/layout/MeasureLayout.mjs +4 -3
- package/dist/es/motion/features/use-features.mjs +2 -2
- package/dist/es/motion/features/use-projection.mjs +2 -1
- package/dist/es/motion/index.mjs +2 -2
- package/dist/es/motion/utils/VisualElementHandler.mjs +2 -2
- package/dist/es/motion/utils/use-motion-ref.mjs +2 -1
- package/dist/es/motion/utils/use-visual-element.mjs +2 -1
- package/dist/es/motion/utils/use-visual-state.mjs +13 -8
- package/dist/es/projection/use-reset-projection.mjs +1 -1
- package/dist/es/render/dom/use-render.mjs +2 -1
- package/dist/es/render/html/use-props.mjs +6 -3
- package/dist/es/render/svg/use-props.mjs +2 -1
- package/dist/es/utils/use-constant.mjs +2 -2
- package/dist/es/utils/use-cycle.mjs +2 -1
- package/dist/es/utils/use-force-update.mjs +2 -1
- package/dist/es/utils/use-isomorphic-effect.mjs +2 -1
- package/dist/es/utils/use-reduced-motion.mjs +2 -1
- package/dist/es/utils/use-unmount-effect.mjs +2 -2
- package/dist/es/value/use-motion-value.mjs +2 -1
- package/dist/es/value/use-on-change.mjs +2 -1
- package/dist/es/value/use-spring.mjs +2 -1
- package/dist/es/value/use-velocity.mjs +2 -1
- package/dist/framer-motion.cjs.js +155 -138
- package/dist/framer-motion.dev.js +155 -138
- package/dist/framer-motion.js +1 -1
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js +1 -1
- package/package.json +6 -6
- package/types/components/AnimatePresence/PresenceChild.d.ts +1 -1
- package/types/components/AnimatePresence/index.d.ts +1 -1
- package/types/components/AnimateSharedLayout.d.ts +1 -1
- package/types/components/LayoutGroup/index.d.ts +1 -1
- package/types/components/MotionConfig/index.d.ts +1 -1
- package/types/components/Reorder/Group.d.ts +2 -2
- package/types/components/Reorder/Item.d.ts +2 -2
- package/types/context/DeprecatedLayoutGroupContext.d.ts +2 -2
- package/types/context/LayoutGroupContext.d.ts +2 -2
- package/types/context/LazyContext.d.ts +2 -2
- package/types/context/MotionConfigContext.d.ts +2 -2
- package/types/context/MotionContext/index.d.ts +2 -2
- package/types/context/PresenceContext.d.ts +2 -2
- package/types/context/ReorderContext.d.ts +2 -2
- package/types/context/SwitchLayoutGroupContext.d.ts +2 -2
- package/types/events/types.d.ts +1 -1
- package/types/events/use-dom-event.d.ts +1 -1
- package/types/events/use-pointer-event.d.ts +1 -1
- package/types/gestures/drag/types.d.ts +1 -1
- package/types/gestures/drag/use-drag-controls.d.ts +1 -1
- package/types/motion/features/types.d.ts +1 -1
- package/types/motion/index.d.ts +1 -1
- package/types/motion/types.d.ts +1 -1
- package/types/motion/utils/use-motion-ref.d.ts +1 -1
- package/types/motion/utils/use-visual-element.d.ts +1 -1
- package/types/render/dom/motion-proxy.d.ts +1 -1
- package/types/render/dom/utils/create-config.d.ts +2 -2
- package/types/render/dom/utils/is-svg-component.d.ts +1 -1
- package/types/render/html/types.d.ts +1 -1
- package/types/render/svg/types.d.ts +1 -1
- package/types/render/types.d.ts +1 -1
- package/types/types.d.ts +1 -1
- package/types/utils/is-ref-object.d.ts +1 -1
- package/types/utils/use-isomorphic-effect.d.ts +2 -2
- package/types/value/scroll/use-element-scroll.d.ts +1 -1
- package/dist/size-webpack-dom-animation.js +0 -1
- package/dist/size-webpack-dom-max.js +0 -2
- package/dist/size-webpack-dom-max.js.LICENSE.txt +0 -14
- package/dist/size-webpack-m.js +0 -2
- package/dist/size-webpack-m.js.LICENSE.txt +0 -14
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __rest, __assign, __read } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { useConstant } from '../utils/use-constant.mjs';
|
|
4
4
|
import { getOrigin, checkTargetForNewValues } from '../render/utils/setters.mjs';
|
|
5
5
|
import { visualElement } from '../render/index.mjs';
|
|
@@ -7,6 +7,7 @@ import { animateVisualElement } from '../render/utils/animation.mjs';
|
|
|
7
7
|
import { makeUseVisualState } from '../motion/utils/use-visual-state.mjs';
|
|
8
8
|
import { createBox } from '../projection/geometry/models.mjs';
|
|
9
9
|
|
|
10
|
+
var useEffect = React.useEffect, useState = React.useState;
|
|
10
11
|
var createObject = function () { return ({}); };
|
|
11
12
|
var stateVisualElement = visualElement({
|
|
12
13
|
build: function () { },
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { animationControls } from './animation-controls.mjs';
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
3
|
import { useConstant } from '../utils/use-constant.mjs';
|
|
4
4
|
|
|
5
|
+
var useEffect = React.useEffect;
|
|
5
6
|
/**
|
|
6
7
|
* Creates `AnimationControls`, which can be used to manually start, stop
|
|
7
8
|
* and sequence animations on one or more components.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __values } from 'tslib';
|
|
2
|
-
import
|
|
3
|
-
import { useMemo } from 'react';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import { PresenceContext } from '../../context/PresenceContext.mjs';
|
|
5
4
|
import { useConstant } from '../../utils/use-constant.mjs';
|
|
6
5
|
|
|
6
|
+
var useMemo = React.useMemo;
|
|
7
7
|
var presenceId = 0;
|
|
8
8
|
function getPresenceId() {
|
|
9
9
|
var id = presenceId;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __read, __spreadArray } from 'tslib';
|
|
2
|
-
import
|
|
3
|
-
import { useContext, useRef, cloneElement, Children, isValidElement } from 'react';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import { useForceUpdate } from '../../utils/use-force-update.mjs';
|
|
5
4
|
import { PresenceChild } from './PresenceChild.mjs';
|
|
6
5
|
import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
|
|
7
6
|
|
|
7
|
+
var Children = React.Children, useRef = React.useRef, isValidElement = React.isValidElement, cloneElement = React.cloneElement, useContext = React.useContext;
|
|
8
8
|
function getChildKey(child) {
|
|
9
9
|
return child.key || "";
|
|
10
10
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { PresenceContext } from '../../context/PresenceContext.mjs';
|
|
3
3
|
import { useConstant } from '../../utils/use-constant.mjs';
|
|
4
4
|
|
|
5
|
+
var useContext = React.useContext, useEffect = React.useEffect;
|
|
5
6
|
/**
|
|
6
7
|
* When a component is the child of `AnimatePresence`, it can use `usePresence`
|
|
7
8
|
* to access information about whether it's still present in the React tree.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __read, __assign } from 'tslib';
|
|
2
|
-
import
|
|
3
|
-
import { useContext, useRef, useMemo } from 'react';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
|
|
5
4
|
import { DeprecatedLayoutGroupContext } from '../../context/DeprecatedLayoutGroupContext.mjs';
|
|
6
5
|
import { useForceUpdate } from '../../utils/use-force-update.mjs';
|
|
7
6
|
import { nodeGroup } from '../../projection/node/group.mjs';
|
|
8
7
|
|
|
8
|
+
var useContext = React.useContext, useMemo = React.useMemo, useRef = React.useRef;
|
|
9
9
|
var LayoutGroup = function (_a) {
|
|
10
10
|
var _b, _c;
|
|
11
11
|
var children = _a.children, id = _a.id, _d = _a.inheritId, inheritId = _d === void 0 ? true : _d;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __read, __rest } from 'tslib';
|
|
2
|
-
import
|
|
3
|
-
import { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import { LazyContext } from '../../context/LazyContext.mjs';
|
|
5
4
|
import { loadFeatures } from '../../motion/features/definitions.mjs';
|
|
6
5
|
|
|
6
|
+
var useEffect = React.useEffect, useRef = React.useRef, useState = React.useState;
|
|
7
7
|
/**
|
|
8
8
|
* Used in conjunction with the `m` component to reduce bundle size.
|
|
9
9
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __rest, __assign } from 'tslib';
|
|
2
|
-
import
|
|
3
|
-
import { useContext, useMemo } from 'react';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import { MotionConfigContext } from '../../context/MotionConfigContext.mjs';
|
|
5
4
|
import { useConstant } from '../../utils/use-constant.mjs';
|
|
6
5
|
|
|
6
|
+
var useContext = React.useContext, useMemo = React.useMemo;
|
|
7
7
|
/**
|
|
8
8
|
* `MotionConfig` is used to set configuration options for all children `motion` components.
|
|
9
9
|
*
|
|
@@ -39,10 +39,7 @@ function MotionConfig(_a) {
|
|
|
39
39
|
var transitionDependency = typeof config.transition === "object"
|
|
40
40
|
? config.transition.toString()
|
|
41
41
|
: "";
|
|
42
|
-
var context = useMemo(function () { return config; }, [
|
|
43
|
-
transitionDependency,
|
|
44
|
-
config.transformPagePoint,
|
|
45
|
-
]);
|
|
42
|
+
var context = useMemo(function () { return config; }, [transitionDependency, config.transformPagePoint]);
|
|
46
43
|
return (React.createElement(MotionConfigContext.Provider, { value: context }, children));
|
|
47
44
|
}
|
|
48
45
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { __rest, __assign } from 'tslib';
|
|
2
2
|
import { invariant } from 'hey-listen';
|
|
3
|
-
import
|
|
4
|
-
import { forwardRef, useRef, useEffect } from 'react';
|
|
3
|
+
import React from 'react';
|
|
5
4
|
import { ReorderContext } from '../../context/ReorderContext.mjs';
|
|
6
5
|
import { motion } from '../../render/dom/motion.mjs';
|
|
7
6
|
import { useConstant } from '../../utils/use-constant.mjs';
|
|
8
7
|
import { checkReorder } from './utils/check-reorder.mjs';
|
|
9
8
|
|
|
9
|
+
var forwardRef = React.forwardRef, useEffect = React.useEffect, useRef = React.useRef;
|
|
10
10
|
function ReorderGroup(_a, externalRef) {
|
|
11
11
|
var children = _a.children, _b = _a.as, as = _b === void 0 ? "ul" : _b, _c = _a.axis, axis = _c === void 0 ? "y" : _c, onReorder = _a.onReorder, values = _a.values, props = __rest(_a, ["children", "as", "axis", "onReorder", "values"]);
|
|
12
12
|
var Component = useConstant(function () { return motion(as); });
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { __rest, __read, __assign } from 'tslib';
|
|
2
2
|
import { invariant } from 'hey-listen';
|
|
3
|
-
import
|
|
4
|
-
import { forwardRef, useContext, useRef, useEffect } from 'react';
|
|
3
|
+
import React from 'react';
|
|
5
4
|
import { ReorderContext } from '../../context/ReorderContext.mjs';
|
|
6
5
|
import { motion } from '../../render/dom/motion.mjs';
|
|
7
6
|
import { useConstant } from '../../utils/use-constant.mjs';
|
|
@@ -9,6 +8,7 @@ import { useMotionValue } from '../../value/use-motion-value.mjs';
|
|
|
9
8
|
import { useTransform } from '../../value/use-transform.mjs';
|
|
10
9
|
import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
|
|
11
10
|
|
|
11
|
+
var useContext = React.useContext, useEffect = React.useEffect, useRef = React.useRef, forwardRef = React.forwardRef;
|
|
12
12
|
function useDefaultMotionValue(value, defaultValue) {
|
|
13
13
|
if (defaultValue === void 0) { defaultValue = 0; }
|
|
14
14
|
return isMotionValue(value) ? value : useMotionValue(defaultValue);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
* @deprecated
|
|
6
6
|
*/
|
|
7
|
-
var DeprecatedLayoutGroupContext = createContext(null);
|
|
7
|
+
var DeprecatedLayoutGroupContext = React.createContext(null);
|
|
8
8
|
|
|
9
9
|
export { DeprecatedLayoutGroupContext };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
|
5
5
|
*/
|
|
6
|
-
var MotionConfigContext = createContext({
|
|
6
|
+
var MotionConfigContext = React.createContext({
|
|
7
7
|
transformPagePoint: function (p) { return p; },
|
|
8
8
|
isStatic: false,
|
|
9
9
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { MotionContext } from './index.mjs';
|
|
3
3
|
import { getCurrentTreeVariants } from './utils.mjs';
|
|
4
4
|
|
|
5
|
+
var useContext = React.useContext, useMemo = React.useMemo;
|
|
5
6
|
function useCreateMotionContext(props, isStatic) {
|
|
6
7
|
var _a = getCurrentTreeVariants(props, useContext(MotionContext)), initial = _a.initial, animate = _a.animate;
|
|
7
8
|
return useMemo(function () { return ({ initial: initial, animate: animate }); },
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
|
-
var MotionContext = createContext({});
|
|
3
|
+
var MotionContext = React.createContext({});
|
|
4
4
|
function useVisualElementContext() {
|
|
5
|
-
return useContext(MotionContext).visualElement;
|
|
5
|
+
return React.useContext(MotionContext).visualElement;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export { MotionContext, useVisualElementContext };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
function addDomEvent(target, eventName, handler, options) {
|
|
4
4
|
target.addEventListener(eventName, handler, options);
|
|
@@ -26,7 +26,7 @@ function addDomEvent(target, eventName, handler, options) {
|
|
|
26
26
|
* @public
|
|
27
27
|
*/
|
|
28
28
|
function useDomEvent(ref, eventName, handler, options) {
|
|
29
|
-
useEffect(function () {
|
|
29
|
+
React.useEffect(function () {
|
|
30
30
|
var element = ref.current;
|
|
31
31
|
if (handler && element) {
|
|
32
32
|
return addDomEvent(element, eventName, handler, options);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { VisualElementDragControls } from './VisualElementDragControls.mjs';
|
|
3
3
|
import { useConstant } from '../../utils/use-constant.mjs';
|
|
4
4
|
|
|
5
|
+
var useEffect = React.useEffect;
|
|
5
6
|
/**
|
|
6
7
|
* A hook that allows an element to be dragged.
|
|
7
8
|
*
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
|
|
3
3
|
import { useUnmountEffect } from '../utils/use-unmount-effect.mjs';
|
|
4
4
|
import { usePointerEvent } from '../events/use-pointer-event.mjs';
|
|
5
5
|
import { PanSession } from './PanSession.mjs';
|
|
6
6
|
|
|
7
|
+
var useRef = React.useRef, useContext = React.useContext, useEffect = React.useEffect;
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
9
10
|
* @param handlers -
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { isNodeOrChild } from './utils/is-node-or-child.mjs';
|
|
3
3
|
import { usePointerEvent, addPointerEvent } from '../events/use-pointer-event.mjs';
|
|
4
4
|
import { useUnmountEffect } from '../utils/use-unmount-effect.mjs';
|
|
@@ -6,6 +6,7 @@ import { pipe } from 'popmotion';
|
|
|
6
6
|
import { AnimationType } from '../render/utils/types.mjs';
|
|
7
7
|
import { isDragActive } from './drag/utils/lock.mjs';
|
|
8
8
|
|
|
9
|
+
var useRef = React.useRef;
|
|
9
10
|
/**
|
|
10
11
|
* @param handlers -
|
|
11
12
|
* @internal
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __read } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { isAnimationControls } from '../../animation/utils/is-animation-controls.mjs';
|
|
4
4
|
import { usePresence } from '../../components/AnimatePresence/use-presence.mjs';
|
|
5
5
|
import { PresenceContext } from '../../context/PresenceContext.mjs';
|
|
@@ -7,6 +7,7 @@ import { createAnimationState } from '../../render/utils/animation-state.mjs';
|
|
|
7
7
|
import { AnimationType } from '../../render/utils/types.mjs';
|
|
8
8
|
import { makeRenderlessComponent } from '../utils/make-renderless-component.mjs';
|
|
9
9
|
|
|
10
|
+
var useContext = React.useContext, useEffect = React.useEffect;
|
|
10
11
|
var animations = {
|
|
11
12
|
animation: makeRenderlessComponent(function (_a) {
|
|
12
13
|
var visualElement = _a.visualElement, animate = _a.animate;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __extends, __assign, __read } from 'tslib';
|
|
2
2
|
import sync from 'framesync';
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { usePresence } from '../../../components/AnimatePresence/use-presence.mjs';
|
|
5
5
|
import { LayoutGroupContext } from '../../../context/LayoutGroupContext.mjs';
|
|
6
6
|
import { SwitchLayoutGroupContext } from '../../../context/SwitchLayoutGroupContext.mjs';
|
|
@@ -9,6 +9,7 @@ import { correctBorderRadius } from '../../../projection/styles/scale-border-rad
|
|
|
9
9
|
import { correctBoxShadow } from '../../../projection/styles/scale-box-shadow.mjs';
|
|
10
10
|
import { addScaleCorrector } from '../../../projection/styles/scale-correction.mjs';
|
|
11
11
|
|
|
12
|
+
var useContext = React.useContext;
|
|
12
13
|
var MeasureLayoutWithContext = /** @class */ (function (_super) {
|
|
13
14
|
__extends(MeasureLayoutWithContext, _super);
|
|
14
15
|
function MeasureLayoutWithContext() {
|
|
@@ -108,11 +109,11 @@ var MeasureLayoutWithContext = /** @class */ (function (_super) {
|
|
|
108
109
|
return null;
|
|
109
110
|
};
|
|
110
111
|
return MeasureLayoutWithContext;
|
|
111
|
-
}(
|
|
112
|
+
}(React.Component));
|
|
112
113
|
function MeasureLayout(props) {
|
|
113
114
|
var _a = __read(usePresence(), 2), isPresent = _a[0], safeToRemove = _a[1];
|
|
114
115
|
var layoutGroup = useContext(LayoutGroupContext);
|
|
115
|
-
return (
|
|
116
|
+
return (React.createElement(MeasureLayoutWithContext, __assign({}, props, { layoutGroup: layoutGroup, switchLayoutGroup: useContext(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove })));
|
|
116
117
|
}
|
|
117
118
|
var defaultScaleCorrectors = {
|
|
118
119
|
borderRadius: __assign(__assign({}, correctBorderRadius), { applyTo: [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __assign } from 'tslib';
|
|
2
|
-
import
|
|
3
|
-
import { useContext } from 'react';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import { featureDefinitions } from './definitions.mjs';
|
|
5
4
|
import { invariant } from 'hey-listen';
|
|
6
5
|
import { LazyContext } from '../../context/LazyContext.mjs';
|
|
7
6
|
|
|
7
|
+
var useContext = React.useContext;
|
|
8
8
|
var featureNames = Object.keys(featureDefinitions);
|
|
9
9
|
var numFeatures = featureNames.length;
|
|
10
10
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { isRefObject } from '../../utils/is-ref-object.mjs';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { SwitchLayoutGroupContext } from '../../context/SwitchLayoutGroupContext.mjs';
|
|
4
4
|
|
|
5
|
+
var useContext = React.useContext;
|
|
5
6
|
function useProjection(projectionId, _a, visualElement, ProjectionNodeConstructor) {
|
|
6
7
|
var _b;
|
|
7
8
|
var layoutId = _a.layoutId, layout = _a.layout, drag = _a.drag, dragConstraints = _a.dragConstraints, layoutScroll = _a.layoutScroll;
|
package/dist/es/motion/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __assign } from 'tslib';
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef, useContext } from 'react';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import { useFeatures } from './features/use-features.mjs';
|
|
5
4
|
import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
|
|
6
5
|
import { MotionContext } from '../context/MotionContext/index.mjs';
|
|
@@ -14,6 +13,7 @@ import { LayoutGroupContext } from '../context/LayoutGroupContext.mjs';
|
|
|
14
13
|
import { useProjection } from './features/use-projection.mjs';
|
|
15
14
|
import { VisualElementHandler } from './utils/VisualElementHandler.mjs';
|
|
16
15
|
|
|
16
|
+
var forwardRef = React.forwardRef, useContext = React.useContext;
|
|
17
17
|
/**
|
|
18
18
|
* Create a `motion` component.
|
|
19
19
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __extends } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
|
|
4
4
|
var VisualElementHandler = /** @class */ (function (_super) {
|
|
5
5
|
__extends(VisualElementHandler, _super);
|
|
@@ -23,6 +23,6 @@ var VisualElementHandler = /** @class */ (function (_super) {
|
|
|
23
23
|
return this.props.children;
|
|
24
24
|
};
|
|
25
25
|
return VisualElementHandler;
|
|
26
|
-
}(
|
|
26
|
+
}(React.Component));
|
|
27
27
|
|
|
28
28
|
export { VisualElementHandler };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { isRefObject } from '../../utils/is-ref-object.mjs';
|
|
3
3
|
|
|
4
|
+
var useCallback = React.useCallback;
|
|
4
5
|
/**
|
|
5
6
|
* Creates a ref function that, when called, hydrates the provided
|
|
6
7
|
* external ref and VisualElement.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { PresenceContext } from '../../context/PresenceContext.mjs';
|
|
3
3
|
import { useVisualElementContext } from '../../context/MotionContext/index.mjs';
|
|
4
4
|
import { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';
|
|
5
5
|
import { LazyContext } from '../../context/LazyContext.mjs';
|
|
6
6
|
|
|
7
|
+
var useContext = React.useContext, useEffect = React.useEffect, useRef = React.useRef;
|
|
7
8
|
function useVisualElement(Component, visualState, props, createVisualElement) {
|
|
8
9
|
var lazyContext = useContext(LazyContext);
|
|
9
10
|
var parent = useVisualElementContext();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __rest } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { isAnimationControls } from '../../animation/utils/is-animation-controls.mjs';
|
|
4
4
|
import { PresenceContext } from '../../context/PresenceContext.mjs';
|
|
5
5
|
import { checkIfControllingVariants, checkIfVariantNode, resolveVariantFromProps } from '../../render/utils/variants.mjs';
|
|
@@ -7,6 +7,7 @@ import { useConstant } from '../../utils/use-constant.mjs';
|
|
|
7
7
|
import { resolveMotionValue } from '../../value/utils/resolve-motion-value.mjs';
|
|
8
8
|
import { MotionContext } from '../../context/MotionContext/index.mjs';
|
|
9
9
|
|
|
10
|
+
var useContext = React.useContext;
|
|
10
11
|
function makeState(_a, props, context, presenceContext) {
|
|
11
12
|
var scrapeMotionValuesFromProps = _a.scrapeMotionValuesFromProps, createRenderState = _a.createRenderState, onMount = _a.onMount;
|
|
12
13
|
var state = {
|
|
@@ -18,13 +19,17 @@ function makeState(_a, props, context, presenceContext) {
|
|
|
18
19
|
}
|
|
19
20
|
return state;
|
|
20
21
|
}
|
|
21
|
-
var makeUseVisualState = function (config) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
var makeUseVisualState = function (config) {
|
|
23
|
+
return function (props, isStatic) {
|
|
24
|
+
var context = useContext(MotionContext);
|
|
25
|
+
var presenceContext = useContext(PresenceContext);
|
|
26
|
+
return isStatic
|
|
27
|
+
? makeState(config, props, context, presenceContext)
|
|
28
|
+
: useConstant(function () {
|
|
29
|
+
return makeState(config, props, context, presenceContext);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
};
|
|
28
33
|
function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
|
|
29
34
|
var values = {};
|
|
30
35
|
var blockInitialAnimation = (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __assign } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { useHTMLProps } from '../html/use-props.mjs';
|
|
4
4
|
import { filterProps } from './utils/filter-props.mjs';
|
|
5
5
|
import { isSVGComponent } from './utils/is-svg-component.mjs';
|
|
6
6
|
import { useSVGProps } from '../svg/use-props.mjs';
|
|
7
7
|
|
|
8
|
+
var createElement = React.createElement;
|
|
8
9
|
function createUseRender(forwardMotionProps) {
|
|
9
10
|
if (forwardMotionProps === void 0) { forwardMotionProps = false; }
|
|
10
11
|
var useRender = function (Component, props, projectionId, ref, _a, isStatic) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __assign } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { isForcedMotionValue } from '../../motion/utils/is-forced-motion-value.mjs';
|
|
4
4
|
import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
|
|
5
5
|
import { buildHTMLStyles } from './utils/build-styles.mjs';
|
|
6
6
|
import { createHtmlRenderState } from './utils/create-render-state.mjs';
|
|
7
7
|
|
|
8
|
+
var useMemo = React.useMemo;
|
|
8
9
|
function copyRawValuesOnly(target, source, props) {
|
|
9
10
|
for (var key in source) {
|
|
10
11
|
if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
|
|
@@ -42,8 +43,10 @@ function useHTMLProps(props, visualState, isStatic) {
|
|
|
42
43
|
// Disable the ghost element when a user drags
|
|
43
44
|
htmlProps.draggable = false;
|
|
44
45
|
// Disable text selection
|
|
45
|
-
style.userSelect =
|
|
46
|
-
|
|
46
|
+
style.userSelect =
|
|
47
|
+
style.WebkitUserSelect =
|
|
48
|
+
style.WebkitTouchCallout =
|
|
49
|
+
"none";
|
|
47
50
|
// Disable scrolling on the draggable direction
|
|
48
51
|
style.touchAction =
|
|
49
52
|
props.drag === true
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { __assign } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { copyRawValuesOnly } from '../html/use-props.mjs';
|
|
4
4
|
import { buildSVGAttrs } from './utils/build-attrs.mjs';
|
|
5
5
|
import { createSvgRenderState } from './utils/create-render-state.mjs';
|
|
6
6
|
|
|
7
|
+
var useMemo = React.useMemo;
|
|
7
8
|
function useSVGProps(props, visualState) {
|
|
8
9
|
var visualProps = useMemo(function () {
|
|
9
10
|
var state = createSvgRenderState();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates a constant value over the lifecycle of a component.
|
|
@@ -8,7 +8,7 @@ import { useRef } from 'react';
|
|
|
8
8
|
* you can ensure that initialisers don't execute twice or more.
|
|
9
9
|
*/
|
|
10
10
|
function useConstant(init) {
|
|
11
|
-
var ref = useRef(null);
|
|
11
|
+
var ref = React.useRef(null);
|
|
12
12
|
if (ref.current === null) {
|
|
13
13
|
ref.current = init();
|
|
14
14
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __read } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { wrap } from 'popmotion';
|
|
4
4
|
|
|
5
|
+
var useState = React.useState, useRef = React.useRef;
|
|
5
6
|
/**
|
|
6
7
|
* Cycles through a series of visual properties. Can be used to toggle between or cycle through animations. It works similar to `useState` in React. It is provided an initial array of possible states, and returns an array of two arguments.
|
|
7
8
|
*
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __read } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { useUnmountEffect } from './use-unmount-effect.mjs';
|
|
4
4
|
|
|
5
|
+
var useState = React.useState, useCallback = React.useCallback, useRef = React.useRef;
|
|
5
6
|
function useForceUpdate() {
|
|
6
7
|
var unloadingRef = useRef(false);
|
|
7
8
|
var _a = __read(useState(0), 2), forcedRenderCount = _a[0], setForcedRenderCount = _a[1];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { isBrowser } from './is-browser.mjs';
|
|
3
3
|
|
|
4
|
+
var useEffect = React.useEffect, useLayoutEffect = React.useLayoutEffect;
|
|
4
5
|
var useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
|
|
5
6
|
|
|
6
7
|
export { useIsomorphicLayoutEffect };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __read } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { motionValue } from '../value/index.mjs';
|
|
4
4
|
import { useOnChange } from '../value/use-on-change.mjs';
|
|
5
5
|
|
|
6
|
+
var useState = React.useState;
|
|
6
7
|
// Does this device prefer reduced motion? Returns `null` server-side.
|
|
7
8
|
var prefersReducedMotion;
|
|
8
9
|
function initPrefersReducedMotion() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
function useUnmountEffect(callback) {
|
|
4
|
-
return useEffect(function () { return function () { return callback(); }; }, []);
|
|
4
|
+
return React.useEffect(function () { return function () { return callback(); }; }, []);
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export { useUnmountEffect };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { __read } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { motionValue } from './index.mjs';
|
|
4
4
|
import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
|
|
5
5
|
import { useConstant } from '../utils/use-constant.mjs';
|
|
6
6
|
|
|
7
|
+
var useContext = React.useContext, useEffect = React.useEffect, useState = React.useState;
|
|
7
8
|
/**
|
|
8
9
|
* Creates a `MotionValue` to track the state and velocity of a value.
|
|
9
10
|
*
|