@tscircuit/cli 0.0.144 → 0.0.161

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 (207) hide show
  1. package/.github/workflows/formatbot.yml +41 -0
  2. package/.github/workflows/release.yml +6 -1
  3. package/.github/workflows/test.yml +2 -2
  4. package/.github/workflows/typecheck.yml +29 -0
  5. package/DEVELOPMENT.md +4 -1
  6. package/README.md +2 -6
  7. package/{dev-server-api/src → api}/db/generic-json-level.ts +4 -7
  8. package/{dev-server-api/src → api}/db/zod-level-db.ts +9 -9
  9. package/{dev-server-api/src → api/lib}/middlewares/with-db.ts +2 -2
  10. package/{dev-server-api/src → api/lib}/middlewares/with-debug-request-logging.ts +1 -1
  11. package/{dev-server-api/src → api/lib}/middlewares/with-error-response.ts +2 -2
  12. package/{dev-server-api → api}/routes/api/db/download.ts +3 -3
  13. package/{dev-server-api → api}/routes/api/dev_package_examples/create.ts +1 -1
  14. package/{dev-server-api → api}/routes/api/dev_package_examples/get.ts +3 -3
  15. package/{dev-server-api → api}/routes/api/dev_package_examples/list.ts +3 -3
  16. package/{dev-server-api → api}/routes/api/dev_package_examples/update.ts +4 -4
  17. package/{dev-server-api → api}/routes/api/dev_server/reset.ts +1 -1
  18. package/{dev-server-api → api}/routes/api/export_files/create.ts +2 -6
  19. package/{dev-server-api → api}/routes/api/export_files/download.ts +1 -3
  20. package/{dev-server-api → api}/routes/api/export_requests/create.ts +3 -4
  21. package/{dev-server-api → api}/routes/api/export_requests/get.ts +5 -8
  22. package/{dev-server-api → api}/routes/api/export_requests/list.ts +2 -3
  23. package/{dev-server-api → api}/routes/api/export_requests/update.ts +3 -5
  24. package/{dev-server-api/routes → api/routes/api}/health.ts +1 -1
  25. package/{dev-server-api → api}/routes/api/package_info/create.ts +1 -1
  26. package/{dev-server-api → api}/routes/api/package_info/get.ts +3 -2
  27. package/{dev-server-api/routes/api → api/routes}/health.ts +1 -1
  28. package/{dev-server-api → api}/routes/index.ts +2 -2
  29. package/{dev-server-api → api}/server.ts +2 -2
  30. package/api/static-routes.ts +24 -0
  31. package/{dev-server-api → api}/tests/fixtures/get-test-server.ts +2 -1
  32. package/api/tests/fixtures/start-server.ts +41 -0
  33. package/{dev-server-api → api}/tests/routes/dev_package_examples/create.test.ts +2 -2
  34. package/{dev-server-api → api}/tests/routes/dev_package_examples/get.test.ts +2 -2
  35. package/{dev-server-api → api}/tests/routes/dev_package_examples/list.test.ts +2 -2
  36. package/{dev-server-api → api}/tests/routes/dev_package_examples/update.test.ts +3 -3
  37. package/{dev-server-api → api}/tests/routes/export_files/create.test.ts +1 -1
  38. package/{dev-server-api → api}/tests/routes/export_files/download.test.ts +3 -3
  39. package/{dev-server-api → api}/tests/routes/export_requests/create.test.ts +2 -2
  40. package/{dev-server-api → api}/tests/routes/export_requests/get.test.ts +2 -2
  41. package/{dev-server-api → api}/tests/routes/export_requests/list.test.ts +1 -1
  42. package/{dev-server-api → api}/tests/routes/export_requests/update.test.ts +1 -1
  43. package/biome.json +49 -0
  44. package/bun.lockb +0 -0
  45. package/{lib → cli/lib}/cmd-fns/add.ts +2 -2
  46. package/{lib → cli/lib}/cmd-fns/auth-login.ts +2 -2
  47. package/{lib → cli/lib}/cmd-fns/dev/check-if-initialized.ts +1 -1
  48. package/{lib → cli/lib}/cmd-fns/dev/derive-selector-from-pcb-component-id.ts +1 -1
  49. package/{lib → cli/lib}/cmd-fns/dev/dev-server-request-handler.ts +5 -5
  50. package/{lib → cli/lib}/cmd-fns/dev/find-available-port.ts +7 -5
  51. package/{lib → cli/lib}/cmd-fns/dev/fulfill-export-requests.ts +27 -27
  52. package/{lib → cli/lib}/cmd-fns/dev/get-dev-server-axios.ts +3 -3
  53. package/{lib → cli/lib}/cmd-fns/dev/index.ts +4 -4
  54. package/{lib → cli/lib}/cmd-fns/dev/infer-export-name-from-source.ts +2 -2
  55. package/{lib → cli/lib}/cmd-fns/dev/soupify-and-upload-example-file.ts +6 -5
  56. package/{lib → cli/lib}/cmd-fns/dev/start-edit-event-watcher.ts +41 -42
  57. package/{lib → cli/lib}/cmd-fns/dev/start-export-request-watcher.ts +3 -4
  58. package/{lib → cli/lib}/cmd-fns/dev/start-fs-watcher.ts +2 -1
  59. package/{lib → cli/lib}/cmd-fns/dev/upload-examples-from-directory.ts +4 -3
  60. package/{lib → cli/lib}/cmd-fns/dev-server-fulfill-export-requests.ts +3 -3
  61. package/{lib → cli/lib}/cmd-fns/dev-server-upload.ts +3 -3
  62. package/{lib → cli/lib}/cmd-fns/export-gerbers.ts +2 -2
  63. package/cli/lib/cmd-fns/go.ts +14 -0
  64. package/{lib → cli/lib}/cmd-fns/index.ts +2 -0
  65. package/{lib → cli/lib}/cmd-fns/init/create-or-modify-npmrc.ts +2 -2
  66. package/{lib → cli/lib}/cmd-fns/init/get-generated-npmrc.ts +1 -1
  67. package/{lib → cli/lib}/cmd-fns/init/index.ts +13 -9
  68. package/{lib → cli/lib}/cmd-fns/install.ts +1 -1
  69. package/{lib → cli/lib}/cmd-fns/lint.ts +16 -10
  70. package/{lib → cli/lib}/cmd-fns/open.ts +1 -1
  71. package/{lib → cli/lib}/cmd-fns/package-examples-create.ts +2 -2
  72. package/{lib → cli/lib}/cmd-fns/package-files-create.ts +1 -1
  73. package/{lib → cli/lib}/cmd-fns/package-files-upload-directory.ts +1 -1
  74. package/{lib → cli/lib}/cmd-fns/package-releases-create.ts +1 -1
  75. package/{lib → cli/lib}/cmd-fns/package-releases-list.ts +1 -1
  76. package/{lib → cli/lib}/cmd-fns/publish/index.ts +34 -34
  77. package/{lib → cli/lib}/cmd-fns/remove.ts +2 -2
  78. package/cli/lib/cmd-fns/render.ts +45 -0
  79. package/{lib → cli/lib}/cmd-fns/soupify.ts +2 -2
  80. package/{lib → cli/lib}/cmd-fns/uninstall.ts +1 -1
  81. package/{lib → cli/lib}/cmd-fns/version.ts +7 -8
  82. package/{lib → cli/lib}/create-config-manager.ts +1 -1
  83. package/{lib → cli/lib}/export-fns/export-bom-csv.ts +3 -3
  84. package/{lib → cli/lib}/export-fns/export-gerbers.ts +6 -6
  85. package/{lib → cli/lib}/export-fns/export-pnp-csv.ts +3 -3
  86. package/{lib → cli/lib}/get-program.ts +37 -21
  87. package/{lib → cli/lib}/param-handlers/interact-for-package-release-id.ts +2 -3
  88. package/{lib → cli/lib}/param-handlers/interact-for-runtime.ts +1 -1
  89. package/{lib → cli/lib}/param-handlers/param-handler-type.ts +1 -1
  90. package/{lib → cli/lib}/posthog.ts +6 -7
  91. package/{lib → cli/lib}/soupify.ts +4 -4
  92. package/{lib → cli/lib}/util/app-context.ts +1 -1
  93. package/{lib → cli/lib}/util/create-context-and-run-program.ts +14 -10
  94. package/{lib → cli/lib}/util/get-all-package-files.ts +2 -2
  95. package/cli/lib/util/lint-project.ts +137 -0
  96. package/{tests → cli/tests}/init.test.ts +1 -1
  97. package/{tests → cli/tests}/open.test.ts +2 -1
  98. package/{tests → cli/tests}/soupify.test.ts +1 -1
  99. package/dist/cli.js +311 -310
  100. package/example-project/package.json +2 -11
  101. package/example-project/src/manual-edits.ts +34 -34
  102. package/{dev-server-frontend/src → frontend}/components/command-k.tsx +2 -2
  103. package/{dev-server-frontend/src → frontend}/components/dialogs/generic-export-dialog.tsx +6 -10
  104. package/{dev-server-frontend/src → frontend}/components/dialogs/gerber-export-dialog.tsx +5 -5
  105. package/{dev-server-frontend/src → frontend}/components/select-example-search.tsx +7 -7
  106. package/{dev-server-frontend/src → frontend}/components/ui/alert-dialog.tsx +7 -7
  107. package/{dev-server-frontend/src → frontend}/components/ui/alert.tsx +2 -2
  108. package/{dev-server-frontend/src → frontend}/components/ui/breadcrumb.tsx +2 -2
  109. package/{dev-server-frontend/src → frontend}/components/ui/button.tsx +3 -3
  110. package/{dev-server-frontend/src → frontend}/components/ui/card.tsx +2 -2
  111. package/{dev-server-frontend/src → frontend}/components/ui/command.tsx +7 -7
  112. package/{dev-server-frontend/src → frontend}/components/ui/context-menu.tsx +9 -9
  113. package/{dev-server-frontend/src → frontend}/components/ui/dialog.tsx +6 -6
  114. package/{dev-server-frontend/src → frontend}/components/ui/menubar.tsx +13 -13
  115. package/{dev-server-frontend/src → frontend}/components/ui/navigation-menu.tsx +7 -7
  116. package/{dev-server-frontend/src → frontend}/components/ui/popover.tsx +2 -2
  117. package/{dev-server-frontend/src → frontend}/components/ui/select.tsx +7 -7
  118. package/{dev-server-frontend/src → frontend}/components/ui/tabs.tsx +4 -4
  119. package/{dev-server-frontend/src → frontend}/components/ui/toggle-group.tsx +3 -3
  120. package/{dev-server-frontend/src → frontend}/components/ui/toggle.tsx +2 -2
  121. package/{dev-server-frontend/src → frontend}/components/ui/tooltip.tsx +2 -2
  122. package/{dev-server-frontend → frontend}/components.json +1 -1
  123. package/{dev-server-frontend/src → frontend}/hooks/use-active-dev-package-example-lite.ts +2 -2
  124. package/{dev-server-frontend → frontend}/index.html +1 -1
  125. package/{dev-server-frontend/src → frontend}/main.tsx +2 -2
  126. package/{dev-server-frontend → frontend}/tailwind.config.js +4 -7
  127. package/frontend/views/App.tsx +22 -0
  128. package/{dev-server-frontend/src → frontend/views}/Header.tsx +5 -5
  129. package/{dev-server-frontend/src → frontend/views}/HeaderMenu.tsx +51 -23
  130. package/{dev-server-frontend/src/ExampleContentView.tsx → frontend/views/MainContentView.tsx} +7 -7
  131. package/frontend/vite.config.ts +50 -0
  132. package/package.json +57 -18
  133. package/renovate.json +2 -4
  134. package/scripts/build-cli.ts +12 -0
  135. package/tsconfig.json +17 -108
  136. package/tsup.config.ts +3 -3
  137. package/.github/workflows/server-tests.yml +0 -31
  138. package/build-cli.ts +0 -14
  139. package/dev-server-api/bun.lockb +0 -0
  140. package/dev-server-api/edgespec.config.ts +0 -4
  141. package/dev-server-api/package.json +0 -23
  142. package/dev-server-api/src/db/create-schema.ts +0 -54
  143. package/dev-server-api/src/lib/public-mapping/public-map-export-file.ts +0 -17
  144. package/dev-server-api/src/lib/public-mapping/public-map-export-request.ts +0 -23
  145. package/dev-server-api/static-routes.ts +0 -24
  146. package/dev-server-api/tests/fixtures/start-server.ts +0 -20
  147. package/dev-server-api/tsconfig.json +0 -28
  148. package/dev-server-frontend/.eslintrc.cjs +0 -20
  149. package/dev-server-frontend/package-lock.json +0 -8970
  150. package/dev-server-frontend/package.json +0 -70
  151. package/dev-server-frontend/postcss.config.js +0 -6
  152. package/dev-server-frontend/src/App.tsx +0 -22
  153. package/dev-server-frontend/tsconfig.json +0 -29
  154. package/dev-server-frontend/tsconfig.node.json +0 -13
  155. package/dev-server-frontend/vite.config.ts +0 -23
  156. package/example-project/package-lock.json +0 -609
  157. package/lib/util/lint-project.ts +0 -112
  158. /package/{dev-server-api → api}/README.md +0 -0
  159. /package/{dev-server-api/src → api}/db/get-db.ts +0 -0
  160. /package/{dev-server-api/src → api}/db/schema.ts +0 -0
  161. /package/{dev-server-api → api}/index.ts +0 -0
  162. /package/{dev-server-api/src → api/lib}/with-winter-spec.ts +0 -0
  163. /package/{dev-server-api/src → api}/lib/zod/export_parameters.ts +0 -0
  164. /package/{dev-server-api → api}/tests/routes/health.test.ts +0 -0
  165. /package/{cli.ts → cli/cli.ts} +0 -0
  166. /package/{lib → cli/lib}/cmd-fns/auth-logout.ts +0 -0
  167. /package/{lib → cli/lib}/cmd-fns/auth-sessions-create.ts +0 -0
  168. /package/{lib → cli/lib}/cmd-fns/auth-sessions-get.ts +0 -0
  169. /package/{lib → cli/lib}/cmd-fns/auth-sessions-list.ts +0 -0
  170. /package/{lib → cli/lib}/cmd-fns/config-clear.ts +0 -0
  171. /package/{lib → cli/lib}/cmd-fns/config-print-config.ts +0 -0
  172. /package/{lib → cli/lib}/cmd-fns/config-reveal-location.ts +0 -0
  173. /package/{lib → cli/lib}/cmd-fns/config-set-log-requests.ts +0 -0
  174. /package/{lib → cli/lib}/cmd-fns/config-set-registry.ts +0 -0
  175. /package/{lib → cli/lib}/cmd-fns/config-set-runtime.ts +0 -0
  176. /package/{lib → cli/lib}/cmd-fns/config-set-session.ts +0 -0
  177. /package/{lib → cli/lib}/cmd-fns/dev/mark-all-examples-loading.ts +0 -0
  178. /package/{lib → cli/lib}/cmd-fns/dev/start-dev-server.ts +0 -0
  179. /package/{lib → cli/lib}/cmd-fns/init/get-generated-readme.ts +0 -0
  180. /package/{lib → cli/lib}/cmd-fns/init/get-generated-tsconfig.ts +0 -0
  181. /package/{lib → cli/lib}/cmd-fns/package-examples-get.ts +0 -0
  182. /package/{lib → cli/lib}/cmd-fns/package-examples-list.ts +0 -0
  183. /package/{lib → cli/lib}/cmd-fns/package-files-download.ts +0 -0
  184. /package/{lib → cli/lib}/cmd-fns/package-files-get.ts +0 -0
  185. /package/{lib → cli/lib}/cmd-fns/package-files-list.ts +0 -0
  186. /package/{lib → cli/lib}/cmd-fns/package-releases-get.ts +0 -0
  187. /package/{lib → cli/lib}/cmd-fns/package-releases-update.ts +0 -0
  188. /package/{lib → cli/lib}/cmd-fns/packages-create.ts +0 -0
  189. /package/{lib → cli/lib}/cmd-fns/packages-get.ts +0 -0
  190. /package/{lib → cli/lib}/cmd-fns/packages-list.ts +0 -0
  191. /package/{lib → cli/lib}/param-handlers/index.ts +0 -0
  192. /package/{lib → cli/lib}/param-handlers/interact-for-local-directory.ts +0 -0
  193. /package/{lib → cli/lib}/param-handlers/interact-for-local-file.ts +0 -0
  194. /package/{lib → cli/lib}/param-handlers/interact-for-package-example-id.ts +0 -0
  195. /package/{lib → cli/lib}/param-handlers/interact-for-package-name-with-version.ts +0 -0
  196. /package/{lib → cli/lib}/param-handlers/interact-for-package-name.ts +0 -0
  197. /package/{lib → cli/lib}/param-handlers/interact-for-registry-url.ts +0 -0
  198. /package/example-project/examples/{basic-bug.tsx → basic-chip.tsx} +0 -0
  199. /package/{dev-server-frontend → frontend}/README.md +0 -0
  200. /package/{dev-server-frontend → frontend}/bun.lockb +0 -0
  201. /package/{dev-server-frontend/src → frontend}/components/global-context-providers.tsx +0 -0
  202. /package/{dev-server-frontend/src → frontend}/hooks/toast-if-api-not-connected.ts +0 -0
  203. /package/{dev-server-frontend/src → frontend}/hooks/use-dev-package-examples.tsx +0 -0
  204. /package/{dev-server-frontend/src → frontend}/hooks/use-global-store.ts +0 -0
  205. /package/{dev-server-frontend/src → frontend}/index.css +0 -0
  206. /package/{dev-server-frontend/src → frontend}/lib/utils.ts +0 -0
  207. /package/{dev-server-frontend/src → frontend}/vite-env.d.ts +0 -0
