-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Description
What problem does this feature solve?
Currently, Vetur offers auto-completion & hover info for custom components defined in ElementUI, OnsenUI and Bootstrap-Vue. However, hand-maintaining such json files seem to be a lot of work. Also not co-locating the doc and the component definition can make updating component challenging.
Helper-json repos at:
- https://github.com/ElementUI/element-helper-json
- https://www.npmjs.com/package/vue-onsenui-helper-json
- https://github.com/bootstrap-vue/bootstrap-vue-helper-json
This feature makes it possible to write the doc in the SFC / js component file, and auto-generate a helper json that can be used for enhancing editing experience or auto-generating API / doc website.
What does the proposed API look like?
Two more optional attributes on the default export:
export default {
name: 'v-card',
description: 'A card component',
props: ['width', 'height'],
propsDescription: [
'width of the rendered card component',
'height of the rendered card component'
]
}
I was thinking maybe using a custom block for it, but then that only applies to SFC, not js components. jsdoc might be another option.
Other ideas welcome.
Another idea is similar to the typings
in package.json, have a vueTypings
for component libraries. It'll point to the generated helper-json file and editors could pick it up to enhance editing experience.
/cc
@Leopoldthecoder for ElementUI
@masahirotanaka for OnsenUI
@pi0 for Bootstrap-Vue
@rstoenescu for Quasar
@johnleider for Vuetify
Would you be interested in using this feature in the Vue component libraries that you are maintaining? Would you be interested in helping spec'ing a format for the generated json file and the editing experiences that should be enabled by using that file?