Framework-agnostic SVG circuit editor for Boukamp DSL circuits used in electrochemical impedance spectroscopy (EIS).
Documentation: jigonzalez930209.github.io/velo-circuit
R0{50}-Q1{5e-5,0.8} with strict validation modecreateCircuitGrid() catalog view (DSL + SVG columns) and editor grid modevelo-spectroz circuit elements (11 types including CC, HN)velo-spectrozCircuit symbols use the outline symbol design system: outline-only glyphs, 2.0 px base stroke, and per-kind stroke colors. Parameter counts and DSL syntax are documented in Element Types.
| Code | Element | Params |
|---|---|---|
R |
Resistor | 1 |
C |
Capacitor | 1 |
L |
Inductor | 1 |
Q |
CPE | 2 |
W |
Warburg Infinite | 1 |
Ws |
Warburg Short | 2 |
Wo |
Warburg Open | 2 |
G |
Gerischer | 2 |
Pdw |
Parallel Diffusion Warburg | 4 |
CC |
Cole-Cole | 3 |
HN |
Havriliak-Negami | 4 |
pnpm add velo-circuit
or:
npm install velo-circuit
import { createEditor } from 'velo-circuit';
const editor = createEditor();
editor.mount(document.getElementById('canvas'), {
initialDsl: 'R0-p(R1,C1)-Wo2',
width: 900,
height: 560,
});
editor.on('ast-changed', () => {
console.log(editor.getValue());
});
import { createCircuitGrid } from 'velo-circuit';
const grid = createCircuitGrid({
height: 480,
rowHeight: 120,
strict: true,
columns: [
{ id: 'dsl', label: 'Linear DSL', type: 'dsl', width: 320 },
{ id: 'svg', label: 'Circuit', type: 'svg', width: 220 },
{ id: 'params', label: 'Parameters', type: 'params', width: 200 },
],
initialRows: [
{ id: 'r1', dsl: 'R0{50}-p(R1{100},C1{1e-5})' },
{ id: 'r2', dsl: 'R0{10}-CC1{50,1e-3,0.8}' },
],
});
grid.mount(document.getElementById('grid')!);
grid.on('row-double-click', (row) => console.log(row));
Render read-only circuit diagrams without mounting the editor:
import { renderDslPreviewSvg } from 'velo-circuit';
const svg = renderDslPreviewSvg('R0-p(R1,C1)-Wo2', {
themeMode: 'dark',
colorMode: 'multicolor',
connectionStyle: 'curved',
});
// → standalone <svg class="circuit-preview">…</svg> with embedded CSS
See the Static SVG Rendering guide for export patterns and theme options.
pnpm install
pnpm typecheck
pnpm test
pnpm build
pnpm docs:dev
CI runs in GitHub Actions on Node 22 and 24. npm publish is triggered by pushing a tag like v1.0.0.
You can prepare and dispatch a release with:
pnpm release:prepare -- 1.0.0
What it does:
typecheck, test, and buildpackage.json (and lockfile) to the provided version, or skips if already setchore(release): vX.Y.ZvX.Y.ZRequired GitHub secret for publish workflow: NPM_TOKEN.