UNPKG

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.

33 lines (32 loc) 1.79 kB
import { EditorView } from "@codemirror/view"; import { EditorState } from "@codemirror/state"; import { SyntaxNode } from "@lezer/common"; import { UpdateDispatch } from "./popover-menu/PopoverState"; export declare function codeString(view: EditorView, from: number, to?: number): string; export declare function codeStringState(state: EditorState, from: number, to?: number): string; export declare function classNames(input: Record<string, boolean>): string; export declare function unwrap(value: any, errorMessage: string): any; export declare const colorRegex: RegExp; export declare const colorNames: { [key: string]: string; }; declare type NodeType = "Object" | "Array" | "Property" | "PropertyName" | "String" | "Number" | "Boolean"; declare type AbsPathItem = { nodeType: NodeType; index: number; node: SyntaxNode; }; export declare function syntaxNodeToAbsPath(node: SyntaxNode): AbsPathItem[]; export declare function syntaxNodeToKeyPath(node: SyntaxNode, fullCode: string): (string | number)[]; export declare function setIn(keyPath: (string | number)[], newValue: any, content: string): string; export declare function insertSwap(content: string, update: UpdateDispatch): string; export declare function applyAllCmds(content: string, updates: UpdateDispatch[]): string; export declare function createNodeMap(schema: any, doc: string): Promise<{ [x: string]: any; }>; export declare function getMenuTargetNode(state: EditorState): SyntaxNode | null; export declare const simpleUpdate: (view: EditorView, from: number, to: number, insert: string) => void; export declare function simpleParse(content: any, defaultVal?: {}): any; export declare function getCursorPos(state: EditorState): number; export declare const maybeTrim: (x: string) => string; export {};