@tscircuit/cli 0.0.109 → 0.0.111

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/bun.lockb CHANGED
Binary file
Binary file
@@ -0,0 +1,6 @@
1
+ import { createWinterSpecBundleFromDir } from "winterspec/adapters/node"
2
+ import { join } from "node:path"
3
+
4
+ export default await createWinterSpecBundleFromDir(
5
+ join(import.meta.dir, "./routes")
6
+ )
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@tscircuit/dev-server-api",
3
- "main": "dist/bundle.ts",
3
+ "main": "index.ts",
4
4
  "type": "module",
5
5
  "scripts": {
6
- "start": "edgespec dev --port 3021",
7
- "build": "edgespec bundle -o dist/bundle.ts"
6
+ "start": "bun server.ts",
7
+ "build": "echo 'nothing to do'"
8
8
  },
9
9
  "devDependencies": {
10
10
  "@types/better-sqlite3": "^7.6.9",
@@ -18,7 +18,7 @@
18
18
  "better-sqlite3": "^11.0.0",
19
19
  "kysely": "^0.27.3",
20
20
  "kysely-bun-sqlite": "^0.3.2",
21
- "winterspec": "0.0.79",
21
+ "winterspec": "^0.0.80",
22
22
  "zod": "^3.22.4"
23
23
  }
24
24
  }
@@ -1,9 +1,20 @@
1
1
  import { createFetchHandlerFromDir } from "winterspec/adapters/node"
2
+ import { Request as EdgeRuntimeRequest } from "@edge-runtime/primitives"
3
+ import { join } from "node:path"
2
4
 
3
- const serverFetch = await createFetchHandlerFromDir("./routes")
5
+ const serverFetch = await createFetchHandlerFromDir(
6
+ join(import.meta.dir, "./routes")
7
+ )
4
8
 
5
9
  console.log("starting dev-server-api on localhost:3021")
6
10
  Bun.serve({
7
- fetch: (req) => serverFetch(req),
11
+ fetch: (bunReq) => {
12
+ const req = new EdgeRuntimeRequest(bunReq.url, {
13
+ headers: bunReq.headers,
14
+ method: bunReq.method,
15
+ body: bunReq.body,
16
+ })
17
+ return serverFetch(req as any)
18
+ },
8
19
  port: 3021,
9
20
  })
Binary file
@@ -13,7 +13,7 @@
13
13
  "build": "tsc && vite build --base /preview && rm -f dist/bundle* && make-vfs --dir dist --outfile ./dist/bundle.ts",
14
14
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 10",
15
15
  "preview": "vite preview",
16
- "update-deps": "bun add @tscircuit/pcb-viewer@latest @tscircuit/builder@latest @tscircuit/schematic-viewer@latest"
16
+ "update-deps": "bun add @tscircuit/pcb-viewer@latest @tscircuit/builder@latest @tscircuit/schematic-viewer@latest @tscircuit/3d-viewer@latest"
17
17
  },
