From 93ea5b958e4c40682bca93725403db93fad7e890 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Wed, 11 Dec 2024 17:26:38 +0100 Subject: [PATCH] docs(ComponentProps): consistent quotes in default --- docs/app/components/content/ComponentProps.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/app/components/content/ComponentProps.vue b/docs/app/components/content/ComponentProps.vue index 2bf3facd..7d354265 100644 --- a/docs/app/components/content/ComponentProps.vue +++ b/docs/app/components/content/ComponentProps.vue @@ -47,7 +47,17 @@ const metaProps: ComputedRef = computed(() => { return meta.meta.props.filter((prop) => { return !props.ignore?.includes(prop.name) }).map((prop) => { - prop.default = prop.default ?? prop.tags?.find(tag => tag.name === 'defaultValue')?.text ?? componentTheme?.defaultVariants?.[prop.name] + if (prop.default) { + prop.default = prop.default.replace(' as never', '').replace(/^"(.*)"$/, '\'$1\'') + } else { + const tag = prop.tags?.find(tag => tag.name === 'defaultValue')?.text + if (tag) { + prop.default = tag + } else if (componentTheme?.defaultVariants?.[prop.name]) { + prop.default = typeof componentTheme?.defaultVariants?.[prop.name] === 'string' ? `'${componentTheme?.defaultVariants?.[prop.name]}'` : componentTheme?.defaultVariants?.[prop.name] + } + } + // @ts-expect-error - Type is not correct prop.type = !prop.type.startsWith('boolean') && prop.schema?.kind === 'enum' && Object.keys(prop.schema.schema)?.length ? Object.values(prop.schema.schema).map(schema => schema?.type ? schema.type : schema).join(' | ') : prop.type return prop