@optilogic/core 1.0.0-beta.14 → 1.0.0-beta.16

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/index.d.cts CHANGED
@@ -2706,6 +2706,293 @@ interface UseContextMenuResult<T = unknown> {
2706
2706
  }
2707
2707
  declare function useContextMenu<T = unknown>(): UseContextMenuResult<T>;
2708
2708
 
2709
+ /**
2710
+ * Built-in content types that FileView can render.
2711
+ */
2712
+ type BuiltInContentType = "code" | "markdown" | "image" | "pdf" | "csv" | "html" | "plaintext" | "unknown";
2713
+ /**
2714
+ * Content type - either a built-in type or a custom string.
2715
+ * The `(string & {})` pattern preserves autocomplete for built-in types
2716
+ * while accepting arbitrary strings for custom renderers.
2717
+ */
2718
+ type ContentType = BuiltInContentType | (string & {});
2719
+ /**
2720
+ * Callback to resolve image `src` values to renderable URLs.
2721
+ * Called for non-remote, non-data-URI image sources in markdown content.
2722
+ * Can return a blob URL, data URL, or any string that works as an `<img>` src.
2723
+ */
2724
+ type ResolveImageUrl = (src: string) => Promise<string> | string;
2725
+ /**
2726
+ * Props passed to every renderer component.
2727
+ * All renderers receive a consistent contract regardless of content type.
2728
+ */
2729
+ interface FileRendererProps {
2730
+ /** Text content of the file. Null when content is binary/URL-based. */
2731
+ content: string | null;
2732
+ /** URL for binary content (images, PDFs). Null for text-based content. */
2733
+ url: string | null;
2734
+ /** The file name, used for display and language detection. */
2735
+ fileName: string;
2736
+ /** The resolved content type. */
2737
+ contentType: ContentType;
2738
+ /** Optional className for the renderer container. */
2739
+ className?: string;
2740
+ /** Optional callback to resolve relative image URLs in markdown content. */
2741
+ resolveImageUrl?: ResolveImageUrl;
2742
+ }
2743
+ /**
2744
+ * A renderer component that can render file content.
2745
+ */
2746
+ type FileRenderer = React$1.ComponentType<FileRendererProps>;
2747
+ /**
2748
+ * Registry mapping content types to renderer components.
2749
+ * Users can override individual renderers by providing their own map.
2750
+ */
2751
+ type RendererRegistry = Partial<Record<ContentType, FileRenderer>>;
2752
+ /**
2753
+ * Error information for the FileView.
2754
+ */
2755
+ interface FileViewError {
2756
+ /** Error message to display. */
2757
+ message: string;
2758
+ /** Optional retry callback. If provided, a retry button is shown. */
2759
+ onRetry?: () => void;
2760
+ }
2761
+ /**
2762
+ * Props for the FileView component.
2763
+ */
2764
+ interface FileViewProps {
2765
+ /**
2766
+ * Text content of the file.
2767
+ * For text-based files (code, markdown, plaintext, csv), pass the string content.
2768
+ * For binary files (images, PDFs), pass null and use `url` instead.
2769
+ */
2770
+ content: string | null;
2771
+ /**
2772
+ * URL for binary content.
2773
+ * Used for images, PDFs, and other non-text content.
2774
+ * Can be an object URL, data URL, or HTTP URL.
2775
+ */
2776
+ url?: string | null;
2777
+ /**
2778
+ * The file name including extension.
2779
+ * Used for content type detection and display context.
2780
+ * @example "README.md", "app.tsx", "photo.png"
2781
+ */
2782
+ fileName: string;
2783
+ /**
2784
+ * Explicit content type override.
2785
+ * When provided, bypasses automatic detection from fileName.
2786
+ */
2787
+ contentType?: ContentType;
2788
+ /**
2789
+ * Custom renderer overrides.
2790
+ * Merges with (and overrides) the default renderer registry.
2791
+ * Only the types you specify are overridden; others use defaults.
2792
+ *
2793
+ * @example
2794
+ * renderers={{ code: MyCustomCodeRenderer }}
2795
+ */
2796
+ renderers?: RendererRegistry;
2797
+ /** Loading state. When true, shows loading indicator. */
2798
+ loading?: boolean;
2799
+ /** Error state. When provided, shows error message with optional retry. */
2800
+ error?: FileViewError | null;
2801
+ /** Custom loading component. Replaces the default spinner. */
2802
+ loadingComponent?: React$1.ReactNode;
2803
+ /** Custom empty state component. Shown when content is null/empty and not loading/error. */
2804
+ emptyComponent?: React$1.ReactNode;
2805
+ /**
2806
+ * Empty state message. Used when no custom emptyComponent is provided.
2807
+ * @default "No content to display"
2808
+ */
2809
+ emptyMessage?: string;
2810
+ /** Custom error component. Replaces the default error display. */
2811
+ errorComponent?: React$1.ComponentType<{
2812
+ error: FileViewError;
2813
+ }>;
2814
+ /** Additional class name for the outermost container. */
2815
+ className?: string;
2816
+ /** Additional class name passed to the active renderer. */
2817
+ rendererClassName?: string;
2818
+ /**
2819
+ * Optional callback to resolve image `src` values to renderable URLs.
2820
+ * Used by MarkdownRenderer for relative/non-remote image paths.
2821
+ * Remote URLs (http/https) and data URIs are passed through unchanged.
2822
+ */
2823
+ resolveImageUrl?: ResolveImageUrl;
2824
+ }
2825
+ /**
2826
+ * Content type detection result.
2827
+ */
2828
+ interface ContentTypeDetectionResult {
2829
+ /** The detected content type. */
2830
+ type: ContentType;
2831
+ /** The file extension that was matched, if any. */
2832
+ extension: string | null;
2833
+ }
2834
+
2835
+ /**
2836
+ * FileView
2837
+ *
2838
+ * A configurable file viewer that detects content type from the file name
2839
+ * and delegates rendering to a pluggable renderer system.
2840
+ *
2841
+ * Built-in renderers: Code, Markdown, Image, PlainText.
2842
+ * Users can override any renderer or add custom ones via the `renderers` prop.
2843
+ *
2844
+ * @example
2845
+ * <FileView fileName="app.tsx" content={sourceCode} />
2846
+ *
2847
+ * @example
2848
+ * <FileView fileName="photo.png" content={null} url={imageUrl} />
2849
+ *
2850
+ * @example
2851
+ * <FileView
2852
+ * fileName="data.txt"
2853
+ * content={jsonContent}
2854
+ * contentType="code"
2855
+ * renderers={{ code: MyCustomCodeRenderer }}
2856
+ * />
2857
+ */
2858
+ declare function FileView({ content, url, fileName, contentType: contentTypeOverride, renderers: userRenderers, loading, error, loadingComponent, emptyComponent, emptyMessage, errorComponent: ErrorComponent, className, rendererClassName, resolveImageUrl, }: FileViewProps): react_jsx_runtime.JSX.Element;
2859
+ declare namespace FileView {
2860
+ var displayName: string;
2861
+ }
2862
+
2863
+ /**
2864
+ * CodeRenderer
2865
+ *
2866
+ * Renders text content as code with line numbers in a left gutter.
2867
+ * Uses shiki for syntax highlighting when available, falling back to
2868
+ * plain monospace text otherwise.
2869
+ *
2870
+ * Layout:
2871
+ * ┌─────────────────────────────────────────┐
2872
+ * │ 1 │ import React from "react"; │
2873
+ * │ 2 │ │
2874
+ * │ 3 │ export function App() { │
2875
+ * │ 4 │ return <div>Hello</div>; │
2876
+ * │ 5 │ } │
2877
+ * └─────────────────────────────────────────┘
2878
+ */
2879
+ declare function CodeRenderer({ content, fileName, className, }: FileRendererProps): react_jsx_runtime.JSX.Element;
2880
+ declare namespace CodeRenderer {
2881
+ var displayName: string;
2882
+ }
2883
+
2884
+ /**
2885
+ * MarkdownRenderer
2886
+ *
2887
+ * Renders markdown content using react-markdown + remark-gfm.
2888
+ * Fenced code blocks use shiki syntax highlighting when available.
2889
+ * Styled with Tailwind using semantic CSS variables for theme support.
2890
+ *
2891
+ * Requires `react-markdown` and `remark-gfm` as peer dependencies of @optilogic/core.
2892
+ */
2893
+ declare function MarkdownRenderer({ content, className, resolveImageUrl, }: FileRendererProps): react_jsx_runtime.JSX.Element;
2894
+ declare namespace MarkdownRenderer {
2895
+ var displayName: string;
2896
+ }
2897
+
2898
+ /**
2899
+ * ImageRenderer
2900
+ *
2901
+ * Renders an image from a URL, centered in its container.
2902
+ * Handles load errors with a fallback message.
2903
+ */
2904
+ declare function ImageRenderer({ url, fileName, className, }: FileRendererProps): react_jsx_runtime.JSX.Element;
2905
+ declare namespace ImageRenderer {
2906
+ var displayName: string;
2907
+ }
2908
+
2909
+ /**
2910
+ * PlainTextRenderer
2911
+ *
2912
+ * Renders plain text content without line numbers.
2913
+ * Used for .txt, .log, and as the ultimate fallback renderer.
2914
+ */
2915
+ declare function PlainTextRenderer({ content, className }: FileRendererProps): react_jsx_runtime.JSX.Element;
2916
+ declare namespace PlainTextRenderer {
2917
+ var displayName: string;
2918
+ }
2919
+
2920
+ /**
2921
+ * CsvRenderer
2922
+ *
2923
+ * Parses CSV/TSV content and renders it in a DataGrid
2924
+ * with sorting, filtering, resizable columns, and virtualization.
2925
+ */
2926
+ declare function CsvRenderer({ content, className }: FileRendererProps): react_jsx_runtime.JSX.Element;
2927
+ declare namespace CsvRenderer {
2928
+ var displayName: string;
2929
+ }
2930
+
2931
+ /**
2932
+ * HtmlRenderer
2933
+ *
2934
+ * Renders HTML content in a fully sandboxed iframe.
2935
+ */
2936
+ declare function HtmlRenderer({ content, fileName, className, }: FileRendererProps): react_jsx_runtime.JSX.Element;
2937
+ declare namespace HtmlRenderer {
2938
+ var displayName: string;
2939
+ }
2940
+
2941
+ interface UseContentTypeOptions {
2942
+ fileName: string;
2943
+ contentTypeOverride?: ContentType;
2944
+ }
2945
+ interface UseContentTypeReturn extends ContentTypeDetectionResult {
2946
+ /** Whether the type was explicitly overridden. */
2947
+ isOverridden: boolean;
2948
+ }
2949
+ /**
2950
+ * Hook to determine the content type for a file.
2951
+ * Uses explicit override if provided, otherwise auto-detects from fileName.
2952
+ */
2953
+ declare function useContentType({ fileName, contentTypeOverride, }: UseContentTypeOptions): UseContentTypeReturn;
2954
+
2955
+ /**
2956
+ * Extract the file extension from a file name.
2957
+ * Handles dotfiles (e.g., ".gitignore" -> "gitignore") and
2958
+ * compound extensions (e.g., "file.test.ts" -> "ts").
2959
+ */
2960
+ declare function getFileExtension(fileName: string): string | null;
2961
+ /**
2962
+ * Detect content type from a file name.
2963
+ *
2964
+ * @example
2965
+ * detectContentType("app.tsx") // { type: "code", extension: "tsx" }
2966
+ * detectContentType("README.md") // { type: "markdown", extension: "md" }
2967
+ * detectContentType("photo.png") // { type: "image", extension: "png" }
2968
+ * detectContentType("unknown.xyz") // { type: "unknown", extension: "xyz" }
2969
+ */
2970
+ declare function detectContentType(fileName: string): ContentTypeDetectionResult;
2971
+ /**
2972
+ * Check if a content type is text-based (uses `content` string).
2973
+ */
2974
+ declare function isTextContentType(contentType: ContentType): boolean;
2975
+ /**
2976
+ * Check if a content type is URL-based (uses `url` string).
2977
+ */
2978
+ declare function isUrlContentType(contentType: ContentType): boolean;
2979
+
2980
+ /**
2981
+ * Default renderer registry.
2982
+ * Maps built-in content types to their default renderer components.
2983
+ */
2984
+ declare const DEFAULT_RENDERERS: RendererRegistry;
2985
+ /**
2986
+ * Merge user-provided renderers with defaults.
2987
+ * User renderers override defaults for the same content type.
2988
+ */
2989
+ declare function mergeRenderers(userRenderers?: RendererRegistry): RendererRegistry;
2990
+ /**
2991
+ * Resolve a renderer for a given content type.
2992
+ * Falls back to PlainTextRenderer if no match found.
2993
+ */
2994
+ declare function resolveRenderer(registry: RendererRegistry, contentType: string): FileRenderer;
2995
+
2709
2996
  /** @deprecated Use SortConfig instead */