18
18
  "dependencies": {
19
19
  "@headlessui/react": "^1.7.18",
@@ -30,8 +30,9 @@
30
30
  "@radix-ui/react-toggle": "^1.0.3",
31
31
  "@radix-ui/react-toggle-group": "^1.0.4",
32
32
  "@radix-ui/react-tooltip": "^1.0.7",
33
- "@tscircuit/builder": "1.5.128",
34
- "@tscircuit/pcb-viewer": "^1.3.14",
33
+ "@tscircuit/3d-viewer": "^0.0.6",
34
+ "@tscircuit/builder": "^1.5.134",
35
+ "@tscircuit/pcb-viewer": "^1.4.0",
35
36
  "@tscircuit/schematic-viewer": "^1.2.14",
36
37
  "@tscircuit/table-viewer": "0.0.8",
37
38
  "axios": "^1.6.7",
@@ -9,10 +9,11 @@ import { SoupTableViewer } from "@tscircuit/table-viewer"
9
9
  import "react-data-grid/lib/styles.css"
10
10
  import { useEffect, useRef, useState } from "react"
11
11
  import type { EditEvent } from "@tscircuit/pcb-viewer"
12
+ import { CadViewer } from "@tscircuit/3d-viewer"
12
13
 
13
14
  export const ExampleContentView = () => {
14
15
  const devExamplePackageId = useGlobalStore(
15
- (s) => s.active_dev_example_package_id
16
+ (s) => s.active_dev_example_package_id,
16
17
  )
17
18
 
18
19
  const {
@@ -33,7 +34,7 @@ export const ExampleContentView = () => {
33
34
  refetchIntervalInBackground: true,
34
35
  refetchOnWindowFocus: true,
35
36
  retry: false,
36
- }
37
+ },
37
38
  )
38
39
 
39
40
  const sentEditEvents = useRef<Record<string, boolean>>({})
@@ -46,7 +47,8 @@ export const ExampleContentView = () => {
46
47
  let [editEvents, setEditEvents] = useState<EditEvent[]>([])
47
48
 
48
49
  editEvents = editEvents.filter(
49
- (ee) => ee.created_at > new Date(pkg?.edit_events_last_applied_at).valueOf()
50
+ (ee) =>
51
+ ee.created_at > new Date(pkg?.edit_events_last_applied_at).valueOf(),
50
52
  )
51
53
 
52
54
  const editorHeight = window.innerHeight - 52
@@ -64,7 +66,7 @@ export const ExampleContentView = () => {
64
66
  viewMode === "split" &&
65
67
  splitMode === "horizontal" &&
66
68
  "grid grid-cols-2",
67
- viewMode === "split" && splitMode === "vertical" && "grid grid-rows-2"
69
+ viewMode === "split" && splitMode === "vertical" && "grid grid-rows-2",
68
70
  )}
69
71
  >
70
72
  {pkg && (viewMode === "schematic" || viewMode === "split") && (
@@ -101,7 +103,7 @@ export const ExampleContentView = () => {
101
103
  axios.post(`/api/dev_package_examples/update`, {
102
104
  dev_package_example_id: devExamplePackageId,
103
105
  completed_edit_events: changedEditEvents.filter(
104
- (ee) => ee.in_progress === false
106
+ (ee) => ee.in_progress === false,
105
107
  ),
106
108
  })
107
109
  }
@@ -111,6 +113,22 @@ export const ExampleContentView = () => {
111
113
  />
112
114
  </ErrorBoundary>
113
115
  )}
116
+ {pkg && viewMode === "3d" && (
117
+ <ErrorBoundary
118
+ fallbackRender={(props) => (
119
+ <div style={{ padding: 20 }}>
120
+ Failed to render 3d view
121
+ <div style={{ marginTop: 20, color: "red" }}>
122
+ {props.error.message}
123
+ </div>
124
+ </div>
125
+ )}
126
+ >
127
+ <div style={{ height: itemHeight }}>
128
+ <CadViewer soup={pkg.tscircuit_soup} />
129
+ </div>
130
+ </ErrorBoundary>
131
+ )}
114
132
  {pkg && viewMode === "soup" && (
115
133
  <ErrorBoundary fallback={<div>Failed to render Soup</div>}>
116
134
  <SoupTableViewer
@@ -34,10 +34,12 @@ export const Header = () => {
34
34
  <TabsList>
35
35
  <TabsTrigger value="schematic">Schematic</TabsTrigger>
36
36
  <TabsTrigger value="pcb">PCB</TabsTrigger>
37
- <TabsTrigger value="split">Split</TabsTrigger>
37
+ {/* <TabsTrigger value="split">Split</TabsTrigger> */}
38
+ <TabsTrigger value="3d">3D</TabsTrigger>
38
39
  </TabsList>
39
40
  </Tabs>
40
- <Button
41
+ {/* Button is only relevant when the "Split" button is available */}
42
+ {/* <Button
41
43
  variant="outline"
42
44
  disabled={viewMode !== "split"}
43
45
  className="ml-1 group"
@@ -46,7 +48,7 @@ export const Header = () => {
46
48
  }}
47
49
  >
48
50
  <RotateCounterClockwiseIcon className="scale-x-[-1] group-hover:rotate-[30deg] transition-transform" />
49
- </Button>
51
+ </Button> */}
50
52
  </div>
51
53
  </div>
52
54
  )
@@ -4,7 +4,7 @@ import { persist } from "zustand/middleware"
4
4
  export interface GlobalState {
5
5
  active_dev_example_package_id: string | null
6
6
 
7
- view_mode: "schematic" | "pcb" | "split" | "soup"
7
+ view_mode: "schematic" | "pcb" | "split" | "soup" | "3d"
8
8
  split_mode: "horizontal" | "vertical"
9
9
  in_debug_mode: boolean
10
10
 
@@ -37,6 +37,6 @@ export const useGlobalStore = create<GlobalState>()(
37
37
  }),
38
38
  {
39
39
  name: "global-store",
40
- }
41
- )
40
+ },
41
+ ),
42
42
  )