@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.
Files changed (54) hide show
  1. package/.github/workflows/chromatic.yml +30 -0
  2. package/.github/workflows/npm-build.yml +26 -0
  3. package/.github/workflows/npm-typecheck.yml +26 -0
  4. package/README.md +1 -1
  5. package/dist/index.d.ts +6 -7
  6. package/dist/index.js +690 -664
  7. package/dist/index.js.map +1 -1
  8. package/package.json +21 -12
  9. package/renovate.json +12 -1
  10. package/src/Schematic.tsx +148 -77
  11. package/src/lib/types/core.ts +14 -49
  12. package/src/lib/types/source-component.ts +6 -0
  13. package/src/lib/utils/collect-element-refs.ts +4 -3
  14. package/src/lib/utils/colors.ts +236 -0
  15. package/src/schematic-components/SVGPathComponent.tsx +84 -144
  16. package/src/schematic-components/SchematicChip.tsx +183 -0
  17. package/src/schematic-components/SchematicComponent.tsx +18 -24
  18. package/src/schematic-components/SchematicComponentFromSymbol.tsx +44 -0
  19. package/src/schematic-components/SchematicElement.tsx +4 -38
  20. package/src/schematic-components/SchematicTrace.tsx +4 -3
  21. package/src/schematic-components/index.tsx +7 -14
  22. package/src/stories/basics/schematic-net-label.stories.tsx +112 -166
  23. package/src/stories/basics/schematic-net-labels-2.stories.tsx +22 -20
  24. package/src/stories/bug-connections.stories.tsx +9 -6
  25. package/src/stories/bug-high-port-numbers.stories.tsx +99 -82
  26. package/src/stories/bug-pin-spacing.stories.tsx +1 -0
  27. package/src/stories/bugs/bug1-y-flip.stories.tsx +3 -2
  28. package/src/stories/bugs/bug3-scaling-trace.stories.tsx +11 -5
  29. package/src/stories/bugs/bug4-schematic-line.stories.tsx +0 -1
  30. package/src/stories/bugs/bug5-diode.stories.tsx +0 -1
  31. package/src/stories/bugs/bug8-autolayout.stories.tsx +22 -31
  32. package/src/stories/circuit-components/diode.stories.tsx +3 -1
  33. package/src/stories/circuit-components/resistor.stories.tsx +3 -1
  34. package/src/stories/component-drawing-example.stories.tsx +2 -2
  35. package/src/stories/led-circuit-react.stories.tsx +40 -45
  36. package/src/stories/net-alias.stories.tsx +1 -1
  37. package/src/stories/off-center-render.stories.tsx +6 -6
  38. package/src/stories/rotated-resistor.stories.tsx +1 -1
  39. package/src/stories/schematic-path.stories.tsx +1 -1
  40. package/src/stories/three-sided-bug.stories.tsx +8 -8
  41. package/src/pages/led-circuit.tsx +0 -96
  42. package/src/schematic-components/ProjectComponent.tsx +0 -70
  43. package/src/schematic-components/SchematicBox.tsx +0 -29
  44. package/src/schematic-components/SchematicBug.tsx +0 -90
  45. package/src/schematic-components/SchematicLine.tsx +0 -48
  46. package/src/schematic-components/SchematicPath.tsx +0 -51
  47. package/src/schematic-components/SchematicPort.tsx +0 -63
  48. package/src/schematic-components/SimpleCapacitor.tsx +0 -29
  49. package/src/schematic-components/SimpleDiode.tsx +0 -42
  50. package/src/schematic-components/SimpleGround.tsx +0 -30
  51. package/src/schematic-components/SimpleInductor.tsx +0 -29
  52. package/src/schematic-components/SimplePowerSource.tsx +0 -43
  53. package/src/schematic-components/SimpleResistor.tsx +0 -28
  54. package/src/stories/led-circuit-builder.stories.tsx +0 -104
