@tscircuit/cli 0.0.145 → 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 (203) hide show
  1. package/.github/workflows/formatbot.yml +1 -1
  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 +2 -5
  8. package/{dev-server-api/src → api/lib}/middlewares/with-db.ts +2 -2
  9. package/{dev-server-api → api}/routes/api/db/download.ts +1 -1
  10. package/{dev-server-api → api}/routes/api/dev_package_examples/create.ts +1 -1
  11. package/{dev-server-api → api}/routes/api/dev_package_examples/get.ts +2 -2
  12. package/{dev-server-api → api}/routes/api/dev_package_examples/list.ts +1 -1
  13. package/{dev-server-api → api}/routes/api/dev_package_examples/update.ts +3 -3
  14. package/{dev-server-api → api}/routes/api/dev_server/reset.ts +1 -1
  15. package/{dev-server-api → api}/routes/api/export_files/create.ts +2 -6
  16. package/{dev-server-api → api}/routes/api/export_files/download.ts +1 -3
  17. package/{dev-server-api → api}/routes/api/export_requests/create.ts +3 -4
  18. package/{dev-server-api → api}/routes/api/export_requests/get.ts +3 -6
  19. package/{dev-server-api → api}/routes/api/export_requests/list.ts +2 -3
  20. package/{dev-server-api → api}/routes/api/export_requests/update.ts +3 -5
  21. package/{dev-server-api/routes → api/routes/api}/health.ts +1 -1
  22. package/{dev-server-api → api}/routes/api/package_info/create.ts +1 -1
  23. package/{dev-server-api → api}/routes/api/package_info/get.ts +3 -2
  24. package/{dev-server-api/routes/api → api/routes}/health.ts +1 -1
  25. package/{dev-server-api → api}/routes/index.ts +1 -1
  26. package/{dev-server-api → api}/server.ts +1 -1
  27. package/api/static-routes.ts +24 -0
  28. package/{dev-server-api → api}/tests/fixtures/get-test-server.ts +2 -1
  29. package/api/tests/fixtures/start-server.ts +41 -0
  30. package/{dev-server-api → api}/tests/routes/dev_package_examples/create.test.ts +1 -1
  31. package/{dev-server-api → api}/tests/routes/dev_package_examples/get.test.ts +1 -1
  32. package/{dev-server-api → api}/tests/routes/dev_package_examples/list.test.ts +1 -1
  33. package/{dev-server-api → api}/tests/routes/dev_package_examples/update.test.ts +1 -1
  34. package/{dev-server-api → api}/tests/routes/export_files/create.test.ts +1 -1
  35. package/{dev-server-api → api}/tests/routes/export_files/download.test.ts +1 -1
  36. package/{dev-server-api → api}/tests/routes/export_requests/create.test.ts +1 -1
  37. package/{dev-server-api → api}/tests/routes/export_requests/get.test.ts +1 -1
  38. package/{dev-server-api → api}/tests/routes/export_requests/list.test.ts +1 -1
  39. package/{dev-server-api → api}/tests/routes/export_requests/update.test.ts +1 -1
  40. package/biome.json +8 -3
  41. package/bun.lockb +0 -0
  42. package/{lib → cli/lib}/cmd-fns/add.ts +1 -1
  43. package/{lib → cli/lib}/cmd-fns/dev/dev-server-request-handler.ts +2 -2
  44. package/{lib → cli/lib}/cmd-fns/dev/fulfill-export-requests.ts +13 -13
  45. package/{lib → cli/lib}/cmd-fns/dev/index.ts +1 -1
  46. package/{lib → cli/lib}/cmd-fns/dev/soupify-and-upload-example-file.ts +3 -2
  47. package/{lib → cli/lib}/cmd-fns/dev/start-edit-event-watcher.ts +4 -4
  48. package/{lib → cli/lib}/cmd-fns/dev/start-export-request-watcher.ts +1 -1
  49. package/{lib → cli/lib}/cmd-fns/dev/start-fs-watcher.ts +2 -1
  50. package/{lib → cli/lib}/cmd-fns/dev/upload-examples-from-directory.ts +3 -2
  51. package/{lib → cli/lib}/cmd-fns/export-gerbers.ts +1 -1
  52. package/cli/lib/cmd-fns/go.ts +14 -0
  53. package/{lib → cli/lib}/cmd-fns/index.ts +2 -0
  54. package/{lib → cli/lib}/cmd-fns/init/create-or-modify-npmrc.ts +1 -1
  55. package/{lib → cli/lib}/cmd-fns/init/get-generated-npmrc.ts +1 -1
  56. package/{lib → cli/lib}/cmd-fns/init/index.ts +1 -1
  57. package/{lib → cli/lib}/cmd-fns/install.ts +1 -1
  58. package/{lib → cli/lib}/cmd-fns/lint.ts +1 -1
  59. package/{lib → cli/lib}/cmd-fns/open.ts +1 -1
  60. package/{lib → cli/lib}/cmd-fns/package-examples-create.ts +1 -1
  61. package/{lib → cli/lib}/cmd-fns/publish/index.ts +1 -1
  62. package/{lib → cli/lib}/cmd-fns/remove.ts +1 -1
  63. package/cli/lib/cmd-fns/render.ts +45 -0
  64. package/{lib → cli/lib}/cmd-fns/soupify.ts +1 -1
  65. package/{lib → cli/lib}/cmd-fns/uninstall.ts +1 -1
  66. package/{lib → cli/lib}/cmd-fns/version.ts +6 -7
  67. package/{lib → cli/lib}/export-fns/export-bom-csv.ts +1 -1
  68. package/{lib → cli/lib}/export-fns/export-gerbers.ts +1 -1
  69. package/{lib → cli/lib}/export-fns/export-pnp-csv.ts +1 -1
  70. package/{lib → cli/lib}/get-program.ts +20 -4
  71. package/{lib → cli/lib}/param-handlers/param-handler-type.ts +1 -1
  72. package/{lib → cli/lib}/util/app-context.ts +1 -1
  73. package/{lib → cli/lib}/util/create-context-and-run-program.ts +4 -4
  74. package/{lib → cli/lib}/util/get-all-package-files.ts +1 -1
  75. package/{tests → cli/tests}/open.test.ts +2 -1
  76. package/{tests → cli/tests}/soupify.test.ts +1 -1
  77. package/dist/cli.js +302 -308
  78. package/example-project/package.json +2 -11
  79. package/{dev-server-frontend/src → frontend}/components/command-k.tsx +1 -1
  80. package/{dev-server-frontend/src → frontend}/components/dialogs/generic-export-dialog.tsx +3 -7
  81. package/{dev-server-frontend/src → frontend}/components/dialogs/gerber-export-dialog.tsx +2 -2
  82. package/{dev-server-frontend/src → frontend}/components/select-example-search.tsx +6 -6
  83. package/{dev-server-frontend/src → frontend}/components/ui/alert-dialog.tsx +2 -2
  84. package/{dev-server-frontend/src → frontend}/components/ui/alert.tsx +1 -1
  85. package/{dev-server-frontend/src → frontend}/components/ui/breadcrumb.tsx +1 -1
  86. package/{dev-server-frontend/src → frontend}/components/ui/button.tsx +1 -1
  87. package/{dev-server-frontend/src → frontend}/components/ui/card.tsx +1 -1
  88. package/{dev-server-frontend/src → frontend}/components/ui/command.tsx +2 -2
  89. package/{dev-server-frontend/src → frontend}/components/ui/context-menu.tsx +1 -1
  90. package/{dev-server-frontend/src → frontend}/components/ui/dialog.tsx +1 -1
  91. package/{dev-server-frontend/src → frontend}/components/ui/menubar.tsx +1 -1
  92. package/{dev-server-frontend/src → frontend}/components/ui/navigation-menu.tsx +1 -1
  93. package/{dev-server-frontend/src → frontend}/components/ui/popover.tsx +1 -1
  94. package/{dev-server-frontend/src → frontend}/components/ui/select.tsx +1 -1
  95. package/{dev-server-frontend/src → frontend}/components/ui/tabs.tsx +1 -1
  96. package/{dev-server-frontend/src → frontend}/components/ui/toggle-group.tsx +2 -2
  97. package/{dev-server-frontend/src → frontend}/components/ui/toggle.tsx +1 -1
  98. package/{dev-server-frontend/src → frontend}/components/ui/tooltip.tsx +1 -1
  99. package/{dev-server-frontend → frontend}/index.html +1 -1
  100. package/{dev-server-frontend/src → frontend}/main.tsx +1 -1
  101. package/{dev-server-frontend → frontend}/tailwind.config.js +3 -6
  102. package/frontend/views/App.tsx +22 -0
  103. package/{dev-server-frontend/src → frontend/views}/Header.tsx +5 -5
  104. package/{dev-server-frontend/src → frontend/views}/HeaderMenu.tsx +50 -17
  105. package/{dev-server-frontend/src/ExampleContentView.tsx → frontend/views/MainContentView.tsx} +5 -5
  106. package/frontend/vite.config.ts +50 -0
  107. package/package.json +55 -18
  108. package/scripts/build-cli.ts +12 -0
  109. package/tsconfig.json +5 -96
  110. package/.github/workflows/server-tests.yml +0 -31
  111. package/build-cli.ts +0 -14
  112. package/dev-server-api/bun.lockb +0 -0
  113. package/dev-server-api/edgespec.config.ts +0 -4
  114. package/dev-server-api/package.json +0 -23
  115. package/dev-server-api/src/db/create-schema.ts +0 -54
  116. package/dev-server-api/src/lib/public-mapping/public-map-export-file.ts +0 -17
  117. package/dev-server-api/src/lib/public-mapping/public-map-export-request.ts +0 -23
  118. package/dev-server-api/static-routes.ts +0 -24
  119. package/dev-server-api/tests/fixtures/start-server.ts +0 -20
  120. package/dev-server-api/tsconfig.json +0 -28
  121. package/dev-server-frontend/.eslintrc.cjs +0 -20
  122. package/dev-server-frontend/package-lock.json +0 -8970
  123. package/dev-server-frontend/package.json +0 -70
  124. package/dev-server-frontend/postcss.config.js +0 -6
  125. package/dev-server-frontend/src/App.tsx +0 -22
  126. package/dev-server-frontend/tsconfig.json +0 -29
  127. package/dev-server-frontend/tsconfig.node.json +0 -13
  128. package/dev-server-frontend/vite.config.ts +0 -23
  129. package/example-project/package-lock.json +0 -609
  130. /package/{dev-server-api → api}/README.md +0 -0
  131. /package/{dev-server-api/src → api}/db/get-db.ts +0 -0
  132. /package/{dev-server-api/src → api}/db/schema.ts +0 -0
  133. /package/{dev-server-api/src → api}/db/zod-level-db.ts +0 -0
  134. /package/{dev-server-api → api}/index.ts +0 -0
  135. /package/{dev-server-api/src → api/lib}/middlewares/with-debug-request-logging.ts +0 -0
  136. /package/{dev-server-api/src → api/lib}/middlewares/with-error-response.ts +0 -0
  137. /package/{dev-server-api/src → api/lib}/with-winter-spec.ts +0 -0
  138. /package/{dev-server-api/src → api}/lib/zod/export_parameters.ts +0 -0
  139. /package/{dev-server-api → api}/tests/routes/health.test.ts +0 -0
  140. /package/{cli.ts → cli/cli.ts} +0 -0
  141. /package/{lib → cli/lib}/cmd-fns/auth-login.ts +0 -0
  142. /package/{lib → cli/lib}/cmd-fns/auth-logout.ts +0 -0
  143. /package/{lib → cli/lib}/cmd-fns/auth-sessions-create.ts +0 -0
  144. /package/{lib → cli/lib}/cmd-fns/auth-sessions-get.ts +0 -0
  145. /package/{lib → cli/lib}/cmd-fns/auth-sessions-list.ts +0 -0
  146. /package/{lib → cli/lib}/cmd-fns/config-clear.ts +0 -0
  147. /package/{lib → cli/lib}/cmd-fns/config-print-config.ts +0 -0
  148. /package/{lib → cli/lib}/cmd-fns/config-reveal-location.ts +0 -0
  149. /package/{lib → cli/lib}/cmd-fns/config-set-log-requests.ts +0 -0
  150. /package/{lib → cli/lib}/cmd-fns/config-set-registry.ts +0 -0
  151. /package/{lib → cli/lib}/cmd-fns/config-set-runtime.ts +0 -0
  152. /package/{lib → cli/lib}/cmd-fns/config-set-session.ts +0 -0
  153. /package/{lib → cli/lib}/cmd-fns/dev/check-if-initialized.ts +0 -0
  154. /package/{lib → cli/lib}/cmd-fns/dev/derive-selector-from-pcb-component-id.ts +0 -0
  155. /package/{lib → cli/lib}/cmd-fns/dev/find-available-port.ts +0 -0
  156. /package/{lib → cli/lib}/cmd-fns/dev/get-dev-server-axios.ts +0 -0
  157. /package/{lib → cli/lib}/cmd-fns/dev/infer-export-name-from-source.ts +0 -0
  158. /package/{lib → cli/lib}/cmd-fns/dev/mark-all-examples-loading.ts +0 -0
  159. /package/{lib → cli/lib}/cmd-fns/dev/start-dev-server.ts +0 -0
  160. /package/{lib → cli/lib}/cmd-fns/dev-server-fulfill-export-requests.ts +0 -0
  161. /package/{lib → cli/lib}/cmd-fns/dev-server-upload.ts +0 -0
  162. /package/{lib → cli/lib}/cmd-fns/init/get-generated-readme.ts +0 -0
  163. /package/{lib → cli/lib}/cmd-fns/init/get-generated-tsconfig.ts +0 -0
  164. /package/{lib → cli/lib}/cmd-fns/package-examples-get.ts +0 -0
  165. /package/{lib → cli/lib}/cmd-fns/package-examples-list.ts +0 -0
  166. /package/{lib → cli/lib}/cmd-fns/package-files-create.ts +0 -0
  167. /package/{lib → cli/lib}/cmd-fns/package-files-download.ts +0 -0
  168. /package/{lib → cli/lib}/cmd-fns/package-files-get.ts +0 -0
  169. /package/{lib → cli/lib}/cmd-fns/package-files-list.ts +0 -0
  170. /package/{lib → cli/lib}/cmd-fns/package-files-upload-directory.ts +0 -0
  171. /package/{lib → cli/lib}/cmd-fns/package-releases-create.ts +0 -0
  172. /package/{lib → cli/lib}/cmd-fns/package-releases-get.ts +0 -0
  173. /package/{lib → cli/lib}/cmd-fns/package-releases-list.ts +0 -0
  174. /package/{lib → cli/lib}/cmd-fns/package-releases-update.ts +0 -0
  175. /package/{lib → cli/lib}/cmd-fns/packages-create.ts +0 -0
  176. /package/{lib → cli/lib}/cmd-fns/packages-get.ts +0 -0
  177. /package/{lib → cli/lib}/cmd-fns/packages-list.ts +0 -0
  178. /package/{lib → cli/lib}/create-config-manager.ts +0 -0
  179. /package/{lib → cli/lib}/param-handlers/index.ts +0 -0
  180. /package/{lib → cli/lib}/param-handlers/interact-for-local-directory.ts +0 -0
  181. /package/{lib → cli/lib}/param-handlers/interact-for-local-file.ts +0 -0
  182. /package/{lib → cli/lib}/param-handlers/interact-for-package-example-id.ts +0 -0
  183. /package/{lib → cli/lib}/param-handlers/interact-for-package-name-with-version.ts +0 -0
  184. /package/{lib → cli/lib}/param-handlers/interact-for-package-name.ts +0 -0
  185. /package/{lib → cli/lib}/param-handlers/interact-for-package-release-id.ts +0 -0
  186. /package/{lib → cli/lib}/param-handlers/interact-for-registry-url.ts +0 -0
  187. /package/{lib → cli/lib}/param-handlers/interact-for-runtime.ts +0 -0
  188. /package/{lib → cli/lib}/posthog.ts +0 -0
  189. /package/{lib → cli/lib}/soupify.ts +0 -0
  190. /package/{lib → cli/lib}/util/lint-project.ts +0 -0
  191. /package/{tests → cli/tests}/init.test.ts +0 -0
  192. /package/example-project/examples/{basic-bug.tsx → basic-chip.tsx} +0 -0
  193. /package/{dev-server-frontend → frontend}/README.md +0 -0
  194. /package/{dev-server-frontend → frontend}/bun.lockb +0 -0
  195. /package/{dev-server-frontend/src → frontend}/components/global-context-providers.tsx +0 -0
  196. /package/{dev-server-frontend → frontend}/components.json +0 -0
  197. /package/{dev-server-frontend/src → frontend}/hooks/toast-if-api-not-connected.ts +0 -0
  198. /package/{dev-server-frontend/src → frontend}/hooks/use-active-dev-package-example-lite.ts +0 -0
  199. /package/{dev-server-frontend/src → frontend}/hooks/use-dev-package-examples.tsx +0 -0
  200. /package/{dev-server-frontend/src → frontend}/hooks/use-global-store.ts +0 -0
  201. /package/{dev-server-frontend/src → frontend}/index.css +0 -0
  202. /package/{dev-server-frontend/src → frontend}/lib/utils.ts +0 -0
  203. /package/{dev-server-frontend/src → frontend}/vite-env.d.ts +0 -0
