diff --git a/benchmarks-evalite/prompt.ts b/benchmarks-evalite/prompt.ts
index 7ac8890..963a590 100644
--- a/benchmarks-evalite/prompt.ts
+++ b/benchmarks-evalite/prompt.ts
@@ -136,9 +136,9 @@ ${cleanedPropsDoc}
// Silkscreen markings for the chip outline
-
- // Pin 1 indicator
-
+
+ // Pin 1 indicator
+
)
@@ -147,7 +147,7 @@ ${cleanedPropsDoc}
-
+
)
diff --git a/benchmarks-evalite/prompts/prompt-2025-01-28T12-59-44-873Z.txt b/benchmarks-evalite/prompts/prompt-2025-01-28T12-59-44-873Z.txt
new file mode 100644
index 0000000..81c2c4a
--- /dev/null
+++ b/benchmarks-evalite/prompts/prompt-2025-01-28T12-59-44-873Z.txt
@@ -0,0 +1,1245 @@
+You are an expert in electronic circuit design and tscircuit, and your job is to create a circuit board in tscircuit with the user-provided description.
+
+YOU MUST ABIDE BY THE RULES IN THE RULES SECTION
+
+## tscircuit API overview
+
+Here's an overview of the tscircuit API:
+
+ // usually the root component
+ // custom shape instead of rectangle
+
+
+
+
+
+
+
+
+
+
+
+
+
+### footprint strings
+
+Footprint strings are a compact way to represent the physical footprint for a
+component. Any component can be given a footprint string. Here are example
+footprint strings:
+
+0402
+0603
+0805
+1206
+1210
+cap0402
+res0402
+soic8_p1.27mm
+dip16
+pinrow10
+tssop20_p0.5mm
+sot23
+
+### All available footprints
+
+- Either use a passive footprint like this (e.g. 0402, 0603, 0805, 1206, 1210), here is a json string with all available footprint passive sizes:
+
+["01005","0201","0402","0603","0805","1206","1210","2010","2512"]
+
+- Or create a footprint string like this (e.g. dfn8_w5.3mm_p1.27mm, dip10_w4.00mm_p2.65mm, lqfp64_w10_h10_pl1_pw0.25mm, sot363, stampreceiver_left20_right20_bottom3_top2_w21mm_p2.54mm, tssop20_w6.5mm_p0.65mm, bga7_w8_h8_grid3x3_p1_missing(center,B1), bga64_w10_h10_grid8x8_p1.27mm), here are json objects with the available footprints and their options:
+
+{"fn":"axial","p":2.54,"id":0.7,"od":1}
+{"fn":"bga","num_pins":64,"p":0.8,"missing":[],"grid":{"x":8,"y":8},"origin":"tl"}
+{"fn":"breakoutheaders","w":10,"left":20,"right":20,"top":0,"bottom":0,"p":2.54,"id":1,"od":1.5}
+{"fn":"dfn","num_pins":8,"w":5.3,"p":1.27,"legsoutside":false,"pw":0.6,"pl":1}
+{"fn":"dip","num_pins":6,"p":2.54,"id":1,"od":1.5,"w":7.62}
+{"fn":"lqfp","num_pins":64,"p":0.5,"legsoutside":true,"w":10,"h":10,"pw":0.25,"pl":0.25}
+{"fn":"mlp","num_pins":64,"p":0.5,"thermalpad":true,"legsoutside":false,"w":10,"h":10,"pw":0.25,"pl":0.25}
+{"fn":"ms012","num_pins":8,"w":3.9,"p":1.27,"legsoutside":true,"pw":0.6,"pl":1}
+{"fn":"ms013","num_pins":16,"w":7.5,"p":1.27,"legsoutside":true,"pw":0.6,"pl":1}
+{"fn":"pinrow","num_pins":6,"p":2.54,"id":1,"od":1.5}
+{"fn":"pushbutton","w":4.5,"h":6.5,"id":1,"od":1.2}
+{"fn":"qfn","num_pins":64,"p":0.5,"legsoutside":false,"w":10,"h":10,"pw":0.25,"pl":0.25}
+{"fn":"qfp","num_pins":64,"p":0.5,"pw":0.25,"pl":1,"legsoutside":true,"w":10,"h":10}
+{"fn":"quad","num_pins":64,"p":0.5,"legsoutside":false,"w":10,"h":10,"pw":0.25,"pl":0.25}
+{"fn":"sod123","num_pins":2,"w":"2.36mm","h":"1.22mm","pl":"0.9mm","pw":"0.9mm","pad_spacing":"4.19mm"}
+{"fn":"soic","num_pins":8,"w":5.3,"p":1.27,"legsoutside":false,"pw":0.6,"pl":1}
+{"fn":"sot23","num_pins":3,"w":"1.92mm","h":"2.74mm","pl":"0.8mm","pw":"0.764mm"}
+{"fn":"sot235","num_pins":5,"h":"1.6mm","pl":"1mm","pw":"0.7mm","p":"0.95mm"}
+{"fn":"sot236","num_pins":6,"w":1.6,"p":0.95,"legsoutside":true,"pw":0.6,"pl":1}
+{"fn":"sot363","num_pins":6,"w":1.94,"p":0.65,"pw":0.3,"pl":0.7,"legsoutside":false}
+{"fn":"sot563","num_pins":6,"w":1.94,"p":0.5,"pw":0.3,"pl":0.67,"legsoutside":false}
+{"fn":"sot723","num_pins":3,"w":"1.2mm","h":"1.2mm","pl":"0.3mm","pw":"0.32mm"}
+{"fn":"ssop","num_pins":8,"w":3.9,"p":1.27,"legsoutside":false,"pw":0.6,"pl":1}
+{"fn":"stampboard","w":22.58,"left":20,"right":20,"top":2,"bottom":2,"p":2.54,"pw":1.6,"pl":2.4,"innerhole":false,"innerholeedgedistance":1.61}
+{"fn":"stampreceiver","w":22.58,"left":20,"right":20,"top":2,"bottom":2,"p":2.54,"pw":1.6,"pl":3.2,"innerhole":false,"innerholeedgedistance":1.61}
+{"fn":"tssop","num_pins":8,"w":6.1,"p":0.65,"legsoutside":true,"pw":0.6,"pl":1}
+
+
+- Here is a list of unsupported footprints:
+
+1- hc
+
+keep in mind that num_pins can be replaced with a number directly infront of the footprint name like so: dip8_p1.27mm which means num_pins=8, don't do that for footprints with fixed number of pins like ms012 and sot723
+
+### Components and Props
+
+- Here is a documentation of all available components and their types:
+
+
+
+```typescript
+export const rotationPoint3 = z.object({
+ x: z.union([z.number(), z.string()]),
+ y: z.union([z.number(), z.string()]),
+ z: z.union([z.number(), z.string()]),
+})
+export interface CadModelBase {
+ rotationOffset?:
+ | number
+ | { x: number | string; y: number | string; z: number | string }
+ positionOffset?: {
+ x: number | string
+ y: number | string
+ z: number | string
+ }
+ size?: { x: number | string; y: number | string; z: number | string }
+}
+export const cadModelBase = z.object({
+ rotationOffset: z.number().or(rotationPoint3).optional(),
+ positionOffset: point3.optional(),
+ size: point3.optional(),
+})
+export interface CadModelStl extends CadModelBase {
+ stlUrl: string
+}
+export const cadModelStl = cadModelBase.extend({
+ stlUrl: z.string(),
+})
+export interface CadModelObj extends CadModelBase {
+ objUrl: string
+ mtlUrl?: string
+}
+export const cadModelObj = cadModelBase.extend({
+ objUrl: z.string(),
+ mtlUrl: z.string().optional(),
+})
+export interface CadModelJscad extends CadModelBase {
+ jscad: Record
+}
+export const cadModelJscad = cadModelBase.extend({
+ jscad: z.record(z.any()),
+})
+```
+
+```typescript
+export type Distance = number | string
+
+export { distance, length } from "circuit-json"
+```
+
+```typescript
+/**
+ * This is an abbreviated definition of the soup elements that you can find here:
+ * https://docs.tscircuit.com/api-reference/advanced/soup#pcb-smtpad
+ */
+export type FootprintSoupElements = {
+ type: "pcb_smtpad" | "pcb_plated_hole"
+ x: string | number
+ y: string | number
+ layer?: LayerRef
+ holeDiameter?: string | number
+ outerDiameter?: string | number
+ shape?: "circle" | "rect"
+ width?: string | number
+ height?: string | number
+ portHints?: string[]
+}
+```
+
+```typescript
+export interface PcbLayoutProps {
+ pcbX?: string | number
+ pcbY?: string | number
+ pcbRotation?: string | number
+ layer?: LayerRefInput
+}
+export interface CommonLayoutProps {
+ pcbX?: string | number
+ pcbY?: string | number
+ pcbRotation?: string | number
+
+ schX?: string | number
+ schY?: string | number
+ schRotation?: string | number
+
+ layer?: LayerRefInput
+ footprint?: Footprint
+}
+export const pcbLayoutProps = z.object({
+ pcbX: distance.optional(),
+ pcbY: distance.optional(),
+ pcbRotation: rotation.optional(),
+ layer: layer_ref.optional(),
+})
+export const commonLayoutProps = z.object({
+ pcbX: distance.optional(),
+ pcbY: distance.optional(),
+ pcbRotation: rotation.optional(),
+ schX: distance.optional(),
+ schY: distance.optional(),
+ schRotation: rotation.optional(),
+ layer: layer_ref.optional(),
+ footprint: footprintProp.optional(),
+})
+export interface SupplierProps {
+ supplierPartNumbers?: SupplierPartNumbers
+}
+export const supplierProps = z.object({
+ supplierPartNumbers: z.record(supplier_name, z.array(z.string())).optional(),
+})
+export interface CommonComponentProps extends CommonLayoutProps {
+ key?: any
+ name: string
+ supplierPartNumbers?: SupplierPartNumbers
+ cadModel?: CadModelProp
+ children?: any
+ symbolName?: string
+}
+export const commonComponentProps = commonLayoutProps
+ .merge(supplierProps)
+ .extend({
+ key: z.any().optional(),
+ name: z.string(),
+ cadModel: cadModelProp.optional(),
+ children: z.any().optional(),
+ symbolName: z.string().optional(),
+ })
+export const lrPolarPins = [
+ "pin1",
+ "left",
+ "anode",
+ "pos",
+ "pin2",
+ "right",
+ "cathode",
+ "neg",
+] as const
+```
+
+```typescript
+export const point = z.object({
+ x: distance,
+ y: distance,
+})
+```
+
+```typescript
+export const point3 = z.object({
+ x: distance,
+ y: distance,
+ z: distance,
+})
+```
+
+```typescript
+/**
+ * @deprecated Use SchematicPortArrangementWithPinCounts instead.
+ */
+export interface SchematicPortArrangementWithSizes {
+ leftSize?: number
+ topSize?: number
+ rightSize?: number
+ bottomSize?: number
+}
+/**
+ * Specifies the number of pins on each side of the schematic box component.
+ */
+export interface SchematicPortArrangementWithPinCounts {
+ leftPinCount?: number
+ topPinCount?: number
+ rightPinCount?: number
+ bottomPinCount?: number
+}
+export interface PinSideDefinition {
+ pins: Array
+ direction:
+ | "top-to-bottom"
+ | "left-to-right"
+ | "bottom-to-top"
+ | "right-to-left"
+}
+export interface SchematicPortArrangementWithSides {
+ leftSide?: PinSideDefinition
+ topSide?: PinSideDefinition
+ rightSide?: PinSideDefinition
+ bottomSide?: PinSideDefinition
+}
+export interface SchematicPortArrangement
+ extends SchematicPortArrangementWithSizes,
+ SchematicPortArrangementWithSides,
+ SchematicPortArrangementWithPinCounts {}
+export const explicitPinSideDefinition = z.object({
+ pins: z.array(z.union([z.number(), z.string()])),
+ direction: z.union([
+ z.literal("top-to-bottom"),
+ z.literal("left-to-right"),
+ z.literal("bottom-to-top"),
+ z.literal("right-to-left"),
+ ]),
+})
+export const schematicPortArrangement = z.object({
+ leftSize: z.number().optional().describe("@deprecated, use leftPinCount"),
+ topSize: z.number().optional().describe("@deprecated, use topPinCount"),
+ rightSize: z.number().optional().describe("@deprecated, use rightPinCount"),
+ bottomSize: z.number().optional().describe("@deprecated, use bottomPinCount"),
+ leftPinCount: z.number().optional(),
+ rightPinCount: z.number().optional(),
+ topPinCount: z.number().optional(),
+ bottomPinCount: z.number().optional(),
+ leftSide: explicitPinSideDefinition.optional(),
+ rightSide: explicitPinSideDefinition.optional(),
+ topSide: explicitPinSideDefinition.optional(),
+ bottomSide: explicitPinSideDefinition.optional(),
+})
+```
+
+```typescript
+export type SchematicPinStyle = Record<
+ string,
+ {
+ leftMargin?: number | string
+ rightMargin?: number | string
+ topMargin?: number | string
+ bottomMargin?: number | string
+ }
+export const schematicPinStyle = z.record(
+ z.object({
+ leftMargin: distance.optional(),
+ rightMargin: distance.optional(),
+ topMargin: distance.optional(),
+ bottomMargin: distance.optional(),
+ }),
+```
+
+```typescript
+/** @deprecated use battery_capacity from circuit-json when circuit-json is updated */
+export interface BatteryProps extends CommonComponentProps {
+ capacity?: number | string
+}
+export const batteryProps = commonComponentProps.extend({
+ capacity: capacity.optional(),
+})
+```
+
+```typescript
+export interface BoardProps extends Omit {
+ width?: number | string
+ height?: number | string
+ outline?: Point[]
+ outlineOffsetX?: number | string
+ outlineOffsetY?: number | string
+}
+export const boardProps = subcircuitGroupProps.extend({
+ width: distance.optional(),
+ height: distance.optional(),
+ outline: z.array(point).optional(),
+ outlineOffsetX: distance.optional(),
+ outlineOffsetY: distance.optional(),
+})
+```
+
+```typescript
+export interface CapacitorProps extends CommonComponentProps {
+ capacitance: number | string
+ polarized?: boolean
+ decouplingFor?: string
+ decouplingTo?: string
+ bypassFor?: string
+ bypassTo?: string
+ maxDecouplingTraceLength?: number
+}
+export const capacitorProps = commonComponentProps.extend({
+ capacitance,
+ polarized: z.boolean().optional().default(false),
+ decouplingFor: z.string().optional(),
+ decouplingTo: z.string().optional(),
+ bypassFor: z.string().optional(),
+ bypassTo: z.string().optional(),
+ maxDecouplingTraceLength: z.number().optional(),
+})
+```
+
+```typescript
+export interface ChipProps extends CommonComponentProps {
+ manufacturerPartNumber?: string
+ pinLabels?: Record
+ schPortArrangement?: SchematicPortArrangement
+ schPinStyle?: SchematicPinStyle
+ schPinSpacing?: Distance
+ schWidth?: Distance
+ schHeight?: Distance
+ noSchematicRepresentation?: boolean
+}
+export const chipProps = commonComponentProps.extend({
+ manufacturerPartNumber: z.string().optional(),
+ pinLabels: z
+ .record(
+ z.number().or(z.string()),
+ z.string().or(z.array(z.string()).readonly()),
+ )
+ .optional(),
+ schPortArrangement: schematicPortArrangement.optional(),
+ schPinStyle: schematicPinStyle.optional(),
+ schPinSpacing: distance.optional(),
+ schWidth: distance.optional(),
+ schHeight: distance.optional(),
+ noSchematicRepresentation: z.boolean().optional(),
+})
+```
+
+```typescript
+export interface ConstrainedLayoutProps {
+ name?: string
+ pcbOnly?: boolean
+ schOnly?: boolean
+}
+export const constrainedLayoutProps = z.object({
+ name: z.string().optional(),
+ pcbOnly: z.boolean().optional(),
+ schOnly: z.boolean().optional(),
+})
+```
+
+```typescript
+export type PcbXDistConstraint = {
+ pcb?: true
+ xDist: Distance
+
+ left: string
+
+ right: string
+
+ edgeToEdge?: true
+
+ centerToCenter?: true
+}
+/**
+ * If true, the provided distance is the distance between the centers of the
+ * left and right components
+ */
+export type PcbYDistConstraint = {
+ pcb?: true
+ yDist: Distance
+
+ top: string
+
+ bottom: string
+
+ edgeToEdge?: true
+ centerToCenter?: true
+}
+/**
+ * Selector for bottom component, e.g. ".U1" or ".R1", you can also specify the
+ * edge or center of the component e.g. ".R1 bottomedge", ".R1 center"
+ */
+export type PcbSameYConstraint = {
+ pcb?: true
+ sameY?: true
+
+ for: string[]
+}
+/**
+ * Selector for components, e.g. [".U1", ".R1"], you can also specify the
+ * edge or center of the component e.g. [".R1 leftedge", ".U1 center"]
+ */
+export type PcbSameXConstraint = {
+ pcb?: true
+ sameX?: true
+ for: string[]
+}
+export const pcbXDistConstraintProps = z.object({
+ pcb: z.literal(true).optional(),
+ xDist: distance,
+ left: z.string(),
+ right: z.string(),
+
+ edgeToEdge: z.literal(true).optional(),
+ centerToCenter: z.literal(true).optional(),
+})
+export const pcbYDistConstraintProps = z.object({
+ pcb: z.literal(true).optional(),
+ yDist: distance,
+ top: z.string(),
+ bottom: z.string(),
+
+ edgeToEdge: z.literal(true).optional(),
+ centerToCenter: z.literal(true).optional(),
+})
+export const pcbSameYConstraintProps = z.object({
+ pcb: z.literal(true).optional(),
+ sameY: z.literal(true).optional(),
+ for: z.array(z.string()),
+})
+export const pcbSameXConstraintProps = z.object({
+ pcb: z.literal(true).optional(),
+ sameX: z.literal(true).optional(),
+ for: z.array(z.string()),
+})
+```
+
+```typescript
+export interface CrystalProps extends CommonComponentProps {
+ frequency: number | string
+ loadCapacitance: number | string
+ pinVariant?: PinVariant
+}
+export const crystalProps = commonComponentProps.extend({
+ frequency: frequency,
+ loadCapacitance: capacitance,
+ pinVariant: z.enum(["2pin", "4pin"]).optional(),
+})
+```
+
+```typescript
+export const fabricationNotePathProps = pcbLayoutProps
+ .omit({ pcbX: true, pcbY: true, pcbRotation: true })
+```
+
+```typescript
+export const fabricationNoteTextProps = pcbLayoutProps.extend({
+ text: z.string(),
+ anchorAlignment: z
+ .enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"])
+ .default("center"),
+ font: z.enum(["tscircuit2024"]).optional(),
+ fontSize: length.optional(),
+ color: z.string().optional(),
+})
+```
+
+```typescript
+export interface FootprintProps {
+ originalLayer?: LayerRef
+}
+/**
+ * The layer that the footprint is designed for. If you set this to "top"
+ * then it means the children were intended to represent the top layer. If
+ * the with this footprint is moved to the bottom layer, then the
+ * components will be mirrored.
+ *
+ * Generally, you shouldn't set this except where it can help prevent
+ * confusion because you have a complex multi-layer footprint. Default is
+ * "top" and this is most intuitive.
+ */
+export const footprintProps = z.object({
+ originalLayer: layer_ref.default("top").optional(),
+})
+```
+
+```typescript
+export interface BaseGroupProps extends CommonLayoutProps {
+ name?: string
+ key?: any
+ children?: any
+}
+export type PartsEngine = {
+ findPart: (params: {
+ sourceComponent: AnySourceComponent
+ footprinterString?: string
+ }) => Promise | SupplierPartNumbers
+}
+export interface PcbRouteCache {
+ pcbTraces: PcbTrace[]
+ cacheKey: string
+}
+export interface AutorouterConfig {
+ serverUrl?: string
+ inputFormat?: "simplified" | "circuit-json"
+ serverMode?: "job" | "solve-endpoint"
+ cache?: PcbRouteCache
+}
+export const autorouterConfig = z.object({
+ serverUrl: z.string().optional(),
+ inputFormat: z.enum(["simplified", "circuit-json"]).optional(),
+ serverMode: z.enum(["job", "solve-endpoint"]).optional(),
+ cache: z.custom((v) => true).optional(),
+})
+export interface SubcircuitGroupProps extends BaseGroupProps {
+ layout?: LayoutBuilder
+ manualEdits?: ManualEditsFileInput
+ routingDisabled?: boolean
+ defaultTraceWidth?: Distance
+ minTraceWidth?: Distance
+ pcbRouteCache?: PcbRouteCache
+
+ autorouter?: AutorouterProp
+
+ schAutoLayoutEnabled?: boolean
+
+ schTraceAutoLabelEnabled?: boolean
+
+ partsEngine?: PartsEngine
+}
+/**
+ * If true, net labels will automatically be created for complex traces
+ */
+export interface SubcircuitGroupPropsWithBool extends SubcircuitGroupProps {
+ subcircuit: true
+}
+export interface NonSubcircuitGroupProps extends BaseGroupProps {
+ subcircuit?: false | undefined
+}
+export const baseGroupProps = commonLayoutProps.extend({
+ name: z.string().optional(),
+ children: z.any().optional(),
+ key: z.any().optional(),
+})
+export const subcircuitGroupProps = baseGroupProps.extend({
+ layout: z.custom((v) => true).optional(),
+ manualEdits: manual_edits_file.optional(),
+ schAutoLayoutEnabled: z.boolean().optional(),
+ schTraceAutoLabelEnabled: z.boolean().optional(),
+ routingDisabled: z.boolean().optional(),
+ defaultTraceWidth: length.optional(),
+ minTraceWidth: length.optional(),
+ partsEngine: z.custom((v) => "findPart" in v).optional(),
+ pcbRouteCache: z.custom((v) => true).optional(),
+ autorouter: autorouterProp.optional(),
+})
+export const subcircuitGroupPropsWithBool = subcircuitGroupProps.extend({
+ subcircuit: z.literal(true),
+})
+export const groupProps = z.discriminatedUnion("subcircuit", [
+ baseGroupProps.extend({ subcircuit: z.literal(false).optional() }),
+```
+
+```typescript
+export interface HoleProps extends Omit {
+ name?: string
+ diameter?: Distance
+ radius?: Distance
+}
+export const holeProps = pcbLayoutProps
+ .omit({ pcbRotation: true })
+```
+
+```typescript
+export const inductorProps = commonComponentProps.extend({
+ inductance,
+})
+```
+
+```typescript
+export interface JumperProps extends CommonComponentProps {
+ manufacturerPartNumber?: string
+ pinLabels?: Record
+ schPinStyle?: SchematicPinStyle
+ schPinSpacing?: number | string
+ schWidth?: number | string
+ schHeight?: number | string
+ schDirection?: "left" | "right"
+ schPortArrangement?: SchematicPortArrangement
+}
+export const jumperProps = commonComponentProps.extend({
+ manufacturerPartNumber: z.string().optional(),
+ pinLabels: z
+ .record(z.number().or(z.string()), z.string().or(z.array(z.string())))
+ .optional(),
+ schPinStyle: schematicPinStyle.optional(),
+ schPinSpacing: distance.optional(),
+ schWidth: distance.optional(),
+ schHeight: distance.optional(),
+ schDirection: z.enum(["left", "right"]).optional(),
+ schPortArrangement: schematicPortArrangement.optional(),
+})
+```
+
+```typescript
+export const ledProps = commonComponentProps.extend({
+ color: z.string().optional(),
+})
+```
+
+```typescript
+export interface MosfetProps extends CommonComponentProps {
+ channelType: "n" | "p"
+ mosfetMode: "enhancement" | "depletion"
+}
+export const mosfetProps = commonComponentProps.extend({
+ channelType: z.enum(["n", "p"]),
+ mosfetMode: z.enum(["enhancement", "depletion"]),
+})
+export const mosfetPins = [
+ "pin1",
+ "drain",
+ "pin2",
+ "source",
+ "pin3",
+ "gate",
+] as const
+```
+
+```typescript
+export interface NetProps {
+ name: string
+}
+export const netProps = z.object({
+ name: z.string(),
+})
+```
+
+```typescript
+export interface NetAliasProps {
+ net?: string
+ schX?: number | string
+ schY?: number | string
+ schRotation?: number | string
+ anchorSide?: "left" | "up" | "right" | "down"
+}
+export const netAliasProps = z.object({
+ net: z.string().optional(),
+ schX: distance.optional(),
+ schY: distance.optional(),
+ schRotation: rotation.optional(),
+ anchorSide: z.enum(["left", "up", "right", "down"]).optional(),
+})
+```
+
+```typescript
+export const pcbKeepoutProps = z.union([
+ pcbLayoutProps.omit({ pcbRotation: true }).extend({
+ shape: z.literal("circle"),
+ radius: distance,
+ }),
+```
+
+```typescript
+export const pcbTraceProps = z.object({
+ layer: z.string().optional(),
+ thickness: distance.optional(),
+ route: z.array(route_hint_point),
+})
+```
+
+```typescript
+export interface PinHeaderProps extends CommonComponentProps {
+ pinCount: number
+
+ pitch?: number | string
+
+ gender?: "male" | "female"
+
+ showSilkscreenPinLabels?: boolean
+
+ doubleRow?: boolean
+
+ holeDiameter?: number | string
+
+ platedDiameter?: number | string
+
+ pinLabels?: string[]
+
+ facingDirection?: "left" | "right"
+}
+/**
+ * Direction the header is facing
+ */
+export const pinHeaderProps = commonComponentProps.extend({
+ pinCount: z.number(),
+ pitch: distance.optional(),
+ gender: z.enum(["male", "female"]).optional().default("male"),
+ showSilkscreenPinLabels: z.boolean().optional(),
+ doubleRow: z.boolean().optional(),
+ holeDiameter: distance.optional(),
+ platedDiameter: distance.optional(),
+ pinLabels: z.array(z.string()).optional(),
+ facingDirection: z.enum(["left", "right"]).optional(),
+})
+```
+
+```typescript
+export interface CirclePlatedHoleProps
+ extends Omit {
+ name?: string
+ shape: "circle"
+ holeDiameter: number | string
+ outerDiameter: number | string
+ portHints?: PortHints
+}
+export interface OvalPlatedHoleProps
+ extends Omit {
+ name?: string
+ shape: "oval"
+ outerWidth: number | string
+ outerHeight: number | string
+ innerWidth: number | string
+ innerHeight: number | string
+ portHints?: PortHints
+}
+export interface PillPlatedHoleProps
+ extends Omit {
+ name?: string
+ shape: "pill"
+ outerWidth: number | string
+ outerHeight: number | string
+ innerWidth: number | string
+ innerHeight: number | string
+ portHints?: PortHints
+}
+export const platedHoleProps = z.discriminatedUnion("shape", [
+ pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
+ name: z.string().optional(),
+ shape: z.literal("circle"),
+ holeDiameter: distance,
+ outerDiameter: distance,
+ portHints: portHints.optional(),
+ }),
+```
+
+```typescript
+export const portProps = commonLayoutProps.extend({
+ name: z.string(),
+ pinNumber: z.number().optional(),
+ aliases: z.array(z.string()).optional(),
+ direction: direction,
+})
+```
+
+```typescript
+export interface PotentiometerProps extends CommonComponentProps {
+ maxResistance: number | string
+}
+export const potentiometerProps = commonComponentProps.extend({
+ maxResistance: resistance,
+})
+```
+
+```typescript
+export const powerSourceProps = commonComponentProps.extend({
+ voltage,
+})
+```
+
+```typescript
+export interface ResistorProps extends CommonComponentProps {
+ resistance: number | string
+ pullupFor?: string
+ pullupTo?: string
+ pulldownFor?: string
+ pulldownTo?: string
+}
+export const resistorProps = commonComponentProps.extend({
+ resistance,
+
+ pullupFor: z.string().optional(),
+ pullupTo: z.string().optional(),
+
+ pulldownFor: z.string().optional(),
+ pulldownTo: z.string().optional(),
+})
+```
+
+```typescript
+export interface ResonatorProps extends CommonComponentProps {
+ frequency: number | string
+ loadCapacitance: number | string
+ pinVariant?: ResonatorPinVariant
+}
+export const resonatorProps = commonComponentProps.extend({
+ frequency: frequency,
+ loadCapacitance: capacitance,
+ pinVariant: z.enum(["no_ground", "ground_pin", "two_ground_pins"]).optional(),
+})
+```
+
+```typescript
+export const schematicBoxProps = z.object({
+ schX: distance,
+ schY: distance,
+ width: distance,
+ height: distance,
+})
+```
+
+```typescript
+export const schematicLineProps = z.object({
+ x1: distance,
+ y1: distance,
+ x2: distance,
+ y2: distance,
+})
+```
+
+```typescript
+export const schematicPathProps = z.object({
+ points: z.array(point),
+ isFilled: z.boolean().optional().default(false),
+ fillColor: z.enum(["red", "blue"]).optional(),
+})
+```
+
+```typescript
+export const schematicTextProps = z.object({
+ schX: distance,
+ schY: distance,
+ text: z.string(),
+})
+```
+
+```typescript
+export const silkscreenCircleProps = pcbLayoutProps
+ .omit({ pcbRotation: true })
+```
+
+```typescript
+export const silkscreenLineProps = pcbLayoutProps
+ .omit({ pcbX: true, pcbY: true, pcbRotation: true })
+```
+
+```typescript
+export const silkscreenPathProps = pcbLayoutProps
+ .omit({ pcbX: true, pcbY: true, pcbRotation: true })
+```
+
+```typescript
+export const silkscreenRectProps = pcbLayoutProps
+ .omit({ pcbRotation: true })
+```
+
+```typescript
+export const silkscreenTextProps = pcbLayoutProps.extend({
+ text: z.string(),
+ anchorAlignment: z
+ .enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"])
+ .default("center"),
+ font: z.enum(["tscircuit2024"]).optional(),
+ fontSize: length.optional(),
+})
+```
+
+```typescript
+export interface RectSmtPadProps extends Omit {
+ shape: "rect"
+ width: Distance
+ height: Distance
+ portHints?: PortHints
+}
+export interface RotatedRectSmtPadProps
+ extends Omit {
+ shape: "rotated_rect"
+ width: Distance
+ height: Distance
+ ccwRotation: number
+ portHints?: PortHints
+}
+export interface CircleSmtPadProps extends Omit {
+ shape: "circle"
+ radius: Distance
+ portHints?: PortHints
+}
+export const rectSmtPadProps = pcbLayoutProps
+ .omit({ pcbRotation: true })
+export const rotatedRectSmtPadProps = pcbLayoutProps
+ .omit({ pcbRotation: true })
+export const circleSmtPadProps = pcbLayoutProps
+ .omit({ pcbRotation: true })
+```
+
+```typescript
+export interface RectSolderPasteProps
+ extends Omit {
+ shape: "rect"
+ width: Distance
+ height: Distance
+}
+export interface CircleSolderPasteProps
+ extends Omit {
+ shape: "circle"
+ radius: Distance
+}
+export const rectSolderPasteProps = pcbLayoutProps
+ .omit({ pcbRotation: true })
+export const circleSolderPasteProps = pcbLayoutProps
+ .omit({ pcbRotation: true })
+```
+
+```typescript
+export const switchProps = commonComponentProps.extend({
+ ftype: z.literal("switch"),
+ switchType: z.enum(["spst"]).default("spst"),
+ isNormallyClosed: z.boolean().default(false),
+})
+```
+
+```typescript
+export const routeHintPointProps = z.object({
+ x: distance,
+ y: distance,
+ via: z.boolean().optional(),
+ toLayer: layer_ref.optional(),
+})
+export const traceHintProps = z.object({
+ for: z
+ .string()
+ .optional()
+ .describe(
+ "Selector for the port you're targeting, not required if you're inside a trace",
+ ),
+ order: z.number().optional(),
+ offset: route_hint_point.or(routeHintPointProps).optional(),
+ offsets: z
+ .array(route_hint_point)
+ .or(z.array(routeHintPointProps))
+ .optional(),
+ traceWidth: z.number().optional(),
+})
+```
+
+```typescript
+export const portRef = z.union([
+ z.string(),
+ z.custom<{ getPortSelector: () => string }>((v) =>
+export const traceProps = z.union([
+ baseTraceProps.extend({
+ path: z.array(portRef),
+ }),
+```
+
+```typescript
+export interface TransistorProps extends CommonComponentProps {
+ transistorType: "npn" | "pnp"
+}
+export const transistorProps = commonComponentProps.extend({
+ transistorType: z.enum(["npn", "pnp"]),
+})
+export const transistorPins = [
+ "pin1",
+ "emitter",
+ "pin2",
+ "collector",
+ "pin3",
+ "base",
+] as const
+```
+
+```typescript
+export const viaProps = commonLayoutProps.extend({
+ fromLayer: layer_ref,
+ toLayer: layer_ref,
+ holeDiameter: distance,
+ outerDiameter: distance,
+})
+```
+
+
+
+- Here is a list of unsupported components:
+
+1- powerSource
+2- powerSourceSimple
+3- pinHeader
+
+- Here are examples of how you can take advantage of those props:
+
+ // Example of a custom chip footprint definition
+ const CustomChipFootprint = () => (
+
+ // SMT pads for the chip
+
+
+
+
+
+ // Silkscreen markings for the chip outline
+
+ // Pin 1 indicator
+
+
+ )
+
+ // Example of a custom resistor footprint
+ const Resistor0603Footprint = () => (
+
+
+
+
+
+ )
+
+ // Example of a complete circuit
+ export const MyCircuit = () => (
+
+ // Power section group
+
+ // Decoupling capacitor arrangement
+
+
+
+
+
+ // Input protection group
+
+
+
+
+
+
+ // Power nets
+
+
+
+ // Connections
+
+
+
+ // Layout constraints
+
+
+ )
+
+ // Example of a custom module/component that can be reused
+ export const DecouplingCapacitor = ({
+ chipRef,
+ capName,
+ capValue = "100nF",
+ distance = "2mm"
+ }) => (
+
+
+
+
+ )
+
+ // Usage of the custom module
+ export const CircuitWithDecoupling = () => (
+
+
+
+
+ )
+
+
+### RULES
+
+- Component names must be in camel case
+- Never use components in the "Unsupported components" list
+- Never use footprints in the "Unsupported footprints" list
+- Any component may have a pcbX and/or a pcbY representing the center of the
+ component on a circuit board.
+- Never use footprints that are not supported in the "All available footprints" section
+- Some footprints have a fixed number of pins like ms012 and sot723
+- `` components use CSS selectors in the `from` and `to` fields
+ to connect components.
+- Any component can have a `name` prop
+- `pcbX` and `pcbY` are optional and default to 0.
+- A board is centered on the origin (pcbX=0, pcbY=0), so to place a component
+ at the center it must be placed at pcbX=0,pcbY=0. Similarly, if you're trying
+ to layout components around the center, you would make ones to the left of
+ the center have negative pcbX values, below the center have negative pcbY,
+ and to the right of the center have positive pcbX values, and above the
+ center have positive pcbY values.
+- Every component that is going to be placed must be given a footprint
+- Traces can only take two ports
+- Don't use path as prop for trace, only use from, to
+- We don't support defining output ports, so don't defined port components
+- Don't specify autorouter; don't use the autorouter prop
+- Selectors for component pins must be of this format: ".U1 > .pin1" or ".U1 > .pin2" where U1 is the component name, and the pins must be numbers, so don't use names for pins but use pin1, pin2, pin3, pin4
+- And instead of ".T1 > .base" you do do ".T1 > .pin2"
+
+### Trace Reference Syntax
+
+Traces are created using the `` component. The `from` and `to`
+fields are CSS selectors that reference the components to connect.
+
+Examples:
+
+
+
+
+
+### Output
+
+Use a codefence with the language "tsx" to wrap the code. You can use the
+current_code of the user as a starting point (if provided).
+
+You must export a higher-order component where the root component is ``
+inside the codefence. For example:
+
+```tsx
+export const MyLed = () => (
+
+
+
+
+
+)
+```
\ No newline at end of file