framer-motion 11.16.0 → 11.16.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/cjs/client.js +72 -68
- package/dist/cjs/dom.js +2 -2
- package/dist/cjs/index.js +72 -68
- package/dist/cjs/m.js +140 -136
- package/dist/client.d.ts +67 -67
- package/dist/dom.js +1 -1
- package/dist/es/motion/index.mjs +11 -7
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +104 -99
- package/dist/framer-motion.js +1 -1
- package/dist/m.d.ts +67 -67
- package/package.json +3 -3
package/dist/cjs/client.js
CHANGED
|
@@ -399,7 +399,7 @@ class MotionValue {
|
|
|
399
399
|
* This will be replaced by the build step with the latest version number.
|
|
400
400
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
401
401
|
*/
|
|
402
|
-
this.version = "11.16.
|
|
402
|
+
this.version = "11.16.1";
|
|
403
403
|
/**
|
|
404
404
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
405
405
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -5206,7 +5206,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
5206
5206
|
* and warn against mismatches.
|
|
5207
5207
|
*/
|
|
5208
5208
|
if (process.env.NODE_ENV === "development") {
|
|
5209
|
-
warnOnce(nextValue.version === "11.16.
|
|
5209
|
+
warnOnce(nextValue.version === "11.16.1", `Attempting to mix Motion versions ${nextValue.version} with 11.16.1 may not work as expected.`);
|
|
5210
5210
|
}
|
|
5211
5211
|
}
|
|
5212
5212
|
else if (isMotionValue(prevValue)) {
|
|
@@ -8576,6 +8576,8 @@ const layout = {
|
|
|
8576
8576
|
},
|
|
8577
8577
|
};
|
|
8578
8578
|
|
|
8579
|
+
const LazyContext = react.createContext({ strict: false });
|
|
8580
|
+
|
|
8579
8581
|
/**
|
|
8580
8582
|
* @public
|
|
8581
8583
|
*/
|
|
@@ -8587,9 +8589,71 @@ const MotionConfigContext = react.createContext({
|
|
|
8587
8589
|
|
|
8588
8590
|
const MotionContext = react.createContext({});
|
|
8589
8591
|
|
|
8590
|
-
|
|
8592
|
+
function getCurrentTreeVariants(props, context) {
|
|
8593
|
+
if (isControllingVariants(props)) {
|
|
8594
|
+
const { initial, animate } = props;
|
|
8595
|
+
return {
|
|
8596
|
+
initial: initial === false || isVariantLabel(initial)
|
|
8597
|
+
? initial
|
|
8598
|
+
: undefined,
|
|
8599
|
+
animate: isVariantLabel(animate) ? animate : undefined,
|
|
8600
|
+
};
|
|
8601
|
+
}
|
|
8602
|
+
return props.inherit !== false ? context : {};
|
|
8603
|
+
}
|
|
8591
8604
|
|
|
8592
|
-
|
|
8605
|
+
function useCreateMotionContext(props) {
|
|
8606
|
+
const { initial, animate } = getCurrentTreeVariants(props, react.useContext(MotionContext));
|
|
8607
|
+
return react.useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
|
|
8608
|
+
}
|
|
8609
|
+
function variantLabelsAsDependency(prop) {
|
|
8610
|
+
return Array.isArray(prop) ? prop.join(" ") : prop;
|
|
8611
|
+
}
|
|
8612
|
+
|
|
8613
|
+
function loadFeatures(features) {
|
|
8614
|
+
for (const key in features) {
|
|
8615
|
+
featureDefinitions[key] = {
|
|
8616
|
+
...featureDefinitions[key],
|
|
8617
|
+
...features[key],
|
|
8618
|
+
};
|
|
8619
|
+
}
|
|
8620
|
+
}
|
|
8621
|
+
|
|
8622
|
+
const motionComponentSymbol = Symbol.for("motionComponentSymbol");
|
|
8623
|
+
|
|
8624
|
+
/**
|
|
8625
|
+
* Creates a ref function that, when called, hydrates the provided
|
|
8626
|
+
* external ref and VisualElement.
|
|
8627
|
+
*/
|
|
8628
|
+
function useMotionRef(visualState, visualElement, externalRef) {
|
|
8629
|
+
return react.useCallback((instance) => {
|
|
8630
|
+
instance && visualState.mount && visualState.mount(instance);
|
|
8631
|
+
if (visualElement) {
|
|
8632
|
+
if (instance) {
|
|
8633
|
+
visualElement.mount(instance);
|
|
8634
|
+
}
|
|
8635
|
+
else {
|
|
8636
|
+
visualElement.unmount();
|
|
8637
|
+
}
|
|
8638
|
+
}
|
|
8639
|
+
if (externalRef) {
|
|
8640
|
+
if (typeof externalRef === "function") {
|
|
8641
|
+
externalRef(instance);
|
|
8642
|
+
}
|
|
8643
|
+
else if (isRefObject(externalRef)) {
|
|
8644
|
+
externalRef.current = instance;
|
|
8645
|
+
}
|
|
8646
|
+
}
|
|
8647
|
+
},
|
|
8648
|
+
/**
|
|
8649
|
+
* Only pass a new ref callback to React if we've received a visual element
|
|
8650
|
+
* factory. Otherwise we'll be mounting/remounting every time externalRef
|
|
8651
|
+
* or other dependencies change.
|
|
8652
|
+
*/
|
|
8653
|
+
[visualElement]);
|
|
8654
|
+
}
|
|
8655
|
+
|
|
8656
|
+
const useIsomorphicLayoutEffect = isBrowser ? react.useLayoutEffect : react.useEffect;
|
|
8593
8657
|
|
|
8594
8658
|
function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) {
|
|
8595
8659
|
var _a, _b;
|
|
@@ -8713,70 +8777,6 @@ function getClosestProjectingNode(visualElement) {
|
|
|
8713
8777
|
: getClosestProjectingNode(visualElement.parent);
|
|
8714
8778
|
}
|
|
8715
8779
|
|
|
8716
|
-
/**
|
|
8717
|
-
* Creates a ref function that, when called, hydrates the provided
|
|
8718
|
-
* external ref and VisualElement.
|
|
8719
|
-
*/
|
|
8720
|
-
function useMotionRef(visualState, visualElement, externalRef) {
|
|
8721
|
-
return react.useCallback((instance) => {
|
|
8722
|
-
instance && visualState.mount && visualState.mount(instance);
|
|
8723
|
-
if (visualElement) {
|
|
8724
|
-
if (instance) {
|
|
8725
|
-
visualElement.mount(instance);
|
|
8726
|
-
}
|
|
8727
|
-
else {
|
|
8728
|
-
visualElement.unmount();
|
|
8729
|
-
}
|
|
8730
|
-
}
|
|
8731
|
-
if (externalRef) {
|
|
8732
|
-
if (typeof externalRef === "function") {
|
|
8733
|
-
externalRef(instance);
|
|
8734
|
-
}
|
|
8735
|
-
else if (isRefObject(externalRef)) {
|
|
8736
|
-
externalRef.current = instance;
|
|
8737
|
-
}
|
|
8738
|
-
}
|
|
8739
|
-
},
|
|
8740
|
-
/**
|
|
8741
|
-
* Only pass a new ref callback to React if we've received a visual element
|
|
8742
|
-
* factory. Otherwise we'll be mounting/remounting every time externalRef
|
|
8743
|
-
* or other dependencies change.
|
|
8744
|
-
*/
|
|
8745
|
-
[visualElement]);
|
|
8746
|
-
}
|
|
8747
|
-
|
|
8748
|
-
function getCurrentTreeVariants(props, context) {
|
|
8749
|
-
if (isControllingVariants(props)) {
|
|
8750
|
-
const { initial, animate } = props;
|
|
8751
|
-
return {
|
|
8752
|
-
initial: initial === false || isVariantLabel(initial)
|
|
8753
|
-
? initial
|
|
8754
|
-
: undefined,
|
|
8755
|
-
animate: isVariantLabel(animate) ? animate : undefined,
|
|
8756
|
-
};
|
|
8757
|
-
}
|
|
8758
|
-
return props.inherit !== false ? context : {};
|
|
8759
|
-
}
|
|
8760
|
-
|
|
8761
|
-
function useCreateMotionContext(props) {
|
|
8762
|
-
const { initial, animate } = getCurrentTreeVariants(props, react.useContext(MotionContext));
|
|
8763
|
-
return react.useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
|
|
8764
|
-
}
|
|
8765
|
-
function variantLabelsAsDependency(prop) {
|
|
8766
|
-
return Array.isArray(prop) ? prop.join(" ") : prop;
|
|
8767
|
-
}
|
|
8768
|
-
|
|
8769
|
-
function loadFeatures(features) {
|
|
8770
|
-
for (const key in features) {
|
|
8771
|
-
featureDefinitions[key] = {
|
|
8772
|
-
...featureDefinitions[key],
|
|
8773
|
-
...features[key],
|
|
8774
|
-
};
|
|
8775
|
-
}
|
|
8776
|
-
}
|
|
8777
|
-
|
|
8778
|
-
const motionComponentSymbol = Symbol.for("motionComponentSymbol");
|
|
8779
|
-
|
|
8780
8780
|
/**
|
|
8781
8781
|
* Create a `motion` component.
|
|
8782
8782
|
*
|
|
@@ -8787,6 +8787,7 @@ const motionComponentSymbol = Symbol.for("motionComponentSymbol");
|
|
|
8787
8787
|
* component "offline", or outside the React render cycle.
|
|
8788
8788
|
*/
|
|
8789
8789
|
function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }) {
|
|
8790
|
+
var _a, _b;
|
|
8790
8791
|
preloadedFeatures && loadFeatures(preloadedFeatures);
|
|
8791
8792
|
function MotionComponent(props, externalRef) {
|
|
8792
8793
|
/**
|
|
@@ -8820,6 +8821,9 @@ function createRendererMotionComponent({ preloadedFeatures, createVisualElement,
|
|
|
8820
8821
|
*/
|
|
8821
8822
|
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, context.visualElement)] }));
|
|
8822
8823
|
}
|
|
8824
|
+
MotionComponent.displayName = `motion.${typeof Component === "string"
|
|
8825
|
+
? Component
|
|
8826
|
+
: `create(${(_b = (_a = Component.displayName) !== null && _a !== void 0 ? _a : Component.name) !== null && _b !== void 0 ? _b : ""})`}`;
|
|
8823
8827
|
const ForwardRefMotionComponent = react.forwardRef(MotionComponent);
|
|
8824
8828
|
ForwardRefMotionComponent[motionComponentSymbol] = Component;
|
|
8825
8829
|
return ForwardRefMotionComponent;
|
package/dist/cjs/dom.js
CHANGED
|
@@ -984,7 +984,7 @@ class MotionValue {
|
|
|
984
984
|
* This will be replaced by the build step with the latest version number.
|
|
985
985
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
986
986
|
*/
|
|
987
|
-
this.version = "11.16.
|
|
987
|
+
this.version = "11.16.1";
|
|
988
988
|
/**
|
|
989
989
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
990
990
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -3920,7 +3920,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
3920
3920
|
* and warn against mismatches.
|
|
3921
3921
|
*/
|
|
3922
3922
|
if (process.env.NODE_ENV === "development") {
|
|
3923
|
-
warnOnce(nextValue.version === "11.16.
|
|
3923
|
+
warnOnce(nextValue.version === "11.16.1", `Attempting to mix Motion versions ${nextValue.version} with 11.16.1 may not work as expected.`);
|
|
3924
3924
|
}
|
|
3925
3925
|
}
|
|
3926
3926
|
else if (isMotionValue(prevValue)) {
|
package/dist/cjs/index.js
CHANGED
|
@@ -468,7 +468,7 @@ class MotionValue {
|
|
|
468
468
|
* This will be replaced by the build step with the latest version number.
|
|
469
469
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
470
470
|
*/
|
|
471
|
-
this.version = "11.16.
|
|
471
|
+
this.version = "11.16.1";
|
|
472
472
|
/**
|
|
473
473
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
474
474
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -5634,7 +5634,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
5634
5634
|
* and warn against mismatches.
|
|
5635
5635
|
*/
|
|
5636
5636
|
if (process.env.NODE_ENV === "development") {
|
|
5637
|
-
warnOnce(nextValue.version === "11.16.
|
|
5637
|
+
warnOnce(nextValue.version === "11.16.1", `Attempting to mix Motion versions ${nextValue.version} with 11.16.1 may not work as expected.`);
|
|
5638
5638
|
}
|
|
5639
5639
|
}
|
|
5640
5640
|
else if (isMotionValue(prevValue)) {
|
|
@@ -10023,6 +10023,8 @@ const layout = {
|
|
|
10023
10023
|
},
|
|
10024
10024
|
};
|
|
10025
10025
|
|
|
10026
|
+
const LazyContext = React.createContext({ strict: false });
|
|
10027
|
+
|
|
10026
10028
|
/**
|
|
10027
10029
|
* @public
|
|
10028
10030
|
*/
|
|
@@ -10034,9 +10036,71 @@ const MotionConfigContext = React.createContext({
|
|
|
10034
10036
|
|
|
10035
10037
|
const MotionContext = React.createContext({});
|
|
10036
10038
|
|
|
10037
|
-
|
|
10039
|
+
function getCurrentTreeVariants(props, context) {
|
|
10040
|
+
if (isControllingVariants(props)) {
|
|
10041
|
+
const { initial, animate } = props;
|
|
10042
|
+
return {
|
|
10043
|
+
initial: initial === false || isVariantLabel(initial)
|
|
10044
|
+
? initial
|
|
10045
|
+
: undefined,
|
|
10046
|
+
animate: isVariantLabel(animate) ? animate : undefined,
|
|
10047
|
+
};
|
|
10048
|
+
}
|
|
10049
|
+
return props.inherit !== false ? context : {};
|
|
10050
|
+
}
|
|
10038
10051
|
|
|
10039
|
-
|
|
10052
|
+
function useCreateMotionContext(props) {
|
|
10053
|
+
const { initial, animate } = getCurrentTreeVariants(props, React.useContext(MotionContext));
|
|
10054
|
+
return React.useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
|
|
10055
|
+
}
|
|
10056
|
+
function variantLabelsAsDependency(prop) {
|
|
10057
|
+
return Array.isArray(prop) ? prop.join(" ") : prop;
|
|
10058
|
+
}
|
|
10059
|
+
|
|
10060
|
+
function loadFeatures(features) {
|
|
10061
|
+
for (const key in features) {
|
|
10062
|
+
featureDefinitions[key] = {
|
|
10063
|
+
...featureDefinitions[key],
|
|
10064
|
+
...features[key],
|
|
10065
|
+
};
|
|
10066
|
+
}
|
|
10067
|
+
}
|
|
10068
|
+
|
|
10069
|
+
const motionComponentSymbol = Symbol.for("motionComponentSymbol");
|
|
10070
|
+
|
|
10071
|
+
/**
|
|
10072
|
+
* Creates a ref function that, when called, hydrates the provided
|
|
10073
|
+
* external ref and VisualElement.
|
|
10074
|
+
*/
|
|
10075
|
+
function useMotionRef(visualState, visualElement, externalRef) {
|
|
10076
|
+
return React.useCallback((instance) => {
|
|
10077
|
+
instance && visualState.mount && visualState.mount(instance);
|
|
10078
|
+
if (visualElement) {
|
|
10079
|
+
if (instance) {
|
|
10080
|
+
visualElement.mount(instance);
|
|
10081
|
+
}
|
|
10082
|
+
else {
|
|
10083
|
+
visualElement.unmount();
|
|
10084
|
+
}
|
|
10085
|
+
}
|
|
10086
|
+
if (externalRef) {
|
|
10087
|
+
if (typeof externalRef === "function") {
|
|
10088
|
+
externalRef(instance);
|
|
10089
|
+
}
|
|
10090
|
+
else if (isRefObject(externalRef)) {
|
|
10091
|
+
externalRef.current = instance;
|
|
10092
|
+
}
|
|
10093
|
+
}
|
|
10094
|
+
},
|
|
10095
|
+
/**
|
|
10096
|
+
* Only pass a new ref callback to React if we've received a visual element
|
|
10097
|
+
* factory. Otherwise we'll be mounting/remounting every time externalRef
|
|
10098
|
+
* or other dependencies change.
|
|
10099
|
+
*/
|
|
10100
|
+
[visualElement]);
|
|
10101
|
+
}
|
|
10102
|
+
|
|
10103
|
+
const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
|
|
10040
10104
|
|
|
10041
10105
|
function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) {
|
|
10042
10106
|
var _a, _b;
|
|
@@ -10160,70 +10224,6 @@ function getClosestProjectingNode(visualElement) {
|
|
|
10160
10224
|
: getClosestProjectingNode(visualElement.parent);
|
|
10161
10225
|
}
|
|
10162
10226
|
|
|
10163
|
-
/**
|
|
10164
|
-
* Creates a ref function that, when called, hydrates the provided
|
|
10165
|
-
* external ref and VisualElement.
|
|
10166
|
-
*/
|
|
10167
|
-
function useMotionRef(visualState, visualElement, externalRef) {
|
|
10168
|
-
return React.useCallback((instance) => {
|
|
10169
|
-
instance && visualState.mount && visualState.mount(instance);
|
|
10170
|
-
if (visualElement) {
|
|
10171
|
-
if (instance) {
|
|
10172
|
-
visualElement.mount(instance);
|
|
10173
|
-
}
|
|
10174
|
-
else {
|
|
10175
|
-
visualElement.unmount();
|
|
10176
|
-
}
|
|
10177
|
-
}
|
|
10178
|
-
if (externalRef) {
|
|
10179
|
-
if (typeof externalRef === "function") {
|
|
10180
|
-
externalRef(instance);
|
|
10181
|
-
}
|
|
10182
|
-
else if (isRefObject(externalRef)) {
|
|
10183
|
-
externalRef.current = instance;
|
|
10184
|
-
}
|
|
10185
|
-
}
|
|
10186
|
-
},
|
|
10187
|
-
/**
|
|
10188
|
-
* Only pass a new ref callback to React if we've received a visual element
|
|
10189
|
-
* factory. Otherwise we'll be mounting/remounting every time externalRef
|
|
10190
|
-
* or other dependencies change.
|
|
10191
|
-
*/
|
|
10192
|
-
[visualElement]);
|
|
10193
|
-
}
|
|
10194
|
-
|
|
10195
|
-
function getCurrentTreeVariants(props, context) {
|
|
10196
|
-
if (isControllingVariants(props)) {
|
|
10197
|
-
const { initial, animate } = props;
|
|
10198
|
-
return {
|
|
10199
|
-
initial: initial === false || isVariantLabel(initial)
|
|
10200
|
-
? initial
|
|
10201
|
-
: undefined,
|
|
10202
|
-
animate: isVariantLabel(animate) ? animate : undefined,
|
|
10203
|
-
};
|
|
10204
|
-
}
|
|
10205
|
-
return props.inherit !== false ? context : {};
|
|
10206
|
-
}
|
|
10207
|
-
|
|
10208
|
-
function useCreateMotionContext(props) {
|
|
10209
|
-
const { initial, animate } = getCurrentTreeVariants(props, React.useContext(MotionContext));
|
|
10210
|
-
return React.useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
|
|
10211
|
-
}
|
|
10212
|
-
function variantLabelsAsDependency(prop) {
|
|
10213
|
-
return Array.isArray(prop) ? prop.join(" ") : prop;
|
|
10214
|
-
}
|
|
10215
|
-
|
|
10216
|
-
function loadFeatures(features) {
|
|
10217
|
-
for (const key in features) {
|
|
10218
|
-
featureDefinitions[key] = {
|
|
10219
|
-
...featureDefinitions[key],
|
|
10220
|
-
...features[key],
|
|
10221
|
-
};
|
|
10222
|
-
}
|
|
10223
|
-
}
|
|
10224
|
-
|
|
10225
|
-
const motionComponentSymbol = Symbol.for("motionComponentSymbol");
|
|
10226
|
-
|
|
10227
10227
|
/**
|
|
10228
10228
|
* Create a `motion` component.
|
|
10229
10229
|
*
|
|
@@ -10234,6 +10234,7 @@ const motionComponentSymbol = Symbol.for("motionComponentSymbol");
|
|
|
10234
10234
|
* component "offline", or outside the React render cycle.
|
|
10235
10235
|
*/
|
|
10236
10236
|
function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }) {
|
|
10237
|
+
var _a, _b;
|
|
10237
10238
|
preloadedFeatures && loadFeatures(preloadedFeatures);
|
|
10238
10239
|
function MotionComponent(props, externalRef) {
|
|
10239
10240
|
/**
|
|
@@ -10267,6 +10268,9 @@ function createRendererMotionComponent({ preloadedFeatures, createVisualElement,
|
|
|
10267
10268
|
*/
|
|
10268
10269
|
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, context.visualElement)] }));
|
|
10269
10270
|
}
|
|
10271
|
+
MotionComponent.displayName = `motion.${typeof Component === "string"
|
|
10272
|
+
? Component
|
|
10273
|
+
: `create(${(_b = (_a = Component.displayName) !== null && _a !== void 0 ? _a : Component.name) !== null && _b !== void 0 ? _b : ""})`}`;
|
|
10270
10274
|
const ForwardRefMotionComponent = React.forwardRef(MotionComponent);
|
|
10271
10275
|
ForwardRefMotionComponent[motionComponentSymbol] = Component;
|
|
10272
10276
|
return ForwardRefMotionComponent;
|