@@ -1,14 +1,5 @@
1
1
  {
2
2
  "name": "example-project",
3
- "version": "1.2.26",
4
- "type": "module",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "update-deps": "bun add -f @tscircuit/builder@latest @tscircuit/react-fiber@latest @tscircuit/layout@latest"
8
- },
9
- "dependencies": {
10
- "@tscircuit/builder": "^1.5.134",
11
- "@tscircuit/layout": "^0.0.25",
12
- "@tscircuit/react-fiber": "^1.1.29"
13
- }
3
+ "description": "An example project for tscircuit, this package.json is required",
4
+ "type": "module"
14
5
  }
@@ -8,7 +8,7 @@ import {
8
8
  CommandList,
9
9
  CommandShortcut,
10
10
  } from "./ui/command"
11
- import { useGlobalStore } from "src/hooks/use-global-store"
11
+ import { useGlobalStore } from "frontend/hooks/use-global-store"
12
12
  import { useDevPackageExamples } from "../hooks/use-dev-package-examples"
13
13
  import { CommandSeparator } from "cmdk"
14
14
 
@@ -1,14 +1,10 @@
1
1
  import { useMemo, useState } from "react"
2
2
  import { Dialog } from "@headlessui/react"
3
- import { useGlobalStore } from "src/hooks/use-global-store"
4
- import { useActiveDevPackageExampleLite } from "src/hooks/use-active-dev-package-example-lite"
3
+ import { useGlobalStore } from "frontend/hooks/use-global-store"
4
+ import { useActiveDevPackageExampleLite } from "frontend/hooks/use-active-dev-package-example-lite"
5
5
  import { Button } from "../ui/button"
