@tscircuit/pcb-viewer 1.11.419 → 1.11.421
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/dist/index.d.ts +28 -2
- package/dist/index.js +224 -108
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,27 @@ interface BoundsSelection {
|
|
|
80
80
|
maxY: number;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
interface PcbViewerController {
|
|
84
|
+
/** @internal Pending command, consumed after the viewer focuses the component. */
|
|
85
|
+
focusRequest: {
|
|
86
|
+
pcbComponentId: string;
|
|
87
|
+
} | null;
|
|
88
|
+
/** @internal Acknowledge only this request, preserving newer commands. */
|
|
89
|
+
onFocusRequestHandled: (request: {
|
|
90
|
+
pcbComponentId: string;
|
|
91
|
+
}) => void;
|
|
92
|
+
}
|
|
93
|
+
/** Focus commands may be issued before the PCB viewer mounts, such as when switching tabs. */
|
|
94
|
+
declare const usePcbViewerController: () => {
|
|
95
|
+
controller: {
|
|
96
|
+
focusRequest: {
|
|
97
|
+
pcbComponentId: string;
|
|
98
|
+
};
|
|
99
|
+
onFocusRequestHandled: (request: NonNullable<PcbViewerController["focusRequest"]>) => void;
|
|
100
|
+
};
|
|
101
|
+
focusPcbComponent: (pcbComponentId: string) => void;
|
|
102
|
+
};
|
|
103
|
+
|
|
83
104
|
type Props = {
|
|
84
105
|
circuitJson?: AnyCircuitElement[];
|
|
85
106
|
height?: number;
|
|
@@ -99,8 +120,10 @@ type Props = {
|
|
|
99
120
|
clickToInteractEnabled?: boolean;
|
|
100
121
|
debugGraphics?: GraphicsObject | null;
|
|
101
122
|
disablePcbGroups?: boolean;
|
|
123
|
+
/** Connect the controller returned by usePcbViewerController. */
|
|
124
|
+
controller?: PcbViewerController;
|
|
102
125
|
};
|
|
103
|
-
declare const PCBViewer: ({ circuitJson, debugGraphics, height, renderer, initialState, allowEditing, editEvents: editEventsProp, onEditEventsChanged, onRenderComplete, onBoundsSelected, onViewSchematicComponent, focusOnHover, clickToInteractEnabled, disablePcbGroups, }: Props) => react_jsx_runtime.JSX.Element;
|
|
126
|
+
declare const PCBViewer: ({ circuitJson, debugGraphics, height, renderer, initialState, allowEditing, editEvents: editEventsProp, onEditEventsChanged, onRenderComplete, onBoundsSelected, onViewSchematicComponent, focusOnHover, clickToInteractEnabled, disablePcbGroups, controller, }: Props) => react_jsx_runtime.JSX.Element;
|
|
104
127
|
|
|
105
128
|
interface CanvasElementsRendererProps {
|
|
106
129
|
elements: AnyCircuitElement[];
|
|
@@ -113,6 +136,9 @@ interface CanvasElementsRendererProps {
|
|
|
113
136
|
grid?: GridConfig;
|
|
114
137
|
allowEditing: boolean;
|
|
115
138
|
focusOnHover?: boolean;
|
|
139
|
+
focusedPcbComponent?: {
|
|
140
|
+
pcbComponentId: string;
|
|
141
|
+
} | null;
|
|
116
142
|
onViewSchematicComponent?: (event: ViewSchematicComponentEvent) => void;
|
|
117
143
|
onBoundsSelected?: (bounds: BoundsSelection) => void;
|
|
118
144
|
onContextMenuOpenChange?: (open: boolean) => void;
|
|
@@ -123,4 +149,4 @@ interface CanvasElementsRendererProps {
|
|
|
123
149
|
}
|
|
124
150
|
declare const CanvasElementsRenderer: (props: CanvasElementsRendererProps) => react_jsx_runtime.JSX.Element;
|
|
125
151
|
|
|
126
|
-
export { CanvasElementsRenderer, PCBViewer, type ViewSchematicComponentEvent };
|
|
152
|
+
export { CanvasElementsRenderer, PCBViewer, type PcbViewerController, type ViewSchematicComponentEvent, usePcbViewerController };
|