Skip to content

feat: add CourtyardPill primitive and register <courtyardpill> JSX element - #5923

Open
devbox-zero-ops wants to merge 2 commits into
tscircuit:mainfrom
devbox-zero-ops:feat/courtyard-pill
Open

devbox-zero-ops wants to merge 2 commits into
tscircuit:mainfrom
devbox-zero-ops:feat/courtyard-pill

Conversation

@devbox-zero-ops

Copy link
Copy Markdown

Closes #5920

Summary

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)
  • bunx tsc --noEmit (pass, 0 errors)
  • bunx biome check (pass, 0 errors)

@vercel

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tscircuit-core-benchmarks Ready Ready Preview Nov 26, 2026 9:12am UTC

Request Review

@nitina-ariveguru

Copy link
Copy Markdown

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.

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.

@devbox-zero-ops

Copy link
Copy Markdown
Author

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 branch was successfully deployed

1 active deployment
Preview — 248e4722 Deployed Nov 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<courtyardpill> is documented as a built-in element but not registered in core ("Unsupported component type")

2 participants