Reference
TypeScript types
All types live in src/labs/types.ts. Import them from @/labs/types.
Row
type Row = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j';
PinRef variants
type TiePin = { board: string; col: number; row: Row };
type RailPin = { board: string; rail: 'vcc_top'|'gnd_top'|'vcc_bot'|'gnd_bot'; col: number };
type IcPin = { ic: string; pin: string }; // pin is any named pin on the IC/part
type PassivePin = { component: string; end: 'p1'|'p2' };
type LedPin = { led: string; end: 'anode'|'cathode' };
type PinRef = TiePin | RailPin | IcPin | PassivePin | LedPin;MountPoint
type MountPoint = { board: string; col: number; row: Row };Color enumerations
type LedColor = 'red' | 'green' | 'yellow' | 'blue' | 'white'; type WireColor = 'red' | 'black' | 'yellow' | 'green' | 'blue' | 'orange' | 'white' | 'purple';
ComponentInstance
A discriminated union covering every renderable part. See Component types for the full list.
type ComponentInstance =
| { id: string; type: 'breadboard' }
| { id: string; type: 'wire'; from: PinRef; to: PinRef; color: WireColor }
| { id: string; type: 'resistor'; ohms: number; mountedAt: MountPoint }
| { id: string; type: 'capacitor'; capacitance: number; mountedAt: MountPoint }
| { id: string; type: 'led'; color: LedColor; mountedAt: MountPoint }
| { id: string; type: 'npn-bjt'; mountedAt: MountPoint }
// ... and many moreStep
type Step = {
title: string;
body: string;
show: string[]; // cumulative component ids
highlight?: string; // id to spotlight
activeInputs?: Record<string, 0|1>; // I/O panel state
supplyVoltage?: number; // for analog circuits
readings?: Record<string, string>; // instrument displays
ledBrightness?: Record<string, number>; // analog LED glow values
};TruthTable
type TruthTableRow = {
inputs: Record<string, 0 | 1>;
outputs: Record<string, 0 | 1>;
};
type TruthTable = {
inputs: string[];
outputs: string[];
rows: TruthTableRow[];
};Circuit
type Circuit = {
id: string;
title: string;
description: string;
components: ComponentInstance[];
steps: Step[];
truthTable?: TruthTable;
};BuildFn (LabScene internal)
// src/labs/LabScene.tsx — not exported, but useful for extension: type BuildFn = ( inst: ComponentInstance, all: ComponentInstance[], ) => THREE.Group | null;