@selenite/graph-editor
Version:
A graph editor for visual programming, based on rete and svelte.
57 lines (56 loc) • 1.98 kB
TypeScript
import { type resolveContext } from '../global/todo.svelte';
import 'regenerator-runtime/runtime';
declare function parseXml(xml: string): ParsedXmlNodes;
export declare function buildXml({ parsedXml, indent, baseSpace, cursorTag }: {
parsedXml: ParsedXmlNodes;
indent?: number;
baseSpace?: string;
cursorTag?: string;
}): string;
export declare function getElementFromParsedXml(xml: Record<string, unknown>): string | null;
/**
* Returns the different paths to the possible merge positions
* @param param0
* @returns
*/
export declare function findPossibleMergePositions({ baseXml, element, typesPaths, cursorTag }: {
baseXml: ParsedXmlNodes;
element: string;
typesPaths: Record<string, string[]>;
cursorTag?: string;
}): {
path: {
pos: number;
key: string;
}[];
withCursor: boolean;
}[];
export declare function getXmlAttributes(xml: {
[key: string]: ParsedXmlNodes | ParsedXmlNode[] | ParsedXmlAttribute | undefined;
':@'?: ParsedXmlAttribute | undefined;
}): Record<string, string>;
export declare function mergeParsedXml({ baseXml, newXml, geosContext, cursorTag }: {
baseXml: ParsedXmlNodes;
newXml: ParsedXmlNodes;
cursorTag?: string;
geosContext: resolveContext<'geos'>;
}): ParsedXmlNodes;
declare function formatXml({ xml, indent }: {
xml: string;
indent?: number;
}): string;
declare function formatComment(comment: string): string;
type ParsedXmlAttribute = Record<string, string>;
type ParsedXmlNode = {
'#text'?: string;
[key: string]: ParsedXmlAttribute | Array<ParsedXmlNode> | string | undefined;
};
type parsedXmlComment = {
'#comment': string;
};
type ParsedXmlNodes = Array<parsedXmlComment | {
':@'?: ParsedXmlAttribute;
[key: string]: ParsedXmlNodes | Array<ParsedXmlNode> | ParsedXmlAttribute | undefined;
}>;
export type { ParsedXmlNodes, ParsedXmlNode, parsedXmlComment, ParsedXmlAttribute };
export { parseXml, formatXml, formatComment };