@bergetai/ui 0.17.0 → 0.19.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.
Files changed (90) hide show
  1. package/dist/components/alert-dialog/AlertDialog.cjs +3 -3
  2. package/dist/components/alert-dialog/AlertDialog.cjs.map +1 -1
  3. package/dist/components/alert-dialog/AlertDialog.d.cts +3 -3
  4. package/dist/components/alert-dialog/AlertDialog.d.mts +3 -3
  5. package/dist/components/alert-dialog/AlertDialog.mjs +3 -3
  6. package/dist/components/alert-dialog/AlertDialog.mjs.map +1 -1
  7. package/dist/components/box/Box.cjs.map +1 -1
  8. package/dist/components/box/Box.d.cts +3 -3
  9. package/dist/components/box/Box.d.mts +3 -3
  10. package/dist/components/box/Box.mjs.map +1 -1
  11. package/dist/components/button/Button.cjs +3 -1
  12. package/dist/components/button/Button.cjs.map +1 -1
  13. package/dist/components/button/Button.d.cts +1 -1
  14. package/dist/components/button/Button.d.mts +1 -1
  15. package/dist/components/button/Button.mjs +3 -1
  16. package/dist/components/button/Button.mjs.map +1 -1
  17. package/dist/components/code-block/CodeBlock.cjs +50 -48
  18. package/dist/components/code-block/CodeBlock.cjs.map +1 -1
  19. package/dist/components/code-block/CodeBlock.d.cts +27 -7
  20. package/dist/components/code-block/CodeBlock.d.cts.map +1 -1
  21. package/dist/components/code-block/CodeBlock.d.mts +27 -7
  22. package/dist/components/code-block/CodeBlock.d.mts.map +1 -1
  23. package/dist/components/code-block/CodeBlock.mjs +45 -50
  24. package/dist/components/code-block/CodeBlock.mjs.map +1 -1
  25. package/dist/components/code-block/index.d.cts +3 -0
  26. package/dist/components/code-block/index.d.mts +3 -0
  27. package/dist/components/container/Container.cjs.map +1 -1
  28. package/dist/components/container/Container.d.cts +3 -3
  29. package/dist/components/container/Container.d.mts +3 -3
  30. package/dist/components/container/Container.mjs.map +1 -1
  31. package/dist/components/country-select/CountrySelect.cjs +2 -2
  32. package/dist/components/country-select/CountrySelect.cjs.map +1 -1
  33. package/dist/components/country-select/CountrySelect.mjs +2 -2
  34. package/dist/components/country-select/CountrySelect.mjs.map +1 -1
  35. package/dist/components/dialog/Dialog.cjs +3 -3
  36. package/dist/components/dialog/Dialog.cjs.map +1 -1
  37. package/dist/components/dialog/Dialog.d.cts +1 -1
  38. package/dist/components/dialog/Dialog.d.mts +1 -1
  39. package/dist/components/dialog/Dialog.mjs +3 -3
  40. package/dist/components/dialog/Dialog.mjs.map +1 -1
  41. package/dist/components/dropdown-menu/DropdownMenu.cjs.map +1 -1
  42. package/dist/components/dropdown-menu/DropdownMenu.d.cts +9 -9
  43. package/dist/components/dropdown-menu/DropdownMenu.d.mts +9 -9
  44. package/dist/components/dropdown-menu/DropdownMenu.mjs.map +1 -1
  45. package/dist/components/grid/Grid.cjs.map +1 -1
  46. package/dist/components/grid/Grid.d.cts +3 -3
  47. package/dist/components/grid/Grid.d.mts +3 -3
  48. package/dist/components/grid/Grid.mjs.map +1 -1
  49. package/dist/components/item/Item.cjs.map +1 -1
  50. package/dist/components/item/Item.d.cts +1 -1
  51. package/dist/components/item/Item.d.mts +1 -1
  52. package/dist/components/item/Item.mjs.map +1 -1
  53. package/dist/components/typography/Typography.d.cts +1 -1
  54. package/dist/components/typography/Typography.d.mts +1 -1
  55. package/dist/hooks/use-highlighted-code.cjs +58 -0
  56. package/dist/hooks/use-highlighted-code.cjs.map +1 -0
  57. package/dist/hooks/use-highlighted-code.d.cts +5 -0
  58. package/dist/hooks/use-highlighted-code.d.cts.map +1 -0
  59. package/dist/hooks/use-highlighted-code.d.mts +5 -0
  60. package/dist/hooks/use-highlighted-code.d.mts.map +1 -0
  61. package/dist/hooks/use-highlighted-code.mjs +56 -0
  62. package/dist/hooks/use-highlighted-code.mjs.map +1 -0
  63. package/dist/index.cjs +12 -0
  64. package/dist/index.d.cts +6 -2
  65. package/dist/index.d.mts +6 -2
  66. package/dist/index.mjs +5 -2
  67. package/dist/lib/highlighter.cjs +81 -0
  68. package/dist/lib/highlighter.cjs.map +1 -0
  69. package/dist/lib/highlighter.mjs +79 -0
  70. package/dist/lib/highlighter.mjs.map +1 -0
  71. package/dist/lib/utils.cjs +4 -4
  72. package/dist/lib/utils.cjs.map +1 -1
  73. package/dist/lib/utils.d.cts +6 -0
  74. package/dist/lib/utils.d.cts.map +1 -0
  75. package/dist/lib/utils.d.mts +6 -0
  76. package/dist/lib/utils.d.mts.map +1 -0
  77. package/dist/lib/utils.mjs +4 -4
  78. package/dist/lib/utils.mjs.map +1 -1
  79. package/dist/primitives/button.d.cts +1 -1
  80. package/dist/primitives/button.d.mts +1 -1
  81. package/dist/primitives/code-block.cjs +133 -0
  82. package/dist/primitives/code-block.cjs.map +1 -0
  83. package/dist/primitives/code-block.d.cts +29 -0
  84. package/dist/primitives/code-block.d.cts.map +1 -0
  85. package/dist/primitives/code-block.d.mts +29 -0
  86. package/dist/primitives/code-block.d.mts.map +1 -0
  87. package/dist/primitives/code-block.mjs +124 -0
  88. package/dist/primitives/code-block.mjs.map +1 -0
  89. package/dist/styles/index.css +61 -0
  90. package/package.json +2 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-highlighted-code.mjs","names":[],"sources":["../../src/hooks/use-highlighted-code.ts"],"sourcesContent":["// BERGET: upstream uses an intentional mutate-during-render streaming pattern\n// (see the init/render loop below); the React Compiler skips this file, which\n// is safe and expected. Keep this minimal when replaying upstream updates.\n/* eslint-disable react-hooks/preserve-manual-memoization */\nimport * as React from 'react';\n\nimport { loadHighlighter } from '@/lib/highlighter';\n\nexport function useHighlightedCode(value: string, language: string) {\n // A trailing newline would render as an extra empty line.\n const code = value.endsWith('\\n') ? value.slice(0, -1) : value;\n const [loaded, setLoaded] = React.useState<{\n language: string;\n highlighter: Awaited<ReturnType<typeof loadHighlighter>>;\n } | null>(null);\n const highlighter = loaded?.language === language ? loaded.highlighter : null;\n\n React.useEffect(() => {\n let cancelled = false;\n\n loadHighlighter(language)\n .then((next) => {\n if (!cancelled) {\n setLoaded({ language, highlighter: next });\n }\n })\n .catch(() => {});\n\n return () => {\n cancelled = true;\n };\n }, [language]);\n\n // The complete lines, highlighted. While the code streams, only the new\n // lines are tokenized, starting from the grammar state of the last one.\n const [done, setDone] = React.useState<{\n highlighter: typeof highlighter;\n text: string;\n lines: React.ReactNode[];\n state?: Parameters<NonNullable<typeof highlighter>['highlight']>[1];\n }>({ highlighter: null, text: '', lines: [] });\n\n let next = done;\n\n if (next.highlighter !== highlighter || !code.startsWith(next.text)) {\n next = { highlighter, text: '', lines: [] };\n }\n\n const end = code.lastIndexOf('\\n') + 1;\n\n if (highlighter && end > next.text.length) {\n const result = highlighter.highlight(code.slice(next.text.length, end - 1), next.state);\n\n next = {\n highlighter,\n text: code.slice(0, end),\n lines: [...next.lines, ...result.lines],\n state: result.state,\n };\n }\n\n if (next !== done) {\n setDone(next);\n }\n\n // The last line is still being written, so it is tokenized on every render.\n const tail = code.slice(end);\n\n return React.useMemo(() => {\n if (!highlighter) {\n return code.split('\\n');\n }\n\n return [...next.lines, highlighter.highlight(tail, next.state).lines[0]];\n }, [code, highlighter, next, tail]);\n}\n"],"mappings":";;;AAQA,SAAgB,mBAAmB,OAAe,UAAkB;CAElE,MAAM,OAAO,MAAM,SAAS,IAAI,IAAI,MAAM,MAAM,GAAG,EAAE,IAAI;CACzD,MAAM,CAAC,QAAQ,aAAa,MAAM,SAGxB,IAAI;CACd,MAAM,cAAc,QAAQ,aAAa,WAAW,OAAO,cAAc;CAEzE,MAAM,gBAAgB;EACpB,IAAI,YAAY;EAEhB,gBAAgB,QAAQ,CAAC,CACtB,MAAM,SAAS;GACd,IAAI,CAAC,WACH,UAAU;IAAE;IAAU,aAAa;GAAK,CAAC;EAE7C,CAAC,CAAC,CACD,YAAY,CAAC,CAAC;EAEjB,aAAa;GACX,YAAY;EACd;CACF,GAAG,CAAC,QAAQ,CAAC;CAIb,MAAM,CAAC,MAAM,WAAW,MAAM,SAK3B;EAAE,aAAa;EAAM,MAAM;EAAI,OAAO,CAAC;CAAE,CAAC;CAE7C,IAAI,OAAO;CAEX,IAAI,KAAK,gBAAgB,eAAe,CAAC,KAAK,WAAW,KAAK,IAAI,GAChE,OAAO;EAAE;EAAa,MAAM;EAAI,OAAO,CAAC;CAAE;CAG5C,MAAM,MAAM,KAAK,YAAY,IAAI,IAAI;CAErC,IAAI,eAAe,MAAM,KAAK,KAAK,QAAQ;EACzC,MAAM,SAAS,YAAY,UAAU,KAAK,MAAM,KAAK,KAAK,QAAQ,MAAM,CAAC,GAAG,KAAK,KAAK;EAEtF,OAAO;GACL;GACA,MAAM,KAAK,MAAM,GAAG,GAAG;GACvB,OAAO,CAAC,GAAG,KAAK,OAAO,GAAG,OAAO,KAAK;GACtC,OAAO,OAAO;EAChB;CACF;CAEA,IAAI,SAAS,MACX,QAAQ,IAAI;CAId,MAAM,OAAO,KAAK,MAAM,GAAG;CAE3B,OAAO,MAAM,cAAc;EACzB,IAAI,CAAC,aACH,OAAO,KAAK,MAAM,IAAI;EAGxB,OAAO,CAAC,GAAG,KAAK,OAAO,YAAY,UAAU,MAAM,KAAK,KAAK,CAAC,CAAC,MAAM,EAAE;CACzE,GAAG;EAAC;EAAM;EAAa;EAAM;CAAI,CAAC;AACpC"}
