Description
What problem does this feature solve?
It would be usefull for library authors to be able to extend component metas. In @nuxt/ui
for example we're using something similar for our devtools, allowing us to pass default property values and examples to preview components (Here's an example).
What does the proposed solution look like?
We could define a new macro defineComponentMeta(meta: Record<string, any>)
that can be used within a component. Its content would be parsed and injected into the component's meta by the meta checker.
<script setup lang="ts">
const props = defineProps<{ foo: string }>()
extendComponentMeta({
bar: 'baz'
})
</script>
<template>
<span />
</template>
Which would result in the following meta:
{
bar: 'baz',
props: [ /* ... */ ],
// ...
}
I can look into the implementation if needed.
Metadata
Assignees
Labels
No labels
Activity