@tscircuit/core 0.0.83 → 0.0.85
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 +27 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -771,7 +771,7 @@ var Footprint = class extends PrimitiveComponent {
|
|
|
771
771
|
};
|
|
772
772
|
|
|
773
773
|
// lib/components/base-components/NormalComponent.ts
|
|
774
|
-
import "zod";
|
|
774
|
+
import { z as z4 } from "zod";
|
|
775
775
|
|
|
776
776
|
// lib/components/primitive-components/Port.ts
|
|
777
777
|
import { z as z2 } from "zod";
|
|
@@ -1733,6 +1733,12 @@ function getBoundsOfPcbComponents(components) {
|
|
|
1733
1733
|
}
|
|
1734
1734
|
|
|
1735
1735
|
// lib/components/base-components/NormalComponent.ts
|
|
1736
|
+
import { rotation } from "circuit-json";
|
|
1737
|
+
var rotation3 = z4.object({
|
|
1738
|
+
x: rotation,
|
|
1739
|
+
y: rotation,
|
|
1740
|
+
z: rotation
|
|
1741
|
+
});
|
|
1736
1742
|
var NormalComponent = class extends PrimitiveComponent {
|
|
1737
1743
|
reactSubtrees = [];
|
|
1738
1744
|
isPrimitiveContainer = true;
|
|
@@ -1789,7 +1795,9 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
1789
1795
|
existingPort.props.name = label;
|
|
1790
1796
|
}
|
|
1791
1797
|
}
|
|
1792
|
-
|
|
1798
|
+
if (portsToCreate.length > 0) {
|
|
1799
|
+
this.addAll(portsToCreate);
|
|
1800
|
+
}
|
|
1793
1801
|
}
|
|
1794
1802
|
_addChildrenFromStringFootprint() {
|
|
1795
1803
|
const { footprint } = this.props;
|
|
@@ -1968,11 +1976,6 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
1968
1976
|
if (!newPort) continue;
|
|
1969
1977
|
newPorts2.push(newPort);
|
|
1970
1978
|
}
|
|
1971
|
-
if (newPorts2.length === 0) {
|
|
1972
|
-
throw new Error(
|
|
1973
|
-
`No ports found in chip ${this} (define a schPortArrangement, a footprint or add portHints to elements of the footprint)`
|
|
1974
|
-
);
|
|
1975
|
-
}
|
|
1976
1979
|
return newPorts2;
|
|
1977
1980
|
}
|
|
1978
1981
|
const newPorts = [];
|
|
@@ -2038,14 +2041,19 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2038
2041
|
doInitialCadModelRender() {
|
|
2039
2042
|
const { db } = this.root;
|
|
2040
2043
|
const { boardThickness = 0 } = this.root?._getBoard() ?? {};
|
|
2041
|
-
const
|
|
2042
|
-
if (
|
|
2044
|
+
const cadModel = this._parsedProps.cadModel;
|
|
2045
|
+
if (cadModel) {
|
|
2043
2046
|
const bounds = this._getPcbCircuitJsonBounds();
|
|
2044
2047
|
const pcb_component = db.pcb_component.get(this.pcb_component_id);
|
|
2045
|
-
const cadModel = props.cadModel;
|
|
2046
2048
|
if (typeof cadModel === "string") {
|
|
2047
2049
|
throw new Error("String cadModel not yet implemented");
|
|
2048
2050
|
}
|
|
2051
|
+
const rotationOffset = rotation3.parse({
|
|
2052
|
+
x: 0,
|
|
2053
|
+
y: 0,
|
|
2054
|
+
z: typeof cadModel.rotationOffset === "number" ? cadModel.rotationOffset : 0,
|
|
2055
|
+
...typeof cadModel.rotationOffset === "object" ? cadModel.rotationOffset ?? {} : {}
|
|
2056
|
+
});
|
|
2049
2057
|
const cad_model = db.cad_component.insert({
|
|
2050
2058
|
// TODO z maybe depends on layer
|
|
2051
2059
|
position: {
|
|
@@ -2054,9 +2062,9 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2054
2062
|
z: this.props.layer === "bottom" ? -boardThickness / 2 : boardThickness / 2
|
|
2055
2063
|
},
|
|
2056
2064
|
rotation: {
|
|
2057
|
-
x:
|
|
2058
|
-
y: this.props.layer === "top" ? 0 : 180,
|
|
2059
|
-
z: (pcb_component?.rotation ?? 0) + (this.props.layer === "bottom" ? 180 : 0)
|
|
2065
|
+
x: rotationOffset.x,
|
|
2066
|
+
y: (this.props.layer === "top" ? 0 : 180) + rotationOffset.y,
|
|
2067
|
+
z: (pcb_component?.rotation ?? 0) + (this.props.layer === "bottom" ? 180 : 0) + rotationOffset.z
|
|
2060
2068
|
},
|
|
2061
2069
|
pcb_component_id: this.pcb_component_id,
|
|
2062
2070
|
source_component_id: this.source_component_id,
|
|
@@ -3017,7 +3025,12 @@ var getAllDimensionsForSchematicBox = (params) => {
|
|
|
3017
3025
|
};
|
|
3018
3026
|
}
|
|
3019
3027
|
if (!sidePinCounts) {
|
|
3020
|
-
|
|
3028
|
+
sidePinCounts = {
|
|
3029
|
+
leftSize: 0,
|
|
3030
|
+
rightSize: 0,
|
|
3031
|
+
topSize: 0,
|
|
3032
|
+
bottomSize: 0
|
|
3033
|
+
};
|
|
3021
3034
|
}
|
|
3022
3035
|
const orderedTruePorts = [];
|
|
3023
3036
|
let currentDistanceFromEdge = 0;
|