@@ -3,7 +3,7 @@ import { ChevronDownIcon } from "@radix-ui/react-icons"
3
3
  import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"
4
4
  import { cva } from "class-variance-authority"
5
5
 
6
- import { cn } from "src/lib/utils"
6
+ import { cn } from "frontend/lib/utils"
7
7
 
8
8
  const NavigationMenu = React.forwardRef<
9
9
  React.ElementRef<typeof NavigationMenuPrimitive.Root>,
@@ -13,7 +13,7 @@ const NavigationMenu = React.forwardRef<
13
13
  ref={ref}
14
14
  className={cn(
15
15
  "relative z-10 flex max-w-max flex-1 items-center justify-center",
16
- className
16
+ className,
17
17
  )}
18
18
  {...props}
19
19
  >
@@ -31,7 +31,7 @@ const NavigationMenuList = React.forwardRef<
31
31
  ref={ref}
32
32
  className={cn(
33
33
  "group flex flex-1 list-none items-center justify-center space-x-1",
34
- className
34
+ className,
35
35
  )}
36
36
  {...props}
37
37
  />
@@ -41,7 +41,7 @@ NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName
41
41
  const NavigationMenuItem = NavigationMenuPrimitive.Item
42
42
 
43
43
  const navigationMenuTriggerStyle = cva(
44
- "group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"
44
+ "group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50",
45
45
  )
