@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.
@@ -4,18 +4,19 @@ const FTDIBasic3v3 = () => (
4
4
  <group>
5
5
  <bug
6
6
  name="U1"
7
- port_arrangement={{
8
- left_side: {
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
- right_side: {
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
- port_labels={{
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
- center={[3, 0]}
52
- rotation="90deg"
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
- center={[4.5, 0]}
59
- rotation="90deg"
60
+ schX={4.5}
61
+ schY={0}
62
+ schRotation="90deg"
60
63
  />
61
- <diode name="LED1" footprint="0805" rotation="90deg" center={[3, 2]} />
62
- <diode name="LED2" footprint="0805" rotation="90deg" center={[4.5, 2]} />
63
- <netalias net="5V" center={[3, -2]} />
64
- <netalias net="5V" center={[4.5, -2]} />
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" center={[-3, 4]} rotation="180deg" />
72
- <netalias net="GND" center={[-5, 3]} rotation="180deg" />
73
- <netalias net="GND" center={[-6, 3]} rotation="180deg" />
74
- <netalias net="GND" center={[-7, 3]} rotation="180deg" />
75
- <netalias net="GND" center={[-8, 2]} rotation="180deg" />
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"
@@ -3,6 +3,7 @@ import { Schematic } from "Schematic"
3
3
  const BugPinSpacingExample = () => (
4
4
  <bug
5
5
  name="U2"
6
+ manufacturerPartNumber="part-number"
6
7
  schPortArrangement={{
7
8
  leftSize: 2,
8
9
  rightSize: 2,
@@ -4,8 +4,9 @@ export const Bug1YFlip = () => {
4
4
  return (
5
5
  <Schematic style={{ height: 600 }}>
6
6
  <bug
7
- port_arrangement={{ top_size: 2 }}
8
- port_labels={{ 1: "foo", 2: "baz" }}
7
+ name="U1"
8
+ schPortArrangement={{ topSize: 2 }}
9
+ pinLabels={{ 1: "foo", 2: "baz" }}
9
10
  />
10
11
  </Schematic>
11
12
  )
@@ -30,8 +30,8 @@ export const Bug8Autolayout = () => {
30
30
  <Schematic style={{ height: 500 }}>
31
31
  <board
32
32
  layout={layout().autoLayoutSchematic()}
33
- pcbCenterX={0}
34
- pcbCenterY={0}
33
+ pcbX={0}
34
+ pcbY={0}
35
35
  width={"10mm"}
36
36
  height={"10mm"}
37
37
  >
@@ -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 x={0} y={0} width="6mm" height="6mm" />
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" center={[2, 1]} />
6
+ <resistor name="R1" resistance="10 ohm" schX={2} schY={1} />
7
7
  <capacitor
8
8
  name="C1"
9
9
  capacitance="10 uF"
10
- center={[4, 2]}
11
- rotation="90deg"
10
+ schX={4}
11
+ schY={2}
12
+ schRotation="90deg"
12
13
  />
13
14
  <resistor
14
15
  name="R2"
15
16
  resistance="10 ohm"
16
- center={[6, 1]}
17
- rotation="90deg"
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" center={[1, 2]} name="main_power" />
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
- port_arrangement={{ left_size: 3, right_size: 3 }}
30
- center={[8, 3]}
31
- port_labels={{
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" center={[6, 3.5]} rotation="180deg" />
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 center={["10mm", "1.5mm"]} net="D0BUS" />
52
+ <netalias schX={"10mm"} schY={"1.5mm"} net="D0BUS" />
50
53
  <trace path={[".B1 > .D0", ".D0BUS"]} />
51
54
  </Schematic>
52
55
  )
@@ -83,7 +83,7 @@ const soup = [
83
83
  ]
84
84
 
85
85
  export const NetAliasSoup = () => {
86
- return <Schematic style={{ height: 500 }} soup={soup} />
86
+ return <Schematic style={{ height: 500 }} soup={soup as any} />
87
87
  }
88
88
 
89
89
  export default {
@@ -7,13 +7,13 @@ export const OffCenterRendering = () => {
7
7
  <Schematic style={{ height: 600 }}>
8
8
  <bug
9
9
  name="B1"
10
- port_arrangement={{
11
- left_size: 3,
12
- right_size: 2,
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
- sch_cx={8}
15
- sch_cy={3}
16
- port_labels={{
14
+ schX={8}
15
+ schY={3}
16
+ pinLabels={{
17
17
  "1": "D0",
18
18
  "2": "D1",
19
19
  }}
@@ -9,7 +9,7 @@ export const RotatedResistor = () => {
9
9
  schX={2}
10
10
  schY={1}
11
11
  schRotation="90deg"
12
- rotation="90deg"
12
+ pcbRotation="90deg"
13
13
  />
14
14
  </Schematic>
15
15
  )
@@ -31,7 +31,7 @@ const soup: AnyElement[] = [
31
31
  ]
32
32
 
33
33
  export const SchematicPathSoup = () => {
34
- return <Schematic style={{ height: 500 }} soup={soup} />
34
+ return <Schematic style={{ height: 500 }} soup={soup as any} />
35
35
  }
36
36
 
37
37
  export default {
@@ -5,15 +5,15 @@ export const ThreeSidedBug = () => {
5
5
  <Schematic style={{ height: 600 }}>
6
6
  <bug
7
7
  name="B1"
8
- port_arrangement={{
9
- left_size: 3,
10
- right_size: 3,
11
- top_size: 0,
12
- bottom_size: 5,
8
+ schPortArrangement={{
9
+ leftSize: 3,
10
+ rightSize: 3,
11
+ topSize: 0,
12
+ bottomSize: 5,
13
13
  }}
14
- sch_cx={8}
15
- sch_cy={3}
16
- port_labels={{
14
+ schX={8}
15
+ schY={3}
16
+ pinLabels={{
17
17
  "1": "D0",
18
18
  "2": "D1",
19
19
  }}