framer-motion 12.23.27 → 12.24.0
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/client.js +1 -1
- package/dist/cjs/{feature-bundle-kvRbMDEA.js → feature-bundle-DhbxBqkJ.js} +32 -15
- package/dist/cjs/feature-bundle-DhbxBqkJ.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/m.js +14 -11
- package/dist/cjs/m.js.map +1 -1
- package/dist/dom-mini.js +1 -1
- package/dist/dom.js +1 -1
- package/dist/es/components/Reorder/Group.mjs.map +1 -1
- package/dist/es/gestures/drag/index.mjs +10 -0
- package/dist/es/gestures/drag/index.mjs.map +1 -1
- package/dist/es/motion/index.mjs +10 -6
- package/dist/es/motion/index.mjs.map +1 -1
- package/dist/es/motion/utils/use-visual-element.mjs +2 -1
- package/dist/es/motion/utils/use-visual-element.mjs.map +1 -1
- package/dist/es/projection/geometry/delta-apply.mjs +1 -1
- package/dist/es/projection/geometry/delta-apply.mjs.map +1 -1
- package/dist/es/projection/node/create-projection-node.mjs +1 -1
- package/dist/es/projection/node/create-projection-node.mjs.map +1 -1
- package/dist/es/render/dom/create-visual-element.mjs +5 -1
- package/dist/es/render/dom/create-visual-element.mjs.map +1 -1
- package/dist/es/render/dom/use-render.mjs +2 -4
- package/dist/es/render/dom/use-render.mjs.map +1 -1
- package/dist/framer-motion.dev.js +73 -17
- package/dist/framer-motion.js +1 -1
- package/dist/m.d.ts +9 -1
- package/dist/mini.js +1 -1
- package/dist/size-rollup-animate.js +1 -1
- package/dist/size-rollup-animate.js.map +1 -1
- package/dist/size-rollup-dom-animation-assets.js +1 -1
- package/dist/size-rollup-dom-animation-m.js +1 -1
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max-assets.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js +1 -1
- package/dist/size-rollup-m.js.map +1 -1
- package/dist/size-rollup-motion.js +1 -1
- package/dist/size-rollup-motion.js.map +1 -1
- package/dist/size-rollup-scroll.js +1 -1
- package/dist/size-rollup-scroll.js.map +1 -1
- package/dist/size-rollup-waapi-animate.js +1 -1
- package/dist/size-rollup-waapi-animate.js.map +1 -1
- package/dist/types/client.d.ts +1 -1
- package/dist/types/index.d.ts +13 -5
- package/dist/{types.d-DagZKalS.d.ts → types.d-a9pt5qxk.d.ts} +6 -1
- package/package.json +4 -4
- package/dist/cjs/feature-bundle-kvRbMDEA.js.map +0 -1
package/dist/cjs/m.js
CHANGED
|
@@ -617,10 +617,8 @@ function isSVGComponent(Component) {
|
|
|
617
617
|
return false;
|
|
618
618
|
}
|
|
619
619
|
|
|
620
|
-
function useRender(Component, props, ref, { latestValues, }, isStatic, forwardMotionProps = false) {
|
|
621
|
-
const useVisualProps = isSVGComponent(Component)
|
|
622
|
-
? useSVGProps
|
|
623
|
-
: useHTMLProps;
|
|
620
|
+
function useRender(Component, props, ref, { latestValues, }, isStatic, forwardMotionProps = false, isSVG) {
|
|
621
|
+
const useVisualProps = (isSVG ?? isSVGComponent(Component)) ? useSVGProps : useHTMLProps;
|
|
624
622
|
const visualProps = useVisualProps(props, latestValues, isStatic, Component);
|
|
625
623
|
const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
|
|
626
624
|
const elementProps = Component !== react.Fragment ? { ...filteredProps, ...visualProps, ref } : {};
|
|
@@ -891,7 +889,7 @@ const SwitchLayoutGroupContext = react.createContext({});
|
|
|
891
889
|
|
|
892
890
|
const useIsomorphicLayoutEffect = isBrowser ? react.useLayoutEffect : react.useEffect;
|
|
893
891
|
|
|
894
|
-
function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) {
|
|
892
|
+
function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor, isSVG) {
|
|
895
893
|
const { visualElement: parent } = react.useContext(MotionContext);
|
|
896
894
|
const lazyContext = react.useContext(LazyContext);
|
|
897
895
|
const presenceContext = react.useContext(PresenceContext);
|
|
@@ -913,6 +911,7 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
|
|
|
913
911
|
? presenceContext.initial === false
|
|
914
912
|
: false,
|
|
915
913
|
reducedMotionConfig,
|
|
914
|
+
isSVG,
|
|
916
915
|
});
|
|
917
916
|
}
|
|
918
917
|
const visualElement = visualElementRef.current;
|
|
@@ -1028,10 +1027,14 @@ function getClosestProjectingNode(visualElement) {
|
|
|
1028
1027
|
* Alongside this is a config option which provides a way of rendering the provided
|
|
1029
1028
|
* component "offline", or outside the React render cycle.
|
|
1030
1029
|
*/
|
|
1031
|
-
function createMotionComponent(Component, { forwardMotionProps = false } = {}, preloadedFeatures, createVisualElement) {
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1030
|
+
function createMotionComponent(Component, { forwardMotionProps = false, type } = {}, preloadedFeatures, createVisualElement) {
|
|
1031
|
+
/**
|
|
1032
|
+
* Determine whether to use SVG or HTML rendering based on:
|
|
1033
|
+
* 1. Explicit `type` option (highest priority)
|
|
1034
|
+
* 2. Auto-detection via `isSVGComponent`
|
|
1035
|
+
*/
|
|
1036
|
+
const isSVG = type ? type === "svg" : isSVGComponent(Component);
|
|
1037
|
+
const useVisualState = isSVG ? useSVGVisualState : useHTMLVisualState;
|
|
1035
1038
|
function MotionDOMComponent(props, externalRef) {
|
|
1036
1039
|
/**
|
|
1037
1040
|
* If we need to measure the element we load this functionality in a
|
|
@@ -1056,13 +1059,13 @@ function createMotionComponent(Component, { forwardMotionProps = false } = {}, p
|
|
|
1056
1059
|
* providing a way of rendering to these APIs outside of the React render loop
|
|
1057
1060
|
* for more performant animations and interactions
|
|
1058
1061
|
*/
|
|
1059
|
-
context.visualElement = useVisualElement(Component, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode);
|
|
1062
|
+
context.visualElement = useVisualElement(Component, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode, isSVG);
|
|
1060
1063
|
}
|
|
1061
1064
|
/**
|
|
1062
1065
|
* The mount order and hierarchy is specific to ensure our element ref
|
|
1063
1066
|
* is hydrated by the time features fire their effects.
|
|
1064
1067
|
*/
|
|
1065
|
-
return (jsxRuntime.jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout && context.visualElement ? (jsxRuntime.jsx(MeasureLayout, { visualElement: context.visualElement, ...configAndProps })) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, forwardMotionProps)] }));
|
|
1068
|
+
return (jsxRuntime.jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout && context.visualElement ? (jsxRuntime.jsx(MeasureLayout, { visualElement: context.visualElement, ...configAndProps })) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, forwardMotionProps, isSVG)] }));
|
|
1066
1069
|
}
|
|
1067
1070
|
MotionDOMComponent.displayName = `motion.${typeof Component === "string"
|
|
1068
1071
|
? Component
|