@tscircuit/pcb-viewer 1.11.397 → 1.11.399
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +783 -680
- package/dist/index.js.map +1 -1
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -86,3 +86,40 @@ The PCBViewer component accepts these props:
|
|
|
86
86
|
- Trace routing
|
|
87
87
|
- DRC (Design Rule Check) visualization
|
|
88
88
|
- Measurement tools
|
|
89
|
+
|
|
90
|
+
### WebGPU rendering
|
|
91
|
+
|
|
92
|
+
`PCBViewer` defaults to `renderer="webgpu"`. It uses
|
|
93
|
+
[`circuit-json-webgpu`](https://github.com/tscircuit/circuit-json-webgpu) inside a
|
|
94
|
+
Web Worker with an OffscreenCanvas. Circuit geometry is compiled and uploaded
|
|
95
|
+
once per scene; pan and zoom update the camera and draw retained GPU buffers
|
|
96
|
+
continuously. The main thread handles React, interaction, and view messages.
|
|
97
|
+
There is no bitmap zoom-settle delay or pool of raster workers.
|
|
98
|
+
|
|
99
|
+
Pass `renderer="canvas"` to explicitly use the existing Canvas renderer. WebGPU
|
|
100
|
+
also falls back to Canvas when WebGPU/OffscreenCanvas is unavailable, initialization
|
|
101
|
+
fails, the GPU device is lost, or the scene includes unsupported geometry (such
|
|
102
|
+
as dimension annotations or interpolated trace routes). The initial GPU geometry compile
|
|
103
|
+
still takes time on large boards, but runs in the worker. Curves use fixed
|
|
104
|
+
triangle tessellation and can show facets at extreme zoom.
|
|
105
|
+
|
|
106
|
+
Right-click the board and choose **Rendering Engine → Canvas** or
|
|
107
|
+
**WebGPU (experimental)** to switch without resetting pan, zoom, or layer visibility.
|
|
108
|
+
The `renderer` prop sets the initial selection; changing that prop updates the selection.
|
|
109
|
+
Selecting WebGPU still permits automatic Canvas fallback on unsupported devices or scenes.
|
|
110
|
+
|
|
111
|
+
Run `bun run test:webgpu` after `bunx playwright install chromium` to test the built
|
|
112
|
+
viewer bundle, AM3352 wheel zoom, resize, StrictMode cleanup, context-menu switching,
|
|
113
|
+
and fallbacks. The Cosmos `WebGpuAm3352` fixture also switches between backends.
|
|
114
|
+
|
|
115
|
+
The WebGPU integration is still experimental. The complete imported Canvas suite
|
|
116
|
+
currently exposes substantial non-text parity gaps, including soldermask, trace
|
|
117
|
+
clipping, and keepouts. See the renderer's
|
|
118
|
+
[full parity report](https://github.com/tscircuit/circuit-json-webgpu/blob/main/tests/parity/latest-report.json).
|
|
119
|
+
The integration PR remains draft until these are resolved; existing diagnostics
|
|
120
|
+
and Canvas fallback do not yet detect every visual mismatch.
|
|
121
|
+
|
|
122
|
+
The WebGPU renderer is installed as a bundled devDependency from
|
|
123
|
+
`https://jscdn.tscircuit.com/@tscircuit/circuit-json-webgpu/0.0.3.tgz`.
|
|
124
|
+
The renderer repository includes a TypeScript local render command and 597
|
|
125
|
+
SVG-left/WebGPU-right feature snapshot tests.
|
package/dist/index.d.ts
CHANGED
|
@@ -74,6 +74,9 @@ interface BoundsSelection {
|
|
|
74
74
|
type Props = {
|
|
75
75
|
circuitJson?: AnyCircuitElement[];
|
|
76
76
|
height?: number;
|
|
77
|
+
/** Initial engine; users can switch via the context menu. Prop changes reset it.
|
|
78
|
+
* WebGPU runs in a worker and falls back to Canvas when unavailable. */
|
|
79
|
+
renderer?: "webgpu" | "canvas";
|
|
77
80
|
allowEditing?: boolean;
|
|
78
81
|
editEvents?: ManualEditEvent[];
|
|
79
82
|
initialState?: Partial<StateProps>;
|
|
@@ -84,7 +87,7 @@ type Props = {
|
|
|
84
87
|
debugGraphics?: GraphicsObject | null;
|
|
85
88
|
disablePcbGroups?: boolean;
|
|
86
89
|
};
|
|
87
|
-
declare const PCBViewer: ({ circuitJson, debugGraphics, height, initialState, allowEditing, editEvents: editEventsProp, onEditEventsChanged, onBoundsSelected, focusOnHover, clickToInteractEnabled, disablePcbGroups, }: Props) => react_jsx_runtime.JSX.Element;
|
|
90
|
+
declare const PCBViewer: ({ circuitJson, debugGraphics, height, renderer, initialState, allowEditing, editEvents: editEventsProp, onEditEventsChanged, onBoundsSelected, focusOnHover, clickToInteractEnabled, disablePcbGroups, }: Props) => react_jsx_runtime.JSX.Element;
|
|
88
91
|
|
|
89
92
|
interface CanvasElementsRendererProps {
|
|
90
93
|
elements: AnyCircuitElement[];
|
|
@@ -93,10 +96,12 @@ interface CanvasElementsRendererProps {
|
|
|
93
96
|
setTransform?: (transform: Matrix) => void;
|
|
94
97
|
width?: number;
|
|
95
98
|
height?: number;
|
|
99
|
+
renderer?: "webgpu" | "canvas";
|
|
96
100
|
grid?: GridConfig;
|
|
97
101
|
allowEditing: boolean;
|
|
98
102
|
focusOnHover?: boolean;
|
|
99
103
|
onBoundsSelected?: (bounds: BoundsSelection) => void;
|
|
104
|
+
onContextMenuOpenChange?: (open: boolean) => void;
|
|
100
105
|
cancelPanDrag: () => void;
|
|
101
106
|
onCreateEditEvent: (event: ManualEditEvent) => void;
|
|
102
107
|
onModifyEditEvent: (event: Partial<ManualEditEvent>) => void;
|