6
6
  import axios from "axios"
7
- import {
8
- ExportParameters,
9
- ExportParametersInput,
10
- export_parameters,
11
- } from "@server/lib/zod/export_parameters"
7
+ import type { ExportParametersInput } from "api/lib/zod/export_parameters"
12
8
 
13
9
  export const useGenericExportDialog = ({
14
10
  exportFileName,
@@ -1,7 +1,7 @@
1
1
  import { useMemo, useState } from "react"
2
2
  import { Dialog } from "@headlessui/react"
3
- import { useGlobalStore } from "src/hooks/use-global-store"
4
- import { useActiveDevPackageExampleLite } from "src/hooks/use-active-dev-package-example-lite"
3
+ import { useGlobalStore } from "frontend/hooks/use-global-store"
4
+ import { useActiveDevPackageExampleLite } from "frontend/hooks/use-active-dev-package-example-lite"
5
5
  import { Button } from "../ui/button"
6
6
  import axios from "axios"
7
7
 
@@ -3,8 +3,8 @@
3
3
  import * as React from "react"
4
4
  import { CaretSortIcon, CheckIcon } from "@radix-ui/react-icons"
5
5
 
6
- import { cn } from "src/lib/utils"
7
- import { Button } from "src/components/ui/button"
6
+ import { cn } from "frontend/lib/utils"
7
+ import { Button } from "frontend/components/ui/button"
8
8
  import {
9
9
  Command,
10
10
  CommandEmpty,
@@ -13,15 +13,15 @@ import {
13
13
  CommandItem,
14
14
  CommandList,
15
15
  CommandShortcut,
16
- } from "src/components/ui/command"
16
+ } from "frontend/components/ui/command"
17
17
  import {
18
18
  Popover,
19
19
  PopoverContent,
20
20
  PopoverTrigger,
21
- } from "src/components/ui/popover"
22
- import { useGlobalStore } from "src/hooks/use-global-store"
21
+ } from "frontend/components/ui/popover"
22
+ import { useGlobalStore } from "frontend/hooks/use-global-store"
23
23
  import { useDevPackageExamples } from "../hooks/use-dev-package-examples"
24
- import { useActiveDevPackageExampleLite } from "src/hooks/use-active-dev-package-example-lite"
24
+ import { useActiveDevPackageExampleLite } from "frontend/hooks/use-active-dev-package-example-lite"
25
25
 
26
26
  export function inflatePackageExample(ex: any) {
27
27
  if (!ex) return ex
@@ -1,8 +1,8 @@
1
1
  import * as React from "react"
2
2
  import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
3
3
 
4
- import { cn } from "src/lib/utils"
5
- import { buttonVariants } from "src/components/ui/button"
4
+ import { cn } from "frontend/lib/utils"
5
+ import { buttonVariants } from "frontend/components/ui/button"
6
6
 
7
7
  const AlertDialog = AlertDialogPrimitive.Root
8
8
 
@@ -1,7 +1,7 @@
1
1
  import * as React from "react"
2
2
  import { cva, type VariantProps } from "class-variance-authority"
3
3
 
4
- import { cn } from "src/lib/utils"
4
+ import { cn } from "frontend/lib/utils"
5
5
 
6
6
  const alertVariants = cva(
7
7
  "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
@@ -2,7 +2,7 @@ import * as React from "react"
2
2
  import { ChevronRightIcon, DotsHorizontalIcon } from "@radix-ui/react-icons"
3
3
  import { Slot } from "@radix-ui/react-slot"
4
4
 
5
- import { cn } from "src/lib/utils"
5
+ import { cn } from "frontend/lib/utils"
6
6
 
7
7
  const Breadcrumb = React.forwardRef<
8
8
  HTMLElement,
@@ -2,7 +2,7 @@ import * as React from "react"
2
2
  import { Slot } from "@radix-ui/react-slot"
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 buttonVariants = cva(
8
8
  "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
@@ -1,6 +1,6 @@
1
1
  import * as React from "react"
2
2
 
3
- import { cn } from "src/lib/utils"
3
+ import { cn } from "frontend/lib/utils"
4
4
 
5
5
  const Card = React.forwardRef<
6
6
  HTMLDivElement,
@@ -3,8 +3,8 @@ import { type DialogProps } from "@radix-ui/react-dialog"
3
3
  import { MagnifyingGlassIcon } from "@radix-ui/react-icons"
4
4
  import { Command as CommandPrimitive } from "cmdk"
5
5
 
6
- import { cn } from "src/lib/utils"
7
- import { Dialog, DialogContent } from "src/components/ui/dialog"
6
+ import { cn } from "frontend/lib/utils"
7
+ import { Dialog, DialogContent } from "frontend/components/ui/dialog"
8
8
 
9
9
  const Command = React.forwardRef<
10
10
  React.ElementRef<typeof CommandPrimitive>,
@@ -6,7 +6,7 @@ import {
6
6
  DotFilledIcon,
7
7
  } from "@radix-ui/react-icons"
8
8
 
9
- import { cn } from "src/lib/utils"
9
+ import { cn } from "frontend/lib/utils"
10
10
 
11
11
  const ContextMenu = ContextMenuPrimitive.Root
12
12
 
@@ -2,7 +2,7 @@ import * as React from "react"
2
2
  import * as DialogPrimitive from "@radix-ui/react-dialog"
3
3
  import { Cross2Icon } from "@radix-ui/react-icons"
4
4
 
5
- import { cn } from "src/lib/utils"
5
+ import { cn } from "frontend/lib/utils"
6
6
 
7
7
  const Dialog = DialogPrimitive.Root
8
8
 
@@ -6,7 +6,7 @@ import {
6
6
  } from "@radix-ui/react-icons"
7
7
  import * as MenubarPrimitive from "@radix-ui/react-menubar"
8
8
 
9
- import { cn } from "src/lib/utils"
9
+ import { cn } from "frontend/lib/utils"
10
10
 
11
11
  const MenubarMenu = MenubarPrimitive.Menu
12
12
 
@@ -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>,
@@ -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
 
@@ -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
 
@@ -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
 
@@ -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>
@@ -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",
@@ -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
 
@@ -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
 
@@ -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: {
@@ -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,10 +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
39
  const { data, isLoading } = useQuery(
36
40
  ["package_info"],
37
- async () => axios.get(`/api/package_info/get`),
41
+ async () => axios.get("/api/package_info/get"),
38
42
  {
39
43
  refetchOnWindowFocus: true,
40
44
  retry: false,
@@ -73,6 +77,33 @@ export const HeaderMenu = () => {
73
77
  },
74
78
  })
75
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
+
76
107
  return (
77
108
  <>
78
109
  <Menubar className="border-none shadow-none">
@@ -88,6 +119,13 @@ export const HeaderMenu = () => {
88
119
  >
89
120
  New Circuit
90
121
  </MenubarItem>
122
+ <MenubarItem
123
+ onSelect={() => {
124
+ handleDebugClick()
125
+ }}
126
+ >
127
+ Debug
128
+ </MenubarItem>
91
129
  <MenubarSeparator />
92
130
  <MenubarSub>
93
131
  <MenubarSubTrigger>Export</MenubarSubTrigger>
@@ -242,18 +280,12 @@ export const HeaderMenu = () => {
242
280
  @tscircuit/cli v{cliPackageJson.version}
243
281
  </MenubarItem>
244
282
  <MenubarItem disabled>
245
- @tscircuit/builder (cli) v
283
+ @tscircuit/builder v
246
284
  {cliPackageJson.devDependencies?.["@tscircuit/builder"]?.replace(
247
285
  /\^/g,
248
286
  "",
249
287
  )}
250
288
  </MenubarItem>
251
- <MenubarItem disabled>
252
- @tscircuit/builder (ui) v
253
- {frontendPackageJson.dependencies?.[
254
- "@tscircuit/builder"
255
- ]?.replace(/\^/g, "")}
256
- </MenubarItem>
257
289
  <MenubarItem disabled>
258
290
  @tscircuit/react-fiber v
259
291
  {cliPackageJson.devDependencies["@tscircuit/react-fiber"].replace(
@@ -263,15 +295,16 @@ export const HeaderMenu = () => {
263
295
  </MenubarItem>
264
296
  <MenubarItem disabled>
265
297
  @tscircuit/schematic-viewer v
266
- {frontendPackageJson.dependencies[
298
+ {cliPackageJson.devDependencies[
267
299
  "@tscircuit/schematic-viewer"
268
300
  ].replace(/\^/g, "")}
269
301
  </MenubarItem>
270
302
  <MenubarItem disabled>
271
303
  @tscircuit/pcb-viewer v
272
- {frontendPackageJson.dependencies[
273
- "@tscircuit/pcb-viewer"
274
- ].replace(/\^/g, "")}
304
+ {cliPackageJson.devDependencies["@tscircuit/pcb-viewer"].replace(
305
+ /\^/g,
306
+ "",
307
+ )}
275
308
  </MenubarItem>
276
309
  </MenubarContent>
277
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
  )
@@ -72,7 +72,7 @@ export const ExampleContentView = () => {
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
+ })