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.

51 lines (50 loc) 1.57 kB
import { SyntaxNode } from "@lezer/common"; import { MenuEvent } from "./modify-json"; import { SchemaMap } from "../components/Editor"; import { Projection } from "./projections"; import { LintError } from "./Linter"; export declare type MenuRow = { label: string; elements: MenuElement[]; }; export declare type MenuElement = { type: "button"; label?: string; content: string; onSelect: MenuEvent; } | { type: "display"; label?: string; content: string; } | { type: "free-input"; label: string; } | { type: "projection"; projectionType: Projection["type"]; takeOverMenu?: boolean; label?: string; element: JSX.Element; }; export declare const nodeToId: (node: SyntaxNode) => `${number}-${number}`; export declare function prepDiagnostics(diagnostics: LintError[], targetNode: SyntaxNode): { label: string; elements: ({ type: string; content: string; onSelect: { type: string; payload: any; nodeId: `${number}-${number}`; }; } | { type: string; content: string; })[]; }[]; export declare const simpleTypes: Record<string, any>; export declare const literalTypes: Record<string, string>; export declare const liminalNodeTypes: Set<string>; export declare function retargetToAppropriateNode(node: SyntaxNode): SyntaxNode; export declare function simpleMerge(content: MenuRow[]): MenuRow[]; export declare function generateMenuContent(syntaxNode: SyntaxNode, schemaMap: SchemaMap, fullCode: string): MenuRow[];