@tscircuit/fake-snippets 0.0.109 → 0.0.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/bun-formatcheck.yml +2 -2
- package/.github/workflows/bun-pver-release.yml +3 -3
- package/.github/workflows/bun-test.yml +1 -1
- package/.github/workflows/bun-typecheck.yml +2 -2
- package/.github/workflows/update-snapshots.yml +1 -1
- package/README.md +4 -0
- package/api/generated-index.js +37 -3
- package/biome.json +2 -1
- package/bun-tests/fake-snippets-api/fixtures/get-test-server.ts +32 -3
- package/bun-tests/fake-snippets-api/fixtures/preload.ts +18 -0
- package/bun-tests/fake-snippets-api/routes/orgs/add_member.test.ts +26 -0
- package/bun-tests/fake-snippets-api/routes/orgs/create.test.ts +37 -0
- package/bun-tests/fake-snippets-api/routes/orgs/get.test.ts +52 -0
- package/bun-tests/fake-snippets-api/routes/orgs/list.test.ts +17 -0
- package/bun-tests/fake-snippets-api/routes/orgs/list_members.test.ts +23 -0
- package/bun-tests/fake-snippets-api/routes/orgs/remove_member.test.ts +81 -0
- package/bun-tests/fake-snippets-api/routes/orgs/update.test.ts +151 -0
- package/bun-tests/fake-snippets-api/routes/package_builds/get.test.ts +1 -1
- package/bun-tests/fake-snippets-api/routes/package_files/create.test.ts +15 -13
- package/bun-tests/fake-snippets-api/routes/package_files/create_or_update.test.ts +26 -24
- package/bun-tests/fake-snippets-api/routes/package_files/delete.test.ts +9 -9
- package/bun-tests/fake-snippets-api/routes/package_files/download.test.ts +4 -4
- package/bun-tests/fake-snippets-api/routes/package_files/get.test.ts +38 -28
- package/bun-tests/fake-snippets-api/routes/package_files/list.test.ts +23 -15
- package/bun-tests/fake-snippets-api/routes/package_releases/create.test.ts +33 -0
- package/bun-tests/fake-snippets-api/routes/package_releases/get.test.ts +4 -4
- package/bun-tests/fake-snippets-api/routes/package_releases/get_image_generation_fields.test.ts +38 -0
- package/bun-tests/fake-snippets-api/routes/packages/create.test.ts +19 -0
- package/bun-tests/fake-snippets-api/routes/packages/fork.test.ts +3 -4
- package/bun-tests/fake-snippets-api/routes/packages/get.test.ts +30 -0
- package/bun-tests/fake-snippets-api/routes/packages/images.test.ts +4 -2
- package/bun-tests/fake-snippets-api/routes/packages/list-1.test.ts +34 -0
- package/bun.lock +361 -453
- package/bunfig.toml +2 -1
- package/dist/bundle.js +1313 -639
- package/dist/index.d.ts +313 -6
- package/dist/index.js +328 -24
- package/dist/schema.d.ts +290 -1
- package/dist/schema.js +54 -1
- package/fake-snippets-api/lib/db/autoload-dev-packages.ts +31 -20
- package/fake-snippets-api/lib/db/db-client.ts +219 -4
- package/fake-snippets-api/lib/db/schema.ts +63 -1
- package/fake-snippets-api/lib/db/seed.ts +100 -0
- package/fake-snippets-api/lib/middleware/with-session-auth.ts +60 -8
- package/fake-snippets-api/lib/package_file/get-package-file-id-from-file-descriptor.ts +2 -2
- package/fake-snippets-api/lib/public-mapping/public-map-org.ts +33 -0
- package/fake-snippets-api/lib/public-mapping/public-map-package-build.ts +10 -0
- package/fake-snippets-api/lib/public-mapping/public-map-package-release.ts +17 -0
- package/fake-snippets-api/routes/api/orgs/add_member.ts +52 -0
- package/fake-snippets-api/routes/api/orgs/create.ts +48 -0
- package/fake-snippets-api/routes/api/orgs/get.ts +39 -0
- package/fake-snippets-api/routes/api/orgs/list.ts +31 -0
- package/fake-snippets-api/routes/api/orgs/list_members.ts +60 -0
- package/fake-snippets-api/routes/api/orgs/remove_member.ts +46 -0
- package/fake-snippets-api/routes/api/orgs/update.ts +118 -0
- package/fake-snippets-api/routes/api/package_files/get.ts +3 -6
- package/fake-snippets-api/routes/api/package_files/list.ts +7 -4
- package/fake-snippets-api/routes/api/packages/create.ts +57 -10
- package/fake-snippets-api/routes/api/packages/get.ts +23 -0
- package/fake-snippets-api/routes/api/packages/images/[owner_github_username]/[unscoped_name]/[view_format].ts +13 -11
- package/fake-snippets-api/routes/api/packages/list.ts +29 -2
- package/fake-snippets-api/routes/api/packages/update_ai_description.ts +37 -0
- package/package.json +25 -19
- package/renovate.json +1 -1
- package/scripts/generate-sitemap.ts +1 -1
- package/src/App.tsx +27 -8
- package/src/ContextProviders.tsx +25 -2
- package/src/components/CircuitJsonImportDialog.tsx +1 -1
- package/src/components/CmdKMenu.tsx +281 -247
- package/src/components/DownloadButtonAndMenu.tsx +17 -5
- package/src/components/FileSidebar.tsx +11 -17
- package/src/components/Footer.tsx +8 -9
- package/src/components/Header.tsx +19 -32
- package/src/components/Header2.tsx +16 -32
- package/src/components/HeaderDropdown.tsx +13 -8
- package/src/components/HeaderLogin.tsx +43 -15
- package/src/components/NotFound.tsx +5 -5
- package/src/components/PackageBreadcrumb.tsx +6 -12
- package/src/components/PackageSearchResults.tsx +1 -1
- package/src/components/PrefetchPageLink.tsx +7 -1
- package/src/components/ProfileRouter.tsx +32 -0
- package/src/components/SearchComponent.tsx +12 -8
- package/src/components/SentryNotFoundReporter.tsx +44 -0
- package/src/components/UserCard.tsx +80 -0
- package/src/components/ViewPackagePage/components/build-status.tsx +1 -1
- package/src/components/ViewPackagePage/components/important-files-view.tsx +105 -34
- package/src/components/ViewPackagePage/components/main-content-header.tsx +10 -6
- package/src/components/ViewPackagePage/components/main-content-view-selector.tsx +1 -1
- package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +54 -19
- package/src/components/ViewPackagePage/components/package-header.tsx +25 -33
- package/src/components/ViewPackagePage/components/preview-image-squares.tsx +11 -18
- package/src/components/ViewPackagePage/components/repo-page-content.tsx +12 -5
- package/src/components/ViewPackagePage/components/sidebar-about-section.tsx +16 -10
- package/src/components/ViewPackagePage/components/sidebar-releases-section.tsx +11 -11
- package/src/components/ViewPackagePage/components/tab-views/pcb-view.tsx +1 -2
- package/src/components/ViewPackagePage/components/tab-views/schematic-view.tsx +2 -1
- package/src/components/dialogs/GitHubRepositorySelector.tsx +56 -49
- package/src/components/dialogs/edit-package-details-dialog.tsx +5 -6
- package/src/components/dialogs/import-component-dialog.tsx +16 -9
- package/src/components/dialogs/import-package-dialog.tsx +3 -2
- package/src/components/dialogs/new-package-save-prompt-dialog.tsx +190 -0
- package/src/components/organization/OrganizationCard.tsx +206 -0
- package/src/components/organization/OrganizationCardSkeleton.tsx +55 -0
- package/src/components/organization/OrganizationHeader.tsx +154 -0
- package/src/components/organization/OrganizationMembers.tsx +146 -0
- package/src/components/package-port/CodeAndPreview.tsx +15 -12
- package/src/components/package-port/CodeEditor.tsx +4 -30
- package/src/components/package-port/CodeEditorHeader.tsx +123 -61
- package/src/components/package-port/EditorNav.tsx +32 -49
- package/src/components/preview/ConnectedPackagesList.tsx +8 -8
- package/src/components/preview/ConnectedRepoOverview.tsx +102 -2
- package/src/components/preview/PackageReleasesDashboard.tsx +23 -11
- package/src/components/ui/tree-view.tsx +6 -3
- package/src/hooks/use-add-org-member-mutation.ts +51 -0
- package/src/hooks/use-create-org-mutation.ts +38 -0
- package/src/hooks/use-create-package-mutation.ts +3 -0
- package/src/hooks/use-current-package-release.ts +4 -3
- package/src/hooks/use-download-zip.ts +2 -2
- package/src/hooks/use-global-store.ts +6 -4
- package/src/hooks/use-hydration.ts +30 -0
- package/src/hooks/use-jlcpcb-component-import.tsx +164 -0
- package/src/hooks/use-list-org-members.ts +27 -0
- package/src/hooks/use-list-user-orgs.ts +25 -0
- package/src/hooks/use-org-by-github-handle.ts +26 -0
- package/src/hooks/use-org.ts +24 -0
- package/src/hooks/use-organization.ts +42 -0
- package/src/hooks/use-package-as-snippet.ts +4 -2
- package/src/hooks/use-package-builds.ts +6 -2
- package/src/hooks/use-package-files.ts +5 -3
- package/src/hooks/use-package-release-by-id-or-version.ts +29 -20
- package/src/hooks/use-package-release-images.ts +105 -0
- package/src/hooks/use-package-release.ts +2 -2
- package/src/hooks/use-package-stars.ts +80 -4
- package/src/hooks/use-preview-images.ts +6 -3
- package/src/hooks/use-remove-org-member-mutation.ts +32 -0
- package/src/hooks/use-update-ai-description-mutation.ts +42 -0
- package/src/hooks/use-update-org-mutation.ts +41 -0
- package/src/hooks/use-warn-user-on-page-change.ts +71 -4
- package/src/hooks/useFileManagement.ts +51 -22
- package/src/hooks/useOptimizedPackageFilesLoader.ts +11 -24
- package/src/hooks/usePackageFilesLoader.ts +2 -2
- package/src/hooks/useUpdatePackageFilesMutation.ts +13 -1
- package/src/lib/download-fns/download-gltf-from-circuit-json.ts +1 -1
- package/src/lib/download-fns/download-kicad-files.ts +22 -11
- package/src/lib/download-fns/download-step.ts +12 -0
- package/src/lib/normalize-svg-for-tile.ts +50 -0
- package/src/lib/posthog.ts +11 -9
- package/src/lib/react-query-api-failure-tracking.ts +148 -0
- package/src/lib/sentry.ts +14 -0
- package/src/lib/templates/blank-circuit-board-template.ts +0 -4
- package/src/lib/ts-lib-cache.ts +122 -7
- package/src/lib/utils/checkIfManualEditsImported.ts +4 -4
- package/src/lib/utils/findTargetFile.ts +45 -10
- package/src/lib/utils/isComponentExported.ts +2 -1
- package/src/main.tsx +2 -1
- package/src/pages/create-organization.tsx +169 -0
- package/src/pages/dashboard.tsx +38 -6
- package/src/pages/datasheet.tsx +1 -1
- package/src/pages/datasheets.tsx +3 -3
- package/src/pages/editor.tsx +4 -6
- package/src/pages/landing.tsx +6 -6
- package/src/pages/latest.tsx +3 -0
- package/src/pages/organization-profile.tsx +199 -0
- package/src/pages/organization-settings.tsx +569 -0
- package/src/pages/package-editor.tsx +21 -21
- package/src/pages/preview-release.tsx +75 -145
- package/src/pages/quickstart.tsx +159 -123
- package/src/pages/release-detail.tsx +119 -31
- package/src/pages/search.tsx +197 -57
- package/src/pages/settings-redirect.tsx +44 -0
- package/src/pages/trending.tsx +29 -20
- package/src/pages/user-profile.tsx +58 -7
- package/src/pages/user-settings.tsx +161 -0
- package/src/pages/view-package.tsx +30 -16
- package/vite.config.ts +9 -0
- package/fake-snippets-api/routes/api/autocomplete/create_autocomplete.ts +0 -133
- package/src/components/JLCPCBImportDialog.tsx +0 -280
- package/src/components/PackageBuildsPage/LogContent.tsx +0 -72
- package/src/components/PackageBuildsPage/PackageBuildDetailsPage.tsx +0 -113
- package/src/components/PackageBuildsPage/build-preview-content.tsx +0 -56
- package/src/components/PackageBuildsPage/collapsible-section.tsx +0 -63
- package/src/components/PackageBuildsPage/package-build-details-panel.tsx +0 -166
- package/src/components/PackageBuildsPage/package-build-header.tsx +0 -79
- package/src/components/PageSearchComponent.tsx +0 -148
- package/src/pages/package-builds.tsx +0 -33
|
@@ -4,8 +4,10 @@ import {
|
|
|
4
4
|
convertCircuitJsonToPcbSvg,
|
|
5
5
|
convertCircuitJsonToSchematicSvg,
|
|
6
6
|
} from "circuit-to-svg"
|
|
7
|
+
import { convertCircuitJsonToSimple3dSvg } from "circuit-json-to-simple-3d"
|
|
7
8
|
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
8
9
|
import { z } from "zod"
|
|
10
|
+
import { renderAsync } from "@resvg/resvg-js"
|
|
9
11
|
|
|
10
12
|
// Define the view types and extensions
|
|
11
13
|
const VIEW_TYPES = ["schematic", "pcb", "assembly", "3d"] as const
|
|
@@ -68,7 +70,8 @@ export default withRouteSpec({
|
|
|
68
70
|
const circuit_json_file = ctx.db.packageFiles.find(
|
|
69
71
|
(pf) =>
|
|
70
72
|
pf.package_release_id === pkg_release.package_release_id &&
|
|
71
|
-
pf.file_path === "circuit.json"
|
|
73
|
+
(pf.file_path === "circuit.json" ||
|
|
74
|
+
pf.file_path === "/dist/circuit.json"),
|
|
72
75
|
)
|
|
73
76
|
|
|
74
77
|
if (!circuit_json_file?.content_text) {
|
|
@@ -82,7 +85,6 @@ export default withRouteSpec({
|
|
|
82
85
|
|
|
83
86
|
// Convert circuit json to svg
|
|
84
87
|
let svg = ""
|
|
85
|
-
|
|
86
88
|
if (outputType === "schematic") {
|
|
87
89
|
svg = convertCircuitJsonToSchematicSvg(circuit_json as AnyCircuitElement[])
|
|
88
90
|
} else if (outputType === "pcb") {
|
|
@@ -90,13 +92,14 @@ export default withRouteSpec({
|
|
|
90
92
|
} else if (outputType === "assembly") {
|
|
91
93
|
svg = convertCircuitJsonToAssemblySvg(circuit_json as AnyCircuitElement[])
|
|
92
94
|
} else if (outputType === "3d") {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
svg = await convertCircuitJsonToSimple3dSvg(circuit_json, {
|
|
96
|
+
background: {
|
|
97
|
+
color: "#fff",
|
|
98
|
+
opacity: 0.0,
|
|
99
|
+
},
|
|
100
|
+
defaultZoomMultiplier: 1.1,
|
|
101
|
+
})
|
|
98
102
|
}
|
|
99
|
-
|
|
100
103
|
if (format === "svg") {
|
|
101
104
|
return new Response(svg, {
|
|
102
105
|
headers: {
|
|
@@ -106,9 +109,8 @@ export default withRouteSpec({
|
|
|
106
109
|
})
|
|
107
110
|
}
|
|
108
111
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return new Response(svg, {
|
|
112
|
+
const pngBuffer = await renderAsync(svg)
|
|
113
|
+
return new Response(pngBuffer.asPng().buffer as ArrayBuffer, {
|
|
112
114
|
headers: {
|
|
113
115
|
"Content-Type": "image/png",
|
|
114
116
|
"Cache-Control": "public, max-age=86400, s-maxage=86400",
|
|
@@ -13,7 +13,16 @@ export default withRouteSpec({
|
|
|
13
13
|
}),
|
|
14
14
|
jsonResponse: z.object({
|
|
15
15
|
ok: z.boolean(),
|
|
16
|
-
packages: z.array(
|
|
16
|
+
packages: z.array(
|
|
17
|
+
packageSchema.extend({
|
|
18
|
+
starred_at: z.string().nullable(),
|
|
19
|
+
user_permissions: z
|
|
20
|
+
.object({
|
|
21
|
+
can_manage_packages: z.boolean(),
|
|
22
|
+
})
|
|
23
|
+
.optional(),
|
|
24
|
+
}),
|
|
25
|
+
),
|
|
17
26
|
}),
|
|
18
27
|
})(async (req, ctx) => {
|
|
19
28
|
const { creator_account_id, owner_github_username, name, is_writable } =
|
|
@@ -28,6 +37,17 @@ export default withRouteSpec({
|
|
|
28
37
|
})
|
|
29
38
|
}
|
|
30
39
|
|
|
40
|
+
// Helper to check if user can manage a package
|
|
41
|
+
const canManagePackage = (pkg: any) => {
|
|
42
|
+
if (!auth) return false
|
|
43
|
+
// Check if user is a member of the package's owner org
|
|
44
|
+
const state = ctx.db.getState()
|
|
45
|
+
return state.orgAccounts.some(
|
|
46
|
+
(oa) =>
|
|
47
|
+
oa.account_id === auth.account_id && oa.org_id === pkg.owner_org_id,
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
31
51
|
let packages = ctx.db.packages
|
|
32
52
|
|
|
33
53
|
// Apply filters
|
|
@@ -46,7 +66,7 @@ export default withRouteSpec({
|
|
|
46
66
|
}
|
|
47
67
|
|
|
48
68
|
if (is_writable && auth) {
|
|
49
|
-
packages = packages.filter(
|
|
69
|
+
packages = packages.filter(canManagePackage)
|
|
50
70
|
}
|
|
51
71
|
|
|
52
72
|
// Get star timestamps for authenticated user
|
|
@@ -65,6 +85,13 @@ export default withRouteSpec({
|
|
|
65
85
|
...p,
|
|
66
86
|
latest_package_release_id: p.latest_package_release_id || null,
|
|
67
87
|
starred_at: starTimestamps.get(p.package_id) || null,
|
|
88
|
+
...(auth
|
|
89
|
+
? {
|
|
90
|
+
user_permissions: {
|
|
91
|
+
can_manage_packages: canManagePackage(p),
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
: {}),
|
|
68
95
|
})),
|
|
69
96
|
})
|
|
70
97
|
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
2
|
+
import { z } from "zod"
|
|
3
|
+
|
|
4
|
+
export default withRouteSpec({
|
|
5
|
+
methods: ["POST"],
|
|
6
|
+
auth: "session",
|
|
7
|
+
jsonBody: z.object({
|
|
8
|
+
package_id: z.string(),
|
|
9
|
+
}),
|
|
10
|
+
jsonResponse: z.object({
|
|
11
|
+
success: z.boolean(),
|
|
12
|
+
}),
|
|
13
|
+
})(async (req, ctx) => {
|
|
14
|
+
const { package_id } = req.jsonBody
|
|
15
|
+
|
|
16
|
+
const package_info = ctx.db.getPackageById(package_id)
|
|
17
|
+
if (!package_info) {
|
|
18
|
+
return ctx.error(404, {
|
|
19
|
+
error_code: "package_not_found",
|
|
20
|
+
message: "Package not found",
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (package_info.owner_github_username !== ctx.auth.github_username) {
|
|
25
|
+
return ctx.error(403, {
|
|
26
|
+
error_code: "unauthorized",
|
|
27
|
+
message: "Only the package owner can update AI description",
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
ctx.db.updatePackage(package_id, {
|
|
32
|
+
ai_description: "New ai description",
|
|
33
|
+
ai_usage_instructions: "New ai usage instructions",
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
return ctx.json({ success: true })
|
|
37
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/fake-snippets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.111",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"playwright": "bunx playwright test",
|
|
19
19
|
"playwright:update": "bunx playwright test --update-snapshots",
|
|
20
20
|
"start:playwright-server": "bun run build:fake-api && vite --port 5177",
|
|
21
|
-
"dev": "bun run build:fake-api && AUTOLOAD_PACKAGES=true vite",
|
|
21
|
+
"dev": "bun run build:fake-api && AUTOLOAD_PACKAGES=true vite --host",
|
|
22
22
|
"dev:registry": "SNIPPETS_API_URL=http://localhost:3100 vite",
|
|
23
23
|
"build": "bun run generate-images && bun run generate-sitemap && bun run build:fake-api && tsc -b && vite build",
|
|
24
24
|
"preview": "vite preview",
|
|
@@ -76,17 +76,18 @@
|
|
|
76
76
|
"@radix-ui/react-toggle-group": "^1.1.0",
|
|
77
77
|
"@radix-ui/react-tooltip": "^1.1.2",
|
|
78
78
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
79
|
+
"@sentry/react": "^10.10.0",
|
|
79
80
|
"@tailwindcss/typography": "^0.5.16",
|
|
80
|
-
"@tscircuit/3d-viewer": "^0.0.
|
|
81
|
-
"@tscircuit/assembly-viewer": "^0.0.
|
|
81
|
+
"@tscircuit/3d-viewer": "^0.0.402",
|
|
82
|
+
"@tscircuit/assembly-viewer": "^0.0.5",
|
|
82
83
|
"@tscircuit/create-snippet-url": "^0.0.8",
|
|
83
|
-
"@tscircuit/eval": "^0.0.
|
|
84
|
+
"@tscircuit/eval": "^0.0.325",
|
|
84
85
|
"@tscircuit/layout": "^0.0.29",
|
|
85
86
|
"@tscircuit/mm": "^0.0.8",
|
|
86
|
-
"@tscircuit/pcb-viewer": "^1.11.
|
|
87
|
+
"@tscircuit/pcb-viewer": "^1.11.218",
|
|
87
88
|
"@tscircuit/prompt-benchmarks": "^0.0.28",
|
|
88
|
-
"@tscircuit/runframe": "^0.0.
|
|
89
|
-
"@tscircuit/schematic-viewer": "^2.0.
|
|
89
|
+
"@tscircuit/runframe": "^0.0.1031",
|
|
90
|
+
"@tscircuit/schematic-viewer": "^2.0.39",
|
|
90
91
|
"@tscircuit/simple-3d-svg": "^0.0.41",
|
|
91
92
|
"@types/babel__standalone": "^7.1.7",
|
|
92
93
|
"@types/bun": "^1.1.10",
|
|
@@ -99,6 +100,7 @@
|
|
|
99
100
|
"@types/react-dom": "^18.3.0",
|
|
100
101
|
"@types/react-helmet": "^6.1.11",
|
|
101
102
|
"@types/sharp": "^0.32.0",
|
|
103
|
+
"@types/three": "^0.180.0",
|
|
102
104
|
"@typescript/ata": "^0.9.7",
|
|
103
105
|
"@typescript/vfs": "^1.6.0",
|
|
104
106
|
"@valtown/codemirror-ts": "^2.2.0",
|
|
@@ -107,13 +109,15 @@
|
|
|
107
109
|
"autoprefixer": "^10.4.20",
|
|
108
110
|
"circuit-json-to-bom-csv": "^0.0.7",
|
|
109
111
|
"circuit-json-to-gerber": "^0.0.29",
|
|
110
|
-
"circuit-json-to-gltf": "^0.0.
|
|
112
|
+
"circuit-json-to-gltf": "^0.0.14",
|
|
113
|
+
"circuit-json-to-kicad": "^0.0.9",
|
|
111
114
|
"circuit-json-to-pnp-csv": "^0.0.7",
|
|
112
115
|
"circuit-json-to-readable-netlist": "^0.0.13",
|
|
113
|
-
"circuit-json-to-simple-3d": "^0.0.
|
|
116
|
+
"circuit-json-to-simple-3d": "^0.0.7",
|
|
114
117
|
"circuit-json-to-spice": "^0.0.6",
|
|
115
|
-
"circuit-json-to-
|
|
116
|
-
"circuit-to-
|
|
118
|
+
"circuit-json-to-step": "^0.0.2",
|
|
119
|
+
"circuit-json-to-tscircuit": "^0.0.9",
|
|
120
|
+
"circuit-to-svg": "^0.0.202",
|
|
117
121
|
"class-variance-authority": "^0.7.1",
|
|
118
122
|
"clsx": "^2.1.1",
|
|
119
123
|
"cmdk": "^1.0.4",
|
|
@@ -121,11 +125,12 @@
|
|
|
121
125
|
"codemirror-copilot": "^0.0.7",
|
|
122
126
|
"dotenv": "^16.5.0",
|
|
123
127
|
"dsn-converter": "^0.0.60",
|
|
124
|
-
"easyeda": "^0.0.
|
|
128
|
+
"easyeda": "^0.0.228",
|
|
125
129
|
"embla-carousel-react": "^8.3.0",
|
|
126
130
|
"extract-codefence": "^0.0.4",
|
|
127
131
|
"fflate": "^0.8.2",
|
|
128
132
|
"file-saver": "^2.0.5",
|
|
133
|
+
"fuse.js": "^7.1.0",
|
|
129
134
|
"get-port": "^7.1.0",
|
|
130
135
|
"globals": "^15.9.0",
|
|
131
136
|
"he": "^1.2.0",
|
|
@@ -136,6 +141,7 @@
|
|
|
136
141
|
"jscad-electronics": "^0.0.25",
|
|
137
142
|
"jszip": "^3.10.1",
|
|
138
143
|
"kicad-converter": "^0.0.17",
|
|
144
|
+
"kicadts": "^0.0.9",
|
|
139
145
|
"ky": "^1.7.5",
|
|
140
146
|
"lucide-react": "^0.488.0",
|
|
141
147
|
"lz-string": "^1.5.0",
|
|
@@ -143,14 +149,13 @@
|
|
|
143
149
|
"md5": "^2.3.0",
|
|
144
150
|
"ms": "^2.1.3",
|
|
145
151
|
"next-themes": "^0.3.0",
|
|
146
|
-
"openai": "^5.6.0",
|
|
147
152
|
"postcss": "^8.4.47",
|
|
148
153
|
"posthog-js": "^1.203.2",
|
|
149
154
|
"prompts": "^2.4.2",
|
|
150
|
-
"react": "^
|
|
155
|
+
"react": "^19.1.1",
|
|
151
156
|
"react-cookie-consent": "^9.0.0",
|
|
152
157
|
"react-day-picker": "8.10.1",
|
|
153
|
-
"react-dom": "^
|
|
158
|
+
"react-dom": "^19.1.1",
|
|
154
159
|
"react-error-boundary": "^6.0.0",
|
|
155
160
|
"react-helmet": "^6.1.0",
|
|
156
161
|
"react-helmet-async": "^2.0.5",
|
|
@@ -164,20 +169,21 @@
|
|
|
164
169
|
"redaxios": "^0.5.1",
|
|
165
170
|
"remark-gfm": "^4.0.1",
|
|
166
171
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
167
|
-
"schematic-symbols": "^0.0.
|
|
172
|
+
"schematic-symbols": "^0.0.202",
|
|
168
173
|
"sharp": "^0.33.5",
|
|
169
174
|
"shiki": "^3.2.1",
|
|
170
175
|
"sitemap": "^8.0.0",
|
|
171
176
|
"sonner": "^1.5.0",
|
|
172
177
|
"states-us": "^1.1.1",
|
|
178
|
+
"stepts": "^0.0.1",
|
|
173
179
|
"svgo": "^4.0.0",
|
|
174
180
|
"tailwind-merge": "^2.5.2",
|
|
175
181
|
"tailwindcss": "^3.4.13",
|
|
176
182
|
"tailwindcss-animate": "^1.0.7",
|
|
177
183
|
"terser": "^5.27.0",
|
|
178
|
-
"three": "
|
|
184
|
+
"three": "0.165.0",
|
|
179
185
|
"three-stdlib": "^2.36.0",
|
|
180
|
-
"tscircuit": "^0.0.
|
|
186
|
+
"tscircuit": "^0.0.653",
|
|
181
187
|
"tsup": "^8.5.0",
|
|
182
188
|
"typescript": "^5.6.3",
|
|
183
189
|
"use-async-memo": "^1.2.5",
|
package/renovate.json
CHANGED
|
@@ -20,7 +20,7 @@ const staticRoutes = [
|
|
|
20
20
|
async function fetchTrendingSnippets() {
|
|
21
21
|
try {
|
|
22
22
|
const response = await fetch(
|
|
23
|
-
"https://
|
|
23
|
+
"https://api.tscircuit.com/snippets/list_trending",
|
|
24
24
|
{
|
|
25
25
|
headers: {
|
|
26
26
|
Accept: "application/json",
|
package/src/App.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import React from "react"
|
|
|
6
6
|
import { ReloadIcon } from "@radix-ui/react-icons"
|
|
7
7
|
import { Loader2 } from "lucide-react"
|
|
8
8
|
|
|
9
|
-
const FullPageLoader = () => (
|
|
9
|
+
export const FullPageLoader = () => (
|
|
10
10
|
<div className="fixed inset-0 flex items-center justify-center bg-white z-50">
|
|
11
11
|
<div className="w-48">
|
|
12
12
|
<div className="loading">
|
|
@@ -64,10 +64,12 @@ const MyOrdersPage = lazyImport(() => import("@/pages/my-orders"))
|
|
|
64
64
|
const LatestPage = lazyImport(() => import("@/pages/latest"))
|
|
65
65
|
const QuickstartPage = lazyImport(() => import("@/pages/quickstart"))
|
|
66
66
|
const SearchPage = lazyImport(() => import("@/pages/search"))
|
|
67
|
-
const
|
|
67
|
+
const CreateOrganizationPage = lazyImport(
|
|
68
|
+
() => import("@/pages/create-organization"),
|
|
69
|
+
)
|
|
70
|
+
const ProfileRouter = lazyImport(() => import("@/components/ProfileRouter"))
|
|
68
71
|
const DevLoginPage = lazyImport(() => import("@/pages/dev-login"))
|
|
69
72
|
const ViewPackagePage = lazyImport(() => import("@/pages/view-package"))
|
|
70
|
-
const PackageBuildsPage = lazyImport(() => import("@/pages/package-builds"))
|
|
71
73
|
const TrendingPage = lazyImport(() => import("@/pages/trending"))
|
|
72
74
|
const DatasheetPage = lazyImport(() => import("@/pages/datasheet"))
|
|
73
75
|
const DatasheetsPage = lazyImport(() => import("@/pages/datasheets"))
|
|
@@ -82,6 +84,10 @@ const ReleasesPage = lazyImport(() => import("@/pages/releases"))
|
|
|
82
84
|
const ReleaseDetailPage = lazyImport(() => import("@/pages/release-detail"))
|
|
83
85
|
const ReleaseBuildsPage = lazyImport(() => import("@/pages/release-builds"))
|
|
84
86
|
const ReleasePreviewPage = lazyImport(() => import("@/pages/preview-release"))
|
|
87
|
+
const OrganizationSettingsPage = lazyImport(
|
|
88
|
+
() => import("@/pages/organization-settings"),
|
|
89
|
+
)
|
|
90
|
+
const UserSettingsPage = lazyImport(() => import("@/pages/user-settings"))
|
|
85
91
|
|
|
86
92
|
class ErrorBoundary extends React.Component<
|
|
87
93
|
{ children: React.ReactNode },
|
|
@@ -258,7 +264,23 @@ function App() {
|
|
|
258
264
|
<Route path="/authorize" component={AuthenticatePage} />
|
|
259
265
|
<Route path="/my-orders" component={MyOrdersPage} />
|
|
260
266
|
<Route path="/dev-login" component={DevLoginPage} />
|
|
261
|
-
|
|
267
|
+
|
|
268
|
+
{/* Organization creation route */}
|
|
269
|
+
<Route path="/orgs/new" component={CreateOrganizationPage} />
|
|
270
|
+
|
|
271
|
+
{/* User settings */}
|
|
272
|
+
<Route path="/settings" component={UserSettingsPage} />
|
|
273
|
+
|
|
274
|
+
{/* Organization settings route */}
|
|
275
|
+
<Route
|
|
276
|
+
path="/:orgname/settings"
|
|
277
|
+
component={OrganizationSettingsPage}
|
|
278
|
+
/>
|
|
279
|
+
|
|
280
|
+
{/* Profile fallback route - handles both organizations and users */}
|
|
281
|
+
<Route path="/:username" component={ProfileRouter} />
|
|
282
|
+
|
|
283
|
+
{/* Package-related routes - must come after profile fallback */}
|
|
262
284
|
<Route
|
|
263
285
|
path="/:author/:packageName/releases/:releaseId/builds"
|
|
264
286
|
component={ReleaseBuildsPage}
|
|
@@ -280,10 +302,7 @@ function App() {
|
|
|
280
302
|
component={ReleasesPage}
|
|
281
303
|
/>
|
|
282
304
|
<Route path="/:author/:packageName" component={ViewPackagePage} />
|
|
283
|
-
|
|
284
|
-
path="/:author/:packageName/builds"
|
|
285
|
-
component={PackageBuildsPage}
|
|
286
|
-
/>
|
|
305
|
+
{/* 404 fallback */}
|
|
287
306
|
<Route component={lazyImport(() => import("@/pages/404"))} />
|
|
288
307
|
</Switch>
|
|
289
308
|
</Suspense>
|
package/src/ContextProviders.tsx
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
MutationCache,
|
|
3
|
+
QueryCache,
|
|
4
|
+
QueryClient,
|
|
5
|
+
QueryClientProvider,
|
|
6
|
+
} from "react-query"
|
|
2
7
|
import { HelmetProvider } from "react-helmet-async"
|
|
3
8
|
import { useEffect } from "react"
|
|
4
9
|
import { useGlobalStore } from "./hooks/use-global-store"
|
|
5
10
|
import { posthog } from "./lib/posthog"
|
|
6
11
|
import { Toaster } from "react-hot-toast"
|
|
7
12
|
import { populateQueryCacheWithSSRData } from "./lib/populate-query-cache-with-ssr-data"
|
|
13
|
+
import { trackReactQueryApiFailure } from "./lib/react-query-api-failure-tracking"
|
|
8
14
|
|
|
9
15
|
const staffGithubUsernames = [
|
|
10
16
|
"imrishabh18",
|
|
@@ -13,7 +19,24 @@ const staffGithubUsernames = [
|
|
|
13
19
|
...(import.meta.env.VITE_STAFF_GITHUB_USERNAMES?.split(",") || []),
|
|
14
20
|
]
|
|
15
21
|
|
|
16
|
-
const queryClient = new QueryClient(
|
|
22
|
+
const queryClient = new QueryClient({
|
|
23
|
+
queryCache: new QueryCache({
|
|
24
|
+
onError: (error, query) => {
|
|
25
|
+
trackReactQueryApiFailure(error, {
|
|
26
|
+
operationType: "query",
|
|
27
|
+
queryKey: query.queryKey,
|
|
28
|
+
})
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
mutationCache: new MutationCache({
|
|
32
|
+
onError: (error, _variables, _context, mutation) => {
|
|
33
|
+
trackReactQueryApiFailure(error, {
|
|
34
|
+
operationType: "mutation",
|
|
35
|
+
mutationKey: mutation.options?.mutationKey,
|
|
36
|
+
})
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
})
|
|
17
40
|
populateQueryCacheWithSSRData(queryClient)
|
|
18
41
|
|
|
19
42
|
const isInternalGithubUser = (githubUsername?: string | null) => {
|
|
@@ -123,7 +123,7 @@ export function CircuitJsonImportDialog({
|
|
|
123
123
|
const tscircuitComponentContent = convertCircuitJsonToTscircuit(
|
|
124
124
|
importedCircuitJson as any,
|
|
125
125
|
{
|
|
126
|
-
componentName: "
|
|
126
|
+
componentName: "Component",
|
|
127
127
|
},
|
|
128
128
|
)
|
|
129
129
|
console.info(tscircuitComponentContent)
|