Skip to content

Commit

Permalink
Merge pull request #2619 from framer/feature/react-jsx
Browse files Browse the repository at this point in the history
feat: use modern jsx transform
  • Loading branch information
mergetron[bot] committed Apr 16, 2024
2 parents c218181 + ff51dce commit 8c3a635
Show file tree
Hide file tree
Showing 259 changed files with 262 additions and 435 deletions.
1 change: 0 additions & 1 deletion dev/examples/AnimatePresence-image-gallery.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { motion, AnimatePresence, wrap } from "framer-motion"
import * as React from "react"
import { useState } from "react"

/**
Expand Down
5 changes: 2 additions & 3 deletions dev/examples/AnimatePresence-layout-animations-siblings.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { motion, AnimatePresence, LayoutGroup } from "framer-motion"
import * as React from "react"
import { useState } from "react"
import { useEffect, useState } from "react";

/**
* An example of an AnimatePresence child animating in and out with shared layout
Expand Down Expand Up @@ -33,7 +32,7 @@ function ExitComponent() {
export const App = () => {
const [isVisible, setVisible] = useState(true)

React.useEffect(() => {
useEffect(() => {
setTimeout(() => {
setVisible(!isVisible)
}, 3000)
Expand Down
5 changes: 2 additions & 3 deletions dev/examples/AnimatePresence-notifications-list-pop.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as React from "react"
import { useState } from "react"
import { forwardRef, useState } from "react";
import { motion, AnimatePresence } from "framer-motion"

const Notification = React.forwardRef(function (
const Notification = forwardRef(function (
{ id, notifications, setNotifications, style },
ref
) {
Expand Down
1 change: 0 additions & 1 deletion dev/examples/AnimatePresence-notifications-list.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { useState } from "react"
import { motion, AnimatePresence } from "framer-motion"

Expand Down
5 changes: 2 additions & 3 deletions dev/examples/AnimatePresence-parallel-children.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { motion, AnimatePresence } from "framer-motion"
import * as React from "react"
import { useState } from "react"
import { useEffect, useState } from "react";

/**
* An example of three top-level AnimatePresence children controlling the exit of a single
Expand All @@ -17,7 +16,7 @@ const style = {
export const App = () => {
const [isVisible, setVisible] = useState(true)

React.useEffect(() => {
useEffect(() => {
setTimeout(() => {
setVisible(!isVisible)
}, 3000)
Expand Down
1 change: 0 additions & 1 deletion dev/examples/AnimatePresence-siblings.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { motion, AnimatePresence, LayoutGroup } from "framer-motion"
import * as React from "react"
import { useState } from "react"

/**
Expand Down
5 changes: 2 additions & 3 deletions dev/examples/AnimatePresence-variants.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { motion, AnimatePresence } from "framer-motion"
import * as React from "react"
import { useState } from "react"
import { useEffect, useState } from "react";

/**
* An example of AnimatePresence with exit defined as a variant through a tree.
Expand Down Expand Up @@ -42,7 +41,7 @@ const listVariants = {
export const App = () => {
const [isVisible, setVisible] = useState(true)

React.useEffect(() => {
useEffect(() => {
setTimeout(() => {
setVisible(!isVisible)
}, 3000)
Expand Down
5 changes: 2 additions & 3 deletions dev/examples/AnimatePresence.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { motion, AnimatePresence } from "framer-motion"
import * as React from "react"
import { useState } from "react"
import { useEffect, useState } from "react";

/**
* An example of a single-child AnimatePresence animation
Expand All @@ -16,7 +15,7 @@ const style = {
export const App = () => {
const [isVisible, setVisible] = useState(true)

React.useEffect(() => {
useEffect(() => {
setTimeout(() => {
setVisible(!isVisible)
}, 1500)
Expand Down
5 changes: 2 additions & 3 deletions dev/examples/Animation-CSS-variables.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from "react"
import { useEffect } from "react"
import { useRef, useEffect } from "react";
import { motion } from "framer-motion"

/**
Expand All @@ -20,7 +19,7 @@ export const App = () => {
duration: 1,
}

const ref = React.useRef<HTMLDivElement>(null)
const ref = useRef<HTMLDivElement>(null)
useEffect(() => {
function changeToVar() {
ref.current.style.setProperty("--to", "cyan")
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-animate.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { useEffect, useState } from "react"
import { motion, motionValue, useAnimate } from "framer-motion"
import { frame } from "framer-motion"
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-batch-read-writes.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { MotionConfig, motion } from "framer-motion"

const style = {
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-between-value-types-x.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion, useCycle } from "framer-motion"

/**
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-boxShadow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion, useCycle } from "framer-motion"

/**
Expand Down
4 changes: 2 additions & 2 deletions dev/examples/Animation-cleanup.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from "react"
import { useState } from "react";
import { motion } from "framer-motion"

export const App = () => {
const [open, setOpen] = React.useState(true)
const [open, setOpen] = useState(true)
return (
<div>
{open && (
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-filter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion } from "framer-motion"

/**
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-height-auto-display-none.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { useState } from "react"
import { mix, motion } from "framer-motion"

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-height-auto-padding.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { useState } from "react"
import { motion, AnimatePresence } from "framer-motion"

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-height-auto-rotate-scale.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { useState } from "react"
import { motion, mix } from "framer-motion"

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-keyframes.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion, useCycle } from "framer-motion"

/**
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-layout-delay-children.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion, useCycle } from "framer-motion"

export const App = () => {
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-layout-nested-position.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion, useCycle } from "framer-motion"

/**
Expand Down
5 changes: 2 additions & 3 deletions dev/examples/Animation-layout-scale-correction.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from "react"
import { useState } from "react"
import { useEffect, useState } from "react";
import { motion } from "framer-motion"
import styled from "styled-components"

Expand All @@ -12,7 +11,7 @@ export const App = () => {
const [isOn, setIsOn] = useState(false)

// Double render to ensure it doesn't matter if we trigger a animate transition mid-animation
React.useEffect(() => {
useEffect(() => {
isOn && setTimeout(() => setIsOn(isOn), 500)
}, [isOn])

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-layout-seperate-children.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { useState } from "react"
import { motion } from "framer-motion"

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-layout-size.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion, useCycle } from "framer-motion"

/**
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-layout-text-size.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion, useCycle } from "framer-motion"
import styled from "styled-components"

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-layout-transform-template.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { useState } from "react"
import { motion } from "framer-motion"
import styled from "styled-components"
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-layout-update-stress.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion, useCycle } from "framer-motion"
import styled from "styled-components"

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-repeat-spring.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion } from "framer-motion"

/**
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-reverse.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useAnimate } from "framer-motion"
import * as React from "react"

export const App = () => {
const [scope, animate] = useAnimate()
Expand Down
6 changes: 3 additions & 3 deletions dev/examples/Animation-stagger-custom.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from "react"
import { useState, useEffect } from "react";
import { useAnimation, distance2D, wrap } from "framer-motion"
import { motion } from "framer-motion"

Expand All @@ -12,7 +12,7 @@ const stagger = 0.1
let interval

export const App = () => {
const [center, setCenter] = React.useState({ x: len / 2, y: len / 2 })
const [center, setCenter] = useState({ x: len / 2, y: len / 2 })

const cells = Array.from(Array(count).keys()).map((i) => {
return (
Expand Down Expand Up @@ -74,7 +74,7 @@ const Cell = ({ center, i, onClick }) => {
})
}

React.useEffect(() => {
useEffect(() => {
animate()
})

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-stress-mount.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion } from "framer-motion"

/**
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Animation-transition-tween.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { useState } from "react"
import { motion } from "framer-motion"

Expand Down
6 changes: 3 additions & 3 deletions dev/examples/Animation-variants.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from "react"
import { Fragment, useState } from "react";
import { motion, useMotionValue } from "framer-motion"

const MotionFragment = motion(React.Fragment)
const MotionFragment = motion(Fragment)

export function App() {
const backgroundColor = useMotionValue("#f00")
const [isActive, setIsActive] = React.useState(true)
const [isActive, setIsActive] = useState(true)
return (
<MotionFragment initial="initial" animate={isActive ? "to" : "initial"}>
<motion.div>
Expand Down
4 changes: 2 additions & 2 deletions dev/examples/Benchmark-cold-start-gsap.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from "react"
import { useRef } from "react";
import gsap from "gsap"
import { useGSAP } from "@gsap/react"

Expand Down Expand Up @@ -26,7 +26,7 @@ const boxContainer = {
const num = 100

function Box() {
const ref = React.useRef(null)
const ref = useRef(null)

useGSAP(
() => {
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Benchmark-cold-start-motion.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion } from "framer-motion"

/**
Expand Down
5 changes: 2 additions & 3 deletions dev/examples/Drag-SharedLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from "react"
import { useState, useRef } from "react"
import { useEffect, useState, useRef } from "react";
import { motion } from "framer-motion"
import styled from "styled-components"

Expand Down Expand Up @@ -68,7 +67,7 @@ function DragDrop() {
const viewportWidth = useRef(0)
const [is, setIs] = useState(true)

React.useEffect(() => {
useEffect(() => {
viewportWidth.current = window.innerWidth
}, [])

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Drag-block-viewport-conditionally.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion } from "framer-motion"

const styleA = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { useRef } from "react"
import { motion } from "framer-motion"

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Drag-constraints-ref-small-container.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { useRef } from "react"
import { motion } from "framer-motion"

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Drag-constraints-ref.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { useRef, useState } from "react"
import { motion } from "framer-motion"

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Drag-constraints-relative.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion } from "framer-motion"

const styleA = {
Expand Down
6 changes: 3 additions & 3 deletions dev/examples/Drag-constraints-resize.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from "react"
import { useState, useEffect } from "react";
import { motion } from "framer-motion"

const styleA = {
Expand All @@ -8,8 +8,8 @@ const styleA = {
}

export function App() {
const [backgroundColor, setBackgroundColor] = React.useState("darkgray")
React.useEffect(() => {
const [backgroundColor, setBackgroundColor] = useState("darkgray")
useEffect(() => {
const listener = () => {
// The re-render will have updateBlockedByResize as true and cause clearMeasurements() to be called.
setBackgroundColor("pink")
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Drag-draggable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { useState, useRef, useEffect } from "react"
import { motion } from "framer-motion"

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Drag-nested.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion } from "framer-motion"

const scroll = {
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Drag-svg.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion } from "framer-motion"

export const App = () => {
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Drag-to-reorder.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { useEffect, useState } from "react"
import { Reorder, useMotionValue, animate } from "framer-motion"

Expand Down
1 change: 0 additions & 1 deletion dev/examples/Drag-useDragControls-snapToCursor.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion, useDragControls } from "framer-motion"

/**
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Drag-useDragControls.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion, useDragControls } from "framer-motion"

/**
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Events-onTap.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion } from "framer-motion"

/**
Expand Down
1 change: 0 additions & 1 deletion dev/examples/Events-pan.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from "react"
import { motion } from "framer-motion"

const styleA = {
Expand Down
Loading

0 comments on commit 8c3a635

Please sign in to comment.