You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: add CourtyardPill primitive and register <courtyardpill> JSX element - #5923
Registers the documented <courtyardpill> intrinsic JSX element and implements the CourtyardPill PCB primitive component so footprints using <courtyardpill> emit valid pcb_courtyard_pill elements in circuit-json instead of failing with Unsupported component type "courtyardpill".
Changes
Added CourtyardPill primitive (lib/components/primitive-components/CourtyardPill.ts) using courtyardPillProps from @tscircuit/props, emitting db.pcb_courtyard_pill with top/bottom layer flipping, getPcbSize(), and _moveCircuitJsonElements().
Exported CourtyardPill in lib/components/index.ts.
Registered courtyardpill: Props.CourtyardPillProps in lib/fiber/intrinsic-jsx.ts.
Added pcb_courtyard_pill reconstruction in lib/utils/createComponentsFromCircuitJson.ts.
Added unit tests in tests/components/primitive-components/courtyard-pill.test.tsx covering the #5920 repro, bottom-layer flip, and createComponentsFromCircuitJson round-trip.
Verification
bun test tests/components/primitive-components/courtyard-pill.test.tsx (3 pass / 0 fail, 15 assertions)
I filed #5920 and tested this merged onto current main (v0.0.2485), swapped into tscircuit 0.0.3296 with an empty .tscircuit/cache. It merges cleanly, tsc --noEmit is clean, and the 3 new tests pass.
End to end with fix: include pcb_courtyard_polygon and pcb_courtyard_pill in checkCourtyardOverlap checks#600 swapped in, two chips whose 8 × 3 pill courtyards overlap by 2 mm now get pcb_courtyard_overlap_error. Two pills whose bounding boxes overlap but whose round ends are 0.68 mm apart, and two pills 2 mm apart, get none. Stock checks (0.0.283) report nothing for any of them.
On a layer="bottom" chip, a pill offset pcbX={1} is mirrored to x − 1 and gets layer: "bottom", as expected.
Rotation isn't carried, though. On a chip with pcbRotation={90}, a pill at pcbX={1} gets the rotated center ((−5, 0) → (−5, 1)), but it stays width: 8, height: 3 with no rotation, so the courtyard lies across the part instead of along it. With the same footprint using <courtyardrect>, core emits ccw_rotation: 90. A pill at pcbRotation={30} is also emitted unrotated. pcb_courtyard_pill in circuit-json has no rotation field, so this probably needs either a ccw_rotation there, swapping width/height for 90°/270° in the meantime, or emitting rotated pills as pcb_courtyard_outline. Otherwise the overlap check from tscircuit/checks#600 will test the wrong shape on any rotated part.
Great catch on rotation — pushed 248e472 to handle all parent rotations cleanly:
0° / 180°: emits pcb_courtyard_pill with (width, height, radius) as before.
90° / 270°: swaps width and height on pcb_courtyard_pill (e.g. 8 × 3 becomes 3 × 8 at the rotated center), preserving exact pill geometry for tscircuit/checks#600 without requiring a schema change in circuit-json.
Arbitrary angles (e.g. 30° / 45°): samples the rounded stadium boundary and transforms it via the global PCB transform into a pcb_courtyard_outline polygon (with _moveCircuitJsonElements updated to translate both pcb_courtyard_pill and pcb_courtyard_outline).
Added unit tests for both pcbRotation={90} and pcbRotation={30} (5 pass / 0 fail, tsc --noEmit and biome check clean).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5920
Summary
Registers the documented
<courtyardpill>intrinsic JSX element and implements theCourtyardPillPCB primitive component so footprints using<courtyardpill>emit validpcb_courtyard_pillelements in circuit-json instead of failing withUnsupported component type "courtyardpill".Changes
CourtyardPillprimitive (lib/components/primitive-components/CourtyardPill.ts) usingcourtyardPillPropsfrom@tscircuit/props, emittingdb.pcb_courtyard_pillwith top/bottom layer flipping,getPcbSize(), and_moveCircuitJsonElements().CourtyardPillinlib/components/index.ts.courtyardpill: Props.CourtyardPillPropsinlib/fiber/intrinsic-jsx.ts.pcb_courtyard_pillreconstruction inlib/utils/createComponentsFromCircuitJson.ts.tests/components/primitive-components/courtyard-pill.test.tsxcovering the#5920repro, bottom-layer flip, andcreateComponentsFromCircuitJsonround-trip.Verification
bun test tests/components/primitive-components/courtyard-pill.test.tsx(3 pass / 0 fail, 15 assertions)bunx tsc --noEmit(pass, 0 errors)bunx biome check(pass, 0 errors)