framer-motion 12.23.12 → 13.0.0-alpha.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.
Files changed (54) hide show
  1. package/dist/cjs/client.js +1 -2
  2. package/dist/cjs/{feature-bundle-PNQ-8QDo.js → feature-bundle-C8gfmTBU.js} +0 -1
  3. package/dist/cjs/index.js +1 -2
  4. package/dist/es/animation/hooks/use-animate-style.mjs +1 -0
  5. package/dist/es/animation/hooks/use-animate.mjs +1 -0
  6. package/dist/es/animation/hooks/use-animated-state.mjs +1 -0
  7. package/dist/es/animation/hooks/use-animation.mjs +1 -0
  8. package/dist/es/client.mjs +0 -2
  9. package/dist/es/components/AnimatePresence/use-presence-data.mjs +1 -0
  10. package/dist/es/components/AnimatePresence/use-presence.mjs +1 -0
  11. package/dist/es/components/AnimateSharedLayout.mjs +1 -0
  12. package/dist/es/context/DeprecatedLayoutGroupContext.mjs +1 -0
  13. package/dist/es/context/MotionContext/create.mjs +1 -0
  14. package/dist/es/events/use-dom-event.mjs +1 -0
  15. package/dist/es/index.mjs +0 -2
  16. package/dist/es/m.mjs +0 -1
  17. package/dist/es/motion/utils/use-motion-ref.mjs +1 -0
  18. package/dist/es/motion/utils/use-visual-element.mjs +1 -0
  19. package/dist/es/motion/utils/use-visual-state.mjs +1 -0
  20. package/dist/es/render/dom/use-render.mjs +1 -0
  21. package/dist/es/render/html/use-html-visual-state.mjs +1 -0
  22. package/dist/es/render/html/use-props.mjs +1 -0
  23. package/dist/es/render/svg/use-props.mjs +1 -0
  24. package/dist/es/render/svg/use-svg-visual-state.mjs +1 -0
  25. package/dist/es/utils/reduced-motion/use-reduced-motion-config.mjs +1 -0
  26. package/dist/es/utils/reduced-motion/use-reduced-motion.mjs +1 -0
  27. package/dist/es/utils/use-animation-frame.mjs +1 -0
  28. package/dist/es/utils/use-constant.mjs +1 -0
  29. package/dist/es/utils/use-cycle.mjs +1 -0
  30. package/dist/es/utils/use-force-update.mjs +1 -0
  31. package/dist/es/utils/use-in-view.mjs +1 -0
  32. package/dist/es/utils/use-instant-transition.mjs +1 -0
  33. package/dist/es/utils/use-is-mounted.mjs +1 -0
  34. package/dist/es/utils/use-isomorphic-effect.mjs +1 -0
  35. package/dist/es/utils/use-motion-value-event.mjs +1 -0
  36. package/dist/es/utils/use-page-in-view.mjs +1 -0
  37. package/dist/es/utils/use-unmount-effect.mjs +1 -0
  38. package/dist/es/value/use-combine-values.mjs +1 -0
  39. package/dist/es/value/use-computed.mjs +1 -0
  40. package/dist/es/value/use-inverted-scale.mjs +1 -0
  41. package/dist/es/value/use-motion-template.mjs +1 -0
  42. package/dist/es/value/use-motion-value.mjs +1 -0
  43. package/dist/es/value/use-scroll.mjs +1 -0
  44. package/dist/es/value/use-spring.mjs +1 -0
  45. package/dist/es/value/use-time.mjs +1 -0
  46. package/dist/es/value/use-transform.mjs +1 -0
  47. package/dist/es/value/use-velocity.mjs +1 -0
  48. package/dist/es/value/use-will-change/index.mjs +1 -0
  49. package/dist/framer-motion.dev.js +0 -1
  50. package/dist/framer-motion.js +1 -1
  51. package/dist/types/client.d.ts +2 -4
  52. package/dist/types/index.d.ts +78 -3
  53. package/dist/{types.d-Cjd591yU.d.ts → types.d-C7Th3txw.d.ts} +3 -79
  54. package/package.json +2 -2
