@tscircuit/core 0.0.764 → 0.0.766
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 +97 -6
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as circuit_json from 'circuit-json';
|
|
2
|
-
import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, LayerRef, AnyCircuitElement, Size, AnySourceComponent, PcbTraceRoutePoint, PcbTrace as PcbTrace$1, PcbVia, SchematicPort, SchematicComponent, RouteHintPoint, CircuitJson } from 'circuit-json';
|
|
2
|
+
import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, PcbViaClearanceError, LayerRef, AnyCircuitElement, Size, AnySourceComponent, PcbTraceRoutePoint, PcbTrace as PcbTrace$1, PcbVia, SchematicPort, SchematicComponent, RouteHintPoint, CircuitJson } from 'circuit-json';
|
|
3
3
|
import * as _tscircuit_props from '@tscircuit/props';
|
|
4
4
|
import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, solderjumperProps, ledProps, powerSourceProps, CommonComponentProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, copperPourProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
5
5
|
import * as react from 'react';
|
|
@@ -68,7 +68,7 @@ declare abstract class Renderable implements IRenderable {
|
|
|
68
68
|
*/
|
|
69
69
|
runRenderPhase(phase: RenderPhase): void;
|
|
70
70
|
runRenderPhaseForChildren(phase: RenderPhase): void;
|
|
71
|
-
renderError(message: string | Omit<PcbTraceError, "pcb_error_id"> | Omit<PcbPlacementError, "pcb_error_id"> | Omit<PcbManualEditConflictWarning, "pcb_error_id">): void;
|
|
71
|
+
renderError(message: string | Omit<PcbTraceError, "pcb_error_id"> | Omit<PcbPlacementError, "pcb_error_id"> | Omit<PcbManualEditConflictWarning, "pcb_error_id"> | Omit<PcbViaClearanceError, "pcb_error_id">): void;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1250,7 +1250,22 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1250
1250
|
if (typeof message === "string") {
|
|
1251
1251
|
return super.renderError(message);
|
|
1252
1252
|
}
|
|
1253
|
-
|
|
1253
|
+
switch (message.type) {
|
|
1254
|
+
case "pcb_placement_error":
|
|
1255
|
+
this.root?.db.pcb_placement_error.insert(message);
|
|
1256
|
+
break;
|
|
1257
|
+
case "pcb_via_clearance_error":
|
|
1258
|
+
this.root?.db.pcb_via_clearance_error.insert(message);
|
|
1259
|
+
break;
|
|
1260
|
+
case "pcb_trace_error":
|
|
1261
|
+
this.root?.db.pcb_trace_error.insert(message);
|
|
1262
|
+
break;
|
|
1263
|
+
case "pcb_manual_edit_conflict_warning":
|
|
1264
|
+
this.root?.db.pcb_manual_edit_conflict_warning.insert(message);
|
|
1265
|
+
break;
|
|
1266
|
+
default:
|
|
1267
|
+
this.root?.db.pcb_placement_error.insert(message);
|
|
1268
|
+
}
|
|
1254
1269
|
}
|
|
1255
1270
|
getString() {
|
|
1256
1271
|
const { lowercaseComponentName: cname, _parsedProps: props, parent } = this;
|
|
@@ -8298,6 +8313,56 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
8298
8313
|
}
|
|
8299
8314
|
};
|
|
8300
8315
|
|
|
8316
|
+
// lib/utils/boards/get-board-center-from-anchor.ts
|
|
8317
|
+
var getBoardCenterFromAnchor = ({
|
|
8318
|
+
boardAnchorPosition,
|
|
8319
|
+
boardAnchorAlignment,
|
|
8320
|
+
width,
|
|
8321
|
+
height
|
|
8322
|
+
}) => {
|
|
8323
|
+
const { x: ax, y: ay } = boardAnchorPosition;
|
|
8324
|
+
let cx = ax;
|
|
8325
|
+
let cy = ay;
|
|
8326
|
+
switch (boardAnchorAlignment) {
|
|
8327
|
+
case "top_left":
|
|
8328
|
+
cx = ax + width / 2;
|
|
8329
|
+
cy = ay - height / 2;
|
|
8330
|
+
break;
|
|
8331
|
+
case "top_right":
|
|
8332
|
+
cx = ax - width / 2;
|
|
8333
|
+
cy = ay - height / 2;
|
|
8334
|
+
break;
|
|
8335
|
+
case "bottom_left":
|
|
8336
|
+
cx = ax + width / 2;
|
|
8337
|
+
cy = ay + height / 2;
|
|
8338
|
+
break;
|
|
8339
|
+
case "bottom_right":
|
|
8340
|
+
cx = ax - width / 2;
|
|
8341
|
+
cy = ay + height / 2;
|
|
8342
|
+
break;
|
|
8343
|
+
case "top":
|
|
8344
|
+
cx = ax;
|
|
8345
|
+
cy = ay - height / 2;
|
|
8346
|
+
break;
|
|
8347
|
+
case "bottom":
|
|
8348
|
+
cx = ax;
|
|
8349
|
+
cy = ay + height / 2;
|
|
8350
|
+
break;
|
|
8351
|
+
case "left":
|
|
8352
|
+
cx = ax + width / 2;
|
|
8353
|
+
cy = ay;
|
|
8354
|
+
break;
|
|
8355
|
+
case "right":
|
|
8356
|
+
cx = ax - width / 2;
|
|
8357
|
+
cy = ay;
|
|
8358
|
+
break;
|
|
8359
|
+
case "center":
|
|
8360
|
+
default:
|
|
8361
|
+
break;
|
|
8362
|
+
}
|
|
8363
|
+
return { x: cx, y: cy };
|
|
8364
|
+
};
|
|
8365
|
+
|
|
8301
8366
|
// lib/components/normal-components/Board.ts
|
|
8302
8367
|
import { boardProps } from "@tscircuit/props";
|
|
8303
8368
|
import { identity as identity4 } from "transformation-matrix";
|
|
@@ -12732,7 +12797,9 @@ import {
|
|
|
12732
12797
|
checkEachPcbPortConnectedToPcbTraces,
|
|
12733
12798
|
checkEachPcbTraceNonOverlapping,
|
|
12734
12799
|
checkPcbComponentsOutOfBoard,
|
|
12735
|
-
checkPcbTracesOutOfBoard
|
|
12800
|
+
checkPcbTracesOutOfBoard,
|
|
12801
|
+
checkDifferentNetViaSpacing,
|
|
12802
|
+
checkSameNetViaSpacing
|
|
12736
12803
|
} from "@tscircuit/checks";
|
|
12737
12804
|
var getRoundedRectOutline = (width, height, radius) => {
|
|
12738
12805
|
const r = Math.min(radius, width / 2, height / 2);
|
|
@@ -12842,10 +12909,17 @@ var Board = class extends Group6 {
|
|
|
12842
12909
|
for (const pcbGroup of allPcbGroups) {
|
|
12843
12910
|
updateBounds(pcbGroup.center, pcbGroup.width, pcbGroup.height);
|
|
12844
12911
|
}
|
|
12912
|
+
if (props.boardAnchorPosition) {
|
|
12913
|
+
const { x, y } = props.boardAnchorPosition;
|
|
12914
|
+
minX = Math.min(minX, x);
|
|
12915
|
+
minY = Math.min(minY, y);
|
|
12916
|
+
maxX = Math.max(maxX, x);
|
|
12917
|
+
maxY = Math.max(maxY, y);
|
|
12918
|
+
}
|
|
12845
12919
|
const padding = 2;
|
|
12846
12920
|
const computedWidth = hasComponents ? maxX - minX + padding * 2 : 0;
|
|
12847
12921
|
const computedHeight = hasComponents ? maxY - minY + padding * 2 : 0;
|
|
12848
|
-
|
|
12922
|
+
let center = {
|
|
12849
12923
|
x: hasComponents ? (minX + maxX) / 2 + (props.outlineOffsetX ?? 0) : props.outlineOffsetX ?? 0,
|
|
12850
12924
|
y: hasComponents ? (minY + maxY) / 2 + (props.outlineOffsetY ?? 0) : props.outlineOffsetY ?? 0
|
|
12851
12925
|
};
|
|
@@ -12918,6 +12992,15 @@ var Board = class extends Group6 {
|
|
|
12918
12992
|
x: (props.pcbX ?? 0) + (props.outlineOffsetX ?? 0),
|
|
12919
12993
|
y: (props.pcbY ?? 0) + (props.outlineOffsetY ?? 0)
|
|
12920
12994
|
};
|
|
12995
|
+
const { boardAnchorPosition, boardAnchorAlignment } = props;
|
|
12996
|
+
if (boardAnchorPosition) {
|
|
12997
|
+
center = getBoardCenterFromAnchor({
|
|
12998
|
+
boardAnchorPosition,
|
|
12999
|
+
boardAnchorAlignment: boardAnchorAlignment ?? "center",
|
|
13000
|
+
width: computedWidth,
|
|
13001
|
+
height: computedHeight
|
|
13002
|
+
});
|
|
13003
|
+
}
|
|
12921
13004
|
if (props.outline) {
|
|
12922
13005
|
const xValues = props.outline.map((point) => point.x);
|
|
12923
13006
|
const yValues = props.outline.map((point) => point.y);
|
|
@@ -12994,6 +13077,14 @@ var Board = class extends Group6 {
|
|
|
12994
13077
|
for (const error of pcbTracesOutOfBoardErrors) {
|
|
12995
13078
|
db.pcb_trace_error.insert(error);
|
|
12996
13079
|
}
|
|
13080
|
+
const differentNetViaErrors = checkDifferentNetViaSpacing(db.toArray());
|
|
13081
|
+
for (const error of differentNetViaErrors) {
|
|
13082
|
+
db.pcb_via_clearance_error.insert(error);
|
|
13083
|
+
}
|
|
13084
|
+
const sameNetViaErrors = checkSameNetViaSpacing(db.toArray());
|
|
13085
|
+
for (const error of sameNetViaErrors) {
|
|
13086
|
+
db.pcb_via_clearance_error.insert(error);
|
|
13087
|
+
}
|
|
12997
13088
|
}
|
|
12998
13089
|
_emitRenderLifecycleEvent(phase, startOrEnd) {
|
|
12999
13090
|
super._emitRenderLifecycleEvent(phase, startOrEnd);
|
|
@@ -15970,7 +16061,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
15970
16061
|
var package_default = {
|
|
15971
16062
|
name: "@tscircuit/core",
|
|
15972
16063
|
type: "module",
|
|
15973
|
-
version: "0.0.
|
|
16064
|
+
version: "0.0.765",
|
|
15974
16065
|
types: "dist/index.d.ts",
|
|
15975
16066
|
main: "dist/index.js",
|
|
15976
16067
|
module: "dist/index.js",
|
|
@@ -16000,7 +16091,7 @@ var package_default = {
|
|
|
16000
16091
|
devDependencies: {
|
|
16001
16092
|
"@biomejs/biome": "^1.8.3",
|
|
16002
16093
|
"@tscircuit/capacity-autorouter": "^0.0.129",
|
|
16003
|
-
"@tscircuit/checks": "^0.0.
|
|
16094
|
+
"@tscircuit/checks": "^0.0.84",
|
|
16004
16095
|
"@tscircuit/circuit-json-util": "^0.0.67",
|
|
16005
16096
|
"@tscircuit/footprinter": "^0.0.236",
|
|
16006
16097
|
"@tscircuit/import-snippet": "^0.0.4",
|
|
@@ -16022,7 +16113,7 @@ var package_default = {
|
|
|
16022
16113
|
"bun-match-svg": "0.0.12",
|
|
16023
16114
|
"calculate-elbow": "^0.0.12",
|
|
16024
16115
|
"chokidar-cli": "^3.0.0",
|
|
16025
|
-
"circuit-json": "^0.0.
|
|
16116
|
+
"circuit-json": "^0.0.272",
|
|
16026
16117
|
"circuit-json-to-bpc": "^0.0.13",
|
|
16027
16118
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
16028
16119
|
"circuit-json-to-gltf": "^0.0.7",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.766",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@biomejs/biome": "^1.8.3",
|
|
33
33
|
"@tscircuit/capacity-autorouter": "^0.0.129",
|
|
34
|
-
"@tscircuit/checks": "^0.0.
|
|
34
|
+
"@tscircuit/checks": "^0.0.84",
|
|
35
35
|
"@tscircuit/circuit-json-util": "^0.0.67",
|
|
36
36
|
"@tscircuit/footprinter": "^0.0.236",
|
|
37
37
|
"@tscircuit/import-snippet": "^0.0.4",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"bun-match-svg": "0.0.12",
|
|
54
54
|
"calculate-elbow": "^0.0.12",
|
|
55
55
|
"chokidar-cli": "^3.0.0",
|
|
56
|
-
"circuit-json": "^0.0.
|
|
56
|
+
"circuit-json": "^0.0.272",
|
|
57
57
|
"circuit-json-to-bpc": "^0.0.13",
|
|
58
58
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
59
59
|
"circuit-json-to-gltf": "^0.0.7",
|