@tscircuit/schematic-viewer 1.2.14 → 1.3.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/dist/index.d.ts +3 -3
- package/dist/index.js +106 -87
- package/dist/index.js.map +1 -1
- package/package.json +18 -8
- package/renovate.json +12 -1
- package/src/Schematic.tsx +16 -19
- package/src/lib/types/source-component.ts +1 -0
- package/src/lib/utils/collect-element-refs.ts +3 -3
- package/src/schematic-components/SchematicBug.tsx +27 -10
- package/src/schematic-components/SchematicElement.tsx +7 -13
- package/src/stories/basics/schematic-net-label.stories.tsx +112 -166
- package/src/stories/bug-connections.stories.tsx +6 -6
- package/src/stories/bug-high-port-numbers.stories.tsx +20 -17
- 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/bug8-autolayout.stories.tsx +2 -2
- package/src/stories/component-drawing-example.stories.tsx +2 -2
- package/src/stories/led-circuit-builder.stories.tsx +1 -1
- package/src/stories/led-circuit-react.stories.tsx +14 -11
- 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
|
@@ -4,18 +4,19 @@ const FTDIBasic3v3 = () => (
|
|
|
4
4
|
<group>
|
|
5
5
|
<bug
|
|
6
6
|
name="U1"
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
manufacturerPartNumber="part-number"
|
|
8
|
+
schPortArrangement={{
|
|
9
|
+
leftSide: {
|
|
9
10
|
pins: [16, 15, 20, 17, 4, 27, 28, 19, 26, 25, 7, 18, 21],
|
|
10
11
|
direction: "top-to-bottom",
|
|
11
12
|
},
|
|
12
|
-
|
|
13
|
+
rightSide: {
|
|
13
14
|
pins: [1, 5, 11, 3, 2, 9, 10, 6, 23, 22, 14, 13, 12],
|
|
14
15
|
direction: "top-to-bottom",
|
|
15
16
|
},
|
|
16
17
|
}}
|
|
17
18
|
footprint="ssop28Db"
|
|
18
|
-
|
|
19
|
+
pinLabels={{
|
|
19
20
|
"1": "TXD",
|
|
20
21
|
"5": "RXD",
|
|
21
22
|
"11": "CTS",
|
|
@@ -48,31 +49,33 @@ const FTDIBasic3v3 = () => (
|
|
|
48
49
|
resistance="1kohm"
|
|
49
50
|
name="R1"
|
|
50
51
|
footprint="0805"
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
schX={3}
|
|
53
|
+
schY={0}
|
|
54
|
+
schRotation="90deg"
|
|
53
55
|
/>
|
|
54
56
|
<resistor
|
|
55
57
|
resistance="1kohm"
|
|
56
58
|
name="R2"
|
|
57
59
|
footprint="0805"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
schX={4.5}
|
|
61
|
+
schY={0}
|
|
62
|
+
schRotation="90deg"
|
|
60
63
|
/>
|
|
61
|
-
<diode name="LED1" footprint="0805"
|
|
62
|
-
<diode name="LED2" footprint="0805"
|
|
63
|
-
<netalias net="5V"
|
|
64
|
-
<netalias net="5V"
|
|
64
|
+
<diode name="LED1" footprint="0805" schRotation={"90deg"} schX={3} schY={2} />
|
|
65
|
+
<diode name="LED2" footprint="0805" schRotation={"90deg"} schX={4.5} schY={2} />
|
|
66
|
+
<netalias net="5V" schX={3} schY={-2} />
|
|
67
|
+
<netalias net="5V" schX={4.5} schY={-2} />
|
|
65
68
|
<trace path={[".5V", ".R2 > port.left"]} />
|
|
66
69
|
<trace path={[".5V", ".R1 > port.left"]} />
|
|
67
70
|
<trace path={[".R1 > port.right", ".LED1 > port.left"]} />
|
|
68
71
|
<trace path={[".R2 > port.right", ".LED2 > port.left"]} />
|
|
69
72
|
<trace path={[".LED1 > port.right", ".U1 > .TXLED"]} />
|
|
70
73
|
<trace path={[".LED2 > port.right", ".U1 > .RXLED"]} />
|
|
71
|
-
<netalias net="GND"
|
|
72
|
-
<netalias net="GND"
|
|
73
|
-
<netalias net="GND"
|
|
74
|
-
<netalias net="GND"
|
|
75
|
-
<netalias net="GND"
|
|
74
|
+
<netalias net="GND" schX={-3} schY={4} schRotation="180deg" />
|
|
75
|
+
<netalias net="GND" schX={-5} schY={3} schRotation="180deg" />
|
|
76
|
+
<netalias net="GND" schX={-6} schY={3} schRotation="180deg" />
|
|
77
|
+
<netalias net="GND" schX={-7} schY={3} schRotation="180deg" />
|
|
78
|
+
<netalias net="GND" schX={-8} schY={2} schRotation="180deg" />
|
|
76
79
|
{/* <component>
|
|
77
80
|
<schematicbox
|
|
78
81
|
name="USB"
|
|
@@ -4,8 +4,9 @@ export const Bug1YFlip = () => {
|
|
|
4
4
|
return (
|
|
5
5
|
<Schematic style={{ height: 600 }}>
|
|
6
6
|
<bug
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
name="U1"
|
|
8
|
+
schPortArrangement={{ topSize: 2 }}
|
|
9
|
+
pinLabels={{ 1: "foo", 2: "baz" }}
|
|
9
10
|
/>
|
|
10
11
|
</Schematic>
|
|
11
12
|
)
|
|
@@ -3,8 +3,8 @@ import { Schematic } from "Schematic"
|
|
|
3
3
|
export const ComponentDrawingExample = () => {
|
|
4
4
|
return (
|
|
5
5
|
<Schematic style={{ height: 600 }}>
|
|
6
|
-
<component>
|
|
7
|
-
<schematicbox
|
|
6
|
+
<component name={"C1"}>
|
|
7
|
+
<schematicbox schX={0} schY={0} width="6mm" height="6mm" />
|
|
8
8
|
<schematicline x1={0} y1={0} x2={1} y2={1} />
|
|
9
9
|
</component>
|
|
10
10
|
</Schematic>
|
|
@@ -95,7 +95,7 @@ const $soup = pb
|
|
|
95
95
|
export const LEDCircuitBuilder = () => {
|
|
96
96
|
const soup = useMaybePromise($soup)
|
|
97
97
|
if (!soup) return null
|
|
98
|
-
return <Schematic style={{ height: 600 }} soup={soup} />
|
|
98
|
+
return <Schematic style={{ height: 600 }} soup={soup as any} />
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
export default {
|
|
@@ -3,32 +3,35 @@ import { Schematic } from "../Schematic"
|
|
|
3
3
|
export const LEDCircuitReact = () => {
|
|
4
4
|
return (
|
|
5
5
|
<Schematic style={{ height: 500 }}>
|
|
6
|
-
<resistor name="R1" resistance="10 ohm"
|
|
6
|
+
<resistor name="R1" resistance="10 ohm" schX={2} schY={1} />
|
|
7
7
|
<capacitor
|
|
8
8
|
name="C1"
|
|
9
9
|
capacitance="10 uF"
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
schX={4}
|
|
11
|
+
schY={2}
|
|
12
|
+
schRotation="90deg"
|
|
12
13
|
/>
|
|
13
14
|
<resistor
|
|
14
15
|
name="R2"
|
|
15
16
|
resistance="10 ohm"
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
schX={6}
|
|
18
|
+
schY={1}
|
|
19
|
+
schRotation="90deg"
|
|
18
20
|
/>
|
|
19
21
|
<trace
|
|
20
22
|
path={[".R1 > port.right", ".C1 > port.left", ".R2 > port.left"]}
|
|
21
23
|
/>
|
|
22
|
-
<powersource voltage="5V"
|
|
24
|
+
<powersource voltage="5V" schX={1} schY={2} name="main_power" />
|
|
23
25
|
<trace path={[".main_power > port.positive", ".R1 > port.left"]} />
|
|
24
26
|
<trace
|
|
25
27
|
path={["power > port.negative", ".C1 > port.right", ".R2 > port.right"]}
|
|
26
28
|
/>
|
|
27
29
|
<bug
|
|
28
30
|
name="B1"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
schPortArrangement={{ leftSide: { pins: [3, 2, 1], direction: "top-to-bottom" }, rightSide: { pins: [6, 5, 4], direction: "top-to-bottom" } }}
|
|
32
|
+
schX={8}
|
|
33
|
+
schY={3}
|
|
34
|
+
pinLabels={{
|
|
32
35
|
1: "PWR",
|
|
33
36
|
2: "NC",
|
|
34
37
|
3: "RG",
|
|
@@ -41,12 +44,12 @@ export const LEDCircuitReact = () => {
|
|
|
41
44
|
<ground name="GND" center={[11, 3]} />
|
|
42
45
|
<trace path={[".B1 > port.GND", ".GND > .gnd"]} />
|
|
43
46
|
{/* <trace from=".B1 > port.GND" to=".GND > .gnd" /> */}
|
|
44
|
-
<diode name="D1"
|
|
47
|
+
<diode name="D1" schX={6} schY={3.5} schRotation="180deg" />
|
|
45
48
|
<trace path={[".D1 > port.right", ".C1 > .right"]} />
|
|
46
49
|
<trace path={[".D1 > port.left", ".B1 > .RG"]} />
|
|
47
50
|
{/* <trace from=".D1 > .left" to=".B1 > .RG" /> */}
|
|
48
51
|
{/* <trace from=".D1 > .right" to=".C1> .right" /> */}
|
|
49
|
-
<netalias
|
|
52
|
+
<netalias schX={"10mm"} schY={"1.5mm"} net="D0BUS" />
|
|
50
53
|
<trace path={[".B1 > .D0", ".D0BUS"]} />
|
|
51
54
|
</Schematic>
|
|
52
55
|
)
|
|
@@ -7,13 +7,13 @@ export const OffCenterRendering = () => {
|
|
|
7
7
|
<Schematic style={{ height: 600 }}>
|
|
8
8
|
<bug
|
|
9
9
|
name="B1"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
schPortArrangement={{
|
|
11
|
+
leftSide: { pins: [3, 2, 1], direction: "top-to-bottom" },
|
|
12
|
+
rightSide: { pins: [6, 5, 4], direction: "top-to-bottom" },
|
|
13
13
|
}}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
schX={8}
|
|
15
|
+
schY={3}
|
|
16
|
+
pinLabels={{
|
|
17
17
|
"1": "D0",
|
|
18
18
|
"2": "D1",
|
|
19
19
|
}}
|
|
@@ -5,15 +5,15 @@ export const ThreeSidedBug = () => {
|
|
|
5
5
|
<Schematic style={{ height: 600 }}>
|
|
6
6
|
<bug
|
|
7
7
|
name="B1"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
schPortArrangement={{
|
|
9
|
+
leftSize: 3,
|
|
10
|
+
rightSize: 3,
|
|
11
|
+
topSize: 0,
|
|
12
|
+
bottomSize: 5,
|
|
13
13
|
}}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
schX={8}
|
|
15
|
+
schY={3}
|
|
16
|
+
pinLabels={{
|
|
17
17
|
"1": "D0",
|
|
18
18
|
"2": "D1",
|
|
19
19
|
}}
|