@skillpet/circuit
Version:
Circuit diagram library — render electrical schematics from JSON, with interactive SVG, themes, and Vue/React components
41 lines (40 loc) • 1.25 kB
TypeScript
/**
* Logic expression parsing and tree layout — TS port of Python `schemdraw.parsing`.
*
* Exports:
* - `DrawTree`, `buchheim` — Buchheim-Reingold-Tilford tree layout
* - `LogicTree` — intermediate tree for logic gates
* - `logicparse` — parse a logic string into a Drawing of logic gates
*/
import { Drawing } from "../drawing.js";
export declare class LogicTree {
node: string;
children: LogicTree[];
constructor(node: string, ...children: LogicTree[]);
[Symbol.iterator](): Iterator<LogicTree>;
}
export declare class DrawTree {
x: number;
y: number;
node: string;
children: DrawTree[];
parent: DrawTree | null;
thread: DrawTree | null;
mod: number;
ancestor: DrawTree;
change: number;
shift: number;
number: number;
private _lmostSibling;
constructor(tree: LogicTree, parent?: DrawTree | null, depth?: number, number?: number);
left(): DrawTree | null;
right(): DrawTree | null;
lbrother(): DrawTree | null;
get lmostSibling(): DrawTree | null;
}
export declare function buchheim(tree: LogicTree): DrawTree;
export declare function logicparse(expr: string, opts?: {
gateW?: number;
gateH?: number;
outlabel?: string;
}): Drawing;