@tscircuit/cli 0.0.394 → 0.1.1
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/bun-formatcheck.yml +26 -0
- package/.github/workflows/bun-pver-release.yml +25 -0
- package/.github/workflows/{typecheck.yml → bun-typecheck.yml} +0 -3
- package/LICENSE +21 -0
- package/README.md +30 -36
- package/biome.json +9 -9
- package/bun.lockb +0 -0
- package/cli/CliContext.ts +8 -0
- package/cli/auth/login/register.ts +73 -0
- package/cli/auth/logout/register.ts +11 -0
- package/cli/auth/register.ts +5 -0
- package/cli/config/print/register.ts +12 -0
- package/cli/config/register.ts +5 -0
- package/cli/dev/register.ts +111 -0
- package/cli/main.ts +31 -0
- package/dist/main.js +473 -0
- package/docs/file-server-api-usage.md +57 -0
- package/docs/run-frame-usage.md +14 -0
- package/example-dir/manual-edits.json +1 -0
- package/example-dir/snippet.d.ts +13 -0
- package/example-dir/snippet.tsx +20 -0
- package/example-dir/types.d.ts +11 -0
- package/lib/cli-config/TypedConfigStore.ts +50 -0
- package/lib/cli-config/index.ts +16 -0
- package/lib/dependency-analysis/DependencyAnalyzer.ts +129 -0
- package/lib/dependency-analysis/getLocalFileDependencies.ts +101 -0
- package/lib/dependency-analysis/installNodeModuleTypes.ts +74 -0
- package/lib/index.ts +2 -0
- package/lib/project-config/index.ts +5 -0
- package/lib/registry-api/endpoint-types.ts +20 -0
- package/lib/registry-api/get-ky.ts +30 -0
- package/lib/server/EventsWatcher.ts +75 -0
- package/lib/server/createServer.ts +62 -0
- package/lib/site/getIndex.ts +18 -0
- package/package.json +27 -144
- package/tsconfig.json +25 -22
- package/.github/workflows/formatbot.yml +0 -63
- package/.github/workflows/release.yml +0 -40
- package/.github/workflows/test.yml +0 -32
- package/.github/workflows/windows-tests.yml +0 -32
- package/.prettierrc +0 -1
- package/DEVELOPMENT.md +0 -7
- package/api/README.md +0 -3
- package/api/db/generic-json-level.ts +0 -123
- package/api/db/get-db.ts +0 -26
- package/api/db/schema.ts +0 -65
- package/api/db/zod-level-db.ts +0 -148
- package/api/index.ts +0 -4
- package/api/lib/middlewares/with-db.ts +0 -18
- package/api/lib/middlewares/with-debug-request-logging.ts +0 -13
- package/api/lib/middlewares/with-error-response.ts +0 -37
- package/api/lib/with-winter-spec.ts +0 -9
- package/api/lib/zod/export_parameters.ts +0 -25
- package/api/routes/api/db/download.ts +0 -25
- package/api/routes/api/dev_package_examples/create.ts +0 -43
- package/api/routes/api/dev_package_examples/get.ts +0 -46
- package/api/routes/api/dev_package_examples/list.ts +0 -36
- package/api/routes/api/dev_package_examples/update.ts +0 -59
- package/api/routes/api/dev_server/reset.ts +0 -13
- package/api/routes/api/export_files/create.ts +0 -27
- package/api/routes/api/export_files/download.ts +0 -25
- package/api/routes/api/export_requests/create.ts +0 -30
- package/api/routes/api/export_requests/get.ts +0 -43
- package/api/routes/api/export_requests/list.ts +0 -26
- package/api/routes/api/export_requests/update.ts +0 -34
- package/api/routes/api/health.ts +0 -11
- package/api/routes/api/package_info/create.ts +0 -26
- package/api/routes/api/package_info/get.ts +0 -16
- package/api/routes/health.ts +0 -11
- package/api/routes/index.ts +0 -16
- package/api/server.ts +0 -20
- package/api/static-routes.ts +0 -24
- package/api/tests/fixtures/get-test-server.ts +0 -31
- package/api/tests/fixtures/start-server.ts +0 -41
- package/api/tests/routes/dev_package_examples/create.test.ts +0 -19
- package/api/tests/routes/dev_package_examples/get.test.ts +0 -25
- package/api/tests/routes/dev_package_examples/list.test.ts +0 -32
- package/api/tests/routes/dev_package_examples/update.test.ts +0 -38
- package/api/tests/routes/export_files/create.test.ts +0 -18
- package/api/tests/routes/export_files/download.test.ts +0 -29
- package/api/tests/routes/export_requests/create.test.ts +0 -24
- package/api/tests/routes/export_requests/get.test.ts +0 -41
- package/api/tests/routes/export_requests/list.test.ts +0 -35
- package/api/tests/routes/export_requests/update.test.ts +0 -50
- package/api/tests/routes/health.test.ts +0 -10
- package/bunfig.toml +0 -2
- package/cli/cli.ts +0 -13
- package/cli/lib/cmd-fns/add.ts +0 -34
- package/cli/lib/cmd-fns/auth-login.ts +0 -59
- package/cli/lib/cmd-fns/auth-logout.ts +0 -7
- package/cli/lib/cmd-fns/auth-sessions-create.ts +0 -3
- package/cli/lib/cmd-fns/auth-sessions-get.ts +0 -3
- package/cli/lib/cmd-fns/auth-sessions-list.ts +0 -5
- package/cli/lib/cmd-fns/config-clear.ts +0 -5
- package/cli/lib/cmd-fns/config-print-config.ts +0 -6
- package/cli/lib/cmd-fns/config-reveal-location.ts +0 -5
- package/cli/lib/cmd-fns/config-set-log-requests.ts +0 -7
- package/cli/lib/cmd-fns/config-set-registry.ts +0 -9
- package/cli/lib/cmd-fns/config-set-runtime.ts +0 -7
- package/cli/lib/cmd-fns/config-set-session.ts +0 -7
- package/cli/lib/cmd-fns/dev/check-if-initialized.ts +0 -22
- package/cli/lib/cmd-fns/dev/derive-selector-from-pcb-component-id.ts +0 -23
- package/cli/lib/cmd-fns/dev/dev-server-request-handler.ts +0 -61
- package/cli/lib/cmd-fns/dev/find-available-port.ts +0 -32
- package/cli/lib/cmd-fns/dev/fulfill-export-requests.ts +0 -162
- package/cli/lib/cmd-fns/dev/get-dev-server-axios.ts +0 -29
- package/cli/lib/cmd-fns/dev/index.ts +0 -168
- package/cli/lib/cmd-fns/dev/infer-export-name-from-source.ts +0 -17
- package/cli/lib/cmd-fns/dev/mark-all-examples-loading.ts +0 -18
- package/cli/lib/cmd-fns/dev/soupify-and-upload-example-file.ts +0 -62
- package/cli/lib/cmd-fns/dev/start-dev-server.ts +0 -34
- package/cli/lib/cmd-fns/dev/start-edit-event-watcher.ts +0 -347
- package/cli/lib/cmd-fns/dev/start-export-request-watcher.ts +0 -33
- package/cli/lib/cmd-fns/dev/start-fs-watcher.ts +0 -54
- package/cli/lib/cmd-fns/dev/upload-examples-from-directory.ts +0 -42
- package/cli/lib/cmd-fns/dev-server-fulfill-export-requests.ts +0 -43
- package/cli/lib/cmd-fns/dev-server-upload.ts +0 -56
- package/cli/lib/cmd-fns/export-gerbers.ts +0 -28
- package/cli/lib/cmd-fns/export-kicad-pcb.ts +0 -36
- package/cli/lib/cmd-fns/export-pnp-csv.ts +0 -32
- package/cli/lib/cmd-fns/gen-jlcpcb-component.ts +0 -64
- package/cli/lib/cmd-fns/go.ts +0 -14
- package/cli/lib/cmd-fns/index.ts +0 -46
- package/cli/lib/cmd-fns/init/create-or-modify-npmrc.ts +0 -21
- package/cli/lib/cmd-fns/init/get-generated-npmrc.ts +0 -8
- package/cli/lib/cmd-fns/init/get-generated-readme.ts +0 -41
- package/cli/lib/cmd-fns/init/get-generated-tsconfig.ts +0 -34
- package/cli/lib/cmd-fns/init/index.ts +0 -193
- package/cli/lib/cmd-fns/install.ts +0 -34
- package/cli/lib/cmd-fns/lint.ts +0 -43
- package/cli/lib/cmd-fns/open.ts +0 -19
- package/cli/lib/cmd-fns/package-examples-create.ts +0 -36
- package/cli/lib/cmd-fns/package-examples-get.ts +0 -20
- package/cli/lib/cmd-fns/package-examples-list.ts +0 -18
- package/cli/lib/cmd-fns/package-files-create.ts +0 -31
- package/cli/lib/cmd-fns/package-files-download.ts +0 -29
- package/cli/lib/cmd-fns/package-files-get.ts +0 -3
- package/cli/lib/cmd-fns/package-files-list.ts +0 -28
- package/cli/lib/cmd-fns/package-files-upload-directory.ts +0 -6
- package/cli/lib/cmd-fns/package-releases-create.ts +0 -35
- package/cli/lib/cmd-fns/package-releases-get.ts +0 -3
- package/cli/lib/cmd-fns/package-releases-list.ts +0 -32
- package/cli/lib/cmd-fns/package-releases-update.ts +0 -45
- package/cli/lib/cmd-fns/packages-create.ts +0 -16
- package/cli/lib/cmd-fns/packages-get.ts +0 -16
- package/cli/lib/cmd-fns/packages-list.ts +0 -16
- package/cli/lib/cmd-fns/publish/index.ts +0 -336
- package/cli/lib/cmd-fns/remove.ts +0 -31
- package/cli/lib/cmd-fns/render.ts +0 -45
- package/cli/lib/cmd-fns/soupify.ts +0 -31
- package/cli/lib/cmd-fns/uninstall.ts +0 -31
- package/cli/lib/cmd-fns/version.ts +0 -38
- package/cli/lib/create-config-manager.ts +0 -97
- package/cli/lib/export-fns/export-bom-csv.ts +0 -32
- package/cli/lib/export-fns/export-gerbers.ts +0 -108
- package/cli/lib/export-fns/export-kicad-pcb.ts +0 -32
- package/cli/lib/export-fns/export-pnp-csv.ts +0 -31
- package/cli/lib/get-program.ts +0 -387
- package/cli/lib/param-handlers/index.ts +0 -21
- package/cli/lib/param-handlers/interact-for-local-directory.ts +0 -58
- package/cli/lib/param-handlers/interact-for-local-file.ts +0 -59
- package/cli/lib/param-handlers/interact-for-package-example-id.ts +0 -25
- package/cli/lib/param-handlers/interact-for-package-name-with-version.ts +0 -63
- package/cli/lib/param-handlers/interact-for-package-name.ts +0 -45
- package/cli/lib/param-handlers/interact-for-package-release-id.ts +0 -15
- package/cli/lib/param-handlers/interact-for-registry-url.ts +0 -27
- package/cli/lib/param-handlers/interact-for-runtime.ts +0 -33
- package/cli/lib/param-handlers/param-handler-type.ts +0 -7
- package/cli/lib/posthog.ts +0 -23
- package/cli/lib/soupify/get-export-name-from-file.ts +0 -29
- package/cli/lib/soupify/get-tmp-entrpoint-filepath.ts +0 -15
- package/cli/lib/soupify/index.ts +0 -1
- package/cli/lib/soupify/run-entrypoint-file.ts +0 -59
- package/cli/lib/soupify/soupify-with-core.ts +0 -74
- package/cli/lib/soupify/soupify.ts +0 -6
- package/cli/lib/util/app-context.ts +0 -17
- package/cli/lib/util/create-context-and-run-program.ts +0 -168
- package/cli/lib/util/get-all-package-files.ts +0 -66
- package/cli/lib/util/lint-project.ts +0 -137
- package/cli/tests/export-gerber-keyboard.test.ts +0 -16
- package/cli/tests/export-gerber.test.ts +0 -49
- package/cli/tests/export-kicad-pcb.test.ts +0 -23
- package/cli/tests/export-pnp-csv.test.ts +0 -24
- package/cli/tests/fixtures/preload.ts +0 -54
- package/cli/tests/init.test.ts +0 -9
- package/cli/tests/open.test.ts +0 -9
- package/cli/tests/soupify-builder.test.ts +0 -9
- package/cli/tests/soupify-core.test.ts +0 -9
- package/dist/cli.js +0 -3676
- package/docs/EDIT_EVENT_PIPELINE.md +0 -34
- package/example-project/README.md +0 -18
- package/example-project/examples/basic-capacitor.tsx +0 -5
- package/example-project/examples/basic-chip.tsx +0 -26
- package/example-project/examples/basic-resistor.tsx +0 -3
- package/example-project/examples/macrokeypad.tsx +0 -59
- package/example-project/index.ts +0 -1
- package/example-project/package.json +0 -5
- package/example-project/src/ArduinoProMicroBreakout.tsx +0 -37
- package/example-project/src/Key.tsx +0 -46
- package/example-project/src/Keyswitch.tsx +0 -26
- package/example-project/src/KeyswitchSocket.tsx +0 -56
- package/example-project/src/MyCircuit.tsx +0 -38
- package/example-project/src/manual-edits.ts +0 -93
- package/frontend/README.md +0 -3
- package/frontend/bun.lockb +0 -0
- package/frontend/components/command-k.tsx +0 -86
- package/frontend/components/dialogs/generic-export-dialog.tsx +0 -189
- package/frontend/components/dialogs/gerber-export-dialog.tsx +0 -168
- package/frontend/components/global-context-providers.tsx +0 -11
- package/frontend/components/select-example-search.tsx +0 -118
- package/frontend/components/ui/alert-dialog.tsx +0 -139
- package/frontend/components/ui/alert.tsx +0 -59
- package/frontend/components/ui/breadcrumb.tsx +0 -115
- package/frontend/components/ui/button.tsx +0 -57
- package/frontend/components/ui/card.tsx +0 -76
- package/frontend/components/ui/command.tsx +0 -153
- package/frontend/components/ui/context-menu.tsx +0 -202
- package/frontend/components/ui/dialog.tsx +0 -120
- package/frontend/components/ui/menubar.tsx +0 -238
- package/frontend/components/ui/navigation-menu.tsx +0 -128
- package/frontend/components/ui/popover.tsx +0 -31
- package/frontend/components/ui/select.tsx +0 -162
- package/frontend/components/ui/tabs.tsx +0 -53
- package/frontend/components/ui/toggle-group.tsx +0 -59
- package/frontend/components/ui/toggle.tsx +0 -43
- package/frontend/components/ui/tooltip.tsx +0 -28
- package/frontend/components.json +0 -17
- package/frontend/hooks/toast-if-api-not-connected.ts +0 -23
- package/frontend/hooks/use-active-dev-package-example-lite.ts +0 -39
- package/frontend/hooks/use-dev-package-examples.tsx +0 -18
- package/frontend/hooks/use-global-store.ts +0 -42
- package/frontend/index.css +0 -76
- package/frontend/index.html +0 -13
- package/frontend/lib/utils.ts +0 -6
- package/frontend/main.tsx +0 -13
- package/frontend/tailwind.config.js +0 -74
- package/frontend/views/App.tsx +0 -22
- package/frontend/views/Header.tsx +0 -55
- package/frontend/views/HeaderMenu.tsx +0 -326
- package/frontend/views/MainContentView.tsx +0 -172
- package/frontend/vite-env.d.ts +0 -1
- package/frontend/vite.config.ts +0 -50
- package/renovate.json +0 -16
- package/scripts/build-cli.ts +0 -12
- package/tsup.config.ts +0 -7
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as TabsPrimitive from "@radix-ui/react-tabs"
|
|
3
|
-
|
|
4
|
-
import { cn } from "frontend/lib/utils"
|
|
5
|
-
|
|
6
|
-
const Tabs = TabsPrimitive.Root
|
|
7
|
-
|
|
8
|
-
const TabsList = React.forwardRef<
|
|
9
|
-
React.ElementRef<typeof TabsPrimitive.List>,
|
|
10
|
-
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
|
11
|
-
>(({ className, ...props }, ref) => (
|
|
12
|
-
<TabsPrimitive.List
|
|
13
|
-
ref={ref}
|
|
14
|
-
className={cn(
|
|
15
|
-
"inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
|
|
16
|
-
className,
|
|
17
|
-
)}
|
|
18
|
-
{...props}
|
|
19
|
-
/>
|
|
20
|
-
))
|
|
21
|
-
TabsList.displayName = TabsPrimitive.List.displayName
|
|
22
|
-
|
|
23
|
-
const TabsTrigger = React.forwardRef<
|
|
24
|
-
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
|
25
|
-
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
|
26
|
-
>(({ className, ...props }, ref) => (
|
|
27
|
-
<TabsPrimitive.Trigger
|
|
28
|
-
ref={ref}
|
|
29
|
-
className={cn(
|
|
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,
|
|
32
|
-
)}
|
|
33
|
-
{...props}
|
|
34
|
-
/>
|
|
35
|
-
))
|
|
36
|
-
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
|
|
37
|
-
|
|
38
|
-
const TabsContent = React.forwardRef<
|
|
39
|
-
React.ElementRef<typeof TabsPrimitive.Content>,
|
|
40
|
-
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
|
41
|
-
>(({ className, ...props }, ref) => (
|
|
42
|
-
<TabsPrimitive.Content
|
|
43
|
-
ref={ref}
|
|
44
|
-
className={cn(
|
|
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,
|
|
47
|
-
)}
|
|
48
|
-
{...props}
|
|
49
|
-
/>
|
|
50
|
-
))
|
|
51
|
-
TabsContent.displayName = TabsPrimitive.Content.displayName
|
|
52
|
-
|
|
53
|
-
export { Tabs, TabsList, TabsTrigger, TabsContent }
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
|
|
3
|
-
import { VariantProps } from "class-variance-authority"
|
|
4
|
-
|
|
5
|
-
import { cn } from "frontend/lib/utils"
|
|
6
|
-
import { toggleVariants } from "frontend/components/ui/toggle"
|
|
7
|
-
|
|
8
|
-
const ToggleGroupContext = React.createContext<
|
|
9
|
-
VariantProps<typeof toggleVariants>
|
|
10
|
-
>({
|
|
11
|
-
size: "default",
|
|
12
|
-
variant: "default",
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
const ToggleGroup = React.forwardRef<
|
|
16
|
-
React.ElementRef<typeof ToggleGroupPrimitive.Root>,
|
|
17
|
-
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
|
|
18
|
-
VariantProps<typeof toggleVariants>
|
|
19
|
-
>(({ className, variant, size, children, ...props }, ref) => (
|
|
20
|
-
<ToggleGroupPrimitive.Root
|
|
21
|
-
ref={ref}
|
|
22
|
-
className={cn("flex items-center justify-center gap-1", className)}
|
|
23
|
-
{...props}
|
|
24
|
-
>
|
|
25
|
-
<ToggleGroupContext.Provider value={{ variant, size }}>
|
|
26
|
-
{children}
|
|
27
|
-
</ToggleGroupContext.Provider>
|
|
28
|
-
</ToggleGroupPrimitive.Root>
|
|
29
|
-
))
|
|
30
|
-
|
|
31
|
-
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName
|
|
32
|
-
|
|
33
|
-
const ToggleGroupItem = React.forwardRef<
|
|
34
|
-
React.ElementRef<typeof ToggleGroupPrimitive.Item>,
|
|
35
|
-
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
|
|
36
|
-
VariantProps<typeof toggleVariants>
|
|
37
|
-
>(({ className, children, variant, size, ...props }, ref) => {
|
|
38
|
-
const context = React.useContext(ToggleGroupContext)
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<ToggleGroupPrimitive.Item
|
|
42
|
-
ref={ref}
|
|
43
|
-
className={cn(
|
|
44
|
-
toggleVariants({
|
|
45
|
-
variant: context.variant || variant,
|
|
46
|
-
size: context.size || size,
|
|
47
|
-
}),
|
|
48
|
-
className,
|
|
49
|
-
)}
|
|
50
|
-
{...props}
|
|
51
|
-
>
|
|
52
|
-
{children}
|
|
53
|
-
</ToggleGroupPrimitive.Item>
|
|
54
|
-
)
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
|
|
58
|
-
|
|
59
|
-
export { ToggleGroup, ToggleGroupItem }
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as TogglePrimitive from "@radix-ui/react-toggle"
|
|
3
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
-
|
|
5
|
-
import { cn } from "frontend/lib/utils"
|
|
6
|
-
|
|
7
|
-
const toggleVariants = cva(
|
|
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",
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
variant: {
|
|
12
|
-
default: "bg-transparent",
|
|
13
|
-
outline:
|
|
14
|
-
"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
15
|
-
},
|
|
16
|
-
size: {
|
|
17
|
-
default: "h-9 px-3",
|
|
18
|
-
sm: "h-8 px-2",
|
|
19
|
-
lg: "h-10 px-3",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
defaultVariants: {
|
|
23
|
-
variant: "default",
|
|
24
|
-
size: "default",
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
const Toggle = React.forwardRef<
|
|
30
|
-
React.ElementRef<typeof TogglePrimitive.Root>,
|
|
31
|
-
React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &
|
|
32
|
-
VariantProps<typeof toggleVariants>
|
|
33
|
-
>(({ className, variant, size, ...props }, ref) => (
|
|
34
|
-
<TogglePrimitive.Root
|
|
35
|
-
ref={ref}
|
|
36
|
-
className={cn(toggleVariants({ variant, size, className }))}
|
|
37
|
-
{...props}
|
|
38
|
-
/>
|
|
39
|
-
))
|
|
40
|
-
|
|
41
|
-
Toggle.displayName = TogglePrimitive.Root.displayName
|
|
42
|
-
|
|
43
|
-
export { Toggle, toggleVariants }
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
|
|
3
|
-
|
|
4
|
-
import { cn } from "frontend/lib/utils"
|
|
5
|
-
|
|
6
|
-
const TooltipProvider = TooltipPrimitive.Provider
|
|
7
|
-
|
|
8
|
-
const Tooltip = TooltipPrimitive.Root
|
|
9
|
-
|
|
10
|
-
const TooltipTrigger = TooltipPrimitive.Trigger
|
|
11
|
-
|
|
12
|
-
const TooltipContent = React.forwardRef<
|
|
13
|
-
React.ElementRef<typeof TooltipPrimitive.Content>,
|
|
14
|
-
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
|
15
|
-
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
16
|
-
<TooltipPrimitive.Content
|
|
17
|
-
ref={ref}
|
|
18
|
-
sideOffset={sideOffset}
|
|
19
|
-
className={cn(
|
|
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,
|
|
22
|
-
)}
|
|
23
|
-
{...props}
|
|
24
|
-
/>
|
|
25
|
-
))
|
|
26
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName
|
|
27
|
-
|
|
28
|
-
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
package/frontend/components.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
-
"style": "new-york",
|
|
4
|
-
"rsc": false,
|
|
5
|
-
"tsx": true,
|
|
6
|
-
"tailwind": {
|
|
7
|
-
"config": "tailwind.config.js",
|
|
8
|
-
"css": "src/index.css",
|
|
9
|
-
"baseColor": "gray",
|
|
10
|
-
"cssVariables": true,
|
|
11
|
-
"prefix": ""
|
|
12
|
-
},
|
|
13
|
-
"aliases": {
|
|
14
|
-
"components": "src/components",
|
|
15
|
-
"utils": "src/lib/utils"
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react"
|
|
2
|
-
import axios from "axios"
|
|
3
|
-
import toast from "react-hot-toast"
|
|
4
|
-
|
|
5
|
-
export const useToastIfApiNotConnected = () => {
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
let lastWasConnected = true
|
|
8
|
-
const interval = setInterval(async () => {
|
|
9
|
-
try {
|
|
10
|
-
await axios.get("/api/health")
|
|
11
|
-
if (!lastWasConnected) {
|
|
12
|
-
toast.success("Reconnected to dev server API")
|
|
13
|
-
lastWasConnected = true
|
|
14
|
-
}
|
|
15
|
-
} catch (e) {
|
|
16
|
-
toast.error("Not connected to dev server API")
|
|
17
|
-
lastWasConnected = false
|
|
18
|
-
}
|
|
19
|
-
}, 5000)
|
|
20
|
-
|
|
21
|
-
return () => clearInterval(interval)
|
|
22
|
-
}, [])
|
|
23
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { useDevPackageExamples } from "./use-dev-package-examples"
|
|
2
|
-
import { useGlobalStore } from "./use-global-store"
|
|
3
|
-
|
|
4
|
-
export function inflatePackageExample(ex: any): {
|
|
5
|
-
dev_package_example_id: number
|
|
6
|
-
searchable_id: string
|
|
7
|
-
file_path: string
|
|
8
|
-
expath: string
|
|
9
|
-
export_name: string
|
|
10
|
-
last_updated_at: string
|
|
11
|
-
} {
|
|
12
|
-
if (!ex) return ex
|
|
13
|
-
return {
|
|
14
|
-
...ex,
|
|
15
|
-
expath: ex.file_path.replace(/.*examples\//, ""),
|
|
16
|
-
searchable_id: `${ex.file_path.replace(/.*examples\//, "")} | ${
|
|
17
|
-
ex.export_name
|
|
18
|
-
}`,
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const useActiveDevPackageExampleLite = () => {
|
|
23
|
-
const { data: examples } = useDevPackageExamples()
|
|
24
|
-
|
|
25
|
-
const [active_dev_example_package_id, setActiveDevExamplePackageId] =
|
|
26
|
-
useGlobalStore((s) => [
|
|
27
|
-
s.active_dev_example_package_id,
|
|
28
|
-
s.setActiveDevExamplePackageId,
|
|
29
|
-
])
|
|
30
|
-
|
|
31
|
-
const activeDevExamplePackage = inflatePackageExample(
|
|
32
|
-
examples?.find(
|
|
33
|
-
(ex) =>
|
|
34
|
-
ex.dev_package_example_id.toString() === active_dev_example_package_id,
|
|
35
|
-
),
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
return activeDevExamplePackage
|
|
39
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
import { useQuery } from "react-query"
|
|
3
|
-
import axios from "axios"
|
|
4
|
-
import { inflatePackageExample } from "../components/select-example-search"
|
|
5
|
-
|
|
6
|
-
export const useDevPackageExamples = () => {
|
|
7
|
-
return useQuery("examples", async () => {
|
|
8
|
-
const { data } = await axios.get("/api/dev_package_examples/list")
|
|
9
|
-
return data.dev_package_examples.map(inflatePackageExample) as Array<{
|
|
10
|
-
dev_package_example_id: number
|
|
11
|
-
searchable_id: string
|
|
12
|
-
file_path: string
|
|
13
|
-
expath: string
|
|
14
|
-
export_name: string
|
|
15
|
-
last_updated_at: string
|
|
16
|
-
}>
|
|
17
|
-
})
|
|
18
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { create } from "zustand"
|
|
2
|
-
import { persist } from "zustand/middleware"
|
|
3
|
-
|
|
4
|
-
export interface GlobalState {
|
|
5
|
-
active_dev_example_package_id: string | null
|
|
6
|
-
|
|
7
|
-
view_mode: "schematic" | "pcb" | "split" | "soup" | "3d"
|
|
8
|
-
split_mode: "horizontal" | "vertical"
|
|
9
|
-
in_debug_mode: boolean
|
|
10
|
-
|
|
11
|
-
setActiveDevExamplePackageId: (id: string) => void
|
|
12
|
-
setViewMode: (mode: "schematic" | "pcb" | "split") => void
|
|
13
|
-
setSplitMode: (mode: "horizontal" | "vertical") => void
|
|
14
|
-
setDebugMode: (mode: boolean) => void
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const useGlobalStore = create<GlobalState>()(
|
|
18
|
-
persist(
|
|
19
|
-
(set) => ({
|
|
20
|
-
active_dev_example_package_id: null,
|
|
21
|
-
view_mode: "schematic",
|
|
22
|
-
split_mode: "horizontal",
|
|
23
|
-
in_debug_mode: false,
|
|
24
|
-
|
|
25
|
-
setActiveDevExamplePackageId: (id: string) => {
|
|
26
|
-
set({ active_dev_example_package_id: id })
|
|
27
|
-
},
|
|
28
|
-
setViewMode: (mode: "schematic" | "pcb" | "split") => {
|
|
29
|
-
set({ view_mode: mode })
|
|
30
|
-
},
|
|
31
|
-
setSplitMode: (mode: "horizontal" | "vertical") => {
|
|
32
|
-
set({ split_mode: mode })
|
|
33
|
-
},
|
|
34
|
-
setDebugMode: (mode: boolean) => {
|
|
35
|
-
set({ in_debug_mode: mode })
|
|
36
|
-
},
|
|
37
|
-
}),
|
|
38
|
-
{
|
|
39
|
-
name: "global-store",
|
|
40
|
-
},
|
|
41
|
-
),
|
|
42
|
-
)
|
package/frontend/index.css
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
@tailwind base;
|
|
2
|
-
@tailwind components;
|
|
3
|
-
@tailwind utilities;
|
|
4
|
-
|
|
5
|
-
@layer base {
|
|
6
|
-
:root {
|
|
7
|
-
--background: 0 0% 100%;
|
|
8
|
-
--foreground: 224 71.4% 4.1%;
|
|
9
|
-
|
|
10
|
-
--card: 0 0% 100%;
|
|
11
|
-
--card-foreground: 224 71.4% 4.1%;
|
|
12
|
-
|
|
13
|
-
--popover: 0 0% 100%;
|
|
14
|
-
--popover-foreground: 224 71.4% 4.1%;
|
|
15
|
-
|
|
16
|
-
--primary: 220.9 39.3% 11%;
|
|
17
|
-
--primary-foreground: 210 20% 98%;
|
|
18
|
-
|
|
19
|
-
--secondary: 220 14.3% 95.9%;
|
|
20
|
-
--secondary-foreground: 220.9 39.3% 11%;
|
|
21
|
-
|
|
22
|
-
--muted: 220 14.3% 95.9%;
|
|
23
|
-
--muted-foreground: 220 8.9% 46.1%;
|
|
24
|
-
|
|
25
|
-
--accent: 220 14.3% 95.9%;
|
|
26
|
-
--accent-foreground: 220.9 39.3% 11%;
|
|
27
|
-
|
|
28
|
-
--destructive: 0 84.2% 60.2%;
|
|
29
|
-
--destructive-foreground: 210 20% 98%;
|
|
30
|
-
|
|
31
|
-
--border: 220 13% 91%;
|
|
32
|
-
--input: 220 13% 91%;
|
|
33
|
-
--ring: 224 71.4% 4.1%;
|
|
34
|
-
|
|
35
|
-
--radius: 0.5rem;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.dark {
|
|
39
|
-
--background: 224 71.4% 4.1%;
|
|
40
|
-
--foreground: 210 20% 98%;
|
|
41
|
-
|
|
42
|
-
--card: 224 71.4% 4.1%;
|
|
43
|
-
--card-foreground: 210 20% 98%;
|
|
44
|
-
|
|
45
|
-
--popover: 224 71.4% 4.1%;
|
|
46
|
-
--popover-foreground: 210 20% 98%;
|
|
47
|
-
|
|
48
|
-
--primary: 210 20% 98%;
|
|
49
|
-
--primary-foreground: 220.9 39.3% 11%;
|
|
50
|
-
|
|
51
|
-
--secondary: 215 27.9% 16.9%;
|
|
52
|
-
--secondary-foreground: 210 20% 98%;
|
|
53
|
-
|
|
54
|
-
--muted: 215 27.9% 16.9%;
|
|
55
|
-
--muted-foreground: 217.9 10.6% 64.9%;
|
|
56
|
-
|
|
57
|
-
--accent: 215 27.9% 16.9%;
|
|
58
|
-
--accent-foreground: 210 20% 98%;
|
|
59
|
-
|
|
60
|
-
--destructive: 0 62.8% 30.6%;
|
|
61
|
-
--destructive-foreground: 210 20% 98%;
|
|
62
|
-
|
|
63
|
-
--border: 215 27.9% 16.9%;
|
|
64
|
-
--input: 215 27.9% 16.9%;
|
|
65
|
-
--ring: 216 12.2% 83.9%;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
@layer base {
|
|
70
|
-
* {
|
|
71
|
-
@apply border-border;
|
|
72
|
-
}
|
|
73
|
-
body {
|
|
74
|
-
@apply bg-background text-foreground;
|
|
75
|
-
}
|
|
76
|
-
}
|
package/frontend/index.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>[dev] tscircuit</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="root"></div>
|
|
11
|
-
<script type="module" src="/main.tsx"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
package/frontend/lib/utils.ts
DELETED
package/frontend/main.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import ReactDOM from "react-dom/client"
|
|
3
|
-
import App from "./views/App.tsx"
|
|
4
|
-
import "./index.css"
|
|
5
|
-
import { GlobalContextProviders } from "./components/global-context-providers.tsx"
|
|
6
|
-
|
|
7
|
-
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
8
|
-
<React.StrictMode>
|
|
9
|
-
<GlobalContextProviders>
|
|
10
|
-
<App />
|
|
11
|
-
</GlobalContextProviders>
|
|
12
|
-
</React.StrictMode>,
|
|
13
|
-
)
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
const path = require("node:path")
|
|
2
|
-
|
|
3
|
-
/** @type {import('tailwindcss').Config} */
|
|
4
|
-
module.exports = {
|
|
5
|
-
darkMode: ["class"],
|
|
6
|
-
content: [path.join(__dirname, "./{src,components,lib,views}/**/*.{ts,tsx}")],
|
|
7
|
-
prefix: "",
|
|
8
|
-
theme: {
|
|
9
|
-
container: {
|
|
10
|
-
center: true,
|
|
11
|
-
padding: "2rem",
|
|
12
|
-
screens: {
|
|
13
|
-
"2xl": "1400px",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
extend: {
|
|
17
|
-
colors: {
|
|
18
|
-
border: "hsl(var(--border))",
|
|
19
|
-
input: "hsl(var(--input))",
|
|
20
|
-
ring: "hsl(var(--ring))",
|
|
21
|
-
background: "hsl(var(--background))",
|
|
22
|
-
foreground: "hsl(var(--foreground))",
|
|
23
|
-
primary: {
|
|
24
|
-
DEFAULT: "hsl(var(--primary))",
|
|
25
|
-
foreground: "hsl(var(--primary-foreground))",
|
|
26
|
-
},
|
|
27
|
-
secondary: {
|
|
28
|
-
DEFAULT: "hsl(var(--secondary))",
|
|
29
|
-
foreground: "hsl(var(--secondary-foreground))",
|
|
30
|
-
},
|
|
31
|
-
destructive: {
|
|
32
|
-
DEFAULT: "hsl(var(--destructive))",
|
|
33
|
-
foreground: "hsl(var(--destructive-foreground))",
|
|
34
|
-
},
|
|
35
|
-
muted: {
|
|
36
|
-
DEFAULT: "hsl(var(--muted))",
|
|
37
|
-
foreground: "hsl(var(--muted-foreground))",
|
|
38
|
-
},
|
|
39
|
-
accent: {
|
|
40
|
-
DEFAULT: "hsl(var(--accent))",
|
|
41
|
-
foreground: "hsl(var(--accent-foreground))",
|
|
42
|
-
},
|
|
43
|
-
popover: {
|
|
44
|
-
DEFAULT: "hsl(var(--popover))",
|
|
45
|
-
foreground: "hsl(var(--popover-foreground))",
|
|
46
|
-
},
|
|
47
|
-
card: {
|
|
48
|
-
DEFAULT: "hsl(var(--card))",
|
|
49
|
-
foreground: "hsl(var(--card-foreground))",
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
borderRadius: {
|
|
53
|
-
lg: "var(--radius)",
|
|
54
|
-
md: "calc(var(--radius) - 2px)",
|
|
55
|
-
sm: "calc(var(--radius) - 4px)",
|
|
56
|
-
},
|
|
57
|
-
keyframes: {
|
|
58
|
-
"accordion-down": {
|
|
59
|
-
from: { height: "0" },
|
|
60
|
-
to: { height: "var(--radix-accordion-content-height)" },
|
|
61
|
-
},
|
|
62
|
-
"accordion-up": {
|
|
63
|
-
from: { height: "var(--radix-accordion-content-height)" },
|
|
64
|
-
to: { height: "0" },
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
animation: {
|
|
68
|
-
"accordion-down": "accordion-down 0.2s ease-out",
|
|
69
|
-
"accordion-up": "accordion-up 0.2s ease-out",
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
plugins: [require("tailwindcss-animate")],
|
|
74
|
-
}
|
package/frontend/views/App.tsx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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,55 +0,0 @@
|
|
|
1
|
-
import { useState } from "react"
|
|
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
|
-
import { RotateCounterClockwiseIcon } from "@radix-ui/react-icons"
|
|
6
|
-
import { useGlobalStore } from "frontend/hooks/use-global-store"
|
|
7
|
-
import { HeaderMenu } from "./HeaderMenu"
|
|
8
|
-
import { CommandShortcut } from "frontend/components/ui/command"
|
|
9
|
-
|
|
10
|
-
export const Header = () => {
|
|
11
|
-
const [viewMode, setViewMode] = useGlobalStore((s) => [
|
|
12
|
-
s.view_mode,
|
|
13
|
-
s.setViewMode,
|
|
14
|
-
])
|
|
15
|
-
const [splitMode, setSplitMode] = useGlobalStore((s) => [
|
|
16
|
-
s.split_mode,
|
|
17
|
-
s.setSplitMode,
|
|
18
|
-
])
|
|
19
|
-
const [inDebugMode, setInDebugMode] = useState(false)
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<div className="p-2 border-b border-b-gray-200 shadow-sm grid grid-cols-3">
|
|
23
|
-
<div className="flex">
|
|
24
|
-
<div className="inline-flex">
|
|
25
|
-
<HeaderMenu />
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
<div className="justify-center flex">
|
|
29
|
-
<SelectExampleSearch />
|
|
30
|
-
</div>
|
|
31
|
-
<div className="flex justify-end">
|
|
32
|
-
{/* Tabs from shadcn with "Tab One" and "Tab Two" */}
|
|
33
|
-
<Tabs onValueChange={(v) => setViewMode(v as any)} value={viewMode}>
|
|
34
|
-
<TabsList>
|
|
35
|
-
<TabsTrigger value="schematic">Schematic</TabsTrigger>
|
|
36
|
-
<TabsTrigger value="pcb">PCB</TabsTrigger>
|
|
37
|
-
{/* <TabsTrigger value="split">Split</TabsTrigger> */}
|
|
38
|
-
<TabsTrigger value="3d">3D</TabsTrigger>
|
|
39
|
-
</TabsList>
|
|
40
|
-
</Tabs>
|
|
41
|
-
{/* Button is only relevant when the "Split" button is available */}
|
|
42
|
-
{/* <Button
|
|
43
|
-
variant="outline"
|
|
44
|
-
disabled={viewMode !== "split"}
|
|
45
|
-
className="ml-1 group"
|
|
46
|
-
onClick={() => {
|
|
47
|
-
setSplitMode(splitMode === "horizontal" ? "vertical" : "horizontal")
|
|
48
|
-
}}
|
|
49
|
-
>
|
|
50
|
-
<RotateCounterClockwiseIcon className="scale-x-[-1] group-hover:rotate-[30deg] transition-transform" />
|
|
51
|
-
</Button> */}
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
)
|
|
55
|
-
}
|