@tscircuit/schematic-trace-solver 0.0.25 → 0.0.26

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.
Files changed (46) hide show
  1. package/.github/workflows/bun-test.yml +8 -0
  2. package/README.md +28 -0
  3. package/bunfig.toml +2 -2
  4. package/dist/index.js +23 -6136
  5. package/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts +0 -1
  6. package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/SingleNetLabelPlacementSolver_visualize.ts +0 -1
  7. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver.ts +0 -2
  8. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver.ts +0 -1
  9. package/lib/solvers/TraceOverlapShiftSolver/TraceOverlapIssueSolver/TraceOverlapIssueSolver.ts +0 -2
  10. package/lib/solvers/TraceOverlapShiftSolver/TraceOverlapShiftSolver.ts +0 -1
  11. package/package.json +6 -7
  12. package/site/components/DownloadDropdown.tsx +4 -2
  13. package/site/examples/example01-basic.page.tsx +1 -1
  14. package/site/examples/example02.page.tsx +1 -1
  15. package/site/examples/example03.page.tsx +1 -1
  16. package/site/examples/example04-single-symbol.page.tsx +1 -1
  17. package/site/examples/example05.page.tsx +1 -1
  18. package/site/examples/example06.page.tsx +1 -1
  19. package/site/examples/example07.page.tsx +1 -1
  20. package/site/examples/example08.page.tsx +1 -1
  21. package/site/examples/example09.page.tsx +1 -1
  22. package/site/examples/example10.page.tsx +1 -1
  23. package/tests/__snapshots__/svg.snap.svg +3 -0
  24. package/tests/examples/__snapshots__/example01.snap.svg +157 -0
  25. package/tests/examples/__snapshots__/example02.snap.svg +262 -0
  26. package/tests/examples/__snapshots__/example03.snap.svg +282 -0
  27. package/tests/examples/__snapshots__/example04.snap.svg +87 -0
  28. package/tests/examples/__snapshots__/example05.snap.svg +190 -0
  29. package/tests/examples/__snapshots__/example06.snap.svg +94 -0
  30. package/tests/examples/__snapshots__/example07.snap.svg +204 -0
  31. package/tests/examples/__snapshots__/example08.snap.svg +136 -0
  32. package/tests/examples/__snapshots__/example09.snap.svg +484 -0
  33. package/tests/examples/__snapshots__/example10.snap.svg +135 -0
  34. package/tests/examples/example01.test.ts +12 -0
  35. package/tests/examples/example02.test.ts +12 -0
  36. package/tests/examples/example03.test.ts +12 -0
  37. package/tests/examples/example04.test.ts +12 -0
  38. package/tests/examples/example05.test.ts +12 -0
  39. package/tests/examples/example06.test.ts +12 -0
  40. package/tests/examples/example07.test.ts +12 -0
  41. package/tests/examples/example08.test.ts +12 -0
  42. package/tests/examples/example09.test.ts +12 -0
  43. package/tests/examples/example10.test.ts +12 -0
  44. package/tests/fixtures/matcher.ts +62 -0
  45. package/tests/fixtures/preload.ts +1 -0
  46. package/tests/svg.test.ts +11 -0
