@promptbook/remote-server
Version:
Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action
54 lines (53 loc) • 1.87 kB
TypeScript
import type { editor } from 'monaco-editor';
/**
* Type describing monaco editor.
*/
type MonacoEditor = typeof import('monaco-editor');
/**
* Resolved visual theme supported by the Book editor.
*
* @private function of BookEditorMonaco
*/
type BookEditorTheme = 'LIGHT' | 'DARK';
/**
* Props for use book editor monaco language.
*/
type UseBookEditorMonacoLanguageProps = {
readonly monaco: MonacoEditor | null;
readonly theme: BookEditorTheme;
};
/**
* Ensures the BookEditor Monaco language, tokenizer, links and completion providers are
* registered exactly once per Monaco instance, while always re-applying the Book theme.
*
* @private function of BookEditorMonaco
*/
export declare function ensureBookEditorMonacoLanguage(monaco: MonacoEditor, theme?: BookEditorTheme): void;
/**
* Props required to enforce Book Monaco language/theme on one mounted editor.
*
* @private function of BookEditorMonaco
*/
type EnsureBookEditorMonacoLanguageForEditorProps = {
readonly monaco: MonacoEditor;
readonly monacoEditor: editor.IStandaloneCodeEditor;
readonly theme?: BookEditorTheme;
};
/**
* Ensures the mounted Monaco editor model uses Book language and Book theme.
*
* This is resilient when a shared Monaco runtime/theme is changed by another page and the
* Book editor tree is restored from App Router cache without a full remount.
*
* @param props - Monaco runtime and mounted editor instance.
*
* @private function of BookEditorMonaco
*/
export declare function ensureBookEditorMonacoLanguageForEditor(props: EnsureBookEditorMonacoLanguageForEditorProps): void;
/**
* Registers the language helpers that power Monaco inside `BookEditorMonaco`.
*
* @private function of BookEditorMonaco
*/
export declare function useBookEditorMonacoLanguage({ monaco, theme }: UseBookEditorMonacoLanguageProps): void;
export {};