46
46
 
47
47
  const NavigationMenuTrigger = React.forwardRef<
@@ -70,7 +70,7 @@ const NavigationMenuContent = React.forwardRef<
70
70
  ref={ref}
71
71
  className={cn(
72
72
  "left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",
73
- className
73
+ className,
74
74
  )}
75
75
  {...props}
76
76
  />
@@ -87,7 +87,7 @@ const NavigationMenuViewport = React.forwardRef<
87
87
  <NavigationMenuPrimitive.Viewport
88
88
  className={cn(
89
89
  "origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",
90
- className
90
+ className,
91
91
  )}
92
92
  ref={ref}
93
93
  {...props}
@@ -105,7 +105,7 @@ const NavigationMenuIndicator = React.forwardRef<
105
105
  ref={ref}
106
106
  className={cn(
107
107
  "top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",
108
- className
108
+ className,
109
109
  )}
110
110
  {...props}
111
111
  >
@@ -1,7 +1,7 @@
1
1
  import * as React from "react"
2
2
  import * as PopoverPrimitive from "@radix-ui/react-popover"
3
3
 
4
- import { cn } from "src/lib/utils"
4
+ import { cn } from "frontend/lib/utils"
5
5
 
6
6
  const Popover = PopoverPrimitive.Root
7
7
 
