@tscircuit/core 0.0.1923 → 0.0.1924
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.js +19 -213
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -16618,7 +16618,7 @@ import {
|
|
|
16618
16618
|
} from "@tscircuit/checks";
|
|
16619
16619
|
import { getBoundsFromPoints as getBoundsFromPoints10 } from "@tscircuit/math-utils";
|
|
16620
16620
|
import { boardProps } from "@tscircuit/props";
|
|
16621
|
-
import { compose as
|
|
16621
|
+
import { compose as compose15, translate as translate15 } from "transformation-matrix";
|
|
16622
16622
|
|
|
16623
16623
|
// lib/utils/autorouting/getAncestorSubcircuitIds.ts
|
|
16624
16624
|
var getDescendantSubcircuitIds = (db, root_subcircuit_id) => {
|
|
@@ -63283,7 +63283,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
63283
63283
|
var package_default = {
|
|
63284
63284
|
name: "@tscircuit/core",
|
|
63285
63285
|
type: "module",
|
|
63286
|
-
version: "0.0.
|
|
63286
|
+
version: "0.0.1923",
|
|
63287
63287
|
types: "dist/index.d.ts",
|
|
63288
63288
|
main: "dist/index.js",
|
|
63289
63289
|
module: "dist/index.js",
|
|
@@ -63319,8 +63319,8 @@ var package_default = {
|
|
|
63319
63319
|
"@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
|
|
63320
63320
|
"@tscircuit/bus-lanes-solver": "github:tscircuit/bus-lanes-solver#0bc8d071241b18a3e7465a878881abe4998f6384",
|
|
63321
63321
|
"@tscircuit/capacity-autorouter": "^0.0.900",
|
|
63322
|
-
"@tscircuit/checks": "^0.0.
|
|
63323
|
-
"@tscircuit/circuit-json-util": "^0.0.
|
|
63322
|
+
"@tscircuit/checks": "^0.0.195",
|
|
63323
|
+
"@tscircuit/circuit-json-util": "^0.0.114",
|
|
63324
63324
|
"@tscircuit/common": "^0.0.20",
|
|
63325
63325
|
"@tscircuit/copper-pour-solver": "^0.0.54",
|
|
63326
63326
|
"@tscircuit/create-fdm-enclosure": "0.0.4",
|
|
@@ -63415,7 +63415,7 @@ var package_default = {
|
|
|
63415
63415
|
zod: "^3.25.67"
|
|
63416
63416
|
},
|
|
63417
63417
|
overrides: {
|
|
63418
|
-
"@tscircuit/circuit-json-util": "^0.0.
|
|
63418
|
+
"@tscircuit/circuit-json-util": "^0.0.114",
|
|
63419
63419
|
"@tscircuit/props": "^0.0.660",
|
|
63420
63420
|
"circuit-json": "^0.0.489"
|
|
63421
63421
|
}
|
|
@@ -68727,208 +68727,14 @@ import {
|
|
|
68727
68727
|
getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson5
|
|
68728
68728
|
} from "circuit-json-to-connectivity-map";
|
|
68729
68729
|
import Flatbush from "flatbush";
|
|
68730
|
-
|
|
68731
|
-
// lib/utils/copper-pour-connectivity/copper-geometry.ts
|
|
68732
68730
|
import {
|
|
68733
|
-
|
|
68734
|
-
|
|
68735
|
-
|
|
68736
|
-
|
|
68737
|
-
|
|
68738
|
-
|
|
68739
|
-
|
|
68740
|
-
Segment
|
|
68741
|
-
} from "@flatten-js/core";
|
|
68742
|
-
import { compose as compose15, rotate as rotate7, translate as translate15 } from "transformation-matrix";
|
|
68743
|
-
var placePolygon = (polygon, center, degrees = 0) => {
|
|
68744
|
-
const { a, b, c, d, e, f } = compose15(
|
|
68745
|
-
translate15(center.x, center.y),
|
|
68746
|
-
rotate7(degrees * Math.PI / 180)
|
|
68747
|
-
);
|
|
68748
|
-
return polygon.transform(new Matrix(a, b, c, d, e, f));
|
|
68749
|
-
};
|
|
68750
|
-
var ccw = (polygon) => polygon.orientation() === ORIENTATION.CCW ? polygon : polygon.reverse();
|
|
68751
|
-
var circlePolygon = (center, radius) => ccw(new Polygon2(new Circle(new Point(center.x, center.y), radius)));
|
|
68752
|
-
var roundedRectangle = (center, width, height, radius = 0, degrees = 0) => {
|
|
68753
|
-
const x = width / 2;
|
|
68754
|
-
const y = height / 2;
|
|
68755
|
-
const r = Math.max(0, Math.min(radius, x, y));
|
|
68756
|
-
if (r === 0)
|
|
68757
|
-
return placePolygon(
|
|
68758
|
-
ccw(new Polygon2(new Box2(-x, -y, x, y))),
|
|
68759
|
-
center,
|
|
68760
|
-
degrees
|
|
68761
|
-
);
|
|
68762
|
-
const arcs = [
|
|
68763
|
-
new Arc(new Point(x - r, -y + r), r, -Math.PI / 2, 0, true),
|
|
68764
|
-
new Arc(new Point(x - r, y - r), r, 0, Math.PI / 2, true),
|
|
68765
|
-
new Arc(new Point(-x + r, y - r), r, Math.PI / 2, Math.PI, true),
|
|
68766
|
-
new Arc(new Point(-x + r, -y + r), r, Math.PI, Math.PI * 1.5, true)
|
|
68767
|
-
];
|
|
68768
|
-
const edges = [];
|
|
68769
|
-
for (let i = 0; i < arcs.length; i++) {
|
|
68770
|
-
const arc = arcs[i];
|
|
68771
|
-
const next = arcs[(i + 1) % arcs.length];
|
|
68772
|
-
edges.push(arc);
|
|
68773
|
-
if (arc.end.distanceTo(next.start)[0] > 1e-12)
|
|
68774
|
-
edges.push(new Segment(arc.end, next.start));
|
|
68775
|
-
}
|
|
68776
|
-
return placePolygon(ccw(new Polygon2(edges)), center, degrees);
|
|
68777
|
-
};
|
|
68778
|
-
var ringPolygon = (ring) => {
|
|
68779
|
-
const edges = [];
|
|
68780
|
-
for (let i = 0; i < ring.vertices.length; i++) {
|
|
68781
|
-
const start = ring.vertices[i];
|
|
68782
|
-
const end = ring.vertices[(i + 1) % ring.vertices.length];
|
|
68783
|
-
const dx = end.x - start.x;
|
|
68784
|
-
const dy = end.y - start.y;
|
|
68785
|
-
if (dx === 0 && dy === 0) continue;
|
|
68786
|
-
const bulge = start.bulge ?? 0;
|
|
68787
|
-
if (bulge === 0) {
|
|
68788
|
-
edges.push(
|
|
68789
|
-
new Segment(new Point(start.x, start.y), new Point(end.x, end.y))
|
|
68790
|
-
);
|
|
68791
|
-
} else {
|
|
68792
|
-
const offset = (1 - bulge * bulge) / (4 * bulge);
|
|
68793
|
-
const center = new Point(
|
|
68794
|
-
(start.x + end.x) / 2 - dy * offset,
|
|
68795
|
-
(start.y + end.y) / 2 + dx * offset
|
|
68796
|
-
);
|
|
68797
|
-
edges.push(
|
|
68798
|
-
new Arc(
|
|
68799
|
-
center,
|
|
68800
|
-
Math.hypot(dx, dy) * (1 + bulge * bulge) / (4 * Math.abs(bulge)),
|
|
68801
|
-
Math.atan2(start.y - center.y, start.x - center.x),
|
|
68802
|
-
Math.atan2(end.y - center.y, end.x - center.x),
|
|
68803
|
-
bulge > 0
|
|
68804
|
-
)
|
|
68805
|
-
);
|
|
68806
|
-
}
|
|
68807
|
-
}
|
|
68808
|
-
return ccw(new Polygon2(edges));
|
|
68809
|
-
};
|
|
68810
|
-
var subtractHole = (outer, hole) => {
|
|
68811
|
-
for (const face of hole.reverse().faces) outer.addFace(face.shapes);
|
|
68812
|
-
return outer;
|
|
68813
|
-
};
|
|
68814
|
-
var getPourPolygon = (pour) => {
|
|
68815
|
-
if (pour.shape === "rect")
|
|
68816
|
-
return roundedRectangle(
|
|
68817
|
-
pour.center,
|
|
68818
|
-
pour.width,
|
|
68819
|
-
pour.height,
|
|
68820
|
-
0,
|
|
68821
|
-
pour.rotation
|
|
68822
|
-
);
|
|
68823
|
-
if (pour.shape === "polygon")
|
|
68824
|
-
return ccw(new Polygon2(pour.points.map((p) => new Point(p.x, p.y))));
|
|
68825
|
-
const polygon = ringPolygon(pour.brep_shape.outer_ring);
|
|
68826
|
-
for (const ring of pour.brep_shape.inner_rings)
|
|
68827
|
-
subtractHole(polygon, ringPolygon(ring));
|
|
68828
|
-
return polygon;
|
|
68829
|
-
};
|
|
68830
|
-
var getSmtPadPolygon = (pad) => {
|
|
68831
|
-
if (pad.shape === "polygon")
|
|
68832
|
-
return ccw(new Polygon2(pad.points.map((p) => new Point(p.x, p.y))));
|
|
68833
|
-
if (pad.shape === "circle") return circlePolygon(pad, pad.radius);
|
|
68834
|
-
const radius = pad.shape === "pill" || pad.shape === "rotated_pill" ? pad.radius : pad.corner_radius ?? pad.rect_border_radius ?? 0;
|
|
68835
|
-
return roundedRectangle(
|
|
68836
|
-
pad,
|
|
68837
|
-
pad.width,
|
|
68838
|
-
pad.height,
|
|
68839
|
-
radius,
|
|
68840
|
-
"ccw_rotation" in pad ? pad.ccw_rotation : 0
|
|
68841
|
-
);
|
|
68842
|
-
};
|
|
68843
|
-
var getViaPolygon = (center, outerDiameter, holeDiameter) => subtractHole(
|
|
68844
|
-
circlePolygon(center, outerDiameter / 2),
|
|
68845
|
-
circlePolygon(center, holeDiameter / 2)
|
|
68846
|
-
);
|
|
68847
|
-
var getPlatedHolePolygon = (pad, componentRotation = 0) => {
|
|
68848
|
-
if (pad.shape === "circle")
|
|
68849
|
-
return getViaPolygon(pad, pad.outer_diameter, pad.hole_diameter);
|
|
68850
|
-
if ("outer_width" in pad) {
|
|
68851
|
-
return subtractHole(
|
|
68852
|
-
roundedRectangle(
|
|
68853
|
-
pad,
|
|
68854
|
-
pad.outer_width,
|
|
68855
|
-
pad.outer_height,
|
|
68856
|
-
Math.min(pad.outer_width, pad.outer_height) / 2,
|
|
68857
|
-
pad.ccw_rotation
|
|
68858
|
-
),
|
|
68859
|
-
roundedRectangle(
|
|
68860
|
-
pad,
|
|
68861
|
-
pad.hole_width,
|
|
68862
|
-
pad.hole_height,
|
|
68863
|
-
Math.min(pad.hole_width, pad.hole_height) / 2,
|
|
68864
|
-
pad.ccw_rotation
|
|
68865
|
-
)
|
|
68866
|
-
);
|
|
68867
|
-
}
|
|
68868
|
-
const center = { x: pad.x + pad.hole_offset_x, y: pad.y + pad.hole_offset_y };
|
|
68869
|
-
const outer = pad.shape === "hole_with_polygon_pad" ? placePolygon(
|
|
68870
|
-
ccw(new Polygon2(pad.pad_outline.map((p) => new Point(p.x, p.y)))),
|
|
68871
|
-
pad,
|
|
68872
|
-
pad.ccw_rotation ?? componentRotation
|
|
68873
|
-
) : roundedRectangle(
|
|
68874
|
-
pad,
|
|
68875
|
-
pad.rect_pad_width,
|
|
68876
|
-
pad.rect_pad_height,
|
|
68877
|
-
pad.rect_border_radius,
|
|
68878
|
-
"rect_ccw_rotation" in pad ? pad.rect_ccw_rotation : 0
|
|
68879
|
-
);
|
|
68880
|
-
if (pad.shape === "circular_hole_with_rect_pad" || pad.shape === "hole_with_polygon_pad" && pad.hole_shape === "circle") {
|
|
68881
|
-
if (pad.hole_diameter === void 0)
|
|
68882
|
-
throw new Error("Circular plated hole requires hole_diameter");
|
|
68883
|
-
return subtractHole(outer, circlePolygon(center, pad.hole_diameter / 2));
|
|
68884
|
-
}
|
|
68885
|
-
if (!("hole_width" in pad) || pad.hole_width === void 0 || pad.hole_height === void 0)
|
|
68886
|
-
throw new Error("Slotted plated hole requires hole_width and hole_height");
|
|
68887
|
-
return subtractHole(
|
|
68888
|
-
outer,
|
|
68889
|
-
roundedRectangle(
|
|
68890
|
-
center,
|
|
68891
|
-
pad.hole_width,
|
|
68892
|
-
pad.hole_height,
|
|
68893
|
-
Math.min(pad.hole_width, pad.hole_height) / 2,
|
|
68894
|
-
"hole_ccw_rotation" in pad ? pad.hole_ccw_rotation : pad.shape === "hole_with_polygon_pad" ? pad.ccw_rotation ?? componentRotation : 0
|
|
68895
|
-
)
|
|
68896
|
-
);
|
|
68897
|
-
};
|
|
68898
|
-
var getTraceSegmentPolygon = (start, end, startWidth, endWidth = startWidth) => {
|
|
68899
|
-
const length8 = Math.hypot(end.x - start.x, end.y - start.y);
|
|
68900
|
-
const r1 = startWidth / 2;
|
|
68901
|
-
const r2 = endWidth / 2;
|
|
68902
|
-
if (length8 <= Math.abs(r2 - r1))
|
|
68903
|
-
return circlePolygon(r1 >= r2 ? start : end, Math.max(r1, r2));
|
|
68904
|
-
const angle = Math.atan2(end.y - start.y, end.x - start.x);
|
|
68905
|
-
const tangent = Math.acos((r1 - r2) / length8);
|
|
68906
|
-
const first = new Arc(
|
|
68907
|
-
new Point(start.x, start.y),
|
|
68908
|
-
r1,
|
|
68909
|
-
angle + tangent,
|
|
68910
|
-
angle - tangent,
|
|
68911
|
-
true
|
|
68912
|
-
);
|
|
68913
|
-
const second = new Arc(
|
|
68914
|
-
new Point(end.x, end.y),
|
|
68915
|
-
r2,
|
|
68916
|
-
angle - tangent,
|
|
68917
|
-
angle + tangent,
|
|
68918
|
-
true
|
|
68919
|
-
);
|
|
68920
|
-
return ccw(
|
|
68921
|
-
new Polygon2([
|
|
68922
|
-
first,
|
|
68923
|
-
new Segment(first.end, second.start),
|
|
68924
|
-
second,
|
|
68925
|
-
new Segment(second.end, first.start)
|
|
68926
|
-
])
|
|
68927
|
-
);
|
|
68928
|
-
};
|
|
68929
|
-
var copperPolygonsTouch = (a, b, tolerance = 1e-7) => a.vertices.some((p) => b.contains(p)) || b.vertices.some((p) => a.contains(p)) || a.distanceTo(b)[0] <= tolerance;
|
|
68930
|
-
|
|
68931
|
-
// lib/utils/copper-pour-connectivity/find-floating-copper.ts
|
|
68731
|
+
copperPolygonsTouch,
|
|
68732
|
+
getPlatedHolePolygon,
|
|
68733
|
+
getPourPolygon,
|
|
68734
|
+
getSmtPadPolygon,
|
|
68735
|
+
getTraceSegmentPolygon,
|
|
68736
|
+
getViaPolygon
|
|
68737
|
+
} from "@tscircuit/circuit-json-util";
|
|
68932
68738
|
var GEOMETRY_SCALE = 1e6;
|
|
68933
68739
|
var CONTACT_TOLERANCE = 1e-7 * GEOMETRY_SCALE;
|
|
68934
68740
|
var getRouteEndpoint = (routePoint, side) => {
|
|
@@ -69431,9 +69237,9 @@ var Board = class extends Group5 {
|
|
|
69431
69237
|
_computePcbGlobalTransformBeforeLayout() {
|
|
69432
69238
|
if (this._panelPositionOffset) {
|
|
69433
69239
|
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };
|
|
69434
|
-
return
|
|
69240
|
+
return compose15(
|
|
69435
69241
|
parentTransform,
|
|
69436
|
-
|
|
69242
|
+
translate15(this._panelPositionOffset.x, this._panelPositionOffset.y)
|
|
69437
69243
|
);
|
|
69438
69244
|
}
|
|
69439
69245
|
return super._computePcbGlobalTransformBeforeLayout();
|
|
@@ -70078,11 +69884,11 @@ import { distance as distance21 } from "circuit-json";
|
|
|
70078
69884
|
// lib/components/normal-components/Subpanel.ts
|
|
70079
69885
|
import { subpanelProps } from "@tscircuit/props";
|
|
70080
69886
|
import { distance as distance20 } from "circuit-json";
|
|
70081
|
-
import { compose as
|
|
69887
|
+
import { compose as compose16, identity as identity8, translate as translate16 } from "transformation-matrix";
|
|
70082
69888
|
|
|
70083
69889
|
// lib/utils/panels/generate-panel-tabs-and-mouse-bites.ts
|
|
70084
69890
|
import * as Flatten from "@flatten-js/core";
|
|
70085
|
-
import { point as point5, Polygon as
|
|
69891
|
+
import { point as point5, Polygon as Polygon3 } from "@flatten-js/core";
|
|
70086
69892
|
var DEFAULT_TAB_LENGTH = 5;
|
|
70087
69893
|
var DEFAULT_TAB_WIDTH = 2;
|
|
70088
69894
|
var generateCutoutsAndMousebitesForOutline = (outline, options) => {
|
|
@@ -70218,7 +70024,7 @@ function generatePanelTabsAndMouseBites(boards, options) {
|
|
|
70218
70024
|
if (board.width && board.height) {
|
|
70219
70025
|
boardDimensions.push(Math.min(board.width, board.height));
|
|
70220
70026
|
} else if (board.outline && board.outline.length > 0) {
|
|
70221
|
-
const outlinePolygon = new
|
|
70027
|
+
const outlinePolygon = new Polygon3(
|
|
70222
70028
|
board.outline.map((p) => point5(p.x, p.y))
|
|
70223
70029
|
);
|
|
70224
70030
|
const area = Math.abs(outlinePolygon.area());
|
|
@@ -70590,9 +70396,9 @@ var Subpanel = class _Subpanel extends Group5 {
|
|
|
70590
70396
|
_computePcbGlobalTransformBeforeLayout() {
|
|
70591
70397
|
if (this._panelPositionOffset) {
|
|
70592
70398
|
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? identity8();
|
|
70593
|
-
return
|
|
70399
|
+
return compose16(
|
|
70594
70400
|
parentTransform,
|
|
70595
|
-
|
|
70401
|
+
translate16(this._panelPositionOffset.x, this._panelPositionOffset.y)
|
|
70596
70402
|
);
|
|
70597
70403
|
}
|
|
70598
70404
|
return super._computePcbGlobalTransformBeforeLayout();
|
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.1924",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
|
|
38
38
|
"@tscircuit/bus-lanes-solver": "github:tscircuit/bus-lanes-solver#0bc8d071241b18a3e7465a878881abe4998f6384",
|
|
39
39
|
"@tscircuit/capacity-autorouter": "^0.0.900",
|
|
40
|
-
"@tscircuit/checks": "^0.0.
|
|
41
|
-
"@tscircuit/circuit-json-util": "^0.0.
|
|
40
|
+
"@tscircuit/checks": "^0.0.195",
|
|
41
|
+
"@tscircuit/circuit-json-util": "^0.0.114",
|
|
42
42
|
"@tscircuit/common": "^0.0.20",
|
|
43
43
|
"@tscircuit/copper-pour-solver": "^0.0.54",
|
|
44
44
|
"@tscircuit/create-fdm-enclosure": "0.0.4",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"zod": "^3.25.67"
|
|
134
134
|
},
|
|
135
135
|
"overrides": {
|
|
136
|
-
"@tscircuit/circuit-json-util": "^0.0.
|
|
136
|
+
"@tscircuit/circuit-json-util": "^0.0.114",
|
|
137
137
|
"@tscircuit/props": "^0.0.660",
|
|
138
138
|
"circuit-json": "^0.0.489"
|
|
139
139
|
}
|