Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,8 @@ dist
.aider*
.vercel
.agent
.agents
.agents

# Bun
bun.lock
bun.lockb
8 changes: 3 additions & 5 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
"organizeImports": {
"enabled": true
},
"$schema": "https://biomejs.dev/schemas/2.4.15/schema.json",
"assist": { "actions": { "source": { "organizeImports": "on" } } },
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"files": {
"ignore": ["cosmos-export", "dist", "package.json"]
"includes": ["**", "!**/cosmos-export", "!**/dist", "!**/package.json"]
},
"javascript": {
"formatter": {
Expand Down
1,378 changes: 0 additions & 1,378 deletions bun.lock

This file was deleted.

59 changes: 30 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@
"format": "biome format --write src tsconfig.json package.json"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@biomejs/biome": "^2.4.15",
"@resvg/resvg-js": "^2.6.2",
"@types/bun": "latest",
"@types/react": "^19.2.14",
"@types/react": "^19.2.15",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^4.7.0",
"@vitejs/plugin-react": "^6.0.2",
"class-variance-authority": "^0.7.1",
"lucide-react": "^0.471.2",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"vite": "^6.4.1",
"vite-tsconfig-paths": "^5.1.4"
"lucide-react": "^1.16.0",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"vite": "^8.0.14"
},
"peerDependencies": {
"typescript": "^5.9.3"
Expand All @@ -33,33 +32,35 @@
"@radix-ui/react-slot": "^1.2.4",
"@radix-ui/react-tabs": "^1.1.13",
"@resvg/resvg-wasm": "^2.6.2",
"@tscircuit/3d-viewer": "^0.0.450",
"@tscircuit/3d-viewer": "^0.0.560",
"@tscircuit/assembly-viewer": "^0.0.5",
"@tscircuit/circuit-json-util": "^0.0.77",
"@tscircuit/create-snippet-url": "^0.0.13",
"@tscircuit/pcb-viewer": "^1.11.343",
"@tscircuit/schematic-viewer": "^2.0.57",
"@tscircuit/circuit-json-util": "^0.0.94",
"@tscircuit/create-snippet-url": "^0.0.14",
"@tscircuit/pcb-viewer": "^1.11.370",
"@tscircuit/runframe": "^0.0.1989",
"@tscircuit/schematic-viewer": "^2.0.61",
"buffer": "^6.0.3",
"circuit-json": "^0.0.326",
"circuit-json-to-bom-csv": "^0.0.8",
"circuit-json-to-gerber": "^0.0.44",
"circuit-json-to-kicad": "^0.0.27",
"circuit-json-to-lbrn": "^0.0.21",
"circuit-json": "^0.0.426",
"circuit-to-svg": "^0.0.350",
"circuit-json-to-bom-csv": "^0.0.9",
"circuit-json-to-gerber": "^0.0.66",
"circuit-json-to-kicad": "^0.0.137",
"circuit-json-to-lbrn": "^0.0.82",
"circuit-json-to-pnp-csv": "^0.0.7",
"circuit-json-to-step": "^0.0.2",
"easyeda": "^0.0.231",
"fuse.js": "^7.1.0",
"circuit-json-to-step": "^0.0.33",
"easyeda": "^0.0.269",
"fuse.js": "^7.3.0",
"jszip": "^3.10.1",
"ky": "^1.14.3",
"marked": "^17.0.3",
"posthog-js": "^1.352.0",
"ky": "^2.0.2",
"marked": "^18.0.4",
"posthog-js": "^1.375.0",
"react-error-boundary": "^6.1.1",
"react-hot-toast": "^2.6.0",
"react-query": "^3.39.3",
"stepts": "^0.0.1",
"tailwind-merge": "^3.5.0",
"three": "^0.165.0",
"tscircuit": "^0.0.1012",
"zustand": "^5.0.11"
"stepts": "^0.0.4",
"tailwind-merge": "^3.6.0",
"three": "^0.184.0",
"tscircuit": "^0.0.1776",
"zustand": "^5.0.13"
}
}
76 changes: 39 additions & 37 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,40 @@
import { useCallback, useRef, useState } from "react"
import { useStore } from "./store"
import { CircuitJsonPreview } from "@tscircuit/runframe"
import type { AnyCircuitElement } from "circuit-json"
import type { SimpleRouteJson } from "tscircuit"
import { useCallback, useRef, useState } from "react"
import { ErrorBoundary } from "react-error-boundary"
import type { SimpleRouteJson } from "tscircuit"
import { useStore } from "./store"