@@ -20,7 +20,7 @@ const PopoverContent = React.forwardRef<
20
20
  sideOffset={sideOffset}
21
21
  className={cn(
22
22
  "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
23
- className
23
+ className,
24
24
  )}
25
25
  {...props}
26
26
  />
@@ -7,7 +7,7 @@ import {
7
7
  } from "@radix-ui/react-icons"
8
8
  import * as SelectPrimitive from "@radix-ui/react-select"
9
9
 
10
- import { cn } from "src/lib/utils"
10
+ import { cn } from "frontend/lib/utils"
11
11
 
12
12
  const Select = SelectPrimitive.Root
13
13
 
@@ -23,7 +23,7 @@ const SelectTrigger = React.forwardRef<
23
23
  ref={ref}
24
24
  className={cn(
25
25
  "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
26
- className
26
+ className,
27
27
  )}
28
28
  {...props}
29
29
  >
@@ -43,7 +43,7 @@ const SelectScrollUpButton = React.forwardRef<
43
43
  ref={ref}
44
44
  className={cn(
45
45
  "flex cursor-default items-center justify-center py-1",
46
- className
46
+ className,
47
47
  )}
48
48
  {...props}
49
49
  >
@@ -60,7 +60,7 @@ const SelectScrollDownButton = React.forwardRef<
60
60
  ref={ref}
