@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.
- package/.github/workflows/formatbot.yml +1 -1
- package/.github/workflows/release.yml +6 -1
- package/.github/workflows/test.yml +2 -2
- package/.github/workflows/typecheck.yml +29 -0
- package/DEVELOPMENT.md +4 -1
- package/README.md +2 -6
- package/{dev-server-api/src → api}/db/generic-json-level.ts +2 -5
- package/{dev-server-api/src → api/lib}/middlewares/with-db.ts +2 -2
- package/{dev-server-api → api}/routes/api/db/download.ts +1 -1
- package/{dev-server-api → api}/routes/api/dev_package_examples/create.ts +1 -1
- package/{dev-server-api → api}/routes/api/dev_package_examples/get.ts +2 -2
- package/{dev-server-api → api}/routes/api/dev_package_examples/list.ts +1 -1
- package/{dev-server-api → api}/routes/api/dev_package_examples/update.ts +3 -3
- package/{dev-server-api → api}/routes/api/dev_server/reset.ts +1 -1
- package/{dev-server-api → api}/routes/api/export_files/create.ts +2 -6
- package/{dev-server-api → api}/routes/api/export_files/download.ts +1 -3
- package/{dev-server-api → api}/routes/api/export_requests/create.ts +3 -4
- package/{dev-server-api → api}/routes/api/export_requests/get.ts +3 -6
- package/{dev-server-api → api}/routes/api/export_requests/list.ts +2 -3
- package/{dev-server-api → api}/routes/api/export_requests/update.ts +3 -5
- package/{dev-server-api/routes → api/routes/api}/health.ts +1 -1
- package/{dev-server-api → api}/routes/api/package_info/create.ts +1 -1
- package/{dev-server-api → api}/routes/api/package_info/get.ts +3 -2
- package/{dev-server-api/routes/api → api/routes}/health.ts +1 -1
- package/{dev-server-api → api}/routes/index.ts +1 -1
- package/{dev-server-api → api}/server.ts +1 -1
- package/api/static-routes.ts +24 -0
- package/{dev-server-api → api}/tests/fixtures/get-test-server.ts +2 -1
- package/api/tests/fixtures/start-server.ts +41 -0
- package/{dev-server-api → api}/tests/routes/dev_package_examples/create.test.ts +1 -1
- package/{dev-server-api → api}/tests/routes/dev_package_examples/get.test.ts +1 -1
- package/{dev-server-api → api}/tests/routes/dev_package_examples/list.test.ts +1 -1
- package/{dev-server-api → api}/tests/routes/dev_package_examples/update.test.ts +1 -1
- package/{dev-server-api → api}/tests/routes/export_files/create.test.ts +1 -1
- package/{dev-server-api → api}/tests/routes/export_files/download.test.ts +1 -1
- package/{dev-server-api → api}/tests/routes/export_requests/create.test.ts +1 -1
- package/{dev-server-api → api}/tests/routes/export_requests/get.test.ts +1 -1
- package/{dev-server-api → api}/tests/routes/export_requests/list.test.ts +1 -1
- package/{dev-server-api → api}/tests/routes/export_requests/update.test.ts +1 -1
- package/biome.json +8 -3
- package/bun.lockb +0 -0
- package/{lib → cli/lib}/cmd-fns/add.ts +1 -1
- package/{lib → cli/lib}/cmd-fns/dev/dev-server-request-handler.ts +2 -2
- package/{lib → cli/lib}/cmd-fns/dev/fulfill-export-requests.ts +13 -13
- package/{lib → cli/lib}/cmd-fns/dev/index.ts +1 -1
- package/{lib → cli/lib}/cmd-fns/dev/soupify-and-upload-example-file.ts +3 -2
- package/{lib → cli/lib}/cmd-fns/dev/start-edit-event-watcher.ts +4 -4
- package/{lib → cli/lib}/cmd-fns/dev/start-export-request-watcher.ts +1 -1
- package/{lib → cli/lib}/cmd-fns/dev/start-fs-watcher.ts +2 -1
- package/{lib → cli/lib}/cmd-fns/dev/upload-examples-from-directory.ts +3 -2
- package/{lib → cli/lib}/cmd-fns/export-gerbers.ts +1 -1
- package/cli/lib/cmd-fns/go.ts +14 -0
- package/{lib → cli/lib}/cmd-fns/index.ts +2 -0
- package/{lib → cli/lib}/cmd-fns/init/create-or-modify-npmrc.ts +1 -1
- package/{lib → cli/lib}/cmd-fns/init/get-generated-npmrc.ts +1 -1
- package/{lib → cli/lib}/cmd-fns/init/index.ts +1 -1
- package/{lib → cli/lib}/cmd-fns/install.ts +1 -1
- package/{lib → cli/lib}/cmd-fns/lint.ts +1 -1
- package/{lib → cli/lib}/cmd-fns/open.ts +1 -1
- package/{lib → cli/lib}/cmd-fns/package-examples-create.ts +1 -1
- package/{lib → cli/lib}/cmd-fns/publish/index.ts +1 -1
- package/{lib → cli/lib}/cmd-fns/remove.ts +1 -1
- package/cli/lib/cmd-fns/render.ts +45 -0
- package/{lib → cli/lib}/cmd-fns/soupify.ts +1 -1
- package/{lib → cli/lib}/cmd-fns/uninstall.ts +1 -1
- package/{lib → cli/lib}/cmd-fns/version.ts +6 -7
- package/{lib → cli/lib}/export-fns/export-bom-csv.ts +1 -1
- package/{lib → cli/lib}/export-fns/export-gerbers.ts +1 -1
- package/{lib → cli/lib}/export-fns/export-pnp-csv.ts +1 -1
- package/{lib → cli/lib}/get-program.ts +20 -4
- package/{lib → cli/lib}/param-handlers/param-handler-type.ts +1 -1
- package/{lib → cli/lib}/util/app-context.ts +1 -1
- package/{lib → cli/lib}/util/create-context-and-run-program.ts +4 -4
- package/{lib → cli/lib}/util/get-all-package-files.ts +1 -1
- package/{tests → cli/tests}/open.test.ts +2 -1
- package/{tests → cli/tests}/soupify.test.ts +1 -1
- package/dist/cli.js +302 -308
- package/example-project/package.json +2 -11
- package/{dev-server-frontend/src → frontend}/components/command-k.tsx +1 -1
- package/{dev-server-frontend/src → frontend}/components/dialogs/generic-export-dialog.tsx +3 -7
- package/{dev-server-frontend/src → frontend}/components/dialogs/gerber-export-dialog.tsx +2 -2
- package/{dev-server-frontend/src → frontend}/components/select-example-search.tsx +6 -6
- package/{dev-server-frontend/src → frontend}/components/ui/alert-dialog.tsx +2 -2
- package/{dev-server-frontend/src → frontend}/components/ui/alert.tsx +1 -1
- package/{dev-server-frontend/src → frontend}/components/ui/breadcrumb.tsx +1 -1
- package/{dev-server-frontend/src → frontend}/components/ui/button.tsx +1 -1
- package/{dev-server-frontend/src → frontend}/components/ui/card.tsx +1 -1
- package/{dev-server-frontend/src → frontend}/components/ui/command.tsx +2 -2
- package/{dev-server-frontend/src → frontend}/components/ui/context-menu.tsx +1 -1
- package/{dev-server-frontend/src → frontend}/components/ui/dialog.tsx +1 -1
- package/{dev-server-frontend/src → frontend}/components/ui/menubar.tsx +1 -1
- package/{dev-server-frontend/src → frontend}/components/ui/navigation-menu.tsx +1 -1
- package/{dev-server-frontend/src → frontend}/components/ui/popover.tsx +1 -1
- package/{dev-server-frontend/src → frontend}/components/ui/select.tsx +1 -1
- package/{dev-server-frontend/src → frontend}/components/ui/tabs.tsx +1 -1
- package/{dev-server-frontend/src → frontend}/components/ui/toggle-group.tsx +2 -2
- package/{dev-server-frontend/src → frontend}/components/ui/toggle.tsx +1 -1
- package/{dev-server-frontend/src → frontend}/components/ui/tooltip.tsx +1 -1
- package/{dev-server-frontend → frontend}/index.html +1 -1
- package/{dev-server-frontend/src → frontend}/main.tsx +1 -1
- package/{dev-server-frontend → frontend}/tailwind.config.js +3 -6
- package/frontend/views/App.tsx +22 -0
- package/{dev-server-frontend/src → frontend/views}/Header.tsx +5 -5
- package/{dev-server-frontend/src → frontend/views}/HeaderMenu.tsx +50 -17
- package/{dev-server-frontend/src/ExampleContentView.tsx → frontend/views/MainContentView.tsx} +5 -5
- package/frontend/vite.config.ts +50 -0
- package/package.json +55 -18
- package/scripts/build-cli.ts +12 -0
- package/tsconfig.json +5 -96
- package/.github/workflows/server-tests.yml +0 -31
- package/build-cli.ts +0 -14
- package/dev-server-api/bun.lockb +0 -0
- package/dev-server-api/edgespec.config.ts +0 -4
- package/dev-server-api/package.json +0 -23
- package/dev-server-api/src/db/create-schema.ts +0 -54
- package/dev-server-api/src/lib/public-mapping/public-map-export-file.ts +0 -17
- package/dev-server-api/src/lib/public-mapping/public-map-export-request.ts +0 -23
- package/dev-server-api/static-routes.ts +0 -24
- package/dev-server-api/tests/fixtures/start-server.ts +0 -20
- package/dev-server-api/tsconfig.json +0 -28
- package/dev-server-frontend/.eslintrc.cjs +0 -20
- package/dev-server-frontend/package-lock.json +0 -8970
- package/dev-server-frontend/package.json +0 -70
- package/dev-server-frontend/postcss.config.js +0 -6
- package/dev-server-frontend/src/App.tsx +0 -22
- package/dev-server-frontend/tsconfig.json +0 -29
- package/dev-server-frontend/tsconfig.node.json +0 -13
- package/dev-server-frontend/vite.config.ts +0 -23
- package/example-project/package-lock.json +0 -609
- /package/{dev-server-api → api}/README.md +0 -0
- /package/{dev-server-api/src → api}/db/get-db.ts +0 -0
- /package/{dev-server-api/src → api}/db/schema.ts +0 -0
- /package/{dev-server-api/src → api}/db/zod-level-db.ts +0 -0
- /package/{dev-server-api → api}/index.ts +0 -0
- /package/{dev-server-api/src → api/lib}/middlewares/with-debug-request-logging.ts +0 -0
- /package/{dev-server-api/src → api/lib}/middlewares/with-error-response.ts +0 -0
- /package/{dev-server-api/src → api/lib}/with-winter-spec.ts +0 -0
- /package/{dev-server-api/src → api}/lib/zod/export_parameters.ts +0 -0
- /package/{dev-server-api → api}/tests/routes/health.test.ts +0 -0
- /package/{cli.ts → cli/cli.ts} +0 -0
- /package/{lib → cli/lib}/cmd-fns/auth-login.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/auth-logout.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/auth-sessions-create.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/auth-sessions-get.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/auth-sessions-list.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/config-clear.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/config-print-config.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/config-reveal-location.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/config-set-log-requests.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/config-set-registry.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/config-set-runtime.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/config-set-session.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/dev/check-if-initialized.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/dev/derive-selector-from-pcb-component-id.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/dev/find-available-port.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/dev/get-dev-server-axios.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/dev/infer-export-name-from-source.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/dev/mark-all-examples-loading.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/dev/start-dev-server.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/dev-server-fulfill-export-requests.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/dev-server-upload.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/init/get-generated-readme.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/init/get-generated-tsconfig.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/package-examples-get.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/package-examples-list.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/package-files-create.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/package-files-download.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/package-files-get.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/package-files-list.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/package-files-upload-directory.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/package-releases-create.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/package-releases-get.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/package-releases-list.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/package-releases-update.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/packages-create.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/packages-get.ts +0 -0
- /package/{lib → cli/lib}/cmd-fns/packages-list.ts +0 -0
- /package/{lib → cli/lib}/create-config-manager.ts +0 -0
- /package/{lib → cli/lib}/param-handlers/index.ts +0 -0
- /package/{lib → cli/lib}/param-handlers/interact-for-local-directory.ts +0 -0
- /package/{lib → cli/lib}/param-handlers/interact-for-local-file.ts +0 -0
- /package/{lib → cli/lib}/param-handlers/interact-for-package-example-id.ts +0 -0
- /package/{lib → cli/lib}/param-handlers/interact-for-package-name-with-version.ts +0 -0
- /package/{lib → cli/lib}/param-handlers/interact-for-package-name.ts +0 -0
- /package/{lib → cli/lib}/param-handlers/interact-for-package-release-id.ts +0 -0
- /package/{lib → cli/lib}/param-handlers/interact-for-registry-url.ts +0 -0
- /package/{lib → cli/lib}/param-handlers/interact-for-runtime.ts +0 -0
- /package/{lib → cli/lib}/posthog.ts +0 -0
- /package/{lib → cli/lib}/soupify.ts +0 -0
- /package/{lib → cli/lib}/util/lint-project.ts +0 -0
- /package/{tests → cli/tests}/init.test.ts +0 -0
- /package/example-project/examples/{basic-bug.tsx → basic-chip.tsx} +0 -0
- /package/{dev-server-frontend → frontend}/README.md +0 -0
- /package/{dev-server-frontend → frontend}/bun.lockb +0 -0
- /package/{dev-server-frontend/src → frontend}/components/global-context-providers.tsx +0 -0
- /package/{dev-server-frontend → frontend}/components.json +0 -0
- /package/{dev-server-frontend/src → frontend}/hooks/toast-if-api-not-connected.ts +0 -0
- /package/{dev-server-frontend/src → frontend}/hooks/use-active-dev-package-example-lite.ts +0 -0
- /package/{dev-server-frontend/src → frontend}/hooks/use-dev-package-examples.tsx +0 -0
- /package/{dev-server-frontend/src → frontend}/hooks/use-global-store.ts +0 -0
- /package/{dev-server-frontend/src → frontend}/index.css +0 -0
- /package/{dev-server-frontend/src → frontend}/lib/utils.ts +0 -0
- /package/{dev-server-frontend/src → frontend}/vite-env.d.ts +0 -0
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "example-project",
|
|
3
|
-
"
|
|
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 "
|
|
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 "
|
|
4
|
-
import { useActiveDevPackageExampleLite } from "
|
|
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 "
|
|
4
|
-
import { useActiveDevPackageExampleLite } from "
|
|
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 "
|
|
7
|
-
import { Button } from "
|
|
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 "
|
|
16
|
+
} from "frontend/components/ui/command"
|
|
17
17
|
import {
|
|
18
18
|
Popover,
|
|
19
19
|
PopoverContent,
|
|
20
20
|
PopoverTrigger,
|
|
21
|
-
} from "
|
|
22
|
-
import { useGlobalStore } from "
|
|
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 "
|
|
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 "
|
|
5
|
-
import { buttonVariants } from "
|
|
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 "
|
|
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 "
|
|
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 "
|
|
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",
|
|
@@ -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 "
|
|
7
|
-
import { Dialog, DialogContent } from "
|
|
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>,
|
|
@@ -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 "
|
|
6
|
+
import { cn } from "frontend/lib/utils"
|
|
7
7
|
|
|
8
8
|
const NavigationMenu = React.forwardRef<
|
|
9
9
|
React.ElementRef<typeof NavigationMenuPrimitive.Root>,
|
|
@@ -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 "
|
|
6
|
-
import { toggleVariants } from "
|
|
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 "
|
|
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,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 "
|
|
3
|
-
import { Button } from "
|
|
4
|
-
import { Tabs, TabsList, TabsTrigger } from "
|
|
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 "
|
|
6
|
+
import { useGlobalStore } from "frontend/hooks/use-global-store"
|
|
7
7
|
import { HeaderMenu } from "./HeaderMenu"
|
|
8
|
-
import { CommandShortcut } from "
|
|
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 "
|
|
18
|
+
} from "frontend/components/ui/menubar"
|
|
19
19
|
import cliPackageJson from "../../package.json"
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
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(
|
|
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
|
|
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
|
-
{
|
|
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
|
-
{
|
|
273
|
-
|
|
274
|
-
|
|
304
|
+
{cliPackageJson.devDependencies["@tscircuit/pcb-viewer"].replace(
|
|
305
|
+
/\^/g,
|
|
306
|
+
"",
|
|
307
|
+
)}
|
|
275
308
|
</MenubarItem>
|
|
276
309
|
</MenubarContent>
|
|
277
310
|
</MenubarMenu>
|
package/{dev-server-frontend/src/ExampleContentView.tsx → frontend/views/MainContentView.tsx}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useQuery } from "react-query"
|
|
2
|
-
import { useGlobalStore } from "
|
|
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 "
|
|
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
|
|
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
|
+
})
|