@@ -1,9 +1,7 @@
1
- import { p as ForwardRefComponent, H as HTMLMotionProps, r as SVGMotionProps } from '../types.d-Cjd591yU.js';
2
- export { c as create } from '../types.d-Cjd591yU.js';
3
- import 'react';
1
+ import { F as ForwardRefComponent, H as HTMLMotionProps, n as SVGMotionProps } from '../types.d-C7Th3txw.js';
4
2
  import 'motion-dom';
5
3
  import 'motion-utils';
6
- import 'react/jsx-runtime';
4
+ import 'react';
7
5
 
8
6
  /**
9
7
  * HTML components
@@ -5,8 +5,8 @@ export * from 'motion-dom';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import * as React$1 from 'react';
7
7
  import { useEffect, RefObject } from 'react';
8
- import { F as FeatureBundle, M as MotionProps, a as MotionConfigContext, H as HTMLMotionProps, b as HTMLElements, c as createMotionComponent, d as HTMLMotionComponents, S as SVGMotionComponents, e as FeaturePackages, V as VisualElement, f as VisualElementAnimationOptions, I as IProjectionNode, R as ResolvedValues, g as HTMLRenderState } from '../types.d-Cjd591yU.js';
9
- export { A as AnimationType, C as CreateVisualElement, D as DOMMotionComponents, v as FeatureDefinition, w as FeatureDefinitions, x as FeaturePackage, s as FlatTree, p as ForwardRefComponent, t as HydratedFeatureDefinition, u as HydratedFeatureDefinitions, L as LazyFeatureBundle, k as MotionStyle, l as MotionTransform, P as PresenceContext, q as SVGAttributesAsMotionValues, r as SVGMotionProps, h as ScrapeMotionValuesFromProps, j as SwitchLayoutGroupContext, n as VariantLabels, i as VisualState, m as makeUseVisualState, o as optimizedAppearDataAttribute } from '../types.d-Cjd591yU.js';
8
+ import { V as VisualElement, M as MotionProps, C as CreateVisualElement, a as MotionConfigContext, H as HTMLMotionProps, b as HTMLElements, D as DOMMotionComponents, c as HTMLMotionComponents, S as SVGMotionComponents, d as VisualElementAnimationOptions, I as IProjectionNode, R as ResolvedValues, e as HTMLRenderState } from '../types.d-C7Th3txw.js';
9
+ export { A as AnimationType, p as FlatTree, F as ForwardRefComponent, i as MotionStyle, j as MotionTransform, P as PresenceContext, l as SVGAttributesAsMotionValues, n as SVGMotionProps, f as ScrapeMotionValuesFromProps, h as SwitchLayoutGroupContext, k as VariantLabels, g as VisualState, m as makeUseVisualState, o as optimizedAppearDataAttribute } from '../types.d-C7Th3txw.js';
10
10
  import { Easing, EasingFunction, Point, Axis, Box } from 'motion-utils';
11
11
  export * from 'motion-utils';
12
12
  export { MotionGlobalConfig } from 'motion-utils';
@@ -127,6 +127,61 @@ interface Props$2 {
127
127
  }
128
128
  declare const LayoutGroup: React$1.FunctionComponent<React$1.PropsWithChildren<Props$2>>;
129
129
 
130
+ declare abstract class Feature<T extends any = any> {
131
+ isMounted: boolean;
132
+ node: VisualElement<T>;
133
+ constructor(node: VisualElement<T>);
134
+ abstract mount(): void;
135
+ abstract unmount(): void;
136
+ update(): void;
137
+ }
138
+
139
+ declare function MeasureLayout(props: MotionProps & {
140
+ visualElement: VisualElement;
141
+ }): react_jsx_runtime.JSX.Element;
142
+
143
+ interface FeatureClass<Props = unknown> {
144
+ new (props: Props): Feature<Props>;
145
+ }
146
+ interface HydratedFeatureDefinition {
147
+ isEnabled: (props: MotionProps) => boolean;
148
+ Feature: FeatureClass<unknown>;
149
+ ProjectionNode?: any;
150
+ MeasureLayout?: typeof MeasureLayout;
151
+ }
152
+ interface HydratedFeatureDefinitions {
153
+ animation?: HydratedFeatureDefinition;
154
+ exit?: HydratedFeatureDefinition;
155
+ drag?: HydratedFeatureDefinition;
156
+ tap?: HydratedFeatureDefinition;
157
+ focus?: HydratedFeatureDefinition;
158
+ hover?: HydratedFeatureDefinition;
159
+ pan?: HydratedFeatureDefinition;
160
+ inView?: HydratedFeatureDefinition;
161
+ layout?: HydratedFeatureDefinition;
162
+ }
163
+ interface FeatureDefinition {
164
+ isEnabled: HydratedFeatureDefinition["isEnabled"];
165
+ Feature?: HydratedFeatureDefinition["Feature"];
166
+ ProjectionNode?: HydratedFeatureDefinition["ProjectionNode"];
167
+ MeasureLayout?: HydratedFeatureDefinition["MeasureLayout"];
168
+ }
169
+ type FeatureDefinitions = {
170
+ [K in keyof HydratedFeatureDefinitions]: FeatureDefinition;
171
+ };
172
+ interface FeaturePackage {
173
+ Feature?: HydratedFeatureDefinition["Feature"];
174
+ ProjectionNode?: HydratedFeatureDefinition["ProjectionNode"];
175
+ MeasureLayout?: HydratedFeatureDefinition["MeasureLayout"];
176
+ }
177
+ type FeaturePackages = {
178
+ [K in keyof HydratedFeatureDefinitions]: FeaturePackage;
179
+ };
180
+ interface FeatureBundle extends FeaturePackages {
181
+ renderer: CreateVisualElement;
182
+ }
183
+ type LazyFeatureBundle$1 = () => Promise<FeatureBundle>;
184
+
130
185
  type LazyFeatureBundle = () => Promise<FeatureBundle>;
131
186
  /**
132
187
  * @public
@@ -468,6 +523,26 @@ declare function delay(callback: DelayedFunction, timeout: number): () => void;
468
523
  declare const distance: (a: number, b: number) => number;
469
524
  declare function distance2D(a: Point, b: Point): number;
470
525
 
526
+ type MotionComponentProps<Props> = {
527
+ [K in Exclude<keyof Props, keyof MotionProps>]?: Props[K];
528
+ } & MotionProps;
529
+ type MotionComponent<T, P> = T extends keyof DOMMotionComponents ? DOMMotionComponents[T] : React$1.ComponentType<Omit<MotionComponentProps<P>, "children"> & {
530
+ children?: "children" extends keyof P ? P["children"] | MotionComponentProps<P>["children"] : MotionComponentProps<P>["children"];
531
+ }>;
532
+ interface MotionComponentOptions {
533
+ forwardMotionProps?: boolean;
534
+ }
535
+ /**
536
+ * Create a `motion` component.
537
+ *
538
+ * This function accepts a Component argument, which can be either a string (ie "div"
539
+ * for `motion.div`), or an actual React component.
540
+ *
541
+ * Alongside this is a config option which provides a way of rendering the provided
542
+ * component "offline", or outside the React render cycle.
543
+ */
544
+ declare function createMotionComponent<Props, TagName extends keyof DOMMotionComponents | string = "div">(Component: TagName | string | React$1.ComponentType<Props>, { forwardMotionProps }?: MotionComponentOptions, preloadedFeatures?: FeaturePackages, createVisualElement?: CreateVisualElement<Props, TagName>): MotionComponent<TagName, Props>;
545
+
471
546
  declare const m: typeof createMotionComponent & HTMLMotionComponents & SVGMotionComponents & {
472
547
  create: typeof createMotionComponent;
473
548
  };
