From c2e553baabf6aabf54f19c42ff5250804e9b8937 Mon Sep 17 00:00:00 2001 From: Libin YANG Date: Sun, 8 Sep 2024 20:15:35 +0800 Subject: [PATCH] fix: hr label (#393) --- src/components/ui/button/Button.vue | 8 +++--- src/components/ui/button/index.ts | 28 +++++++++---------- src/components/ui/popover/PopoverContent.vue | 4 +-- src/components/ui/select/SelectContent.vue | 4 +-- src/components/ui/select/SelectGroup.vue | 2 +- src/components/ui/select/SelectItem.vue | 4 +-- src/components/ui/select/SelectLabel.vue | 2 +- .../ui/select/SelectScrollDownButton.vue | 2 +- .../ui/select/SelectScrollUpButton.vue | 2 +- src/components/ui/select/SelectSeparator.vue | 2 +- src/components/ui/select/SelectTrigger.vue | 4 +-- src/utils/MDKatex.js | 1 - src/utils/renderer.ts | 10 +++---- 13 files changed, 35 insertions(+), 38 deletions(-) diff --git a/src/components/ui/button/Button.vue b/src/components/ui/button/Button.vue index 5cfd668..2aa3566 100644 --- a/src/components/ui/button/Button.vue +++ b/src/components/ui/button/Button.vue @@ -5,13 +5,13 @@ import { type ButtonVariants, buttonVariants } from '.' import { cn } from '@/lib/utils' interface Props extends PrimitiveProps { - variant?: ButtonVariants['variant'] - size?: ButtonVariants['size'] - class?: HTMLAttributes['class'] + variant?: ButtonVariants[`variant`] + size?: ButtonVariants[`size`] + class?: HTMLAttributes[`class`] } const props = withDefaults(defineProps(), { - as: 'button', + as: `button`, }) diff --git a/src/components/ui/button/index.ts b/src/components/ui/button/index.ts index 1b00c32..bb522b1 100644 --- a/src/components/ui/button/index.ts +++ b/src/components/ui/button/index.ts @@ -3,31 +3,31 @@ import { type VariantProps, cva } from 'class-variance-authority' export { default as Button } from './Button.vue' export const buttonVariants = cva( - 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', + `inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`, { variants: { variant: { - default: 'bg-primary text-primary-foreground hover:bg-primary/90', + default: `bg-primary text-primary-foreground hover:bg-primary/90`, destructive: - 'bg-destructive text-destructive-foreground hover:bg-destructive/90', + `bg-destructive text-destructive-foreground hover:bg-destructive/90`, outline: - 'border border-input bg-background hover:bg-accent hover:text-accent-foreground', + `border border-input bg-background hover:bg-accent hover:text-accent-foreground`, secondary: - 'bg-secondary text-secondary-foreground hover:bg-secondary/80', - ghost: 'hover:bg-accent hover:text-accent-foreground', - link: 'text-primary underline-offset-4 hover:underline', + `bg-secondary text-secondary-foreground hover:bg-secondary/80`, + ghost: `hover:bg-accent hover:text-accent-foreground`, + link: `text-primary underline-offset-4 hover:underline`, }, size: { - default: 'h-10 px-4 py-2', - xs: 'h-7 rounded px-2', - sm: 'h-9 rounded-md px-3', - lg: 'h-11 rounded-md px-8', - icon: 'h-10 w-10', + default: `h-10 px-4 py-2`, + xs: `h-7 rounded px-2`, + sm: `h-9 rounded-md px-3`, + lg: `h-11 rounded-md px-8`, + icon: `h-10 w-10`, }, }, defaultVariants: { - variant: 'default', - size: 'default', + variant: `default`, + size: `default`, }, }, ) diff --git a/src/components/ui/popover/PopoverContent.vue b/src/components/ui/popover/PopoverContent.vue index e691fe8..fef5ced 100644 --- a/src/components/ui/popover/PopoverContent.vue +++ b/src/components/ui/popover/PopoverContent.vue @@ -14,9 +14,9 @@ defineOptions({ }) const props = withDefaults( - defineProps(), + defineProps(), { - align: 'center', + align: `center`, sideOffset: 4, }, ) diff --git a/src/components/ui/select/SelectContent.vue b/src/components/ui/select/SelectContent.vue index 4fe234b..19f660e 100644 --- a/src/components/ui/select/SelectContent.vue +++ b/src/components/ui/select/SelectContent.vue @@ -16,9 +16,9 @@ defineOptions({ }) const props = withDefaults( - defineProps(), + defineProps(), { - position: 'popper', + position: `popper`, }, ) const emits = defineEmits() diff --git a/src/components/ui/select/SelectGroup.vue b/src/components/ui/select/SelectGroup.vue index 407d8ad..bb064cb 100644 --- a/src/components/ui/select/SelectGroup.vue +++ b/src/components/ui/select/SelectGroup.vue @@ -3,7 +3,7 @@ import { type HTMLAttributes, computed } from 'vue' import { SelectGroup, type SelectGroupProps } from 'radix-vue' import { cn } from '@/lib/utils' -const props = defineProps() +const props = defineProps() const delegatedProps = computed(() => { const { class: _, ...delegated } = props diff --git a/src/components/ui/select/SelectItem.vue b/src/components/ui/select/SelectItem.vue index b102a81..b685033 100644 --- a/src/components/ui/select/SelectItem.vue +++ b/src/components/ui/select/SelectItem.vue @@ -10,7 +10,7 @@ import { import { Check } from 'lucide-vue-next' import { cn } from '@/lib/utils' -const props = defineProps() +const props = defineProps() const delegatedProps = computed(() => { const { class: _, ...delegated } = props @@ -31,7 +31,7 @@ const forwardedProps = useForwardProps(delegatedProps) ) " > - + diff --git a/src/components/ui/select/SelectLabel.vue b/src/components/ui/select/SelectLabel.vue index 3d45cdb..f0059d0 100644 --- a/src/components/ui/select/SelectLabel.vue +++ b/src/components/ui/select/SelectLabel.vue @@ -3,7 +3,7 @@ import type { HTMLAttributes } from 'vue' import { SelectLabel, type SelectLabelProps } from 'radix-vue' import { cn } from '@/lib/utils' -const props = defineProps() +const props = defineProps() diff --git a/src/utils/MDKatex.js b/src/utils/MDKatex.js index 4b15c34..780db3d 100644 --- a/src/utils/MDKatex.js +++ b/src/utils/MDKatex.js @@ -16,7 +16,6 @@ function createRenderer(display) { if (display) { return `
${svg.outerHTML}
` } - return `${svg.outerHTML}` } } diff --git a/src/utils/renderer.ts b/src/utils/renderer.ts index 4127a58..6d44d92 100644 --- a/src/utils/renderer.ts +++ b/src/utils/renderer.ts @@ -100,9 +100,6 @@ export function initRenderer(opts: IOpts) { } function styledContent(styleLabel: string, content: string, tagName?: string): string { - if (!content) { - return `` - } const tag = tagName ?? styleLabel return `<${tag} ${styles(styleLabel)}>${content}` } @@ -172,8 +169,9 @@ export function initRenderer(opts: IOpts) { .replace(/\r\n/g, `
`) .replace(/\n/g, `
`) .replace(/(>[^<]+)|(^[^<]+)/g, str => str.replace(/\s/g, ` `)) - - return `
${highlighted}
` + const span = `` + const code = `${highlighted}` + return `
${span}${code}
` }, codespan({ text }: Tokens.Codespan): string { @@ -254,7 +252,7 @@ export function initRenderer(opts: IOpts) { return styledContent(`td`, text) }, - hr(): string { + hr(_: Tokens.Hr): string { return styledContent(`hr`, ``) }, }