@tscircuit/cli 0.0.394 → 0.1.2
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/bun-formatcheck.yml +26 -0
- package/.github/workflows/bun-pver-release.yml +25 -0
- package/.github/workflows/{typecheck.yml → bun-typecheck.yml} +0 -3
- package/LICENSE +21 -0
- package/README.md +33 -36
- package/biome.json +9 -9
- package/bun.lockb +0 -0
- package/cli/CliContext.ts +8 -0
- package/cli/auth/login/register.ts +73 -0
- package/cli/auth/logout/register.ts +11 -0
- package/cli/auth/register.ts +5 -0
- package/cli/clone/register.ts +99 -0
- package/cli/config/print/register.ts +12 -0
- package/cli/config/register.ts +5 -0
- package/cli/dev/register.ts +111 -0
- package/cli/main.ts +33 -0
- package/dist/main.js +537 -0
- package/docs/file-server-api-usage.md +57 -0
- package/docs/run-frame-usage.md +14 -0
- package/example-dir/manual-edits.json +1 -0
- package/example-dir/snippet.d.ts +13 -0
- package/example-dir/snippet.tsx +20 -0
- package/example-dir/types.d.ts +11 -0
- package/lib/cli-config/TypedConfigStore.ts +50 -0
- package/lib/cli-config/index.ts +16 -0
- package/lib/dependency-analysis/DependencyAnalyzer.ts +129 -0
- package/lib/dependency-analysis/getLocalFileDependencies.ts +101 -0
- package/lib/dependency-analysis/installNodeModuleTypes.ts +74 -0
- package/lib/index.ts +2 -0
- package/lib/project-config/index.ts +5 -0
- package/lib/registry-api/endpoint-types.ts +20 -0
- package/lib/registry-api/get-ky.ts +30 -0
- package/lib/server/EventsWatcher.ts +75 -0
- package/lib/server/createServer.ts +62 -0
- package/lib/site/getIndex.ts +18 -0
- package/package.json +27 -144
- package/tsconfig.json +25 -22
- package/.github/workflows/formatbot.yml +0 -63
- package/.github/workflows/release.yml +0 -40
- package/.github/workflows/test.yml +0 -32
- package/.github/workflows/windows-tests.yml +0 -32
- package/.prettierrc +0 -1
- package/DEVELOPMENT.md +0 -7
- package/api/README.md +0 -3
- package/api/db/generic-json-level.ts +0 -123
- package/api/db/get-db.ts +0 -26
- package/api/db/schema.ts +0 -65
- package/api/db/zod-level-db.ts +0 -148
- package/api/index.ts +0 -4
- package/api/lib/middlewares/with-db.ts +0 -18
- package/api/lib/middlewares/with-debug-request-logging.ts +0 -13
- package/api/lib/middlewares/with-error-response.ts +0 -37
- package/api/lib/with-winter-spec.ts +0 -9
- package/api/lib/zod/export_parameters.ts +0 -25
- package/api/routes/api/db/download.ts +0 -25
- package/api/routes/api/dev_package_examples/create.ts +0 -43
- package/api/routes/api/dev_package_examples/get.ts +0 -46
- package/api/routes/api/dev_package_examples/list.ts +0 -36
- package/api/routes/api/dev_package_examples/update.ts +0 -59
- package/api/routes/api/dev_server/reset.ts +0 -13
- package/api/routes/api/export_files/create.ts +0 -27
- package/api/routes/api/export_files/download.ts +0 -25
- package/api/routes/api/export_requests/create.ts +0 -30
- package/api/routes/api/export_requests/get.ts +0 -43
- package/api/routes/api/export_requests/list.ts +0 -26
- package/api/routes/api/export_requests/update.ts +0 -34
- package/api/routes/api/health.ts +0 -11
- package/api/routes/api/package_info/create.ts +0 -26
- package/api/routes/api/package_info/get.ts +0 -16
- package/api/routes/health.ts +0 -11
- package/api/routes/index.ts +0 -16
- package/api/server.ts +0 -20
- package/api/static-routes.ts +0 -24
- package/api/tests/fixtures/get-test-server.ts +0 -31
- package/api/tests/fixtures/start-server.ts +0 -41
- package/api/tests/routes/dev_package_examples/create.test.ts +0 -19
- package/api/tests/routes/dev_package_examples/get.test.ts +0 -25
- package/api/tests/routes/dev_package_examples/list.test.ts +0 -32
- package/api/tests/routes/dev_package_examples/update.test.ts +0 -38
- package/api/tests/routes/export_files/create.test.ts +0 -18
- package/api/tests/routes/export_files/download.test.ts +0 -29
- package/api/tests/routes/export_requests/create.test.ts +0 -24
- package/api/tests/routes/export_requests/get.test.ts +0 -41
- package/api/tests/routes/export_requests/list.test.ts +0 -35
- package/api/tests/routes/export_requests/update.test.ts +0 -50
- package/api/tests/routes/health.test.ts +0 -10
- package/bunfig.toml +0 -2
- package/cli/cli.ts +0 -13
- package/cli/lib/cmd-fns/add.ts +0 -34
- package/cli/lib/cmd-fns/auth-login.ts +0 -59
- package/cli/lib/cmd-fns/auth-logout.ts +0 -7
- package/cli/lib/cmd-fns/auth-sessions-create.ts +0 -3
- package/cli/lib/cmd-fns/auth-sessions-get.ts +0 -3
- package/cli/lib/cmd-fns/auth-sessions-list.ts +0 -5
- package/cli/lib/cmd-fns/config-clear.ts +0 -5
- package/cli/lib/cmd-fns/config-print-config.ts +0 -6
- package/cli/lib/cmd-fns/config-reveal-location.ts +0 -5
- package/cli/lib/cmd-fns/config-set-log-requests.ts +0 -7
- package/cli/lib/cmd-fns/config-set-registry.ts +0 -9
- package/cli/lib/cmd-fns/config-set-runtime.ts +0 -7
- package/cli/lib/cmd-fns/config-set-session.ts +0 -7
- package/cli/lib/cmd-fns/dev/check-if-initialized.ts +0 -22
- package/cli/lib/cmd-fns/dev/derive-selector-from-pcb-component-id.ts +0 -23
- package/cli/lib/cmd-fns/dev/dev-server-request-handler.ts +0 -61
- package/cli/lib/cmd-fns/dev/find-available-port.ts +0 -32
- package/cli/lib/cmd-fns/dev/fulfill-export-requests.ts +0 -162
- package/cli/lib/cmd-fns/dev/get-dev-server-axios.ts +0 -29
- package/cli/lib/cmd-fns/dev/index.ts +0 -168
- package/cli/lib/cmd-fns/dev/infer-export-name-from-source.ts +0 -17
- package/cli/lib/cmd-fns/dev/mark-all-examples-loading.ts +0 -18
- package/cli/lib/cmd-fns/dev/soupify-and-upload-example-file.ts +0 -62
- package/cli/lib/cmd-fns/dev/start-dev-server.ts +0 -34
- package/cli/lib/cmd-fns/dev/start-edit-event-watcher.ts +0 -347
- package/cli/lib/cmd-fns/dev/start-export-request-watcher.ts +0 -33
- package/cli/lib/cmd-fns/dev/start-fs-watcher.ts +0 -54
- package/cli/lib/cmd-fns/dev/upload-examples-from-directory.ts +0 -42
- package/cli/lib/cmd-fns/dev-server-fulfill-export-requests.ts +0 -43
- package/cli/lib/cmd-fns/dev-server-upload.ts +0 -56
- package/cli/lib/cmd-fns/export-gerbers.ts +0 -28
- package/cli/lib/cmd-fns/export-kicad-pcb.ts +0 -36
- package/cli/lib/cmd-fns/export-pnp-csv.ts +0 -32
- package/cli/lib/cmd-fns/gen-jlcpcb-component.ts +0 -64
- package/cli/lib/cmd-fns/go.ts +0 -14
- package/cli/lib/cmd-fns/index.ts +0 -46
- package/cli/lib/cmd-fns/init/create-or-modify-npmrc.ts +0 -21
- package/cli/lib/cmd-fns/init/get-generated-npmrc.ts +0 -8
- package/cli/lib/cmd-fns/init/get-generated-readme.ts +0 -41
- package/cli/lib/cmd-fns/init/get-generated-tsconfig.ts +0 -34
- package/cli/lib/cmd-fns/init/index.ts +0 -193
- package/cli/lib/cmd-fns/install.ts +0 -34
- package/cli/lib/cmd-fns/lint.ts +0 -43
- package/cli/lib/cmd-fns/open.ts +0 -19
- package/cli/lib/cmd-fns/package-examples-create.ts +0 -36
- package/cli/lib/cmd-fns/package-examples-get.ts +0 -20
- package/cli/lib/cmd-fns/package-examples-list.ts +0 -18
- package/cli/lib/cmd-fns/package-files-create.ts +0 -31
- package/cli/lib/cmd-fns/package-files-download.ts +0 -29
- package/cli/lib/cmd-fns/package-files-get.ts +0 -3
- package/cli/lib/cmd-fns/package-files-list.ts +0 -28
- package/cli/lib/cmd-fns/package-files-upload-directory.ts +0 -6
- package/cli/lib/cmd-fns/package-releases-create.ts +0 -35
- package/cli/lib/cmd-fns/package-releases-get.ts +0 -3
- package/cli/lib/cmd-fns/package-releases-list.ts +0 -32
- package/cli/lib/cmd-fns/package-releases-update.ts +0 -45
- package/cli/lib/cmd-fns/packages-create.ts +0 -16
- package/cli/lib/cmd-fns/packages-get.ts +0 -16
- package/cli/lib/cmd-fns/packages-list.ts +0 -16
- package/cli/lib/cmd-fns/publish/index.ts +0 -336
- package/cli/lib/cmd-fns/remove.ts +0 -31
- package/cli/lib/cmd-fns/render.ts +0 -45
- package/cli/lib/cmd-fns/soupify.ts +0 -31
- package/cli/lib/cmd-fns/uninstall.ts +0 -31
- package/cli/lib/cmd-fns/version.ts +0 -38
- package/cli/lib/create-config-manager.ts +0 -97
- package/cli/lib/export-fns/export-bom-csv.ts +0 -32
- package/cli/lib/export-fns/export-gerbers.ts +0 -108
- package/cli/lib/export-fns/export-kicad-pcb.ts +0 -32
- package/cli/lib/export-fns/export-pnp-csv.ts +0 -31
- package/cli/lib/get-program.ts +0 -387
- package/cli/lib/param-handlers/index.ts +0 -21
- package/cli/lib/param-handlers/interact-for-local-directory.ts +0 -58
- package/cli/lib/param-handlers/interact-for-local-file.ts +0 -59
- package/cli/lib/param-handlers/interact-for-package-example-id.ts +0 -25
- package/cli/lib/param-handlers/interact-for-package-name-with-version.ts +0 -63
- package/cli/lib/param-handlers/interact-for-package-name.ts +0 -45
- package/cli/lib/param-handlers/interact-for-package-release-id.ts +0 -15
- package/cli/lib/param-handlers/interact-for-registry-url.ts +0 -27
- package/cli/lib/param-handlers/interact-for-runtime.ts +0 -33
- package/cli/lib/param-handlers/param-handler-type.ts +0 -7
- package/cli/lib/posthog.ts +0 -23
- package/cli/lib/soupify/get-export-name-from-file.ts +0 -29
- package/cli/lib/soupify/get-tmp-entrpoint-filepath.ts +0 -15
- package/cli/lib/soupify/index.ts +0 -1
- package/cli/lib/soupify/run-entrypoint-file.ts +0 -59
- package/cli/lib/soupify/soupify-with-core.ts +0 -74
- package/cli/lib/soupify/soupify.ts +0 -6
- package/cli/lib/util/app-context.ts +0 -17
- package/cli/lib/util/create-context-and-run-program.ts +0 -168
- package/cli/lib/util/get-all-package-files.ts +0 -66
- package/cli/lib/util/lint-project.ts +0 -137
- package/cli/tests/export-gerber-keyboard.test.ts +0 -16
- package/cli/tests/export-gerber.test.ts +0 -49
- package/cli/tests/export-kicad-pcb.test.ts +0 -23
- package/cli/tests/export-pnp-csv.test.ts +0 -24
- package/cli/tests/fixtures/preload.ts +0 -54
- package/cli/tests/init.test.ts +0 -9
- package/cli/tests/open.test.ts +0 -9
- package/cli/tests/soupify-builder.test.ts +0 -9
- package/cli/tests/soupify-core.test.ts +0 -9
- package/dist/cli.js +0 -3676
- package/docs/EDIT_EVENT_PIPELINE.md +0 -34
- package/example-project/README.md +0 -18
- package/example-project/examples/basic-capacitor.tsx +0 -5
- package/example-project/examples/basic-chip.tsx +0 -26
- package/example-project/examples/basic-resistor.tsx +0 -3
- package/example-project/examples/macrokeypad.tsx +0 -59
- package/example-project/index.ts +0 -1
- package/example-project/package.json +0 -5
- package/example-project/src/ArduinoProMicroBreakout.tsx +0 -37
- package/example-project/src/Key.tsx +0 -46
- package/example-project/src/Keyswitch.tsx +0 -26
- package/example-project/src/KeyswitchSocket.tsx +0 -56
- package/example-project/src/MyCircuit.tsx +0 -38
- package/example-project/src/manual-edits.ts +0 -93
- package/frontend/README.md +0 -3
- package/frontend/bun.lockb +0 -0
- package/frontend/components/command-k.tsx +0 -86
- package/frontend/components/dialogs/generic-export-dialog.tsx +0 -189
- package/frontend/components/dialogs/gerber-export-dialog.tsx +0 -168
- package/frontend/components/global-context-providers.tsx +0 -11
- package/frontend/components/select-example-search.tsx +0 -118
- package/frontend/components/ui/alert-dialog.tsx +0 -139
- package/frontend/components/ui/alert.tsx +0 -59
- package/frontend/components/ui/breadcrumb.tsx +0 -115
- package/frontend/components/ui/button.tsx +0 -57
- package/frontend/components/ui/card.tsx +0 -76
- package/frontend/components/ui/command.tsx +0 -153
- package/frontend/components/ui/context-menu.tsx +0 -202
- package/frontend/components/ui/dialog.tsx +0 -120
- package/frontend/components/ui/menubar.tsx +0 -238
- package/frontend/components/ui/navigation-menu.tsx +0 -128
- package/frontend/components/ui/popover.tsx +0 -31
- package/frontend/components/ui/select.tsx +0 -162
- package/frontend/components/ui/tabs.tsx +0 -53
- package/frontend/components/ui/toggle-group.tsx +0 -59
- package/frontend/components/ui/toggle.tsx +0 -43
- package/frontend/components/ui/tooltip.tsx +0 -28
- package/frontend/components.json +0 -17
- package/frontend/hooks/toast-if-api-not-connected.ts +0 -23
- package/frontend/hooks/use-active-dev-package-example-lite.ts +0 -39
- package/frontend/hooks/use-dev-package-examples.tsx +0 -18
- package/frontend/hooks/use-global-store.ts +0 -42
- package/frontend/index.css +0 -76
- package/frontend/index.html +0 -13
- package/frontend/lib/utils.ts +0 -6
- package/frontend/main.tsx +0 -13
- package/frontend/tailwind.config.js +0 -74
- package/frontend/views/App.tsx +0 -22
- package/frontend/views/Header.tsx +0 -55
- package/frontend/views/HeaderMenu.tsx +0 -326
- package/frontend/views/MainContentView.tsx +0 -172
- package/frontend/vite-env.d.ts +0 -1
- package/frontend/vite.config.ts +0 -50
- package/renovate.json +0 -16
- package/scripts/build-cli.ts +0 -12
- package/tsup.config.ts +0 -7
|
@@ -1,34 +0,0 @@
|
|
|
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
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# seveibar/example-project-3
|
|
2
|
-
|
|
3
|
-
To develop and view the examples, run `tsci dev` and open [http://127.0.0.1:3020](http://127.0.0.1:3020) in your browser.
|
|
4
|
-
|
|
5
|
-
## Developing
|
|
6
|
-
|
|
7
|
-
You should install an editor like [VS Code](https://code.visualstudio.com/) with a typescript extension. Many web developers already have this.
|
|
8
|
-
|
|
9
|
-
Usually, you'll want to develop some named circuits inside of the `lib` directory,
|
|
10
|
-
export them in the `index.ts` file, then show how to use them in the `examples` directory.
|
|
11
|
-
|
|
12
|
-
Any file in `examples` will be automatically loaded and appear in the browser preview when you run `tsci dev`. It auto-reloads when you make changes, no need to reload the page or re-run the command.
|
|
13
|
-
|
|
14
|
-
> [!TIP] Make sure to replace this README with some details about your project and how to use it.
|
|
15
|
-
|
|
16
|
-
## Publishing
|
|
17
|
-
|
|
18
|
-
After you're satisfied with your project, publish it on the [tscircuit registry](https://registry.tscircuit.com) with `tsci publish`
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import "@tscircuit/core"
|
|
2
|
-
import { layout } from "@tscircuit/layout"
|
|
3
|
-
import manual_edits from "../src/manual-edits"
|
|
4
|
-
|
|
5
|
-
export const BasicChip = () => (
|
|
6
|
-
<board pcbX={0} pcbY={0} width="20mm" height="20mm">
|
|
7
|
-
<group subcircuit>
|
|
8
|
-
<chip
|
|
9
|
-
name="U2"
|
|
10
|
-
schPortArrangement={{
|
|
11
|
-
leftSize: 8,
|
|
12
|
-
rightSize: 8,
|
|
13
|
-
}}
|
|
14
|
-
footprint="ssop16"
|
|
15
|
-
pinLabels={{
|
|
16
|
-
"1": "GND",
|
|
17
|
-
"2": "VBUS",
|
|
18
|
-
"3": "D-",
|
|
19
|
-
"4": "D+",
|
|
20
|
-
}}
|
|
21
|
-
/>
|
|
22
|
-
<resistor name="R1" pcbX={4} resistance="10kohm" footprint="0805" />
|
|
23
|
-
<trace from=".U2 > .1" to=".R1 > port.1" />
|
|
24
|
-
</group>
|
|
25
|
-
</board>
|
|
26
|
-
)
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { layout } from "@tscircuit/layout"
|
|
2
|
-
import { ArduinoProMicroBreakout } from "example-project/src/ArduinoProMicroBreakout"
|
|
3
|
-
import { Key } from "example-project/src/Key"
|
|
4
|
-
import manualEdits from "example-project/src/manual-edits"
|
|
5
|
-
import { KeyswitchSocket } from "example-project/src/KeyswitchSocket"
|
|
6
|
-
|
|
7
|
-
export const MacroKeypad = () => {
|
|
8
|
-
const keyPositions = Array.from({ length: 9 })
|
|
9
|
-
.map((_, i) => ({
|
|
10
|
-
keyNum: i + 1,
|
|
11
|
-
col: i % 3,
|
|
12
|
-
row: Math.floor(i / 3),
|
|
13
|
-
}))
|
|
14
|
-
.map((p) => ({
|
|
15
|
-
...p,
|
|
16
|
-
x: p.col * 19.05 - 19.05,
|
|
17
|
-
y: p.row * 19.05 - 19.05,
|
|
18
|
-
}))
|
|
19
|
-
|
|
20
|
-
const rowToMicroPin = {
|
|
21
|
-
0: "D2",
|
|
22
|
-
1: "D3",
|
|
23
|
-
2: "D4",
|
|
24
|
-
}
|
|
25
|
-
const colToMicroPin = {
|
|
26
|
-
0: "D5",
|
|
27
|
-
1: "D6",
|
|
28
|
-
2: "D7",
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<board
|
|
33
|
-
width="85mm"
|
|
34
|
-
height="60mm"
|
|
35
|
-
layout={layout().manualEdits(manualEdits)}
|
|
36
|
-
>
|
|
37
|
-
{keyPositions.map(({ keyNum, x, y }) => (
|
|
38
|
-
<Key name={`K${keyNum}`} keyNum={keyNum} pcbX={x - 12.5} pcbY={y + 2} />
|
|
39
|
-
))}
|
|
40
|
-
<ArduinoProMicroBreakout key="u1" name="U1" pcbX={30.5} />
|
|
41
|
-
{keyPositions.map(({ keyNum, row, col }) => (
|
|
42
|
-
<trace
|
|
43
|
-
// @ts-ignore
|
|
44
|
-
key={`trace-${keyNum}-col`}
|
|
45
|
-
from={`.SW${keyNum} .pin1`}
|
|
46
|
-
to={`.U1 .${colToMicroPin[col as 0 | 1 | 2]}`}
|
|
47
|
-
/>
|
|
48
|
-
))}
|
|
49
|
-
{keyPositions.map(({ keyNum, row, col }) => (
|
|
50
|
-
<trace
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
key={`trace-${keyNum}-row`}
|
|
53
|
-
from={`.D${keyNum} .pin2`}
|
|
54
|
-
to={`.U1 .${rowToMicroPin[row as 0 | 1 | 2]}`}
|
|
55
|
-
/>
|
|
56
|
-
))}
|
|
57
|
-
</board>
|
|
58
|
-
)
|
|
59
|
-
}
|
package/example-project/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./src/MyCircuit"
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export const ArduinoProMicroBreakout = (props: {
|
|
2
|
-
name: string
|
|
3
|
-
pcbX?: number
|
|
4
|
-
pcbY?: number
|
|
5
|
-
}) => (
|
|
6
|
-
<chip
|
|
7
|
-
{...props}
|
|
8
|
-
footprint="dip24_w0.7in_h1.3in"
|
|
9
|
-
pinLabels={{
|
|
10
|
-
pin1: "TXD",
|
|
11
|
-
pin2: "RXI",
|
|
12
|
-
pin3: "GND1",
|
|
13
|
-
pin4: "GND2",
|
|
14
|
-
pin5: "D2",
|
|
15
|
-
pin6: "D3",
|
|
16
|
-
pin7: "D4",
|
|
17
|
-
pin8: "D5",
|
|
18
|
-
pin9: "D6",
|
|
19
|
-
pin10: "D7",
|
|
20
|
-
pin11: "D8",
|
|
21
|
-
pin12: "D9",
|
|
22
|
-
// right side (from bottom)
|
|
23
|
-
pin13: "D10",
|
|
24
|
-
pin14: "D16",
|
|
25
|
-
pin15: "D14",
|
|
26
|
-
pin16: "D15",
|
|
27
|
-
pin17: "A0",
|
|
28
|
-
pin18: "A1",
|
|
29
|
-
pin19: "A2",
|
|
30
|
-
pin20: "A3",
|
|
31
|
-
pin21: "VCC",
|
|
32
|
-
pin22: "RST",
|
|
33
|
-
pin23: "GND3",
|
|
34
|
-
pin24: "RAW",
|
|
35
|
-
}}
|
|
36
|
-
/>
|
|
37
|
-
)
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Keyswitch } from "./Keyswitch"
|
|
2
|
-
import { KeyswitchSocket } from "./KeyswitchSocket"
|
|
3
|
-
|
|
4
|
-
export const Key = (props: {
|
|
5
|
-
name: string
|
|
6
|
-
keyNum: number
|
|
7
|
-
pcbX: number
|
|
8
|
-
pcbY: number
|
|
9
|
-
}) => {
|
|
10
|
-
const socketName = `SW${props.keyNum}`
|
|
11
|
-
const switchHoleName = `HO${props.keyNum}`
|
|
12
|
-
const diodeName = `D${props.keyNum}`
|
|
13
|
-
return (
|
|
14
|
-
<>
|
|
15
|
-
<KeyswitchSocket
|
|
16
|
-
key="shaft1"
|
|
17
|
-
layer="bottom"
|
|
18
|
-
name={socketName}
|
|
19
|
-
pcbX={props.pcbX}
|
|
20
|
-
pcbY={props.pcbY}
|
|
21
|
-
/>
|
|
22
|
-
<Keyswitch
|
|
23
|
-
key="switch"
|
|
24
|
-
name={switchHoleName}
|
|
25
|
-
pcbX={props.pcbX + 0.55}
|
|
26
|
-
pcbY={props.pcbY + -3.81}
|
|
27
|
-
/>
|
|
28
|
-
<diode
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
key="diode"
|
|
31
|
-
pcbRotation={-90}
|
|
32
|
-
name={diodeName}
|
|
33
|
-
footprint="0603"
|
|
34
|
-
layer="bottom"
|
|
35
|
-
pcbX={props.pcbX + 7}
|
|
36
|
-
pcbY={props.pcbY - 6}
|
|
37
|
-
/>
|
|
38
|
-
<trace
|
|
39
|
-
// @ts-ignore
|
|
40
|
-
key="trace1"
|
|
41
|
-
from={`.${socketName} .pin2`}
|
|
42
|
-
to={`.${diodeName} .pin1`}
|
|
43
|
-
/>
|
|
44
|
-
</>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Keyswitch (Brown)
|
|
3
|
-
*
|
|
4
|
-
* https://www.lcsc.com/datasheet/lcsc_datasheet_1912111437_Kailh-CPG1511F01S03_C400227.pdf
|
|
5
|
-
*/
|
|
6
|
-
export const Keyswitch = (props: {
|
|
7
|
-
name: string
|
|
8
|
-
pcbX?: number
|
|
9
|
-
pcbY?: number
|
|
10
|
-
}) => {
|
|
11
|
-
return (
|
|
12
|
-
<chip
|
|
13
|
-
{...props}
|
|
14
|
-
cadModel={{
|
|
15
|
-
objUrl:
|
|
16
|
-
"https://modelcdn.tscircuit.com/easyeda_models/download?pn=C400227",
|
|
17
|
-
rotationOffset: { x: 180, y: 0, z: -90 },
|
|
18
|
-
}}
|
|
19
|
-
footprint={
|
|
20
|
-
<footprint>
|
|
21
|
-
<hole diameter={2.5} pcbX={0} pcbY={0} />
|
|
22
|
-
</footprint>
|
|
23
|
-
}
|
|
24
|
-
/>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import "@tscircuit/core"
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A switch shaft you can use to connect a pluggable Kailh socket.
|
|
5
|
-
*
|
|
6
|
-
* Datasheet: https://wmsc.lcsc.com/wmsc/upload/file/pdf/v2/lcsc/2211090930_Kailh-CPG151101S11-1_C5184526.pdf
|
|
7
|
-
*/
|
|
8
|
-
export const KeyswitchSocket = (props: {
|
|
9
|
-
name: string
|
|
10
|
-
pcbX?: number
|
|
11
|
-
pcbY?: number
|
|
12
|
-
layer?: "top" | "bottom"
|
|
13
|
-
}) => (
|
|
14
|
-
<chip
|
|
15
|
-
{...props}
|
|
16
|
-
pcbRotation={0}
|
|
17
|
-
cadModel={{
|
|
18
|
-
objUrl: `https://modelcdn.tscircuit.com/easyeda_models/download?pn=C5184526`,
|
|
19
|
-
}}
|
|
20
|
-
supplierPartNumbers={{
|
|
21
|
-
jlcpcb: ["C5184526"],
|
|
22
|
-
}}
|
|
23
|
-
footprint={
|
|
24
|
-
<footprint>
|
|
25
|
-
{/* <silkscreentext text={props.name} /> */}
|
|
26
|
-
<smtpad
|
|
27
|
-
shape="rect"
|
|
28
|
-
width="2.55mm"
|
|
29
|
-
height="2.5mm"
|
|
30
|
-
portHints={["pin1"]}
|
|
31
|
-
layer="top"
|
|
32
|
-
/>
|
|
33
|
-
<smtpad
|
|
34
|
-
shape="rect"
|
|
35
|
-
width="2.55mm"
|
|
36
|
-
height="2.5mm"
|
|
37
|
-
portHints={["pin2"]}
|
|
38
|
-
layer="top"
|
|
39
|
-
/>
|
|
40
|
-
<hole name="H1" diameter="3mm" />
|
|
41
|
-
<hole name="H2" diameter="3mm" />
|
|
42
|
-
<constraint xDist="6.35mm" centerToCenter left=".H1" right=".H2" />
|
|
43
|
-
<constraint yDist="2.54mm" centerToCenter top=".H1" bottom=".H2" />
|
|
44
|
-
<constraint edgeToEdge xDist="11.3mm" left=".pin1" right=".pin2" />
|
|
45
|
-
<constraint sameY for={[".pin1", ".H1"]} />
|
|
46
|
-
<constraint sameY for={[".pin2", ".H2"]} />
|
|
47
|
-
<constraint
|
|
48
|
-
edgeToEdge
|
|
49
|
-
xDist={(11.3 - 6.35 - 3) / 2}
|
|
50
|
-
left=".pin1"
|
|
51
|
-
right=".H1"
|
|
52
|
-
/>
|
|
53
|
-
</footprint>
|
|
54
|
-
}
|
|
55
|
-
/>
|
|
56
|
-
)
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import "@tscircuit/react-fiber"
|
|
2
|
-
import { layout } from "@tscircuit/layout"
|
|
3
|
-
import manual_edits from "./manual-edits"
|
|
4
|
-
|
|
5
|
-
export const MyCircuit = () => (
|
|
6
|
-
<board width="40mm" height="40mm" pcbX={0} pcbY={0}>
|
|
7
|
-
<resistor
|
|
8
|
-
name="R1"
|
|
9
|
-
resistance="20kohm"
|
|
10
|
-
pcbX={0}
|
|
11
|
-
pcbY={0}
|
|
12
|
-
footprint="0805"
|
|
13
|
-
supplierPartNumbers={{
|
|
14
|
-
jlcpcb: ["C2759650"],
|
|
15
|
-
}}
|
|
16
|
-
/>
|
|
17
|
-
<resistor
|
|
18
|
-
name="R2"
|
|
19
|
-
pcbX={5}
|
|
20
|
-
pcbY={0}
|
|
21
|
-
resistance="20kohm"
|
|
22
|
-
footprint="0805"
|
|
23
|
-
supplierPartNumbers={{
|
|
24
|
-
jlcpcb: ["C2759650"],
|
|
25
|
-
}}
|
|
26
|
-
/>
|
|
27
|
-
<trace from=".R1 > .pin1" to=".R2 > .pin2" />
|
|
28
|
-
{/* <tracehint
|
|
29
|
-
for=".R1 > .right"
|
|
30
|
-
offsets={[
|
|
31
|
-
{
|
|
32
|
-
x: 3,
|
|
33
|
-
y: 3,
|
|
34
|
-
},
|
|
35
|
-
]}
|
|
36
|
-
/> */}
|
|
37
|
-
</board>
|
|
38
|
-
)
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DO NOT EDIT THIS FILE DIRECTLY!
|
|
3
|
-
*
|
|
4
|
-
* This file is automatically edited when running `tsci dev` and dragging things
|
|
5
|
-
* around. `tsci dev` searches for a file named "*.manual-edits.ts" and edits
|
|
6
|
-
* it when you e.g. move a footprint. If there are multiple files, it'll try
|
|
7
|
-
* to pick one based on context or ask.
|
|
8
|
-
*
|
|
9
|
-
* If you're not running `tsci dev`, you can safely edit this file.
|
|
10
|
-
*/
|
|
11
|
-
export default {
|
|
12
|
-
// Generated when this file is created, this unique identifier is used to help
|
|
13
|
-
// determine which file to edit when there are many *.manual-edits.ts files
|
|
14
|
-
manual_edit_id: "abcdef",
|
|
15
|
-
|
|
16
|
-
// Manual pcb placements, added when you drag a footprint
|
|
17
|
-
pcb_placements: [
|
|
18
|
-
{
|
|
19
|
-
_edit_event_id: "0.6668756126702717",
|
|
20
|
-
selector: ".U2",
|
|
21
|
-
center: {
|
|
22
|
-
x: -5.830346475507767,
|
|
23
|
-
y: -1.3620071684587813,
|
|
24
|
-
},
|
|
25
|
-
relative_to: "group_center",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
_edit_event_id: "0.867524742177592",
|
|
29
|
-
selector: ".R1",
|
|
30
|
-
center: {
|
|
31
|
-
x: 3.679808841099163,
|
|
32
|
-
y: 3.6320191158900847,
|
|
33
|
-
},
|
|
34
|
-
relative_to: "group_center",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
_edit_event_id: "0.4555106760070762",
|
|
38
|
-
selector: ".C1",
|
|
39
|
-
center: {
|
|
40
|
-
x: 0,
|
|
41
|
-
y: 2.6666666666666665,
|
|
42
|
-
},
|
|
43
|
-
relative_to: "group_center",
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
_edit_event_id: "0.6123290063979561",
|
|
47
|
-
selector: ".R2",
|
|
48
|
-
center: {
|
|
49
|
-
x: 13.457749922536511,
|
|
50
|
-
y: 5.576084911465589,
|
|
51
|
-
},
|
|
52
|
-
relative_to: "group_center",
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
manual_trace_hints: [
|
|
56
|
-
{
|
|
57
|
-
pcb_port_selector: ".D9 > .pin2",
|
|
58
|
-
offsets: [
|
|
59
|
-
{
|
|
60
|
-
x: 17.58431693903126,
|
|
61
|
-
y: 15.875996800068524,
|
|
62
|
-
via: false,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
x: 18.01072486303387,
|
|
66
|
-
y: 2.621817162320708,
|
|
67
|
-
via: false,
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
x: 23.127619951065203,
|
|
71
|
-
y: 2.4441471939862858,
|
|
72
|
-
via: false,
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
pcb_port_selector: ".D4 > .pin2",
|
|
78
|
-
offsets: [
|
|
79
|
-
{
|
|
80
|
-
x: -21.94914509505002,
|
|
81
|
-
y: -3.063375950444515,
|
|
82
|
-
via: true,
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
x: -16.627383568380463,
|
|
86
|
-
y: -3.006761466118242,
|
|
87
|
-
via: true,
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
edit_events: [],
|
|
93
|
-
}
|
package/frontend/README.md
DELETED
package/frontend/bun.lockb
DELETED
|
Binary file
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react"
|
|
2
|
-
import {
|
|
3
|
-
Command,
|
|
4
|
-
CommandDialog,
|
|
5
|
-
CommandGroup,
|
|
6
|
-
CommandInput,
|
|
7
|
-
CommandItem,
|
|
8
|
-
CommandList,
|
|
9
|
-
CommandShortcut,
|
|
10
|
-
} from "./ui/command"
|
|
11
|
-
import { useGlobalStore } from "frontend/hooks/use-global-store"
|
|
12
|
-
import { useDevPackageExamples } from "../hooks/use-dev-package-examples"
|
|
13
|
-
import { CommandSeparator } from "cmdk"
|
|
14
|
-
|
|
15
|
-
export const CommandK = () => {
|
|
16
|
-
const [open, setOpen] = useState(false)
|
|
17
|
-
const store = useGlobalStore()
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
const down = (e: KeyboardEvent) => {
|
|
20
|
-
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
|
|
21
|
-
e.preventDefault()
|
|
22
|
-
setOpen((open) => !open)
|
|
23
|
-
}
|
|
24
|
-
if (e.key === "Escape") {
|
|
25
|
-
setOpen(false)
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
document.addEventListener("keydown", down)
|
|
30
|
-
return () => document.removeEventListener("keydown", down)
|
|
31
|
-
}, [])
|
|
32
|
-
|
|
33
|
-
const { data: examples } = useDevPackageExamples()
|
|
34
|
-
|
|
35
|
-
const close = () => {
|
|
36
|
-
setOpen(false)
|
|
37
|
-
return true
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<CommandDialog open={open} onOpenChange={(open) => setOpen(open)}>
|
|
42
|
-
<Command className="rounded-lg border shadow-md">
|
|
43
|
-
<CommandInput placeholder="Type a command or search..." />
|
|
44
|
-
<CommandList>
|
|
45
|
-
<CommandGroup heading="Viewing Options">
|
|
46
|
-
<CommandItem
|
|
47
|
-
onSelect={() => close() && store.setViewMode("schematic")}
|
|
48
|
-
>
|
|
49
|
-
View Schematic
|
|
50
|
-
<CommandShortcut></CommandShortcut>
|
|
51
|
-
</CommandItem>
|
|
52
|
-
<CommandItem onSelect={() => close() && store.setViewMode("pcb")}>
|
|
53
|
-
View PCB
|
|
54
|
-
<CommandShortcut></CommandShortcut>
|
|
55
|
-
</CommandItem>
|
|
56
|
-
<CommandItem onSelect={() => close() && store.setViewMode("split")}>
|
|
57
|
-
View in Split Mode
|
|
58
|
-
<CommandShortcut></CommandShortcut>
|
|
59
|
-
</CommandItem>
|
|
60
|
-
<CommandItem onSelect={() => close() && store.setViewMode("split")}>
|
|
61
|
-
Vertical Split
|
|
62
|
-
<CommandShortcut></CommandShortcut>
|
|
63
|
-
</CommandItem>
|
|
64
|
-
</CommandGroup>
|
|
65
|
-
<CommandSeparator />
|
|
66
|
-
<CommandGroup heading="Examples">
|
|
67
|
-
{examples?.map((ex) => (
|
|
68
|
-
<CommandItem
|
|
69
|
-
key={ex.dev_package_example_id}
|
|
70
|
-
value={ex.expath}
|
|
71
|
-
onSelect={() =>
|
|
72
|
-
close() &&
|
|
73
|
-
store.setActiveDevExamplePackageId(
|
|
74
|
-
ex.dev_package_example_id.toString(),
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
>
|
|
78
|
-
{ex.expath}
|
|
79
|
-
</CommandItem>
|
|
80
|
-
))}
|
|
81
|
-
</CommandGroup>
|
|
82
|
-
</CommandList>
|
|
83
|
-
</Command>
|
|
84
|
-
</CommandDialog>
|
|
85
|
-
)
|
|
86
|
-
}
|