@tscircuit/core 0.0.350 → 0.0.352
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 +2 -2
- package/dist/index.js +31 -22
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { createElement } from 'react';
|
|
|
5
5
|
import * as zod from 'zod';
|
|
6
6
|
import { z, ZodType } from 'zod';
|
|
7
7
|
import { symbols, SchSymbol, BaseSymbolName } from 'schematic-symbols';
|
|
8
|
-
import { PcbTraceError, PcbPlacementError, PcbManualEditConflictError, LayerRef, AnyCircuitElement, AnySourceComponent, PcbTraceRoutePoint, PcbTrace, RouteHintPoint, CircuitJson } from 'circuit-json';
|
|
8
|
+
import { PcbTraceError, PcbPlacementError, PcbManualEditConflictError, LayerRef, AnyCircuitElement, AnySourceComponent, PcbTraceRoutePoint, PcbTrace, PcbVia, RouteHintPoint, CircuitJson } from 'circuit-json';
|
|
9
9
|
import { Matrix } from 'transformation-matrix';
|
|
10
10
|
import { SoupUtilObjects } from '@tscircuit/soup-util';
|
|
11
11
|
import * as _tscircuit_layout from '@tscircuit/layout';
|
|
@@ -1001,7 +1001,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
1001
1001
|
_hasStartedAsyncAutorouting: boolean;
|
|
1002
1002
|
_asyncAutoroutingResult: {
|
|
1003
1003
|
output_simple_route_json?: SimpleRouteJson;
|
|
1004
|
-
output_pcb_traces?: PcbTrace[];
|
|
1004
|
+
output_pcb_traces?: (PcbTrace | PcbVia)[];
|
|
1005
1005
|
} | null;
|
|
1006
1006
|
get config(): {
|
|
1007
1007
|
zodProps: Props;
|
package/dist/index.js
CHANGED
|
@@ -6009,6 +6009,7 @@ var Group = class extends NormalComponent {
|
|
|
6009
6009
|
if (!output_pcb_traces) return;
|
|
6010
6010
|
const { db } = this.root;
|
|
6011
6011
|
for (const pcb_trace of output_pcb_traces) {
|
|
6012
|
+
if (pcb_trace.type !== "pcb_trace") continue;
|
|
6012
6013
|
pcb_trace.subcircuit_id = this.subcircuit_id;
|
|
6013
6014
|
if (pcb_trace.connection_name) {
|
|
6014
6015
|
const sourceTraceId = pcb_trace.connection_name;
|
|
@@ -6017,18 +6018,26 @@ var Group = class extends NormalComponent {
|
|
|
6017
6018
|
db.pcb_trace.insert(pcb_trace);
|
|
6018
6019
|
}
|
|
6019
6020
|
for (const pcb_trace of output_pcb_traces) {
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6021
|
+
if (pcb_trace.type === "pcb_via") {
|
|
6022
|
+
continue;
|
|
6023
|
+
}
|
|
6024
|
+
if (pcb_trace.type === "pcb_trace") {
|
|
6025
|
+
for (const point of pcb_trace.route) {
|
|
6026
|
+
if (point.route_type === "via") {
|
|
6027
|
+
db.pcb_via.insert({
|
|
6028
|
+
pcb_trace_id: pcb_trace.pcb_trace_id,
|
|
6029
|
+
x: point.x,
|
|
6030
|
+
y: point.y,
|
|
6031
|
+
hole_diameter: 0.3,
|
|
6032
|
+
outer_diameter: 0.6,
|
|
6033
|
+
layers: [
|
|
6034
|
+
point.from_layer,
|
|
6035
|
+
point.to_layer
|
|
6036
|
+
],
|
|
6037
|
+
from_layer: point.from_layer,
|
|
6038
|
+
to_layer: point.to_layer
|
|
6039
|
+
});
|
|
6040
|
+
}
|
|
6032
6041
|
}
|
|
6033
6042
|
}
|
|
6034
6043
|
}
|
|
@@ -6147,23 +6156,23 @@ var Board = class extends Group {
|
|
|
6147
6156
|
let minY = Infinity;
|
|
6148
6157
|
let maxX = -Infinity;
|
|
6149
6158
|
let maxY = -Infinity;
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
const { width, height, center: center2 } = pcb_component;
|
|
6159
|
+
const allPcbComponents = db.pcb_component.list();
|
|
6160
|
+
let hasComponents = false;
|
|
6161
|
+
for (const pcbComponent of allPcbComponents) {
|
|
6162
|
+
const { width, height, center: center2 } = pcbComponent;
|
|
6155
6163
|
if (width === 0 || height === 0) continue;
|
|
6164
|
+
hasComponents = true;
|
|
6156
6165
|
minX = Math.min(minX, center2.x - width / 2);
|
|
6157
6166
|
minY = Math.min(minY, center2.y - height / 2);
|
|
6158
6167
|
maxX = Math.max(maxX, center2.x + width / 2);
|
|
6159
6168
|
maxY = Math.max(maxY, center2.y + height / 2);
|
|
6160
6169
|
}
|
|
6161
6170
|
const padding = 2;
|
|
6162
|
-
const computedWidth = maxX - minX + padding * 2;
|
|
6163
|
-
const computedHeight = maxY - minY + padding * 2;
|
|
6171
|
+
const computedWidth = hasComponents ? maxX - minX + padding * 2 : 0;
|
|
6172
|
+
const computedHeight = hasComponents ? maxY - minY + padding * 2 : 0;
|
|
6164
6173
|
const center = {
|
|
6165
|
-
x: (minX + maxX) / 2 + (props.outlineOffsetX ?? 0),
|
|
6166
|
-
y: (minY + maxY) / 2 + (props.outlineOffsetY ?? 0)
|
|
6174
|
+
x: hasComponents ? (minX + maxX) / 2 + (props.outlineOffsetX ?? 0) : props.outlineOffsetX ?? 0,
|
|
6175
|
+
y: hasComponents ? (minY + maxY) / 2 + (props.outlineOffsetY ?? 0) : props.outlineOffsetY ?? 0
|
|
6167
6176
|
};
|
|
6168
6177
|
db.pcb_board.update(this.pcb_board_id, {
|
|
6169
6178
|
width: computedWidth,
|
|
@@ -7305,7 +7314,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
7305
7314
|
var package_default = {
|
|
7306
7315
|
name: "@tscircuit/core",
|
|
7307
7316
|
type: "module",
|
|
7308
|
-
version: "0.0.
|
|
7317
|
+
version: "0.0.351",
|
|
7309
7318
|
types: "dist/index.d.ts",
|
|
7310
7319
|
main: "dist/index.js",
|
|
7311
7320
|
module: "dist/index.js",
|