Comments (8)
After some digging I tried to look into the work and found that XyzTransition.js
in the library has a very strict attribute here around line 26
:
https://github.com/ingram-projects/animxyz/blob/master/packages/vue/src/components/XyzTransition.js
Adding this helped me:
context.children.forEach((child) => {
child.data = mergeData(
{
attrs: {
xyz: data.attrs.xyz,
// Added this here
...context.data.attrs
},
directives: data.directives,
staticStyle: data.staticStyle,
style: data.style,
},
child.data
)
})
Would you mind being able to apply that in the next release, or is there a specific reason not to by any chance?
from animxyz.
Hi Sananes!
I will also look into this. In the current prerelease version I am trying a new dataMerge tool that may solve the current issue https://github.com/alexsasharegan/vue-functional-data-merge.
If the new data merge doesn't work I will try to do something similar to what you are suggesting but I have to make sure it only passes attributes that are not relevant to the transition component. AKA that it ignores appear
, duration
, mode
, etc.
Since these are parsed into context.props
I think it should be fine, but just want to double check.
from animxyz.
Makes total sense my man! Sounds good to me, either way I have a workaround for now. But love the direction your heading at!
from animxyz.
This should be resolved in the latest release v0.2.0! Let me know if it works for you and thanks for helping us improve :)
from animxyz.
You’re awesome @milesingrams! Thanks a bunch and happy new year to you!
from animxyz.
@milesingrams Hey my good buddy! Unfortunately I didn't actually get a chance to test this the other day. But unfortunately, it's still not inheriting values. Here's an example of what I have going:
<XyzTransition
v-bind="this.$attrs"
v-bind:on="this.$listeners"
v-observe-visibility="{ callback: visiblityChanged, ...options }"
>
<slot v-if="isVisible" />
</XyzTransition>
The component itself isn't inheriting the attributes. This works perfectly fine for XyzTransitionGroup though?
from animxyz.
Hi Sasanes. I believe this is more an issue of how v-observe-visibility works with v-if. Basically v-observe-visibility watches an existing DOM element to see if it comes into the viewport.
With XyzTransitionGroup (And Vue's native TransitionGroup), there is always a wrapper element which can be observed whether or not the child elements exist.
However with XyzTransition (And Vue's native Transition) it is a higher-order-component meaning it only renders it's children and does not have a wrapping element. When v-if is false on the child of XyzTransition, the component renders 0 DOM elements and therefore does not have any elements to attach the observe-visibility handler to.
The only way to get this to work with XyzTransition would be to wrap the transition in a div with the observer on it. I have implemented this in a codesandbox to show how it might work. If you scroll up and down you will see the elements appear.
https://codesandbox.io/s/animxyz-observe-visibility-test-71tu9?file=/src/components/Animation.vue
from animxyz.
The codepen solution is quite buggy though. I think the only way to properly implement this would be a v-visible directive which would toggle between 'visibility: visible' and 'visibility: hidden' instead of v-if or v-show. This is easy using a custom directive but it still doesn't trigger the transitions since 'v-show' and 'v-if' are special directives and trigger transitions at a core level. Hopefully I can find a way.
I'm trying to find a solution to this too so I can natively add v-observe-visibility properties. But so far it's proven difficult.
I'll keep trying and keep you updated. Also please let me know if you find a way!
from animxyz.
Related Issues (20)
- warning in console with vue3 + vite HOT 2
- Does it work with react-router-dom v6+?
- ES Module issue with Nuxt 3 HOT 7
- Not friendly to vue3. The animation cannot be displayed when I load the page for the first time. How should I solve it? HOT 2
- Animations flickering in React 18 HOT 2
- Issue with mode="out-in" HOT 1
- Responsive Design? HOT 1
- --xyz-duration not working, not even in sandbox HOT 1
- Is this being maintained? HOT 2
- How to use it with nuxt3? HOT 2
- Infinite Animation not working properly
- w3C html spec compliance: custom attributes need a data- prefix. HOT 1
- Issue with Bootstrap modal HOT 2
- Change default perspective to none HOT 4
- Repeat appear-visible
- Struggling to get it to work using React HOT 2
- ient HOT 1
- onanimationend and onanimationstart fired before the time and twice!
- React Router V6 `Routes` location prop breaking HOT 1
- Pls make it compatible with react 18 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from animxyz.