-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/EMP-4044-replace-filters-injection-m…
- Loading branch information
Showing
14 changed files
with
205 additions
and
101 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -3,6 +3,24 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
## [1.0.0-alpha.8](https://github.com/empathyco/x/compare/[email protected]@1.0.0-alpha.8) (2024-05-13) | ||
|
||
|
||
### Features | ||
|
||
* replace `AnimationsMixin` with `useCollapseAnimation` composable (#1468) ([e3ee9d9](https://github.com/empathyco/x/commit/e3ee9d94f9acc4abdcd1c591a754c86d9a6abbb7)) | ||
|
||
|
||
|
||
## [1.0.0-alpha.7](https://github.com/empathyco/x/compare/[email protected]@1.0.0-alpha.7) (2024-05-09) | ||
|
||
|
||
### Features | ||
|
||
* Replace FacetsMixin by useFacets composable (#1462) ([bb7e0ce](https://github.com/empathyco/x/commit/bb7e0cede8653d82e436db696e80c1bdbcb9cc41)) | ||
|
||
|
||
|
||
## [1.0.0-alpha.6](https://github.com/empathyco/x/compare/[email protected]@1.0.0-alpha.6) (2024-05-09) | ||
|
||
|
||
|
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
3 changes: 3 additions & 0 deletions
3
packages/_vue3-migration-test/src/components/animations/index.ts
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
export { default as TestAnimateWidth } from './test-animate-width.vue'; | ||
export { default as TestCollapseHeight } from './test-collapse-height.vue'; | ||
export { default as TestCollapseWidth } from './test-collapse-width.vue'; | ||
export { default as TestCrossFade } from './test-cross-fade.vue'; | ||
export { default as TestFade } from './test-fade.vue'; |
15 changes: 15 additions & 0 deletions
15
packages/_vue3-migration-test/src/components/animations/test-collapse-height.vue
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,15 @@ | ||
<template> | ||
<div> | ||
<button @click="open = !open">Toggle</button> | ||
<CollapseHeight> | ||
<p v-if="open">CollapseHeight</p> | ||
</CollapseHeight> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
import CollapseHeight from '../../../../x-components/src/components/animations/collapse-height.vue'; | ||
const open = ref(true); | ||
</script> |
15 changes: 15 additions & 0 deletions
15
packages/_vue3-migration-test/src/components/animations/test-collapse-width.vue
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,15 @@ | ||
<template> | ||
<div> | ||
<button @click="open = !open">Toggle</button> | ||
<CollapseWidth> | ||
<p v-if="open">CollapseWidth</p> | ||
</CollapseWidth> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
import CollapseWidth from '../../../../x-components/src/components/animations/collapse-width.vue'; | ||
const open = ref(true); | ||
</script> |
15 changes: 15 additions & 0 deletions
15
packages/_vue3-migration-test/src/components/animations/test-cross-fade.vue
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,15 @@ | ||
<template> | ||
<div> | ||
<button @click="open = !open">Toggle</button> | ||
<CrossFade> | ||
<p v-if="open">CrossFade</p> | ||
</CrossFade> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
import CrossFade from '../../../../x-components/src/components/animations/cross-fade.vue'; | ||
const open = ref(true); | ||
</script> |
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 |
---|---|---|
|
@@ -3,6 +3,24 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
## [5.0.0-alpha.11](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2024-05-13) | ||
|
||
|
||
### Features | ||
|
||
* replace `AnimationsMixin` with `useCollapseAnimation` composable (#1468) ([e3ee9d9](https://github.com/empathyco/x/commit/e3ee9d94f9acc4abdcd1c591a754c86d9a6abbb7)) | ||
|
||
|
||
|
||
## [5.0.0-alpha.10](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2024-05-09) | ||
|
||
|
||
### Features | ||
|
||
* Replace FacetsMixin by useFacets composable (#1462) ([bb7e0ce](https://github.com/empathyco/x/commit/bb7e0cede8653d82e436db696e80c1bdbcb9cc41)) | ||
|
||
|
||
|
||
## [5.0.0-alpha.9](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2024-05-09) | ||
|
||
|
||
|
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
64 changes: 0 additions & 64 deletions
64
packages/x-components/src/components/animations/animations.mixin.ts
This file was deleted.
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
64 changes: 64 additions & 0 deletions
64
packages/x-components/src/components/animations/use-collapse-animation.ts
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,64 @@ | ||
/** | ||
* Type options for the property that will be animated. | ||
*/ | ||
type AnimatedProperty = 'height' | 'width'; | ||
|
||
/** | ||
* Returns parametrized methods to use in a component to allow the collapsing of the provided | ||
* property. | ||
* | ||
* @param property - The property that will be animated. | ||
* @returns Composable for the module. | ||
* @public | ||
*/ | ||
export function useCollapseAnimation(property: AnimatedProperty) { | ||
const scrollProperty = property === 'width' ? 'scrollWidth' : 'scrollHeight'; | ||
|
||
/** | ||
* Changes the element's animated property from 0 to the element's content size. | ||
* | ||
* @remarks `content-visibility` CSS property boosts the rendering performance waiting to be | ||
* needed until rendering the content. This behaviour collides with this animation method. | ||
* When the `scrollProperty` is evaluated, the content has not been rendered yet and the value | ||
* is 0 so nothing is animated. To avoid this behaviour, we change the `content-visibility` to | ||
* default value, force a layer repaint and then, evaluate the `scrollProperty` value which | ||
* now has value. Then we restore the `content-visibility` value to its previous state. | ||
* | ||
* @param element - The DOM element that is going to be animated. | ||
*/ | ||
function expand(element: HTMLElement): void { | ||
element.style[property] = '0'; | ||
const originalValue = (element.style as any)['content-visibility']; | ||
(element.style as any)['content-visibility'] = 'visible'; | ||
element.getBoundingClientRect(); | ||
element.style[property] = `${element[scrollProperty]}px`; | ||
(element.style as any)['content-visibility'] = originalValue; | ||
} | ||
|
||
/** | ||
* Removes the animated property from the element. | ||
* | ||
* @param element - The DOM element that is going to be animated. | ||
*/ | ||
function cleanUpAnimationStyles(element: HTMLElement): void { | ||
element.style.removeProperty(property); | ||
} | ||
|
||
/** | ||
* Changes the element's animated property from the element's content size to 0. | ||
* | ||
* @param element - The DOM element that is going to be animated. | ||
*/ | ||
function collapse(element: HTMLElement): void { | ||
element.style[property] = `${element[scrollProperty]}px`; | ||
// This is intended. We want to provoke a layer repaint to apply this style. | ||
element.getBoundingClientRect(); | ||
element.style[property] = '0'; | ||
} | ||
|
||
return { | ||
expand, | ||
cleanUpAnimationStyles, | ||
collapse | ||
}; | ||
} |