@camstack/ui-library 0.1.25 → 0.1.27
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.cjs +1886 -124
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +304 -3
- package/dist/index.d.ts +304 -3
- package/dist/index.js +1826 -92
- package/dist/index.js.map +1 -1
- package/package.json +10 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { UseThemeModeReturn } from './theme/index.cjs';
|
|
2
|
+
export { CamStackColorTokens, CamStackTheme, DeepPartial, ThemeMode, ThemeProvider, createTheme, darkColors, defaultTheme, lightColors, themeToCss, useThemeMode } from './theme/index.cjs';
|
|
2
3
|
import { ClassValue } from 'clsx';
|
|
3
4
|
import { LucideIcon } from 'lucide-react';
|
|
4
5
|
import * as react from 'react';
|
|
5
|
-
import { ButtonHTMLAttributes, HTMLAttributes, LabelHTMLAttributes, InputHTMLAttributes, ReactNode, SelectHTMLAttributes } from 'react';
|
|
6
|
+
import react__default, { ButtonHTMLAttributes, HTMLAttributes, LabelHTMLAttributes, InputHTMLAttributes, ReactNode, SelectHTMLAttributes } from 'react';
|
|
6
7
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
7
8
|
import { VariantProps } from 'class-variance-authority';
|
|
8
9
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
10
|
import { ColumnDef, SortingState, ColumnFiltersState, PaginationState } from '@tanstack/react-table';
|
|
10
11
|
export { ColumnDef, ColumnFiltersState, PaginationState, SortingState } from '@tanstack/react-table';
|
|
12
|
+
import { PipelineSlot, PipelineAddonSchema, InferenceCapabilities, PipelineSchema, PipelineTemplate, LabelData } from '@camstack/types';
|
|
13
|
+
import { createTRPCClient } from '@trpc/client';
|
|
11
14
|
|
|
12
15
|
declare function cn(...inputs: ClassValue[]): string;
|
|
13
16
|
|
|
@@ -198,6 +201,30 @@ interface ProviderBadgeProps {
|
|
|
198
201
|
}
|
|
199
202
|
declare function ProviderBadge({ provider, showLabel, className, }: ProviderBadgeProps): react_jsx_runtime.JSX.Element;
|
|
200
203
|
|
|
204
|
+
type SemanticBadgeVariant = 'success' | 'warning' | 'danger' | 'info' | 'neutral';
|
|
205
|
+
interface SemanticBadgeProps {
|
|
206
|
+
children: react__default.ReactNode;
|
|
207
|
+
variant?: SemanticBadgeVariant;
|
|
208
|
+
/** Use monospace font (good for versions, codes) */
|
|
209
|
+
mono?: boolean;
|
|
210
|
+
className?: string;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* General-purpose badge with semantic color variants.
|
|
214
|
+
* Solid background with dark text for maximum contrast.
|
|
215
|
+
*/
|
|
216
|
+
declare function SemanticBadge({ children, variant, mono, className }: SemanticBadgeProps): react_jsx_runtime.JSX.Element;
|
|
217
|
+
interface VersionBadgeProps {
|
|
218
|
+
version: string;
|
|
219
|
+
preRelease?: boolean;
|
|
220
|
+
className?: string;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Version badge — auto-detects pre-release versions.
|
|
224
|
+
* Stable = success (green), Pre-release = warning (amber).
|
|
225
|
+
*/
|
|
226
|
+
declare function VersionBadge({ version, preRelease, className }: VersionBadgeProps): react_jsx_runtime.JSX.Element;
|
|
227
|
+
|
|
201
228
|
interface FormFieldProps {
|
|
202
229
|
label: string;
|
|
203
230
|
description?: string;
|
|
@@ -412,4 +439,278 @@ interface DeviceGridProps {
|
|
|
412
439
|
}
|
|
413
440
|
declare function DeviceGrid({ children, minCardWidth, gap, className, }: DeviceGridProps): react_jsx_runtime.JSX.Element;
|
|
414
441
|
|
|
415
|
-
|
|
442
|
+
interface PipelineStepDisplayConfig {
|
|
443
|
+
readonly addonId: string;
|
|
444
|
+
readonly addonName: string;
|
|
445
|
+
readonly slot: PipelineSlot;
|
|
446
|
+
readonly inputClasses: readonly string[];
|
|
447
|
+
readonly outputClasses: readonly string[];
|
|
448
|
+
readonly enabled: boolean;
|
|
449
|
+
readonly agentId: string;
|
|
450
|
+
readonly runtime: string;
|
|
451
|
+
readonly backend: string;
|
|
452
|
+
readonly modelId: string;
|
|
453
|
+
readonly confidence: number;
|
|
454
|
+
readonly classFilters: readonly string[];
|
|
455
|
+
readonly children: readonly PipelineStepDisplayConfig[];
|
|
456
|
+
}
|
|
457
|
+
interface PipelineStepProps {
|
|
458
|
+
readonly step: PipelineStepDisplayConfig;
|
|
459
|
+
readonly schema: PipelineAddonSchema | null;
|
|
460
|
+
/** Full schema map so children can look up their own schema */
|
|
461
|
+
readonly allSchemas: ReadonlyMap<string, PipelineAddonSchema>;
|
|
462
|
+
readonly capabilities: InferenceCapabilities;
|
|
463
|
+
readonly depth?: number;
|
|
464
|
+
readonly onChange: (updated: PipelineStepDisplayConfig) => void;
|
|
465
|
+
readonly onDelete?: (addonId: string) => void;
|
|
466
|
+
readonly readOnly?: boolean;
|
|
467
|
+
}
|
|
468
|
+
declare function PipelineStep({ step, schema, allSchemas, capabilities, depth, onChange, onDelete, readOnly, }: PipelineStepProps): react_jsx_runtime.JSX.Element;
|
|
469
|
+
|
|
470
|
+
interface PipelineRuntimeOption {
|
|
471
|
+
readonly id: string;
|
|
472
|
+
readonly label: string;
|
|
473
|
+
readonly available: boolean;
|
|
474
|
+
/** Platform score for this backend (higher = better) */
|
|
475
|
+
readonly platformScore?: number;
|
|
476
|
+
/** Whether this is the best-scored backend */
|
|
477
|
+
readonly isBest?: boolean;
|
|
478
|
+
}
|
|
479
|
+
interface PipelineRuntimeSelectorProps {
|
|
480
|
+
readonly options: readonly PipelineRuntimeOption[];
|
|
481
|
+
readonly value: string;
|
|
482
|
+
readonly onChange: (value: string) => void;
|
|
483
|
+
}
|
|
484
|
+
declare function PipelineRuntimeSelector({ options, value, onChange }: PipelineRuntimeSelectorProps): react_jsx_runtime.JSX.Element;
|
|
485
|
+
|
|
486
|
+
interface PipelineBuilderProps {
|
|
487
|
+
readonly schema: PipelineSchema;
|
|
488
|
+
readonly capabilities: InferenceCapabilities;
|
|
489
|
+
readonly steps: readonly PipelineStepDisplayConfig[];
|
|
490
|
+
readonly onChange: (steps: readonly PipelineStepDisplayConfig[]) => void;
|
|
491
|
+
readonly templates: readonly PipelineTemplate[];
|
|
492
|
+
readonly selectedTemplateId: string | null;
|
|
493
|
+
readonly onSelectTemplate: (id: string | null) => void;
|
|
494
|
+
readonly onSaveTemplate: (name: string, steps: readonly PipelineStepDisplayConfig[]) => void;
|
|
495
|
+
readonly onUpdateTemplate: (id: string, steps: readonly PipelineStepDisplayConfig[]) => void;
|
|
496
|
+
readonly onDeleteTemplate: (id: string) => void;
|
|
497
|
+
readonly readOnly?: boolean;
|
|
498
|
+
/** Addon IDs to exclude from the pipeline (e.g. 'motion-detection' for benchmark) */
|
|
499
|
+
readonly excludeAddons?: readonly string[];
|
|
500
|
+
}
|
|
501
|
+
declare function PipelineBuilder({ schema, capabilities, steps, onChange, templates, selectedTemplateId, onSelectTemplate, onSaveTemplate, onUpdateTemplate, onDeleteTemplate, readOnly, excludeAddons, }: PipelineBuilderProps): react_jsx_runtime.JSX.Element;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Detection class colors — single source of truth.
|
|
505
|
+
*
|
|
506
|
+
* Used by: DetectionCanvas (UI), result-annotator (server-side SVG),
|
|
507
|
+
* admin-ui event viewer, and any other place that visualizes detections.
|
|
508
|
+
*/
|
|
509
|
+
/** Fixed colors for known detection classes */
|
|
510
|
+
declare const CLASS_COLORS: Readonly<Record<string, string>>;
|
|
511
|
+
/** Primary/default color when nothing else matches */
|
|
512
|
+
declare const DEFAULT_COLOR = "#f59e42";
|
|
513
|
+
/**
|
|
514
|
+
* Get the color for a detection class name.
|
|
515
|
+
* Returns a fixed color for known classes, or a deterministic hash-based color for unknown ones.
|
|
516
|
+
*/
|
|
517
|
+
declare function getClassColor(className: string, customColors?: Readonly<Record<string, string>>): string;
|
|
518
|
+
|
|
519
|
+
/** @deprecated Use CLASS_COLORS from detection-colors instead */
|
|
520
|
+
declare const DEFAULT_CLASS_COLORS: Readonly<Record<string, string>>;
|
|
521
|
+
|
|
522
|
+
interface Detection {
|
|
523
|
+
/** Display class name (e.g., 'person', 'vehicle', 'face') */
|
|
524
|
+
readonly className: string;
|
|
525
|
+
/** Confidence score 0-1 */
|
|
526
|
+
readonly confidence: number;
|
|
527
|
+
/** Bounding box [x1, y1, x2, y2] in pixel coordinates */
|
|
528
|
+
readonly bbox: readonly [number, number, number, number];
|
|
529
|
+
/** Sub-detections from cropper steps (face box, plate box) — for debug */
|
|
530
|
+
readonly children?: readonly Detection[];
|
|
531
|
+
/** Accumulated labels from all classifier/recognizer steps */
|
|
532
|
+
readonly labelsData?: readonly LabelData[];
|
|
533
|
+
/** Base64-encoded binary segmentation mask (from -seg models) */
|
|
534
|
+
readonly mask?: string;
|
|
535
|
+
/** Mask pixel width */
|
|
536
|
+
readonly maskWidth?: number;
|
|
537
|
+
/** Mask pixel height */
|
|
538
|
+
readonly maskHeight?: number;
|
|
539
|
+
}
|
|
540
|
+
interface DetectionCanvasProps {
|
|
541
|
+
/** Image source (data URL or regular URL) */
|
|
542
|
+
readonly src: string | null;
|
|
543
|
+
/** Image dimensions (used for bbox coordinate mapping) */
|
|
544
|
+
readonly imageWidth: number;
|
|
545
|
+
readonly imageHeight: number;
|
|
546
|
+
/** Detections to overlay */
|
|
547
|
+
readonly detections?: readonly Detection[];
|
|
548
|
+
/** Custom class → hex color mapping (merged with defaults) */
|
|
549
|
+
readonly classColors?: Readonly<Record<string, string>>;
|
|
550
|
+
/** Aspect ratio CSS value (default: auto based on image dimensions) */
|
|
551
|
+
readonly aspectRatio?: string;
|
|
552
|
+
/** Additional CSS classes on the container */
|
|
553
|
+
readonly className?: string;
|
|
554
|
+
/** Placeholder content when no image is loaded */
|
|
555
|
+
readonly placeholder?: ReactNode;
|
|
556
|
+
/** Show confidence percentage in bbox labels */
|
|
557
|
+
readonly showConfidence?: boolean;
|
|
558
|
+
/** Minimum confidence to display (0-1, default: 0) */
|
|
559
|
+
readonly minConfidence?: number;
|
|
560
|
+
/** Border width for bboxes in px (default: 2) */
|
|
561
|
+
readonly borderWidth?: number;
|
|
562
|
+
}
|
|
563
|
+
declare function DetectionCanvas({ src, imageWidth, imageHeight, detections, classColors, aspectRatio, className, placeholder, showConfidence, minConfidence, borderWidth, }: DetectionCanvasProps): react_jsx_runtime.JSX.Element;
|
|
564
|
+
|
|
565
|
+
interface DetectionResultTreeProps {
|
|
566
|
+
readonly detections: readonly Detection[];
|
|
567
|
+
readonly classColors?: Readonly<Record<string, string>>;
|
|
568
|
+
readonly className?: string;
|
|
569
|
+
/** Set of detection path keys that are hidden (e.g., "0", "0.1", "0.1.2") */
|
|
570
|
+
readonly hiddenKeys?: ReadonlySet<string>;
|
|
571
|
+
/** Callback when a detection's visibility is toggled */
|
|
572
|
+
readonly onToggleVisibility?: (key: string, visible: boolean) => void;
|
|
573
|
+
}
|
|
574
|
+
declare function DetectionResultTree({ detections, classColors, className, hiddenKeys, onToggleVisibility, }: DetectionResultTreeProps): react_jsx_runtime.JSX.Element;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* StepTimings — displays pipeline execution timings per step.
|
|
578
|
+
*/
|
|
579
|
+
interface StepTimingsProps {
|
|
580
|
+
readonly timings: Readonly<Record<string, number>>;
|
|
581
|
+
readonly totalMs?: number;
|
|
582
|
+
readonly className?: string;
|
|
583
|
+
}
|
|
584
|
+
declare function StepTimings({ timings, totalMs, className }: StepTimingsProps): react_jsx_runtime.JSX.Element | null;
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* ImageSelector — select from reference images or upload custom image.
|
|
588
|
+
* Used by benchmark Image Tester and any addon page that needs image input.
|
|
589
|
+
*/
|
|
590
|
+
interface ReferenceImage {
|
|
591
|
+
readonly id: string;
|
|
592
|
+
readonly filename: string;
|
|
593
|
+
readonly sizeKB?: number;
|
|
594
|
+
}
|
|
595
|
+
interface ImageSelectorProps {
|
|
596
|
+
readonly images: readonly ReferenceImage[];
|
|
597
|
+
readonly selectedFilename: string;
|
|
598
|
+
readonly uploadedName?: string;
|
|
599
|
+
readonly onSelect: (filename: string) => void;
|
|
600
|
+
readonly onUpload: (base64: string, filename: string, dataUrl: string) => void;
|
|
601
|
+
readonly className?: string;
|
|
602
|
+
}
|
|
603
|
+
declare function ImageSelector({ images, selectedFilename, uploadedName, onSelect, onUpload, className, }: ImageSelectorProps): react_jsx_runtime.JSX.Element;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* InferenceConfigSelector — cascading selectors for runtime/backend/model.
|
|
607
|
+
*
|
|
608
|
+
* Used by benchmark Engine tab, Image Tester pipeline steps, and admin-ui
|
|
609
|
+
* pipeline configuration. Shows only valid combinations based on capabilities.
|
|
610
|
+
*/
|
|
611
|
+
interface InferenceBackendOption {
|
|
612
|
+
readonly id: string;
|
|
613
|
+
readonly label: string;
|
|
614
|
+
readonly available: boolean;
|
|
615
|
+
}
|
|
616
|
+
interface InferenceModelOption {
|
|
617
|
+
readonly id: string;
|
|
618
|
+
readonly name: string;
|
|
619
|
+
readonly downloaded?: boolean;
|
|
620
|
+
}
|
|
621
|
+
interface InferenceAgentOption {
|
|
622
|
+
readonly id: string;
|
|
623
|
+
readonly name: string;
|
|
624
|
+
readonly status: 'online' | 'offline' | 'busy';
|
|
625
|
+
}
|
|
626
|
+
interface InferenceConfigSelectorProps {
|
|
627
|
+
readonly runtime: 'node' | 'python';
|
|
628
|
+
readonly backend: string;
|
|
629
|
+
readonly modelId: string;
|
|
630
|
+
readonly agentId?: string;
|
|
631
|
+
readonly runtimes: readonly {
|
|
632
|
+
value: string;
|
|
633
|
+
label: string;
|
|
634
|
+
available: boolean;
|
|
635
|
+
}[];
|
|
636
|
+
readonly backends: readonly InferenceBackendOption[];
|
|
637
|
+
readonly models: readonly InferenceModelOption[];
|
|
638
|
+
readonly agents?: readonly InferenceAgentOption[];
|
|
639
|
+
readonly onRuntimeChange: (rt: 'node' | 'python') => void;
|
|
640
|
+
readonly onBackendChange: (id: string) => void;
|
|
641
|
+
readonly onModelChange: (id: string) => void;
|
|
642
|
+
readonly onAgentChange?: (id: string) => void;
|
|
643
|
+
readonly layout?: 'horizontal' | 'vertical' | 'grid';
|
|
644
|
+
readonly className?: string;
|
|
645
|
+
/** Show agent selector (default: false) */
|
|
646
|
+
readonly showAgent?: boolean;
|
|
647
|
+
}
|
|
648
|
+
declare function InferenceConfigSelector({ runtime, backend, modelId, agentId, runtimes, backends, models, agents, onRuntimeChange, onBackendChange, onModelChange, onAgentChange, layout, className, showAgent, }: InferenceConfigSelectorProps): react_jsx_runtime.JSX.Element;
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Standard props for addon page components.
|
|
652
|
+
*
|
|
653
|
+
* Every addon page receives these props from the AddonPageLoader in admin-ui.
|
|
654
|
+
* Use this type for your page's default export:
|
|
655
|
+
*
|
|
656
|
+
* ```tsx
|
|
657
|
+
* import type { AddonPageProps } from '@camstack/ui'
|
|
658
|
+
*
|
|
659
|
+
* export default function MyAddonPage({ trpc, theme, navigate }: AddonPageProps) {
|
|
660
|
+
* return <div>Hello from my addon!</div>
|
|
661
|
+
* }
|
|
662
|
+
* ```
|
|
663
|
+
*/
|
|
664
|
+
interface AddonPageProps {
|
|
665
|
+
/** tRPC client — fully typed access to all backend routes */
|
|
666
|
+
readonly trpc: any;
|
|
667
|
+
/** Current theme state */
|
|
668
|
+
readonly theme: {
|
|
669
|
+
readonly isDark: boolean;
|
|
670
|
+
};
|
|
671
|
+
/** Navigate to a route within the admin UI */
|
|
672
|
+
readonly navigate: (path: string) => void;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
interface MountAddonPageOptions {
|
|
676
|
+
/** Backend server URL (default: 'https://localhost:4443') */
|
|
677
|
+
serverUrl?: string;
|
|
678
|
+
/** Title shown in the dev toolbar */
|
|
679
|
+
title?: string;
|
|
680
|
+
/** Root element ID (default: 'root') */
|
|
681
|
+
rootId?: string;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Mount an addon page component with the full dev shell.
|
|
685
|
+
*
|
|
686
|
+
* @param PageComponent - The addon page component (must accept AddonPageProps)
|
|
687
|
+
* @param options - Configuration options
|
|
688
|
+
*/
|
|
689
|
+
declare function mountAddonPage(PageComponent: (props: AddonPageProps) => any, options?: MountAddonPageOptions): void;
|
|
690
|
+
|
|
691
|
+
interface LoginFormProps {
|
|
692
|
+
onLogin: (username: string, password: string) => Promise<void>;
|
|
693
|
+
serverUrl?: string;
|
|
694
|
+
logoSrc?: string;
|
|
695
|
+
error?: string;
|
|
696
|
+
className?: string;
|
|
697
|
+
}
|
|
698
|
+
declare function LoginForm({ onLogin, serverUrl, logoSrc, error: externalError, className, }: LoginFormProps): react_jsx_runtime.JSX.Element;
|
|
699
|
+
|
|
700
|
+
interface DevShellProps {
|
|
701
|
+
children: (props: {
|
|
702
|
+
trpc: ReturnType<typeof createTRPCClient>;
|
|
703
|
+
theme: UseThemeModeReturn;
|
|
704
|
+
}) => ReactNode;
|
|
705
|
+
serverUrl?: string;
|
|
706
|
+
title?: string;
|
|
707
|
+
}
|
|
708
|
+
interface DevShellContextValue {
|
|
709
|
+
trpc: ReturnType<typeof createTRPCClient>;
|
|
710
|
+
token: string;
|
|
711
|
+
logout: () => void;
|
|
712
|
+
}
|
|
713
|
+
declare function useDevShell(): DevShellContextValue;
|
|
714
|
+
declare function DevShell({ children, serverUrl, title, }: DevShellProps): react_jsx_runtime.JSX.Element;
|
|
715
|
+
|
|
716
|
+
export { type AddonPageProps, AppShell, type AppShellProps, Badge, type BadgeProps, Button, type ButtonProps, CLASS_COLORS, Card, type CardProps, Checkbox, type CheckboxProps, CodeBlock, type CodeBlockProps, ConfirmDialog, type ConfirmDialogProps, DEFAULT_CLASS_COLORS, DEFAULT_COLOR, DataTable, type DataTableAction, type DataTableProps, type Detection, DetectionCanvas, type DetectionCanvasProps, DetectionResultTree, type DetectionResultTreeProps, DevShell, type DevShellProps, DeviceCard, type DeviceCardAction, type DeviceCardBadge, type DeviceCardProps, DeviceGrid, type DeviceGridProps, Dialog, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Dropdown, DropdownContent, DropdownItem, DropdownTrigger, EmptyState, type EmptyStateProps, FilterBar, type FilterBarProps, type FilterDef, FloatingPanel, type FloatingPanelProps, FormField, type FormFieldProps, IconButton, type IconButtonProps, ImageSelector, type ImageSelectorProps, type InferenceAgentOption, type InferenceBackendOption, InferenceConfigSelector, type InferenceConfigSelectorProps, type InferenceModelOption, Input, type InputProps, KeyValueList, type KeyValueListProps, Label, type LabelProps, LoginForm, type LoginFormProps, type MountAddonPageOptions, PageHeader, type PageHeaderProps, PipelineBuilder, type PipelineBuilderProps, type PipelineRuntimeOption, PipelineRuntimeSelector, PipelineStep, type PipelineStepDisplayConfig, type PipelineStepProps, Popover, PopoverContent, PopoverTrigger, ProviderBadge, type ProviderBadgeProps, type ProviderType, type ReferenceImage, ScrollArea, type ScrollAreaProps, Select, type SelectOption, type SelectProps, SemanticBadge, type SemanticBadgeProps, type SemanticBadgeVariant, Separator, type SeparatorProps, Sidebar, SidebarItem, type SidebarItemProps, type SidebarProps, type SidebarSection, Skeleton, type SkeletonProps, StatCard, type StatCardProps, StatusBadge, type StatusBadgeProps, type StatusType, StepTimings, type StepTimingsProps, Switch, type SwitchProps, Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipTrigger, UseThemeModeReturn, VersionBadge, type VersionBadgeProps, cn, getClassColor, mountAddonPage, providerIcons, statusIcons, useDevShell };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { UseThemeModeReturn } from './theme/index.js';
|
|
2
|
+
export { CamStackColorTokens, CamStackTheme, DeepPartial, ThemeMode, ThemeProvider, createTheme, darkColors, defaultTheme, lightColors, themeToCss, useThemeMode } from './theme/index.js';
|
|
2
3
|
import { ClassValue } from 'clsx';
|
|
3
4
|
import { LucideIcon } from 'lucide-react';
|
|
4
5
|
import * as react from 'react';
|
|
5
|
-
import { ButtonHTMLAttributes, HTMLAttributes, LabelHTMLAttributes, InputHTMLAttributes, ReactNode, SelectHTMLAttributes } from 'react';
|
|
6
|
+
import react__default, { ButtonHTMLAttributes, HTMLAttributes, LabelHTMLAttributes, InputHTMLAttributes, ReactNode, SelectHTMLAttributes } from 'react';
|
|
6
7
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
7
8
|
import { VariantProps } from 'class-variance-authority';
|
|
8
9
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
10
|
import { ColumnDef, SortingState, ColumnFiltersState, PaginationState } from '@tanstack/react-table';
|
|
10
11
|
export { ColumnDef, ColumnFiltersState, PaginationState, SortingState } from '@tanstack/react-table';
|
|
12
|
+
import { PipelineSlot, PipelineAddonSchema, InferenceCapabilities, PipelineSchema, PipelineTemplate, LabelData } from '@camstack/types';
|
|
13
|
+
import { createTRPCClient } from '@trpc/client';
|
|
11
14
|
|
|
12
15
|
declare function cn(...inputs: ClassValue[]): string;
|
|
13
16
|
|
|
@@ -198,6 +201,30 @@ interface ProviderBadgeProps {
|
|
|
198
201
|
}
|
|
199
202
|
declare function ProviderBadge({ provider, showLabel, className, }: ProviderBadgeProps): react_jsx_runtime.JSX.Element;
|
|
200
203
|
|
|
204
|
+
type SemanticBadgeVariant = 'success' | 'warning' | 'danger' | 'info' | 'neutral';
|
|
205
|
+
interface SemanticBadgeProps {
|
|
206
|
+
children: react__default.ReactNode;
|
|
207
|
+
variant?: SemanticBadgeVariant;
|
|
208
|
+
/** Use monospace font (good for versions, codes) */
|
|
209
|
+
mono?: boolean;
|
|
210
|
+
className?: string;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* General-purpose badge with semantic color variants.
|
|
214
|
+
* Solid background with dark text for maximum contrast.
|
|
215
|
+
*/
|
|
216
|
+
declare function SemanticBadge({ children, variant, mono, className }: SemanticBadgeProps): react_jsx_runtime.JSX.Element;
|
|
217
|
+
interface VersionBadgeProps {
|
|
218
|
+
version: string;
|
|
219
|
+
preRelease?: boolean;
|
|
220
|
+
className?: string;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Version badge — auto-detects pre-release versions.
|
|
224
|
+
* Stable = success (green), Pre-release = warning (amber).
|
|
225
|
+
*/
|
|
226
|
+
declare function VersionBadge({ version, preRelease, className }: VersionBadgeProps): react_jsx_runtime.JSX.Element;
|
|
227
|
+
|
|
201
228
|
interface FormFieldProps {
|
|
202
229
|
label: string;
|
|
203
230
|
description?: string;
|
|
@@ -412,4 +439,278 @@ interface DeviceGridProps {
|
|
|
412
439
|
}
|
|
413
440
|
declare function DeviceGrid({ children, minCardWidth, gap, className, }: DeviceGridProps): react_jsx_runtime.JSX.Element;
|
|
414
441
|
|
|
415
|
-
|
|
442
|
+
interface PipelineStepDisplayConfig {
|
|
443
|
+
readonly addonId: string;
|
|
444
|
+
readonly addonName: string;
|
|
445
|
+
readonly slot: PipelineSlot;
|
|
446
|
+
readonly inputClasses: readonly string[];
|
|
447
|
+
readonly outputClasses: readonly string[];
|
|
448
|
+
readonly enabled: boolean;
|
|
449
|
+
readonly agentId: string;
|
|
450
|
+
readonly runtime: string;
|
|
451
|
+
readonly backend: string;
|
|
452
|
+
readonly modelId: string;
|
|
453
|
+
readonly confidence: number;
|
|
454
|
+
readonly classFilters: readonly string[];
|
|
455
|
+
readonly children: readonly PipelineStepDisplayConfig[];
|
|
456
|
+
}
|
|
457
|
+
interface PipelineStepProps {
|
|
458
|
+
readonly step: PipelineStepDisplayConfig;
|
|
459
|
+
readonly schema: PipelineAddonSchema | null;
|
|
460
|
+
/** Full schema map so children can look up their own schema */
|
|
461
|
+
readonly allSchemas: ReadonlyMap<string, PipelineAddonSchema>;
|
|
462
|
+
readonly capabilities: InferenceCapabilities;
|
|
463
|
+
readonly depth?: number;
|
|
464
|
+
readonly onChange: (updated: PipelineStepDisplayConfig) => void;
|
|
465
|
+
readonly onDelete?: (addonId: string) => void;
|
|
466
|
+
readonly readOnly?: boolean;
|
|
467
|
+
}
|
|
468
|
+
declare function PipelineStep({ step, schema, allSchemas, capabilities, depth, onChange, onDelete, readOnly, }: PipelineStepProps): react_jsx_runtime.JSX.Element;
|
|
469
|
+
|
|
470
|
+
interface PipelineRuntimeOption {
|
|
471
|
+
readonly id: string;
|
|
472
|
+
readonly label: string;
|
|
473
|
+
readonly available: boolean;
|
|
474
|
+
/** Platform score for this backend (higher = better) */
|
|
475
|
+
readonly platformScore?: number;
|
|
476
|
+
/** Whether this is the best-scored backend */
|
|
477
|
+
readonly isBest?: boolean;
|
|
478
|
+
}
|
|
479
|
+
interface PipelineRuntimeSelectorProps {
|
|
480
|
+
readonly options: readonly PipelineRuntimeOption[];
|
|
481
|
+
readonly value: string;
|
|
482
|
+
readonly onChange: (value: string) => void;
|
|
483
|
+
}
|
|
484
|
+
declare function PipelineRuntimeSelector({ options, value, onChange }: PipelineRuntimeSelectorProps): react_jsx_runtime.JSX.Element;
|
|
485
|
+
|
|
486
|
+
interface PipelineBuilderProps {
|
|
487
|
+
readonly schema: PipelineSchema;
|
|
488
|
+
readonly capabilities: InferenceCapabilities;
|
|
489
|
+
readonly steps: readonly PipelineStepDisplayConfig[];
|
|
490
|
+
readonly onChange: (steps: readonly PipelineStepDisplayConfig[]) => void;
|
|
491
|
+
readonly templates: readonly PipelineTemplate[];
|
|
492
|
+
readonly selectedTemplateId: string | null;
|
|
493
|
+
readonly onSelectTemplate: (id: string | null) => void;
|
|
494
|
+
readonly onSaveTemplate: (name: string, steps: readonly PipelineStepDisplayConfig[]) => void;
|
|
495
|
+
readonly onUpdateTemplate: (id: string, steps: readonly PipelineStepDisplayConfig[]) => void;
|
|
496
|
+
readonly onDeleteTemplate: (id: string) => void;
|
|
497
|
+
readonly readOnly?: boolean;
|
|
498
|
+
/** Addon IDs to exclude from the pipeline (e.g. 'motion-detection' for benchmark) */
|
|
499
|
+
readonly excludeAddons?: readonly string[];
|
|
500
|
+
}
|
|
501
|
+
declare function PipelineBuilder({ schema, capabilities, steps, onChange, templates, selectedTemplateId, onSelectTemplate, onSaveTemplate, onUpdateTemplate, onDeleteTemplate, readOnly, excludeAddons, }: PipelineBuilderProps): react_jsx_runtime.JSX.Element;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Detection class colors — single source of truth.
|
|
505
|
+
*
|
|
506
|
+
* Used by: DetectionCanvas (UI), result-annotator (server-side SVG),
|
|
507
|
+
* admin-ui event viewer, and any other place that visualizes detections.
|
|
508
|
+
*/
|
|
509
|
+
/** Fixed colors for known detection classes */
|
|
510
|
+
declare const CLASS_COLORS: Readonly<Record<string, string>>;
|
|
511
|
+
/** Primary/default color when nothing else matches */
|
|
512
|
+
declare const DEFAULT_COLOR = "#f59e42";
|
|
513
|
+
/**
|
|
514
|
+
* Get the color for a detection class name.
|
|
515
|
+
* Returns a fixed color for known classes, or a deterministic hash-based color for unknown ones.
|
|
516
|
+
*/
|
|
517
|
+
declare function getClassColor(className: string, customColors?: Readonly<Record<string, string>>): string;
|
|
518
|
+
|
|
519
|
+
/** @deprecated Use CLASS_COLORS from detection-colors instead */
|
|
520
|
+
declare const DEFAULT_CLASS_COLORS: Readonly<Record<string, string>>;
|
|
521
|
+
|
|
522
|
+
interface Detection {
|
|
523
|
+
/** Display class name (e.g., 'person', 'vehicle', 'face') */
|
|
524
|
+
readonly className: string;
|
|
525
|
+
/** Confidence score 0-1 */
|
|
526
|
+
readonly confidence: number;
|
|
527
|
+
/** Bounding box [x1, y1, x2, y2] in pixel coordinates */
|
|
528
|
+
readonly bbox: readonly [number, number, number, number];
|
|
529
|
+
/** Sub-detections from cropper steps (face box, plate box) — for debug */
|
|
530
|
+
readonly children?: readonly Detection[];
|
|
531
|
+
/** Accumulated labels from all classifier/recognizer steps */
|
|
532
|
+
readonly labelsData?: readonly LabelData[];
|
|
533
|
+
/** Base64-encoded binary segmentation mask (from -seg models) */
|
|
534
|
+
readonly mask?: string;
|
|
535
|
+
/** Mask pixel width */
|
|
536
|
+
readonly maskWidth?: number;
|
|
537
|
+
/** Mask pixel height */
|
|
538
|
+
readonly maskHeight?: number;
|
|
539
|
+
}
|
|
540
|
+
interface DetectionCanvasProps {
|
|
541
|
+
/** Image source (data URL or regular URL) */
|
|
542
|
+
readonly src: string | null;
|
|
543
|
+
/** Image dimensions (used for bbox coordinate mapping) */
|
|
544
|
+
readonly imageWidth: number;
|
|
545
|
+
readonly imageHeight: number;
|
|
546
|
+
/** Detections to overlay */
|
|
547
|
+
readonly detections?: readonly Detection[];
|
|
548
|
+
/** Custom class → hex color mapping (merged with defaults) */
|
|
549
|
+
readonly classColors?: Readonly<Record<string, string>>;
|
|
550
|
+
/** Aspect ratio CSS value (default: auto based on image dimensions) */
|
|
551
|
+
readonly aspectRatio?: string;
|
|
552
|
+
/** Additional CSS classes on the container */
|
|
553
|
+
readonly className?: string;
|
|
554
|
+
/** Placeholder content when no image is loaded */
|
|
555
|
+
readonly placeholder?: ReactNode;
|
|
556
|
+
/** Show confidence percentage in bbox labels */
|
|
557
|
+
readonly showConfidence?: boolean;
|
|
558
|
+
/** Minimum confidence to display (0-1, default: 0) */
|
|
559
|
+
readonly minConfidence?: number;
|
|
560
|
+
/** Border width for bboxes in px (default: 2) */
|
|
561
|
+
readonly borderWidth?: number;
|
|
562
|
+
}
|
|
563
|
+
declare function DetectionCanvas({ src, imageWidth, imageHeight, detections, classColors, aspectRatio, className, placeholder, showConfidence, minConfidence, borderWidth, }: DetectionCanvasProps): react_jsx_runtime.JSX.Element;
|
|
564
|
+
|
|
565
|
+
interface DetectionResultTreeProps {
|
|
566
|
+
readonly detections: readonly Detection[];
|
|
567
|
+
readonly classColors?: Readonly<Record<string, string>>;
|
|
568
|
+
readonly className?: string;
|
|
569
|
+
/** Set of detection path keys that are hidden (e.g., "0", "0.1", "0.1.2") */
|
|
570
|
+
readonly hiddenKeys?: ReadonlySet<string>;
|
|
571
|
+
/** Callback when a detection's visibility is toggled */
|
|
572
|
+
readonly onToggleVisibility?: (key: string, visible: boolean) => void;
|
|
573
|
+
}
|
|
574
|
+
declare function DetectionResultTree({ detections, classColors, className, hiddenKeys, onToggleVisibility, }: DetectionResultTreeProps): react_jsx_runtime.JSX.Element;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* StepTimings — displays pipeline execution timings per step.
|
|
578
|
+
*/
|
|
579
|
+
interface StepTimingsProps {
|
|
580
|
+
readonly timings: Readonly<Record<string, number>>;
|
|
581
|
+
readonly totalMs?: number;
|
|
582
|
+
readonly className?: string;
|
|
583
|
+
}
|
|
584
|
+
declare function StepTimings({ timings, totalMs, className }: StepTimingsProps): react_jsx_runtime.JSX.Element | null;
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* ImageSelector — select from reference images or upload custom image.
|
|
588
|
+
* Used by benchmark Image Tester and any addon page that needs image input.
|
|
589
|
+
*/
|
|
590
|
+
interface ReferenceImage {
|
|
591
|
+
readonly id: string;
|
|
592
|
+
readonly filename: string;
|
|
593
|
+
readonly sizeKB?: number;
|
|
594
|
+
}
|
|
595
|
+
interface ImageSelectorProps {
|
|
596
|
+
readonly images: readonly ReferenceImage[];
|
|
597
|
+
readonly selectedFilename: string;
|
|
598
|
+
readonly uploadedName?: string;
|
|
599
|
+
readonly onSelect: (filename: string) => void;
|
|
600
|
+
readonly onUpload: (base64: string, filename: string, dataUrl: string) => void;
|
|
601
|
+
readonly className?: string;
|
|
602
|
+
}
|
|
603
|
+
declare function ImageSelector({ images, selectedFilename, uploadedName, onSelect, onUpload, className, }: ImageSelectorProps): react_jsx_runtime.JSX.Element;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* InferenceConfigSelector — cascading selectors for runtime/backend/model.
|
|
607
|
+
*
|
|
608
|
+
* Used by benchmark Engine tab, Image Tester pipeline steps, and admin-ui
|
|
609
|
+
* pipeline configuration. Shows only valid combinations based on capabilities.
|
|
610
|
+
*/
|
|
611
|
+
interface InferenceBackendOption {
|
|
612
|
+
readonly id: string;
|
|
613
|
+
readonly label: string;
|
|
614
|
+
readonly available: boolean;
|
|
615
|
+
}
|
|
616
|
+
interface InferenceModelOption {
|
|
617
|
+
readonly id: string;
|
|
618
|
+
readonly name: string;
|
|
619
|
+
readonly downloaded?: boolean;
|
|
620
|
+
}
|
|
621
|
+
interface InferenceAgentOption {
|
|
622
|
+
readonly id: string;
|
|
623
|
+
readonly name: string;
|
|
624
|
+
readonly status: 'online' | 'offline' | 'busy';
|
|
625
|
+
}
|
|
626
|
+
interface InferenceConfigSelectorProps {
|
|
627
|
+
readonly runtime: 'node' | 'python';
|
|
628
|
+
readonly backend: string;
|
|
629
|
+
readonly modelId: string;
|
|
630
|
+
readonly agentId?: string;
|
|
631
|
+
readonly runtimes: readonly {
|
|
632
|
+
value: string;
|
|
633
|
+
label: string;
|
|
634
|
+
available: boolean;
|
|
635
|
+
}[];
|
|
636
|
+
readonly backends: readonly InferenceBackendOption[];
|
|
637
|
+
readonly models: readonly InferenceModelOption[];
|
|
638
|
+
readonly agents?: readonly InferenceAgentOption[];
|
|
639
|
+
readonly onRuntimeChange: (rt: 'node' | 'python') => void;
|
|
640
|
+
readonly onBackendChange: (id: string) => void;
|
|
641
|
+
readonly onModelChange: (id: string) => void;
|
|
642
|
+
readonly onAgentChange?: (id: string) => void;
|
|
643
|
+
readonly layout?: 'horizontal' | 'vertical' | 'grid';
|
|
644
|
+
readonly className?: string;
|
|
645
|
+
/** Show agent selector (default: false) */
|
|
646
|
+
readonly showAgent?: boolean;
|
|
647
|
+
}
|
|
648
|
+
declare function InferenceConfigSelector({ runtime, backend, modelId, agentId, runtimes, backends, models, agents, onRuntimeChange, onBackendChange, onModelChange, onAgentChange, layout, className, showAgent, }: InferenceConfigSelectorProps): react_jsx_runtime.JSX.Element;
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Standard props for addon page components.
|
|
652
|
+
*
|
|
653
|
+
* Every addon page receives these props from the AddonPageLoader in admin-ui.
|
|
654
|
+
* Use this type for your page's default export:
|
|
655
|
+
*
|
|
656
|
+
* ```tsx
|
|
657
|
+
* import type { AddonPageProps } from '@camstack/ui'
|
|
658
|
+
*
|
|
659
|
+
* export default function MyAddonPage({ trpc, theme, navigate }: AddonPageProps) {
|
|
660
|
+
* return <div>Hello from my addon!</div>
|
|
661
|
+
* }
|
|
662
|
+
* ```
|
|
663
|
+
*/
|
|
664
|
+
interface AddonPageProps {
|
|
665
|
+
/** tRPC client — fully typed access to all backend routes */
|
|
666
|
+
readonly trpc: any;
|
|
667
|
+
/** Current theme state */
|
|
668
|
+
readonly theme: {
|
|
669
|
+
readonly isDark: boolean;
|
|
670
|
+
};
|
|
671
|
+
/** Navigate to a route within the admin UI */
|
|
672
|
+
readonly navigate: (path: string) => void;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
interface MountAddonPageOptions {
|
|
676
|
+
/** Backend server URL (default: 'https://localhost:4443') */
|
|
677
|
+
serverUrl?: string;
|
|
678
|
+
/** Title shown in the dev toolbar */
|
|
679
|
+
title?: string;
|
|
680
|
+
/** Root element ID (default: 'root') */
|
|
681
|
+
rootId?: string;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Mount an addon page component with the full dev shell.
|
|
685
|
+
*
|
|
686
|
+
* @param PageComponent - The addon page component (must accept AddonPageProps)
|
|
687
|
+
* @param options - Configuration options
|
|
688
|
+
*/
|
|
689
|
+
declare function mountAddonPage(PageComponent: (props: AddonPageProps) => any, options?: MountAddonPageOptions): void;
|
|
690
|
+
|
|
691
|
+
interface LoginFormProps {
|
|
692
|
+
onLogin: (username: string, password: string) => Promise<void>;
|
|
693
|
+
serverUrl?: string;
|
|
694
|
+
logoSrc?: string;
|
|
695
|
+
error?: string;
|
|
696
|
+
className?: string;
|
|
697
|
+
}
|
|
698
|
+
declare function LoginForm({ onLogin, serverUrl, logoSrc, error: externalError, className, }: LoginFormProps): react_jsx_runtime.JSX.Element;
|
|
699
|
+
|
|
700
|
+
interface DevShellProps {
|
|
701
|
+
children: (props: {
|
|
702
|
+
trpc: ReturnType<typeof createTRPCClient>;
|
|
703
|
+
theme: UseThemeModeReturn;
|
|
704
|
+
}) => ReactNode;
|
|
705
|
+
serverUrl?: string;
|
|
706
|
+
title?: string;
|
|
707
|
+
}
|
|
708
|
+
interface DevShellContextValue {
|
|
709
|
+
trpc: ReturnType<typeof createTRPCClient>;
|
|
710
|
+
token: string;
|
|
711
|
+
logout: () => void;
|
|
712
|
+
}
|
|
713
|
+
declare function useDevShell(): DevShellContextValue;
|
|
714
|
+
declare function DevShell({ children, serverUrl, title, }: DevShellProps): react_jsx_runtime.JSX.Element;
|
|
715
|
+
|
|
716
|
+
export { type AddonPageProps, AppShell, type AppShellProps, Badge, type BadgeProps, Button, type ButtonProps, CLASS_COLORS, Card, type CardProps, Checkbox, type CheckboxProps, CodeBlock, type CodeBlockProps, ConfirmDialog, type ConfirmDialogProps, DEFAULT_CLASS_COLORS, DEFAULT_COLOR, DataTable, type DataTableAction, type DataTableProps, type Detection, DetectionCanvas, type DetectionCanvasProps, DetectionResultTree, type DetectionResultTreeProps, DevShell, type DevShellProps, DeviceCard, type DeviceCardAction, type DeviceCardBadge, type DeviceCardProps, DeviceGrid, type DeviceGridProps, Dialog, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Dropdown, DropdownContent, DropdownItem, DropdownTrigger, EmptyState, type EmptyStateProps, FilterBar, type FilterBarProps, type FilterDef, FloatingPanel, type FloatingPanelProps, FormField, type FormFieldProps, IconButton, type IconButtonProps, ImageSelector, type ImageSelectorProps, type InferenceAgentOption, type InferenceBackendOption, InferenceConfigSelector, type InferenceConfigSelectorProps, type InferenceModelOption, Input, type InputProps, KeyValueList, type KeyValueListProps, Label, type LabelProps, LoginForm, type LoginFormProps, type MountAddonPageOptions, PageHeader, type PageHeaderProps, PipelineBuilder, type PipelineBuilderProps, type PipelineRuntimeOption, PipelineRuntimeSelector, PipelineStep, type PipelineStepDisplayConfig, type PipelineStepProps, Popover, PopoverContent, PopoverTrigger, ProviderBadge, type ProviderBadgeProps, type ProviderType, type ReferenceImage, ScrollArea, type ScrollAreaProps, Select, type SelectOption, type SelectProps, SemanticBadge, type SemanticBadgeProps, type SemanticBadgeVariant, Separator, type SeparatorProps, Sidebar, SidebarItem, type SidebarItemProps, type SidebarProps, type SidebarSection, Skeleton, type SkeletonProps, StatCard, type StatCardProps, StatusBadge, type StatusBadgeProps, type StatusType, StepTimings, type StepTimingsProps, Switch, type SwitchProps, Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipTrigger, UseThemeModeReturn, VersionBadge, type VersionBadgeProps, cn, getClassColor, mountAddonPage, providerIcons, statusIcons, useDevShell };
|