circuit-json-to-tscircuit 0.0.62 → 0.0.63
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/{chunk-7OQRDC2Y.js → chunk-MVPNWU4R.js} +10 -4
- package/dist/cli/main.js +2 -2
- package/dist/lib/index.js +1 -1
- package/lib/generate-board-schematic-tsx/convert-box-components.ts +13 -3
- package/package.json +1 -1
- package/tests/__snapshots__/test22-preserve-board-schematic-schematic.snap.svg +2 -2
- package/tests/ti-evms/__snapshots__/ti-drv8307evm-roundtrip-schematic-comparison.snap.svg +2 -2
- package/tests/ti-evms/__snapshots__/ti-drv8307evm-roundtrip.test.tsx.snap +11 -11
- package/tests/ti-evms/__snapshots__/ti-lm251772evm-pd-roundtrip-schematic-comparison.snap.svg +2 -2
- package/tests/ti-evms/__snapshots__/ti-lm251772evm-pd-roundtrip.test.tsx.snap +8 -8
- package/tests/ti-evms/__snapshots__/ti-lm5155evm-fly-roundtrip-schematic-comparison.snap.svg +2 -2
- package/tests/ti-evms/__snapshots__/ti-lmg342x-bb-evm-roundtrip-schematic-comparison.snap.svg +2 -2
- package/tests/ti-evms/__snapshots__/ti-lmg342x-bb-evm-roundtrip.test.tsx.snap +44 -44
- package/tests/ti-evms/ti-lm5155evm-fly-roundtrip.test.tsx +37 -6
|
@@ -571,16 +571,22 @@ import { su as su2 } from "@tscircuit/soup-util";
|
|
|
571
571
|
import {
|
|
572
572
|
schematic_text as schematic_text3
|
|
573
573
|
} from "circuit-json";
|
|
574
|
+
var DEFAULT_BOX_BODY_STROKE_WIDTH = 0.02;
|
|
575
|
+
var DEFAULT_BOX_BODY_STROKE_COLOR = "#840000";
|
|
576
|
+
var DEFAULT_BOX_BODY_FILL_COLOR = "#ffffc2";
|
|
574
577
|
var convertBoxComponent = ({
|
|
575
578
|
circuitJson,
|
|
576
579
|
schematicComponent
|
|
577
580
|
}) => {
|
|
578
581
|
const primitives = [
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
schY: schematicComponent.center.y,
|
|
582
|
+
convertRect({
|
|
583
|
+
center: schematicComponent.center,
|
|
582
584
|
width: schematicComponent.size.width,
|
|
583
|
-
height: schematicComponent.size.height
|
|
585
|
+
height: schematicComponent.size.height,
|
|
586
|
+
strokeWidth: DEFAULT_BOX_BODY_STROKE_WIDTH,
|
|
587
|
+
color: DEFAULT_BOX_BODY_STROKE_COLOR,
|
|
588
|
+
fillColor: DEFAULT_BOX_BODY_FILL_COLOR,
|
|
589
|
+
isFilled: true
|
|
584
590
|
})
|
|
585
591
|
];
|
|
586
592
|
for (const schematicPort of su2(circuitJson).schematic_port.list({
|
package/dist/cli/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
convertCircuitJsonToTscircuit
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-MVPNWU4R.js";
|
|
5
5
|
|
|
6
6
|
// cli/main.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -16,7 +16,7 @@ var package_default = {
|
|
|
16
16
|
"./cli": "./dist/cli/main.js"
|
|
17
17
|
},
|
|
18
18
|
type: "module",
|
|
19
|
-
version: "0.0.
|
|
19
|
+
version: "0.0.62",
|
|
20
20
|
repository: {
|
|
21
21
|
type: "git",
|
|
22
22
|
url: "https://github.com/tscircuit/circuit-json-to-tscircuit.git"
|
package/dist/lib/index.js
CHANGED
|
@@ -4,8 +4,15 @@ import {
|
|
|
4
4
|
type AnyCircuitElement,
|
|
5
5
|
type SchematicComponent,
|
|
6
6
|
} from "circuit-json"
|
|
7
|
+
import { convertRect } from "./convert-rect"
|
|
7
8
|
import { formatElement } from "./format-attributes"
|
|
8
9
|
|
|
10
|
+
// Circuit JSON does not encode box body styling. These values mirror the
|
|
11
|
+
// circuit-to-svg defaults so reconstructed boxes keep the compiled view.
|
|
12
|
+
const DEFAULT_BOX_BODY_STROKE_WIDTH = 0.02
|
|
13
|
+
const DEFAULT_BOX_BODY_STROKE_COLOR = "#840000"
|
|
14
|
+
const DEFAULT_BOX_BODY_FILL_COLOR = "#ffffc2"
|
|
15
|
+
|
|
9
16
|
export const convertBoxComponent = ({
|
|
10
17
|
circuitJson,
|
|
11
18
|
schematicComponent,
|
|
@@ -14,11 +21,14 @@ export const convertBoxComponent = ({
|
|
|
14
21
|
schematicComponent: SchematicComponent
|
|
15
22
|
}): string[] => {
|
|
16
23
|
const primitives = [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
schY: schematicComponent.center.y,
|
|
24
|
+
convertRect({
|
|
25
|
+
center: schematicComponent.center,
|
|
20
26
|
width: schematicComponent.size.width,
|
|
21
27
|
height: schematicComponent.size.height,
|
|
28
|
+
strokeWidth: DEFAULT_BOX_BODY_STROKE_WIDTH,
|
|
29
|
+
color: DEFAULT_BOX_BODY_STROKE_COLOR,
|
|
30
|
+
fillColor: DEFAULT_BOX_BODY_FILL_COLOR,
|
|
31
|
+
isFilled: true,
|
|
22
32
|
}),
|
|
23
33
|
]
|
|
24
34
|
for (const schematicPort of su(circuitJson).schematic_port.list({
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="600" style="background-color: rgb(245, 241, 237)" data-real-to-screen-transform="matrix(64.5869731593,0,0,-64.5869731593,
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="600" style="background-color: rgb(245, 241, 237)" data-real-to-screen-transform="matrix(64.5869731593,0,0,-64.5869731593,567.7065134203,502.4736705294)" data-software-used-string="@tscircuit/core@0.0.2038"><style>
|
|
2
2
|
.boundary { fill: rgb(245, 241, 237); }
|
|
3
3
|
.schematic-boundary { fill: none; stroke: #fff; }
|
|
4
4
|
.component { fill: none; stroke: rgb(132, 0, 0); }
|
|
@@ -22,4 +22,4 @@
|
|
|
22
22
|
.pin-number { fill: rgb(169, 0, 0); }
|
|
23
23
|
.port-label { fill: rgb(0, 100, 100); }
|
|
24
24
|
.component-name { fill: rgb(0, 100, 100); }
|
|
25
|
-
</style><rect class="boundary" x="0" y="0" width="1200" height="600"/><circle cx="
|
|
25
|
+
</style><rect class="boundary" x="0" y="0" width="1200" height="600"/><circle cx="567.7065134203" cy="373.29972421080004" r="1.937609194779" fill="#008800" stroke="#008800" stroke-width="7.750436779116" data-schematic-circle-id="schematic_circle_0"/><path d="M 632.2934865796 405.59321079045003 L 761.4674328982001 405.59321079045003 L 761.4674328982001 211.83229131255 L 632.2934865796 211.83229131255 L 632.2934865796 405.59321079045003" stroke="#840000" stroke-width="1.291739463186" fill="#ffffc2" stroke-linecap="round" stroke-linejoin="round"/><path d="M 438.5325671017 373.29972421080004 L 567.7065134203 373.29972421080004" stroke="rgb(132, 0, 0)" stroke-width="1.291739463186" fill="none" stroke-linecap="round" stroke-linejoin="round"/><path d="M 567.7065134203 373.29972421080004 L 567.7065134203 567.0606436887" stroke="rgb(132, 0, 0)" stroke-width="1.291739463186" fill="none" stroke-linecap="round" stroke-linejoin="round"/><text x="632.2934865796" y="179.53880473290002" fill="#000000" text-anchor="start" dominant-baseline="ideographic" font-family="sans-serif" font-size="12.91739463186px" transform="rotate(90, 632.2934865796, 179.53880473290002)">U1 "controller" {flyback}</text></svg>
|