feat(astro): add partytown for umami
All checks were successful
build dist / build-dist (push) Successful in 38s
All checks were successful
build dist / build-dist (push) Successful in 38s
This commit is contained in:
parent
7a6857ae31
commit
e82befa2a2
5 changed files with 538 additions and 349 deletions
|
@ -1,59 +1,58 @@
|
|||
import * as React from 'react'
|
||||
import { Slot } from '@radix-ui/react-slot'
|
||||
import { cva, type VariantProps } from 'class-variance-authority'
|
||||
import { Slot } from "@radix-ui/react-slot";
|
||||
import { type VariantProps, cva } from "class-variance-authority";
|
||||
import type * as React from "react";
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const buttonVariants = cva(
|
||||
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default:
|
||||
'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
|
||||
destructive:
|
||||
'bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
||||
outline:
|
||||
'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
||||
secondary:
|
||||
'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
|
||||
ghost:
|
||||
'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
||||
link: 'text-primary underline-offset-4 hover:underline',
|
||||
},
|
||||
size: {
|
||||
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
||||
sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',
|
||||
lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
|
||||
icon: 'size-9',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
},
|
||||
},
|
||||
)
|
||||
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
||||
destructive:
|
||||
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
||||
outline:
|
||||
"border bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
||||
secondary:
|
||||
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
||||
ghost:
|
||||
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
||||
link: "text-primary underline-offset-4 hover:underline",
|
||||
},
|
||||
size: {
|
||||
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
||||
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
||||
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
||||
icon: "size-9",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
size: "default",
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
function Button({
|
||||
className,
|
||||
variant,
|
||||
size,
|
||||
asChild = false,
|
||||
...props
|
||||
}: React.ComponentProps<'button'> &
|
||||
VariantProps<typeof buttonVariants> & {
|
||||
asChild?: boolean
|
||||
}) {
|
||||
const Comp = asChild ? Slot : 'button'
|
||||
className,
|
||||
variant,
|
||||
size,
|
||||
asChild = false,
|
||||
...props
|
||||
}: React.ComponentProps<"button"> &
|
||||
VariantProps<typeof buttonVariants> & {
|
||||
asChild?: boolean;
|
||||
}) {
|
||||
const Comp = asChild ? Slot : "button";
|
||||
|
||||
return (
|
||||
<Comp
|
||||
data-slot="button"
|
||||
className={cn(buttonVariants({ variant, size, className }))}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
return (
|
||||
<Comp
|
||||
data-slot="button"
|
||||
className={cn(buttonVariants({ variant, size, className }))}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export { Button, buttonVariants }
|
||||
export { Button, buttonVariants };
|
||||
|
|
|
@ -1,122 +1,122 @@
|
|||
@reference './global.css';
|
||||
|
||||
@layer components {
|
||||
.prose {
|
||||
@apply text-foreground text-base leading-8;
|
||||
@apply [&>*]:first:mt-0 [&>*]:last:mb-0 [&>section:first-child>*]:mt-0 [&>section:last-child>*]:mb-0;
|
||||
.prose {
|
||||
@apply text-foreground text-base leading-8;
|
||||
@apply [&>*]:first:mt-0 [&>*]:last:mb-0 [&>section:first-child>*]:mt-0 [&>section:last-child>*]:mb-0;
|
||||
|
||||
p {
|
||||
@apply text-foreground/80 my-5 leading-7 not-first:mt-5;
|
||||
}
|
||||
p {
|
||||
@apply text-foreground/80 my-5 leading-7 not-first:mt-5;
|
||||
}
|
||||
|
||||
h1 {
|
||||
@apply text-foreground mt-0 mb-6 scroll-m-20 text-4xl leading-tight font-medium;
|
||||
}
|
||||
h1 {
|
||||
@apply text-foreground mt-0 mb-6 scroll-m-20 text-4xl leading-tight font-medium;
|
||||
}
|
||||
|
||||
h2 {
|
||||
@apply text-foreground mt-8 mb-4 scroll-m-20 text-2xl leading-tight font-medium;
|
||||
}
|
||||
h2 {
|
||||
@apply text-foreground mt-8 mb-4 scroll-m-20 text-2xl leading-tight font-medium;
|
||||
}
|
||||
|
||||
h3 {
|
||||
@apply text-foreground mt-6 mb-4 scroll-m-20 text-xl leading-snug font-medium;
|
||||
}
|
||||
h3 {
|
||||
@apply text-foreground mt-6 mb-4 scroll-m-20 text-xl leading-snug font-medium;
|
||||
}
|
||||
|
||||
h4 {
|
||||
@apply text-foreground mt-6 mb-3 scroll-m-20 text-lg leading-normal font-medium;
|
||||
}
|
||||
h4 {
|
||||
@apply text-foreground mt-6 mb-3 scroll-m-20 text-lg leading-normal font-medium;
|
||||
}
|
||||
|
||||
h5 {
|
||||
@apply text-foreground mt-5 mb-3 scroll-m-20 leading-normal font-medium;
|
||||
}
|
||||
h5 {
|
||||
@apply text-foreground mt-5 mb-3 scroll-m-20 leading-normal font-medium;
|
||||
}
|
||||
|
||||
h6 {
|
||||
@apply text-foreground mt-5 mb-3 scroll-m-20 leading-normal font-medium;
|
||||
}
|
||||
h6 {
|
||||
@apply text-foreground mt-5 mb-3 scroll-m-20 leading-normal font-medium;
|
||||
}
|
||||
|
||||
a {
|
||||
@apply text-foreground decoration-muted-foreground hover:decoration-foreground font-medium break-words underline underline-offset-[3px] transition-colors;
|
||||
}
|
||||
a {
|
||||
@apply text-foreground decoration-muted-foreground hover:decoration-foreground font-medium break-words underline underline-offset-[3px] transition-colors;
|
||||
}
|
||||
|
||||
strong {
|
||||
@apply text-foreground font-medium;
|
||||
}
|
||||
strong {
|
||||
@apply text-foreground font-medium;
|
||||
}
|
||||
|
||||
ul {
|
||||
@apply marker:text-foreground/30 my-5 ml-6 list-disc [&>li]:mt-2;
|
||||
}
|
||||
ul {
|
||||
@apply marker:text-foreground/30 my-5 ml-6 list-disc [&>li]:mt-2;
|
||||
}
|
||||
|
||||
ol {
|
||||
@apply marker:text-foreground/30 my-5 ml-6 list-decimal [&>li]:mt-2;
|
||||
@apply [&[type='A']]:list-[upper-alpha] [&[type='I']]:list-[upper-roman] [&[type='a']]:list-[lower-alpha] [&[type='i']]:list-[lower-roman];
|
||||
}
|
||||
ol {
|
||||
@apply marker:text-foreground/30 my-5 ml-6 list-decimal [&>li]:mt-2;
|
||||
@apply [&[type='A']]:list-[upper-alpha] [&[type='I']]:list-[upper-roman] [&[type='a']]:list-[lower-alpha] [&[type='i']]:list-[lower-roman];
|
||||
}
|
||||
|
||||
li {
|
||||
@apply text-foreground/80 pl-2 leading-7 [&>p]:my-0;
|
||||
}
|
||||
li {
|
||||
@apply text-foreground/80 pl-2 leading-7 [&>p]:my-0;
|
||||
}
|
||||
|
||||
ul ul,
|
||||
ol ol,
|
||||
ul ol,
|
||||
ol ul {
|
||||
@apply marker:text-foreground/30 my-2 ml-6;
|
||||
}
|
||||
ul ul,
|
||||
ol ol,
|
||||
ul ol,
|
||||
ol ul {
|
||||
@apply marker:text-foreground/30 my-2 ml-6;
|
||||
}
|
||||
|
||||
code {
|
||||
@apply bg-muted/50 text-foreground relative rounded-sm px-[0.3rem] py-[0.2rem] text-sm font-medium;
|
||||
@apply [&>span[data-line='']>*]:text-(--shiki-light) dark:[&>span[data-line='']>*]:text-(--shiki-dark);
|
||||
}
|
||||
code {
|
||||
@apply bg-muted/50 text-foreground relative rounded-sm px-[0.3rem] py-[0.2rem] text-sm font-medium;
|
||||
@apply [&>span[data-line='']>*]:text-(--shiki-light) dark:[&>span[data-line='']>*]:text-(--shiki-dark);
|
||||
}
|
||||
|
||||
.expressive-code {
|
||||
@apply my-6 [&_.title]:font-medium!;
|
||||
}
|
||||
.expressive-code {
|
||||
@apply my-6 [&_.title]:font-medium!;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
@apply [&_*]:text-muted-foreground my-6 border-l-2 pl-6;
|
||||
}
|
||||
blockquote {
|
||||
@apply [&_*]:text-muted-foreground my-6 border-l-2 pl-6;
|
||||
}
|
||||
|
||||
hr {
|
||||
@apply border-border my-8 border-t;
|
||||
}
|
||||
hr {
|
||||
@apply border-border my-8 border-t;
|
||||
}
|
||||
|
||||
table {
|
||||
@apply my-8 w-full text-sm;
|
||||
}
|
||||
table {
|
||||
@apply my-8 w-full text-sm;
|
||||
}
|
||||
|
||||
thead {
|
||||
@apply border-muted-foreground/30 border-b;
|
||||
}
|
||||
thead {
|
||||
@apply border-muted-foreground/30 border-b;
|
||||
}
|
||||
|
||||
th {
|
||||
@apply border px-4 py-2 text-left font-medium [&[align=center]]:text-center [&[align=right]]:text-right;
|
||||
}
|
||||
th {
|
||||
@apply border px-4 py-2 text-left font-medium [&[align=center]]:text-center [&[align=right]]:text-right;
|
||||
}
|
||||
|
||||
tbody tr {
|
||||
@apply border-muted-foreground/20 even:bg-muted/50 border-b;
|
||||
}
|
||||
tbody tr {
|
||||
@apply border-muted-foreground/20 even:bg-muted/50 border-b;
|
||||
}
|
||||
|
||||
td {
|
||||
@apply border px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right;
|
||||
}
|
||||
td {
|
||||
@apply border px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right;
|
||||
}
|
||||
|
||||
img,
|
||||
video {
|
||||
@apply my-8;
|
||||
}
|
||||
img,
|
||||
video {
|
||||
@apply my-8;
|
||||
}
|
||||
|
||||
figure {
|
||||
@apply my-8;
|
||||
}
|
||||
figure {
|
||||
@apply my-8;
|
||||
}
|
||||
|
||||
figcaption {
|
||||
@apply text-muted-foreground mt-3 text-sm;
|
||||
}
|
||||
figcaption {
|
||||
@apply text-muted-foreground mt-3 text-sm;
|
||||
}
|
||||
|
||||
kbd {
|
||||
@apply text-foreground bg-muted border-border rounded-md border px-2 py-1 text-xs font-medium shadow-sm;
|
||||
}
|
||||
kbd {
|
||||
@apply text-foreground bg-muted border-border rounded-md border px-2 py-1 text-xs font-medium;
|
||||
}
|
||||
|
||||
.katex-display {
|
||||
@apply my-6 overflow-x-auto overflow-y-hidden tracking-normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
.katex-display {
|
||||
@apply my-6 overflow-x-auto overflow-y-hidden tracking-normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue