UNPKG

svelte-motion

Version:

Svelte animation library based on the React library framer-motion.

53 lines (52 loc) 1.77 kB
/** based on framer-motion@4.1.17, Copyright (c) 2018 Framer B.V. */ import { ResolvedValues } from "../types"; import { SVGAttributes } from "react"; import { MakeMotion, MotionProps } from "../../motion/types"; import { SVGElements } from "./supported-elements"; import { ForwardRefComponent, HTMLRenderState } from "../html/types"; export interface SVGRenderState extends HTMLRenderState { /** * Measured dimensions of the SVG element to be used to calculate a transform-origin. */ dimensions?: SVGDimensions; /** * A mutable record of attributes we want to apply directly to the rendered Element * every frame. We use a mutable data structure to reduce GC during animations. */ attrs: ResolvedValues; /** * Measured path length if this is a SVGPathElement */ totalPathLength?: number; } export declare type SVGDimensions = { x: number; y: number; width: number; height: number; }; interface SVGAttributesWithoutMotionProps<T> extends Pick<SVGAttributes<T>, Exclude<keyof SVGAttributes<T>, keyof MotionProps>> { } /** * Blanket-accept any SVG attribute as a `MotionValue` * @public */ export declare type SVGAttributesAsMotionValues<T> = MakeMotion<SVGAttributesWithoutMotionProps<T>>; declare type UnwrapSVGFactoryElement<F> = F extends React.SVGProps<infer P> ? P : never; /** * @public */ export interface SVGMotionProps<T> extends SVGAttributesAsMotionValues<T>, MotionProps { } /** * Motion-optimised versions of React's SVG components. * * @public */ export declare type SVGMotionComponents = { [K in SVGElements]: ForwardRefComponent<UnwrapSVGFactoryElement<JSX.IntrinsicElements[K]>, SVGMotionProps<UnwrapSVGFactoryElement<JSX.IntrinsicElements[K]>>>; }; export {};