61
61
  className={cn(
62
62
  "flex cursor-default items-center justify-center py-1",
63
- className
63
+ className,
64
64
  )}
65
65
  {...props}
66
66
  >
@@ -81,7 +81,7 @@ const SelectContent = React.forwardRef<
81
81
  "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
82
82
  position === "popper" &&
83
83
  "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
84
- className
84
+ className,
85
85
  )}
86
86
  position={position}
87
87
  {...props}
@@ -91,7 +91,7 @@ const SelectContent = React.forwardRef<
91
91
  className={cn(
92
92
  "p-1",
93
93
  position === "popper" &&
94
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
94
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
95
95
  )}
96
96
  >
97
97
  {children}
@@ -122,7 +122,7 @@ const SelectItem = React.forwardRef<
122
122
  ref={ref}
123
123
  className={cn(
124
124
  "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
125
- className
125
+ className,
126
126
  )}
127
127
  {...props}
128
128
  >
@@ -1,7 +1,7 @@
1
1
  import * as React from "react"
2
2
  import * as TabsPrimitive from "@radix-ui/react-tabs"
3
3
 
4
- import { cn } from "src/lib/utils"
4
+ import { cn } from "frontend/lib/utils"
5
5
 
6
6
  const Tabs = TabsPrimitive.Root
7
7
 
@@ -13,7 +13,7 @@ const TabsList = React.forwardRef<
13
13
  ref={ref}
14
14
  className={cn(
15
15
  "inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
16
- className
16
+ className,
17
17
  )}
18
18
  {...props}
19
19
  />
@@ -28,7 +28,7 @@ const TabsTrigger = React.forwardRef<
28
28
  ref={ref}
29
29
  className={cn(
30
30
  "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
31
- className
31
+ className,
32
32
  )}
33
33
  {...props}
34
34
  />
@@ -43,7 +43,7 @@ const TabsContent = React.forwardRef<
43
43
  ref={ref}
44
44
  className={cn(
45
45
  "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
46
- className
46
+ className,
47
47
  )}
48
48
  {...props}
49
49
  />
@@ -2,8 +2,8 @@ import * as React from "react"
2
2
  import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
3
3
  import { VariantProps } from "class-variance-authority"
4
4
 
5
- import { cn } from "src/lib/utils"
6
- import { toggleVariants } from "src/components/ui/toggle"
5
+ import { cn } from "frontend/lib/utils"
6
+ import { toggleVariants } from "frontend/components/ui/toggle"
7
7
 
8
8
  const ToggleGroupContext = React.createContext<
9
9
  VariantProps<typeof toggleVariants>
@@ -45,7 +45,7 @@ const ToggleGroupItem = React.forwardRef<
45
45
  variant: context.variant || variant,
46
46
  size: context.size || size,
47
47
  }),
48
- className
48
+ className,
49
49
  )}
50
50
  {...props}
51
51
  >
