From bd1d1b6288f17c104ef656342e9ba3e1df7a4de3 Mon Sep 17 00:00:00 2001 From: seveibar Date: Tue, 28 Jul 2026 08:22:01 -0700 Subject: [PATCH] feat: default breakout autorouter to fanout --- README.md | 5 +++++ generated/COMPONENT_TYPES.md | 6 ++++++ lib/components/breakout.ts | 13 ++++++++++++- tests/breakout.test.ts | 7 +++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b8d4e60a..351860f1 100644 --- a/README.md +++ b/README.md @@ -412,6 +412,11 @@ export interface BreakoutProps extends Omit< SubcircuitGroupProps, "subcircuit" > { + /** + * Autorouter used to escape the components inside the breakout boundary. + * Defaults to the multilayer fanout autorouter. + */ + autorouter?: AutorouterProp; padding?: Distance; paddingLeft?: Distance; paddingRight?: Distance; diff --git a/generated/COMPONENT_TYPES.md b/generated/COMPONENT_TYPES.md index 80e94180..a792aa4b 100644 --- a/generated/COMPONENT_TYPES.md +++ b/generated/COMPONENT_TYPES.md @@ -1257,13 +1257,19 @@ export const boardProps = subcircuitGroupProps ```typescript export interface BreakoutProps extends Omit { + autorouter?: AutorouterProp padding?: Distance paddingLeft?: Distance paddingRight?: Distance paddingTop?: Distance paddingBottom?: Distance } +/** + * Autorouter used to escape the components inside the breakout boundary. + * Defaults to the multilayer fanout autorouter. + */ export const breakoutProps = subcircuitGroupProps.extend({ + autorouter: autorouterProp.default("fanout"), padding: distance.optional(), paddingLeft: distance.optional(), paddingRight: distance.optional(), diff --git a/lib/components/breakout.ts b/lib/components/breakout.ts index e58ec049..30652f57 100644 --- a/lib/components/breakout.ts +++ b/lib/components/breakout.ts @@ -2,10 +2,20 @@ import { distance } from "circuit-json" import type { Distance } from "lib/common/distance" import { expectTypesMatch } from "lib/typecheck" import { z } from "zod" -import { subcircuitGroupProps, type SubcircuitGroupProps } from "./group" +import { + autorouterProp, + subcircuitGroupProps, + type AutorouterProp, + type SubcircuitGroupProps, +} from "./group" export interface BreakoutProps extends Omit { + /** + * Autorouter used to escape the components inside the breakout boundary. + * Defaults to the multilayer fanout autorouter. + */ + autorouter?: AutorouterProp padding?: Distance paddingLeft?: Distance paddingRight?: Distance @@ -14,6 +24,7 @@ export interface BreakoutProps } export const breakoutProps = subcircuitGroupProps.extend({ + autorouter: autorouterProp.default("fanout"), padding: distance.optional(), paddingLeft: distance.optional(), paddingRight: distance.optional(), diff --git a/tests/breakout.test.ts b/tests/breakout.test.ts index 86bf547e..925a02eb 100644 --- a/tests/breakout.test.ts +++ b/tests/breakout.test.ts @@ -17,6 +17,13 @@ test("should parse breakout props with padding", () => { expect(parsed.paddingLeft).toBe(2) }) +test("breakout and fanout elements default to the fanout autorouter", () => { + expect(breakoutProps.parse({}).autorouter).toBe("fanout") + expect( + breakoutProps.parse({ autorouter: "single_layer_fanout" }).autorouter, + ).toBe("single_layer_fanout") +}) + test("should parse breakout point props", () => { const raw: BreakoutPointProps = { pcbX: 5,