-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix rollup config and address warnings
Reduces number of files using named and default exports together. Consumers of your bundle will have to use `chunk['default’]` to access their default export, which is error prone and confusing. Also de-dupes date-fns versions.
- Loading branch information
1 parent
4915741
commit 6520266
Showing
93 changed files
with
1,238 additions
and
706 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright 2022 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
import { createContext } from '@googleforcreators/react'; | ||
|
||
const Context = createContext(null); | ||
|
||
export default Context; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2022 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
function generateKeyframesMap(targets, getAnimationParts) { | ||
return targets.reduce((acc, target) => { | ||
return { | ||
...acc, | ||
...getAnimationParts(target).reduce((a, part) => { | ||
const { generatedKeyframes } = part; | ||
return { | ||
...a, | ||
...generatedKeyframes, | ||
}; | ||
}, acc), | ||
}; | ||
}, {}); | ||
} | ||
|
||
export default generateKeyframesMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
packages/animation/src/components/test/generateKeyframesMap.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import generateKeyframesMap from '../generateKeyframesMap'; | ||
|
||
const mockGetAnimationParts = (src) => (target) => src[target]; | ||
const mockAnimationPart = (keyframes) => ({ generatedKeyframes: keyframes }); | ||
|
||
describe('generateKeyframesMap', () => { | ||
it('should flatten keyframes into a single map', () => { | ||
const targets = ['target1', 'target2', 'target3']; | ||
const parts = { | ||
[targets[0]]: [ | ||
mockAnimationPart({ bounce: { transform: [1, 3, 4] } }), | ||
mockAnimationPart({ dance: { transform: [5, 7, 9] } }), | ||
], | ||
[targets[1]]: [mockAnimationPart({ flip: { transform: [2, 5, 8] } })], | ||
[targets[2]]: [mockAnimationPart({ blinkOn: { opacity: [0, 1, 0, 1] } })], | ||
}; | ||
|
||
const getAnimationParts = mockGetAnimationParts(parts); | ||
|
||
expect(generateKeyframesMap(targets, getAnimationParts)).toStrictEqual({ | ||
bounce: { transform: [1, 3, 4] }, | ||
dance: { transform: [5, 7, 9] }, | ||
flip: { transform: [2, 5, 8] }, | ||
blinkOn: { opacity: [0, 1, 0, 1] }, | ||
}); | ||
}); | ||
|
||
it('should consolidate duplicate keyframes', () => { | ||
const bounceKeyframes = { bounce: { transform: [1, 3, 4] } }; | ||
|
||
const targets = ['target1', 'target2', 'target3']; | ||
const parts = { | ||
[targets[0]]: [ | ||
mockAnimationPart(bounceKeyframes), | ||
mockAnimationPart({ dance: { transform: [5, 7, 9] } }), | ||
], | ||
[targets[1]]: [mockAnimationPart(bounceKeyframes)], | ||
[targets[2]]: [ | ||
mockAnimationPart(bounceKeyframes), | ||
mockAnimationPart({ blinkOn: { opacity: [0, 1, 0, 1] } }), | ||
], | ||
}; | ||
|
||
const getAnimationParts = mockGetAnimationParts(parts); | ||
|
||
expect(generateKeyframesMap(targets, getAnimationParts)).toStrictEqual({ | ||
bounce: { transform: [1, 3, 4] }, | ||
dance: { transform: [5, 7, 9] }, | ||
blinkOn: { opacity: [0, 1, 0, 1] }, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2022 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
import PropTypes from 'prop-types'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { AnimationInputPropTypes } from '../types'; | ||
|
||
export const PanEffectInputPropTypes = { | ||
panDir: PropTypes.shape(AnimationInputPropTypes), | ||
duration: PropTypes.shape(AnimationInputPropTypes), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
packages/animation/src/effects/backgroundPanAndZoom/types.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright 2022 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
export { PanEffectInputPropTypes as PanAndZoomEffectInputPropTypes } from '../backgroundPan/types'; |
Oops, something went wrong.