import { JSX } from 'react/jsx-runtime'; import { StoreApi } from 'zustand'; import { UseBoundStore } from 'zustand'; declare interface Assembly { id: string; name: string; parts: AssemblyPart[]; mates: Mate[]; } declare interface AssemblyPart { id: string; name: string; modelId: string; transform: { position: Point3D; rotation: Point3D; }; meshData?: MeshData; color?: string; visible: boolean; } export declare class CadEngine { private worker; private pendingRequests; private onMeshUpdate; private onProgress; private onError; private _isReady; get isReady(): boolean; init(): Promise; private handleMessage; private downloadExport; private resolvePending; private rejectPending; private sendRequest; execute(code: string): Promise; exportModel(format: "step" | "stl", filename: string): Promise; importModel(format: "step" | "stl" | "dxf", data: ArrayBuffer, filename: string): Promise; /** * Analyze a DXF file: classify layers, extract profiles, propose 3D features. * Runs on the main thread (not in the WASM worker) since it's pure TS logic. */ analyzeDxf(dxfContent: string): DxfAnalysisResult; setOnMeshUpdate(handler: (mesh: MeshPayload) => void): void; setOnProgress(handler: (stage: string, percent: number) => void): void; setOnError(handler: (error: string) => void): void; dispose(): void; } declare interface CadModel { id: string; name: string; features: Feature[]; activeFeatureIndex: number; } declare interface CadState { model: CadModel; meshData: MeshData | null; isEngineReady: boolean; isProcessing: boolean; assembly: Assembly; selectedFeatureId: string | null; selectedFaceIndex: number | null; viewportSettings: ViewportSettings; leftPanelWidth: number; rightPanelWidth: number; bottomPanelHeight: number; activeBottomTab: "chat" | "code" | "console"; activeLeftTab: "features" | "parts" | "assembly" | "splicer" | "macros"; activeRightTab: "export" | "jobs"; rightPanelOpen: boolean; viewMode: "3d" | "sketch"; canUndo: boolean; canRedo: boolean; chatMessages: ChatMessage[]; isChatLoading: boolean; editorCode: string; setModel: (model: CadModel) => void; setMeshData: (mesh: MeshData | null) => void; setEngineReady: (ready: boolean) => void; setProcessing: (processing: boolean) => void; addFeature: (feature: Feature) => void; removeFeature: (id: string) => void; updateFeature: (id: string, updates: Partial) => void; toggleFeatureVisibility: (id: string) => void; selectFeature: (id: string | null) => void; selectFace: (index: number | null) => void; setViewportSettings: (settings: Partial) => void; setLeftPanelWidth: (width: number) => void; setRightPanelWidth: (width: number) => void; setBottomPanelHeight: (height: number) => void; setActiveBottomTab: (tab: "chat" | "code" | "console") => void; setActiveLeftTab: (tab: "features" | "parts" | "assembly" | "splicer" | "macros") => void; setActiveRightTab: (tab: "export" | "jobs") => void; toggleRightPanel: () => void; setViewMode: (mode: "3d" | "sketch") => void; addChatMessage: (message: Omit) => void; setChatLoading: (loading: boolean) => void; clearChat: () => void; setEditorCode: (code: string) => void; pushHistory: (label: string) => void; undo: () => void; redo: () => void; addAssemblyPart: (part: Assembly["parts"][number]) => void; removeAssemblyPart: (id: string) => void; addMate: (mate: Assembly["mates"][number]) => void; removeMate: (id: string) => void; } export declare function CadViewport({ className }: CadViewportProps): JSX.Element; declare interface CadViewportProps { className?: string; } declare interface ChatMessage { id: string; role: "user" | "assistant" | "system"; content: string; timestamp: number; codeBlock?: string; modelSnapshot?: string; } export declare function configureWorkerUrl(url: string | URL): void; /** Result from DXF layer analysis (sent from main thread, not worker) */ export declare interface DxfAnalysisRequest { dxfContent: string; } export declare interface DxfAnalysisResult { layerCount: number; profileCount: number; proposedFeatureCount: number; warnings: string[]; /** Serialized ReconstructionResult */ reconstructionData: string; /** Generated replicad code for the first proposed feature */ generatedCode: string | null; } export declare interface EdgeMesh { vertices: Float32Array; } export declare interface ErrorPayload { message: string; stack?: string; } export declare interface ExecutePayload { code: string; } export declare interface ExportPayload { format: "step" | "stl"; filename: string; } export declare interface ExportResultPayload { data: ArrayBuffer; format: string; filename: string; mimeType: string; } export declare interface FaceMesh { vertices: Float32Array; normals: Float32Array; triangles: Uint32Array; } declare interface Feature { id: string; name: string; type: FeatureType; visible: boolean; suppressed: boolean; params: Record; sketchId?: string; /** Replicad code that generates this feature's geometry */ code?: string; } declare type FeatureType = "sketch" | "extrude" | "revolve" | "sweep" | "loft" | "fillet" | "chamfer" | "boolean-fuse" | "boolean-cut" | "boolean-common" | "shell" | "mirror" | "pattern"; export declare function getCadEngine(): CadEngine; export declare interface ImportPayload { format: "step" | "stl" | "dxf"; data: ArrayBuffer; filename: string; } declare interface Mate { id: string; type: MateType; partA: string; partB: string; faceA?: number; faceB?: number; value?: number; locked: boolean; } declare type MateType = "coincident" | "concentric" | "distance" | "angle" | "tangent" | "lock" | "gear" | "rack-pinion"; declare interface MeshData { faces: { vertices: Float32Array; normals: Float32Array; triangles: Uint32Array; }; edges: { vertices: Float32Array; }; } export declare interface MeshPayload { faces: FaceMesh; edges: EdgeMesh; } declare interface Point3D { x: number; y: number; z: number; } export declare interface ProgressPayload { stage: string; percent: number; } export declare function useCadEngine(): { execute: (code: string) => Promise; exportModel: (format: "step" | "stl") => Promise; importModel: (file: File) => Promise; }; export declare const useCadStore: UseBoundStore>; declare interface ViewportSettings { showGrid: boolean; showAxes: boolean; showWireframe: boolean; showEdges: boolean; backgroundColor: string; projectionMode: "perspective" | "orthographic"; } export declare type WorkerMessageType = "init" | "execute" | "export" | "import" | "ready" | "result" | "mesh" | "error" | "progress"; export declare interface WorkerRequest { id: string; type: Extract; payload: unknown; } export declare interface WorkerResponse { id: string; type: Extract; payload: unknown; } export { }