package/package.json CHANGED
@@ -1,20 +1,22 @@
1
1
  {
2
2
  "name": "@tscircuit/schematic-viewer",
3
- "version": "1.2.14",
3
+ "version": "1.4.0",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
- "repository": "tscircuit/schematic-viewer",
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
- "@tscircuit/builder": "*",
17
- "@tscircuit/react-fiber": "*",
18
20
  "@tscircuit/table-viewer": "*",
19
21
  "react": "*"
20
22
  },
@@ -31,15 +33,14 @@
31
33
  "@storybook/nextjs": "^8.1.3",
32
34
  "@storybook/react": "^8.1.3",
33
35
  "@storybook/testing-library": "^0.0.14-next.2",
34
- "@tscircuit/builder": "^1.5.126",
35
- "@tscircuit/react-fiber": "^1.1.29",
36
36
  "@tscircuit/routing": "^1.3.0",
37
- "@tscircuit/soup": "^0.0.34",
38
37
  "@tscircuit/table-viewer": "^0.0.6",
39
38
  "@types/node": "^18.6.0",
40
39
  "@types/react": "^18.0.15",
41
40
  "@vitejs/plugin-react": "^4.3.0",
42
41
  "ava": "^4.3.1",
42
+ "chromatic": "^11.5.5",
43
+ "circuit-json": "^0.0.82",
43
44
  "esbuild": "^0.20.2",
44
45
  "esbuild-register": "^3.5.0",
45
46
  "next": "^14.2.3",
@@ -54,7 +55,7 @@
54
55
  "transformation-matrix": "^2.12.0",
55
56
  "tsup": "^6.7.0",
56
57
  "type-fest": "^2.17.0",
57
- "typescript": "^5.4.3",
58
+ "typescript": "^5.5.3",
58
59
  "vite": "^5.2.11",
59
60
  "vite-tsconfig-paths": "^4.3.2",
60
61
  "zod": "^3.23.8",
@@ -62,11 +63,19 @@
62
63
  },
63
64
  "dependencies": {
64
65
  "@storybook/react-vite": "^8.1.3",
65
- "@tscircuit/layout": "^0.0.17",
66
- "@tscircuit/props": "^0.0.15",
66
+ "@tscircuit/core": "^0.0.125",
67
+ "@tscircuit/layout": "^0.0.25",
68
+ "@tscircuit/props": "^0.0.23",
69
+ "@tscircuit/soup-util": "^0.0.38",
70
+ "circuit-to-svg": "^0.0.40",
67
71
  "convert-units": "^2.3.4",
68
72
  "react-error-boundary": "^4.0.4",
69
73
  "react-supergrid": "^1.0.10",
74
+ "schematic-symbols": "^0.0.78",
70
75
  "use-mouse-matrix-transform": "^1.1.12"
71
- }
76
+ },
77
+ "bugs": {
78
+ "url": "https://github.com/tscircuit/schematic-viewer/issues"
79
+ },
80
+ "homepage": "https://github.com/tscircuit/schematic-viewer#readme"
72
81
  }
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:recommended"
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,22 @@
1
- import { useCallback, useEffect, useState } from "react"
2
- import { ContextProviders, ProjectComponent } from "schematic-components"
3
- import { SuperGrid, toMMSI } from "react-supergrid"
4
- import {
5
- AnyElement,
6
- createProjectBuilder,
7
- createProjectFromElements,
8
- findBoundsAndCenter,
9
- transformSchematicElement,
10
- } from "@tscircuit/builder"
11
- import * as builder1 from "@tscircuit/builder"
12
- import TscReactFiber, { createRoot } from "@tscircuit/react-fiber"
13
- import { SchematicElement } from "schematic-components/SchematicElement"
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"
1
+ import { useRenderedCircuit } from "@tscircuit/core"
2
+ import { findBoundsAndCenter } from "@tscircuit/soup-util"
3
+ import type { AnyCircuitElement } from "circuit-json"
18
4
  import { useGlobalStore } from "lib/render-context"