const convertSimpleRouteJsonToCircuitJson = (
simpleRouteJson: SimpleRouteJson,
): AnyCircuitElement[] => {
const circuitJson: AnyCircuitElement[] = []

for (const connection of simpleRouteJson.connections) {
const trace: AnyCircuitElement = {
type: "pcb_trace",
pcb_trace_id: connection.name,
route: connection.pointsToConnect.map((point) => ({
route_type: "wire",
x: point.x,
y: point.y,
layer: point.layer as
| "top"
| "bottom"
| "inner1"
| "inner2"
| "inner3"
| "inner4"
| "inner5"
| "inner6",
width: simpleRouteJson.minTraceWidth,
})),
}
circuitJson.push(trace)
}

return circuitJson
}

export const App = () => {
const circuitJson = useStore((s) => s.circuitJson)
Expand All @@ -12,37 +43,6 @@ export const App = () => {
const textareaRef = useRef<HTMLTextAreaElement>(null)
const [errorMsg, setErrorMsg] = useState<string | null>(null)

const convertSimpleRouteJsonToCircuitJson = (
simpleRouteJson: SimpleRouteJson,
): AnyCircuitElement[] => {
const circuitJson: AnyCircuitElement[] = []

for (const connection of simpleRouteJson.connections) {
const trace: AnyCircuitElement = {
type: "pcb_trace",
pcb_trace_id: connection.name,
route: connection.pointsToConnect.map((point) => ({
route_type: "wire",
x: point.x,
y: point.y,
layer: point.layer as
| "top"
| "bottom"
| "inner1"
| "inner2"
| "inner3"
| "inner4"
| "inner5"
| "inner6",
width: simpleRouteJson.minTraceWidth,
})),
}
circuitJson.push(trace)
}

return circuitJson
}

const loadJsonString = useCallback(
(jsonString: string) => {
try {
Expand All @@ -67,16 +67,15 @@ export const App = () => {
const handleDrop = useCallback(
(e: React.DragEvent) => {
e.preventDefault()
// biome-ignore lint/complexity/noForEach: <explanation>
Array.from(e.dataTransfer.files).forEach((file) => {
for (const file of Array.from(e.dataTransfer.files)) {
const reader = new FileReader()
reader.onload = (e) => {
if (typeof e.target?.result === "string") {
loadJsonString(e.target.result)
}
}
reader.readAsText(file)
})
}
},
[loadJsonString],
)
Expand All @@ -101,6 +100,7 @@ export const App = () => {
className="h-screen flex flex-col items-center justify-center bg-gray-900 text-white p-4"
onDrop={handleDrop}
onDragOver={(e) => e.preventDefault()}
role="application"
>
{!circuitJson ? (
<div className="flex flex-col text-center max-w-2xl w-full">
Expand Down Expand Up @@ -140,6 +140,8 @@ export const App = () => {
{errorMsg && (
<p className="text-red-400 text-sm mb-3 flex items-center gap-2">
<svg
aria-hidden="true"
focusable="false"
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
Expand Down
6 changes: 6 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"installCommand": "bun install",
"buildCommand": "bun run build",
"outputDirectory": "dist"
}
6 changes: 3 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { defineConfig } from "vite"
import react from "@vitejs/plugin-react"
import tsconfigPaths from "vite-tsconfig-paths"
import { defineConfig } from "vite"

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), tsconfigPaths()],
plugins: [react()],
server: {
port: 3110,
open: true,
Expand All @@ -17,6 +16,7 @@ export default defineConfig({
global: "globalThis",
},
resolve: {
tsconfigPaths: true,
alias: {
"@resvg/resvg-js": "@resvg/resvg-wasm",
buffer: "buffer/",
Expand Down