@tscircuit/schematic-viewer 1.2.14 → 1.4.0
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/.github/workflows/chromatic.yml +30 -0
- package/.github/workflows/npm-build.yml +26 -0
- package/.github/workflows/npm-typecheck.yml +26 -0
- package/README.md +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.js +690 -664
- package/dist/index.js.map +1 -1
- package/package.json +21 -12
- package/renovate.json +12 -1
- package/src/Schematic.tsx +148 -77
- package/src/lib/types/core.ts +14 -49
- package/src/lib/types/source-component.ts +6 -0
- package/src/lib/utils/collect-element-refs.ts +4 -3
- package/src/lib/utils/colors.ts +236 -0
- package/src/schematic-components/SVGPathComponent.tsx +84 -144
- package/src/schematic-components/SchematicChip.tsx +183 -0
- package/src/schematic-components/SchematicComponent.tsx +18 -24
- package/src/schematic-components/SchematicComponentFromSymbol.tsx +44 -0
- package/src/schematic-components/SchematicElement.tsx +4 -38
- package/src/schematic-components/SchematicTrace.tsx +4 -3
- package/src/schematic-components/index.tsx +7 -14
- package/src/stories/basics/schematic-net-label.stories.tsx +112 -166
- package/src/stories/basics/schematic-net-labels-2.stories.tsx +22 -20
- package/src/stories/bug-connections.stories.tsx +9 -6
- package/src/stories/bug-high-port-numbers.stories.tsx +99 -82
- package/src/stories/bug-pin-spacing.stories.tsx +1 -0
- package/src/stories/bugs/bug1-y-flip.stories.tsx +3 -2
- package/src/stories/bugs/bug3-scaling-trace.stories.tsx +11 -5
- package/src/stories/bugs/bug4-schematic-line.stories.tsx +0 -1
- package/src/stories/bugs/bug5-diode.stories.tsx +0 -1
- package/src/stories/bugs/bug8-autolayout.stories.tsx +22 -31
- package/src/stories/circuit-components/diode.stories.tsx +3 -1
- package/src/stories/circuit-components/resistor.stories.tsx +3 -1
- package/src/stories/component-drawing-example.stories.tsx +2 -2
- package/src/stories/led-circuit-react.stories.tsx +40 -45
- package/src/stories/net-alias.stories.tsx +1 -1
- package/src/stories/off-center-render.stories.tsx +6 -6
- package/src/stories/rotated-resistor.stories.tsx +1 -1
- package/src/stories/schematic-path.stories.tsx +1 -1
- package/src/stories/three-sided-bug.stories.tsx +8 -8
- package/src/pages/led-circuit.tsx +0 -96
- package/src/schematic-components/ProjectComponent.tsx +0 -70
- package/src/schematic-components/SchematicBox.tsx +0 -29
- package/src/schematic-components/SchematicBug.tsx +0 -90
- package/src/schematic-components/SchematicLine.tsx +0 -48
- package/src/schematic-components/SchematicPath.tsx +0 -51
- package/src/schematic-components/SchematicPort.tsx +0 -63
- package/src/schematic-components/SimpleCapacitor.tsx +0 -29
- package/src/schematic-components/SimpleDiode.tsx +0 -42
- package/src/schematic-components/SimpleGround.tsx +0 -30
- package/src/schematic-components/SimpleInductor.tsx +0 -29
- package/src/schematic-components/SimplePowerSource.tsx +0 -43
- package/src/schematic-components/SimpleResistor.tsx +0 -28
- package/src/stories/led-circuit-builder.stories.tsx +0 -104
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AnyCircuitElement, SchematicComponent as SchematicComponentType } from "circuit-json"
|
|
2
2
|
import * as Component from "./"
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
component: {
|
|
6
|
-
source:
|
|
7
|
-
schematic:
|
|
6
|
+
source: any
|
|
7
|
+
schematic: SchematicComponentType
|
|
8
8
|
schematic_children: any[]
|
|
9
|
+
allElements: AnyCircuitElement[]
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -14,30 +15,23 @@ interface Props {
|
|
|
14
15
|
* generating schematic lines directly
|
|
15
16
|
*/
|
|
16
17
|
export const SchematicComponent = ({ component }: Props) => {
|
|
17
|
-
const { source, schematic } = component
|
|
18
|
+
const { source, schematic, allElements } = component
|
|
18
19
|
if (!source.ftype) return null
|
|
19
20
|
|
|
20
21
|
switch (source.ftype) {
|
|
21
|
-
case "simple_resistor":
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
case "
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return <Component.
|
|
29
|
-
}
|
|
30
|
-
case "
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return <Component.SimpleInductor component={{ source, schematic }} />
|
|
35
|
-
}
|
|
36
|
-
case "simple_bug": {
|
|
37
|
-
return <Component.SchematicBug component={{ source, schematic }} />
|
|
38
|
-
}
|
|
39
|
-
case "simple_diode": {
|
|
40
|
-
return <Component.SimpleDiode component={{ source, schematic }} />
|
|
22
|
+
case "simple_resistor":
|
|
23
|
+
case "simple_capacitor":
|
|
24
|
+
case "simple_power_source":
|
|
25
|
+
case "simple_ground":
|
|
26
|
+
case "simple_inductor":
|
|
27
|
+
case "simple_diode":
|
|
28
|
+
{
|
|
29
|
+
return <Component.SchematicComponentFromSymbol component={{ source, schematic }} />
|
|
30
|
+
}
|
|
31
|
+
case "simple_chip":
|
|
32
|
+
case "simple_bug":
|
|
33
|
+
{
|
|
34
|
+
return <Component.SchematicChip component={{ source, schematic, allElements }} />
|
|
41
35
|
}
|
|
42
36
|
default: {
|
|
43
37
|
return <div>unknown ftype: {component.source.ftype}</div>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SchematicComponent, SourceSimpleResistor } from "circuit-json"
|
|
2
|
+
import { colorMap } from "lib/utils/colors"
|
|
3
|
+
import { symbols } from "schematic-symbols"
|
|
4
|
+
import SVGPathComponent from "./SVGPathComponent"
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
component: {
|
|
8
|
+
source: SourceSimpleResistor
|
|
9
|
+
schematic: SchematicComponent
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const SchematicComponentFromSymbol = ({ component: { source, schematic } }: Props) => {
|
|
14
|
+
const { center, rotation } = schematic
|
|
15
|
+
// Get the resistor symbol paths
|
|
16
|
+
const symbol = symbols[schematic.symbol_name]
|
|
17
|
+
const paths = symbol.primitives
|
|
18
|
+
.filter((p: any) => p.type === "path")
|
|
19
|
+
.map((p: any) => ({
|
|
20
|
+
stroke: colorMap.schematic.component_outline,
|
|
21
|
+
strokeWidth: 0.02,
|
|
22
|
+
d: p.points.reduce(
|
|
23
|
+
(acc: string, point: { x: number; y: number }, index: number) => {
|
|
24
|
+
const command = index === 0 ? "M" : "L"
|
|
25
|
+
return `${acc} ${command} ${point.x} ${point.y}`
|
|
26
|
+
},
|
|
27
|
+
"",
|
|
28
|
+
),
|
|
29
|
+
}))
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<SVGPathComponent
|
|
33
|
+
rotation={rotation}
|
|
34
|
+
center={center}
|
|
35
|
+
size={{
|
|
36
|
+
width: symbol?.size.width,
|
|
37
|
+
height: symbol?.size.height,
|
|
38
|
+
}}
|
|
39
|
+
paths={paths}
|
|
40
|
+
/>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default SchematicComponentFromSymbol
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyCircuitElement } from "circuit-json"
|
|
2
2
|
import { collectElementRefs } from "lib/utils/collect-element-refs"
|
|
3
3
|
import SchematicComponent from "./SchematicComponent"
|
|
4
|
-
import
|
|
4
|
+
import { SchematicNetLabel } from "./SchematicNetLabel"
|
|
5
5
|
import SchematicText from "./SchematicText"
|
|
6
|
-
import SchematicBox from "./SchematicBox"
|
|
7
6
|
import SchematicTrace from "./SchematicTrace"
|
|
8
|
-
import SchematicLine from "./SchematicLine"
|
|
9
|
-
import RenderError from "./RenderError"
|
|
10
|
-
import SchematicPath from "./SchematicPath"
|
|
11
|
-
import { SchematicNetLabel } from "./SchematicNetLabel"
|
|
12
7
|
|
|
13
8
|
/**
|
|
14
9
|
* Render any @tsbuilder/builder AnyElement that can be put on a schematic.
|
|
@@ -17,8 +12,8 @@ export const SchematicElement = ({
|
|
|
17
12
|
element,
|
|
18
13
|
allElements,
|
|
19
14
|
}: {
|
|
20
|
-
element:
|
|
21
|
-
allElements:
|
|
15
|
+
element: AnyCircuitElement
|
|
16
|
+
allElements: AnyCircuitElement[]
|
|
22
17
|
}) => {
|
|
23
18
|
// A lot of the split logic for element types into a project is here:
|
|
24
19
|
// https://github.com/tscircuit/builder/blob/7e7bef9c0aadd11999795003b8986f0d244c111f/src/lib/project/create-project-from-elements.ts#L13
|
|
@@ -36,30 +31,6 @@ export const SchematicElement = ({
|
|
|
36
31
|
)
|
|
37
32
|
}
|
|
38
33
|
|
|
39
|
-
if (element.type === "schematic_port") {
|
|
40
|
-
return (
|
|
41
|
-
<SchematicPort port={collectElementRefs(element, allElements) as any} />
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (element.type === "schematic_box") {
|
|
46
|
-
return (
|
|
47
|
-
<SchematicBox box={collectElementRefs(element, allElements) as any} />
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (element.type === "schematic_line") {
|
|
52
|
-
return (
|
|
53
|
-
<SchematicLine line={collectElementRefs(element, allElements) as any} />
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (element.type === "schematic_path") {
|
|
58
|
-
return (
|
|
59
|
-
<SchematicPath path={collectElementRefs(element, allElements) as any} />
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
34
|
if (element.type === "schematic_text") {
|
|
64
35
|
return <SchematicText schematic_text={element} />
|
|
65
36
|
}
|
|
@@ -68,10 +39,5 @@ export const SchematicElement = ({
|
|
|
68
39
|
return <SchematicNetLabel net_label={element} />
|
|
69
40
|
}
|
|
70
41
|
|
|
71
|
-
if (element.type === "source_error") {
|
|
72
|
-
// TODO use the ids on the source error to put this in the right place
|
|
73
|
-
return <RenderError text={element.message} />
|
|
74
|
-
}
|
|
75
|
-
|
|
76
42
|
return null
|
|
77
43
|
}
|
|
@@ -4,6 +4,7 @@ import Path from "svg-path-generator"
|
|
|
4
4
|
import getSVGPathBounds from "lib/utils/get-svg-path-bounds"
|
|
5
5
|
import RenderError from "./RenderError"
|
|
6
6
|
import SVGPathComponent2 from "./SVGPathComponent2"
|
|
7
|
+
import { colorMap } from "lib/utils/colors"
|
|
7
8
|
|
|
8
9
|
interface Props {
|
|
9
10
|
trace: {
|
|
@@ -33,14 +34,14 @@ export const SchematicTrace = ({ trace: { source, schematic } }: Props) => {
|
|
|
33
34
|
y: pathBounds.minY + pathBounds.height / 2,
|
|
34
35
|
}
|
|
35
36
|
return (
|
|
36
|
-
<
|
|
37
|
+
<SVGPathComponent
|
|
37
38
|
rotation={0}
|
|
38
39
|
center={center}
|
|
39
40
|
size={pathBounds}
|
|
40
41
|
paths={[
|
|
41
42
|
{
|
|
42
|
-
stroke:
|
|
43
|
-
strokeWidth: 0.
|
|
43
|
+
stroke:colorMap.schematic.wire,
|
|
44
|
+
strokeWidth: 0.01,
|
|
44
45
|
d,
|
|
45
46
|
},
|
|
46
47
|
]}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./SVGPathComponent"
|
|
5
|
-
export * from "./ProjectComponent"
|
|
1
|
+
export * from "./ContextProviders"
|
|
2
|
+
export * from "./RenderError"
|
|
3
|
+
export * from "./SchematicChip"
|
|
6
4
|
export * from "./SchematicComponent"
|
|
7
|
-
export * from "./
|
|
5
|
+
export * from "./SchematicComponentFromSymbol"
|
|
6
|
+
export * from "./SchematicGroup"
|
|
8
7
|
export * from "./SchematicText"
|
|
9
|
-
export * from "./ProjectComponent"
|
|
10
8
|
export * from "./SchematicTrace"
|
|
11
|
-
export * from "./
|
|
12
|
-
|
|
13
|
-
export * from "./SimpleGround"
|
|
14
|
-
export * from "./SimpleInductor"
|
|
15
|
-
export * from "./RenderError"
|
|
16
|
-
export * from "./SimpleDiode"
|
|
17
|
-
export * from "./ContextProviders"
|
|
9
|
+
export * from "./SVGPathComponent"
|
|
10
|
+
|
|
@@ -4,182 +4,128 @@ export const SchematicNetLabel = () => {
|
|
|
4
4
|
return (
|
|
5
5
|
<Schematic
|
|
6
6
|
style={{ height: 500 }}
|
|
7
|
-
soup={
|
|
7
|
+
soup={[
|
|
8
8
|
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
9
|
+
type: "source_component",
|
|
10
|
+
source_component_id: "simple_resistor_0",
|
|
11
|
+
name: "R1",
|
|
12
|
+
supplier_part_numbers: {},
|
|
13
|
+
ftype: "simple_resistor",
|
|
14
|
+
resistance: 100,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: "schematic_component",
|
|
18
|
+
source_component_id: "simple_resistor_0",
|
|
19
|
+
schematic_component_id: "schematic_component_simple_resistor_0",
|
|
20
|
+
rotation: 0,
|
|
21
|
+
size: {
|
|
22
|
+
width: 1,
|
|
23
|
+
height: 0.3,
|
|
24
|
+
},
|
|
25
|
+
center: {
|
|
26
|
+
x: 0,
|
|
27
|
+
y: 0,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "source_port",
|
|
32
|
+
name: "left",
|
|
33
|
+
source_port_id: "source_port_0",
|
|
34
|
+
source_component_id: "simple_resistor_0",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "schematic_port",
|
|
38
|
+
schematic_port_id: "schematic_port_0",
|
|
39
|
+
source_port_id: "source_port_0",
|
|
40
|
+
center: {
|
|
41
|
+
x: -0.5,
|
|
42
|
+
y: 0,
|
|
43
|
+
},
|
|
44
|
+
facing_direction: "left",
|
|
45
|
+
schematic_component_id: "schematic_component_simple_resistor_0",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: "source_port",
|
|
49
|
+
name: "right",
|
|
50
|
+
source_port_id: "source_port_1",
|
|
51
|
+
source_component_id: "simple_resistor_0",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: "schematic_port",
|
|
55
|
+
schematic_port_id: "schematic_port_1",
|
|
56
|
+
source_port_id: "source_port_1",
|
|
57
|
+
center: {
|
|
58
|
+
x: 0.5,
|
|
59
|
+
y: 0,
|
|
60
|
+
},
|
|
61
|
+
facing_direction: "right",
|
|
62
|
+
schematic_component_id: "schematic_component_simple_resistor_0",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: "schematic_text",
|
|
66
|
+
text: "R1",
|
|
67
|
+
schematic_text_id: "schematic_text_0",
|
|
68
|
+
schematic_component_id: "schematic_component_simple_resistor_0",
|
|
69
|
+
anchor: "left",
|
|
70
|
+
position: {
|
|
71
|
+
x: -0.2,
|
|
72
|
+
y: -0.5,
|
|
73
|
+
},
|
|
74
|
+
rotation: 0,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: "schematic_text",
|
|
78
|
+
text: "100",
|
|
79
|
+
schematic_text_id: "schematic_text_1",
|
|
80
|
+
schematic_component_id: "schematic_component_simple_resistor_0",
|
|
81
|
+
anchor: "left",
|
|
82
|
+
position: {
|
|
83
|
+
x: -0.2,
|
|
84
|
+
y: -0.3,
|
|
85
|
+
},
|
|
86
|
+
rotation: 0,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "source_net",
|
|
90
|
+
member_source_group_ids: [],
|
|
91
|
+
source_net_id: "net_0",
|
|
92
|
+
name: "N1",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: "source_trace",
|
|
96
|
+
connected_source_port_ids: ["source_port_1"],
|
|
97
|
+
connected_source_net_ids: ["net_0"],
|
|
98
|
+
source_trace_id: "source_trace_0",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: "schematic_net_label",
|
|
102
|
+
source_net_id: "net_0",
|
|
103
|
+
text: "N1",
|
|
104
|
+
anchor_side: "left",
|
|
105
|
+
center: {
|
|
106
|
+
x: 1.5,
|
|
107
|
+
y: 0,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: "schematic_trace",
|
|
112
|
+
schematic_trace_id: "schematic_trace_0",
|
|
113
|
+
source_trace_id: "source_trace_0",
|
|
114
|
+
edges: [
|
|
93
115
|
{
|
|
94
|
-
|
|
95
|
-
schematic_port_id: "schematic_port_1",
|
|
96
|
-
source_port_id: "source_port_1",
|
|
97
|
-
center: {
|
|
116
|
+
from: {
|
|
98
117
|
x: 0.5,
|
|
99
118
|
y: 0,
|
|
100
119
|
},
|
|
101
|
-
|
|
102
|
-
schematic_component_id: "schematic_component_simple_resistor_0",
|
|
103
|
-
source: {
|
|
104
|
-
type: "source_port",
|
|
105
|
-
name: "right",
|
|
106
|
-
source_port_id: "source_port_1",
|
|
107
|
-
source_component_id: "simple_resistor_0",
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
type: "schematic_text",
|
|
112
|
-
text: "R1",
|
|
113
|
-
schematic_text_id: "schematic_text_0",
|
|
114
|
-
schematic_component_id: "schematic_component_simple_resistor_0",
|
|
115
|
-
anchor: "left",
|
|
116
|
-
position: {
|
|
117
|
-
x: -0.2,
|
|
118
|
-
y: -0.5,
|
|
119
|
-
},
|
|
120
|
-
rotation: 0,
|
|
121
|
-
source: null,
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
type: "schematic_text",
|
|
125
|
-
text: 100,
|
|
126
|
-
schematic_text_id: "schematic_text_1",
|
|
127
|
-
schematic_component_id: "schematic_component_simple_resistor_0",
|
|
128
|
-
anchor: "left",
|
|
129
|
-
position: {
|
|
130
|
-
x: -0.2,
|
|
131
|
-
y: -0.3,
|
|
132
|
-
},
|
|
133
|
-
rotation: 0,
|
|
134
|
-
source: null,
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
type: "source_net",
|
|
138
|
-
member_source_group_ids: [],
|
|
139
|
-
source_net_id: "net_0",
|
|
140
|
-
name: "N1",
|
|
141
|
-
source: null,
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
type: "source_trace",
|
|
145
|
-
connected_source_port_ids: ["source_port_1"],
|
|
146
|
-
connected_source_net_ids: ["net_0"],
|
|
147
|
-
source_trace_id: "source_trace_0",
|
|
148
|
-
source: null,
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
type: "schematic_net_label",
|
|
152
|
-
source_net_id: "net_0",
|
|
153
|
-
text: "N1",
|
|
154
|
-
anchor_side: "left",
|
|
155
|
-
center: {
|
|
120
|
+
to: {
|
|
156
121
|
x: 1.5,
|
|
157
122
|
y: 0,
|
|
158
123
|
},
|
|
159
|
-
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
type: "schematic_trace",
|
|
163
|
-
schematic_trace_id: "schematic_trace_0",
|
|
164
|
-
source_trace_id: "source_trace_0",
|
|
165
|
-
edges: [
|
|
166
|
-
{
|
|
167
|
-
from: {
|
|
168
|
-
x: 0.5,
|
|
169
|
-
y: 0,
|
|
170
|
-
},
|
|
171
|
-
to: {
|
|
172
|
-
x: 1.5,
|
|
173
|
-
y: 0,
|
|
174
|
-
},
|
|
175
|
-
from_schematic_port_id: "schematic_port_1",
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
source: null,
|
|
124
|
+
from_schematic_port_id: "schematic_port_1",
|
|
179
125
|
},
|
|
180
126
|
],
|
|
181
|
-
}
|
|
182
|
-
}
|
|
127
|
+
},
|
|
128
|
+
]}
|
|
183
129
|
/>
|
|
184
130
|
)
|
|
185
131
|
}
|
|
@@ -3,26 +3,28 @@ import { Schematic } from "../../Schematic"
|
|
|
3
3
|
export const SchematicNetLabel2 = () => {
|
|
4
4
|
return (
|
|
5
5
|
<Schematic style={{ height: 500 }}>
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
6
|
+
<board width={10} height={10}>
|
|
7
|
+
<resistor resistance="1k" name="R1" schX={-2} schY={0} />
|
|
8
|
+
<resistor resistance="1k" name="R2" schX={2} schY={0} />
|
|
9
|
+
<resistor
|
|
10
|
+
schRotation="90deg"
|
|
11
|
+
resistance="1k"
|
|
12
|
+
name="R3"
|
|
13
|
+
schX={0}
|
|
14
|
+
schY={2}
|
|
15
|
+
/>
|
|
16
|
+
<resistor
|
|
17
|
+
schRotation="90deg"
|
|
18
|
+
resistance="1k"
|
|
19
|
+
name="R4"
|
|
20
|
+
schX={0}
|
|
21
|
+
schY={-2}
|
|
22
|
+
/>
|
|
23
|
+
<trace from=".R1 > .right" to="net.N1" />
|
|
24
|
+
<trace from=".R2 > .left" to="net.N2" />
|
|
25
|
+
<trace from=".R3 > .left" to="net.N3" />
|
|
26
|
+
<trace from=".R4 > .right" to="net.GND2" />
|
|
27
|
+
</board>
|
|
26
28
|
</Schematic>
|
|
27
29
|
)
|
|
28
30
|
}
|
|
@@ -5,13 +5,16 @@ export const BugConnections = () => {
|
|
|
5
5
|
<Schematic style={{ height: 600 }}>
|
|
6
6
|
<bug
|
|
7
7
|
name="B1"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
schPortArrangement={{
|
|
9
|
+
leftSize: 3,
|
|
10
|
+
rightSize: 2,
|
|
11
11
|
}}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
schHeight={5}
|
|
13
|
+
schWidth={3}
|
|
14
|
+
schPinSpacing={2}
|
|
15
|
+
schX={8}
|
|
16
|
+
schY={3}
|
|
17
|
+
pinLabels={{
|
|
15
18
|
"1": "D0",
|
|
16
19
|
"2": "D1",
|
|
17
20
|
}}
|