@hex-core/components 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_tsup-dts-rollup.d.ts +3105 -0
- package/dist/accordion.d.ts +4 -13
- package/dist/alert-dialog.d.ts +11 -34
- package/dist/alert.d.ts +4 -17
- package/dist/aspect-ratio.d.ts +1 -7
- package/dist/avatar.d.ts +3 -11
- package/dist/badge.d.ts +3 -22
- package/dist/breadcrumb.d.ts +7 -27
- package/dist/button.d.ts +3 -13
- package/dist/calendar.d.ts +1 -17
- package/dist/card.d.ts +6 -16
- package/dist/checkbox.d.ts +2 -11
- package/dist/citation.d.ts +2 -0
- package/dist/citation.js +70 -0
- package/dist/citation.js.map +1 -0
- package/dist/cluster.d.ts +3 -34
- package/dist/code-block-copy.d.ts +2 -0
- package/dist/code-block-copy.js +108 -0
- package/dist/code-block-copy.js.map +1 -0
- package/dist/code-block.d.ts +3 -0
- package/dist/code-block.js +90 -0
- package/dist/code-block.js.map +1 -0
- package/dist/collapsible.d.ts +3 -11
- package/dist/color-picker.d.ts +2 -44
- package/dist/combobox.d.ts +3 -45
- package/dist/command.d.ts +9 -111
- package/dist/composer.d.ts +2 -0
- package/dist/composer.js +75 -0
- package/dist/composer.js.map +1 -0
- package/dist/container.d.ts +3 -41
- package/dist/context-menu.d.ts +12 -37
- package/dist/data-table.d.ts +2 -33
- package/dist/date-picker.d.ts +2 -43
- package/dist/dialog.d.ts +11 -46
- package/dist/drawer.d.ts +10 -41
- package/dist/dropdown-menu.d.ts +13 -39
- package/dist/dropzone.d.ts +3 -54
- package/dist/file-tree.d.ts +3 -53
- package/dist/form.d.ts +8 -45
- package/dist/grid.d.ts +3 -50
- package/dist/hover-card.d.ts +3 -11
- package/dist/index.d.ts +298 -179
- package/dist/index.js +674 -1
- package/dist/index.js.map +1 -1
- package/dist/input-otp.d.ts +5 -19
- package/dist/input.d.ts +2 -6
- package/dist/label.d.ts +2 -11
- package/dist/loading-indicator.d.ts +3 -0
- package/dist/loading-indicator.js +64 -0
- package/dist/loading-indicator.js.map +1 -0
- package/dist/markdown.d.ts +2 -0
- package/dist/markdown.js +28 -0
- package/dist/markdown.js.map +1 -0
- package/dist/menubar.d.ts +11 -35
- package/dist/message-actions.d.ts +2 -0
- package/dist/message-actions.js +28 -0
- package/dist/message-actions.js.map +1 -0
- package/dist/message-list.d.ts +2 -0
- package/dist/message-list.js +49 -0
- package/dist/message-list.js.map +1 -0
- package/dist/message.d.ts +3 -0
- package/dist/message.js +35 -0
- package/dist/message.js.map +1 -0
- package/dist/multi-combobox.d.ts +3 -51
- package/dist/navigation-menu.d.ts +9 -23
- package/dist/pagination.d.ts +7 -40
- package/dist/popover.d.ts +4 -13
- package/dist/progress.d.ts +1 -10
- package/dist/radio-group.d.ts +2 -9
- package/dist/reasoning.d.ts +2 -0
- package/dist/reasoning.js +90 -0
- package/dist/reasoning.js.map +1 -0
- package/dist/resizable.d.ts +3 -28
- package/dist/schemas.d.ts +72 -121
- package/dist/schemas.js +849 -1
- package/dist/schemas.js.map +1 -1
- package/dist/scroll-area.d.ts +3 -18
- package/dist/select.d.ts +8 -21
- package/dist/separator.d.ts +2 -11
- package/dist/sheet.d.ts +10 -39
- package/dist/sidebar.d.ts +8 -75
- package/dist/skeleton.d.ts +1 -11
- package/dist/slider.d.ts +2 -20
- package/dist/sonner.d.ts +2 -14
- package/dist/spacer.d.ts +3 -38
- package/dist/stack.d.ts +3 -34
- package/dist/stepper.d.ts +4 -48
- package/dist/suggestion.d.ts +2 -0
- package/dist/suggestion.js +55 -0
- package/dist/suggestion.js.map +1 -0
- package/dist/switch.d.ts +2 -11
- package/dist/table.d.ts +8 -24
- package/dist/tabs.d.ts +4 -13
- package/dist/textarea.d.ts +2 -10
- package/dist/time-picker.d.ts +2 -34
- package/dist/timeline.d.ts +4 -42
- package/dist/toggle-group.d.ts +2 -17
- package/dist/toggle.d.ts +2 -19
- package/dist/tool-call.d.ts +2 -0
- package/dist/tool-call.js +133 -0
- package/dist/tool-call.js.map +1 -0
- package/dist/tooltip.d.ts +4 -13
- package/package.json +4 -1
- package/dist/button-variants-Bx6gCUFp.d.ts +0 -19
package/dist/accordion.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const Accordion: React.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
-
/** A single collapsible item within an Accordion. */
|
|
7
|
-
declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
-
/** The clickable header that toggles an AccordionItem open/closed. */
|
|
9
|
-
declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
-
/** The collapsible content panel of an AccordionItem. */
|
|
11
|
-
declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
-
|
|
13
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
1
|
+
export { Accordion_alias_1 as Accordion } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { AccordionItem_alias_1 as AccordionItem } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { AccordionTrigger_alias_1 as AccordionTrigger } from './_tsup-dts-rollup.js';
|
|
4
|
+
export { AccordionContent_alias_1 as AccordionContent } from './_tsup-dts-rollup.js';
|
package/dist/alert-dialog.d.ts
CHANGED
|
@@ -1,34 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
declare const AlertDialogOverlay: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
-
/** Content panel for the alert dialog. No close button — user must choose action or cancel. */
|
|
14
|
-
declare const AlertDialogContent: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
-
/**
|
|
16
|
-
* Header container for title + description.
|
|
17
|
-
* @returns A div wrapping title/description with vertical rhythm
|
|
18
|
-
*/
|
|
19
|
-
declare function AlertDialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
20
|
-
/**
|
|
21
|
-
* Footer container for Cancel/Action buttons.
|
|
22
|
-
* @returns A div stacking buttons on mobile and right-aligning on desktop
|
|
23
|
-
*/
|
|
24
|
-
declare function AlertDialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
25
|
-
/** Accessible title for the alert dialog. */
|
|
26
|
-
declare const AlertDialogTitle: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
27
|
-
/** Accessible description for the alert dialog. */
|
|
28
|
-
declare const AlertDialogDescription: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
29
|
-
/** The destructive action button (e.g. Delete). Receives focus by default. */
|
|
30
|
-
declare const AlertDialogAction: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
31
|
-
/** The cancel button. Closes the dialog. */
|
|
32
|
-
declare const AlertDialogCancel: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
33
|
-
|
|
34
|
-
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
|
|
1
|
+
export { AlertDialog_alias_1 as AlertDialog } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { AlertDialogPortal_alias_1 as AlertDialogPortal } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { AlertDialogOverlay_alias_1 as AlertDialogOverlay } from './_tsup-dts-rollup.js';
|
|
4
|
+
export { AlertDialogTrigger_alias_1 as AlertDialogTrigger } from './_tsup-dts-rollup.js';
|
|
5
|
+
export { AlertDialogContent_alias_1 as AlertDialogContent } from './_tsup-dts-rollup.js';
|
|
6
|
+
export { AlertDialogHeader_alias_1 as AlertDialogHeader } from './_tsup-dts-rollup.js';
|
|
7
|
+
export { AlertDialogFooter_alias_1 as AlertDialogFooter } from './_tsup-dts-rollup.js';
|
|
8
|
+
export { AlertDialogTitle_alias_1 as AlertDialogTitle } from './_tsup-dts-rollup.js';
|
|
9
|
+
export { AlertDialogDescription_alias_1 as AlertDialogDescription } from './_tsup-dts-rollup.js';
|
|
10
|
+
export { AlertDialogAction_alias_1 as AlertDialogAction } from './_tsup-dts-rollup.js';
|
|
11
|
+
export { AlertDialogCancel_alias_1 as AlertDialogCancel } from './_tsup-dts-rollup.js';
|
package/dist/alert.d.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const alertVariants: (props?: ({
|
|
6
|
-
variant?: "default" | "destructive" | null | undefined;
|
|
7
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
8
|
-
/** An inline notification banner for important messages. */
|
|
9
|
-
declare const Alert: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
10
|
-
variant?: "default" | "destructive" | null | undefined;
|
|
11
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
-
/** The alert title heading. */
|
|
13
|
-
declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
|
|
14
|
-
/** The alert description. Renders a div so paragraph children can be styled via [&_p]. */
|
|
15
|
-
declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
-
|
|
17
|
-
export { Alert, AlertDescription, AlertTitle, alertVariants };
|
|
1
|
+
export { Alert_alias_1 as Alert } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { AlertTitle_alias_1 as AlertTitle } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { AlertDescription_alias_1 as AlertDescription } from './_tsup-dts-rollup.js';
|
|
4
|
+
export { alertVariants_alias_1 as alertVariants } from './_tsup-dts-rollup.js';
|
package/dist/aspect-ratio.d.ts
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio';
|
|
3
|
-
|
|
4
|
-
/** A container that maintains a specified width-to-height ratio for its children. */
|
|
5
|
-
declare const AspectRatio: React.ForwardRefExoticComponent<AspectRatioPrimitive.AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
-
|
|
7
|
-
export { AspectRatio };
|
|
1
|
+
export { AspectRatio_alias_1 as AspectRatio } from './_tsup-dts-rollup.js';
|
package/dist/avatar.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/** Root container for an avatar (image + fallback). */
|
|
5
|
-
declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
-
/** Avatar image. AvatarFallback renders in its place when the image is missing or errors. */
|
|
7
|
-
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
8
|
-
/** Fallback content (usually initials or an icon) shown when the image is missing or fails. Supports delayMs to avoid flashing for fast-loading images. */
|
|
9
|
-
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
10
|
-
|
|
11
|
-
export { Avatar, AvatarFallback, AvatarImage };
|
|
1
|
+
export { Avatar_alias_1 as Avatar } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { AvatarImage_alias_1 as AvatarImage } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { AvatarFallback_alias_1 as AvatarFallback } from './_tsup-dts-rollup.js';
|
package/dist/badge.d.ts
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
|
|
6
|
-
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "secondary" | "destructive" | "outline" | null | undefined;
|
|
8
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
|
-
/**
|
|
10
|
-
* A small status indicator badge with multiple style variants.
|
|
11
|
-
* Used for tags, statuses, counts, and categorization.
|
|
12
|
-
*/
|
|
13
|
-
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Renders an inline badge element with variant-based styling.
|
|
17
|
-
* @param props - Badge props including variant and className
|
|
18
|
-
* @returns A styled div element
|
|
19
|
-
*/
|
|
20
|
-
declare function Badge({ className, variant, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
21
|
-
|
|
22
|
-
export { Badge, type BadgeProps, badgeVariants };
|
|
1
|
+
export { BadgeProps_alias_1 as BadgeProps } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { Badge_alias_1 as Badge } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { badgeVariants_alias_1 as badgeVariants } from './_tsup-dts-rollup.js';
|
package/dist/breadcrumb.d.ts
CHANGED
|
@@ -1,27 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/** A single breadcrumb list item. */
|
|
9
|
-
declare const BreadcrumbItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
10
|
-
/** A link inside a breadcrumb item. Use asChild to render e.g. Next.js Link. */
|
|
11
|
-
declare const BreadcrumbLink: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
|
|
12
|
-
asChild?: boolean;
|
|
13
|
-
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
14
|
-
/** The final breadcrumb (current page). Not interactive. */
|
|
15
|
-
declare const BreadcrumbPage: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
16
|
-
/**
|
|
17
|
-
* Visual separator between breadcrumb items (chevron by default).
|
|
18
|
-
* @returns An li rendering a decorative chevron icon
|
|
19
|
-
*/
|
|
20
|
-
declare function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<"li">): react_jsx_runtime.JSX.Element;
|
|
21
|
-
/**
|
|
22
|
-
* Ellipsis for truncated breadcrumb trails.
|
|
23
|
-
* @returns A span containing a decorative SVG (aria-hidden) plus a sr-only "More pages" label for AT.
|
|
24
|
-
*/
|
|
25
|
-
declare function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
|
|
26
|
-
|
|
27
|
-
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
|
|
1
|
+
export { Breadcrumb_alias_1 as Breadcrumb } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { BreadcrumbList_alias_1 as BreadcrumbList } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { BreadcrumbItem_alias_1 as BreadcrumbItem } from './_tsup-dts-rollup.js';
|
|
4
|
+
export { BreadcrumbLink_alias_1 as BreadcrumbLink } from './_tsup-dts-rollup.js';
|
|
5
|
+
export { BreadcrumbPage_alias_1 as BreadcrumbPage } from './_tsup-dts-rollup.js';
|
|
6
|
+
export { BreadcrumbSeparator_alias_1 as BreadcrumbSeparator } from './_tsup-dts-rollup.js';
|
|
7
|
+
export { BreadcrumbEllipsis_alias_1 as BreadcrumbEllipsis } from './_tsup-dts-rollup.js';
|
package/dist/button.d.ts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
import 'class-variance-authority/types';
|
|
5
|
-
import 'class-variance-authority';
|
|
6
|
-
|
|
7
|
-
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, ButtonVariantsProps {
|
|
8
|
-
asChild?: boolean;
|
|
9
|
-
loading?: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
12
|
-
|
|
13
|
-
export { Button, type ButtonProps };
|
|
1
|
+
export { ButtonProps_alias_1 as ButtonProps } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { Button_alias_1 as Button } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { buttonVariants_alias_2 as buttonVariants } from './_tsup-dts-rollup.js';
|
package/dist/calendar.d.ts
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { DayPicker } from 'react-day-picker';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Calendar date grid built on react-day-picker v9. Forwards all DayPicker
|
|
7
|
-
* props. Pair `mode` + `selected` + `onSelect` for selection control;
|
|
8
|
-
* pass `captionLayout="dropdown"` with `startMonth`/`endMonth` for
|
|
9
|
-
* native year-dropdown navigation.
|
|
10
|
-
* @returns A themed react-day-picker instance with our dropdown overlay CSS.
|
|
11
|
-
*/
|
|
12
|
-
declare function Calendar({ className, classNames, showOutsideDays, ...props }: React.ComponentProps<typeof DayPicker>): react_jsx_runtime.JSX.Element;
|
|
13
|
-
declare namespace Calendar {
|
|
14
|
-
var displayName: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { Calendar };
|
|
1
|
+
export { Calendar_alias_1 as Calendar } from './_tsup-dts-rollup.js';
|
package/dist/card.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/** The title element inside a CardHeader. */
|
|
8
|
-
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
|
|
9
|
-
/** A description element inside a CardHeader. */
|
|
10
|
-
declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
11
|
-
/** The main content area of a Card. */
|
|
12
|
-
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
-
/** The footer section of a Card. */
|
|
14
|
-
declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
-
|
|
16
|
-
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
1
|
+
export { Card_alias_1 as Card } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { CardHeader_alias_1 as CardHeader } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { CardFooter_alias_1 as CardFooter } from './_tsup-dts-rollup.js';
|
|
4
|
+
export { CardTitle_alias_1 as CardTitle } from './_tsup-dts-rollup.js';
|
|
5
|
+
export { CardDescription_alias_1 as CardDescription } from './_tsup-dts-rollup.js';
|
|
6
|
+
export { CardContent_alias_1 as CardContent } from './_tsup-dts-rollup.js';
|
package/dist/checkbox.d.ts
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* An accessible checkbox component built on Radix UI.
|
|
6
|
-
* Supports checked, unchecked, and indeterminate states with smooth animations.
|
|
7
|
-
*/
|
|
8
|
-
type CheckboxProps = React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>;
|
|
9
|
-
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
-
|
|
11
|
-
export { Checkbox, type CheckboxProps };
|
|
1
|
+
export { CheckboxProps_alias_1 as CheckboxProps } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { Checkbox_alias_1 as Checkbox } from './_tsup-dts-rollup.js';
|
package/dist/citation.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/lib/utils.ts
|
|
6
|
+
function cn(...inputs) {
|
|
7
|
+
return twMerge(clsx(inputs));
|
|
8
|
+
}
|
|
9
|
+
function Citation({ title, url, page, index, className, children }) {
|
|
10
|
+
const baseClasses = cn(
|
|
11
|
+
"inline-flex items-center gap-1.5 rounded-md border border-foreground/15 bg-card px-2 py-0.5 text-xs",
|
|
12
|
+
"transition-all duration-[var(--duration-normal,200ms)] ease-out",
|
|
13
|
+
className
|
|
14
|
+
);
|
|
15
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16
|
+
typeof index === "number" ? /* @__PURE__ */ jsxs("span", { className: "font-mono text-[10px] font-semibold text-muted-foreground", children: [
|
|
17
|
+
"[",
|
|
18
|
+
index,
|
|
19
|
+
"]"
|
|
20
|
+
] }) : /* @__PURE__ */ jsx(DocGlyph, {}),
|
|
21
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-foreground", children: title }),
|
|
22
|
+
typeof page === "number" ? /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
23
|
+
"p.",
|
|
24
|
+
page
|
|
25
|
+
] }) : null,
|
|
26
|
+
children
|
|
27
|
+
] });
|
|
28
|
+
if (url) {
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
"a",
|
|
31
|
+
{
|
|
32
|
+
href: url,
|
|
33
|
+
target: "_blank",
|
|
34
|
+
rel: "noreferrer noopener",
|
|
35
|
+
className: cn(
|
|
36
|
+
baseClasses,
|
|
37
|
+
"hover:border-foreground/30 hover:bg-secondary/40 hover:shadow-sm",
|
|
38
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
|
39
|
+
),
|
|
40
|
+
children: body
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return /* @__PURE__ */ jsx("span", { className: baseClasses, children: body });
|
|
45
|
+
}
|
|
46
|
+
function DocGlyph() {
|
|
47
|
+
return /* @__PURE__ */ jsxs(
|
|
48
|
+
"svg",
|
|
49
|
+
{
|
|
50
|
+
"aria-hidden": true,
|
|
51
|
+
viewBox: "0 0 16 16",
|
|
52
|
+
width: "11",
|
|
53
|
+
height: "11",
|
|
54
|
+
fill: "none",
|
|
55
|
+
stroke: "currentColor",
|
|
56
|
+
strokeWidth: "1.5",
|
|
57
|
+
strokeLinecap: "round",
|
|
58
|
+
strokeLinejoin: "round",
|
|
59
|
+
className: "shrink-0 text-muted-foreground",
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsx("path", { d: "M9 1.5H4.5A1.5 1.5 0 0 0 3 3v10a1.5 1.5 0 0 0 1.5 1.5h7A1.5 1.5 0 0 0 13 13V5.5L9 1.5z" }),
|
|
62
|
+
/* @__PURE__ */ jsx("path", { d: "M9 1.5V5.5h4" })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { Citation };
|
|
69
|
+
//# sourceMappingURL=citation.js.map
|
|
70
|
+
//# sourceMappingURL=citation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts","../src/ai/citation/citation.tsx"],"names":[],"mappings":";;;;;AAQO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACyBA,SAAS,QAAA,CAAS,EAAE,KAAA,EAAO,GAAA,EAAK,MAAM,KAAA,EAAO,SAAA,EAAW,UAAS,EAAkB;AAClF,EAAA,MAAM,WAAA,GAAc,EAAA;AAAA,IACnB,qGAAA;AAAA,IACA,iEAAA;AAAA,IACA;AAAA,GACD;AAEA,EAAA,MAA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O,cAAA;AAAA,MACP,WAAA,EAAY,KAAA;AAAA,MACZ,aAAA,EAAc,OAAA;AAAA,MACd,cAAA,EAAe,OAAA;AAAA,MACf,SAAA,EAAU,gCAAA;AAAA,MAEV,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,GAAE,wFAAA,EAAyF,CAAA;AAAA,wBACjG,GAAA,CAAC,MAAA,EAAA,EAAK,CAAA,EAAE,cAAA,EAAe;AAAA;AAAA;AAAA,GACxB;AAEF","file":"citation.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind CSS conflict resolution.\n * @param inputs - Class values (strings, arrays, objects) to merge\n * @returns A single merged class string with Tailwind conflicts resolved\n */\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","import * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\n\n/**\n * Source attribution chip — renders a citation for a RAG hit, search\n * result, or any external reference the assistant pulled from. Becomes a\n * clickable anchor when `url` is provided; otherwise a static span.\n *\n * @example\n * <Citation title=\"auth-overview.md\" url={src.url} page={3} />\n * @example\n * <Cluster gap=\"xs\">\n * {sources.map((s, i) => (\n * <Citation key={s.id} title={s.title} url={s.url} index={i + 1} />\n * ))}\n * </Cluster>\n */\nexport interface CitationProps {\n\ttitle: string;\n\turl?: string;\n\tpage?: number;\n\t/** Numeric index for inline footnote-style display (e.g. \"[1] auth.md\"). */\n\tindex?: number;\n\tclassName?: string;\n\tchildren?: React.ReactNode;\n}\n\n/**\n * Renders a source citation chip. Uses an `<a>` when `url` is set so the\n * chip is keyboard-focusable + opens in a new tab; falls back to a\n * non-interactive span otherwise.\n *\n * @param props - title + optional url, page, index\n * @returns An anchor or span styled as a chip\n */\nfunction Citation({ title, url, page, index, className, children }: CitationProps) {\n\tconst baseClasses = cn(\n\t\t\"inline-flex items-center gap-1.5 rounded-md border border-foreground/15 bg-card px-2 py-0.5 text-xs\",\n\t\t\"transition-all duration-[var(--duration-normal,200ms)] ease-out\",\n\t\tclassName,\n\t);\n\n\tconst body = (\n\t\t<>\n\t\t\t{typeof index === \"number\" ? (\n\t\t\t\t<span className=\"font-mono text-[10px] font-semibold text-muted-foreground\">[{index}]</span>\n\t\t\t) : (\n\t\t\t\t<DocGlyph />\n\t\t\t)}\n\t\t\t<span className=\"truncate text-foreground\">{title}</span>\n\t\t\t{typeof page === \"number\" ? (\n\t\t\t\t<span className=\"text-muted-foreground\">p.{page}</span>\n\t\t\t) : null}\n\t\t\t{children}\n\t\t</>\n\t);\n\n\tif (url) {\n\t\treturn (\n\t\t\t<a\n\t\t\t\thref={url}\n\t\t\t\ttarget=\"_blank\"\n\t\t\t\trel=\"noreferrer noopener\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\tbaseClasses,\n\t\t\t\t\t\"hover:border-foreground/30 hover:bg-secondary/40 hover:shadow-sm\",\n\t\t\t\t\t\"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{body}\n\t\t\t</a>\n\t\t);\n\t}\n\n\treturn <span className={baseClasses}>{body}</span>;\n}\n\nfunction DocGlyph() {\n\treturn (\n\t\t<svg\n\t\t\taria-hidden\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\twidth=\"11\"\n\t\t\theight=\"11\"\n\t\t\tfill=\"none\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeWidth=\"1.5\"\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t\tclassName=\"shrink-0 text-muted-foreground\"\n\t\t>\n\t\t\t<path d=\"M9 1.5H4.5A1.5 1.5 0 0 0 3 3v10a1.5 1.5 0 0 0 1.5 1.5h7A1.5 1.5 0 0 0 13 13V5.5L9 1.5z\" />\n\t\t\t<path d=\"M9 1.5V5.5h4\" />\n\t\t</svg>\n\t);\n}\n\nexport { Citation };\n"]}
|
package/dist/cluster.d.ts
CHANGED
|
@@ -1,34 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* CVA variants for Cluster — horizontal flex flow with wrap.
|
|
8
|
-
* `gap` and `justify` pull from shared layout-variant maps; `align` adds
|
|
9
|
-
* `baseline` (text-baseline alignment for mixed-size siblings).
|
|
10
|
-
*/
|
|
11
|
-
declare const clusterVariants: (props?: ({
|
|
12
|
-
gap?: "sm" | "lg" | "md" | "xl" | "xs" | null | undefined;
|
|
13
|
-
align?: "center" | "start" | "end" | "stretch" | "baseline" | null | undefined;
|
|
14
|
-
justify?: "center" | "start" | "end" | "between" | null | undefined;
|
|
15
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
16
|
-
/** Props for the Cluster component. */
|
|
17
|
-
interface ClusterProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof clusterVariants> {
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Horizontal flex flow with wrap. Children flow left-to-right and wrap to next line as needed.
|
|
21
|
-
* @param props - Cluster props including `gap`, `align`, and `justify` variant keys.
|
|
22
|
-
* @returns A flex row that wraps with consistent gap.
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* <Cluster gap="sm">
|
|
26
|
-
* <Badge>react</Badge>
|
|
27
|
-
* <Badge>typescript</Badge>
|
|
28
|
-
* <Badge>tailwind</Badge>
|
|
29
|
-
* </Cluster>
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
declare function Cluster({ className, gap, align, justify, ...props }: ClusterProps): react_jsx_runtime.JSX.Element;
|
|
33
|
-
|
|
34
|
-
export { Cluster, type ClusterProps, clusterVariants };
|
|
1
|
+
export { ClusterProps_alias_1 as ClusterProps } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { Cluster_alias_1 as Cluster } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { clusterVariants_alias_1 as clusterVariants } from './_tsup-dts-rollup.js';
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
function cn(...inputs) {
|
|
8
|
+
return twMerge(clsx(inputs));
|
|
9
|
+
}
|
|
10
|
+
var RESET_DELAY_MS = 1500;
|
|
11
|
+
function CodeBlockCopy({ code, className, ...props }) {
|
|
12
|
+
const [state, setState] = React.useState("idle");
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
if (state === "idle") return;
|
|
15
|
+
const id = window.setTimeout(() => setState("idle"), RESET_DELAY_MS);
|
|
16
|
+
return () => window.clearTimeout(id);
|
|
17
|
+
}, [state]);
|
|
18
|
+
async function handleClick() {
|
|
19
|
+
try {
|
|
20
|
+
await navigator.clipboard.writeText(code);
|
|
21
|
+
setState("copied");
|
|
22
|
+
} catch {
|
|
23
|
+
setState("error");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const ariaLabel = state === "copied" ? "Copied" : state === "error" ? "Copy failed" : "Copy code";
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
"button",
|
|
29
|
+
{
|
|
30
|
+
type: "button",
|
|
31
|
+
onClick: handleClick,
|
|
32
|
+
"aria-label": ariaLabel,
|
|
33
|
+
title: ariaLabel,
|
|
34
|
+
className: cn(
|
|
35
|
+
"inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground",
|
|
36
|
+
"transition-all duration-[var(--duration-normal,200ms)] ease-out",
|
|
37
|
+
"hover:bg-foreground/10 hover:text-foreground",
|
|
38
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
39
|
+
className
|
|
40
|
+
),
|
|
41
|
+
...props,
|
|
42
|
+
children: state === "copied" ? /* @__PURE__ */ jsx(CheckGlyph, {}) : state === "error" ? /* @__PURE__ */ jsx(ErrorGlyph, {}) : /* @__PURE__ */ jsx(CopyGlyph, {})
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
function CopyGlyph() {
|
|
47
|
+
return /* @__PURE__ */ jsxs(
|
|
48
|
+
"svg",
|
|
49
|
+
{
|
|
50
|
+
"aria-hidden": true,
|
|
51
|
+
viewBox: "0 0 16 16",
|
|
52
|
+
width: "13",
|
|
53
|
+
height: "13",
|
|
54
|
+
fill: "none",
|
|
55
|
+
stroke: "currentColor",
|
|
56
|
+
strokeWidth: "1.5",
|
|
57
|
+
strokeLinecap: "round",
|
|
58
|
+
strokeLinejoin: "round",
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ jsx("rect", { x: "5", y: "5", width: "9", height: "9", rx: "1.5" }),
|
|
61
|
+
/* @__PURE__ */ jsx("path", { d: "M11 5V3.5A1.5 1.5 0 0 0 9.5 2h-6A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5" })
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function CheckGlyph() {
|
|
67
|
+
return /* @__PURE__ */ jsx(
|
|
68
|
+
"svg",
|
|
69
|
+
{
|
|
70
|
+
"aria-hidden": true,
|
|
71
|
+
viewBox: "0 0 16 16",
|
|
72
|
+
width: "13",
|
|
73
|
+
height: "13",
|
|
74
|
+
fill: "none",
|
|
75
|
+
stroke: "currentColor",
|
|
76
|
+
strokeWidth: "1.5",
|
|
77
|
+
strokeLinecap: "round",
|
|
78
|
+
strokeLinejoin: "round",
|
|
79
|
+
className: "text-emerald-500",
|
|
80
|
+
children: /* @__PURE__ */ jsx("path", { d: "M3 8l3.5 3.5L13 5" })
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
function ErrorGlyph() {
|
|
85
|
+
return /* @__PURE__ */ jsxs(
|
|
86
|
+
"svg",
|
|
87
|
+
{
|
|
88
|
+
"aria-hidden": true,
|
|
89
|
+
viewBox: "0 0 16 16",
|
|
90
|
+
width: "13",
|
|
91
|
+
height: "13",
|
|
92
|
+
fill: "none",
|
|
93
|
+
stroke: "currentColor",
|
|
94
|
+
strokeWidth: "1.5",
|
|
95
|
+
strokeLinecap: "round",
|
|
96
|
+
strokeLinejoin: "round",
|
|
97
|
+
className: "text-destructive",
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6.5" }),
|
|
100
|
+
/* @__PURE__ */ jsx("path", { d: "M8 5v3.5M8 11v.01" })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { CodeBlockCopy };
|
|
107
|
+
//# sourceMappingURL=code-block-copy.js.map
|
|
108
|
+
//# sourceMappingURL=code-block-copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts","../src/ai/code-block/code-block-copy.tsx"],"names":[],"mappings":";;;;;AAQO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACLA,IAAM,cAAA,GAAiB,IAAA;AAyBvB,SAAS,cAAc,EAAE,IAAA,EAAM,SAAA,EAAW,GAAG,OAAM,EAAuB;AACzE,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAU,eAAoB,MAAM,CAAA;AAE1D,EAAM,gBAAU,MAAM;AACrB,IAAA,IAAI,UAAU,MAAA,EAAQ;AACtB,IAAA,MAAM,KAAK,MAAA,CAAO,UAAA,CAAW,MAAM,QAAA,CAAS,MAAM,GAAG,cAAc,CAAA;AACnE,IAAA,OAAO,MAAM,MAAA,CAAO,YAAA,CAAa,EAAE,CA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AAA,EAAI,EAAA,EAAG,GAAA,EAAI,GAAE,KAAA,EAAM,CAAA;AAAA,wBAC9B,GAAA,CAAC,MAAA,EAAA,EAAK,CAAA,EAAE,mBAAA,EAAoB;AAAA;AAAA;AAAA,GAC7B;AAEF","file":"code-block-copy.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind CSS conflict resolution.\n * @param inputs - Class values (strings, arrays, objects) to merge\n * @returns A single merged class string with Tailwind conflicts resolved\n */\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\n\nconst RESET_DELAY_MS = 1500;\n\n/**\n * Copy-to-clipboard button for the `CodeBlock` header. Lives in a\n * client-only file so the surrounding `CodeBlock` (an async Server\n * Component) can render server-side while this island hydrates on the\n * client for `navigator.clipboard` access.\n *\n * @example\n * <CodeBlockCopy code={code} />\n */\nexport interface CodeBlockCopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n\t/** The code text to copy. Must be plain text (not the highlighted HTML). */\n\tcode: string;\n}\n\n/**\n * Renders the copy button. Switches to a check icon for ~1.5s after a\n * successful copy.\n *\n * @param props - the raw code string\n * @returns A button that copies on click\n */\ntype CopyState = \"idle\" | \"copied\" | \"error\";\n\nfunction CodeBlockCopy({ code, className, ...props }: CodeBlockCopyProps) {\n\tconst [state, setState] = React.useState<CopyState>(\"idle\");\n\n\tReact.useEffect(() => {\n\t\tif (state === \"idle\") return;\n\t\tconst id = window.setTimeout(() => setState(\"idle\"), RESET_DELAY_MS);\n\t\treturn () => window.clearTimeout(id);\n\t}, [state]);\n\n\tasync function handleClick() {\n\t\ttry {\n\t\t\tawait navigator.clipboard.writeText(code);\n\t\t\tsetState(\"copied\");\n\t\t} catch {\n\t\t\tsetState(\"error\");\n\t\t}\n\t}\n\n\tconst ariaLabel =\n\t\tstate === \"copied\" ? \"Copied\" : state === \"error\" ? \"Copy failed\" : \"Copy code\";\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonClick={handleClick}\n\t\t\taria-label={ariaLabel}\n\t\t\ttitle={ariaLabel}\n\t\t\tclassName={cn(\n\t\t\t\t\"inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground\",\n\t\t\t\t\"transition-all duration-[var(--duration-normal,200ms)] ease-out\",\n\t\t\t\t\"hover:bg-foreground/10 hover:text-foreground\",\n\t\t\t\t\"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{state === \"copied\" ? <CheckGlyph /> : state === \"error\" ? <ErrorGlyph /> : <CopyGlyph />}\n\t\t</button>\n\t);\n}\n\nfunction CopyGlyph() {\n\treturn (\n\t\t<svg\n\t\t\taria-hidden\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\twidth=\"13\"\n\t\t\theight=\"13\"\n\t\t\tfill=\"none\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeWidth=\"1.5\"\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t>\n\t\t\t<rect x=\"5\" y=\"5\" width=\"9\" height=\"9\" rx=\"1.5\" />\n\t\t\t<path d=\"M11 5V3.5A1.5 1.5 0 0 0 9.5 2h-6A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5\" />\n\t\t</svg>\n\t);\n}\n\nfunction CheckGlyph() {\n\treturn (\n\t\t<svg\n\t\t\taria-hidden\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\twidth=\"13\"\n\t\t\theight=\"13\"\n\t\t\tfill=\"none\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeWidth=\"1.5\"\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t\tclassName=\"text-emerald-500\"\n\t\t>\n\t\t\t<path d=\"M3 8l3.5 3.5L13 5\" />\n\t\t</svg>\n\t);\n}\n\nfunction ErrorGlyph() {\n\treturn (\n\t\t<svg\n\t\t\taria-hidden\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\twidth=\"13\"\n\t\t\theight=\"13\"\n\t\t\tfill=\"none\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeWidth=\"1.5\"\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t\tclassName=\"text-destructive\"\n\t\t>\n\t\t\t<circle cx=\"8\" cy=\"8\" r=\"6.5\" />\n\t\t\t<path d=\"M8 5v3.5M8 11v.01\" />\n\t\t</svg>\n\t);\n}\n\nexport { CodeBlockCopy };\n"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { cache } from 'react';
|
|
2
|
+
import { codeToHtml } from 'shiki';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { CodeBlockCopy } from './code-block-copy.js';
|
|
6
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
// src/ai/code-block/code-block.tsx
|
|
9
|
+
function cn(...inputs) {
|
|
10
|
+
return twMerge(clsx(inputs));
|
|
11
|
+
}
|
|
12
|
+
var LABEL_TO_LANG = {
|
|
13
|
+
pnpm: "bash",
|
|
14
|
+
npm: "bash",
|
|
15
|
+
yarn: "bash",
|
|
16
|
+
bun: "bash",
|
|
17
|
+
bash: "bash",
|
|
18
|
+
sh: "bash",
|
|
19
|
+
shell: "bash",
|
|
20
|
+
zsh: "bash",
|
|
21
|
+
ts: "ts",
|
|
22
|
+
typescript: "ts",
|
|
23
|
+
tsx: "tsx",
|
|
24
|
+
js: "js",
|
|
25
|
+
javascript: "js",
|
|
26
|
+
jsx: "jsx",
|
|
27
|
+
json: "json",
|
|
28
|
+
css: "css",
|
|
29
|
+
html: "html",
|
|
30
|
+
md: "md",
|
|
31
|
+
markdown: "md",
|
|
32
|
+
py: "py",
|
|
33
|
+
python: "py",
|
|
34
|
+
text: "text",
|
|
35
|
+
prompt: "text",
|
|
36
|
+
plain: "text"
|
|
37
|
+
};
|
|
38
|
+
var DEFAULT_THEMES = { light: "github-light", dark: "github-dark" };
|
|
39
|
+
var cachedCodeToHtml = cache(
|
|
40
|
+
async (code, lang, themesKey, themes) => {
|
|
41
|
+
return codeToHtml(code, { lang, themes, defaultColor: false });
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
function resolveLang(label, language) {
|
|
45
|
+
if (language) return language;
|
|
46
|
+
if (label) {
|
|
47
|
+
const fromLabel = LABEL_TO_LANG[label.toLowerCase()];
|
|
48
|
+
if (fromLabel) return fromLabel;
|
|
49
|
+
}
|
|
50
|
+
return "text";
|
|
51
|
+
}
|
|
52
|
+
async function CodeBlock({
|
|
53
|
+
code,
|
|
54
|
+
label,
|
|
55
|
+
language,
|
|
56
|
+
themes = DEFAULT_THEMES,
|
|
57
|
+
className
|
|
58
|
+
}) {
|
|
59
|
+
const lang = resolveLang(label, language);
|
|
60
|
+
const themesKey = `${themes.light}|${themes.dark}`;
|
|
61
|
+
const html = await cachedCodeToHtml(code, lang, themesKey, themes);
|
|
62
|
+
const displayLabel = label ?? lang;
|
|
63
|
+
return /* @__PURE__ */ jsxs(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
className: cn(
|
|
67
|
+
"group relative overflow-hidden rounded-lg border bg-card text-card-foreground",
|
|
68
|
+
className
|
|
69
|
+
),
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b bg-muted/40 px-3 py-1.5", children: [
|
|
72
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs font-medium text-muted-foreground", children: displayLabel }),
|
|
73
|
+
/* @__PURE__ */ jsx(CodeBlockCopy, { code })
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
"data-shiki": "",
|
|
79
|
+
className: "overflow-x-auto p-4 font-mono text-sm [&_pre]:!bg-transparent",
|
|
80
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { CodeBlock };
|
|
89
|
+
//# sourceMappingURL=code-block.js.map
|
|
90
|
+
//# sourceMappingURL=code-block.js.map
|