@tscircuit/circuit-json-util 0.0.136 → 0.0.137
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 +8 -0
- package/dist/index.js +14 -17
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -3837,6 +3837,7 @@ declare const transformSchematicElement: (elm: AnyCircuitElement, matrix: Matrix
|
|
|
3837
3837
|
schematic_component_id: string;
|
|
3838
3838
|
is_box_with_pins: boolean;
|
|
3839
3839
|
source_component_id?: string | undefined;
|
|
3840
|
+
do_not_place?: boolean | undefined;
|
|
3840
3841
|
subcircuit_id?: string | undefined;
|
|
3841
3842
|
metadata?: zod.objectOutputType<{
|
|
3842
3843
|
kicad_symbol: zod.ZodOptional<zod.ZodObject<{
|
|
@@ -5788,6 +5789,7 @@ declare const transformSchematicElement: (elm: AnyCircuitElement, matrix: Matrix
|
|
|
5788
5789
|
y: number;
|
|
5789
5790
|
} | undefined;
|
|
5790
5791
|
source_trace_id?: string | undefined;
|
|
5792
|
+
font_size?: number | undefined;
|
|
5791
5793
|
schematic_length_unit?: "9.236363636363636mm" | "mm" | "in" | undefined;
|
|
5792
5794
|
schematic_sheet_id?: string | undefined;
|
|
5793
5795
|
symbol_name?: string | undefined;
|
|
@@ -10523,6 +10525,7 @@ declare const transformSchematicElements: (elms: AnyCircuitElement[], matrix: Ma
|
|
|
10523
10525
|
schematic_component_id: string;
|
|
10524
10526
|
is_box_with_pins: boolean;
|
|
10525
10527
|
source_component_id?: string | undefined;
|
|
10528
|
+
do_not_place?: boolean | undefined;
|
|
10526
10529
|
subcircuit_id?: string | undefined;
|
|
10527
10530
|
metadata?: zod.objectOutputType<{
|
|
10528
10531
|
kicad_symbol: zod.ZodOptional<zod.ZodObject<{
|
|
@@ -12474,6 +12477,7 @@ declare const transformSchematicElements: (elms: AnyCircuitElement[], matrix: Ma
|
|
|
12474
12477
|
y: number;
|
|
12475
12478
|
} | undefined;
|
|
12476
12479
|
source_trace_id?: string | undefined;
|
|
12480
|
+
font_size?: number | undefined;
|
|
12477
12481
|
schematic_length_unit?: "9.236363636363636mm" | "mm" | "in" | undefined;
|
|
12478
12482
|
schematic_sheet_id?: string | undefined;
|
|
12479
12483
|
symbol_name?: string | undefined;
|
|
@@ -16744,6 +16748,7 @@ declare const transformPCBElement: (elm: AnyCircuitElement, matrix: Matrix) => {
|
|
|
16744
16748
|
schematic_component_id: string;
|
|
16745
16749
|
is_box_with_pins: boolean;
|
|
16746
16750
|
source_component_id?: string | undefined;
|
|
16751
|
+
do_not_place?: boolean | undefined;
|
|
16747
16752
|
subcircuit_id?: string | undefined;
|
|
16748
16753
|
metadata?: zod.objectOutputType<{
|
|
16749
16754
|
kicad_symbol: zod.ZodOptional<zod.ZodObject<{
|
|
@@ -18695,6 +18700,7 @@ declare const transformPCBElement: (elm: AnyCircuitElement, matrix: Matrix) => {
|
|
|
18695
18700
|
y: number;
|
|
18696
18701
|
} | undefined;
|
|
18697
18702
|
source_trace_id?: string | undefined;
|
|
18703
|
+
font_size?: number | undefined;
|
|
18698
18704
|
schematic_length_unit?: "9.236363636363636mm" | "mm" | "in" | undefined;
|
|
18699
18705
|
schematic_sheet_id?: string | undefined;
|
|
18700
18706
|
symbol_name?: string | undefined;
|
|
@@ -22965,6 +22971,7 @@ declare const transformPCBElements: (elms: AnyCircuitElement[], matrix: Matrix)
|
|
|
22965
22971
|
schematic_component_id: string;
|
|
22966
22972
|
is_box_with_pins: boolean;
|
|
22967
22973
|
source_component_id?: string | undefined;
|
|
22974
|
+
do_not_place?: boolean | undefined;
|
|
22968
22975
|
subcircuit_id?: string | undefined;
|
|
22969
22976
|
metadata?: zod.objectOutputType<{
|
|
22970
22977
|
kicad_symbol: zod.ZodOptional<zod.ZodObject<{
|
|
@@ -24916,6 +24923,7 @@ declare const transformPCBElements: (elms: AnyCircuitElement[], matrix: Matrix)
|
|
|
24916
24923
|
y: number;
|
|
24917
24924
|
} | undefined;
|
|
24918
24925
|
source_trace_id?: string | undefined;
|
|
24926
|
+
font_size?: number | undefined;
|
|
24919
24927
|
schematic_length_unit?: "9.236363636363636mm" | "mm" | "in" | undefined;
|
|
24920
24928
|
schematic_sheet_id?: string | undefined;
|
|
24921
24929
|
symbol_name?: string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -2090,18 +2090,15 @@ var createBounds = ({
|
|
|
2090
2090
|
}
|
|
2091
2091
|
};
|
|
2092
2092
|
};
|
|
2093
|
-
var getSchematicNetLabelTextWidth = (text) => {
|
|
2094
|
-
const characterWidth = 0.12 * (SCHEMATIC_NET_LABEL_FONT_SIZE / 0.18);
|
|
2095
|
-
const horizontalPadding = 0.12 * (SCHEMATIC_NET_LABEL_FONT_SIZE / 0.18);
|
|
2096
|
-
return text.length * characterWidth + horizontalPadding;
|
|
2097
|
-
};
|
|
2098
2093
|
var getSchematicNetLabelBounds = (netLabel) => {
|
|
2099
|
-
const
|
|
2094
|
+
const scale2 = (netLabel.font_size ?? SCHEMATIC_NET_LABEL_FONT_SIZE) / SCHEMATIC_NET_LABEL_FONT_SIZE;
|
|
2095
|
+
const labelLength = (netLabel.text.length + 1) * 0.12 * scale2;
|
|
2096
|
+
const labelHeight = SCHEMATIC_NET_LABEL_HEIGHT * scale2;
|
|
2100
2097
|
const anchor = netLabel.anchor_position;
|
|
2101
2098
|
if (!anchor) {
|
|
2102
2099
|
const isVertical = netLabel.anchor_side === "top" || netLabel.anchor_side === "bottom";
|
|
2103
|
-
const width = isVertical ?
|
|
2104
|
-
const height = isVertical ? labelLength :
|
|
2100
|
+
const width = isVertical ? labelHeight : labelLength;
|
|
2101
|
+
const height = isVertical ? labelLength : labelHeight;
|
|
2105
2102
|
return createBounds({
|
|
2106
2103
|
minX: netLabel.center.x - width / 2,
|
|
2107
2104
|
minY: netLabel.center.y - height / 2,
|
|
@@ -2113,29 +2110,29 @@ var getSchematicNetLabelBounds = (netLabel) => {
|
|
|
2113
2110
|
case "left":
|
|
2114
2111
|
return createBounds({
|
|
2115
2112
|
minX: anchor.x,
|
|
2116
|
-
minY: anchor.y -
|
|
2113
|
+
minY: anchor.y - labelHeight / 2,
|
|
2117
2114
|
maxX: anchor.x + labelLength,
|
|
2118
|
-
maxY: anchor.y +
|
|
2115
|
+
maxY: anchor.y + labelHeight / 2
|
|
2119
2116
|
});
|
|
2120
2117
|
case "right":
|
|
2121
2118
|
return createBounds({
|
|
2122
2119
|
minX: anchor.x - labelLength,
|
|
2123
|
-
minY: anchor.y -
|
|
2120
|
+
minY: anchor.y - labelHeight / 2,
|
|
2124
2121
|
maxX: anchor.x,
|
|
2125
|
-
maxY: anchor.y +
|
|
2122
|
+
maxY: anchor.y + labelHeight / 2
|
|
2126
2123
|
});
|
|
2127
2124
|
case "top":
|
|
2128
2125
|
return createBounds({
|
|
2129
|
-
minX: anchor.x -
|
|
2126
|
+
minX: anchor.x - labelHeight / 2,
|
|
2130
2127
|
minY: anchor.y - labelLength,
|
|
2131
|
-
maxX: anchor.x +
|
|
2128
|
+
maxX: anchor.x + labelHeight / 2,
|
|
2132
2129
|
maxY: anchor.y
|
|
2133
2130
|
});
|
|
2134
2131
|
case "bottom":
|
|
2135
2132
|
return createBounds({
|
|
2136
|
-
minX: anchor.x -
|
|
2133
|
+
minX: anchor.x - labelHeight / 2,
|
|
2137
2134
|
minY: anchor.y,
|
|
2138
|
-
maxX: anchor.x +
|
|
2135
|
+
maxX: anchor.x + labelHeight / 2,
|
|
2139
2136
|
maxY: anchor.y + labelLength
|
|
2140
2137
|
});
|
|
2141
2138
|
}
|
|
@@ -3499,7 +3496,7 @@ function convertSchematicLengthUnit(element, unit) {
|
|
|
3499
3496
|
};
|
|
3500
3497
|
case "schematic_net_label":
|
|
3501
3498
|
return {
|
|
3502
|
-
...element,
|
|
3499
|
+
...lengths(element, "font_size"),
|
|
3503
3500
|
...tag,
|
|
3504
3501
|
center: point(element.center),
|
|
3505
3502
|
...element.anchor_position && {
|