llm-ui-objects
Version:
Interactive object components for LLM-powered writing interfaces
150 lines (136 loc) • 4.86 kB
TypeScript
import React$1 from 'react';
interface CellProps {
id: string;
text: string;
isActive: boolean;
isMinimized?: boolean;
isSelected?: boolean;
isHovered?: boolean;
minimizedText?: string;
tabDirection?: string;
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
onMouseEnter?: (e: React.MouseEvent<HTMLDivElement>) => void;
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement>) => void;
parentCellId: string | null;
style?: React.CSSProperties;
}
declare const Cell: React$1.FC<CellProps>;
interface CellBoardProps {
initialBoard: string[][];
maxRows: number;
maxColumns: number;
setEntryCell: (cellId: string | undefined) => void;
style?: React$1.CSSProperties;
}
declare const CellBoard: React$1.FC<CellBoardProps>;
interface CellTreeProps {
cellWidth: number;
cellHeight: number;
style?: React$1.CSSProperties;
}
declare const CellTree: React$1.FC<CellTreeProps>;
interface CellEditorProps {
cellIds: string[];
style?: React$1.CSSProperties;
textColor?: string;
}
declare const CellEditor: React$1.FC<CellEditorProps>;
interface GeneratorProps {
id: string;
parameters: ParameterProps[];
color: string;
size?: string;
numColumns?: number;
isGenerating?: boolean;
isSelected?: boolean;
cellId: string | null;
lensId: string | null;
onMouseEnter?: (e: React.MouseEvent<HTMLDivElement>) => void;
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement>) => void;
}
interface ParameterProps {
id: string;
name: string;
nickname?: string;
type: string;
allowedValues: string[] | number[];
valueNicknames?: {
[key: string]: string;
};
defaultValue: string | number;
value?: string | number;
}
declare const Generator: React$1.FC<GeneratorProps>;
interface LensProps {
id: string;
type: string;
style?: React.CSSProperties;
onGenerationClick?: (generationText: string) => void;
group: number;
getGenerationMetadata?: (generations: GenerationProps[]) => Promise<any[]>;
}
interface GenerationProps {
id: string;
generatorId: string;
lensId: string | null;
inputText: string;
content: string;
parameters: ParameterProps[];
metadata: any;
}
declare const Lens: React$1.FC<LensProps>;
interface ListLensProps {
generations: GenerationProps[];
onGenerationClick?: (generationText: string) => void;
}
declare const ListLens: React$1.FC<ListLensProps>;
interface SpaceLensProps {
generations: GenerationProps[];
onGenerationClick?: (generationText: string) => void;
getPosition: (generations: GenerationProps[]) => Promise<{
x: number;
y: number;
}[]>;
}
declare const SpaceLens: React$1.FC<SpaceLensProps>;
interface IObjectsContext {
cells: CellProps[];
addCell: (text: string, data?: any) => string;
removeCell: (cellId: string) => void;
updateCell: (cellId: string, text: string) => void;
toggleCell: (cellId: string, property: string) => void;
linkCells: (childId: string, parentId: string) => void;
unlinkCell: (id: string) => void;
generators: GeneratorProps[];
addGenerator: (generator: GeneratorProps) => string;
removeGenerator: (generatorId: string) => void;
updateGenerator: (generatorId: string, parameters: any) => void;
toggleGenerator: (generatorId: string, property: string) => void;
onGenerate: (generatorId: string) => void;
generations: GenerationProps[];
updateGenerationsData: (ids: string[], data: any[]) => void;
linkCellToGenerator: (cellId: string, generatorId: string) => void;
unlinkCellFromGenerator: (generatorId: string) => void;
linkGeneratorToLens: (generatorId: string, lensId: string) => void;
unlinkGeneratorFromLens: (generatorId: string) => void;
lenses: LensProps[];
addLens: (lens: LensProps) => string;
removeLens: (id: string) => void;
changeLensType: (id: string, type: string) => void;
linkLenses: (fromId: string, toId: string) => void;
unlinkLens: (id: string) => void;
resetLens: (id: string) => void;
hoveredId: string | null;
setHoveredId: (id: string | null) => void;
}
declare const ObjectsContext: React$1.Context<IObjectsContext>;
interface Props {
children: React$1.ReactElement | React$1.ReactElement[];
cells?: CellProps[];
generators?: GeneratorProps[];
lenses?: LensProps[];
generateHandler: (input: string | string[], parameters: any) => Promise<string | string[]>;
minimizeHandler?: (text: string) => string;
}
declare const ObjectsContextProvider: React$1.FC<Props>;
export { Cell, CellBoard, CellEditor, type CellProps, CellTree, type GenerationProps, Generator, type GeneratorProps, Lens, type LensProps, ListLens, ObjectsContext, ObjectsContextProvider, type ParameterProps, SpaceLens };