@tscircuit/core 0.0.2172 → 0.0.2174
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 +7 -5
- package/dist/index.js +128 -70
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3957,9 +3957,9 @@ interface ISymbol {
|
|
|
3957
3957
|
*/
|
|
3958
3958
|
schematic_symbol_id?: string;
|
|
3959
3959
|
/**
|
|
3960
|
-
*
|
|
3961
|
-
*
|
|
3962
|
-
*
|
|
3960
|
+
* Maps pre-resize schematic world points to resized and rotated world points
|
|
3961
|
+
* (mm, +X right, +Y up, right-handed). Includes translation, so directions
|
|
3962
|
+
* must use only its linear part. Computed lazily when first requested.
|
|
3963
3963
|
*/
|
|
3964
3964
|
userCoordinateToResizedSymbolTransformMat?: Matrix;
|
|
3965
3965
|
/**
|
|
@@ -3973,8 +3973,9 @@ interface ISymbol {
|
|
|
3973
3973
|
*/
|
|
3974
3974
|
getSchematicSymbolBounds(): SchematicSymbolBounds | null;
|
|
3975
3975
|
/**
|
|
3976
|
-
* Get the
|
|
3977
|
-
*
|
|
3976
|
+
* Get the point transform for resizing symbol contents and applying the
|
|
3977
|
+
* parent component's schRotation, in the world frame described above.
|
|
3978
|
+
* Returns null if neither resizing nor rotation is needed.
|
|
3978
3979
|
*/
|
|
3979
3980
|
getUserCoordinateToResizedSymbolTransform(): Matrix | null;
|
|
3980
3981
|
/**
|
|
@@ -110860,6 +110861,7 @@ declare const pcbTraceProps: z.ZodObject<{
|
|
|
110860
110861
|
}>;
|
|
110861
110862
|
declare class PcbTrace extends PrimitiveComponent<typeof pcbTraceProps> {
|
|
110862
110863
|
pcb_trace_id: string | null;
|
|
110864
|
+
_materializedRouteViaIndices: Set<number>;
|
|
110863
110865
|
isAntennaTrace: boolean;
|
|
110864
110866
|
isPcbPrimitive: boolean;
|
|
110865
110867
|
get config(): {
|
package/dist/index.js
CHANGED
|
@@ -6074,6 +6074,17 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
6074
6074
|
const schPort = db2.schematic_port.get(this.schematic_port_id);
|
|
6075
6075
|
if (schPort) {
|
|
6076
6076
|
const newCenter = applyToPoint3(transform, schPort.center);
|
|
6077
|
+
const rotation5 = Math.atan2(transform.b, transform.a) * 180 / Math.PI;
|
|
6078
|
+
if (schPort.facing_direction && rotation5 !== 0) {
|
|
6079
|
+
this.facingDirection = rotateDirection(
|
|
6080
|
+
schPort.facing_direction,
|
|
6081
|
+
rotation5
|
|
6082
|
+
);
|
|
6083
|
+
db2.schematic_port.update(this.schematic_port_id, {
|
|
6084
|
+
facing_direction: this.facingDirection,
|
|
6085
|
+
side_of_component: this.facingDirection === "up" ? "top" : this.facingDirection === "down" ? "bottom" : this.facingDirection
|
|
6086
|
+
});
|
|
6087
|
+
}
|
|
6077
6088
|
db2.schematic_port.update(this.schematic_port_id, {
|
|
6078
6089
|
center: newCenter
|
|
6079
6090
|
});
|
|
@@ -11582,6 +11593,8 @@ var pcbTraceProps = z7.object({
|
|
|
11582
11593
|
});
|
|
11583
11594
|
var PcbTrace = class extends PrimitiveComponent2 {
|
|
11584
11595
|
pcb_trace_id = null;
|
|
11596
|
+
// Imported footprints can already supply the physical via as a pcb_via.
|
|
11597
|
+
_materializedRouteViaIndices = /* @__PURE__ */ new Set();
|
|
11585
11598
|
// Marks radiating copper created by Antenna, never its feed connection.
|
|
11586
11599
|
isAntennaTrace = false;
|
|
11587
11600
|
isPcbPrimitive = true;
|
|
@@ -11638,6 +11651,31 @@ var PcbTrace = class extends PrimitiveComponent2 {
|
|
|
11638
11651
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
11639
11652
|
});
|
|
11640
11653
|
this.pcb_trace_id = pcb_trace.pcb_trace_id;
|
|
11654
|
+
const { holeDiameter, padDiameter } = getViaDiameterDefaults(
|
|
11655
|
+
this.getInheritedMergedProperty("pcbStyle")
|
|
11656
|
+
);
|
|
11657
|
+
for (const [routeIndex, point6] of transformedRoute.entries()) {
|
|
11658
|
+
if (point6.route_type !== "via") continue;
|
|
11659
|
+
if (this._materializedRouteViaIndices.has(routeIndex)) continue;
|
|
11660
|
+
db2.pcb_via.insert({
|
|
11661
|
+
pcb_trace_id: pcb_trace.pcb_trace_id,
|
|
11662
|
+
x: point6.x,
|
|
11663
|
+
y: point6.y,
|
|
11664
|
+
hole_diameter: point6.hole_diameter ?? holeDiameter,
|
|
11665
|
+
outer_diameter: point6.outer_diameter ?? padDiameter,
|
|
11666
|
+
layers: getViaSpanLayers({
|
|
11667
|
+
fromLayer: point6.from_layer,
|
|
11668
|
+
toLayer: point6.to_layer,
|
|
11669
|
+
layerCount: subcircuit._getSubcircuitLayerCount()
|
|
11670
|
+
}),
|
|
11671
|
+
from_layer: point6.from_layer,
|
|
11672
|
+
to_layer: point6.to_layer,
|
|
11673
|
+
tented_on_top: point6.tented_on_top,
|
|
11674
|
+
tented_on_bottom: point6.tented_on_bottom,
|
|
11675
|
+
subcircuit_id: pcb_trace.subcircuit_id,
|
|
11676
|
+
pcb_group_id: pcb_trace.pcb_group_id
|
|
11677
|
+
});
|
|
11678
|
+
}
|
|
11641
11679
|
}
|
|
11642
11680
|
getPcbSize() {
|
|
11643
11681
|
const bounds = this._getPcbLocalBoundsBeforeLayout();
|
|
@@ -12300,10 +12338,16 @@ var SchematicArc = class extends PrimitiveComponent2 {
|
|
|
12300
12338
|
x: arc.center.x + arc.radius,
|
|
12301
12339
|
y: arc.center.y
|
|
12302
12340
|
});
|
|
12303
|
-
const newRadius = Math.
|
|
12341
|
+
const newRadius = Math.hypot(
|
|
12342
|
+
edgePoint.x - newCenter.x,
|
|
12343
|
+
edgePoint.y - newCenter.y
|
|
12344
|
+
);
|
|
12345
|
+
const rotation5 = Math.atan2(transform.b, transform.a) * 180 / Math.PI;
|
|
12304
12346
|
db2.schematic_arc.update(this.schematic_arc_id, {
|
|
12305
12347
|
center: { x: newCenter.x, y: newCenter.y },
|
|
12306
|
-
radius: newRadius
|
|
12348
|
+
radius: newRadius,
|
|
12349
|
+
start_angle_degrees: arc.start_angle_degrees + rotation5,
|
|
12350
|
+
end_angle_degrees: arc.end_angle_degrees + rotation5
|
|
12307
12351
|
});
|
|
12308
12352
|
}
|
|
12309
12353
|
};
|
|
@@ -12360,7 +12404,10 @@ var SchematicCircle = class extends PrimitiveComponent2 {
|
|
|
12360
12404
|
x: circle.center.x + circle.radius,
|
|
12361
12405
|
y: circle.center.y
|
|
12362
12406
|
});
|
|
12363
|
-
const newRadius = Math.
|
|
12407
|
+
const newRadius = Math.hypot(
|
|
12408
|
+
edgePoint.x - newCenter.x,
|
|
12409
|
+
edgePoint.y - newCenter.y
|
|
12410
|
+
);
|
|
12364
12411
|
db2.schematic_circle.update(this.schematic_circle_id, {
|
|
12365
12412
|
center: { x: newCenter.x, y: newCenter.y },
|
|
12366
12413
|
radius: newRadius
|
|
@@ -12689,24 +12736,14 @@ var SchematicRect = class extends PrimitiveComponent2 {
|
|
|
12689
12736
|
const { db: db2 } = this.root;
|
|
12690
12737
|
const rect = db2.schematic_rect.get(this.schematic_rect_id);
|
|
12691
12738
|
if (!rect) return;
|
|
12692
|
-
const
|
|
12693
|
-
|
|
12694
|
-
|
|
12695
|
-
});
|
|
12696
|
-
const bottomRight = applyToPoint21(transform, {
|
|
12697
|
-
x: rect.center.x + rect.width / 2,
|
|
12698
|
-
y: rect.center.y - rect.height / 2
|
|
12699
|
-
});
|
|
12700
|
-
const newWidth = Math.abs(bottomRight.x - topLeft.x);
|
|
12701
|
-
const newHeight = Math.abs(topLeft.y - bottomRight.y);
|
|
12702
|
-
const newCenter = {
|
|
12703
|
-
x: (topLeft.x + bottomRight.x) / 2,
|
|
12704
|
-
y: (topLeft.y + bottomRight.y) / 2
|
|
12705
|
-
};
|
|
12739
|
+
const scaleX = Math.hypot(transform.a, transform.b);
|
|
12740
|
+
const scaleY = Math.hypot(transform.c, transform.d);
|
|
12741
|
+
const rotation5 = Math.atan2(transform.b, transform.a) * 180 / Math.PI;
|
|
12706
12742
|
db2.schematic_rect.update(this.schematic_rect_id, {
|
|
12707
|
-
center:
|
|
12708
|
-
width:
|
|
12709
|
-
height:
|
|
12743
|
+
center: applyToPoint21(transform, rect.center),
|
|
12744
|
+
width: rect.width * scaleX,
|
|
12745
|
+
height: rect.height * scaleY,
|
|
12746
|
+
rotation: (rect.rotation ?? 0) + rotation5
|
|
12710
12747
|
});
|
|
12711
12748
|
}
|
|
12712
12749
|
};
|
|
@@ -12759,7 +12796,8 @@ var SchematicText = class extends PrimitiveComponent2 {
|
|
|
12759
12796
|
if (!text) return;
|
|
12760
12797
|
const newPosition = applyToPoint22(transform, text.position);
|
|
12761
12798
|
db2.schematic_text.update(this.schematic_text_id, {
|
|
12762
|
-
position: { x: newPosition.x, y: newPosition.y }
|
|
12799
|
+
position: { x: newPosition.x, y: newPosition.y },
|
|
12800
|
+
rotation: (text.rotation ?? 0) + Math.atan2(transform.b, transform.a) * 180 / Math.PI
|
|
12763
12801
|
});
|
|
12764
12802
|
}
|
|
12765
12803
|
};
|
|
@@ -14018,7 +14056,13 @@ var SolderPaste = class _SolderPaste extends PrimitiveComponent2 {
|
|
|
14018
14056
|
|
|
14019
14057
|
// lib/components/primitive-components/Symbol/Symbol.ts
|
|
14020
14058
|
import { symbolProps } from "@tscircuit/props";
|
|
14021
|
-
import {
|
|
14059
|
+
import {
|
|
14060
|
+
compose as compose7,
|
|
14061
|
+
translate as translate5,
|
|
14062
|
+
scale as scale2,
|
|
14063
|
+
rotateDEG as rotateDEG2,
|
|
14064
|
+
identity as identity7
|
|
14065
|
+
} from "transformation-matrix";
|
|
14022
14066
|
var SymbolComponent = class extends PrimitiveComponent2 {
|
|
14023
14067
|
isPrimitiveContainer = true;
|
|
14024
14068
|
schematic_symbol_id;
|
|
@@ -14059,13 +14103,21 @@ var SymbolComponent = class extends PrimitiveComponent2 {
|
|
|
14059
14103
|
return this.schematicSymbolBoundsInSymbolLocalCoordinateSpace ?? null;
|
|
14060
14104
|
}
|
|
14061
14105
|
getUserCoordinateToResizedSymbolTransform() {
|
|
14062
|
-
if (!this.hasExplicitSize()) {
|
|
14063
|
-
return null;
|
|
14064
|
-
}
|
|
14065
14106
|
if (this.userCoordinateToResizedSymbolTransformMat) {
|
|
14066
14107
|
return this.userCoordinateToResizedSymbolTransformMat;
|
|
14067
14108
|
}
|
|
14068
14109
|
this._computeUserCoordinateToResizedSymbolTransform();
|
|
14110
|
+
const parentNormal = this.getParentNormalComponent();
|
|
14111
|
+
const rotation5 = parentNormal?._parsedProps.schRotation ?? 0;
|
|
14112
|
+
if (parentNormal && rotation5 !== 0) {
|
|
14113
|
+
const center = parentNormal._getGlobalSchematicPositionBeforeLayout();
|
|
14114
|
+
this.userCoordinateToResizedSymbolTransformMat = compose7(
|
|
14115
|
+
translate5(center.x, center.y),
|
|
14116
|
+
rotateDEG2(rotation5),
|
|
14117
|
+
translate5(-center.x, -center.y),
|
|
14118
|
+
this.userCoordinateToResizedSymbolTransformMat ?? identity7()
|
|
14119
|
+
);
|
|
14120
|
+
}
|
|
14069
14121
|
return this.userCoordinateToResizedSymbolTransformMat ?? null;
|
|
14070
14122
|
}
|
|
14071
14123
|
_computeSchematicSymbolBounds() {
|
|
@@ -14125,6 +14177,7 @@ var SymbolComponent = class extends PrimitiveComponent2 {
|
|
|
14125
14177
|
this.schematicSymbolBoundsInSymbolLocalCoordinateSpace = bounds;
|
|
14126
14178
|
}
|
|
14127
14179
|
_computeUserCoordinateToResizedSymbolTransform() {
|
|
14180
|
+
if (!this.hasExplicitSize()) return;
|
|
14128
14181
|
const bounds = this.getSchematicSymbolBounds();
|
|
14129
14182
|
if (!bounds) return;
|
|
14130
14183
|
const { _parsedProps: props } = this;
|
|
@@ -14745,11 +14798,16 @@ var createComponentsFromCircuitJson = ({
|
|
|
14745
14798
|
components.push(silkscreenText);
|
|
14746
14799
|
}
|
|
14747
14800
|
} else if (elm.type === "pcb_trace") {
|
|
14748
|
-
|
|
14749
|
-
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14801
|
+
const pcbTrace = new PcbTrace({ route: elm.route });
|
|
14802
|
+
for (const [routeIndex, point6] of elm.route.entries()) {
|
|
14803
|
+
if (point6.route_type !== "via") continue;
|
|
14804
|
+
if (circuitJson.some(
|
|
14805
|
+
(via) => via.type === "pcb_via" && via.x === point6.x && via.y === point6.y && via.layers.includes(point6.from_layer) && via.layers.includes(point6.to_layer)
|
|
14806
|
+
)) {
|
|
14807
|
+
pcbTrace._materializedRouteViaIndices.add(routeIndex);
|
|
14808
|
+
}
|
|
14809
|
+
}
|
|
14810
|
+
components.push(pcbTrace);
|
|
14753
14811
|
} else if (elm.type === "pcb_via") {
|
|
14754
14812
|
const via = pcb_via2.parse(elm);
|
|
14755
14813
|
const layers = elm.layers ?? [];
|
|
@@ -15857,7 +15915,7 @@ var getComponentsInAssemblyScope = (component) => {
|
|
|
15857
15915
|
var isMountablePart = (part) => part.componentName === "AssemblyMotor" || part.componentName === "AssemblyPart" || part.componentName === "AssemblyPrintedPart";
|
|
15858
15916
|
var isPrintedPart = (part) => part.componentName === "AssemblyPrintedPart";
|
|
15859
15917
|
var isMotor = (part) => part.componentName === "AssemblyMotor";
|
|
15860
|
-
var
|
|
15918
|
+
var identity8 = () => [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
15861
15919
|
var getMountTransformPlacement = (world) => {
|
|
15862
15920
|
const bottom = world[10] < 0;
|
|
15863
15921
|
const sign = bottom ? -1 : 1;
|
|
@@ -15874,7 +15932,7 @@ var faceMatrix = ({
|
|
|
15874
15932
|
}) => {
|
|
15875
15933
|
const up2 = vec3.cross([0, 0, 0], normal, xAxis);
|
|
15876
15934
|
return mat4.targetTo(
|
|
15877
|
-
|
|
15935
|
+
identity8(),
|
|
15878
15936
|
origin,
|
|
15879
15937
|
vec3.subtract([0, 0, 0], origin, normal),
|
|
15880
15938
|
up2
|
|
@@ -15919,7 +15977,7 @@ var findTarget = (owner, selector, parts) => {
|
|
|
15919
15977
|
return { part, face: getFace(part, faceName) };
|
|
15920
15978
|
};
|
|
15921
15979
|
var rootOrientation = (part, placement) => {
|
|
15922
|
-
const result =
|
|
15980
|
+
const result = identity8();
|
|
15923
15981
|
if (isPrintedPart(part)) return result;
|
|
15924
15982
|
if (!isMotor(part)) {
|
|
15925
15983
|
if (!placement)
|
|
@@ -15991,11 +16049,11 @@ var resolvePrintedPartMounts = (component) => {
|
|
|
15991
16049
|
const mating = faceMatrix(face);
|
|
15992
16050
|
mat4.translate(mating, mating, [0, 0, part._parsedProps.mountGap ?? 0]);
|
|
15993
16051
|
mat4.rotateX(mating, mating, Math.PI);
|
|
15994
|
-
const sourceInverse = mat4.invert(
|
|
16052
|
+
const sourceInverse = mat4.invert(identity8(), faceMatrix(sourceFace));
|
|
15995
16053
|
world = mat4.multiply(
|
|
15996
|
-
|
|
16054
|
+
identity8(),
|
|
15997
16055
|
targetWorld,
|
|
15998
|
-
mat4.multiply(
|
|
16056
|
+
mat4.multiply(identity8(), mating, sourceInverse)
|
|
15999
16057
|
);
|
|
16000
16058
|
root = roots.get(target);
|
|
16001
16059
|
}
|
|
@@ -16031,7 +16089,7 @@ var resolvePrintedPartMounts = (component) => {
|
|
|
16031
16089
|
if (!pcbBoard)
|
|
16032
16090
|
throw new Error(`Mounted board "${board.name}" has no PCB geometry`);
|
|
16033
16091
|
const worldFace = mat4.multiply(
|
|
16034
|
-
|
|
16092
|
+
identity8(),
|
|
16035
16093
|
transforms.get(part),
|
|
16036
16094
|
faceMatrix(face)
|
|
16037
16095
|
);
|
|
@@ -16052,7 +16110,7 @@ var resolvePrintedPartMounts = (component) => {
|
|
|
16052
16110
|
}
|
|
16053
16111
|
const boardTransform = board._computePcbGlobalTransformBeforeLayout();
|
|
16054
16112
|
const yaw = Math.atan2(boardTransform.b, boardTransform.a) - Math.atan2(worldFace[1], worldFace[0]);
|
|
16055
|
-
const adjustment = mat4.fromZRotation(
|
|
16113
|
+
const adjustment = mat4.fromZRotation(identity8(), yaw);
|
|
16056
16114
|
const rotatedOrigin = vec3.transformMat4(
|
|
16057
16115
|
[0, 0, 0],
|
|
16058
16116
|
[worldFace[12], worldFace[13], worldFace[14]],
|
|
@@ -16067,7 +16125,7 @@ var resolvePrintedPartMounts = (component) => {
|
|
|
16067
16125
|
if (roots.get(mountedPart) === root)
|
|
16068
16126
|
transforms.set(
|
|
16069
16127
|
mountedPart,
|
|
16070
|
-
mat4.multiply(
|
|
16128
|
+
mat4.multiply(identity8(), adjustment, world)
|
|
16071
16129
|
);
|
|
16072
16130
|
}
|
|
16073
16131
|
if (component === board || isMountablePart(component) && roots.get(component) === root)
|
|
@@ -16343,7 +16401,7 @@ import {
|
|
|
16343
16401
|
applyToPoint as applyToPoint30,
|
|
16344
16402
|
compose as compose8,
|
|
16345
16403
|
flipY as flipY4,
|
|
16346
|
-
identity as
|
|
16404
|
+
identity as identity9,
|
|
16347
16405
|
rotate as rotate3,
|
|
16348
16406
|
translate as translate6
|
|
16349
16407
|
} from "transformation-matrix";
|
|
@@ -16354,7 +16412,7 @@ var renderAssemblyCadModel = (owner, model, placement) => {
|
|
|
16354
16412
|
const transform = compose8(
|
|
16355
16413
|
translate6(placement.position.x, placement.position.y),
|
|
16356
16414
|
rotate3(placement.pcbRotation * Math.PI / 180),
|
|
16357
|
-
bottom ? flipY4() :
|
|
16415
|
+
bottom ? flipY4() : identity9()
|
|
16358
16416
|
);
|
|
16359
16417
|
const xy2 = applyToPoint30(transform, offset);
|
|
16360
16418
|
const authoredRotation = base.pcbRotationOffset ?? base.rotationOffset ?? 0;
|
|
@@ -22637,22 +22695,22 @@ function createElectricalNetIdentity(srj) {
|
|
|
22637
22695
|
function getElectricalNetIdentity(srj) {
|
|
22638
22696
|
const cached = identityCache.get(srj);
|
|
22639
22697
|
if (cached) return cached;
|
|
22640
|
-
const
|
|
22641
|
-
identityCache.set(srj,
|
|
22642
|
-
return
|
|
22698
|
+
const identity14 = createElectricalNetIdentity(srj);
|
|
22699
|
+
identityCache.set(srj, identity14);
|
|
22700
|
+
return identity14;
|
|
22643
22701
|
}
|
|
22644
22702
|
function connectionsShareElectricalNet(srj, firstConnectionName, secondConnectionName) {
|
|
22645
|
-
const
|
|
22646
|
-
const firstNet =
|
|
22647
|
-
const secondNet =
|
|
22703
|
+
const identity14 = getElectricalNetIdentity(srj);
|
|
22704
|
+
const firstNet = identity14.connectionNetKeys.get(firstConnectionName);
|
|
22705
|
+
const secondNet = identity14.connectionNetKeys.get(secondConnectionName);
|
|
22648
22706
|
return firstNet !== void 0 && firstNet === secondNet;
|
|
22649
22707
|
}
|
|
22650
22708
|
function obstacleSharesElectricalNet(srj, obstacle, connectionName) {
|
|
22651
|
-
const
|
|
22652
|
-
const connectionNet =
|
|
22709
|
+
const identity14 = getElectricalNetIdentity(srj);
|
|
22710
|
+
const connectionNet = identity14.connectionNetKeys.get(connectionName);
|
|
22653
22711
|
if (!connectionNet) return false;
|
|
22654
22712
|
for (const token of obstacle.connectedTo)
|
|
22655
|
-
if (
|
|
22713
|
+
if (identity14.tokenNetKeys.get(token) === connectionNet) return true;
|
|
22656
22714
|
return false;
|
|
22657
22715
|
}
|
|
22658
22716
|
|
|
@@ -36271,8 +36329,8 @@ function layerSequences(bus) {
|
|
|
36271
36329
|
(connections) => connections.toSorted((a2, b2) => {
|
|
36272
36330
|
const delta = (a2.exitTargetPoint ?? a2.targetPoint)[axis] - (b2.exitTargetPoint ?? b2.targetPoint)[axis];
|
|
36273
36331
|
if (delta !== 0) return delta;
|
|
36274
|
-
const
|
|
36275
|
-
return
|
|
36332
|
+
const identity14 = (c2) => "source_trace_id" in c2.connection && typeof c2.connection.source_trace_id === "string" ? c2.connection.source_trace_id : c2.connection.name;
|
|
36333
|
+
return identity14(a2).localeCompare(identity14(b2)) || a2.connection.name.localeCompare(b2.connection.name) || a2.connectionIndex - b2.connectionIndex;
|
|
36276
36334
|
})
|
|
36277
36335
|
);
|
|
36278
36336
|
}
|
|
@@ -84640,7 +84698,7 @@ import {
|
|
|
84640
84698
|
import {
|
|
84641
84699
|
applyToPoint as applyToPoint34,
|
|
84642
84700
|
compose as compose12,
|
|
84643
|
-
rotateDEG as
|
|
84701
|
+
rotateDEG as rotateDEG3,
|
|
84644
84702
|
translate as translate10
|
|
84645
84703
|
} from "transformation-matrix";
|
|
84646
84704
|
var rectTransforms = /* @__PURE__ */ new WeakMap();
|
|
@@ -84651,13 +84709,13 @@ var getRectTransforms = (primitive) => {
|
|
|
84651
84709
|
// compose applies the rightmost operation first: move the world point to
|
|
84652
84710
|
// the rectangle origin, then undo its counter-clockwise rotation.
|
|
84653
84711
|
toLocal: compose12(
|
|
84654
|
-
|
|
84712
|
+
rotateDEG3(-primitive.rotation),
|
|
84655
84713
|
translate10(-primitive.x, -primitive.y)
|
|
84656
84714
|
),
|
|
84657
84715
|
// Rotate a rectangle-local point before translating it into board space.
|
|
84658
84716
|
toWorld: compose12(
|
|
84659
84717
|
translate10(primitive.x, primitive.y),
|
|
84660
|
-
|
|
84718
|
+
rotateDEG3(primitive.rotation)
|
|
84661
84719
|
)
|
|
84662
84720
|
};
|
|
84663
84721
|
rectTransforms.set(primitive, transforms);
|
|
@@ -85385,7 +85443,7 @@ import {
|
|
|
85385
85443
|
import {
|
|
85386
85444
|
applyToPoints,
|
|
85387
85445
|
compose as compose14,
|
|
85388
|
-
rotateDEG as
|
|
85446
|
+
rotateDEG as rotateDEG4,
|
|
85389
85447
|
translate as translate12
|
|
85390
85448
|
} from "transformation-matrix";
|
|
85391
85449
|
var DEFAULT_GRID_PITCH = 0.25;
|
|
@@ -85416,7 +85474,7 @@ var addPillPrimitive = (primitives, params) => {
|
|
|
85416
85474
|
const halfAxis = axisLength / 2;
|
|
85417
85475
|
const axisToWorld = compose14(
|
|
85418
85476
|
translate12(x2, y2),
|
|
85419
|
-
|
|
85477
|
+
rotateDEG4(rotation5 + (height > width ? 90 : 0))
|
|
85420
85478
|
);
|
|
85421
85479
|
const [start, end] = applyToPoints(axisToWorld, [
|
|
85422
85480
|
{ x: -halfAxis, y: 0 },
|
|
@@ -114889,7 +114947,7 @@ import Debug13 from "debug";
|
|
|
114889
114947
|
import { netLabelProps } from "@tscircuit/props";
|
|
114890
114948
|
import {
|
|
114891
114949
|
applyToPoint as applyToPoint37,
|
|
114892
|
-
identity as
|
|
114950
|
+
identity as identity10,
|
|
114893
114951
|
translate as translate15
|
|
114894
114952
|
} from "transformation-matrix";
|
|
114895
114953
|
import { calculateElbow as calculateElbow3 } from "calculate-elbow";
|
|
@@ -114954,7 +115012,7 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
114954
115012
|
if (connectedPorts.length > 0) {
|
|
114955
115013
|
const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
|
|
114956
115014
|
const parentCenter = applyToPoint37(
|
|
114957
|
-
this.parent?.computeSchematicGlobalTransform?.() ??
|
|
115015
|
+
this.parent?.computeSchematicGlobalTransform?.() ?? identity10(),
|
|
114958
115016
|
{ x: 0, y: 0 }
|
|
114959
115017
|
);
|
|
114960
115018
|
return translate15(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
|
|
@@ -119498,7 +119556,7 @@ var RoutingPhasePreparationError = class extends Error {
|
|
|
119498
119556
|
var package_default = {
|
|
119499
119557
|
name: "@tscircuit/core",
|
|
119500
119558
|
type: "module",
|
|
119501
|
-
version: "0.0.
|
|
119559
|
+
version: "0.0.2173",
|
|
119502
119560
|
types: "dist/index.d.ts",
|
|
119503
119561
|
main: "dist/index.js",
|
|
119504
119562
|
module: "dist/index.js",
|
|
@@ -120265,7 +120323,7 @@ function getAccumulatedPcbTracesWithStageOutputReplacements({
|
|
|
120265
120323
|
// lib/components/primitive-components/Group/get-source-trace-id-for-routed-trace.ts
|
|
120266
120324
|
import { distance as distance19, pointToSegmentDistance as pointToSegmentDistance5 } from "@tscircuit/math-utils";
|
|
120267
120325
|
import { ConnectivityMap as ConnectivityMap6 } from "circuit-json-to-connectivity-map";
|
|
120268
|
-
import { applyToPoint as applyToPoint39, rotateDEG as
|
|
120326
|
+
import { applyToPoint as applyToPoint39, rotateDEG as rotateDEG5 } from "transformation-matrix";
|
|
120269
120327
|
var POINT_EPSILON3 = 1e-6;
|
|
120270
120328
|
function isPointOnWireSegment({
|
|
120271
120329
|
point: point6,
|
|
@@ -120283,7 +120341,7 @@ function isPointInSmtPad({
|
|
|
120283
120341
|
traceWidth = 0
|
|
120284
120342
|
}) {
|
|
120285
120343
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
120286
|
-
const unrotatedPoint = pad.shape === "rotated_rect" ? applyToPoint39(
|
|
120344
|
+
const unrotatedPoint = pad.shape === "rotated_rect" ? applyToPoint39(rotateDEG5(-pad.ccw_rotation, pad.x, pad.y), point6) : point6;
|
|
120287
120345
|
return Math.abs(unrotatedPoint.x - pad.x) <= pad.width / 2 + traceWidth / 2 && Math.abs(unrotatedPoint.y - pad.y) <= pad.height / 2 + traceWidth / 2;
|
|
120288
120346
|
}
|
|
120289
120347
|
if (pad.shape === "circle") {
|
|
@@ -124100,7 +124158,7 @@ function createCircuitJsonDatabase() {
|
|
|
124100
124158
|
// lib/IsolatedCircuit.ts
|
|
124101
124159
|
import Debug16 from "debug";
|
|
124102
124160
|
import { isValidElement as isValidElement3 } from "react";
|
|
124103
|
-
import { identity as
|
|
124161
|
+
import { identity as identity11 } from "transformation-matrix";
|
|
124104
124162
|
var IsolatedCircuit = class {
|
|
124105
124163
|
firstChild = null;
|
|
124106
124164
|
children;
|
|
@@ -124322,10 +124380,10 @@ var IsolatedCircuit = class {
|
|
|
124322
124380
|
throw new Error("project.preview is not yet implemented");
|
|
124323
124381
|
}
|
|
124324
124382
|
computeSchematicGlobalTransform() {
|
|
124325
|
-
return
|
|
124383
|
+
return identity11();
|
|
124326
124384
|
}
|
|
124327
124385
|
_computePcbGlobalTransformBeforeLayout() {
|
|
124328
|
-
return
|
|
124386
|
+
return identity11();
|
|
124329
124387
|
}
|
|
124330
124388
|
selectAll(selector) {
|
|
124331
124389
|
this._guessRootComponent();
|
|
@@ -125805,7 +125863,7 @@ import { distance as distance26 } from "circuit-json";
|
|
|
125805
125863
|
// lib/components/normal-components/Subpanel.ts
|
|
125806
125864
|
import { subpanelProps } from "@tscircuit/props";
|
|
125807
125865
|
import { distance as distance25 } from "circuit-json";
|
|
125808
|
-
import { compose as compose19, identity as
|
|
125866
|
+
import { compose as compose19, identity as identity12, translate as translate19 } from "transformation-matrix";
|
|
125809
125867
|
|
|
125810
125868
|
// lib/utils/panels/generate-panel-tabs-and-mouse-bites.ts
|
|
125811
125869
|
import * as Flatten2 from "@flatten-js/core";
|
|
@@ -126316,7 +126374,7 @@ var Subpanel = class _Subpanel extends Group5 {
|
|
|
126316
126374
|
_panelPositionOffset = null;
|
|
126317
126375
|
_computePcbGlobalTransformBeforeLayout() {
|
|
126318
126376
|
if (this._panelPositionOffset) {
|
|
126319
|
-
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ??
|
|
126377
|
+
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? identity12();
|
|
126320
126378
|
return compose19(
|
|
126321
126379
|
parentTransform,
|
|
126322
126380
|
translate19(this._panelPositionOffset.x, this._panelPositionOffset.y)
|
|
@@ -131756,7 +131814,7 @@ var CopperPour = class extends PrimitiveComponent2 {
|
|
|
131756
131814
|
|
|
131757
131815
|
// lib/components/primitive-components/AssemblyDevice.ts
|
|
131758
131816
|
import { assemblyDeviceProps } from "@tscircuit/props";
|
|
131759
|
-
import { identity as
|
|
131817
|
+
import { identity as identity13 } from "transformation-matrix";
|
|
131760
131818
|
|
|
131761
131819
|
// lib/components/primitive-components/resolve-assembly-model.ts
|
|
131762
131820
|
var resolveAssemblyModel = (props) => {
|
|
@@ -131784,10 +131842,10 @@ var AssemblyDevice = class extends PrimitiveComponent2 {
|
|
|
131784
131842
|
doInitialAssignNameToUnnamedComponents() {
|
|
131785
131843
|
}
|
|
131786
131844
|
computeSchematicGlobalTransform() {
|
|
131787
|
-
return
|
|
131845
|
+
return identity13();
|
|
131788
131846
|
}
|
|
131789
131847
|
_computePcbGlobalTransformBeforeLayout() {
|
|
131790
|
-
return
|
|
131848
|
+
return identity13();
|
|
131791
131849
|
}
|
|
131792
131850
|
doInitialSourceRender() {
|
|
131793
131851
|
if (this._parsedProps.modelUrl === void 0 && this._parsedProps.model === void 0 || !this.root)
|