Skip to content

Commit

Permalink
Export motion from wordpress/components as __unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
gwwar committed Aug 4, 2021
1 parent e4e5d77 commit 9bb06cd
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 7 deletions.
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"classnames": "^2.3.1",
"dom-scroll-into-view": "^1.2.1",
"downshift": "^6.0.15",
"framer-motion": "^4.1.3",
"framer-motion": "^4.1.17",
"gradient-parser": "^0.1.5",
"highlight-words-core": "^1.2.2",
"lodash": "^4.17.21",
Expand Down
13 changes: 13 additions & 0 deletions packages/components/src/animation/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Framer Motion is used to create animated, interactive interfaces. The package is roughly ~30kb so
* this should ideally be loaded once across all Gutenberg packages. To give ourselves more flexibility
* in trying animation options, we avoid making this public API.
*
* @see https://www.framer.com/docs/animation/
*/

export {
motion as __unstableMotion,
AnimatePresence as __unstableAnimatePresence,
AnimateSharedLayout as __unstableAnimateSharedLayout,
} from 'framer-motion';
5 changes: 5 additions & 0 deletions packages/components/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export {
default as Animate,
getAnimateClassName as __unstableGetAnimateClassName,
} from './animate';
export {
__unstableMotion,
__unstableAnimatePresence,
__unstableAnimateSharedLayout,
} from './animation';
export { default as AnglePickerControl } from './angle-picker-control';
export {
default as Autocomplete,
Expand Down
5 changes: 4 additions & 1 deletion packages/components/src/snackbar/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import classnames from 'classnames';
import { omit, noop } from 'lodash';
import { motion, AnimatePresence } from 'framer-motion';

/**
* WordPress dependencies
Expand All @@ -14,6 +13,10 @@ import { useReducedMotion } from '@wordpress/compose';
* Internal dependencies
*/
import Snackbar from './';
import {
__unstableMotion as motion,
__unstableAnimatePresence as AnimatePresence,
} from '../animation';

const SNACKBAR_VARIANTS = {
init: {
Expand Down
1 change: 0 additions & 1 deletion packages/edit-post/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"@wordpress/viewport": "file:../viewport",
"@wordpress/warning": "file:../warning",
"classnames": "^2.3.1",
"framer-motion": "^4.1.3",
"lodash": "^4.17.21",
"memize": "^1.1.0",
"rememo": "^3.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/edit-post/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import classnames from 'classnames';
import { motion } from 'framer-motion';

/**
* WordPress dependencies
Expand Down Expand Up @@ -32,7 +31,7 @@ import {
__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,
} from '@wordpress/block-editor';
import { useRef, useMemo } from '@wordpress/element';
import { Button } from '@wordpress/components';
import { Button, __unstableMotion as motion } from '@wordpress/components';
import { useSelect, useDispatch } from '@wordpress/data';
import { useMergeRefs } from '@wordpress/compose';
import { arrowLeft } from '@wordpress/icons';
Expand Down

0 comments on commit 9bb06cd

Please sign in to comment.