Skip to content

Add Run Style Analysis context-menu command with SVG results - #273

Merged
seveibar merged 2 commits into
mainfrom
feat/run-style-analysis
Sep 12, 2026
Merged

Add Run Style Analysis context-menu command with SVG results#273
seveibar merged 2 commits into
mainfrom
feat/run-style-analysis

Conversation

@seveibar

@seveibar seveibar commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Adds Run Style Analysis to the schematic right-click menu. Selecting it snapshots the current Circuit JSON and opens a scrollable modal containing one annotated SVG per placement/style issue across all sheets. Close and rerun to analyze the updated circuit.

The browser imports the standalone analyzer from https://jscdn.tscircuit.com/@tscircuit/circuit-json-schematic-placement-analysis/latest/dist/browser.js only when the command runs. The analyzer is not bundled with the viewer or application. Vite/Webpack ignore annotations preserve the external URL import. The local analyzer dependency is development-only for real-result tests.

The modal includes loading, empty, and CDN/analysis failure states, with focus trapping and Escape/Close dismissal. SVGs are images and Circuit JSON stays local. latest follows the latest published release subject to the CDN’s ten-minute cache; browsers reuse the imported module until page reload. Hosts must permit the jscdn script origin in CSP. Analysis executes synchronously after loading.

Release prerequisite: merge and publish tscircuit/circuit-json-schematic-placement-analysis#66 first. The CDN URL currently returns 404 until that release. Runtime dependency fix #65 is already merged upstream.

Includes example36-style-analysis Cosmos fixture with overlapping resistors.

Validation:

  • bun test: 30 pass, including real issue SVGs, changed-circuit reruns, no issues, and dismissible CDN failures (network import mocked in tests).
  • Typecheck, library build, production Cosmos build, formatting, and diff checks pass.
  • Built viewer preserves the runtime URL import and both bundler-ignore annotations; production Cosmos no longer emits the analyzer chunk.
  • Live CDN loading cannot be verified before publication. Visual browser inspection was blocked by the host’s saved browser permissions.

@vercel

vercel Bot commented Sep 12, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
schematic-viewer Ready Ready Preview Sep 12, 2026 9:22pm UTC

Request Review

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.

1 participant