package/dist/index.cjs CHANGED
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_ThemeProvider = require("./components/theme-provider/ThemeProvider.cjs");
3
+ const require_utils = require("./lib/utils.cjs");
3
4
  const require_ThemeToggle = require("./components/theme-provider/ThemeToggle.cjs");
4
5
  const require_button = require("./primitives/button.cjs");
5
6
  const require_Button = require("./components/button/Button.cjs");
@@ -58,7 +59,9 @@ const require_Grid = require("./components/grid/Grid.cjs");
58
59
  const require_Box = require("./components/box/Box.cjs");
59
60
  const require_LanguageSelect = require("./components/language-select/LanguageSelect.cjs");
60
61
  const require_List = require("./components/list/List.cjs");
62
+ const require_code_block = require("./primitives/code-block.cjs");
61
63
  const require_CodeBlock = require("./components/code-block/CodeBlock.cjs");
64
+ const require_use_highlighted_code = require("./hooks/use-highlighted-code.cjs");
62
65
  const require_WindowFrame = require("./components/window-frame/WindowFrame.cjs");
63
66
  const require_FogIllustration = require("./components/fog-illustration/FogIllustration.cjs");
64
67
  let _shadcn_react_message_scroller = require("@shadcn/react/message-scroller");
@@ -95,6 +98,13 @@ exports.CardHeader = require_card.CardHeader;
95
98
  exports.CardTitle = require_card.CardTitle;
96
99
  exports.Checkbox = require_Checkbox.Checkbox;
97
100
  exports.CodeBlock = require_CodeBlock.CodeBlock;
101
+ exports.CodeBlockActions = require_code_block.CodeBlockActions;
102
+ exports.CodeBlockContent = require_code_block.CodeBlockContent;
103
+ exports.CodeBlockCopyButton = require_code_block.CodeBlockCopyButton;
104
+ exports.CodeBlockFooter = require_code_block.CodeBlockFooter;
105
+ exports.CodeBlockHeader = require_CodeBlock.CodeBlockHeader;
106
+ exports.CodeBlockLine = require_code_block.CodeBlockLine;
107
+ exports.CodeBlockTitle = require_CodeBlock.CodeBlockTitle;
98
108
  exports.Combobox = require_combobox.Combobox;
99
109
  exports.ComboboxClear = require_combobox.ComboboxClear;
100
110
  exports.ComboboxContent = require_combobox.ComboboxContent;
@@ -283,6 +293,7 @@ exports.buttonVariants = require_button.buttonVariants;
283
293
  exports.cardVariants = require_Card.cardVariants;
284
294
  exports.categoryLabels = require_ModelLogo.categoryLabels;
285
295
  exports.checkboxVariants = require_Checkbox.checkboxVariants;
296
+ exports.cn = require_utils.cn;
286
297
  exports.containerVariants = require_Container.containerVariants;
287
298
  exports.getCountryByCode = require_countries.getCountryByCode;
288
299
  exports.getCountryByName = require_countries.getCountryByName;
@@ -295,6 +306,7 @@ exports.switchThumbVariants = require_Switch.switchThumbVariants;
295
306
  exports.tabsListVariants = require_Tabs.tabsListVariants;
296
307
  exports.tabsTriggerVariants = require_Tabs.tabsTriggerVariants;
297
308
  exports.typographyVariants = require_Typography.typographyVariants;
