prong-editor
Version:
Prong (PRojectional jsON Gui) is an editor framework for creating bespoke in-browser editors for JSON-based domain-specific languages (such as [Vega](https://vega.github.io/vega/), [Vega-Lite](https://vega.github.io/vega-lite/), [Tracery](https://tracery.
22 lines (21 loc) • 977 B
TypeScript
import { Decoration, DecorationSet, EditorView, ViewPlugin, ViewUpdate } from "@codemirror/view";
import { NodeType, SyntaxNode } from "@lezer/common";
import { Range, EditorState } from "@codemirror/state";
declare type EventSubs = {
[x: string]: (e: MouseEvent, view: EditorView) => any;
};
export interface SimpleWidget {
checkForAdd: (type: NodeType, view: EditorView, currentNode: SyntaxNode) => boolean;
addNode: (view: EditorView, from: number, to: number, currentNode: SyntaxNode) => Range<Decoration>[];
eventSubscriptions: EventSubs;
}
export interface SimpleWidgetStateVersion {
checkForAdd: (type: NodeType, state: EditorState, currentNode: SyntaxNode) => boolean;
addNode: (state: EditorState, from: number, to: number, currentNode: SyntaxNode) => Range<Decoration>[];
eventSubscriptions: EventSubs;
}
export declare const widgetsPlugin: ViewPlugin<{
decorations: DecorationSet;
update(update: ViewUpdate): void;
}>;
export {};