Giter Club home page Giter Club logo

Comments (8)

Sananes avatar Sananes commented on May 18, 2024

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.

milesingrams avatar milesingrams commented on May 18, 2024

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.

Sananes avatar Sananes commented on May 18, 2024

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.

milesingrams avatar milesingrams commented on May 18, 2024

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.

Sananes avatar Sananes commented on May 18, 2024

You’re awesome @milesingrams! Thanks a bunch and happy new year to you!

from animxyz.

Sananes avatar Sananes commented on May 18, 2024

@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.

milesingrams avatar milesingrams commented on May 18, 2024

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.

milesingrams avatar milesingrams commented on May 18, 2024

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.

vuejs/vue#5425

I'll keep trying and keep you updated. Also please let me know if you find a way!

from animxyz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.