@tscircuit/cli 0.0.189 → 0.0.191
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/formatbot.yml +31 -12
- package/bun.lockb +0 -0
- package/cli/lib/cmd-fns/dev/start-edit-event-watcher.ts +14 -7
- package/dist/cli.js +13 -9
- package/docs/EDIT_EVENT_PIPELINE.md +34 -0
- package/example-project/examples/macrokeypad.tsx +5 -1
- package/example-project/src/manual-edits.ts +97 -1
- package/package.json +3 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Edit Event Pipeline
|
|
2
|
+
|
|
3
|
+
Whenever someone makes a manual edit to tscircuit, a `manual-edits.ts` file is created
|
|
4
|
+
or edited describing what was changed. This file can be loaded into a `<board />` component
|
|
5
|
+
with `layout={layout().manualEdits(manualEdits)}`.
|
|
6
|
+
|
|
7
|
+
There pipeline for edit events is kind of complicated because the event must appear
|
|
8
|
+
to happen instantaneously, but must also be stored, and the circuit should be
|
|
9
|
+
re-rendered to determine the new routing.
|
|
10
|
+
|
|
11
|
+
If you're debugging the edit event pipeline, turn on the debug logs:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
DEBUG=tscircuit:cli:edit-event-watcher
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## How the Edit Events are Processed
|
|
18
|
+
|
|
19
|
+
This these are all the steps that happen to add an edit to `manual-edits.ts`,
|
|
20
|
+
then apply it to the circuit.
|
|
21
|
+
|
|
22
|
+
1. The user makes a change inside the `pcb-viewer` or `schematic-viewer`
|
|
23
|
+
2. An edit event is emitted via e.g. `<PCBViewer onEditEventsChanged={...} />`
|
|
24
|
+
3. The edit event is added to the list of `instantEditEvents` in `MainContentView.tsx`
|
|
25
|
+
1. Instant edit events are applied on the browser side, but don't re-route the circuit
|
|
26
|
+
2. You can tell you're in the phase where the edit event is still be processed and hasn't
|
|
27
|
+
been rendered because the traces still point to the old location
|
|
28
|
+
4. The edit event is sent to the api server in a post request to `/api/dev_package_examples/update`
|
|
29
|
+
5. The api server adds the edit event to the database
|
|
30
|
+
6. The CLI "watcher" (see `start-edit-event-watcher.ts`) polls for new edit events
|
|
31
|
+
7. The CLI watcher edits the `manual-edits.ts` file and triggers the circuit to re-render
|
|
32
|
+
8. The circuit re-renders and the circuit json (soup) is updated on the server via `/api/dev_package_examples/update`
|
|
33
|
+
9. The browser polls for the updated soup via `/api/dev_package_examples/get_soup` and the browser
|
|
34
|
+
updates with the fully routed circuit json
|
|
@@ -29,7 +29,11 @@ export const MacroKeypad = () => {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<board
|
|
32
|
+
<board
|
|
33
|
+
width="120mm"
|
|
34
|
+
height="80mm"
|
|
35
|
+
layout={layout().manualEdits(manualEdits)}
|
|
36
|
+
>
|
|
33
37
|
{keyPositions.map(({ keyNum, x, y }) => (
|
|
34
38
|
<Key name={`K${keyNum}`} keyNum={keyNum} pcbX={x} pcbY={y} />
|
|
35
39
|
))}
|
|
@@ -52,6 +52,102 @@ export default {
|
|
|
52
52
|
relative_to: "group_center",
|
|
53
53
|
},
|
|
54
54
|
],
|
|
55
|
-
manual_trace_hints: [
|
|
55
|
+
manual_trace_hints: [
|
|
56
|
+
{
|
|
57
|
+
pcb_port_selector: ".SW4 > .pin2",
|
|
58
|
+
offsets: [
|
|
59
|
+
{
|
|
60
|
+
x: -8.492199000694345,
|
|
61
|
+
y: -1.998912735924403,
|
|
62
|
+
via: false,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
pcb_port_selector: ".D4 > .pin2",
|
|
68
|
+
offsets: [
|
|
69
|
+
{
|
|
70
|
+
x: -13.122988422132295,
|
|
71
|
+
y: -8.524891307031254,
|
|
72
|
+
via: false,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
pcb_port_selector: ".D1 > .pin2",
|
|
78
|
+
offsets: [
|
|
79
|
+
{
|
|
80
|
+
x: -8.302539134254346,
|
|
81
|
+
y: -25.869889610856028,
|
|
82
|
+
via: true,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
x: 32.60178017340978,
|
|
86
|
+
y: -2.310485746577827,
|
|
87
|
+
via: true,
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
pcb_port_selector: ".SW7 > .pin1",
|
|
93
|
+
offsets: [
|
|
94
|
+
{
|
|
95
|
+
x: -23.955683342322523,
|
|
96
|
+
y: 10.88389101192926,
|
|
97
|
+
via: false,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
x: -16.747386499009068,
|
|
101
|
+
y: 10.88389101192926,
|
|
102
|
+
via: false,
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
pcb_port_selector: ".SW4 > .pin1",
|
|
108
|
+
offsets: [
|
|
109
|
+
{
|
|
110
|
+
x: -23.904010775309708,
|
|
111
|
+
y: -3.8845684719809483,
|
|
112
|
+
via: false,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
pcb_port_selector: ".SW1 > .pin2",
|
|
118
|
+
offsets: [
|
|
119
|
+
{
|
|
120
|
+
x: -9.94176262647342,
|
|
121
|
+
y: -22.9635299104251,
|
|
122
|
+
via: false,
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
pcb_port_selector: ".D2 > .pin2",
|
|
128
|
+
offsets: [
|
|
129
|
+
{
|
|
130
|
+
x: 13.891002671418706,
|
|
131
|
+
y: -22.21580740004698,
|
|
132
|
+
via: false,
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
pcb_port_selector: ".D3 > .pin2",
|
|
138
|
+
offsets: [
|
|
139
|
+
{
|
|
140
|
+
x: 30.876601037632064,
|
|
141
|
+
y: -25.674952976702208,
|
|
142
|
+
via: true,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
x: 44.2153867766214,
|
|
146
|
+
y: 0.20923347590906705,
|
|
147
|
+
via: true,
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
],
|
|
56
152
|
edit_events: [],
|
|
57
153
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.191",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Command line tool for developing, publishing and installing tscircuit circuits",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@edge-runtime/primitives": "^4.1.0",
|
|
38
38
|
"@hono/node-server": "^1.8.2",
|
|
39
39
|
"@tscircuit/builder": "*",
|
|
40
|
-
"@tscircuit/core": "0.0.
|
|
40
|
+
"@tscircuit/core": "0.0.44",
|
|
41
41
|
"@tscircuit/props": "^0.0.62",
|
|
42
42
|
"archiver": "^7.0.1",
|
|
43
43
|
"axios": "^1.6.7",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"@tscircuit/3d-viewer": "^0.0.17",
|
|
98
98
|
"@tscircuit/layout": "^0.0.28",
|
|
99
99
|
"@tscircuit/manual-edit-events": "^0.0.4",
|
|
100
|
-
"@tscircuit/pcb-viewer": "^1.
|
|
100
|
+
"@tscircuit/pcb-viewer": "^1.9.1",
|
|
101
101
|
"@tscircuit/schematic-viewer": "^1.2.14",
|
|
102
102
|
"@tscircuit/soup-util": "^0.0.23",
|
|
103
103
|
"@tscircuit/table-viewer": "0.0.8",
|