circuit-json-to-tscircuit 0.0.69 → 0.0.71
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-7VW2746G.js → chunk-3CHC36FN.js} +2 -0
- package/dist/cli/main.js +2 -2
- package/dist/lib/index.js +1 -1
- package/lib/generate-board-schematic-tsx/convert-symbol-primitives.ts +5 -0
- package/package.json +1 -1
- package/tests/fixtures/create-ti-evm-roundtrip.ts +3 -3
- package/tests/test23-symbol-primitive-transform.test.tsx +2 -1
- package/tests/ti-evms/__snapshots__/ti-drv8307evm-roundtrip-schematic-comparison.snap.svg +2 -2
- package/tests/ti-evms/__snapshots__/ti-lm251772evm-pd-roundtrip-schematic-comparison.snap.svg +4 -4
- package/tests/ti-evms/__snapshots__/ti-lm251772evm-pd-roundtrip.test.tsx.snap +2 -2
- package/tests/ti-evms/__snapshots__/ti-lm5155evm-fly-roundtrip-schematic-comparison.snap.svg +4 -4
- 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 +2 -2
- package/tests/ti-evms/ti-lm5155evm-fly-roundtrip.test.tsx +5 -5
|
@@ -493,6 +493,7 @@ var isNonCollinear = ({
|
|
|
493
493
|
// lib/generate-board-schematic-tsx/convert-symbol-primitives.ts
|
|
494
494
|
import { schematic_text as schematic_text2 } from "circuit-json";
|
|
495
495
|
import { applyToPoint as applyToPoint4 } from "transformation-matrix";
|
|
496
|
+
var DEFAULT_SYMBOL_CIRCLE_STROKE_WIDTH = 0.02;
|
|
496
497
|
var anchors = {
|
|
497
498
|
middle_top: "top_center",
|
|
498
499
|
middle_bottom: "bottom_center",
|
|
@@ -545,6 +546,7 @@ var convertSymbolPrimitives = ({
|
|
|
545
546
|
return formatElement("schematiccircle", {
|
|
546
547
|
center,
|
|
547
548
|
radius: Math.hypot(radiusVector.x, radiusVector.y),
|
|
549
|
+
strokeWidth: DEFAULT_SYMBOL_CIRCLE_STROKE_WIDTH,
|
|
548
550
|
isFilled: primitive.fill
|
|
549
551
|
});
|
|
550
552
|
}
|
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-3CHC36FN.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.70",
|
|
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
|
@@ -3,6 +3,10 @@ import type { SchSymbol } from "schematic-symbols"
|
|
|
3
3
|
import { applyToPoint, type Matrix } from "transformation-matrix"
|
|
4
4
|
import { formatElement } from "./format-attributes"
|
|
5
5
|
|
|
6
|
+
// Circuit JSON symbol primitives do not encode a stroke width. This matches
|
|
7
|
+
// the component outline width used by circuit-to-svg.
|
|
8
|
+
const DEFAULT_SYMBOL_CIRCLE_STROKE_WIDTH = 0.02
|
|
9
|
+
|
|
6
10
|
const anchors = {
|
|
7
11
|
middle_top: "top_center",
|
|
8
12
|
middle_bottom: "bottom_center",
|
|
@@ -68,6 +72,7 @@ export const convertSymbolPrimitives = ({
|
|
|
68
72
|
return formatElement("schematiccircle", {
|
|
69
73
|
center,
|
|
70
74
|
radius: Math.hypot(radiusVector.x, radiusVector.y),
|
|
75
|
+
strokeWidth: DEFAULT_SYMBOL_CIRCLE_STROKE_WIDTH,
|
|
71
76
|
isFilled: primitive.fill,
|
|
72
77
|
})
|
|
73
78
|
}
|
package/package.json
CHANGED
|
@@ -87,7 +87,7 @@ export async function createTiEvmRoundtrip({
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
function createComparisonSvg({
|
|
90
|
+
export function createComparisonSvg({
|
|
91
91
|
fixtureName,
|
|
92
92
|
kind,
|
|
93
93
|
renderedSvg,
|
|
@@ -100,8 +100,8 @@ function createComparisonSvg({
|
|
|
100
100
|
}): string {
|
|
101
101
|
return stackSvgsHorizontally([sourceSvg, renderedSvg], {
|
|
102
102
|
gap: 24,
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
// Schematic SVGs have no viewBox; normalizing only their canvas clips them.
|
|
104
|
+
normalizeSize: false,
|
|
105
105
|
rootAttributes: {
|
|
106
106
|
"aria-label": `${fixtureName} ${kind}: source Circuit JSON on left, generated tscircuit render on right`,
|
|
107
107
|
role: "img",
|
|
@@ -3,7 +3,7 @@ import { convertSymbolPrimitives } from "../lib/generate-board-schematic-tsx/con
|
|
|
3
3
|
import { compose, rotateDEG, scale, translate } from "transformation-matrix"
|
|
4
4
|
import { runTscircuitCode } from "tscircuit"
|
|
5
5
|
|
|
6
|
-
test("transforms symbol
|
|
6
|
+
test("transforms symbol primitives with compiled circle styling", async () => {
|
|
7
7
|
const elementStrings = convertSymbolPrimitives({
|
|
8
8
|
symbol: {
|
|
9
9
|
center: { x: 0, y: 0 },
|
|
@@ -41,6 +41,7 @@ test("transforms symbol circle and box dimensions through a rotated matrix", asy
|
|
|
41
41
|
expect(circle.center.x).toBeCloseTo(6)
|
|
42
42
|
expect(circle.center.y).toBeCloseTo(22)
|
|
43
43
|
expect(circle.radius).toBeCloseTo(4)
|
|
44
|
+
expect(circle.stroke_width).toBe(0.02)
|
|
44
45
|
expect(rect.center.x).toBeCloseTo(6)
|
|
45
46
|
expect(rect.center.y).toBeCloseTo(22)
|
|
46
47
|
expect(rect.width).toBeCloseTo(6)
|