Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export interface BoardProps
title?: string;
material?: "fr4" | "fr1";
/** Number of layers for the PCB */
layers?: 1 | 2 | 4;
layers?: 1 | 2 | 4 | 6 | 8;
borderRadius?: Distance;
thickness?: Distance;
boardAnchorPosition?: Point;
Expand Down
13 changes: 11 additions & 2 deletions generated/COMPONENT_TYPES.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ export interface CommonComponentProps<PinLabel extends string = string>
symbolName?: string
doNotPlace?: boolean
obstructsWithinBounds?: boolean
showAsTranslucentModel?: boolean
}
.extend({
key: z.any().optional(),
Expand All @@ -306,6 +307,12 @@ export interface CommonComponentProps<PinLabel extends string = string>
.describe(
"Does this component take up all the space within its bounds on a layer. This is generally true except for when separated pin headers are being represented by a single component (in which case, chips can be placed between the pin headers) or for tall modules where chips fit underneath",
),
showAsTranslucentModel: z
.boolean()
.optional()
.describe(
"Whether to show this component's CAD model as translucent in the 3D viewer.",
),
pinAttributes: z.record(z.string(), pinAttributeMap).optional(),
})
export const lrPolarPins = [
Expand Down Expand Up @@ -514,7 +521,7 @@ export interface BoardProps
extends Omit<SubcircuitGroupProps, "subcircuit" | "connections"> {
title?: string
material?: "fr4" | "fr1"
layers?: 1 | 2 | 4
layers?: 1 | 2 | 4 | 6 | 8
borderRadius?: Distance
thickness?: Distance
boardAnchorPosition?: Point
Expand All @@ -533,7 +540,9 @@ export const boardProps = subcircuitGroupProps
.omit({ connections: true })
.extend({
material: z.enum(["fr4", "fr1"]).default("fr4"),
layers: z.union([z.literal(1), z.literal(2), z.literal(4)]).default(2),
layers: z
.union([z.literal(1), z.literal(2), z.literal(4), z.literal(6), z.literal(8)])
.default(2),
borderRadius: distance.optional(),
thickness: distance.optional(),
boardAnchorPosition: point.optional(),
Expand Down
6 changes: 5 additions & 1 deletion generated/PROPS_OVERVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export interface BoardProps
title?: string
material?: "fr4" | "fr1"
/** Number of layers for the PCB */
layers?: 1 | 2 | 4
layers?: 1 | 2 | 4 | 6 | 8
borderRadius?: Distance
thickness?: Distance
boardAnchorPosition?: Point
Expand Down Expand Up @@ -468,6 +468,10 @@ export interface CommonComponentProps<PinLabel extends string = string>
* chips can be placed between the pin headers) or for tall modules where chips fit underneath.
*/
obstructsWithinBounds?: boolean
/**
* Whether to show this component's CAD model as translucent in the 3D viewer.
*/
showAsTranslucentModel?: boolean
}


Expand Down
12 changes: 10 additions & 2 deletions lib/components/board.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface BoardProps
title?: string
material?: "fr4" | "fr1"
/** Number of layers for the PCB */
layers?: 1 | 2 | 4
layers?: 1 | 2 | 4 | 6 | 8
borderRadius?: Distance
thickness?: Distance
boardAnchorPosition?: Point
Expand All @@ -55,7 +55,15 @@ export const boardProps = subcircuitGroupProps
.omit({ connections: true })
.extend({
material: z.enum(["fr4", "fr1"]).default("fr4"),
layers: z.union([z.literal(1), z.literal(2), z.literal(4)]).default(2),
layers: z
.union([
z.literal(1),
z.literal(2),
z.literal(4),
z.literal(6),
z.literal(8),
])
.default(2),
borderRadius: distance.optional(),
thickness: distance.optional(),
boardAnchorPosition: point.optional(),
Expand Down
8 changes: 8 additions & 0 deletions tests/board.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ test("should allow single-layer boards", () => {
expect(parsed.layers).toBe(1)
})

test("should allow 6 and 8 layer boards", () => {
const sixLayer: BoardProps = { name: "board", layers: 6 }
const eightLayer: BoardProps = { name: "board", layers: 8 }

expect(boardProps.parse(sixLayer).layers).toBe(6)
expect(boardProps.parse(eightLayer).layers).toBe(8)
})
Comment on lines +31 to +37
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test file violates the rule that a *.test.ts file may have AT MOST one test(...) function. The file already contains at least one test() function (visible at line 39), and this modification adds another test() function at lines 31-37. To fix this violation, split the tests into multiple numbered files such as board1.test.ts, board2.test.ts, etc., with each file containing only one test() function.

Spotted by Graphite Agent (based on custom rule: Custom rule)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.


test("should parse borderRadius prop", () => {
const raw: BoardProps = { name: "board", borderRadius: 2 }
const parsed = boardProps.parse(raw)
Expand Down