Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hr label #393

Merged
merged 2 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/ui/button/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<Props>(), {
as: 'button',
as: `button`,
})
</script>

Expand Down
28 changes: 14 additions & 14 deletions src/components/ui/button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
},
},
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/popover/PopoverContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ defineOptions({
})

const props = withDefaults(
defineProps<PopoverContentProps & { class?: HTMLAttributes['class'] }>(),
defineProps<PopoverContentProps & { class?: HTMLAttributes[`class`] }>(),
{
align: 'center',
align: `center`,
sideOffset: 4,
},
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/select/SelectContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ defineOptions({
})

const props = withDefaults(
defineProps<SelectContentProps & { class?: HTMLAttributes['class'] }>(),
defineProps<SelectContentProps & { class?: HTMLAttributes[`class`] }>(),
{
position: 'popper',
position: `popper`,
},
)
const emits = defineEmits<SelectContentEmits>()
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/select/SelectGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<SelectGroupProps & { class?: HTMLAttributes['class'] }>()
const props = defineProps<SelectGroupProps & { class?: HTMLAttributes[`class`] }>()

const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/select/SelectItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { Check } from 'lucide-vue-next'
import { cn } from '@/lib/utils'

const props = defineProps<SelectItemProps & { class?: HTMLAttributes['class'] }>()
const props = defineProps<SelectItemProps & { class?: HTMLAttributes[`class`] }>()

const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
Expand All @@ -31,7 +31,7 @@ const forwardedProps = useForwardProps(delegatedProps)
)
"
>
<span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<span class="absolute left-2 h-3.5 w-3.5 flex items-center justify-center">
<SelectItemIndicator>
<Check class="h-4 w-4" />
</SelectItemIndicator>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/select/SelectLabel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { HTMLAttributes } from 'vue'
import { SelectLabel, type SelectLabelProps } from 'radix-vue'
import { cn } from '@/lib/utils'

const props = defineProps<SelectLabelProps & { class?: HTMLAttributes['class'] }>()
const props = defineProps<SelectLabelProps & { class?: HTMLAttributes[`class`] }>()
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/select/SelectScrollDownButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SelectScrollDownButton, type SelectScrollDownButtonProps, useForwardPro
import { ChevronDown } from 'lucide-vue-next'
import { cn } from '@/lib/utils'

const props = defineProps<SelectScrollDownButtonProps & { class?: HTMLAttributes['class'] }>()
const props = defineProps<SelectScrollDownButtonProps & { class?: HTMLAttributes[`class`] }>()

const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/select/SelectScrollUpButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SelectScrollUpButton, type SelectScrollUpButtonProps, useForwardProps }
import { ChevronUp } from 'lucide-vue-next'
import { cn } from '@/lib/utils'

const props = defineProps<SelectScrollUpButtonProps & { class?: HTMLAttributes['class'] }>()
const props = defineProps<SelectScrollUpButtonProps & { class?: HTMLAttributes[`class`] }>()

const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/select/SelectSeparator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type HTMLAttributes, computed } from 'vue'
import { SelectSeparator, type SelectSeparatorProps } from 'radix-vue'
import { cn } from '@/lib/utils'

const props = defineProps<SelectSeparatorProps & { class?: HTMLAttributes['class'] }>()
const props = defineProps<SelectSeparatorProps & { class?: HTMLAttributes[`class`] }>()

const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/select/SelectTrigger.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SelectIcon, SelectTrigger, type SelectTriggerProps, useForwardProps } f
import { ChevronDown } from 'lucide-vue-next'
import { cn } from '@/lib/utils'

const props = defineProps<SelectTriggerProps & { class?: HTMLAttributes['class'] }>()
const props = defineProps<SelectTriggerProps & { class?: HTMLAttributes[`class`] }>()

const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
Expand All @@ -25,7 +25,7 @@ const forwardedProps = useForwardProps(delegatedProps)
>
<slot />
<SelectIcon as-child>
<ChevronDown class="w-4 h-4 opacity-50 shrink-0" />
<ChevronDown class="h-4 w-4 shrink-0 opacity-50" />
</SelectIcon>
</SelectTrigger>
</template>
1 change: 0 additions & 1 deletion src/utils/MDKatex.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function createRenderer(display) {
if (display) {
return `<section style="text-align: center; overflow: auto;">${svg.outerHTML}</section>`
}

return `<span style="vertical-align: middle; line-height: 1;">${svg.outerHTML}</span>`
}
}
Expand Down
10 changes: 4 additions & 6 deletions src/utils/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}</${tag}>`
}
Expand Down Expand Up @@ -172,8 +169,9 @@ export function initRenderer(opts: IOpts) {
.replace(/\r\n/g, `<br/>`)
.replace(/\n/g, `<br/>`)
.replace(/(>[^<]+)|(^[^<]+)/g, str => str.replace(/\s/g, `&nbsp;`))

return `<pre class="hljs code__pre" ${styles(`code_pre`)}><span class="mac-sign" style="padding: 10px 14px 0;" hidden>${macCodeSvg}</span><code class="language-${lang}" ${styles(`code`)}>${highlighted}</code></pre>`
const span = `<span class="mac-sign" style="padding: 10px 14px 0;" hidden>${macCodeSvg}</span>`
const code = `<code class="language-${lang}" ${styles(`code`)}>${highlighted}</code>`
return `<pre class="hljs code__pre" ${styles(`code_pre`)}>${span}${code}</pre>`
},

codespan({ text }: Tokens.Codespan): string {
Expand Down Expand Up @@ -254,7 +252,7 @@ export function initRenderer(opts: IOpts) {
return styledContent(`td`, text)
},

hr(): string {
hr(_: Tokens.Hr): string {
return styledContent(`hr`, ``)
},
}
Expand Down
Loading