@tscircuit/core 0.0.78 → 0.0.79
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 -0
- package/dist/index.js +21 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,12 @@ declare class Circuit {
|
|
|
17
17
|
_hasRenderedAtleastOnce: boolean;
|
|
18
18
|
constructor();
|
|
19
19
|
add(componentOrElm: PrimitiveComponent | ReactElement): void;
|
|
20
|
+
/**
|
|
21
|
+
* Get the main board for this Circuit.
|
|
22
|
+
*/
|
|
23
|
+
_getBoard(): PrimitiveComponent & {
|
|
24
|
+
boardThickness: number;
|
|
25
|
+
};
|
|
20
26
|
_guessRootComponent(): void;
|
|
21
27
|
render(): void;
|
|
22
28
|
getSoup(): AnySoupElement[];
|
|
@@ -707,6 +713,7 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
707
713
|
}[] | undefined;
|
|
708
714
|
}>;
|
|
709
715
|
};
|
|
716
|
+
get boardThickness(): number;
|
|
710
717
|
doInitialPcbComponentRender(): void;
|
|
711
718
|
removePcbComponentRender(): void;
|
|
712
719
|
_computePcbGlobalTransformBeforeLayout(): Matrix;
|
package/dist/index.js
CHANGED
|
@@ -1984,6 +1984,7 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
1984
1984
|
}
|
|
1985
1985
|
doInitialCadModelRender() {
|
|
1986
1986
|
const { db } = this.root;
|
|
1987
|
+
const { boardThickness = 0 } = this.root?._getBoard() ?? {};
|
|
1987
1988
|
const { _parsedProps: props } = this;
|
|
1988
1989
|
if (props.cadModel) {
|
|
1989
1990
|
const bounds = this._getPcbCircuitJsonBounds();
|
|
@@ -1993,14 +1994,17 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
1993
1994
|
}
|
|
1994
1995
|
const cad_model = db.cad_component.insert({
|
|
1995
1996
|
// TODO z maybe depends on layer
|
|
1996
|
-
position: {
|
|
1997
|
+
position: {
|
|
1998
|
+
x: bounds.center.x,
|
|
1999
|
+
y: bounds.center.y,
|
|
2000
|
+
z: this.props.layer === "bottom" ? -boardThickness / 2 : boardThickness / 2
|
|
2001
|
+
},
|
|
1997
2002
|
pcb_component_id: this.pcb_component_id,
|
|
1998
2003
|
source_component_id: this.source_component_id,
|
|
1999
2004
|
model_stl_url: "stlUrl" in cadModel ? cadModel.stlUrl : void 0,
|
|
2000
2005
|
model_obj_url: "objUrl" in cadModel ? cadModel.objUrl : void 0,
|
|
2001
|
-
model_jscad: "jscad" in cadModel ? cadModel.jscad : void 0
|
|
2002
|
-
|
|
2003
|
-
// footprinter_string:
|
|
2006
|
+
model_jscad: "jscad" in cadModel ? cadModel.jscad : void 0,
|
|
2007
|
+
footprinter_string: typeof this.props.footprint === "string" && !cadModel ? this.props.footprint : void 0
|
|
2004
2008
|
});
|
|
2005
2009
|
}
|
|
2006
2010
|
}
|
|
@@ -2107,6 +2111,10 @@ var Board = class extends Group {
|
|
|
2107
2111
|
zodProps: boardProps
|
|
2108
2112
|
};
|
|
2109
2113
|
}
|
|
2114
|
+
get boardThickness() {
|
|
2115
|
+
const { _parsedProps: props } = this;
|
|
2116
|
+
return 1.4;
|
|
2117
|
+
}
|
|
2110
2118
|
doInitialPcbComponentRender() {
|
|
2111
2119
|
const { db } = this.root;
|
|
2112
2120
|
const { _parsedProps: props } = this;
|
|
@@ -3520,7 +3528,7 @@ var FabricationNotePath = class extends PrimitiveComponent {
|
|
|
3520
3528
|
}
|
|
3521
3529
|
};
|
|
3522
3530
|
|
|
3523
|
-
// lib/
|
|
3531
|
+
// lib/Circuit.ts
|
|
3524
3532
|
import { su } from "@tscircuit/soup-util";
|
|
3525
3533
|
import { isValidElement as isValidElement2 } from "react";
|
|
3526
3534
|
import { identity as identity5 } from "transformation-matrix";
|
|
@@ -3545,6 +3553,14 @@ var Circuit = class {
|
|
|
3545
3553
|
}
|
|
3546
3554
|
this.children.push(component);
|
|
3547
3555
|
}
|
|
3556
|
+
/**
|
|
3557
|
+
* Get the main board for this Circuit.
|
|
3558
|
+
*/
|
|
3559
|
+
_getBoard() {
|
|
3560
|
+
return this.children.find(
|
|
3561
|
+
(c) => c.componentName === "Board"
|
|
3562
|
+
);
|
|
3563
|
+
}
|
|
3548
3564
|
_guessRootComponent() {
|
|
3549
3565
|
if (this.firstChild) return;
|
|
3550
3566
|
if (this.children.length === 1) {
|