@@ -0,0 +1,136 @@
1
+ <svg width="640" height="640" viewBox="0 0 640 640" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="100%" height="100%" fill="white" />
3
+ <g>
4
+ <circle data-type="point" data-label="R1.1
5
+ x-" data-x="3.4487093" data-y="0.0002732499999993365" cx="458.5646785230897" cy="319.9742965684508" r="3" fill="hsl(226, 100%, 50%, 0.8)" />
6
+ </g>
7
+ <g>
8
+ <circle data-type="point" data-label="R1.2
9
+ x+" data-x="4.5512907" data-y="-0.0002732499999993365" cx="562.2796850824031" cy="320.0257034315492" r="3" fill="hsl(227, 100%, 50%, 0.8)" />
10
+ </g>
11
+ <g>
12
+ <circle data-type="point" data-label="U1.1
13
+ x-" data-x="-0.6000000000000001" data-y="0.30000000000000004" cx="77.72031491759674" cy="291.7803130292294" r="3" fill="hsl(319, 100%, 50%, 0.8)" />
14
+ </g>
15
+ <g>
16
+ <circle data-type="point" data-label="U1.2
17
+ x-" data-x="-0.6000000000000001" data-y="0.10000000000000003" cx="77.72031491759674" cy="310.5934376764098" r="3" fill="hsl(320, 100%, 50%, 0.8)" />
18
+ </g>
19
+ <g>
20
+ <circle data-type="point" data-label="U1.3
21
+ x-" data-x="-0.6000000000000001" data-y="-0.09999999999999998" cx="77.72031491759674" cy="329.4065623235902" r="3" fill="hsl(321, 100%, 50%, 0.8)" />
22
+ </g>
23
+ <g>
24
+ <circle data-type="point" data-label="U1.4
25
+ x-" data-x="-0.6000000000000001" data-y="-0.30000000000000004" cx="77.72031491759674" cy="348.2196869707706" r="3" fill="hsl(322, 100%, 50%, 0.8)" />
26
+ </g>
27
+ <g>
28
+ <circle data-type="point" data-label="U1.5
29
+ x+" data-x="0.6000000000000001" data-y="-0.30000000000000004" cx="190.5990628006793" cy="348.2196869707706" r="3" fill="hsl(323, 100%, 50%, 0.8)" />
30
+ </g>
31
+ <g>
32
+ <circle data-type="point" data-label="U1.6
33
+ x+" data-x="0.6000000000000001" data-y="-0.10000000000000003" cx="190.5990628006793" cy="329.4065623235902" r="3" fill="hsl(324, 100%, 50%, 0.8)" />
34
+ </g>
35
+ <g>
36
+ <circle data-type="point" data-label="U1.7
37
+ x+" data-x="0.6000000000000001" data-y="0.09999999999999998" cx="190.5990628006793" cy="310.5934376764098" r="3" fill="hsl(325, 100%, 50%, 0.8)" />
38
+ </g>
39
+ <g>
40
+ <circle data-type="point" data-label="U1.8
41
+ x+" data-x="0.6000000000000001" data-y="0.30000000000000004" cx="190.5990628006793" cy="291.7803130292294" r="3" fill="hsl(326, 100%, 50%, 0.8)" />
42
+ </g>
43
+ <g>
44
+ <circle data-type="point" data-label="" data-x="-0.6000000000000001" data-y="0.30000000000000004" cx="77.72031491759674" cy="291.7803130292294" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
45
+ </g>
46
+ <g>
47
+ <circle data-type="point" data-label="" data-x="3.4487093" data-y="0.0002732499999993365" cx="458.5646785230897" cy="319.9742965684508" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
48
+ </g>
49
+ <g>
50
+ <circle data-type="point" data-label="" data-x="0.6000000000000001" data-y="-0.10000000000000003" cx="190.5990628006793" cy="329.4065623235902" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
51
+ </g>
52
+ <g>
53
+ <circle data-type="point" data-label="" data-x="4.5512907" data-y="-0.0002732499999993365" cx="562.2796850824031" cy="320.0257034315492" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
54
+ </g>
55
+ <g>
56
+ <polyline data-points="-0.6000000000000001,0.30000000000000004 3.4487093,0.0002732499999993365" data-type="line" data-label="" points="77.72031491759674,291.7803130292294 458.5646785230897,319.9742965684508" fill="none" stroke="hsl(248, 100%, 50%, 0.8)" stroke-width="1" />
57
+ </g>
58
+ <g>
59
+ <polyline data-points="0.6000000000000001,-0.10000000000000003 4.5512907,-0.0002732499999993365" data-type="line" data-label="" points="190.5990628006793,329.4065623235902 562.2796850824031,320.0257034315492" fill="none" stroke="hsl(248, 100%, 50%, 0.8)" stroke-width="1" />
60
+ </g>
61
+ <g>
62
+ <rect data-type="rect" data-label="schematic_component_0" data-x="4" data-y="0" x="458.5646785230897" y="301.7084363106946" width="103.71500655931345" height="36.58312737861081" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.01063087625" />
63
+ </g>
64
+ <g>
65
+ <rect data-type="rect" data-label="schematic_component_1" data-x="0" data-y="0" x="77.72031491759674" y="272.96718838204896" width="112.87874788308255" height="94.06562323590208" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.01063087625" />
66
+ </g>
67
+ <g>
68
+ <rect data-type="rect" data-label="" data-x="-0.801" data-y="0.30000000000000004" x="40" y="282.37375070563917" width="37.626249294360846" height="18.813124647180416" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.01063087625" />
69
+ </g>
70
+ <g>
71
+ <rect data-type="rect" data-label="" data-x="3.2477093" data-y="0.0002732499999993365" x="420.84436360549296" y="310.5677342448606" width="37.62624929436083" height="18.813124647180473" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.01063087625" />
72
+ </g>
73
+ <g>
74
+ <rect data-type="rect" data-label="" data-x="0.801" data-y="-0.10000000000000003" x="190.6931284239152" y="320" width="37.62624929436083" height="18.813124647180416" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.01063087625" />
75
+ </g>
76
+ <g>
77
+ <rect data-type="rect" data-label="" data-x="4.7522907000000005" data-y="-0.0002732499999993365" x="562.3737507056392" y="310.6191411079589" width="37.62624929436083" height="18.813124647180473" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.01063087625" />
78
+ </g>
79
+ <g id="crosshair" style="display: none">
80
+ <line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />
81
+ <line id="crosshair-v" x1="0" x2="640" stroke="#666" stroke-width="0.5" /><text id="coordinates" font-family="monospace" font-size="12" fill="#666"></text>
82
+ </g>
83
+ <script>
84
+ <![CDATA[
85
+ document.currentScript.parentElement.addEventListener('mousemove', (e) => {
86
+ const svg = e.currentTarget;
87
+ const rect = svg.getBoundingClientRect();
88
+ const x = e.clientX - rect.left;
89
+ const y = e.clientY - rect.top;
90
+ const crosshair = svg.getElementById('crosshair');
91
+ const h = svg.getElementById('crosshair-h');
92
+ const v = svg.getElementById('crosshair-v');
93
+ const coords = svg.getElementById('coordinates');
94
+
95
+ crosshair.style.display = 'block';
96
+ h.setAttribute('x1', '0');
97
+ h.setAttribute('x2', '640');
98
+ h.setAttribute('y1', y);
99
+ h.setAttribute('y2', y);
100
+ v.setAttribute('x1', x);
101
+ v.setAttribute('x2', x);
102
+ v.setAttribute('y1', '0');
103
+ v.setAttribute('y2', '640');
104
+
105
+ // Calculate real coordinates using inverse transformation
106
+ const matrix = {
107
+ "a": 94.06562323590211,
108
+ "c": 0,
109
+ "e": 134.15968885913802,
110
+ "b": 0,
111
+ "d": -94.06562323590211,
112
+ "f": 320
113
+ };
114
+ // Manually invert and apply the affine transform
115
+ // Since we only use translate and scale, we can directly compute:
116
+ // x' = (x - tx) / sx
117
+ // y' = (y - ty) / sy
118
+ const sx = matrix.a;
119
+ const sy = matrix.d;
120
+ const tx = matrix.e;
121
+ const ty = matrix.f;
122
+ const realPoint = {
123
+ x: (x - tx) / sx,
124
+ y: (y - ty) / sy // Flip y back since we used negative scale
125
+ }
126
+
127
+ coords.textContent = `(${realPoint.x.toFixed(2)}, ${realPoint.y.toFixed(2)})`;
128
+ coords.setAttribute('x', (x + 5).toString());
129
+ coords.setAttribute('y', (y - 5).toString());
130
+ });
131
+ document.currentScript.parentElement.addEventListener('mouseleave', () => {
132
+ document.currentScript.parentElement.getElementById('crosshair').style.display = 'none';
133
+ });
134
+ ]]>
135
+ </script>
136
+ </svg>