import { FunctionComponent, ReactNode } from 'react'; import { BrowserHost, PlaygroundSample } from '../types.js'; import { PlaygroundSaveData } from './hooks/index.js'; import { CommandBarItem } from './responsive-command-bar/index.js'; import { FileOutputViewer, ProgramViewer } from './types.js'; import { PlaygroundState } from './use-playground-state.js'; export type { PlaygroundState }; export interface PlaygroundEmitterOptions { /** Compile debounce delay in milliseconds. Default is 200. */ debounce?: number; } export interface PlaygroundProps { host: BrowserHost; /** Default content if leaving this unmanaged. */ defaultContent?: string; /** List of available libraries */ readonly libraries: readonly string[]; /** Samples available */ samples?: Record; /** Playground state (controlled) */ playgroundState?: PlaygroundState; /** Default playground state if leaving this unmanaged */ defaultPlaygroundState?: PlaygroundState; /** Callback when playground state changes */ onPlaygroundStateChange?: (state: PlaygroundState) => void; /** * Default emitter to use if not provided in defaultPlaygroundState. * @deprecated Use defaultPlaygroundState.emitter instead */ defaultEmitter?: string; onFileBug?: () => void; /** Additional items to show in the command bar. */ commandBarItems?: CommandBarItem[]; /** Custom viewers to view the typespec program */ viewers?: ProgramViewer[]; /** Custom file viewers that enabled for certain emitters. Key of the map is emitter name */ emitterViewers?: Record; /** * Per-emitter playground options. Key is the emitter name. */ emitterOptions?: Record; onSave?: (value: PlaygroundSaveData) => void; editorOptions?: PlaygroundEditorsOptions; /** * Change the footer of the playground. */ footer?: ReactNode; } export interface PlaygroundEditorsOptions { theme?: string; } export type { PlaygroundSaveData }; /** * Playground component for TypeSpec with consolidated state management. * * @example * ```tsx * const [playgroundState, setPlaygroundState] = useState({ * emitter: 'openapi3', * compilerOptions: {}, * sampleName: 'basic', * selectedViewer: 'openapi', * viewerState: {} * }); * * * ``` * * For uncontrolled usage, use defaultPlaygroundState: * ```tsx * * ``` * * For backward compatibility, you can also use the deprecated defaultEmitter prop: * ```tsx * * ``` */ export declare const Playground: FunctionComponent; //# sourceMappingURL=playground.d.ts.map