@@ -1160,4 +1235,4 @@ interface ScaleMotionValues {
1160
1235
  */
1161
1236
  declare function useInvertedScale(scale?: Partial<ScaleMotionValues>): ScaleMotionValues;
1162
1237
 
1163
- export { type AbsoluteKeyframe, AnimatePresence, type AnimatePresenceProps, AnimateSharedLayout, type AnimationSequence, type At, type Cycle, type CycleState, type DOMSegment, type DOMSegmentWithTransition, type DelayedFunction, DeprecatedLayoutGroupContext, DragControls, FeatureBundle, FeaturePackages, HTMLMotionProps, IProjectionNode, LayoutGroup, LayoutGroupContext, LazyMotion, type LazyProps, MotionConfig, MotionConfigContext, type MotionConfigProps, MotionContext, MotionProps, type MotionValueSegment, type MotionValueSegmentWithTransition, type ObjectSegment, type ObjectSegmentWithTransition, type ObjectTarget, namespace_d as Reorder, type ResolveKeyframes, type ResolvedAnimationDefinition, type ResolvedAnimationDefinitions, ResolvedValues, type ScrollMotionValues, type Segment, type SequenceLabel, type SequenceLabelWithTime, type SequenceMap, type SequenceOptions, type SequenceTime, type UseInViewOptions, type UseScrollOptions, type ValueSequence, VisualElement, WillChangeMotionValue, addPointerEvent, addPointerInfo, addScaleCorrector, animate, animateMini, animateVisualElement, animationControls, animations, buildTransform, calcLength, createBox, createScopedAnimate, delay, disableInstantTransitions, distance, distance2D, domAnimation, domMax, domMin, filterProps, inView, isBrowser, isMotionComponent, isValidMotionProp, m, motion, resolveMotionValue, scroll, scrollInfo, startOptimizedAppearAnimation, unwrapMotionComponent, useAnimate, useAnimateMini, useAnimation, useAnimationControls, useAnimationFrame, useCycle, useAnimatedState as useDeprecatedAnimatedState, useInvertedScale as useDeprecatedInvertedScale, useDomEvent, useDragControls, useElementScroll, useForceUpdate, useInView, useInstantLayoutTransition, useInstantTransition, useIsPresent, useIsomorphicLayoutEffect, useMotionTemplate, useMotionValue, useMotionValueEvent, usePageInView, usePresence, usePresenceData, useReducedMotion, useReducedMotionConfig, useResetProjection, useScroll, useSpring, useTime, useTransform, useUnmountEffect, useVelocity, useViewportScroll, useWillChange, visualElementStore };
1238
+ export { type AbsoluteKeyframe, AnimatePresence, type AnimatePresenceProps, AnimateSharedLayout, type AnimationSequence, type At, CreateVisualElement, type Cycle, type CycleState, DOMMotionComponents, type DOMSegment, type DOMSegmentWithTransition, type DelayedFunction, DeprecatedLayoutGroupContext, DragControls, type FeatureBundle, type FeatureDefinition, type FeatureDefinitions, type FeaturePackage, type FeaturePackages, HTMLMotionProps, type HydratedFeatureDefinition, type HydratedFeatureDefinitions, IProjectionNode, LayoutGroup, LayoutGroupContext, type LazyFeatureBundle$1 as LazyFeatureBundle, LazyMotion, type LazyProps, MotionConfig, MotionConfigContext, type MotionConfigProps, MotionContext, MotionProps, type MotionValueSegment, type MotionValueSegmentWithTransition, type ObjectSegment, type ObjectSegmentWithTransition, type ObjectTarget, namespace_d as Reorder, type ResolveKeyframes, type ResolvedAnimationDefinition, type ResolvedAnimationDefinitions, ResolvedValues, type ScrollMotionValues, type Segment, type SequenceLabel, type SequenceLabelWithTime, type SequenceMap, type SequenceOptions, type SequenceTime, type UseInViewOptions, type UseScrollOptions, type ValueSequence, VisualElement, WillChangeMotionValue, addPointerEvent, addPointerInfo, addScaleCorrector, animate, animateMini, animateVisualElement, animationControls, animations, buildTransform, calcLength, createBox, createScopedAnimate, delay, disableInstantTransitions, distance, distance2D, domAnimation, domMax, domMin, filterProps, inView, isBrowser, isMotionComponent, isValidMotionProp, m, motion, resolveMotionValue, scroll, scrollInfo, startOptimizedAppearAnimation, unwrapMotionComponent, useAnimate, useAnimateMini, useAnimation, useAnimationControls, useAnimationFrame, useCycle, useAnimatedState as useDeprecatedAnimatedState, useInvertedScale as useDeprecatedInvertedScale, useDomEvent, useDragControls, useElementScroll, useForceUpdate, useInView, useInstantLayoutTransition, useInstantTransition, useIsPresent, useIsomorphicLayoutEffect, useMotionTemplate, useMotionValue, useMotionValueEvent, usePageInView, usePresence, usePresenceData, useReducedMotion, useReducedMotionConfig, useResetProjection, useScroll, useSpring, useTime, useTransform, useUnmountEffect, useVelocity, useViewportScroll, useWillChange, visualElementStore };
@@ -1,10 +1,9 @@
1
1
  /// <reference types="react" />
2
- import * as React$1 from 'react';
3
- import { CSSProperties, PropsWithoutRef, RefAttributes, JSX, SVGAttributes } from 'react';
4
2
  import * as motion_dom from 'motion-dom';
5
3
  import { Transition, TransformProperties, MotionNodeOptions, MotionValue, SVGPathProperties, JSAnimation, ValueTransition, TargetAndTransition, AnyResolvedKeyframe, KeyframeResolver, AnimationDefinition, Batcher } from 'motion-dom';
6
4
  import { TransformPoint, Box, Delta, Point, Axis } from 'motion-utils';
7
- import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import * as React$1 from 'react';
6
+ import { CSSProperties, PropsWithoutRef, RefAttributes, JSX, SVGAttributes } from 'react';
8
7
 
9
8
  type ReducedMotionConfig = "always" | "never" | "user";
10
9
  /**
@@ -849,81 +848,6 @@ interface VisualElementEventCallbacks {
849
848
  }
850
849
  type CreateVisualElement<Props = {}, TagName extends keyof DOMMotionComponents | string = "div"> = (Component: TagName | string | React.ComponentType<Props>, options: VisualElementOptions<HTMLElement | SVGElement>) => VisualElement<HTMLElement | SVGElement>;
851
850
 
852
- declare abstract class Feature<T extends any = any> {
853
- isMounted: boolean;
854
- node: VisualElement<T>;
855
- constructor(node: VisualElement<T>);
856
- abstract mount(): void;
857
- abstract unmount(): void;
858
- update(): void;
859
- }
860
-
861
- declare function MeasureLayout(props: MotionProps & {
862
- visualElement: VisualElement;
863
- }): react_jsx_runtime.JSX.Element;
864
-
865
- interface FeatureClass<Props = unknown> {
866
- new (props: Props): Feature<Props>;
867
- }
868
- interface HydratedFeatureDefinition {
869
- isEnabled: (props: MotionProps) => boolean;
870
- Feature: FeatureClass<unknown>;
871
- ProjectionNode?: any;
872
- MeasureLayout?: typeof MeasureLayout;
873
- }
874
- interface HydratedFeatureDefinitions {
875
- animation?: HydratedFeatureDefinition;
876
- exit?: HydratedFeatureDefinition;
877
- drag?: HydratedFeatureDefinition;
878
- tap?: HydratedFeatureDefinition;
879
- focus?: HydratedFeatureDefinition;
880
- hover?: HydratedFeatureDefinition;
881
- pan?: HydratedFeatureDefinition;
882
- inView?: HydratedFeatureDefinition;
883
- layout?: HydratedFeatureDefinition;
884
- }
885
- interface FeatureDefinition {
886
- isEnabled: HydratedFeatureDefinition["isEnabled"];
887
- Feature?: HydratedFeatureDefinition["Feature"];
888
- ProjectionNode?: HydratedFeatureDefinition["ProjectionNode"];
889
- MeasureLayout?: HydratedFeatureDefinition["MeasureLayout"];
890
- }
891
- type FeatureDefinitions = {
892
- [K in keyof HydratedFeatureDefinitions]: FeatureDefinition;
893
- };
894
- interface FeaturePackage {
895
- Feature?: HydratedFeatureDefinition["Feature"];
896
- ProjectionNode?: HydratedFeatureDefinition["ProjectionNode"];
897
- MeasureLayout?: HydratedFeatureDefinition["MeasureLayout"];
898
- }
899
- type FeaturePackages = {
900
- [K in keyof HydratedFeatureDefinitions]: FeaturePackage;
901
- };
902
- interface FeatureBundle extends FeaturePackages {
903
- renderer: CreateVisualElement;
904
- }
905
- type LazyFeatureBundle = () => Promise<FeatureBundle>;
906
-
907
- type MotionComponentProps<Props> = {
908
- [K in Exclude<keyof Props, keyof MotionProps>]?: Props[K];
909
- } & MotionProps;
910
- type MotionComponent<T, P> = T extends keyof DOMMotionComponents ? DOMMotionComponents[T] : React$1.ComponentType<Omit<MotionComponentProps<P>, "children"> & {
911
- children?: "children" extends keyof P ? P["children"] | MotionComponentProps<P>["children"] : MotionComponentProps<P>["children"];
912
- }>;
913
- interface MotionComponentOptions {
914
- forwardMotionProps?: boolean;
915
- }
916
- /**
917
- * Create a `motion` component.
918
- *
919
- * This function accepts a Component argument, which can be either a string (ie "div"
920
- * for `motion.div`), or an actual React component.
921
- *
922
- * Alongside this is a config option which provides a way of rendering the provided
923
- * component "offline", or outside the React render cycle.
924
- */
925
- declare function createMotionComponent<Props, TagName extends keyof DOMMotionComponents | string = "div">(Component: TagName | string | React$1.ComponentType<Props>, { forwardMotionProps }?: MotionComponentOptions, preloadedFeatures?: FeaturePackages, createVisualElement?: CreateVisualElement<Props, TagName>): MotionComponent<TagName, Props>;
926
-
927
851
  declare const optimizedAppearDataAttribute: "data-framer-appear-id";
928
852
 
929
853
  /**
@@ -955,4 +879,4 @@ declare global {
955
879
  }
956
880
  }
957
881
 
958
- export { type AnimationType as A, type CreateVisualElement as C, type DOMMotionComponents as D, type FeatureBundle as F, type HTMLMotionProps as H, type IProjectionNode as I, type LazyFeatureBundle as L, type MotionProps as M, PresenceContext as P, type ResolvedValues as R, type SVGMotionComponents as S, VisualElement as V, MotionConfigContext as a, type HTMLElements as b, createMotionComponent as c, type HTMLMotionComponents as d, type FeaturePackages as e, type VisualElementAnimationOptions as f, type HTMLRenderState as g, type ScrapeMotionValuesFromProps as h, type VisualState as i, SwitchLayoutGroupContext as j, type MotionStyle as k, type MotionTransform as l, makeUseVisualState as m, type VariantLabels as n, optimizedAppearDataAttribute as o, type ForwardRefComponent as p, type SVGAttributesAsMotionValues as q, type SVGMotionProps as r, FlatTree as s, type HydratedFeatureDefinition as t, type HydratedFeatureDefinitions as u, type FeatureDefinition as v, type FeatureDefinitions as w, type FeaturePackage as x };
882
+ export { type AnimationType as A, type CreateVisualElement as C, type DOMMotionComponents as D, type ForwardRefComponent as F, type HTMLMotionProps as H, type IProjectionNode as I, type MotionProps as M, PresenceContext as P, type ResolvedValues as R, type SVGMotionComponents as S, VisualElement as V, MotionConfigContext as a, type HTMLElements as b, type HTMLMotionComponents as c, type VisualElementAnimationOptions as d, type HTMLRenderState as e, type ScrapeMotionValuesFromProps as f, type VisualState as g, SwitchLayoutGroupContext as h, type MotionStyle as i, type MotionTransform as j, type VariantLabels as k, type SVGAttributesAsMotionValues as l, makeUseVisualState as m, type SVGMotionProps as n, optimizedAppearDataAttribute as o, FlatTree as p };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framer-motion",
3
- "version": "12.23.12",
3
+ "version": "13.0.0-alpha.0",
4
4
  "description": "A simple and powerful JavaScript animation library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.mjs",
@@ -142,5 +142,5 @@
142
142
  "maxSize": "2.26 kB"
143
143
  }
144
144
  ],
145
- "gitHead": "e0f7e07570e281b8932c897afb5f6a348c7f97de"
145
+ "gitHead": "543f5aa1f4455919eeda2d531a89d2b13e010145"
146
146
  }