@vibeship/devtools
Version:
Comprehensive markdown-based project management system with AI capabilities for Next.js applications
264 lines (254 loc) • 8.61 kB
TypeScript
import * as react_jsx_runtime from 'react/jsx-runtime';
import React, { Component, ReactNode, ErrorInfo } from 'react';
/**
* Zero-config Vibeship DevTools component
* Works immediately with no setup required
*/
interface VibeshipDevToolsProps {
/**
* Position of the floating button
*/
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
/**
* Whether to show upgrade prompts
*/
showUpgradePrompts?: boolean;
/**
* Whether to start in open state
*/
defaultOpen?: boolean;
/**
* Custom class name for the container
*/
className?: string;
/**
* Callback when upgrade is initiated
*/
onUpgrade?: (nextLevel: number) => void;
/**
* Scanner options (advanced)
*/
scanOptions?: {
includePublicFiles?: boolean;
includeSourceMaps?: boolean;
maxTasks?: number;
};
}
declare function VibeshipDevTools({ position, showUpgradePrompts, defaultOpen, className, onUpgrade, scanOptions, }: VibeshipDevToolsProps): react_jsx_runtime.JSX.Element;
/**
* Static DevTools panel for embedding in layouts
*/
interface VibeshipDevToolsPanelProps {
/**
* Whether to show upgrade prompts
*/
showUpgradePrompts?: boolean;
/**
* Custom class name for the container
*/
className?: string;
/**
* Callback when upgrade is initiated
*/
onUpgrade?: (nextLevel: number) => void;
/**
* Scanner options (advanced)
*/
scanOptions?: {
includePublicFiles?: boolean;
includeSourceMaps?: boolean;
maxTasks?: number;
};
}
declare function VibeshipDevToolsPanel({ showUpgradePrompts, className, onUpgrade, scanOptions, }: VibeshipDevToolsPanelProps): react_jsx_runtime.JSX.Element;
/**
* Client-side task scanner for zero-config mode
* Scans visible content in the browser without requiring API setup
*/
interface ClientTask {
id: string;
type: string;
content: string;
file: string;
line: number;
priority: 'low' | 'medium' | 'high';
source: 'dom' | 'props' | 'code' | 'sourcemap' | 'public';
}
interface ScanOptions {
includeComments?: boolean;
includeHtml?: boolean;
includeProps?: boolean;
includeSourceMaps?: boolean;
includePublicFiles?: boolean;
includeAsync?: boolean;
publicFiles?: string[];
maxTasks?: number;
}
/**
* Scan DOM content for tasks
*/
declare function scanDomContent(options?: ScanOptions): ClientTask[];
/**
* Scan Next.js props for tasks
*/
declare function scanNextJsProps(options?: ScanOptions): ClientTask[];
/**
* Scan any text content for tasks
*/
declare function scanTextContent(content: string, source: ClientTask['source'], fileName?: string): ClientTask[];
/**
* Main scanner that combines all scanning methods
*/
declare function scanForTasks(options?: ScanOptions): ClientTask[];
/**
* Watch for DOM changes and rescan
*/
declare function watchForChanges(callback: (tasks: ClientTask[]) => void, options?: ScanOptions): () => void;
/**
* React hooks for zero-config mode
*/
interface UseClientSideScanOptions extends ScanOptions {
enabled?: boolean;
watchChanges?: boolean;
scanInterval?: number;
includeAsync?: boolean;
}
/**
* Hook to scan for tasks on the client side
*/
declare function useClientSideScan(options?: UseClientSideScanOptions): {
tasks: ClientTask[];
isScanning: boolean;
lastScanTime: Date | null;
rescan: () => Promise<void>;
taskCount: number;
};
/**
* Hook to track feature availability
*/
declare function useFeatureDetection(): {
hasApiRoute: boolean;
hasAiEnabled: boolean;
hasFileAccess: boolean;
isDevMode: boolean;
};
/**
* Hook for progressive enhancement levels
*/
declare function useProgressiveLevel(): {
currentLevel: number;
levels: {
level: number;
name: string;
description: string;
features: string[];
}[];
features: {
hasApiRoute: boolean;
hasAiEnabled: boolean;
hasFileAccess: boolean;
isDevMode: boolean;
};
canUpgrade: boolean;
};
interface TaskPanelProps {
tasks: ClientTask[];
isScanning?: boolean;
lastScanTime?: Date | null;
onRescan?: () => void;
className?: string;
}
declare function TaskPanel({ tasks, isScanning, lastScanTime, onRescan, className, }: TaskPanelProps): react_jsx_runtime.JSX.Element;
/**
* Upgrade prompt component for progressive enhancement
*/
interface UpgradeLevel {
level: number;
name: string;
description: string;
features: string[];
setupTime?: string;
setupSteps?: string[];
}
interface UpgradePromptProps {
currentLevel: number;
nextLevel: UpgradeLevel;
onUpgrade?: () => void;
onDismiss?: () => void;
onLearnMore?: () => void;
}
declare function UpgradePrompt({ currentLevel, nextLevel, onUpgrade, onDismiss, onLearnMore, }: UpgradePromptProps): react_jsx_runtime.JSX.Element;
/**
* Mini upgrade banner for less intrusive prompting
*/
interface UpgradeBannerProps {
message: string;
actionText?: string;
onAction?: () => void;
onDismiss?: () => void;
}
declare function UpgradeBanner({ message, actionText, onAction, onDismiss, }: UpgradeBannerProps): react_jsx_runtime.JSX.Element;
interface VirtualListProps<T> {
items: T[];
height: number;
itemHeight: number | ((index: number) => number);
overscan?: number;
renderItem: (item: T, index: number) => React.ReactNode;
className?: string;
onScroll?: (scrollTop: number) => void;
emptyMessage?: string;
}
declare function VirtualList<T>({ items, height, itemHeight, overscan, renderItem, className, onScroll, emptyMessage, }: VirtualListProps<T>): react_jsx_runtime.JSX.Element;
/**
* Hook to use with VirtualList for dynamic item heights
*/
declare function useVirtualListDynamicHeights<T>(items: T[], estimatedItemHeight?: number): {
getItemHeight: (index: number) => number;
measureItem: (index: number, element: HTMLElement | null) => void;
resetHeights: () => void;
};
interface ErrorBoundaryState {
hasError: boolean;
error?: Error;
errorInfo?: ErrorInfo;
isRetrying: boolean;
}
interface ErrorBoundaryProps {
children: ReactNode;
fallback?: (error: Error, retry: () => void) => ReactNode;
onError?: (error: Error, errorInfo: ErrorInfo) => void;
resetOnPropsChange?: boolean;
resetKeys?: Array<string | number>;
}
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
private retryTimeoutId;
constructor(props: ErrorBoundaryProps);
static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState>;
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
componentDidUpdate(prevProps: ErrorBoundaryProps): void;
componentWillUnmount(): void;
retry: () => void;
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
}
/**
* Higher-order component to wrap components with error boundary
*/
declare function withErrorBoundary<P extends object>(Component: React.ComponentType<P>, errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>): {
(props: P): react_jsx_runtime.JSX.Element;
displayName: string;
};
/**
* Hook to handle async errors in function components
*/
declare function useErrorHandler(): {
handleError: (error: Error) => void;
clearError: () => void;
};
/**
* Component to wrap async operations with error handling
*/
declare function AsyncErrorHandler({ children, onError }: {
children: (handleError: (error: Error) => void) => ReactNode;
onError?: (error: Error) => void;
}): react_jsx_runtime.JSX.Element;
export { AsyncErrorHandler, type ClientTask, ErrorBoundary, type ErrorBoundaryProps, type ErrorBoundaryState, type ScanOptions, TaskPanel, type TaskPanelProps, UpgradeBanner, type UpgradeBannerProps, type UpgradeLevel, UpgradePrompt, type UpgradePromptProps, type UseClientSideScanOptions, VibeshipDevTools, VibeshipDevToolsPanel, type VibeshipDevToolsPanelProps, type VibeshipDevToolsProps, VirtualList, type VirtualListProps, scanDomContent, scanForTasks, scanNextJsProps, scanTextContent, useClientSideScan, useErrorHandler, useFeatureDetection, useProgressiveLevel, useVirtualListDynamicHeights, watchForChanges, withErrorBoundary };