309
+ exports.useHighlightedCode = require_use_highlighted_code.useHighlightedCode;
298
310
  Object.defineProperty(exports, "useMessageScroller", {
299
311
  enumerable: true,
300
312
  get: function() {
package/dist/index.d.cts CHANGED
@@ -102,9 +102,13 @@ import { LanguageSelect, LanguageSelectOption, LanguageSelectProps } from "./com
102
102
  import "./components/language-select/index.cjs";
103
103
  import { FeatureList, FeatureListProps, List, ListHeader, ListHeaderProps, ListItem, ListItemProps, ListProps } from "./components/list/List.cjs";
104
104
  import "./components/list/index.cjs";
105
- import { CodeBlock, CodeBlockProps } from "./components/code-block/CodeBlock.cjs";
105
+ import { CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockLine } from "./primitives/code-block.cjs";
106
+ import { CodeBlock, CodeBlockHeader, CodeBlockTitle } from "./components/code-block/CodeBlock.cjs";
107
+ import "./components/code-block/index.cjs";
108
+ import { useHighlightedCode } from "./hooks/use-highlighted-code.cjs";
106
109
  import { TerminalExample } from "./lib/terminal.cjs";
110
+ import { cn } from "./lib/utils.cjs";
107
111
  import { WindowFrame, WindowFrameProps, WindowTab } from "./components/window-frame/WindowFrame.cjs";
108
112
  import "./components/window-frame/index.cjs";
109
113
  import { FOG_BRAND_PALETTE, FogIllustration, FogIllustrationProps, FogPalette } from "./components/fog-illustration/FogIllustration.cjs";
110
- export { Alert, AlertDescription, type AlertDescriptionProps, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTitleProps, Anchor, type AnchorProps, type AnchorVariantsProps, Badge, type BadgeProps, BergetLogo, type BergetLogoProps, Box, type BoxProps, type SpacingScale as BoxSpacingScale, Bubble, BubbleContent, BubbleGroup, BubbleReactions, Button, type ButtonProps, COUNTRIES, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, CodeBlock, type CodeBlockProps, Combobox, ComboboxClear, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Container, type ContainerProps, type Country, CountrySelect, type CountrySelectProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EU_COUNTRY_CODES, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, type EmptyProps, EmptyTitle, FOG_BRAND_PALETTE, FeatureList, type FeatureListProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FogIllustration, type FogIllustrationProps, type FogPalette, Grid, type GridColsScale, type GridProps, type GridRowsScale, type SpacingScale$1 as GridSpacingScale, Icon, type IconProps, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, InputGroupButton, InputGroupInput, type InputGroupProps, InputGroupText, InputGroupTextarea, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, type ItemProps, ItemSeparator, ItemTitle, Label, LanguageSelect, type LanguageSelectOption, type LanguageSelectProps, Link, type LinkProps, List, ListHeader, type ListHeaderProps, ListItem, type ListItemProps, type ListProps, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, ModelCard, type ModelCardProps, type ModelCategory, type ModelLifecycle, ModelLogo, type ModelLogoProps, type ModelLogoProvider, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, type ProgressProps, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SearchInput, type SearchInputProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLogo, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPageHeader, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SkeletonProps, Slider, type SliderProps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TerminalExample, Textarea, type Theme, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, type TooltipTriggerProps, Typography, type TypographyProps, WindowFrame, type WindowFrameProps, type WindowTab, alertVariants, anchorVariants, badgeVariants, boxVariants, buttonVariants, cardVariants, categoryLabels, checkboxVariants, containerVariants, getCountryByCode, getCountryByName, gridVariants, isEUCountry, linkVariants, navigationMenuTriggerStyle, switchRootVariants, switchThumbVariants, tabsListVariants, tabsTriggerVariants, typographyVariants, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, useSidebar, useTheme };
114
+ export { Alert, AlertDescription, type AlertDescriptionProps, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTitleProps, Anchor, type AnchorProps, type AnchorVariantsProps, Badge, type BadgeProps, BergetLogo, type BergetLogoProps, Box, type BoxProps, type SpacingScale as BoxSpacingScale, Bubble, BubbleContent, BubbleGroup, BubbleReactions, Button, type ButtonProps, COUNTRIES, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Combobox, ComboboxClear, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Container, type ContainerProps, type Country, CountrySelect, type CountrySelectProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EU_COUNTRY_CODES, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, type EmptyProps, EmptyTitle, FOG_BRAND_PALETTE, FeatureList, type FeatureListProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FogIllustration, type FogIllustrationProps, type FogPalette, Grid, type GridColsScale, type GridProps, type GridRowsScale, type SpacingScale$1 as GridSpacingScale, Icon, type IconProps, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, InputGroupButton, InputGroupInput, type InputGroupProps, InputGroupText, InputGroupTextarea, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, type ItemProps, ItemSeparator, ItemTitle, Label, LanguageSelect, type LanguageSelectOption, type LanguageSelectProps, Link, type LinkProps, List, ListHeader, type ListHeaderProps, ListItem, type ListItemProps, type ListProps, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, ModelCard, type ModelCardProps, type ModelCategory, type ModelLifecycle, ModelLogo, type ModelLogoProps, type ModelLogoProvider, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, type ProgressProps, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SearchInput, type SearchInputProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLogo, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPageHeader, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SkeletonProps, Slider, type SliderProps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TerminalExample, Textarea, type Theme, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, type TooltipTriggerProps, Typography, type TypographyProps, WindowFrame, type WindowFrameProps, type WindowTab, alertVariants, anchorVariants, badgeVariants, boxVariants, buttonVariants, cardVariants, categoryLabels, checkboxVariants, cn, containerVariants, getCountryByCode, getCountryByName, gridVariants, isEUCountry, linkVariants, navigationMenuTriggerStyle, switchRootVariants, switchThumbVariants, tabsListVariants, tabsTriggerVariants, typographyVariants, useHighlightedCode, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, useSidebar, useTheme };
package/dist/index.d.mts CHANGED
@@ -102,9 +102,13 @@ import { LanguageSelect, LanguageSelectOption, LanguageSelectProps } from "./com
102
102
  import "./components/language-select/index.mjs";
103
103
  import { FeatureList, FeatureListProps, List, ListHeader, ListHeaderProps, ListItem, ListItemProps, ListProps } from "./components/list/List.mjs";
104
104
  import "./components/list/index.mjs";
105
- import { CodeBlock, CodeBlockProps } from "./components/code-block/CodeBlock.mjs";
105
+ import { CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockLine } from "./primitives/code-block.mjs";
106
+ import { CodeBlock, CodeBlockHeader, CodeBlockTitle } from "./components/code-block/CodeBlock.mjs";
107
+ import "./components/code-block/index.mjs";
108
+ import { useHighlightedCode } from "./hooks/use-highlighted-code.mjs";
106
109
  import { TerminalExample } from "./lib/terminal.mjs";
110
+ import { cn } from "./lib/utils.mjs";
107
111
  import { WindowFrame, WindowFrameProps, WindowTab } from "./components/window-frame/WindowFrame.mjs";
108
112
  import "./components/window-frame/index.mjs";
109
113
  import { FOG_BRAND_PALETTE, FogIllustration, FogIllustrationProps, FogPalette } from "./components/fog-illustration/FogIllustration.mjs";
110
- export { Alert, AlertDescription, type AlertDescriptionProps, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTitleProps, Anchor, type AnchorProps, type AnchorVariantsProps, Badge, type BadgeProps, BergetLogo, type BergetLogoProps, Box, type BoxProps, type SpacingScale as BoxSpacingScale, Bubble, BubbleContent, BubbleGroup, BubbleReactions, Button, type ButtonProps, COUNTRIES, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, CodeBlock, type CodeBlockProps, Combobox, ComboboxClear, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Container, type ContainerProps, type Country, CountrySelect, type CountrySelectProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EU_COUNTRY_CODES, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, type EmptyProps, EmptyTitle, FOG_BRAND_PALETTE, FeatureList, type FeatureListProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FogIllustration, type FogIllustrationProps, type FogPalette, Grid, type GridColsScale, type GridProps, type GridRowsScale, type SpacingScale$1 as GridSpacingScale, Icon, type IconProps, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, InputGroupButton, InputGroupInput, type InputGroupProps, InputGroupText, InputGroupTextarea, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, type ItemProps, ItemSeparator, ItemTitle, Label, LanguageSelect, type LanguageSelectOption, type LanguageSelectProps, Link, type LinkProps, List, ListHeader, type ListHeaderProps, ListItem, type ListItemProps, type ListProps, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, ModelCard, type ModelCardProps, type ModelCategory, type ModelLifecycle, ModelLogo, type ModelLogoProps, type ModelLogoProvider, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, type ProgressProps, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SearchInput, type SearchInputProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLogo, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPageHeader, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SkeletonProps, Slider, type SliderProps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TerminalExample, Textarea, type Theme, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, type TooltipTriggerProps, Typography, type TypographyProps, WindowFrame, type WindowFrameProps, type WindowTab, alertVariants, anchorVariants, badgeVariants, boxVariants, buttonVariants, cardVariants, categoryLabels, checkboxVariants, containerVariants, getCountryByCode, getCountryByName, gridVariants, isEUCountry, linkVariants, navigationMenuTriggerStyle, switchRootVariants, switchThumbVariants, tabsListVariants, tabsTriggerVariants, typographyVariants, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, useSidebar, useTheme };
114
+ export { Alert, AlertDescription, type AlertDescriptionProps, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTitleProps, Anchor, type AnchorProps, type AnchorVariantsProps, Badge, type BadgeProps, BergetLogo, type BergetLogoProps, Box, type BoxProps, type SpacingScale as BoxSpacingScale, Bubble, BubbleContent, BubbleGroup, BubbleReactions, Button, type ButtonProps, COUNTRIES, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Combobox, ComboboxClear, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Container, type ContainerProps, type Country, CountrySelect, type CountrySelectProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EU_COUNTRY_CODES, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, type EmptyProps, EmptyTitle, FOG_BRAND_PALETTE, FeatureList, type FeatureListProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FogIllustration, type FogIllustrationProps, type FogPalette, Grid, type GridColsScale, type GridProps, type GridRowsScale, type SpacingScale$1 as GridSpacingScale, Icon, type IconProps, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, InputGroupButton, InputGroupInput, type InputGroupProps, InputGroupText, InputGroupTextarea, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, type ItemProps, ItemSeparator, ItemTitle, Label, LanguageSelect, type LanguageSelectOption, type LanguageSelectProps, Link, type LinkProps, List, ListHeader, type ListHeaderProps, ListItem, type ListItemProps, type ListProps, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, ModelCard, type ModelCardProps, type ModelCategory, type ModelLifecycle, ModelLogo, type ModelLogoProps, type ModelLogoProvider, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, type ProgressProps, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SearchInput, type SearchInputProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLogo, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPageHeader, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SkeletonProps, Slider, type SliderProps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TerminalExample, Textarea, type Theme, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, type TooltipTriggerProps, Typography, type TypographyProps, WindowFrame, type WindowFrameProps, type WindowTab, alertVariants, anchorVariants, badgeVariants, boxVariants, buttonVariants, cardVariants, categoryLabels, checkboxVariants, cn, containerVariants, getCountryByCode, getCountryByName, gridVariants, isEUCountry, linkVariants, navigationMenuTriggerStyle, switchRootVariants, switchThumbVariants, tabsListVariants, tabsTriggerVariants, typographyVariants, useHighlightedCode, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, useSidebar, useTheme };
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ThemeProvider, useTheme } from "./components/theme-provider/ThemeProvider.mjs";
2
+ import { cn } from "./lib/utils.mjs";
2
3
  import { ThemeToggle } from "./components/theme-provider/ThemeToggle.mjs";
3
4
  import { buttonVariants } from "./primitives/button.mjs";
4
5
  import { Button } from "./components/button/Button.mjs";
@@ -57,7 +58,9 @@ import { Grid, gridVariants } from "./components/grid/Grid.mjs";
57
58
  import { Box, boxVariants } from "./components/box/Box.mjs";
58
59
  import { LanguageSelect } from "./components/language-select/LanguageSelect.mjs";
59
60
  import { FeatureList, List, ListHeader, ListItem } from "./components/list/List.mjs";
60
- import { CodeBlock } from "./components/code-block/CodeBlock.mjs";
61
+ import { CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockLine } from "./primitives/code-block.mjs";
62
+ import { CodeBlock, CodeBlockHeader, CodeBlockTitle } from "./components/code-block/CodeBlock.mjs";
63
+ import { useHighlightedCode } from "./hooks/use-highlighted-code.mjs";
61
64
  import { WindowFrame } from "./components/window-frame/WindowFrame.mjs";
62
65
  import { FOG_BRAND_PALETTE, FogIllustration } from "./components/fog-illustration/FogIllustration.mjs";
63
- export { Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Anchor, Badge, BergetLogo, Box, Bubble, BubbleContent, BubbleGroup, BubbleReactions, Button, COUNTRIES, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CodeBlock, Combobox, ComboboxClear, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Container, CountrySelect, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EU_COUNTRY_CODES, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FOG_BRAND_PALETTE, FeatureList, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FogIllustration, Grid, Icon, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, LanguageSelect, Link, List, ListHeader, ListItem, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, ModelCard, ModelLogo, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLogo, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPageHeader, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, WindowFrame, alertVariants, anchorVariants, badgeVariants, boxVariants, buttonVariants, cardVariants, categoryLabels, checkboxVariants, containerVariants, getCountryByCode, getCountryByName, gridVariants, isEUCountry, linkVariants, navigationMenuTriggerStyle, switchRootVariants, switchThumbVariants, tabsListVariants, tabsTriggerVariants, typographyVariants, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, useSidebar, useTheme };
66
+ export { Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Anchor, Badge, BergetLogo, Box, Bubble, BubbleContent, BubbleGroup, BubbleReactions, Button, COUNTRIES, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Combobox, ComboboxClear, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Container, CountrySelect, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EU_COUNTRY_CODES, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FOG_BRAND_PALETTE, FeatureList, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FogIllustration, Grid, Icon, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, LanguageSelect, Link, List, ListHeader, ListItem, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, ModelCard, ModelLogo, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLogo, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPageHeader, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, WindowFrame, alertVariants, anchorVariants, badgeVariants, boxVariants, buttonVariants, cardVariants, categoryLabels, checkboxVariants, cn, containerVariants, getCountryByCode, getCountryByName, gridVariants, isEUCountry, linkVariants, navigationMenuTriggerStyle, switchRootVariants, switchThumbVariants, tabsListVariants, tabsTriggerVariants, typographyVariants, useHighlightedCode, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, useSidebar, useTheme };
@@ -0,0 +1,81 @@
1
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
+ const require_shiki_theme = require("./shiki-theme.cjs");
3
+ let react = require("react");
4
+ react = require_runtime.__toESM(react, 1);
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+ let shiki_core = require("shiki/core");
7
+ let shiki_engine_javascript = require("shiki/engine/javascript");
8
+ //#region src/lib/highlighter.tsx
9
+ const languages = {
10
+ bash: () => import("shiki/langs/shellscript.mjs"),
11
+ css: () => import("shiki/langs/css.mjs"),
12
+ diff: () => import("shiki/langs/diff.mjs"),
13
+ html: () => import("shiki/langs/html.mjs"),
14
+ javascript: () => import("shiki/langs/javascript.mjs"),
15
+ json: () => import("shiki/langs/json.mjs"),
16
+ jsx: () => import("shiki/langs/jsx.mjs"),
17
+ markdown: () => import("shiki/langs/markdown.mjs"),
18
+ python: () => import("shiki/langs/python.mjs"),
19
+ sql: () => import("shiki/langs/sql.mjs"),
20
+ tsx: () => import("shiki/langs/tsx.mjs"),
21
+ typescript: () => import("shiki/langs/typescript.mjs"),
22
+ yaml: () => import("shiki/langs/yaml.mjs"),
23
+ dockerfile: () => import("shiki/langs/dockerfile.mjs")
24
+ };
25
+ const aliases = {
26
+ js: "javascript",
27
+ md: "markdown",
28
+ py: "python",
29
+ sh: "bash",
30
+ shell: "bash",
31
+ shellscript: "bash",
32
+ ts: "typescript",
33
+ yml: "yaml",
34
+ zsh: "bash",
35
+ docker: "dockerfile"
36
+ };
37
+ let highlighter;
38
+ function getHighlighter() {
39
+ highlighter ??= (0, shiki_core.createHighlighterCore)({
40
+ themes: [require_shiki_theme.bergetShikiTheme],
41
+ langs: [],
42
+ engine: (0, shiki_engine_javascript.createJavaScriptRegexEngine)({ forgiving: true })
43
+ });
44
+ return highlighter;
45
+ }
46
+ function getLanguage(language) {
47
+ const name = language.toLowerCase();
48
+ if (name === "ansi") return name;
49
+ if (name in languages) return name;
50
+ return aliases[name] ?? null;
51
+ }
52
+ async function loadHighlighter(language) {
53
+ const lang = getLanguage(language);
54
+ if (!lang) return null;
55
+ const shiki = await getHighlighter();
56
+ if (lang !== "ansi" && !shiki.getLoadedLanguages().includes(lang)) await shiki.loadLanguage(languages[lang]);
57
+ return { highlight(code, state) {
58
+ const tokenize = (text) => shiki.codeToTokens(text, {
59
+ lang,
60
+ themes: {
61
+ light: "berget",
62
+ dark: "berget"
63
+ },
64
+ defaultColor: false,
65
+ grammarState: state
66
+ }).tokens;
67
+ const tokens = lang === "ansi" ? code.split("\n").flatMap((line) => tokenize(line)) : tokenize(code);
68
+ return {
69
+ lines: tokens.map((line) => line.map((token, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
70
+ style: token.htmlStyle,
71
+ className: "\n text-(--shiki-light)\n dark:text-(--shiki-dark)\n ",
72
+ children: token.content
73
+ }, index))),
74
+ state: shiki.getLastGrammarState(tokens)
75
+ };
76
+ } };
77
+ }
78
+ //#endregion
79
+ exports.loadHighlighter = loadHighlighter;
80
+
81
+ //# sourceMappingURL=highlighter.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"highlighter.cjs","names":["createHighlighterCore","bergetShikiTheme","createJavaScriptRegexEngine"],"sources":["../../src/lib/highlighter.tsx"],"sourcesContent":["import * as React from 'react';\nimport { createHighlighterCore, type GrammarState, type HighlighterCore } from 'shiki/core';\nimport { createJavaScriptRegexEngine } from 'shiki/engine/javascript';\n\n// BERGET: brand syntax-highlighting theme. CSS-variables theme backed by the\n// --berget-shiki-* tokens in styles/index.css (dark + light). Keep this patch\n// minimal so re-running `npx shadcn@latest add code-block --overwrite` is easy.\nimport { bergetShikiTheme } from './shiki-theme';\n\n// Add the languages you need. Each one loads the first time it is used.\nconst languages = {\n bash: () => import('shiki/langs/shellscript.mjs'),\n css: () => import('shiki/langs/css.mjs'),\n diff: () => import('shiki/langs/diff.mjs'),\n html: () => import('shiki/langs/html.mjs'),\n javascript: () => import('shiki/langs/javascript.mjs'),\n json: () => import('shiki/langs/json.mjs'),\n jsx: () => import('shiki/langs/jsx.mjs'),\n markdown: () => import('shiki/langs/markdown.mjs'),\n python: () => import('shiki/langs/python.mjs'),\n sql: () => import('shiki/langs/sql.mjs'),\n tsx: () => import('shiki/langs/tsx.mjs'),\n typescript: () => import('shiki/langs/typescript.mjs'),\n yaml: () => import('shiki/langs/yaml.mjs'),\n dockerfile: () => import('shiki/langs/dockerfile.mjs'),\n};\n\nconst aliases: Record<string, keyof typeof languages> = {\n js: 'javascript',\n md: 'markdown',\n py: 'python',\n sh: 'bash',\n shell: 'bash',\n shellscript: 'bash',\n ts: 'typescript',\n yml: 'yaml',\n zsh: 'bash',\n docker: 'dockerfile',\n};\n\nlet highlighter: Promise<HighlighterCore> | undefined;\n\nfunction getHighlighter() {\n highlighter ??= createHighlighterCore({\n // BERGET: single CSS-variables theme instead of github-light/dark.\n themes: [bergetShikiTheme],\n langs: [],\n engine: createJavaScriptRegexEngine({ forgiving: true }),\n });\n\n return highlighter;\n}\n\nfunction getLanguage(language: string) {\n const name = language.toLowerCase();\n\n if (name === 'ansi') {\n return name;\n }\n\n if (name in languages) {\n return name as keyof typeof languages;\n }\n\n return aliases[name] ?? null;\n}\n\n// Loads a language and returns a highlighter for it, or null for a language\n// that is not listed.\nexport async function loadHighlighter(language: string) {\n const lang = getLanguage(language);\n\n if (!lang) {\n return null;\n }\n\n const shiki = await getHighlighter();\n\n if (lang !== 'ansi' && !shiki.getLoadedLanguages().includes(lang)) {\n await shiki.loadLanguage(languages[lang]);\n }\n\n return {\n // Returns one React node per line, and the grammar state after the last\n // line. Pass that state back to continue where the code left off.\n highlight(code: string, state?: GrammarState) {\n const tokenize = (text: string) =>\n shiki.codeToTokens(text, {\n lang,\n // BERGET: light/dark slots both resolve to the berget theme, whose\n // token colors are var(--berget-shiki-*) and already flip with the\n // data-theme attribute in styles/index.css.\n themes: { light: 'berget', dark: 'berget' },\n defaultColor: false,\n grammarState: state,\n }).tokens;\n\n // ANSI has no grammar state, so each line is tokenized on its own and\n // gets the same colors whether it arrives in one piece or streams.\n const tokens =\n lang === 'ansi' ? code.split('\\n').flatMap((line) => tokenize(line)) : tokenize(code);\n\n return {\n lines: tokens.map((line) =>\n line.map((token, index) => (\n <span\n key={index}\n style={token.htmlStyle as React.CSSProperties}\n className=\"\n text-(--shiki-light)\n dark:text-(--shiki-dark)\n \"\n >\n {token.content}\n </span>\n )),\n ),\n state: shiki.getLastGrammarState(tokens),\n };\n },\n };\n}\n\n// Returns one React node per line, or null for a language that is not listed.\nexport async function highlightCode(code: string, language: string) {\n const highlighter = await loadHighlighter(language);\n\n return highlighter ? highlighter.highlight(code).lines : null;\n}\n"],"mappings":";;;;;;;;AAUA,MAAM,YAAY;CAChB,YAAY,OAAO;CACnB,WAAW,OAAO;CAClB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,kBAAkB,OAAO;CACzB,YAAY,OAAO;CACnB,WAAW,OAAO;CAClB,gBAAgB,OAAO;CACvB,cAAc,OAAO;CACrB,WAAW,OAAO;CAClB,WAAW,OAAO;CAClB,kBAAkB,OAAO;CACzB,YAAY,OAAO;CACnB,kBAAkB,OAAO;AAC3B;AAEA,MAAM,UAAkD;CACtD,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACb,IAAI;CACJ,KAAK;CACL,KAAK;CACL,QAAQ;AACV;AAEA,IAAI;AAEJ,SAAS,iBAAiB;CACxB,iBAAA,GAAgBA,WAAAA,sBAAAA,CAAsB;EAEpC,QAAQ,CAACC,oBAAAA,gBAAgB;EACzB,OAAO,CAAC;EACR,SAAA,GAAQC,wBAAAA,4BAAAA,CAA4B,EAAE,WAAW,KAAK,CAAC;CACzD,CAAC;CAED,OAAO;AACT;AAEA,SAAS,YAAY,UAAkB;CACrC,MAAM,OAAO,SAAS,YAAY;CAElC,IAAI,SAAS,QACX,OAAO;CAGT,IAAI,QAAQ,WACV,OAAO;CAGT,OAAO,QAAQ,SAAS;AAC1B;AAIA,eAAsB,gBAAgB,UAAkB;CACtD,MAAM,OAAO,YAAY,QAAQ;CAEjC,IAAI,CAAC,MACH,OAAO;CAGT,MAAM,QAAQ,MAAM,eAAe;CAEnC,IAAI,SAAS,UAAU,CAAC,MAAM,mBAAmB,CAAC,CAAC,SAAS,IAAI,GAC9D,MAAM,MAAM,aAAa,UAAU,KAAK;CAG1C,OAAO,EAGL,UAAU,MAAc,OAAsB;EAC5C,MAAM,YAAY,SAChB,MAAM,aAAa,MAAM;GACvB;GAIA,QAAQ;IAAE,OAAO;IAAU,MAAM;GAAS;GAC1C,cAAc;GACd,cAAc;EAChB,CAAC,CAAC,CAAC;EAIL,MAAM,SACJ,SAAS,SAAS,KAAK,MAAM,IAAI,CAAC,CAAC,SAAS,SAAS,SAAS,IAAI,CAAC,IAAI,SAAS,IAAI;EAEtF,OAAO;GACL,OAAO,OAAO,KAAK,SACjB,KAAK,KAAK,OAAO,UACf,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAEE,OAAO,MAAM;IACb,WAAU;IAKT,UAAA,MAAM;GACH,GARC,KAQD,CACP,CACH;GACA,OAAO,MAAM,oBAAoB,MAAM;EACzC;CACF,EACF;AACF"}
@@ -0,0 +1,79 @@
1
+ import { bergetShikiTheme } from "./shiki-theme.mjs";
2
+ import "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { createHighlighterCore } from "shiki/core";
5
+ import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
6
+ //#region src/lib/highlighter.tsx
7
+ const languages = {
8
+ bash: () => import("shiki/langs/shellscript.mjs"),
9
+ css: () => import("shiki/langs/css.mjs"),
10
+ diff: () => import("shiki/langs/diff.mjs"),
11
+ html: () => import("shiki/langs/html.mjs"),
12
+ javascript: () => import("shiki/langs/javascript.mjs"),
13
+ json: () => import("shiki/langs/json.mjs"),
14
+ jsx: () => import("shiki/langs/jsx.mjs"),
15
+ markdown: () => import("shiki/langs/markdown.mjs"),
16
+ python: () => import("shiki/langs/python.mjs"),
17
+ sql: () => import("shiki/langs/sql.mjs"),
18
+ tsx: () => import("shiki/langs/tsx.mjs"),
19
+ typescript: () => import("shiki/langs/typescript.mjs"),
20
+ yaml: () => import("shiki/langs/yaml.mjs"),
21
+ dockerfile: () => import("shiki/langs/dockerfile.mjs")
22
+ };
23
+ const aliases = {
24
+ js: "javascript",
25
+ md: "markdown",
26
+ py: "python",
27
+ sh: "bash",
28
+ shell: "bash",
29
+ shellscript: "bash",
30
+ ts: "typescript",
31
+ yml: "yaml",
32
+ zsh: "bash",
33
+ docker: "dockerfile"
34
+ };
35
+ let highlighter;
36
+ function getHighlighter() {
37
+ highlighter ??= createHighlighterCore({
38
+ themes: [bergetShikiTheme],
39
+ langs: [],
40
+ engine: createJavaScriptRegexEngine({ forgiving: true })
41
+ });
42
+ return highlighter;
43
+ }
44
+ function getLanguage(language) {
45
+ const name = language.toLowerCase();
46
+ if (name === "ansi") return name;
47
+ if (name in languages) return name;
48
+ return aliases[name] ?? null;
49
+ }
50
+ async function loadHighlighter(language) {
51
+ const lang = getLanguage(language);
52
+ if (!lang) return null;
53
+ const shiki = await getHighlighter();
54
+ if (lang !== "ansi" && !shiki.getLoadedLanguages().includes(lang)) await shiki.loadLanguage(languages[lang]);
55
+ return { highlight(code, state) {
56
+ const tokenize = (text) => shiki.codeToTokens(text, {
57
+ lang,
58
+ themes: {
59
+ light: "berget",
60
+ dark: "berget"
61
+ },
62
+ defaultColor: false,
63
+ grammarState: state
64
+ }).tokens;
65
+ const tokens = lang === "ansi" ? code.split("\n").flatMap((line) => tokenize(line)) : tokenize(code);
66
+ return {
67
+ lines: tokens.map((line) => line.map((token, index) => /* @__PURE__ */ jsx("span", {
68
+ style: token.htmlStyle,
69
+ className: "\n text-(--shiki-light)\n dark:text-(--shiki-dark)\n ",
70
+ children: token.content
71
+ }, index))),
72
+ state: shiki.getLastGrammarState(tokens)
73
+ };
74
+ } };
75
+ }
76
+ //#endregion
77
+ export { loadHighlighter };
78
+
79
+ //# sourceMappingURL=highlighter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"highlighter.mjs","names":[],"sources":["../../src/lib/highlighter.tsx"],"sourcesContent":["import * as React from 'react';\nimport { createHighlighterCore, type GrammarState, type HighlighterCore } from 'shiki/core';\nimport { createJavaScriptRegexEngine } from 'shiki/engine/javascript';\n\n// BERGET: brand syntax-highlighting theme. CSS-variables theme backed by the\n// --berget-shiki-* tokens in styles/index.css (dark + light). Keep this patch\n// minimal so re-running `npx shadcn@latest add code-block --overwrite` is easy.\nimport { bergetShikiTheme } from './shiki-theme';\n\n// Add the languages you need. Each one loads the first time it is used.\nconst languages = {\n bash: () => import('shiki/langs/shellscript.mjs'),\n css: () => import('shiki/langs/css.mjs'),\n diff: () => import('shiki/langs/diff.mjs'),\n html: () => import('shiki/langs/html.mjs'),\n javascript: () => import('shiki/langs/javascript.mjs'),\n json: () => import('shiki/langs/json.mjs'),\n jsx: () => import('shiki/langs/jsx.mjs'),\n markdown: () => import('shiki/langs/markdown.mjs'),\n python: () => import('shiki/langs/python.mjs'),\n sql: () => import('shiki/langs/sql.mjs'),\n tsx: () => import('shiki/langs/tsx.mjs'),\n typescript: () => import('shiki/langs/typescript.mjs'),\n yaml: () => import('shiki/langs/yaml.mjs'),\n dockerfile: () => import('shiki/langs/dockerfile.mjs'),\n};\n\nconst aliases: Record<string, keyof typeof languages> = {\n js: 'javascript',\n md: 'markdown',\n py: 'python',\n sh: 'bash',\n shell: 'bash',\n shellscript: 'bash',\n ts: 'typescript',\n yml: 'yaml',\n zsh: 'bash',\n docker: 'dockerfile',\n};\n\nlet highlighter: Promise<HighlighterCore> | undefined;\n\nfunction getHighlighter() {\n highlighter ??= createHighlighterCore({\n // BERGET: single CSS-variables theme instead of github-light/dark.\n themes: [bergetShikiTheme],\n langs: [],\n engine: createJavaScriptRegexEngine({ forgiving: true }),\n });\n\n return highlighter;\n}\n\nfunction getLanguage(language: string) {\n const name = language.toLowerCase();\n\n if (name === 'ansi') {\n return name;\n }\n\n if (name in languages) {\n return name as keyof typeof languages;\n }\n\n return aliases[name] ?? null;\n}\n\n// Loads a language and returns a highlighter for it, or null for a language\n// that is not listed.\nexport async function loadHighlighter(language: string) {\n const lang = getLanguage(language);\n\n if (!lang) {\n return null;\n }\n\n const shiki = await getHighlighter();\n\n if (lang !== 'ansi' && !shiki.getLoadedLanguages().includes(lang)) {\n await shiki.loadLanguage(languages[lang]);\n }\n\n return {\n // Returns one React node per line, and the grammar state after the last\n // line. Pass that state back to continue where the code left off.\n highlight(code: string, state?: GrammarState) {\n const tokenize = (text: string) =>\n shiki.codeToTokens(text, {\n lang,\n // BERGET: light/dark slots both resolve to the berget theme, whose\n // token colors are var(--berget-shiki-*) and already flip with the\n // data-theme attribute in styles/index.css.\n themes: { light: 'berget', dark: 'berget' },\n defaultColor: false,\n grammarState: state,\n }).tokens;\n\n // ANSI has no grammar state, so each line is tokenized on its own and\n // gets the same colors whether it arrives in one piece or streams.\n const tokens =\n lang === 'ansi' ? code.split('\\n').flatMap((line) => tokenize(line)) : tokenize(code);\n\n return {\n lines: tokens.map((line) =>\n line.map((token, index) => (\n <span\n key={index}\n style={token.htmlStyle as React.CSSProperties}\n className=\"\n text-(--shiki-light)\n dark:text-(--shiki-dark)\n \"\n >\n {token.content}\n </span>\n )),\n ),\n state: shiki.getLastGrammarState(tokens),\n };\n },\n };\n}\n\n// Returns one React node per line, or null for a language that is not listed.\nexport async function highlightCode(code: string, language: string) {\n const highlighter = await loadHighlighter(language);\n\n return highlighter ? highlighter.highlight(code).lines : null;\n}\n"],"mappings":";;;;;;AAUA,MAAM,YAAY;CAChB,YAAY,OAAO;CACnB,WAAW,OAAO;CAClB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,kBAAkB,OAAO;CACzB,YAAY,OAAO;CACnB,WAAW,OAAO;CAClB,gBAAgB,OAAO;CACvB,cAAc,OAAO;CACrB,WAAW,OAAO;CAClB,WAAW,OAAO;CAClB,kBAAkB,OAAO;CACzB,YAAY,OAAO;CACnB,kBAAkB,OAAO;AAC3B;AAEA,MAAM,UAAkD;CACtD,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACb,IAAI;CACJ,KAAK;CACL,KAAK;CACL,QAAQ;AACV;AAEA,IAAI;AAEJ,SAAS,iBAAiB;CACxB,gBAAgB,sBAAsB;EAEpC,QAAQ,CAAC,gBAAgB;EACzB,OAAO,CAAC;EACR,QAAQ,4BAA4B,EAAE,WAAW,KAAK,CAAC;CACzD,CAAC;CAED,OAAO;AACT;AAEA,SAAS,YAAY,UAAkB;CACrC,MAAM,OAAO,SAAS,YAAY;CAElC,IAAI,SAAS,QACX,OAAO;CAGT,IAAI,QAAQ,WACV,OAAO;CAGT,OAAO,QAAQ,SAAS;AAC1B;AAIA,eAAsB,gBAAgB,UAAkB;CACtD,MAAM,OAAO,YAAY,QAAQ;CAEjC,IAAI,CAAC,MACH,OAAO;CAGT,MAAM,QAAQ,MAAM,eAAe;CAEnC,IAAI,SAAS,UAAU,CAAC,MAAM,mBAAmB,CAAC,CAAC,SAAS,IAAI,GAC9D,MAAM,MAAM,aAAa,UAAU,KAAK;CAG1C,OAAO,EAGL,UAAU,MAAc,OAAsB;EAC5C,MAAM,YAAY,SAChB,MAAM,aAAa,MAAM;GACvB;GAIA,QAAQ;IAAE,OAAO;IAAU,MAAM;GAAS;GAC1C,cAAc;GACd,cAAc;EAChB,CAAC,CAAC,CAAC;EAIL,MAAM,SACJ,SAAS,SAAS,KAAK,MAAM,IAAI,CAAC,CAAC,SAAS,SAAS,SAAS,IAAI,CAAC,IAAI,SAAS,IAAI;EAEtF,OAAO;GACL,OAAO,OAAO,KAAK,SACjB,KAAK,KAAK,OAAO,UACf,oBAAC,QAAD;IAEE,OAAO,MAAM;IACb,WAAU;IAKT,UAAA,MAAM;GACH,GARC,KAQD,CACP,CACH;GACA,OAAO,MAAM,oBAAoB,MAAM;EACzC;CACF,EACF;AACF"}
@@ -27,10 +27,10 @@ function cn(...inputs) {
27
27
  return twMerge((0, clsx.clsx)(inputs));
28
28
  }
29
29
  /**
30
- * Bridge for the legacy Radix `asChild` boolean on Berget primitive wrappers.
31
- * Base UI replaces `asChild` with a `render` prop: this helper returns the
32
- * element to pass to `render` (or `undefined` when not composing), so the
33
- * public design-system API can keep `<Trigger asChild><Button/></Trigger>`.
30
+ * Bridge between the `asChild` boolean on Berget primitive wrappers and
31
+ * Base UI's `render` prop: returns the element to pass to `render` (or
32
+ * `undefined` when not composing), so the public design-system API can
33
+ * keep `<Trigger asChild><Button/></Trigger>`.
34
34
  */
35
35
  function asChildRender(asChild, children) {
36
36
  if (!asChild) return void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","names":["extendTailwindMerge","React"],"sources":["../../src/lib/utils.ts"],"sourcesContent":["import * as React from 'react';\nimport { clsx, type ClassValue } from 'clsx';\nimport { extendTailwindMerge } from 'tailwind-merge';\n\n// Extend tailwind-merge to recognise custom utilities from @theme.\nconst twMerge = extendTailwindMerge({\n extend: {\n classGroups: {\n rounded: [\n 'rounded-berget-none',\n 'rounded-berget-xs',\n 'rounded-berget-sm',\n 'rounded-berget-md',\n 'rounded-berget-lg',\n 'rounded-berget-full',\n ],\n 'font-size': [\n 'text-h1',\n 'text-h2',\n 'text-h3',\n 'text-h4',\n 'text-p',\n 'text-mono',\n 'text-hero',\n 'text-caption',\n ],\n },\n },\n});\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n/**\n * Bridge for the legacy Radix `asChild` boolean on Berget primitive wrappers.\n * Base UI replaces `asChild` with a `render` prop: this helper returns the\n * element to pass to `render` (or `undefined` when not composing), so the\n * public design-system API can keep `<Trigger asChild><Button/></Trigger>`.\n */\nexport function asChildRender(\n asChild: boolean | undefined,\n children: React.ReactNode,\n): React.ReactElement | undefined {\n if (!asChild) return undefined;\n return React.Children.only(children) as React.ReactElement;\n}\n"],"mappings":";;;;;AAKA,MAAM,WAAA,G,wBAAUA,CAAAA,CAAAA,oBAAAA,CAAoB,EAClC,QAAQ,EACN,aAAa;CACX,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;CACF;CACA,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF,EACF,EACF,CAAC;AAED,SAAgB,GAAG,GAAG,QAAsB;CAC1C,OAAO,SAAA,GAAQ,KAAA,KAAA,CAAK,MAAM,CAAC;AAC7B;;;;;;;AAQA,SAAgB,cACd,SACA,UACgC;CAChC,IAAI,CAAC,SAAS,OAAO,KAAA;CACrB,OAAOC,MAAM,SAAS,KAAK,QAAQ;AACrC"}
1
+ {"version":3,"file":"utils.cjs","names":["extendTailwindMerge","React"],"sources":["../../src/lib/utils.ts"],"sourcesContent":["import * as React from 'react';\nimport { clsx, type ClassValue } from 'clsx';\nimport { extendTailwindMerge } from 'tailwind-merge';\n\n// Extend tailwind-merge to recognise custom utilities from @theme.\nconst twMerge = extendTailwindMerge({\n extend: {\n classGroups: {\n rounded: [\n 'rounded-berget-none',\n 'rounded-berget-xs',\n 'rounded-berget-sm',\n 'rounded-berget-md',\n 'rounded-berget-lg',\n 'rounded-berget-full',\n ],\n 'font-size': [\n 'text-h1',\n 'text-h2',\n 'text-h3',\n 'text-h4',\n 'text-p',\n 'text-mono',\n 'text-hero',\n 'text-caption',\n ],\n },\n },\n});\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n/**\n * Bridge between the `asChild` boolean on Berget primitive wrappers and\n * Base UI's `render` prop: returns the element to pass to `render` (or\n * `undefined` when not composing), so the public design-system API can\n * keep `<Trigger asChild><Button/></Trigger>`.\n */\nexport function asChildRender(\n asChild: boolean | undefined,\n children: React.ReactNode,\n): React.ReactElement | undefined {\n if (!asChild) return undefined;\n return React.Children.only(children) as React.ReactElement;\n}\n"],"mappings":";;;;;AAKA,MAAM,WAAA,G,wBAAUA,CAAAA,CAAAA,oBAAAA,CAAoB,EAClC,QAAQ,EACN,aAAa;CACX,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;CACF;CACA,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF,EACF,EACF,CAAC;AAED,SAAgB,GAAG,GAAG,QAAsB;CAC1C,OAAO,SAAA,GAAQ,KAAA,KAAA,CAAK,MAAM,CAAC;AAC7B;;;;;;;AAQA,SAAgB,cACd,SACA,UACgC;CAChC,IAAI,CAAC,SAAS,OAAO,KAAA;CACrB,OAAOC,MAAM,SAAS,KAAK,QAAQ;AACrC"}
@@ -0,0 +1,6 @@
1
+ import "react";
2
+ import { ClassValue } from "clsx";
3
+ //#region src/lib/utils.d.ts
4
+ export declare function cn(...inputs: ClassValue[]): string;
5
+ //#endregion
6
+ //# sourceMappingURL=utils.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.cts","names":[],"sources":["../../src/lib/utils.ts"],"mappings":";;;wBA8BgB,MAAM,QAAQ"}
@@ -0,0 +1,6 @@
1
+ import "react";
2
+ import { ClassValue } from "clsx";
3
+ //#region src/lib/utils.d.ts
4
+ export declare function cn(...inputs: ClassValue[]): string;
5
+ //#endregion
6
+ //# sourceMappingURL=utils.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.mts","names":[],"sources":["../../src/lib/utils.ts"],"mappings":";;;wBA8BgB,MAAM,QAAQ"}
@@ -26,10 +26,10 @@ function cn(...inputs) {
26
26
  return twMerge(clsx(inputs));
27
27
  }
28
28
  /**
29
- * Bridge for the legacy Radix `asChild` boolean on Berget primitive wrappers.
30
- * Base UI replaces `asChild` with a `render` prop: this helper returns the
31
- * element to pass to `render` (or `undefined` when not composing), so the
32
- * public design-system API can keep `<Trigger asChild><Button/></Trigger>`.
29
+ * Bridge between the `asChild` boolean on Berget primitive wrappers and
30
+ * Base UI's `render` prop: returns the element to pass to `render` (or
31
+ * `undefined` when not composing), so the public design-system API can
32
+ * keep `<Trigger asChild><Button/></Trigger>`.
33
33
  */
34
34
  function asChildRender(asChild, children) {
35
35
  if (!asChild) return void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","names":[],"sources":["../../src/lib/utils.ts"],"sourcesContent":["import * as React from 'react';\nimport { clsx, type ClassValue } from 'clsx';\nimport { extendTailwindMerge } from 'tailwind-merge';\n\n// Extend tailwind-merge to recognise custom utilities from @theme.\nconst twMerge = extendTailwindMerge({\n extend: {\n classGroups: {\n rounded: [\n 'rounded-berget-none',\n 'rounded-berget-xs',\n 'rounded-berget-sm',\n 'rounded-berget-md',\n 'rounded-berget-lg',\n 'rounded-berget-full',\n ],\n 'font-size': [\n 'text-h1',\n 'text-h2',\n 'text-h3',\n 'text-h4',\n 'text-p',\n 'text-mono',\n 'text-hero',\n 'text-caption',\n ],\n },\n },\n});\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n/**\n * Bridge for the legacy Radix `asChild` boolean on Berget primitive wrappers.\n * Base UI replaces `asChild` with a `render` prop: this helper returns the\n * element to pass to `render` (or `undefined` when not composing), so the\n * public design-system API can keep `<Trigger asChild><Button/></Trigger>`.\n */\nexport function asChildRender(\n asChild: boolean | undefined,\n children: React.ReactNode,\n): React.ReactElement | undefined {\n if (!asChild) return undefined;\n return React.Children.only(children) as React.ReactElement;\n}\n"],"mappings":";;;;AAKA,MAAM,UAAU,oBAAoB,EAClC,QAAQ,EACN,aAAa;CACX,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;CACF;CACA,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF,EACF,EACF,CAAC;AAED,SAAgB,GAAG,GAAG,QAAsB;CAC1C,OAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;;;;;AAQA,SAAgB,cACd,SACA,UACgC;CAChC,IAAI,CAAC,SAAS,OAAO,KAAA;CACrB,OAAO,MAAM,SAAS,KAAK,QAAQ;AACrC"}
1
+ {"version":3,"file":"utils.mjs","names":[],"sources":["../../src/lib/utils.ts"],"sourcesContent":["import * as React from 'react';\nimport { clsx, type ClassValue } from 'clsx';\nimport { extendTailwindMerge } from 'tailwind-merge';\n\n// Extend tailwind-merge to recognise custom utilities from @theme.\nconst twMerge = extendTailwindMerge({\n extend: {\n classGroups: {\n rounded: [\n 'rounded-berget-none',\n 'rounded-berget-xs',\n 'rounded-berget-sm',\n 'rounded-berget-md',\n 'rounded-berget-lg',\n 'rounded-berget-full',\n ],\n 'font-size': [\n 'text-h1',\n 'text-h2',\n 'text-h3',\n 'text-h4',\n 'text-p',\n 'text-mono',\n 'text-hero',\n 'text-caption',\n ],\n },\n },\n});\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n/**\n * Bridge between the `asChild` boolean on Berget primitive wrappers and\n * Base UI's `render` prop: returns the element to pass to `render` (or\n * `undefined` when not composing), so the public design-system API can\n * keep `<Trigger asChild><Button/></Trigger>`.\n */\nexport function asChildRender(\n asChild: boolean | undefined,\n children: React.ReactNode,\n): React.ReactElement | undefined {\n if (!asChild) return undefined;\n return React.Children.only(children) as React.ReactElement;\n}\n"],"mappings":";;;;AAKA,MAAM,UAAU,oBAAoB,EAClC,QAAQ,EACN,aAAa;CACX,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;CACF;CACA,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF,EACF,EACF,CAAC;AAED,SAAgB,GAAG,GAAG,QAAsB;CAC1C,OAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;;;;;AAQA,SAAgB,cACd,SACA,UACgC;CAChC,IAAI,CAAC,SAAS,OAAO,KAAA;CACrB,OAAO,MAAM,SAAS,KAAK,QAAQ;AACrC"}
@@ -3,7 +3,7 @@ import { VariantProps } from "class-variance-authority";
3
3
  //#region src/primitives/button.d.ts
4
4
  declare const buttonVariants: (props?: ({
5
5
  variant?: "link" | "default" | "secondary" | "outline" | "ghost" | "destructive" | null | undefined;
6
- size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
6
+ size?: "default" | "xs" | "sm" | "icon" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  declare function Button$1({ className, variant, size, ...props }: Button.Props & VariantProps<typeof buttonVariants>): import("react/jsx-runtime").JSX.Element;
9
9
  //#endregion
@@ -3,7 +3,7 @@ import { VariantProps } from "class-variance-authority";
3
3
  //#region src/primitives/button.d.ts
4
4
  declare const buttonVariants: (props?: ({
5
5
  variant?: "link" | "default" | "secondary" | "outline" | "ghost" | "destructive" | null | undefined;
6
- size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
6
+ size?: "default" | "xs" | "sm" | "icon" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  declare function Button$1({ className, variant, size, ...props }: Button.Props & VariantProps<typeof buttonVariants>): import("react/jsx-runtime").JSX.Element;
9
9
  //#endregion
@@ -0,0 +1,133 @@
1
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
+ const require_button = require("./button.cjs");
3
+ let react = require("react");
4
+ react = require_runtime.__toESM(react, 1);
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+ let class_variance_authority = require("class-variance-authority");
7
+ let cn = require("cn");
8
+ let lucide_react = require("lucide-react");
9
+ //#region src/primitives/code-block.tsx
10
+ const codeBlockVariants = (0, class_variance_authority.cva)("group/code-block relative flex w-full min-w-0 flex-col overflow-hidden rounded-lg text-sm has-[>[data-slot=code-block-content]:focus-visible]:ring-3 has-[>[data-slot=code-block-content]:focus-visible]:ring-ring/50 data-[size=sm]:text-xs", {
11
+ variants: { variant: {
12
+ default: "border border-input text-foreground has-[>[data-slot=code-block-content]:focus-visible]:border-ring dark:bg-input/30",
13
+ destructive: "border border-destructive/30 text-destructive dark:border-destructive/40"
14
+ } },
15
+ defaultVariants: { variant: "default" }
16
+ });
17
+ function CodeBlock({ className, variant = "default", size = "default", ...props }) {
18
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
19
+ "data-slot": "code-block",
20
+ "data-variant": variant,
21
+ "data-size": size,
22
+ className: (0, cn.cn)(codeBlockVariants({ variant }), className),
23
+ ...props
24
+ });
25
+ }
26
+ function CodeBlockHeader({ className, ...props }) {
27
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
28
+ "data-slot": "code-block-header",
29
+ className: (0, cn.cn)("flex min-w-0 shrink-0 items-center gap-2 px-3 pt-3 text-muted-foreground group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:pt-2.5 group-data-[variant=destructive]/code-block:text-destructive *:has-[>[data-slot=code-block-title]]:min-w-0", className),
30
+ ...props
31
+ });
32
+ }
33
+ function CodeBlockTitle({ className, ...props }) {
34
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
35
+ "data-slot": "code-block-title",
36
+ className: (0, cn.cn)("min-w-0 truncate font-sans text-sm font-medium text-foreground group-data-[size=sm]/code-block:text-xs group-data-[variant=destructive]/code-block:text-destructive [&_svg]:pointer-events-none [&_svg]:inline-block [&_svg]:align-middle [&_svg:not([class*='size-'])]:size-3.5 *:[svg]:me-1.5", className),
37
+ ...props
38
+ });
39
+ }
40
+ function CodeBlockActions({ className, ...props }) {
41
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
42
+ "data-slot": "code-block-actions",
43
+ className: (0, cn.cn)("-my-1 ms-auto -me-1.5 flex shrink-0 items-center gap-1 [[data-slot=code-block]>&]:absolute [[data-slot=code-block]>&]:end-2 [[data-slot=code-block]>&]:top-2 [[data-slot=code-block]>&]:z-10 [[data-slot=code-block]>&]:m-0 [[data-slot=code-block]>&]:opacity-0 [[data-slot=code-block]>&]:transition-opacity [[data-slot=code-block]>&]:group-focus-within/code-block:opacity-100 [[data-slot=code-block]>&]:group-hover/code-block:opacity-100 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:end-1.5 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:top-1.5 [[data-slot=code-block]>&]:pointer-coarse:opacity-100 [[data-slot=code-block]>&]:*:[button]:bg-background [[data-slot=code-block]>&]:*:[button]:ring-1 [[data-slot=code-block]>&]:*:[button]:ring-foreground/10", className),
44
+ ...props
45
+ });
46
+ }
47
+ function CodeBlockCopyButton({ value, variant = "ghost", size = "icon-xs", className, onClick, ...props }) {
48
+ const [copied, setCopied] = react.useState(false);
49
+ react.useEffect(() => {
50
+ if (!copied) return;
51
+ const timeout = setTimeout(() => setCopied(false), 2e3);
52
+ return () => clearTimeout(timeout);
53
+ }, [copied]);
54
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
55
+ "data-slot": "code-block-copy-button",
56
+ "data-copied": copied || void 0,
57
+ variant,
58
+ size,
59
+ "aria-label": copied ? "Copied" : "Copy",
60
+ className: (0, cn.cn)(className),
61
+ onClick: (event) => {
62
+ onClick?.(event);
63
+ navigator.clipboard.writeText(value).then(() => setCopied(true)).catch(() => {});
64
+ },
65
+ ...props,
66
+ children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CopyIcon, {})
67
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
68
+ "aria-live": "polite",
69
+ className: "sr-only",
70
+ children: copied ? "Copied" : ""
71
+ })] });
72
+ }
73
+ function CodeBlockContent({ className, children, style, wrap = false, lineNumbers = false, startLine = 1, ...props }) {
74
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
75
+ "data-slot": "code-block-content",
76
+ "data-wrap": wrap || void 0,
77
+ "data-numbered": lineNumbers || void 0,
78
+ dir: "ltr",
79
+ tabIndex: 0,
80
+ style: {
81
+ counterReset: `line ${startLine - 1}`,
82
+ ...style
83
+ },
84
+ className: (0, cn.cn)("min-h-0 min-w-0 scroll-fade-x scrollbar-thin overflow-auto px-3 py-3 text-start font-mono leading-relaxed outline-none group-has-data-[slot=code-block-footer]/code-block:pb-2 group-has-data-[slot=code-block-header]/code-block:pt-2 group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:py-2.5 group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1.5 data-wrap:scroll-fade-y data-wrap:wrap-break-word data-wrap:whitespace-pre-wrap", className),
85
+ ...props,
86
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
87
+ "data-slot": "code-block-code",
88
+ className: "grid min-h-lh min-w-max content-start in-data-numbered:grid-cols-[auto_1fr] in-data-wrap:min-w-0",
89
+ children: lineNumbers && typeof children === "string" ? children.replace(/\n$/, "").split("\n").map((line, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeBlockLine, { children: line }, index)) : children
90
+ })
91
+ });
92
+ }
93
+ const codeBlockLineVariants = (0, class_variance_authority.cva)("relative -mx-3 block min-h-lh px-3 group-data-[size=sm]/code-block:-mx-2.5 group-data-[size=sm]/code-block:px-2.5 before:min-w-6 before:text-end before:text-muted-foreground after:absolute after:start-1 after:top-0 after:text-muted-foreground after:select-none in-data-numbered:col-span-2 in-data-numbered:grid in-data-numbered:grid-cols-subgrid in-data-numbered:gap-x-3 in-data-numbered:[counter-increment:line] in-data-numbered:before:content-[counter(line)] in-data-numbered:before:select-none in-data-numbered:supports-[content:counter(line)_/_'']:before:content-[counter(line)_/_'']", {
94
+ variants: { variant: {
95
+ default: "",
96
+ added: "bg-muted after:content-['+']",
97
+ removed: "bg-destructive/10 after:text-destructive after:content-['−']",
98
+ highlighted: "bg-muted"
99
+ } },
100
+ defaultVariants: { variant: "default" }
101
+ });
102
+ function CodeBlockLine({ className, variant = "default", children, ...props }) {
103
+ const empty = children === void 0 || children === null || children === "" || Array.isArray(children) && children.length === 0;
104
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
105
+ "data-slot": "code-block-line",
106
+ "data-variant": variant,
107
+ className: (0, cn.cn)(codeBlockLineVariants({ variant }), className),
108
+ ...props,
109
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
110
+ "data-slot": "code-block-line-content",
111
+ className: "min-w-0",
112
+ children: empty ? "\n" : children
113
+ })
114
+ });
115
+ }
116
+ function CodeBlockFooter({ className, ...props }) {
117
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
118
+ "data-slot": "code-block-footer",
119
+ className: (0, cn.cn)("flex min-w-0 shrink-0 items-center gap-2 px-3 pb-3 text-muted-foreground group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:pb-2.5", className),
120
+ ...props
121
+ });
122
+ }
123
+ //#endregion
124
+ exports.CodeBlock = CodeBlock;
125
+ exports.CodeBlockActions = CodeBlockActions;
126
+ exports.CodeBlockContent = CodeBlockContent;
127
+ exports.CodeBlockCopyButton = CodeBlockCopyButton;
128
+ exports.CodeBlockFooter = CodeBlockFooter;
129
+ exports.CodeBlockHeader = CodeBlockHeader;
130
+ exports.CodeBlockLine = CodeBlockLine;
131
+ exports.CodeBlockTitle = CodeBlockTitle;
132
+
133
+ //# sourceMappingURL=code-block.cjs.map