From 554fabcc8e106d8e62395489145204eb129b280f Mon Sep 17 00:00:00 2001 From: Jayant Pranjal Date: Sun, 5 Oct 2025 18:44:53 +0530 Subject: [PATCH 1/9] feat: added board title --- lib/components/normal-components/Board.ts | 2 ++ .../board-auto-size.test.tsx | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/lib/components/normal-components/Board.ts b/lib/components/normal-components/Board.ts index 84c2b0e02..7a7eb5e1a 100644 --- a/lib/components/normal-components/Board.ts +++ b/lib/components/normal-components/Board.ts @@ -227,6 +227,8 @@ export class Board extends Group { if (!pcbBoard) return const boardInformation: string[] = [] + if ((this.props as any).title) + boardInformation.push((this.props as any).title) if (platform.projectName) boardInformation.push(platform.projectName) if (platform.version) boardInformation.push(`v${platform.version}`) if (platform.url) boardInformation.push(platform.url) diff --git a/tests/components/normal-components/board-auto-size.test.tsx b/tests/components/normal-components/board-auto-size.test.tsx index 7ebf0a71b..6f68fae8e 100644 --- a/tests/components/normal-components/board-auto-size.test.tsx +++ b/tests/components/normal-components/board-auto-size.test.tsx @@ -124,3 +124,28 @@ test("board auto-size with grouped components", () => { expect(circuit.getCircuitJson()).toMatchPcbSnapshot(import.meta.path) }) + +test("board title appears in silkscreen", () => { + const { circuit } = getTestFixture({ + platform: { + printBoardInformationToSilkscreen: true, + }, + }) + + circuit.add( + + + , + ) + + circuit.render() + + const silkscreenTexts = circuit.db.pcb_silkscreen_text.list() + const titleText = silkscreenTexts.find((text) => + text.text.includes("My Custom Board"), + ) + + expect(titleText).toBeDefined() + expect(titleText?.text).toContain("My Custom Board") + expect(titleText?.layer).toBe("top") +}) From dffb7faa1db472f0d67b32c61fd1fee551a098aa Mon Sep 17 00:00:00 2001 From: Jayant Pranjal Date: Sun, 5 Oct 2025 19:51:16 +0530 Subject: [PATCH 2/9] add test into a seperate file --- .../board-auto-size.test.tsx | 25 ----------------- .../board-auto-size2.test.tsx | 27 +++++++++++++++++++ 2 files changed, 27 insertions(+), 25 deletions(-) create mode 100644 tests/components/normal-components/board-auto-size2.test.tsx diff --git a/tests/components/normal-components/board-auto-size.test.tsx b/tests/components/normal-components/board-auto-size.test.tsx index 6f68fae8e..7ebf0a71b 100644 --- a/tests/components/normal-components/board-auto-size.test.tsx +++ b/tests/components/normal-components/board-auto-size.test.tsx @@ -124,28 +124,3 @@ test("board auto-size with grouped components", () => { expect(circuit.getCircuitJson()).toMatchPcbSnapshot(import.meta.path) }) - -test("board title appears in silkscreen", () => { - const { circuit } = getTestFixture({ - platform: { - printBoardInformationToSilkscreen: true, - }, - }) - - circuit.add( - - - , - ) - - circuit.render() - - const silkscreenTexts = circuit.db.pcb_silkscreen_text.list() - const titleText = silkscreenTexts.find((text) => - text.text.includes("My Custom Board"), - ) - - expect(titleText).toBeDefined() - expect(titleText?.text).toContain("My Custom Board") - expect(titleText?.layer).toBe("top") -}) diff --git a/tests/components/normal-components/board-auto-size2.test.tsx b/tests/components/normal-components/board-auto-size2.test.tsx new file mode 100644 index 000000000..d81225163 --- /dev/null +++ b/tests/components/normal-components/board-auto-size2.test.tsx @@ -0,0 +1,27 @@ +import { test, expect } from "bun:test" +import { getTestFixture } from "tests/fixtures/get-test-fixture" + +test("board title appears in silkscreen", () => { + const { circuit } = getTestFixture({ + platform: { + printBoardInformationToSilkscreen: true, + }, + }) + + circuit.add( + + + , + ) + + circuit.render() + + const silkscreenTexts = circuit.db.pcb_silkscreen_text.list() + const titleText = silkscreenTexts.find((text) => + text.text.includes("My Custom Board"), + ) + + expect(titleText).toBeDefined() + expect(titleText?.text).toContain("My Custom Board") + expect(titleText?.layer).toBe("top") +}) \ No newline at end of file From c93e9550df3183d758545e11701ed4fd8a6256e8 Mon Sep 17 00:00:00 2001 From: Jayant Pranjal Date: Sun, 5 Oct 2025 20:02:46 +0530 Subject: [PATCH 3/9] fix graphite errors and formatting --- .../{board-auto-size2.test.tsx => board-title.test.tsx} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tests/components/normal-components/{board-auto-size2.test.tsx => board-title.test.tsx} (99%) diff --git a/tests/components/normal-components/board-auto-size2.test.tsx b/tests/components/normal-components/board-title.test.tsx similarity index 99% rename from tests/components/normal-components/board-auto-size2.test.tsx rename to tests/components/normal-components/board-title.test.tsx index d81225163..ba8d02aab 100644 --- a/tests/components/normal-components/board-auto-size2.test.tsx +++ b/tests/components/normal-components/board-title.test.tsx @@ -24,4 +24,4 @@ test("board title appears in silkscreen", () => { expect(titleText).toBeDefined() expect(titleText?.text).toContain("My Custom Board") expect(titleText?.layer).toBe("top") -}) \ No newline at end of file +}) From a74f4395337278e41c7a5ba1ac540c26a03ed5e9 Mon Sep 17 00:00:00 2001 From: Jayant Pranjal Date: Tue, 7 Oct 2025 10:42:32 +0530 Subject: [PATCH 4/9] update @tscircuitbot/props version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 146a34528..1a353ce8b 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@tscircuit/matchpack": "^0.0.16", "@tscircuit/math-utils": "^0.0.21", "@tscircuit/miniflex": "^0.0.4", - "@tscircuit/props": "0.0.349", + "@tscircuit/props": "^0.0.353", "@tscircuit/schematic-autolayout": "^0.0.6", "@tscircuit/schematic-match-adapt": "^0.0.16", "@tscircuit/schematic-trace-solver": "^0.0.40", From 5eebb7b0dd8aab047c97c3e7576bbab09a818d4a Mon Sep 17 00:00:00 2001 From: Jayant Pranjal Date: Tue, 7 Oct 2025 18:36:33 +0530 Subject: [PATCH 5/9] remove type casting --- lib/components/normal-components/Board.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/components/normal-components/Board.ts b/lib/components/normal-components/Board.ts index 7a7eb5e1a..b316b00e5 100644 --- a/lib/components/normal-components/Board.ts +++ b/lib/components/normal-components/Board.ts @@ -227,8 +227,7 @@ export class Board extends Group { if (!pcbBoard) return const boardInformation: string[] = [] - if ((this.props as any).title) - boardInformation.push((this.props as any).title) + if (this.props.title) boardInformation.push((this.props as any).title) if (platform.projectName) boardInformation.push(platform.projectName) if (platform.version) boardInformation.push(`v${platform.version}`) if (platform.url) boardInformation.push(platform.url) From 71db8269ed51e28bad98df6a495a517b55e99d50 Mon Sep 17 00:00:00 2001 From: Jayant Pranjal Date: Tue, 7 Oct 2025 19:06:33 +0530 Subject: [PATCH 6/9] remove type casting --- lib/components/normal-components/Board.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/components/normal-components/Board.ts b/lib/components/normal-components/Board.ts index b316b00e5..37ec17455 100644 --- a/lib/components/normal-components/Board.ts +++ b/lib/components/normal-components/Board.ts @@ -227,7 +227,7 @@ export class Board extends Group { if (!pcbBoard) return const boardInformation: string[] = [] - if (this.props.title) boardInformation.push((this.props as any).title) + if (this.props.title) boardInformation.push(this.props.title) if (platform.projectName) boardInformation.push(platform.projectName) if (platform.version) boardInformation.push(`v${platform.version}`) if (platform.url) boardInformation.push(platform.url) From f1c562c1742804197ac6cee76ad1a277c3b2a619 Mon Sep 17 00:00:00 2001 From: Jayant Pranjal Date: Thu, 9 Oct 2025 00:35:21 +0530 Subject: [PATCH 7/9] add source_board support for Board.ts --- lib/components/normal-components/Board.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/components/normal-components/Board.ts b/lib/components/normal-components/Board.ts index 37ec17455..c5666d486 100644 --- a/lib/components/normal-components/Board.ts +++ b/lib/components/normal-components/Board.ts @@ -253,6 +253,14 @@ export class Board extends Group { }) } + doInitialSourceRender() { + const { db } = this.root! + const source_board = (db as any).source_board.insert({ + type: "source_board", + title: this.props.title, + }) + } + doInitialPcbComponentRender(): void { if (this.root?.pcbDisabled) return const { db } = this.root! From 39375a31b0a180946f7c89bcc01bc8fb8565b051 Mon Sep 17 00:00:00 2001 From: Jayant Pranjal Date: Thu, 9 Oct 2025 01:25:54 +0530 Subject: [PATCH 8/9] bump circuit-json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dd5e6051f..863939aac 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "bun-match-svg": "0.0.12", "calculate-elbow": "^0.0.12", "chokidar-cli": "^3.0.0", - "circuit-json": "^0.0.273", + "circuit-json": "^0.0.274", "circuit-json-to-bpc": "^0.0.13", "circuit-json-to-connectivity-map": "^0.0.22", "circuit-json-to-gltf": "^0.0.7", From 3ccdb37ecef2cb2d3891428bebf230d538a4266c Mon Sep 17 00:00:00 2001 From: Jayant Pranjal Date: Thu, 9 Oct 2025 02:33:31 +0530 Subject: [PATCH 9/9] update source board type --- lib/components/normal-components/Board.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/components/normal-components/Board.ts b/lib/components/normal-components/Board.ts index f0d8587c9..13165aa86 100644 --- a/lib/components/normal-components/Board.ts +++ b/lib/components/normal-components/Board.ts @@ -266,7 +266,7 @@ export class Board extends Group { doInitialSourceRender() { const { db } = this.root! const source_board = (db as any).source_board.insert({ - type: "source_board", + type: "pcb_board", title: this.props.title, }) }