Licence
Apache-2.0
Version
0.0.3
Deps
0
Size
57 kB
Vulns
0
Weekly
0
@askrjs/monaco
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.
Install
npm install @askrjs/monaco monaco-editor
Import
import { MonacoEditor } from '@askrjs/monaco';
import * as monaco from 'monaco-editor';
Example
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();
}}
/>;
Status
- Root package and direct subpath exports expose the thin wrapper.
MonacoEditorlazy-loads Monaco by default or accepts an injected namespace.- Wrapper-owned concerns are host lifecycle, model wiring, and typed escape hatches.
- Wrapper-owned
pathvalues must be unique; pass an existing Monaco model throughmodel={monaco.editor.getModel(uri)}when sharing is intentional.
Layout
src/components/monaco-editor- public wrapper surfacetests- unit, jsdom, and browser smoke coveragedocs- repo notes and package overview