@skillpet/circuit
Version:
Circuit diagram library — render electrical schematics from JSON, with interactive SVG, themes, and Vue/React components
89 lines (88 loc) • 2.91 kB
TypeScript
/**
* Lines, dots, labels — aligned with Python `elements/lines.py` (subset).
*/
import { Element } from "../element.js";
import { Element2Term } from "../element2term.js";
import { Point, type XY } from "../geometry/point.js";
import { Line as LineEl } from "./line.js";
export declare class Arrow extends LineEl {
constructor(opts?: Record<string, unknown> & {
double?: boolean;
arrow?: string;
});
}
/** Bus-style line stripe. */
export declare class DataBusLine extends Element2Term {
constructor(userParams?: Record<string, unknown>);
}
/** Invisible span for labels (two-terminal). */
export declare class Gap extends Element2Term {
constructor(userParams?: Record<string, unknown>);
}
/** Junction dot. */
export declare class Dot extends Element {
constructor(userParams?: Record<string, unknown> & {
radius?: number;
open?: boolean;
});
}
/** Arrowhead only. */
export declare class Arrowhead extends Element {
constructor(userParams?: Record<string, unknown>);
}
/** Three dots (ellipsis). */
export declare class DotDotDot extends Element {
constructor(userParams?: Record<string, unknown> & {
radius?: number;
open?: boolean;
});
}
/** Axis-aligned rectangle from corner1 to corner2. */
export declare class Rect extends Element {
constructor(userParams?: Record<string, unknown> & {
corner1?: XY;
corner2?: XY;
fill?: string | null;
lw?: number;
ls?: string;
});
}
/** Orthogonal / multi-segment wire (subset of Python `Wire`). */
export declare class Wire extends Element {
constructor(userParams?: Record<string, unknown> & {
shape?: string;
k?: number;
to?: XY;
arrow?: string;
});
/** Python `Wire.to` — end point in absolute coordinates. */
to(target: XY, dx?: number, dy?: number): this;
/** Python `Wire.delta` — displacement from start (`at`). */
delta(dx: number, dy: number): this;
dot(open?: boolean): this;
idot(open?: boolean): this;
shape(shape: string): this;
k(k: number): this;
arrow(arrow: string | undefined): this;
_place(dwgxy: XY, dwgtheta: number, dwgparams: Record<string, unknown>): {
point: Point;
theta: number;
};
}
/** Text label element — aligned with Python `lines.Label` (`elmparams` + optional `label()`). */
export declare class Label extends Element {
constructor(userParams?: Record<string, unknown> & {
label?: string;
});
}
/**
* Signal/tag flag — aligned with Python `lines.Tag` (`SegmentPoly` pentagon + optional text).
*/
export declare class Tag extends Element {
constructor(userParams?: Record<string, unknown> & {
width?: number;
height?: number;
/** Optional label text (legacy; also use `SegmentText` / labels separately). */
s?: string;
});
}