@@ -2,7 +2,7 @@ import * as React from "react"
2
2
  import * as TogglePrimitive from "@radix-ui/react-toggle"
3
3
  import { cva, type VariantProps } from "class-variance-authority"
4
4
 
5
- import { cn } from "src/lib/utils"
5
+ import { cn } from "frontend/lib/utils"
6
6
 
7
7
  const toggleVariants = cva(
8
8
  "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
@@ -23,7 +23,7 @@ const toggleVariants = cva(
23
23
  variant: "default",
24
24
  size: "default",
25
25
  },
26
- }
26
+ },
27
27
  )
28
28
 
29
29
  const Toggle = React.forwardRef<
@@ -1,7 +1,7 @@
1
1
  import * as React from "react"
2
2
  import * as TooltipPrimitive from "@radix-ui/react-tooltip"
3
3
 
4
- import { cn } from "src/lib/utils"
4
+ import { cn } from "frontend/lib/utils"
5
5
 
6
6
  const TooltipProvider = TooltipPrimitive.Provider
7
7
 
@@ -18,7 +18,7 @@ const TooltipContent = React.forwardRef<
18
18
  sideOffset={sideOffset}
19
19
  className={cn(
20
20
  "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
21
- className
21
+ className,
22
22
  )}
23
23
  {...props}
24
24
  />
@@ -14,4 +14,4 @@
14
14
  "components": "src/components",
15
15
  "utils": "src/lib/utils"
16
16
  }
17
- }
17
+ }
@@ -31,8 +31,8 @@ export const useActiveDevPackageExampleLite = () => {
31
31
  const activeDevExamplePackage = inflatePackageExample(
32
32
  examples?.find(
33
33
  (ex) =>
34
- ex.dev_package_example_id.toString() === active_dev_example_package_id
35
- )
34
+ ex.dev_package_example_id.toString() === active_dev_example_package_id,
35
+ ),
36
36
  )
37
37
 
38
38
  return activeDevExamplePackage
@@ -8,6 +8,6 @@
8
8
  </head>
9
9
  <body>
10
10
  <div id="root"></div>
11
- <script type="module" src="/src/main.tsx"></script>
11
+ <script type="module" src="/main.tsx"></script>
12
12
  </body>
13
13
  </html>
@@ -1,6 +1,6 @@
1
1
  import React from "react"
2
2
  import ReactDOM from "react-dom/client"
3
- import App from "./App.tsx"
3
+ import App from "./views/App.tsx"
4
4
  import "./index.css"
5
5
  import { GlobalContextProviders } from "./components/global-context-providers.tsx"
6
6
 
@@ -9,5 +9,5 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
9
9
  <GlobalContextProviders>
10
10
  <App />
11
11
  </GlobalContextProviders>
12
- </React.StrictMode>
12
+ </React.StrictMode>,
13
13
  )
@@ -1,12 +1,9 @@
1
+ const path = require("node:path")
2
+
1
3
  /** @type {import('tailwindcss').Config} */
2
4
  module.exports = {
3
5
  darkMode: ["class"],
4
- content: [
5
- './pages/**/*.{ts,tsx}',
6
- './components/**/*.{ts,tsx}',
7
- './app/**/*.{ts,tsx}',
8
- './src/**/*.{ts,tsx}',
9
- ],
6
+ content: [path.join(__dirname, "./{src,components,lib,views}/**/*.{ts,tsx}")],
10
7
  prefix: "",
11
8
  theme: {
12
9
  container: {
@@ -74,4 +71,4 @@ module.exports = {
74
71
  },
75
72
  },
76
73
  plugins: [require("tailwindcss-animate")],
77
- }
74
+ }
@@ -0,0 +1,22 @@
1
+ import { TabsContent } from "frontend/components/ui/tabs"
2
+ import { MenubarShortcut } from "frontend/components/ui/menubar"
3
+ import { CommandK } from "frontend/components/command-k"
4
+ import { useToastIfApiNotConnected } from "frontend/hooks/toast-if-api-not-connected"
5
+ import { Header } from "./Header"
6
+ import { MainContentView } from "./MainContentView"
7
+
8
+ function App() {
9
+ useToastIfApiNotConnected()
10
+
11
+ return (
12
+ <div className="">
13
+ <Header />
14
+ <div className="">
15
+ <MainContentView />
16
+ </div>
17
+ <CommandK />
18
+ </div>
19
+ )
20
+ }
21
+
22
+ export default App
@@ -1,11 +1,11 @@
1
1
  import { useState } from "react"
2
- import { SelectExampleSearch } from "./components/select-example-search"
3
- import { Button } from "./components/ui/button"
4
- import { Tabs, TabsList, TabsTrigger } from "./components/ui/tabs"
2
+ import { SelectExampleSearch } from "frontend/components/select-example-search"
3
+ import { Button } from "frontend/components/ui/button"
4
+ import { Tabs, TabsList, TabsTrigger } from "frontend/components/ui/tabs"
5
5
  import { RotateCounterClockwiseIcon } from "@radix-ui/react-icons"