2710
2997
  type SortingConfig = {
2711
2998
  field: string;
@@ -2713,4 +3000,4 @@ type SortingConfig = {
2713
3000
  onSort: (field: string) => void;
2714
3001
  };
2715
3002
 
2716
- export { ALL_THEMES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, AccordionTrigger, type AccordionTriggerProps, type AccordionVariant, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Autocomplete, type AutocompleteOption, type AutocompleteProps, Badge, type BadgeProps, Board, BoardContent, type BoardContentProps, BoardHeader, type BoardHeaderProps, type BoardProps, Button, type ButtonProps, CYBERPUNK_THEME, Calendar, type CalendarProps, Card, CardActions, type CardActionsProps, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardGrid, type CardGridProps, CardHeader, type CardHeaderProps, CardImage, type CardImageProps, CardList, type CardListProps, type CardProps, CardTitle, type CardTitleProps, type CellEditEvent, CellEditor, type CellEditorProps$1 as CellEditorProps, type CellPosition, Checkbox, type CheckboxProps, Chip, type ChipProps, type ColorFieldConfig, type ColumnDef, ConfirmationModal, type ConfirmationModalProps, ContextMenu, type ContextMenuItem, type ContextMenuProps, CopyButton, type CopyButtonProps, DARK_ELEGANT_THEME, DataGrid, type DataGridContextValue, type DataGridInternalState, type DataGridProps, type DataGridState, DataTable, type DataTableColumn, type DataTableProps, type DataTableSort, type DateFilterOperator, DatePicker, DatePickerInput, type DatePickerInputProps, type DatePickerProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, type DropdownMenuShortcutProps, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, type EditingCell, type EditorType, FOREST_THEME, FUTURISTIC_THEME, type FilterConfig, type FilterOperator, FilterPopover, type FilterPopoverProps$1 as FilterPopoverProps, type FilterType, GREEN_THEME, type GridCellProps, HeaderCell, type HeaderCellProps$1 as HeaderCellProps, IconButton, type IconButtonProps, Input, type InputProps, Label, type LabelProps, LoadingSpinner, type LoadingSpinnerProps, MINIMALIST_LIGHT_THEME, Modal, ModalButton, type ModalButtonProps, type ModalProps, NATURE_THEME, type NumberFilterOperator, OCEAN_THEME, OPTILOGIC_LEGACY_THEME, PRESET_THEMES, type PaginationConfig, Popover, PopoverAnchor, PopoverContent, type PopoverContentProps, PopoverTrigger, Progress, type ProgressProps, ResizablePanel, type ResizablePanelProps, ResizeHandle, type ResizeHandleProps, SCIFI_THEME, SUNSET_THEME, type SearchConfig, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOption, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, SelectableCard, type SelectableCardProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, type SortConfig, type SortingConfig, Switch, type SwitchProps, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, TabsContent, TabsList, TabsTrigger, type TextFilterOperator, Textarea, type TextareaProps, type Theme, type ThemeHSL, type ThemeHex, ThemePicker, type ThemePickerProps, Toaster, type ToasterProps, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, type TooltipProps, TooltipProvider, TooltipRoot, TooltipTrigger, type UseContextMenuResult, accordionContentVariants, accordionItemVariants, accordionTriggerVariants, applyFilterOperator, applyFilters, applySorting, applyTheme, areThemesEqual, badgeVariants, boardVariants, buttonVariants, cardActionsVariants, cardGridVariants, cardImageVariants, cardListVariants, cardVariants, cloneTheme, cn, exportTheme, getCellValue, getCurrentTheme, getDefaultTheme, getPresetTheme, hexToHsl, iconButtonVariants, importTheme, isPresetTheme, labelVariants, loadingSpinnerVariants, themeToHsl, useColumnResize, useColumnResizeManager, useConfirmation, useContextMenu, useDataGridState, useKeyboardNavigation, validateTheme };
3003
+ export { ALL_THEMES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, AccordionTrigger, type AccordionTriggerProps, type AccordionVariant, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Autocomplete, type AutocompleteOption, type AutocompleteProps, Badge, type BadgeProps, Board, BoardContent, type BoardContentProps, BoardHeader, type BoardHeaderProps, type BoardProps, type BuiltInContentType, Button, type ButtonProps, CYBERPUNK_THEME, Calendar, type CalendarProps, Card, CardActions, type CardActionsProps, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardGrid, type CardGridProps, CardHeader, type CardHeaderProps, CardImage, type CardImageProps, CardList, type CardListProps, type CardProps, CardTitle, type CardTitleProps, type CellEditEvent, CellEditor, type CellEditorProps$1 as CellEditorProps, type CellPosition, Checkbox, type CheckboxProps, Chip, type ChipProps, CodeRenderer, type ColorFieldConfig, type ColumnDef, ConfirmationModal, type ConfirmationModalProps, type ContentType, type ContentTypeDetectionResult, ContextMenu, type ContextMenuItem, type ContextMenuProps, CopyButton, type CopyButtonProps, CsvRenderer, DARK_ELEGANT_THEME, DEFAULT_RENDERERS, DataGrid, type DataGridContextValue, type DataGridInternalState, type DataGridProps, type DataGridState, DataTable, type DataTableColumn, type DataTableProps, type DataTableSort, type DateFilterOperator, DatePicker, DatePickerInput, type DatePickerInputProps, type DatePickerProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, type DropdownMenuShortcutProps, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, type EditingCell, type EditorType, FOREST_THEME, FUTURISTIC_THEME, type FileRenderer, type FileRendererProps, FileView, type FileViewError, type FileViewProps, type FilterConfig, type FilterOperator, FilterPopover, type FilterPopoverProps$1 as FilterPopoverProps, type FilterType, GREEN_THEME, type GridCellProps, HeaderCell, type HeaderCellProps$1 as HeaderCellProps, HtmlRenderer, IconButton, type IconButtonProps, ImageRenderer, Input, type InputProps, Label, type LabelProps, LoadingSpinner, type LoadingSpinnerProps, MINIMALIST_LIGHT_THEME, MarkdownRenderer, Modal, ModalButton, type ModalButtonProps, type ModalProps, NATURE_THEME, type NumberFilterOperator, OCEAN_THEME, OPTILOGIC_LEGACY_THEME, PRESET_THEMES, type PaginationConfig, PlainTextRenderer, Popover, PopoverAnchor, PopoverContent, type PopoverContentProps, PopoverTrigger, Progress, type ProgressProps, type RendererRegistry, ResizablePanel, type ResizablePanelProps, ResizeHandle, type ResizeHandleProps, type ResolveImageUrl, SCIFI_THEME, SUNSET_THEME, type SearchConfig, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOption, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, SelectableCard, type SelectableCardProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, type SortConfig, type SortingConfig, Switch, type SwitchProps, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, TabsContent, TabsList, TabsTrigger, type TextFilterOperator, Textarea, type TextareaProps, type Theme, type ThemeHSL, type ThemeHex, ThemePicker, type ThemePickerProps, Toaster, type ToasterProps, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, type TooltipProps, TooltipProvider, TooltipRoot, TooltipTrigger, type UseContentTypeOptions, type UseContentTypeReturn, type UseContextMenuResult, accordionContentVariants, accordionItemVariants, accordionTriggerVariants, applyFilterOperator, applyFilters, applySorting, applyTheme, areThemesEqual, badgeVariants, boardVariants, buttonVariants, cardActionsVariants, cardGridVariants, cardImageVariants, cardListVariants, cardVariants, cloneTheme, cn, detectContentType, exportTheme, getCellValue, getCurrentTheme, getDefaultTheme, getFileExtension, getPresetTheme, hexToHsl, iconButtonVariants, importTheme, isPresetTheme, isTextContentType, isUrlContentType, labelVariants, loadingSpinnerVariants, mergeRenderers, resolveRenderer, themeToHsl, useColumnResize, useColumnResizeManager, useConfirmation, useContentType, useContextMenu, useDataGridState, useKeyboardNavigation, validateTheme };
package/dist/index.d.ts CHANGED
@@ -2706,6 +2706,293 @@ interface UseContextMenuResult<T = unknown> {
2706
2706
  }
2707
2707
  declare function useContextMenu<T = unknown>(): UseContextMenuResult<T>;
2708
2708
 
2709
+ /**
2710
+ * Built-in content types that FileView can render.
2711
+ */
2712
+ type BuiltInContentType = "code" | "markdown" | "image" | "pdf" | "csv" | "html" | "plaintext" | "unknown";
2713
+ /**
2714
+ * Content type - either a built-in type or a custom string.
2715
+ * The `(string & {})` pattern preserves autocomplete for built-in types
2716
+ * while accepting arbitrary strings for custom renderers.
2717
+ */
2718
+ type ContentType = BuiltInContentType | (string & {});
2719
+ /**
2720
+ * Callback to resolve image `src` values to renderable URLs.
2721
+ * Called for non-remote, non-data-URI image sources in markdown content.
2722
+ * Can return a blob URL, data URL, or any string that works as an `<img>` src.
2723
+ */
2724
+ type ResolveImageUrl = (src: string) => Promise<string> | string;
2725
+ /**
2726
+ * Props passed to every renderer component.
2727
+ * All renderers receive a consistent contract regardless of content type.
2728
+ */
2729
+ interface FileRendererProps {
2730
+ /** Text content of the file. Null when content is binary/URL-based. */
2731
+ content: string | null;
2732
+ /** URL for binary content (images, PDFs). Null for text-based content. */
2733
+ url: string | null;
2734
+ /** The file name, used for display and language detection. */
2735
+ fileName: string;
2736
+ /** The resolved content type. */
2737
+ contentType: ContentType;
2738
+ /** Optional className for the renderer container. */
2739
+ className?: string;
2740
+ /** Optional callback to resolve relative image URLs in markdown content. */
2741
+ resolveImageUrl?: ResolveImageUrl;
2742
+ }
2743
+ /**
2744
+ * A renderer component that can render file content.
2745
+ */
2746
+ type FileRenderer = React$1.ComponentType<FileRendererProps>;
2747
+ /**
2748
+ * Registry mapping content types to renderer components.
2749
+ * Users can override individual renderers by providing their own map.
2750
+ */
2751
+ type RendererRegistry = Partial<Record<ContentType, FileRenderer>>;
2752
+ /**
2753
+ * Error information for the FileView.
2754
+ */
2755
+ interface FileViewError {
2756
+ /** Error message to display. */
2757
+ message: string;
2758
+ /** Optional retry callback. If provided, a retry button is shown. */
2759
+ onRetry?: () => void;
2760
+ }
2761
+ /**
2762
+ * Props for the FileView component.
2763
+ */
2764
+ interface FileViewProps {
2765
+ /**
2766
+ * Text content of the file.
2767
+ * For text-based files (code, markdown, plaintext, csv), pass the string content.
2768
+ * For binary files (images, PDFs), pass null and use `url` instead.
2769
+ */
2770
+ content: string | null;
2771
+ /**
2772
+ * URL for binary content.
2773
+ * Used for images, PDFs, and other non-text content.
2774
+ * Can be an object URL, data URL, or HTTP URL.
2775
+ */
2776
+ url?: string | null;
2777
+ /**
2778
+ * The file name including extension.
2779
+ * Used for content type detection and display context.
2780
+ * @example "README.md", "app.tsx", "photo.png"
2781
+ */
2782
+ fileName: string;
2783
+ /**
2784
+ * Explicit content type override.
2785
+ * When provided, bypasses automatic detection from fileName.
2786
+ */
2787
+ contentType?: ContentType;
2788
+ /**
2789
+ * Custom renderer overrides.
2790
+ * Merges with (and overrides) the default renderer registry.
2791
+ * Only the types you specify are overridden; others use defaults.
2792
+ *
2793
+ * @example
2794
+ * renderers={{ code: MyCustomCodeRenderer }}
2795
+ */
2796
+ renderers?: RendererRegistry;
2797
+ /** Loading state. When true, shows loading indicator. */
2798
+ loading?: boolean;
2799
+ /** Error state. When provided, shows error message with optional retry. */
2800
+ error?: FileViewError | null;
2801
+ /** Custom loading component. Replaces the default spinner. */
2802
+ loadingComponent?: React$1.ReactNode;
2803
+ /** Custom empty state component. Shown when content is null/empty and not loading/error. */
2804
+ emptyComponent?: React$1.ReactNode;
2805
+ /**
2806
+ * Empty state message. Used when no custom emptyComponent is provided.
2807
+ * @default "No content to display"
2808
+ */
2809
+ emptyMessage?: string;
2810
+ /** Custom error component. Replaces the default error display. */
2811
+ errorComponent?: React$1.ComponentType<{
2812
+ error: FileViewError;
2813
+ }>;
2814
+ /** Additional class name for the outermost container. */
2815
+ className?: string;
2816
+ /** Additional class name passed to the active renderer. */
2817
+ rendererClassName?: string;
2818
+ /**
2819
+ * Optional callback to resolve image `src` values to renderable URLs.
2820
+ * Used by MarkdownRenderer for relative/non-remote image paths.
2821
+ * Remote URLs (http/https) and data URIs are passed through unchanged.
2822
+ */
2823
+ resolveImageUrl?: ResolveImageUrl;
2824
+ }
2825
+ /**
2826
+ * Content type detection result.
2827
+ */
2828
+ interface ContentTypeDetectionResult {
2829
+ /** The detected content type. */
2830
+ type: ContentType;
2831
+ /** The file extension that was matched, if any. */
2832
+ extension: string | null;
2833
+ }
2834
+
2835
+ /**
2836
+ * FileView
2837
+ *
2838
+ * A configurable file viewer that detects content type from the file name
2839
+ * and delegates rendering to a pluggable renderer system.
2840
+ *
2841
+ * Built-in renderers: Code, Markdown, Image, PlainText.
2842
+ * Users can override any renderer or add custom ones via the `renderers` prop.
2843
+ *
2844
+ * @example
2845
+ * <FileView fileName="app.tsx" content={sourceCode} />
2846
+ *
2847
+ * @example
2848
+ * <FileView fileName="photo.png" content={null} url={imageUrl} />
2849
+ *
2850
+ * @example
2851
+ * <FileView
2852
+ * fileName="data.txt"
2853
+ * content={jsonContent}
2854
+ * contentType="code"
2855
+ * renderers={{ code: MyCustomCodeRenderer }}
2856
+ * />
2857
+ */
2858
+ declare function FileView({ content, url, fileName, contentType: contentTypeOverride, renderers: userRenderers, loading, error, loadingComponent, emptyComponent, emptyMessage, errorComponent: ErrorComponent, className, rendererClassName, resolveImageUrl, }: FileViewProps): react_jsx_runtime.JSX.Element;
2859
+ declare namespace FileView {
2860
+ var displayName: string;
2861
+ }
2862
+
2863
+ /**
2864
+ * CodeRenderer
2865
+ *
2866
+ * Renders text content as code with line numbers in a left gutter.
2867
+ * Uses shiki for syntax highlighting when available, falling back to
2868
+ * plain monospace text otherwise.
2869
+ *
2870
+ * Layout:
2871
+ * ┌─────────────────────────────────────────┐
2872
+ * │ 1 │ import React from "react"; │
2873
+ * │ 2 │ │
2874
+ * │ 3 │ export function App() { │
2875
+ * │ 4 │ return <div>Hello</div>; │
2876
+ * │ 5 │ } │
2877
+ * └─────────────────────────────────────────┘
2878
+ */
2879
+ declare function CodeRenderer({ content, fileName, className, }: FileRendererProps): react_jsx_runtime.JSX.Element;
2880
+ declare namespace CodeRenderer {
2881
+ var displayName: string;
2882
+ }
2883
+
2884
+ /**
2885
+ * MarkdownRenderer
2886
+ *
2887
+ * Renders markdown content using react-markdown + remark-gfm.
2888
+ * Fenced code blocks use shiki syntax highlighting when available.
2889
+ * Styled with Tailwind using semantic CSS variables for theme support.
2890
+ *
2891
+ * Requires `react-markdown` and `remark-gfm` as peer dependencies of @optilogic/core.
2892
+ */
2893
+ declare function MarkdownRenderer({ content, className, resolveImageUrl, }: FileRendererProps): react_jsx_runtime.JSX.Element;
2894
+ declare namespace MarkdownRenderer {
2895
+ var displayName: string;
2896
+ }
2897
+
2898
+ /**
2899
+ * ImageRenderer
2900
+ *
2901
+ * Renders an image from a URL, centered in its container.
2902
+ * Handles load errors with a fallback message.
2903
+ */
2904
+ declare function ImageRenderer({ url, fileName, className, }: FileRendererProps): react_jsx_runtime.JSX.Element;
2905
+ declare namespace ImageRenderer {
2906
+ var displayName: string;
2907
+ }
2908
+
2909
+ /**
2910
+ * PlainTextRenderer
2911
+ *
2912
+ * Renders plain text content without line numbers.
2913
+ * Used for .txt, .log, and as the ultimate fallback renderer.
2914
+ */
2915
+ declare function PlainTextRenderer({ content, className }: FileRendererProps): react_jsx_runtime.JSX.Element;
2916
+ declare namespace PlainTextRenderer {
2917
+ var displayName: string;
2918
+ }
2919
+
2920
+ /**
2921
+ * CsvRenderer
2922
+ *
2923
+ * Parses CSV/TSV content and renders it in a DataGrid
2924
+ * with sorting, filtering, resizable columns, and virtualization.
2925
+ */
2926
+ declare function CsvRenderer({ content, className }: FileRendererProps): react_jsx_runtime.JSX.Element;
2927
+ declare namespace CsvRenderer {
2928
+ var displayName: string;
2929
+ }
2930
+
2931
+ /**
2932
+ * HtmlRenderer
2933
+ *
2934
+ * Renders HTML content in a fully sandboxed iframe.
2935
+ */
2936
+ declare function HtmlRenderer({ content, fileName, className, }: FileRendererProps): react_jsx_runtime.JSX.Element;
2937
+ declare namespace HtmlRenderer {
2938
+ var displayName: string;
2939
+ }
2940
+
2941
+ interface UseContentTypeOptions {
2942
+ fileName: string;
2943
+ contentTypeOverride?: ContentType;
2944
+ }
2945
+ interface UseContentTypeReturn extends ContentTypeDetectionResult {
2946
+ /** Whether the type was explicitly overridden. */
2947
+ isOverridden: boolean;
2948
+ }
2949
+ /**
2950
+ * Hook to determine the content type for a file.
2951
+ * Uses explicit override if provided, otherwise auto-detects from fileName.
2952
+ */
2953
+ declare function useContentType({ fileName, contentTypeOverride, }: UseContentTypeOptions): UseContentTypeReturn;
2954
+
2955
+ /**
2956
+ * Extract the file extension from a file name.
2957
+ * Handles dotfiles (e.g., ".gitignore" -> "gitignore") and
2958
+ * compound extensions (e.g., "file.test.ts" -> "ts").
2959
+ */
2960
+ declare function getFileExtension(fileName: string): string | null;
2961
+ /**
2962
+ * Detect content type from a file name.
2963
+ *
2964
+ * @example
2965
+ * detectContentType("app.tsx") // { type: "code", extension: "tsx" }
2966
+ * detectContentType("README.md") // { type: "markdown", extension: "md" }
2967
+ * detectContentType("photo.png") // { type: "image", extension: "png" }
2968
+ * detectContentType("unknown.xyz") // { type: "unknown", extension: "xyz" }
2969
+ */
2970
+ declare function detectContentType(fileName: string): ContentTypeDetectionResult;
2971
+ /**
2972
+ * Check if a content type is text-based (uses `content` string).
2973
+ */
2974
+ declare function isTextContentType(contentType: ContentType): boolean;
2975
+ /**
2976
+ * Check if a content type is URL-based (uses `url` string).
2977
+ */
2978
+ declare function isUrlContentType(contentType: ContentType): boolean;
2979
+
2980
+ /**
2981
+ * Default renderer registry.
2982
+ * Maps built-in content types to their default renderer components.
2983
+ */
2984
+ declare const DEFAULT_RENDERERS: RendererRegistry;
2985
+ /**
2986
+ * Merge user-provided renderers with defaults.
2987
+ * User renderers override defaults for the same content type.
2988
+ */
2989
+ declare function mergeRenderers(userRenderers?: RendererRegistry): RendererRegistry;
2990
+ /**
2991
+ * Resolve a renderer for a given content type.
2992
+ * Falls back to PlainTextRenderer if no match found.
2993
+ */
2994
+ declare function resolveRenderer(registry: RendererRegistry, contentType: string): FileRenderer;
2995
+
2709
2996
  /** @deprecated Use SortConfig instead */
2710
2997
  type SortingConfig = {
2711
2998
  field: string;
@@ -2713,4 +3000,4 @@ type SortingConfig = {
2713
3000
  onSort: (field: string) => void;
2714
3001
  };
2715
3002
 
2716
- export { ALL_THEMES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, AccordionTrigger, type AccordionTriggerProps, type AccordionVariant, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Autocomplete, type AutocompleteOption, type AutocompleteProps, Badge, type BadgeProps, Board, BoardContent, type BoardContentProps, BoardHeader, type BoardHeaderProps, type BoardProps, Button, type ButtonProps, CYBERPUNK_THEME, Calendar, type CalendarProps, Card, CardActions, type CardActionsProps, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardGrid, type CardGridProps, CardHeader, type CardHeaderProps, CardImage, type CardImageProps, CardList, type CardListProps, type CardProps, CardTitle, type CardTitleProps, type CellEditEvent, CellEditor, type CellEditorProps$1 as CellEditorProps, type CellPosition, Checkbox, type CheckboxProps, Chip, type ChipProps, type ColorFieldConfig, type ColumnDef, ConfirmationModal, type ConfirmationModalProps, ContextMenu, type ContextMenuItem, type ContextMenuProps, CopyButton, type CopyButtonProps, DARK_ELEGANT_THEME, DataGrid, type DataGridContextValue, type DataGridInternalState, type DataGridProps, type DataGridState, DataTable, type DataTableColumn, type DataTableProps, type DataTableSort, type DateFilterOperator, DatePicker, DatePickerInput, type DatePickerInputProps, type DatePickerProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, type DropdownMenuShortcutProps, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, type EditingCell, type EditorType, FOREST_THEME, FUTURISTIC_THEME, type FilterConfig, type FilterOperator, FilterPopover, type FilterPopoverProps$1 as FilterPopoverProps, type FilterType, GREEN_THEME, type GridCellProps, HeaderCell, type HeaderCellProps$1 as HeaderCellProps, IconButton, type IconButtonProps, Input, type InputProps, Label, type LabelProps, LoadingSpinner, type LoadingSpinnerProps, MINIMALIST_LIGHT_THEME, Modal, ModalButton, type ModalButtonProps, type ModalProps, NATURE_THEME, type NumberFilterOperator, OCEAN_THEME, OPTILOGIC_LEGACY_THEME, PRESET_THEMES, type PaginationConfig, Popover, PopoverAnchor, PopoverContent, type PopoverContentProps, PopoverTrigger, Progress, type ProgressProps, ResizablePanel, type ResizablePanelProps, ResizeHandle, type ResizeHandleProps, SCIFI_THEME, SUNSET_THEME, type SearchConfig, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOption, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, SelectableCard, type SelectableCardProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, type SortConfig, type SortingConfig, Switch, type SwitchProps, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, TabsContent, TabsList, TabsTrigger, type TextFilterOperator, Textarea, type TextareaProps, type Theme, type ThemeHSL, type ThemeHex, ThemePicker, type ThemePickerProps, Toaster, type ToasterProps, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, type TooltipProps, TooltipProvider, TooltipRoot, TooltipTrigger, type UseContextMenuResult, accordionContentVariants, accordionItemVariants, accordionTriggerVariants, applyFilterOperator, applyFilters, applySorting, applyTheme, areThemesEqual, badgeVariants, boardVariants, buttonVariants, cardActionsVariants, cardGridVariants, cardImageVariants, cardListVariants, cardVariants, cloneTheme, cn, exportTheme, getCellValue, getCurrentTheme, getDefaultTheme, getPresetTheme, hexToHsl, iconButtonVariants, importTheme, isPresetTheme, labelVariants, loadingSpinnerVariants, themeToHsl, useColumnResize, useColumnResizeManager, useConfirmation, useContextMenu, useDataGridState, useKeyboardNavigation, validateTheme };
3003
+ export { ALL_THEMES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, AccordionTrigger, type AccordionTriggerProps, type AccordionVariant, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Autocomplete, type AutocompleteOption, type AutocompleteProps, Badge, type BadgeProps, Board, BoardContent, type BoardContentProps, BoardHeader, type BoardHeaderProps, type BoardProps, type BuiltInContentType, Button, type ButtonProps, CYBERPUNK_THEME, Calendar, type CalendarProps, Card, CardActions, type CardActionsProps, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardGrid, type CardGridProps, CardHeader, type CardHeaderProps, CardImage, type CardImageProps, CardList, type CardListProps, type CardProps, CardTitle, type CardTitleProps, type CellEditEvent, CellEditor, type CellEditorProps$1 as CellEditorProps, type CellPosition, Checkbox, type CheckboxProps, Chip, type ChipProps, CodeRenderer, type ColorFieldConfig, type ColumnDef, ConfirmationModal, type ConfirmationModalProps, type ContentType, type ContentTypeDetectionResult, ContextMenu, type ContextMenuItem, type ContextMenuProps, CopyButton, type CopyButtonProps, CsvRenderer, DARK_ELEGANT_THEME, DEFAULT_RENDERERS, DataGrid, type DataGridContextValue, type DataGridInternalState, type DataGridProps, type DataGridState, DataTable, type DataTableColumn, type DataTableProps, type DataTableSort, type DateFilterOperator, DatePicker, DatePickerInput, type DatePickerInputProps, type DatePickerProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, type DropdownMenuShortcutProps, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, type EditingCell, type EditorType, FOREST_THEME, FUTURISTIC_THEME, type FileRenderer, type FileRendererProps, FileView, type FileViewError, type FileViewProps, type FilterConfig, type FilterOperator, FilterPopover, type FilterPopoverProps$1 as FilterPopoverProps, type FilterType, GREEN_THEME, type GridCellProps, HeaderCell, type HeaderCellProps$1 as HeaderCellProps, HtmlRenderer, IconButton, type IconButtonProps, ImageRenderer, Input, type InputProps, Label, type LabelProps, LoadingSpinner, type LoadingSpinnerProps, MINIMALIST_LIGHT_THEME, MarkdownRenderer, Modal, ModalButton, type ModalButtonProps, type ModalProps, NATURE_THEME, type NumberFilterOperator, OCEAN_THEME, OPTILOGIC_LEGACY_THEME, PRESET_THEMES, type PaginationConfig, PlainTextRenderer, Popover, PopoverAnchor, PopoverContent, type PopoverContentProps, PopoverTrigger, Progress, type ProgressProps, type RendererRegistry, ResizablePanel, type ResizablePanelProps, ResizeHandle, type ResizeHandleProps, type ResolveImageUrl, SCIFI_THEME, SUNSET_THEME, type SearchConfig, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOption, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, SelectableCard, type SelectableCardProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, type SortConfig, type SortingConfig, Switch, type SwitchProps, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, TabsContent, TabsList, TabsTrigger, type TextFilterOperator, Textarea, type TextareaProps, type Theme, type ThemeHSL, type ThemeHex, ThemePicker, type ThemePickerProps, Toaster, type ToasterProps, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, type TooltipProps, TooltipProvider, TooltipRoot, TooltipTrigger, type UseContentTypeOptions, type UseContentTypeReturn, type UseContextMenuResult, accordionContentVariants, accordionItemVariants, accordionTriggerVariants, applyFilterOperator, applyFilters, applySorting, applyTheme, areThemesEqual, badgeVariants, boardVariants, buttonVariants, cardActionsVariants, cardGridVariants, cardImageVariants, cardListVariants, cardVariants, cloneTheme, cn, detectContentType, exportTheme, getCellValue, getCurrentTheme, getDefaultTheme, getFileExtension, getPresetTheme, hexToHsl, iconButtonVariants, importTheme, isPresetTheme, isTextContentType, isUrlContentType, labelVariants, loadingSpinnerVariants, mergeRenderers, resolveRenderer, themeToHsl, useColumnResize, useColumnResizeManager, useConfirmation, useContentType, useContextMenu, useDataGridState, useKeyboardNavigation, validateTheme };