5
+ import React, { useCallback, useEffect, useRef, useState } from "react"
6
+ import { ErrorBoundary as TypedErrorBoundary } from "react-error-boundary"
7
+ import { SuperGrid, toMMSI } from "react-supergrid"
19
8
  import useMeasure from "react-use-measure"
9
+ import { ContextProviders } from "schematic-components"
10
+ import { SchematicElement } from "schematic-components/SchematicElement"
11
+ import {
12
+ applyToPoint,
13
+ compose,
14
+ inverse,
15
+ Matrix,
16
+ scale,
17
+ translate,
18
+ } from "transformation-matrix"
20
19
  import { TableViewer } from "./schematic-components/TableViewer"
21
- import { AnySoupElement } from "@tscircuit/soup"
22
20
 
23
21
  const ErrorBoundary = TypedErrorBoundary as any
24
22
 
@@ -37,17 +35,10 @@ const toMMSINeg = (v: number, z: number) =>
37
35
 
38
36
  export interface SchematicProps {
39
37
  children?: any
40
-
41
- /** @deprecated use soup */
42
- elements?: any
43
-
44
- soup?: AnySoupElement[]
45
-
46
- style?: any
47
-
38
+ soup?: AnyCircuitElement[]
39
+ style?: React.CSSProperties
48
40
  showTable?: boolean
49
-
50
- _soupPostProcessor?: (soup: AnySoupElement[]) => AnySoupElement[]
41
+ _soupPostProcessor?: (soup: AnyCircuitElement[]) => AnyCircuitElement[]
51
42
  }
52
43
 
