import { DependencyList } from 'react'; import { DialSchema } from '@vuer-ai/vuer-uikit'; import { DialControlSchema, DialControlResult, OnChangeCallback } from './useCustomDialControls'; /** * Options for global dial controls */ export interface GlobalDialControlOptions { /** If false, automatically cleanup on unmount (default: true) */ persist?: boolean; /** If false, controls will not be registered/displayed (default: true) */ enabled?: boolean; /** * If true, component re-renders when values change (default: true) * Set to false for performance optimization when only using get/set */ reactive?: boolean; /** * Tags for panel filtering (replaces displayKey-based filtering) * Panels can filter by tags to show only matching controls */ tags?: string[]; /** * Callback when values change (from panel interaction or set() calls) * Receives full context including source and schema ownership info */ onChange?: OnChangeCallback; } /** * Hook to register dial controls in the 'global' category * * This is a convenience wrapper around useCustomDialControls that automatically * sets category to 'global', making it easier to create controls that * should always be visible in the global settings panel. * * @param key - Unique identifier for this control set * @param schemaConfig - Schema configuration with schemas and optional groups * @returns Object containing { values, get, set } for accessing and modifying control values * * @example * ```tsx * // Basic usage - will be shown in global panel * const { values, get, set } = useGlobalDialControls('camera-settings', { * schemas: [ * { name: 'fov', dtype: 'number', value: 75, min: 30, max: 120 }, * { name: 'near', dtype: 'number', value: 0.1, min: 0.01, max: 1 }, * ], * groups: [{ name: 'Camera' }], * }); * * // Access values * const fov = values.fov; // From reactive values object * const fov2 = get('fov'); // Direct store access * set('fov', 90); // Update value * * // Conditionally enabled * const { values } = useGlobalDialControls('debug-settings', { * schemas: [ * { name: 'showStats', dtype: 'boolean', value: true }, * ], * }, { enabled: isDebugMode }); * * // Performance optimization: non-reactive mode (no re-renders) * const { get, set } = useGlobalDialControls('settings', schemas, { reactive: false }); * * // With dynamic values (deps as third parameter) * const { values } = useGlobalDialControls('dynamic-settings', { * schemas: [ * { name: 'value', dtype: 'number', value: someValue }, * ], * }, [someValue]); * * // With auto-cleanup * const { values } = useGlobalDialControls('temp-settings', { * schemas: [...] * }, { persist: false }); * ``` */ export declare function useGlobalDialControls(key: string, schemaConfig: DialControlSchema | DialSchema[], deps: DependencyList): DialControlResult; export declare function useGlobalDialControls(key: string, schemaConfig: DialControlSchema | DialSchema[], options: GlobalDialControlOptions, deps?: DependencyList): DialControlResult; export declare function useGlobalDialControls(key: string, schemaConfig: DialControlSchema | DialSchema[]): DialControlResult;