/** * Utility functions for GUI compatibility between lil-gui and Three.js Inspector. * @module guiUtils */ /** Value-bearing change event emitted by inspector-style GUI controllers. */ export interface GUIControllerChangeEvent { value: TValue; } /** Callback accepted by GUI controller change subscriptions. */ export type GUIControllerChangeCallback = (value: TValue) => void; /** * Structural controller contract shared by lil-gui and Three.js Inspector. * Every operation is optional because each GUI implementation exposes a * different subset. */ export interface GUIController { onChange?(callback: GUIControllerChangeCallback): unknown; addEventListener?(type: 'change', listener: (event: GUIControllerChangeEvent) => void): unknown; disable?(): unknown; listen?(): unknown; updateDisplay?(): unknown; } /** Value type reported by a structural GUI controller. */ export type GUIControllerValue = TController extends { onChange(callback: GUIControllerChangeCallback): unknown; } ? TValue : TController extends { addEventListener(type: 'change', listener: (event: GUIControllerChangeEvent) => void): unknown; } ? TValue : TController extends GUIController ? TValue : unknown; /** Parent contract used by inspector-style GUI folders during disposal. */ export interface GUIFolderParent { remove(item: unknown): unknown; } /** Structural folder contract shared by lil-gui and Three.js Inspector. */ export interface GUIFolder { destroy?: () => unknown; parent?: GUIFolderParent | null; paramList?: unknown; } /** * Bind an onChange callback to a GUI controller. * Works with both lil-gui (onChange method) and Inspector API (addEventListener). * */ export declare function bindChange(ctrl: TController, callback: GUIControllerChangeCallback>>): TController; /** * Safely call disable() on a controller if available. * Inspector API doesn't support disable(). * */ export declare function safeDisable(ctrl: TController): TController; /** * Safely call listen() on a controller if available. * Inspector API supports listen() but it's good to check. * */ export declare function safeListen(ctrl: TController): TController; /** * Safely call updateDisplay() on a controller if available. * Inspector API doesn't support updateDisplay(). * */ export declare function safeUpdateDisplay(ctrl: TController): TController; /** * Dispose a GUI folder/group safely. * Works with both lil-gui (destroy) and Inspector API (parent.remove). * */ export declare function disposeFolder(folder: GUIFolder | null | undefined): null;