@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
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/schematic-viewer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"repository":
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/tscircuit/schematic-viewer.git"
|
|
9
|
+
},
|
|
7
10
|
"scripts": {
|
|
8
11
|
"start": "storybook dev -p 6006",
|
|
9
12
|
"typecheck": "tsc --noEmit",
|
|
10
13
|
"build": "tsup",
|
|
11
14
|
"yalc": "npm run build && yalc push",
|
|
12
15
|
"storybook": "storybook dev -p 6006",
|
|
13
|
-
"build-storybook": "storybook build"
|
|
16
|
+
"build-storybook": "storybook build",
|
|
17
|
+
"chromatic": "npx chromatic --project-token=chpt_d88a6beb0734bbe"
|
|
14
18
|
},
|
|
15
19
|
"peerDependencies": {
|
|
16
20
|
"@tscircuit/builder": "*",
|
|
@@ -34,12 +38,13 @@
|
|
|
34
38
|
"@tscircuit/builder": "^1.5.126",
|
|
35
39
|
"@tscircuit/react-fiber": "^1.1.29",
|
|
36
40
|
"@tscircuit/routing": "^1.3.0",
|
|
37
|
-
"@tscircuit/soup": "^0.0.34",
|
|
38
41
|
"@tscircuit/table-viewer": "^0.0.6",
|
|
39
42
|
"@types/node": "^18.6.0",
|
|
40
43
|
"@types/react": "^18.0.15",
|
|
41
44
|
"@vitejs/plugin-react": "^4.3.0",
|
|
42
45
|
"ava": "^4.3.1",
|
|
46
|
+
"chromatic": "^11.5.5",
|
|
47
|
+
"circuit-json": "^0.0.82",
|
|
43
48
|
"esbuild": "^0.20.2",
|
|
44
49
|
"esbuild-register": "^3.5.0",
|
|
45
50
|
"next": "^14.2.3",
|
|
@@ -54,7 +59,7 @@
|
|
|
54
59
|
"transformation-matrix": "^2.12.0",
|
|
55
60
|
"tsup": "^6.7.0",
|
|
56
61
|
"type-fest": "^2.17.0",
|
|
57
|
-
"typescript": "^5.
|
|
62
|
+
"typescript": "^5.5.3",
|
|
58
63
|
"vite": "^5.2.11",
|
|
59
64
|
"vite-tsconfig-paths": "^4.3.2",
|
|
60
65
|
"zod": "^3.23.8",
|
|
@@ -62,11 +67,16 @@
|
|
|
62
67
|
},
|
|
63
68
|
"dependencies": {
|
|
64
69
|
"@storybook/react-vite": "^8.1.3",
|
|
65
|
-
"@tscircuit/layout": "^0.0.
|
|
66
|
-
"@tscircuit/props": "^0.0.
|
|
70
|
+
"@tscircuit/layout": "^0.0.25",
|
|
71
|
+
"@tscircuit/props": "^0.0.23",
|
|
72
|
+
"@tscircuit/soup-util": "^0.0.13",
|
|
67
73
|
"convert-units": "^2.3.4",
|
|
68
74
|
"react-error-boundary": "^4.0.4",
|
|
69
75
|
"react-supergrid": "^1.0.10",
|
|
70
76
|
"use-mouse-matrix-transform": "^1.1.12"
|
|
71
|
-
}
|
|
77
|
+
},
|
|
78
|
+
"bugs": {
|
|
79
|
+
"url": "https://github.com/tscircuit/schematic-viewer/issues"
|
|
80
|
+
},
|
|
81
|
+
"homepage": "https://github.com/tscircuit/schematic-viewer#readme"
|
|
72
82
|
}
|
package/renovate.json
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
3
|
"extends": [
|
|
4
|
-
"config:
|
|
4
|
+
"config:base"
|
|
5
|
+
],
|
|
6
|
+
"packageRules": [
|
|
7
|
+
{
|
|
8
|
+
"packagePatterns": ["*"],
|
|
9
|
+
"excludePackagePatterns": ["@tscircuit/*"],
|
|
10
|
+
"enabled": false
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"matchUpdateTypes": ["major", "minor", "patch"],
|
|
14
|
+
"automerge": true
|
|
15
|
+
}
|
|
5
16
|
]
|
|
6
17
|
}
|
package/src/Schematic.tsx
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import { useCallback, useEffect, useState } from "react"
|
|
2
|
-
import { ContextProviders, ProjectComponent } from "schematic-components"
|
|
3
|
-
import { SuperGrid, toMMSI } from "react-supergrid"
|
|
4
1
|
import {
|
|
5
2
|
AnyElement,
|
|
6
3
|
createProjectBuilder,
|
|
7
4
|
createProjectFromElements,
|
|
8
5
|
findBoundsAndCenter,
|
|
9
|
-
transformSchematicElement,
|
|
10
6
|
} from "@tscircuit/builder"
|
|
11
|
-
import * as builder1 from "@tscircuit/builder"
|
|
12
7
|
import TscReactFiber, { createRoot } from "@tscircuit/react-fiber"
|
|
13
|
-
import {
|
|
14
|
-
import { collectElementRefs } from "lib/utils/collect-element-refs"
|
|
15
|
-
import { useMouseMatrixTransform } from "use-mouse-matrix-transform"
|
|
16
|
-
import { ErrorBoundary as TypedErrorBoundary } from "react-error-boundary"
|
|
17
|
-
import { identity, compose, scale, translate } from "transformation-matrix"
|
|
8
|
+
import { AnyCircuitElement } from "circuit-json"
|
|
18
9
|
import { useGlobalStore } from "lib/render-context"
|
|
10
|
+
import { useCallback, useEffect, useState } from "react"
|
|
11
|
+
import { ErrorBoundary as TypedErrorBoundary } from "react-error-boundary"
|
|
12
|
+
import { SuperGrid, toMMSI } from "react-supergrid"
|
|
19
13
|
import useMeasure from "react-use-measure"
|
|
14
|
+
import { ContextProviders } from "schematic-components"
|
|
15
|
+
import { SchematicElement } from "schematic-components/SchematicElement"
|
|
16
|
+
import { compose, scale, translate } from "transformation-matrix"
|
|
17
|
+
import { useMouseMatrixTransform } from "use-mouse-matrix-transform"
|
|
20
18
|
import { TableViewer } from "./schematic-components/TableViewer"
|
|
21
|
-
import { AnySoupElement } from "@tscircuit/soup"
|
|
22
19
|
|
|
23
20
|
const ErrorBoundary = TypedErrorBoundary as any
|
|
24
21
|
|
|
@@ -41,13 +38,13 @@ export interface SchematicProps {
|
|
|
41
38
|
/** @deprecated use soup */
|
|
42
39
|
elements?: any
|
|
43
40
|
|
|
44
|
-
soup?:
|
|
41
|
+
soup?: AnyCircuitElement[]
|
|
45
42
|
|
|
46
43
|
style?: any
|
|
47
44
|
|
|
48
45
|
showTable?: boolean
|
|
49
46
|
|
|
50
|
-
_soupPostProcessor?: (soup:
|
|
47
|
+
_soupPostProcessor?: (soup: AnyCircuitElement[]) => AnyCircuitElement[]
|
|
51
48
|
}
|
|
52
49
|
|
|
53
50
|
export const Schematic = (props: SchematicProps) => {
|
|
@@ -84,17 +81,17 @@ export const SchematicWithoutContext = ({
|
|
|
84
81
|
const elmBounds = (ref.current as HTMLDivElement).getBoundingClientRect()
|
|
85
82
|
|
|
86
83
|
const { center, width, height } = elements.some((e) =>
|
|
87
|
-
e.type.startsWith("schematic_")
|
|
84
|
+
e.type.startsWith("schematic_"),
|
|
88
85
|
)
|
|
89
86
|
? findBoundsAndCenter(
|
|
90
|
-
elements.filter((e) => e.type.startsWith("schematic_"))
|
|
87
|
+
elements.filter((e) => e.type.startsWith("schematic_")),
|
|
91
88
|
)
|
|
92
89
|
: { center: { x: 0, y: 0 }, width: 0.001, height: 0.001 }
|
|
93
90
|
|
|
94
91
|
const scaleFactor = Math.min(
|
|
95
92
|
(elmBounds.width ?? 0) / width,
|
|
96
93
|
(elmBounds.height ?? 0) / height,
|
|
97
|
-
100
|
|
94
|
+
100,
|
|
98
95
|
)
|
|
99
96
|
setElements(elements)
|
|
100
97
|
setProject(createProjectFromElements(elements))
|
|
@@ -102,11 +99,11 @@ export const SchematicWithoutContext = ({
|
|
|
102
99
|
compose(
|
|
103
100
|
translate((elmBounds.width ?? 0) / 2, (elmBounds.height ?? 0) / 2),
|
|
104
101
|
scale(scaleFactor, -scaleFactor, 0, 0),
|
|
105
|
-
translate(-center.x, -center.y)
|
|
106
|
-
)
|
|
102
|
+
translate(-center.x, -center.y),
|
|
103
|
+
),
|
|
107
104
|
)
|
|
108
105
|
},
|
|
109
|
-
[setElements, setTransform]
|
|
106
|
+
[setElements, setTransform],
|
|
110
107
|
)
|
|
111
108
|
|
|
112
109
|
useEffect(() => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyCircuitElement, SourcePort } from "circuit-json"
|
|
2
2
|
|
|
3
3
|
export const collectElementRefs = (
|
|
4
|
-
elm:
|
|
5
|
-
allElms:
|
|
4
|
+
elm: AnyCircuitElement,
|
|
5
|
+
allElms: AnyCircuitElement[]
|
|
6
6
|
) => {
|
|
7
7
|
const source_port = allElms.find(
|
|
8
8
|
(e) =>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as Type from "lib/types"
|
|
2
|
-
import SVGPathComponent from "./SVGPathComponent"
|
|
3
|
-
import range from "lodash/range"
|
|
4
1
|
import {
|
|
5
|
-
getPortPosition,
|
|
6
2
|
getPortArrangementSize,
|
|
7
3
|
getPortIndices,
|
|
4
|
+
getPortPosition,
|
|
8
5
|
} from "@tscircuit/builder"
|
|
9
6
|
import type { SchematicComponent } from "@tscircuit/soup"
|
|
7
|
+
import * as Type from "lib/types"
|
|
10
8
|
import getSVGPathBounds from "lib/utils/get-svg-path-bounds"
|
|
9
|
+
import SVGPathComponent from "./SVGPathComponent"
|
|
10
|
+
import SchematicText from "./SchematicText"
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
13
|
component: {
|
|
@@ -17,11 +17,13 @@ interface Props {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const SchematicBug = ({ component: { source, schematic } }: Props) => {
|
|
20
|
+
const location = schematic.center
|
|
20
21
|
const port_arrangement = {
|
|
21
22
|
top_size: 0,
|
|
22
23
|
bottom_size: 0,
|
|
23
24
|
...schematic.port_arrangement,
|
|
24
25
|
}
|
|
26
|
+
const manufacturerPartNumber = source.manufacturerPartNumber
|
|
25
27
|
// const port_labels = schematic.port_labels!
|
|
26
28
|
let bugw = schematic.size.width // bug width
|
|
27
29
|
let bugh = schematic.size.height
|
|
@@ -78,12 +80,27 @@ export const SchematicBug = ({ component: { source, schematic } }: Props) => {
|
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
return (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
<>
|
|
84
|
+
<SVGPathComponent
|
|
85
|
+
rotation={schematic.rotation}
|
|
86
|
+
center={actualCenter}
|
|
87
|
+
size={actualSize}
|
|
88
|
+
paths={paths}
|
|
89
|
+
/>
|
|
90
|
+
<SchematicText
|
|
91
|
+
schematic_text={{
|
|
92
|
+
anchor: "bottom",
|
|
93
|
+
position: {
|
|
94
|
+
x: location.x + actualSize.minX / 1.5,
|
|
95
|
+
y: location.y + actualSize.minY,
|
|
96
|
+
},
|
|
97
|
+
schematic_component_id: "SYNTHETIC",
|
|
98
|
+
schematic_text_id: "SYNTHETIC",
|
|
99
|
+
text: manufacturerPartNumber,
|
|
100
|
+
type: "schematic_text",
|
|
101
|
+
}}
|
|
102
|
+
/>
|
|
103
|
+
</>
|
|
87
104
|
)
|
|
88
105
|
}
|
|
89
106
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyCircuitElement } from "circuit-json"
|
|
2
2
|
import { collectElementRefs } from "lib/utils/collect-element-refs"
|
|
3
|
+
import SchematicBox from "./SchematicBox"
|
|
3
4
|
import SchematicComponent from "./SchematicComponent"
|
|
5
|
+
import SchematicLine from "./SchematicLine"
|
|
6
|
+
import { SchematicNetLabel } from "./SchematicNetLabel"
|
|
7
|
+
import SchematicPath from "./SchematicPath"
|
|
4
8
|
import SchematicPort from "./SchematicPort"
|
|
5
9
|
import SchematicText from "./SchematicText"
|
|
6
|
-
import SchematicBox from "./SchematicBox"
|
|
7
10
|
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
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Render any @tsbuilder/builder AnyElement that can be put on a schematic.
|
|
@@ -17,8 +16,8 @@ export const SchematicElement = ({
|
|
|
17
16
|
element,
|
|
18
17
|
allElements,
|
|
19
18
|
}: {
|
|
20
|
-
element:
|
|
21
|
-
allElements:
|
|
19
|
+
element: AnyCircuitElement
|
|
20
|
+
allElements: AnyCircuitElement[]
|
|
22
21
|
}) => {
|
|
23
22
|
// A lot of the split logic for element types into a project is here:
|
|
24
23
|
// https://github.com/tscircuit/builder/blob/7e7bef9c0aadd11999795003b8986f0d244c111f/src/lib/project/create-project-from-elements.ts#L13
|
|
@@ -68,10 +67,5 @@ export const SchematicElement = ({
|
|
|
68
67
|
return <SchematicNetLabel net_label={element} />
|
|
69
68
|
}
|
|
70
69
|
|
|
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
70
|
return null
|
|
77
71
|
}
|
|
@@ -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
|
}
|
|
@@ -5,13 +5,13 @@ 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
|
+
schX={8}
|
|
13
|
+
schY={3}
|
|
14
|
+
pinLabels={{
|
|
15
15
|
"1": "D0",
|
|
16
16
|
"2": "D1",
|
|
17
17
|
}}
|