@tscircuit/schematic-viewer 1.1.5 → 1.1.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/schematic-viewer",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "repository": "tscircuit/schematic-viewer",
@@ -32,7 +32,7 @@
32
32
  "@storybook/nextjs": "^7.4.0",
33
33
  "@storybook/react": "^7.4.0",
34
34
  "@storybook/testing-library": "^0.0.14-next.2",
35
- "@tscircuit/builder": "^1.3.2",
35
+ "@tscircuit/builder": "^1.5.5",
36
36
  "@tscircuit/react-fiber": "^1.0.6",
37
37
  "@tscircuit/routing": "^1.3.0",
38
38
  "@tscircuit/table-viewer": "^0.0.6",
@@ -1,7 +1,11 @@
1
1
  import * as Type from "lib/types"
2
2
  import SVGPathComponent from "./SVGPathComponent"
3
3
  import range from "lodash/range"
4
- import { getPortPosition, getPortArrangementSize } from "@tscircuit/builder"
4
+ import {
5
+ getPortPosition,
6
+ getPortArrangementSize,
7
+ getPortIndices,
8
+ } from "@tscircuit/builder"
5
9
  import getSVGPathBounds from "lib/utils/get-svg-path-bounds"
6
10
 
7
11
  interface Props {
@@ -22,6 +26,7 @@ export const SchematicBug = ({ component: { source, schematic } }: Props) => {
22
26
  let bugh = schematic.size.height
23
27
  const { total_ports, width, height } =
24
28
  getPortArrangementSize(port_arrangement)
29
+ const port_indices = getPortIndices(port_arrangement)
25
30
 
26
31
  // TODO remove, this seems to be due to a builder bug
27
32
  if (isNaN(bugw)) bugw = width
@@ -36,7 +41,7 @@ export const SchematicBug = ({ component: { source, schematic } }: Props) => {
36
41
  bugw / 2
37
42
  } ${bugh / 2} L ${-bugw / 2} ${bugh / 2}Z`,
38
43
  },
39
- ...range(1, total_ports + 1).map((portNum) => {
44
+ ...port_indices.map((portNum) => {
40
45
  const pos = getPortPosition(port_arrangement, portNum)
41
46
 
42
47
  const x2 =
@@ -0,0 +1,100 @@
1
+ import { Schematic } from "Schematic"
2
+
3
+ export const FTDIBasic3v3 = () => (
4
+ <group>
5
+ <bug
6
+ name="U1"
7
+ port_arrangement={{
8
+ left_side: {
9
+ pins: [16, 15, 20, 17, 4, 27, 28, 19, 26, 25, 7, 18, 21],
10
+ direction: "top-to-bottom",
11
+ },
12
+ right_side: {
13
+ pins: [1, 5, 11, 3, 2, 9, 10, 6, 23, 22, 14, 13, 12],
14
+ direction: "top-to-bottom",
15
+ },
16
+ }}
17
+ footprint="ssop28Db"
18
+ port_labels={{
19
+ "1": "TXD",
20
+ "5": "RXD",
21
+ "11": "CTS",
22
+ "3": "RTS",
23
+ "2": "DTR",
24
+ "9": "DSR",
25
+ "10": "DCD",
26
+ "6": "RI",
27
+ "23": "TXLED",
28
+ "22": "RXLED",
29
+ "14": "PWRUN",
30
+ "13": "TXDEN",
31
+ "12": "SLEEP",
32
+ "16": "USBDM",
33
+ "15": "USBDP",
34
+ "20": "VCC",
35
+ "17": "3V3OUT",
36
+ "4": "VCCIO",
37
+ "27": "OSCI",
38
+ "28": "OSCO",
39
+ "19": "RESET",
40
+ "26": "TEST",
41
+ "25": "AGND",
42
+ "7": "GND7",
43
+ "18": "GND18",
44
+ "21": "GND21",
45
+ }}
46
+ />
47
+ <resistor
48
+ resistance="1kohm"
49
+ name="R1"
50
+ footprint="0805"
51
+ center={[3, 0]}
52
+ rotation="90deg"
53
+ />
54
+ <resistor
55
+ resistance="1kohm"
56
+ name="R2"
57
+ footprint="0805"
58
+ center={[4.5, 0]}
59
+ rotation="90deg"
60
+ />
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]} />
65
+ <trace path={[".5V", ".R2 > port.left"]} />
66
+ <trace path={[".5V", ".R1 > port.left"]} />
67
+ <trace path={[".R1 > port.right", ".LED1 > port.left"]} />
68
+ <trace path={[".R2 > port.right", ".LED2 > port.left"]} />
69
+ <trace path={[".LED1 > port.right", ".U1 > .TXLED"]} />
70
+ <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" />
76
+ {/* <component>
77
+ <schematicbox
78
+ name="USB"
79
+ center={[-9, 0]}
80
+ type="schematic_box"
81
+ drawing_type="box"
82
+ width={2}
83
+ height={2}
84
+ />
85
+ </component> */}
86
+ </group>
87
+ )
88
+
89
+ export const BugHighPortNumbers = () => {
90
+ return (
91
+ <Schematic style={{ height: 600 }}>
92
+ <FTDIBasic3v3 />
93
+ </Schematic>
94
+ )
95
+ }
96
+
97
+ export default {
98
+ title: "BugHighPortNumbers",
99
+ component: BugHighPortNumbers,
100
+ }