ESM-only Askr wrapper for Monaco Editor.
This package keeps the wrapper thin on purpose: it hosts Monaco inside an Askr
component without inventing a second editor API. Raw Monaco options, external
model ownership, and direct editor/namespace escape hatches are the contract.
npm install @askrjs/monaco monaco-editorimport { MonacoEditor } from '@askrjs/monaco';
import * as monaco from 'monaco-editor';const model = monaco.editor.createModel(
'const answer = 42;',
'typescript',
monaco.Uri.parse('file:///src/example.ts')
);
<MonacoEditor
monaco={monaco}
model={model}
options={{ automaticLayout: true, minimap: { enabled: false } }}
onMount={(editor) => {
editor.focus();
}}
/>;- Root package and direct subpath exports expose the thin wrapper.
@askrjs/monaco/testingexposes deterministic model-editing helpers for browser tests without pretending that touch devices have a keyboard modifier.MonacoEditorlazy-loads Monaco by default or accepts an injected namespace.- Wrapper-owned concerns are host lifecycle, model wiring, and typed escape hatches.
- Controlled parent rerenders retain the live editor host, so focus, selection, history, and completion state survive model-content callbacks. Actual component unmount remains the single disposal boundary.
- Wrapper-owned
pathvalues must be unique; pass an existing Monaco model throughmodel={monaco.editor.getModel(uri)}when sharing is intentional.
src/components/monaco-editor- public wrapper surfacetests- unit, jsdom, and browser smoke coveragedocs- repo notes and package overview