arielsalminen / vue-design-system

An open source tool for building UI Design Systems with Vue.js
https://vueds.com
MIT License
2.17k stars 225 forks source link

VueJS prop mixins not recognised in documentation #170

Open lukenofurther opened 5 years ago

lukenofurther commented 5 years ago

Are there any intentions in your project to properly include mixins in the VDS generated documentation application? This would allow component composition and minimise code duplication.

I'd like to abstract out a number of props (e.g. label, state, disabled, width etc) from the input and textarea elements because they are identical and I added a select element too, which also shared these same props. There are some associated computed properties and methods shared between my customised elements too. Creating and including the mixin worked fine. However, the generated documentation does not include the props in the prop table, presumably because they're not present in the actual element files.

As someone who hasn't contributed to this project I can't say what would be required to add this functionality, but I can see a major difficulty being accessing the comments from a mixin imported from a separate file. At the very least, adding the props from a mixin without comments shouldn't be too difficult, right?

lukenofurther commented 5 years ago

This has been raised previously with styleguidist (https://github.com/vue-styleguidist/vue-styleguidist/issues/222) and they are not going to include it, although I've asked a question about alternative solutions.

elevatebart commented 5 years ago

Hey @ljelewis, I believe I found a way to implement your use case here: https://github.com/vue-styleguidist/vue-docgen-api/pull/120

please review ;)

lukenofurther commented 5 years ago

@elevatebart quick work! I tried out your change and it doesn't bring through the default or comments/description but it does bring through the prop itself, along with it's type. Definite improvement.