Askr documentation
Generated API snapshot

@askrjs/monaco/monaco-editor

Exports from the declarations published in @askrjs/monaco. Signatures reflect the published artifact.

Exports

This entrypoint publishes 11 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.

MonacoBeforeMounttype

MonacoBeforeMount: ((monaco: MonacoNamespace) => void | PromiseLike<void>) | undefined

Hook run after Monaco loads but before the editor instance is created.

MonacoEditortype

MonacoEditor: (props: MonacoEditorProps) => JSX.Element

Monaco wrapper that keeps the Askr surface thin and forwards real Monaco models, options, and lifecycle access instead of recreating Monaco's API.

MonacoEditorInstancetype

MonacoEditorInstance: Monaco.editor.IStandaloneCodeEditor

A live Monaco standalone code editor instance.

MonacoEditorOptionstype

MonacoEditorOptions: Omit<Monaco.editor.IStandaloneEditorConstructionOptions, 'model' | 'value' | 'language' | 'theme'>

Monaco standalone editor construction options, excluding the fields that `MonacoEditorProps` manages directly (`model`, `value`, `language`, `theme`).

MonacoEditorPropstype

MonacoEditorProps: Omit<JSX.IntrinsicElements['div'], 'children' | 'ref'> & {
  ref?: Ref<HTMLDivElement>;
  children?: never;
  role?: JSX.IntrinsicElements['div']['role'];
  options?: MonacoEditorOptions;
  overrideServices?: Monaco.editor.IEditorOverrideServices;
  model?: MonacoTextModel | null;
  value?: string;
  defaultValue?: string;
  language?: string;
  path?: string | MonacoUri;
  /** Monaco theme name. Monaco applies themes process-wide, so simultaneous editors cannot use different themes. */
  theme?: string;
  monaco?: MonacoNamespace;
  loadMonaco?: MonacoLoader;
  beforeMount?: MonacoBeforeMount;
  onMount?: MonacoMountHandler;
  onUnmount?: MonacoMountHandler;
  onError?: MonacoErrorHandler;
  editorRef?: Ref<MonacoEditorInstance>;
  monacoRef?: Ref<MonacoNamespace>;
}

Thin Askr host for Monaco's standalone editor. Pass raw Monaco `options` and, when needed, provide an external `model` to keep full access to Monaco's language services, providers, and editor APIs.

beforeMount
beforeMount?: MonacoBeforeMount;
children
children?: undefined;
defaultValue
defaultValue?: string | undefined;
editorRef
editorRef?: Ref<Monaco.editor.IStandaloneCodeEditor>;
language
language?: string | undefined;
loadMonaco
loadMonaco?: MonacoLoader;
model
model?: Monaco.editor.ITextModel | null | undefined;
monaco
monaco?: typeof import("monaco-editor/editor/editor.api") | undefined;
monacoRef
monacoRef?: Ref<typeof import("monaco-editor/editor/editor.api")>;
onError
onError?: MonacoErrorHandler;
onMount
onMount?: MonacoMountHandler;
onUnmount
onUnmount?: MonacoMountHandler;
options
options?: MonacoEditorOptions | undefined;
overrideServices
overrideServices?: Monaco.editor.IEditorOverrideServices | undefined;
path
path?: string | Monaco.Uri | undefined;
ref
ref?: Ref<HTMLDivElement>;
role
role?: ReactiveProp<IntrinsicTextValue>;
theme
Monaco theme name. Monaco applies themes process-wide, so simultaneous editors cannot use different themes.
value
value?: string | undefined;

MonacoErrorHandlertype

MonacoErrorHandler: ((error: unknown) => void) | undefined

Handler invoked when loading Monaco or applying an edit fails.

MonacoLoadertype

MonacoLoader: (() => MonacoNamespace | PromiseLike<MonacoNamespace>) | undefined

Loader invoked to resolve the Monaco namespace when `monaco` isn't provided directly.

MonacoMountHandlertype

MonacoMountHandler: ((editor: MonacoEditorInstance, monaco: MonacoNamespace) => void) | undefined

Handler invoked with the editor and Monaco namespace on mount or unmount.

MonacoNamespacetype

MonacoNamespace: typeof import('monaco-editor/editor/editor.api')

The `monaco-editor` module namespace, either provided directly or resolved by `loadMonaco`.

MonacoTextModeltype

MonacoTextModel: Monaco.editor.ITextModel

A Monaco text model backing an editor instance.

MonacoUritype

MonacoUri: Monaco.Uri

A Monaco URI, used to identify a text model's path.