53
44
  export const Schematic = (props: SchematicProps) => {
@@ -60,74 +51,150 @@ export const Schematic = (props: SchematicProps) => {
60
51
 
61
52
  export const SchematicWithoutContext = ({
62
53
  children,
63
- elements: initialElements,
64
- soup: initialSoup,
54
+ soup,
65
55
  style,
66
56
  showTable = false,
67
57
  _soupPostProcessor,
68
58
  }: SchematicProps) => {
69
- initialSoup = initialSoup ?? initialElements ?? []
70
-
71
- const [elements, setElements] = useState<any>(initialSoup ?? [])
72
- const [project, setProject] = useState<any>(null)
73
- const { setCameraTransform, camera_transform: cameraTransform } =
74
- useGlobalStore()
59
+ const {
60
+ circuitJson: circuitJsonFromChildren,
61
+ error: errorFromChildren,
62
+ isLoading,
63
+ } = useRenderedCircuit(children)
64
+
65
+ const [elements, setElements] = useState<AnyCircuitElement[]>([])
66
+ const { setCameraTransform } = useGlobalStore()
75
67
  const [boundsRef, bounds] = useMeasure()
76
- const { ref, setTransform } = useMouseMatrixTransform({
77
- onSetTransform: (transform) => {
78
- setCameraTransform(transform)
68
+ const containerRef = useRef<HTMLDivElement>(null)
69
+ const transformRef = useRef<Matrix>(compose(translate(0, 0), scale(1, 1)))
70
+ const isDraggingRef = useRef(false)
71
+ const lastMousePosRef = useRef({ x: 0, y: 0 })
72
+ const [, forceUpdate] = useState({})
73
+
74
+ const updateTransform = useCallback(
75
+ (newTransform: Matrix) => {
76
+ transformRef.current = newTransform
77
+ setCameraTransform(newTransform)
78
+ forceUpdate({})
79
79
  },
80
- // initialTransform: compose(scale(100, 100, 0, 0)),
81
- })
82
- const setElementsAndCamera = useCallback(
83
- (elements: Array<AnyElement>) => {
84
- const elmBounds = (ref.current as HTMLDivElement).getBoundingClientRect()
80
+ [setCameraTransform],
81
+ )
82
+
83
+ useEffect(() => {
84
+ let processedElements: AnyCircuitElement[] = []
85
+ if (circuitJsonFromChildren && (!soup || soup.length === 0)) {
86
+ processedElements = circuitJsonFromChildren as AnyCircuitElement[]
87
+ } else if (soup && soup.length > 0) {
88
+ processedElements = soup
89
+ }
90
+
91
+ if (processedElements.length > 0) {
92
+ if (_soupPostProcessor) {
93
+ processedElements = _soupPostProcessor(processedElements)
94
+ }
95
+ setElements(processedElements)
96
+ }
97
+ }, [circuitJsonFromChildren, soup, _soupPostProcessor])
98
+
99
+ useEffect(() => {
100
+ if (elements.length > 0 && containerRef.current) {
101
+ const elmBounds = containerRef.current.getBoundingClientRect()
85
102
 
86
103
  const { center, width, height } = elements.some((e) =>
87
- e.type.startsWith("schematic_")
104
+ e.type.startsWith("schematic_"),
88
105
  )
89
106
  ? findBoundsAndCenter(
90
- elements.filter((e) => e.type.startsWith("schematic_"))
107
+ elements.filter((e) => e.type.startsWith("schematic_")),
91
108
  )
92
109
  : { center: { x: 0, y: 0 }, width: 0.001, height: 0.001 }
93
110
 
94
111
  const scaleFactor = Math.min(
95
112
  (elmBounds.width ?? 0) / width,
96
113
  (elmBounds.height ?? 0) / height,
97
- 100
114
+ 100,
98
115
  )
99
- setElements(elements)
100
- setProject(createProjectFromElements(elements))
101
- setTransform(
102
- compose(
103
- translate((elmBounds.width ?? 0) / 2, (elmBounds.height ?? 0) / 2),
104
- scale(scaleFactor, -scaleFactor, 0, 0),
105
- translate(-center.x, -center.y)
106
- )
116
+
117
+ const newTransform = compose(
118
+ translate((elmBounds.width ?? 0) / 2, (elmBounds.height ?? 0) / 2),
119
+ scale(scaleFactor, -scaleFactor, 0, 0),
120
+ translate(-center.x, -center.y),
107
121
  )
122
+
123
+ updateTransform(newTransform)
124
+ }
125
+ }, [elements, bounds.width, bounds.height, updateTransform])
126
+
127
+ const handleMouseDown = useCallback((e: React.MouseEvent) => {
128
+ isDraggingRef.current = true
129
+ lastMousePosRef.current = { x: e.clientX, y: e.clientY }
130
+ }, [])
131
+
132
+ const handleMouseMove = useCallback(
133
+ (e: React.MouseEvent) => {
134
+ if (!isDraggingRef.current) return
135
+
136
+ const dx = e.clientX - lastMousePosRef.current.x
137
+ const dy = e.clientY - lastMousePosRef.current.y
138
+ lastMousePosRef.current = { x: e.clientX, y: e.clientY }
139
+
140
+ const scale = transformRef.current.a // Assuming uniform scaling
141
+ const dragSensitivity = 150 / scale // Adjust this value to change drag speed
142
+
143
+ const newTransform = compose(
144
+ translate(dx * dragSensitivity, dy * dragSensitivity),
145
+ transformRef.current,
146
+ )
147
+ updateTransform(newTransform)
108
148
  },
109
- [setElements, setTransform]
149
+ [updateTransform],
150
+ )
151
+
152
+ const handleMouseUp = useCallback(() => {
153
+ isDraggingRef.current = false
154
+ }, [])
155
+
156
+ const handleWheel = useCallback(
157
+ (e: WheelEvent) => {
158
+ e.preventDefault()
159
+ const scaleMultiplier = Math.pow(0.999, e.deltaY)
160
+
161
+ if (containerRef.current) {
162
+ const rect = containerRef.current.getBoundingClientRect()
163
+ const mouseX = e.clientX - rect.left
164
+ const mouseY = e.clientY - rect.top
165
+
166
+ const inverseTransform = inverse(transformRef.current)
167
+ const transformedPoint = applyToPoint(inverseTransform, {
168
+ x: mouseX,
169
+ y: mouseY,
170
+ })
171
+
172
+ const newTransform = compose(
173
+ transformRef.current,
174
+ translate(transformedPoint.x, transformedPoint.y),
175
+ scale(scaleMultiplier, scaleMultiplier),
176
+ translate(-transformedPoint.x, -transformedPoint.y),
177
+ )
178
+
179
+ updateTransform(newTransform)
180
+ }
181
+ },
182
+ [updateTransform],
110
183
  )
111
184
 
112
185
  useEffect(() => {
113
- if (initialSoup.length > 0) {
114
- setElementsAndCamera(initialSoup as any)
115
- return
186
+ const container = containerRef.current
187
+ if (container) {
188
+ container.addEventListener("wheel", handleWheel, { passive: false })
189
+ return () => {
190
+ container.removeEventListener("wheel", handleWheel)
191
+ }
116
192
  }
117
- const projectBuilder = createProjectBuilder()
118
- ;((createRoot ?? TscReactFiber.createRoot) as any)()
119
- .render(children, projectBuilder as any)
120
- .then(async (elements) => {
121
- if (_soupPostProcessor) {
122
- elements = _soupPostProcessor(elements)
123
- }
124
- setElementsAndCamera(elements)
125
- })
126
- .catch((e) => {
127
- console.error("ERROR RENDERING CIRCUIT")
128
- throw e
129
- })
130
- }, [children])
193
+ }, [handleWheel])
194
+
195
+ if (errorFromChildren) {
196
+ return <div>Error: {errorFromChildren.message}</div>
197
+ }
131
198
 
132
199
  return (
133
200
  <>
@@ -139,13 +206,17 @@ export const SchematicWithoutContext = ({
139
206
  overflow: "hidden",
140
207
  position: "relative",
141
208
  isolation: "isolate",
142
- cursor: "grab",
209
+ cursor: isDraggingRef.current ? "grabbing" : "grab",
143
210
  ...style,
144
211
  }}
145
212
  ref={(el) => {
146
- ref.current = el
213
+ containerRef.current = el
147
214
  boundsRef(el)
148
215
  }}
216
+ onMouseDown={handleMouseDown}
217
+ onMouseMove={handleMouseMove}
218
+ onMouseUp={handleMouseUp}
219
+ onMouseLeave={handleMouseUp}
149
220
  >
150
221
  <SuperGrid
151
222
  stringifyCoord={(x, y, z) => {
@@ -154,7 +225,7 @@ export const SchematicWithoutContext = ({
154
225
  }}
155
226
  width={bounds.width}
156
227
  height={bounds.height}
157
- transform={cameraTransform}
228
+ transform={transformRef.current}
158
229
  />
159
230
  {elements?.map((elm, i) => (
160
231
  <ErrorBoundary key={i} fallbackRender={fallbackRender(elm)}>
@@ -166,7 +237,7 @@ export const SchematicWithoutContext = ({
166
237
  </ErrorBoundary>
167
238
  ))}
168
239
  </div>
169
- {showTable !== false && elements && <TableViewer elements={elements} />}
240
+ {showTable !== false && elements && <TableViewer elements={elements as any} />}
170
241
  </>
171
242
  )
172
243
  }
@@ -1,19 +1,17 @@
1
1
  import { AnySourceComponent, SourceComponent } from "./source-component"
2
+ import {
3
+ Size,
4
+ Point,
5
+ PcbTrace,
6
+ PcbComponent,
7
+ PcbPort,
8
+ SourceGroup,
9
+ } from "circuit-json"
2
10
 
3
11
  export interface SchematicConfig {
4
12
  type: "schematic_config"
5
13
  }
6
14
 
7
- export interface Point {
8
- x: number
9
- y: number
10
- }
11
-
12
- export interface Size {
13
- width: number
14
- height: number
15
- }
16
-
17
15
  export interface SourceConfig {
18
16
  type: "source_config"
19
17
  }
@@ -111,32 +109,6 @@ export interface SchematicPort {
111
109
  facing_direction?: "up" | "down" | "left" | "right"
112
110
  }
113
111
 
114
- export interface PCBTrace {
115
- type: "pcb_trace"
116
- source_trace_id: string
117
- pcb_trace_id: string
118
- route: Array<{
119
- x: number
120
- y: number
121
- strokeWidth: number
122
- cap: "butt" | "round" | "square"
123
- start_pcb_port_id?: string
124
- end_pcb_port_id?: string
125
- }>
126
- }
127
-
128
- export interface PCBComponent {
129
- type: "pcb_component"
130
- pcb_component_id: string
131
- source_component_id: string
132
- }
133
-
134
- export interface PCBPort {
135
- type: "pcb_port"
136
- pcb_port_id: string
137
- source_port_id: string
138
- }
139
-
140
112
  export interface PCBGroup {
141
113
  type: "pcb_group"
142
114
  source_group_id: string
@@ -153,13 +125,6 @@ export interface SourceTrace {
153
125
  connected_source_port_ids: string[]
154
126
  }
155
127
 
156
- export interface SourceGroup {
157
- type: "source_group"
158
- source_group_id: string
159
- name: string
160
- children_source_component_ids: string[]
161
- }
162
-
163
128
  export interface SourcePort {
164
129
  type: "source_port"
165
130
  name: string
@@ -178,9 +143,9 @@ export interface Project {
178
143
  schematic_ports: SchematicPort[]
179
144
  pcb_config: PCBConfig
180
145
  pcb_groups: PCBGroup[]
181
- pcb_components: PCBComponent[]
182
- pcb_traces: PCBTrace[]
183
- pcb_ports: PCBPort[]
146
+ pcb_components: PcbComponent[]
147
+ pcb_traces: PcbTrace[]
148
+ pcb_ports: PcbPort[]
184
149
  source_config: SourceConfig
185
150
  source_traces: SourceTrace[]
186
151
  source_groups: SourceGroup[]
@@ -195,11 +160,11 @@ export type AnyElement =
195
160
  | SourceGroup
196
161
  | SourceTrace
197
162
  | SourcePort
198
- | PCBTrace
199
- | PCBComponent
163
+ | PcbTrace
164
+ | PcbComponent
200
165
  | PCBGroup
201
166
  | PCBConfig
202
- | PCBPort
167
+ | PcbPort
203
168
  | SchematicGroup
204
169
  | SchematicComponent
205
170
  | SchematicTrace
@@ -35,8 +35,13 @@ export type LightEmittingDiode = SimpleDiode & {
35
35
  }
36
36
 
37
37
  export interface SimpleBug extends SourceComponentBase {
38
+ manufacturerPartNumber: any
38
39
  ftype: "simple_bug"
39
40
  }
41
+ export interface SimpleChip extends SourceComponentBase {
42
+ manufacturerPartNumber: any
43
+ ftype: "simple_chip"
44
+ }
40
45
 
41
46
  export interface SimplePowerSource extends SourceComponentBase {
42
47
  ftype: "simple_power_source"
@@ -51,6 +56,7 @@ export type AnySourceComponent =
51
56
  | SimpleResistor
52
57
  | SimpleCapacitor
53
58
  | SimpleBug
59
+ | SimpleChip
54
60
  | SimpleInductor
55
61
  | SimplePowerSource
56
62
  | SimpleGround
@@ -1,8 +1,8 @@
1
- import { AnySoupElement, SourcePort } from "@tscircuit/soup"
1
+ import { AnyCircuitElement, SourcePort } from "circuit-json"
2
2
 
3
3
  export const collectElementRefs = (
4
- elm: AnySoupElement,
5
- allElms: AnySoupElement[]
4
+ elm: AnyCircuitElement,
5
+ allElms: AnyCircuitElement[]
6
6
  ) => {
7
7
  const source_port = allElms.find(
8
8
  (e) =>
@@ -38,6 +38,7 @@ export const collectElementRefs = (
38
38
  source: source_component,
39
39
  source_component,
40
40
  source_port,
41
+ allElements: allElms,
41
42
  }
42
43
  }
43
44
  return null