6
- import { useGlobalStore } from "./hooks/use-global-store"
6
+ import { useGlobalStore } from "frontend/hooks/use-global-store"
7
7
  import { HeaderMenu } from "./HeaderMenu"
8
- import { CommandShortcut } from "./components/ui/command"
8
+ import { CommandShortcut } from "frontend/components/ui/command"
9
9
 
10
10
  export const Header = () => {
11
11
  const [viewMode, setViewMode] = useGlobalStore((s) => [
@@ -15,12 +15,13 @@ import {
15
15
  MenubarSubContent,
16
16
  MenubarSubTrigger,
17
17
  MenubarTrigger,
18
- } from "src/components/ui/menubar"
18
+ } from "frontend/components/ui/menubar"
19
19
  import cliPackageJson from "../../package.json"
20
- import frontendPackageJson from "../package.json"
21
- import { useGenericExportDialog } from "./components/dialogs/generic-export-dialog"
22
- import { useGerberExportDialog } from "./components/dialogs/gerber-export-dialog"
23
- import { useGlobalStore } from "./hooks/use-global-store"
20
+ import { useGenericExportDialog } from "frontend/components/dialogs/generic-export-dialog"
21
+ import { useGerberExportDialog } from "frontend/components/dialogs/gerber-export-dialog"
22
+ import { useGlobalStore } from "frontend/hooks/use-global-store"
23
+
24
+ const DEBUG_URL = "https://debug.tscircuit.com"
24
25
 
25
26
  export const HeaderMenu = () => {
26
27
  const [viewMode, setViewMode] = useGlobalStore((s) => [
@@ -31,15 +32,13 @@ export const HeaderMenu = () => {
31
32
  s.split_mode,
32
33
  s.setSplitMode,
33
34
  ])
35
+ const devExamplePackageId = useGlobalStore(
36
+ (s) => s.active_dev_example_package_id,
37
+ )
34
38
 
35
- const {
36
- data,
37
- isLoading,
38
- } = useQuery(
39
+ const { data, isLoading } = useQuery(
39
40
  ["package_info"],
40
- async () =>
41
- axios
42
- .get(`/api/package_info/get`),
41
+ async () => axios.get("/api/package_info/get"),
43
42
  {
44
43
  refetchOnWindowFocus: true,
45
44
  retry: false,
@@ -78,6 +77,33 @@ export const HeaderMenu = () => {
78
77
  },
79
78
  })
80
79
 
80
+ const handleDebugClick = async () => {
81
+ const soupData = await axios
82
+ .post("/api/dev_package_examples/get", {
83
+ dev_package_example_id: devExamplePackageId,
84
+ })
85
+ .then((r) => r.data.dev_package_example.tscircuit_soup)
86
+
87
+ // logSoup module is giving cors error
88
+ await axios.post(
89
+ `${DEBUG_URL}/api/soup_group/add_soup`,
90
+ {
91
+ soup_group_name: name,
92
+ soup_name: name,
93
+ username: "tmp",
94
+ content: {
95
+ elements: soupData,
96
+ },
97
+ },
98
+ {
99
+ headers: {
100
+ "Access-Control-Allow-Origin": "*",
101
+ "Content-Type": "application/json",
102
+ },
103
+ },
104
+ )
105
+ }
106
+
81
107
  return (
82
108
  <>
83
109
  <Menubar className="border-none shadow-none">
@@ -93,6 +119,13 @@ export const HeaderMenu = () => {
93
119
  >
94
120
  New Circuit
95
121
  </MenubarItem>
122
+ <MenubarItem
123
+ onSelect={() => {
124
+ handleDebugClick()
125
+ }}
126
+ >
127
+ Debug
128
+ </MenubarItem>
96
129
  <MenubarSeparator />
97
130
  <MenubarSub>
98
131
  <MenubarSubTrigger>Export</MenubarSubTrigger>
@@ -247,18 +280,12 @@ export const HeaderMenu = () => {
247
280
  @tscircuit/cli v{cliPackageJson.version}
248
281
  </MenubarItem>
249
282
  <MenubarItem disabled>
250
- @tscircuit/builder (cli) v
283
+ @tscircuit/builder v
251
284
  {cliPackageJson.devDependencies?.["@tscircuit/builder"]?.replace(
252
285
  /\^/g,
253
286
  "",
254
287
  )}
255
288
  </MenubarItem>
256
- <MenubarItem disabled>
257
- @tscircuit/builder (ui) v
258
- {frontendPackageJson.dependencies?.[
259
- "@tscircuit/builder"
260
- ]?.replace(/\^/g, "")}
261
- </MenubarItem>
262
289
  <MenubarItem disabled>
263
290
  @tscircuit/react-fiber v
264
291
  {cliPackageJson.devDependencies["@tscircuit/react-fiber"].replace(
@@ -268,15 +295,16 @@ export const HeaderMenu = () => {
268
295
  </MenubarItem>
269
296
  <MenubarItem disabled>
270
297
  @tscircuit/schematic-viewer v
271
- {frontendPackageJson.dependencies[
298
+ {cliPackageJson.devDependencies[
272
299
  "@tscircuit/schematic-viewer"
273
300
  ].replace(/\^/g, "")}
274
301
  </MenubarItem>
275
302
  <MenubarItem disabled>
276
303
  @tscircuit/pcb-viewer v
277
- {frontendPackageJson.dependencies[
278
- "@tscircuit/pcb-viewer"
279
- ].replace(/\^/g, "")}
304
+ {cliPackageJson.devDependencies["@tscircuit/pcb-viewer"].replace(
305
+ /\^/g,
306
+ "",
307
+ )}
280
308
  </MenubarItem>
281
309
  </MenubarContent>
282
310
  </MenubarMenu>
@@ -1,9 +1,9 @@
1
1
  import { useQuery } from "react-query"
2
- import { useGlobalStore } from "./hooks/use-global-store"
2
+ import { useGlobalStore } from "frontend/hooks/use-global-store"
3
3
  import axios from "axios"
4
4
  import { Schematic } from "@tscircuit/schematic-viewer"
5
5
  import { PCBViewer } from "@tscircuit/pcb-viewer"
6
- import { cn } from "./lib/utils"
6
+ import { cn } from "frontend/lib/utils"
7
7
  import { ErrorBoundary } from "react-error-boundary"
8
8
  import { SoupTableViewer } from "@tscircuit/table-viewer"
9
9
  import "react-data-grid/lib/styles.css"
@@ -11,7 +11,7 @@ import { useEffect, useRef, useState } from "react"
11
11
  import type { EditEvent } from "@tscircuit/pcb-viewer"
12
12
  import { CadViewer } from "@tscircuit/3d-viewer"
13
13
 
14
- export const ExampleContentView = () => {
14
+ export const MainContentView = () => {
15
15
  const devExamplePackageId = useGlobalStore(
16
16
  (s) => s.active_dev_example_package_id,
17
17
  )
@@ -64,15 +64,15 @@ export const ExampleContentView = () => {
64
64
  "relative",
65
65
  `h-[${editorHeight}px]`,
66
66
  viewMode === "split" &&
67
- splitMode === "horizontal" &&
68
- "grid grid-cols-2",
67
+ splitMode === "horizontal" &&
68
+ "grid grid-cols-2",
69
69
  viewMode === "split" && splitMode === "vertical" && "grid grid-rows-2",
70
70
  )}
71
71
  >
72
72
  {pkg && (viewMode === "schematic" || viewMode === "split") && (
73
73
  <ErrorBoundary fallback={<div>Failed to render Schematic</div>}>
74
74
  <Schematic
75
- key={`sch-${pkg?.soup_last_updated_at}`}
75
+ key={`sch-${pkg?.dev_package_example_id}-${pkg?.soup_last_updated_at}`}
76
76
  style={{ height: itemHeight }}
77
77
  soup={pkg.tscircuit_soup}
78
78
  showTable={false}
@@ -82,7 +82,7 @@ export const ExampleContentView = () => {
82
82
  {pkg && (viewMode === "pcb" || viewMode === "split") && (
83
83
  <ErrorBoundary fallback={<div>Failed to render PCB</div>}>
84
84
  <PCBViewer
85
- key={`pcb-${pkg?.soup_last_updated_at}`}
85
+ key={`pcb-${pkg?.soup_last_updated_at}-${pkg?.edit_events_last_applied_at}`}
86
86
  height={itemHeight}
87
87
  allowEditing
88
88
  editEvents={editEvents}
@@ -0,0 +1,50 @@
1
+ import react from "@vitejs/plugin-react"
2
+ import path from "node:path"
3
+ import { defineConfig } from "vite"
4
+ import tailwindcss from "tailwindcss"
5
+ import autoprefixer from "autoprefixer"
6
+
7
+ // https://vitejs.dev/config/
8
+ export default defineConfig({
9
+ root: path.resolve(__dirname),
10
+ plugins: [react()],
11
+ resolve: {
12
+ alias: [
13
+ {
14
+ find: "frontend",
15
+ replacement: path.resolve(__dirname),
16
+ },
17
+ {
18
+ find: "src",
19
+ replacement: path.resolve(__dirname),
20
+ },
21
+ ],
22
+ },
23
+ server: {
24
+ proxy: {
25
+ "/api": "http://127.0.0.1:3020",
26
+ },
27
+ },
28
+ optimizeDeps: {
29
+ needsInterop: ["@tscircuit/schematic-viewer"],
30
+ },
31
+ define: {
32
+ // Global var used by some dep inside schematic-viewer
33
+ global: {},
34
+ },
35
+ build: {
36
+ outDir: path.resolve(__dirname, "dist"),
37
+ rollupOptions: {
38
+ input: path.resolve(__dirname, "index.html"),
39
+ },
40
+ },
41
+ base: "/preview",
42
+ css: {
43
+ postcss: {
44
+ plugins: [
45
+ tailwindcss(path.resolve(__dirname, "tailwind.config.js")),
46
+ autoprefixer,
47
+ ],
48
+ },
49
+ },
50
+ })