import { DependencyList } from 'react'; import { DialSchema } from '@vuer-ai/vuer-uikit'; import { DialControlSchema, DialControlResult, OnChangeCallback } from './useCustomDialControls'; /** * Options for standard dial controls */ export interface DialControlOptions { /** 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 for objects/components * * This is the standard API for creating dial controls. Controls are registered * with category 'default', making them suitable for object-level controls that * should be displayed based on selection state. * * @param key - Unique identifier for this control set * @param schemaConfig - Schema configuration with schemas and optional groups * @param optionsOrDeps - Optional configuration options or dependency list * @param deps - Dependency list to control when schemas are re-registered (only when third param is options) * @returns Object containing { values, get, set } for accessing and modifying control values * * @example * ```tsx * // Basic usage * function ObjectControls({ objectKey }) { * const { values, get, set } = useDialControls(objectKey, { * schemas: [ * { name: 'opacity', dtype: 'number', value: 1, min: 0, max: 1 }, * { name: 'visible', dtype: 'boolean', value: true }, * ], * }); * * // Access via values object (triggers re-render on change) * return ; * } * * // Using get/set methods * const { get, set } = useDialControls('object-1', schemas); * const opacity = get('opacity'); // Direct store access * set('opacity', 0.5); // Update value * * // Conditionally enabled * const { values } = useDialControls('object-1', { * schemas: [ * { name: 'opacity', dtype: 'number', value: 1 }, * ], * }, { enabled: isEditable }); * * // Performance optimization: non-reactive mode (no re-renders) * const { get, set } = useDialControls('object-1', schemas, { reactive: false }); * * // With groups * const { values } = useDialControls('object-1', { * schemas: [ * { name: 'position', dtype: 'vector3', value: [0, 0, 0], grouping: 'Transform' }, * { name: 'rotation', dtype: 'vector3', value: [0, 0, 0], grouping: 'Transform' }, * { name: 'color', dtype: 'color', value: '#ff0000', grouping: 'Material' }, * ], * groups: [ * { name: 'Transform' }, * { name: 'Material' }, * ], * }); * * // With dynamic values (deps as third parameter) * const { values } = useDialControls('dynamic-object', { * schemas: [ * { name: 'value', dtype: 'number', value: someValue }, * ], * }, [someValue]); * * // With auto-cleanup * const { values } = useDialControls('temp-object', { * schemas: [...] * }, { persist: false }); * ``` */ export declare function useDialControls(key: string, schemaConfig: DialControlSchema | DialSchema[], deps: DependencyList): DialControlResult; export declare function useDialControls(key: string, schemaConfig: DialControlSchema | DialSchema[], options: DialControlOptions, deps?: DependencyList): DialControlResult; export declare function useDialControls(key: string, schemaConfig: DialControlSchema | DialSchema[]): DialControlResult;