@tscircuit/fake-snippets 0.0.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.
Files changed (396) hide show
  1. package/.github/CODEOWNERS +1 -0
  2. package/.github/workflows/bun-formatcheck.yml +26 -0
  3. package/.github/workflows/bun-test.yml +28 -0
  4. package/.github/workflows/bun-typecheck.yml +26 -0
  5. package/.github/workflows/bundle-size-analysis.yml +79 -0
  6. package/.github/workflows/playwright-test.yml +37 -0
  7. package/.github/workflows/stale.yml +40 -0
  8. package/.github/workflows/update-snapshots.yml +49 -0
  9. package/CONTRIBUTING.md +59 -0
  10. package/LICENSE +21 -0
  11. package/README.md +113 -0
  12. package/biome.json +60 -0
  13. package/bun-tests/fake-snippets-api/fixtures/get-circuit-json.ts +148 -0
  14. package/bun-tests/fake-snippets-api/fixtures/get-test-server.ts +96 -0
  15. package/bun-tests/fake-snippets-api/fixtures/start-server.ts +44 -0
  16. package/bun-tests/fake-snippets-api/routes/accounts/get_account_balance.test.ts +18 -0
  17. package/bun-tests/fake-snippets-api/routes/health.test.ts +9 -0
  18. package/bun-tests/fake-snippets-api/routes/order_files/get.test.ts +48 -0
  19. package/bun-tests/fake-snippets-api/routes/order_files/upload.test.ts +77 -0
  20. package/bun-tests/fake-snippets-api/routes/orders/create.test.ts +19 -0
  21. package/bun-tests/fake-snippets-api/routes/orders/get.test.ts +38 -0
  22. package/bun-tests/fake-snippets-api/routes/orders/list.test.ts +30 -0
  23. package/bun-tests/fake-snippets-api/routes/orders/update.test.ts +46 -0
  24. package/bun-tests/fake-snippets-api/routes/snippets/add_star.test.ts +114 -0
  25. package/bun-tests/fake-snippets-api/routes/snippets/create.test.ts +28 -0
  26. package/bun-tests/fake-snippets-api/routes/snippets/delete.test.ts +106 -0
  27. package/bun-tests/fake-snippets-api/routes/snippets/download.test.ts +90 -0
  28. package/bun-tests/fake-snippets-api/routes/snippets/generate_from_jlcpcb.test.ts +25 -0
  29. package/bun-tests/fake-snippets-api/routes/snippets/get_image.test.ts +113 -0
  30. package/bun-tests/fake-snippets-api/routes/snippets/images.test.ts +112 -0
  31. package/bun-tests/fake-snippets-api/routes/snippets/list.test.ts +62 -0
  32. package/bun-tests/fake-snippets-api/routes/snippets/list_newest.test.ts +48 -0
  33. package/bun-tests/fake-snippets-api/routes/snippets/list_trending.test.ts +69 -0
  34. package/bun-tests/fake-snippets-api/routes/snippets/remove_star.test.ts +110 -0
  35. package/bun-tests/fake-snippets-api/routes/snippets/search.test.ts +75 -0
  36. package/bun-tests/fake-snippets-api/routes/snippets/star-count.test.ts +44 -0
  37. package/bun-tests/fake-snippets-api/routes/snippets/update.test.ts +116 -0
  38. package/bun-tests/parts-engine.test.ts +18 -0
  39. package/bun.lockb +0 -0
  40. package/bunfig.toml +2 -0
  41. package/components.json +20 -0
  42. package/dist/assets/editor_example_1-1000w.webp +0 -0
  43. package/dist/assets/editor_example_1-1200w.webp +0 -0
  44. package/dist/assets/editor_example_1-1600w.webp +0 -0
  45. package/dist/assets/editor_example_1-2000w.webp +0 -0
  46. package/dist/assets/editor_example_1-400w.webp +0 -0
  47. package/dist/assets/editor_example_1-600w.webp +0 -0
  48. package/dist/assets/editor_example_1-800w.webp +0 -0
  49. package/dist/assets/editor_example_1_more_square-1000w.webp +0 -0
  50. package/dist/assets/editor_example_1_more_square-1200w.webp +0 -0
  51. package/dist/assets/editor_example_1_more_square-1600w.webp +0 -0
  52. package/dist/assets/editor_example_1_more_square-2000w.webp +0 -0
  53. package/dist/assets/editor_example_1_more_square-400w.webp +0 -0
  54. package/dist/assets/editor_example_1_more_square-600w.webp +0 -0
  55. package/dist/assets/editor_example_1_more_square-800w.webp +0 -0
  56. package/dist/assets/editor_example_2-1000w.webp +0 -0
  57. package/dist/assets/editor_example_2-1200w.webp +0 -0
  58. package/dist/assets/editor_example_2-1600w.webp +0 -0
  59. package/dist/assets/editor_example_2-2000w.webp +0 -0
  60. package/dist/assets/editor_example_2-400w.webp +0 -0
  61. package/dist/assets/editor_example_2-600w.webp +0 -0
  62. package/dist/assets/editor_example_2-800w.webp +0 -0
  63. package/dist/assets/example_schematic-1000w.webp +0 -0
  64. package/dist/assets/example_schematic-1200w.webp +0 -0
  65. package/dist/assets/example_schematic-1600w.webp +0 -0
  66. package/dist/assets/example_schematic-2000w.webp +0 -0
  67. package/dist/assets/example_schematic-400w.webp +0 -0
  68. package/dist/assets/example_schematic-600w.webp +0 -0
  69. package/dist/assets/example_schematic-800w.webp +0 -0
  70. package/dist/bundle.js +3270 -0
  71. package/dist/robots.txt +9 -0
  72. package/dist/sitemap.xml +118 -0
  73. package/docs/CIRCUIT_JSON_SOURCE_COMPONENT_OVERVIEW.md +151 -0
  74. package/fake-snippets-api/README.md +6 -0
  75. package/fake-snippets-api/biome.json +47 -0
  76. package/fake-snippets-api/bun.lockb +0 -0
  77. package/fake-snippets-api/lib/db/autoload-dev-snippets.ts +84 -0
  78. package/fake-snippets-api/lib/db/autoload-snippets.json +24 -0
  79. package/fake-snippets-api/lib/db/db-client.ts +343 -0
  80. package/fake-snippets-api/lib/db/schema.ts +112 -0
  81. package/fake-snippets-api/lib/db/seed.ts +1608 -0
  82. package/fake-snippets-api/lib/middleware/with-ctx-error.ts +26 -0
  83. package/fake-snippets-api/lib/middleware/with-db.ts +15 -0
  84. package/fake-snippets-api/lib/middleware/with-error-handling.ts +24 -0
  85. package/fake-snippets-api/lib/middleware/with-optional-session-auth.ts +34 -0
  86. package/fake-snippets-api/lib/middleware/with-request-logging.ts +54 -0
  87. package/fake-snippets-api/lib/middleware/with-session-auth.ts +39 -0
  88. package/fake-snippets-api/lib/middleware/with-winter-spec.ts +24 -0
  89. package/fake-snippets-api/next-env.d.ts +5 -0
  90. package/fake-snippets-api/routes/api/accounts/get.ts +21 -0
  91. package/fake-snippets-api/routes/api/accounts/get_account_balance.ts +22 -0
  92. package/fake-snippets-api/routes/api/accounts/update.ts +32 -0
  93. package/fake-snippets-api/routes/api/ai/[...anyroute].ts +31 -0
  94. package/fake-snippets-api/routes/api/ai.ts +2 -0
  95. package/fake-snippets-api/routes/api/aistream/[...anyroute].ts +65 -0
  96. package/fake-snippets-api/routes/api/health.ts +9 -0
  97. package/fake-snippets-api/routes/api/internal/sessions/create_without_auth.ts +63 -0
  98. package/fake-snippets-api/routes/api/order_files/get.ts +28 -0
  99. package/fake-snippets-api/routes/api/order_files/upload.ts +43 -0
  100. package/fake-snippets-api/routes/api/orders/create.ts +41 -0
  101. package/fake-snippets-api/routes/api/orders/get.ts +28 -0
  102. package/fake-snippets-api/routes/api/orders/list.ts +15 -0
  103. package/fake-snippets-api/routes/api/orders/update.ts +50 -0
  104. package/fake-snippets-api/routes/api/snippets/add_star.ts +42 -0
  105. package/fake-snippets-api/routes/api/snippets/create.ts +55 -0
  106. package/fake-snippets-api/routes/api/snippets/delete.ts +41 -0
  107. package/fake-snippets-api/routes/api/snippets/download.ts +148 -0
  108. package/fake-snippets-api/routes/api/snippets/generate_from_jlcpcb.ts +55 -0
  109. package/fake-snippets-api/routes/api/snippets/get.ts +50 -0
  110. package/fake-snippets-api/routes/api/snippets/get_image.ts +65 -0
  111. package/fake-snippets-api/routes/api/snippets/images/[author]/[snippet_name]/[typeFormat].ts +74 -0
  112. package/fake-snippets-api/routes/api/snippets/list.ts +28 -0
  113. package/fake-snippets-api/routes/api/snippets/list_newest.ts +13 -0
  114. package/fake-snippets-api/routes/api/snippets/list_trending.ts +21 -0
  115. package/fake-snippets-api/routes/api/snippets/remove_star.ts +42 -0
  116. package/fake-snippets-api/routes/api/snippets/search.ts +18 -0
  117. package/fake-snippets-api/routes/api/snippets/update.ts +86 -0
  118. package/favicon.ico +0 -0
  119. package/index.html +23 -0
  120. package/landing.html +23 -0
  121. package/package.json +164 -0
  122. package/playwright-tests/ai-page.spec.ts +19 -0
  123. package/playwright-tests/cmd-click.spec.ts +43 -0
  124. package/playwright-tests/dashboard-page.spec.ts +10 -0
  125. package/playwright-tests/editor-page.spec.ts +15 -0
  126. package/playwright-tests/files-dialog.spec.ts +19 -0
  127. package/playwright-tests/footprint-dialog/footprint-dialog.spec.ts +27 -0
  128. package/playwright-tests/footprint-dialog/footprint-insertion.spec.ts +38 -0
  129. package/playwright-tests/footprint-dialog/footprint-preview.spec.ts +34 -0
  130. package/playwright-tests/footprint-dialog/footprint-selection.spec.ts +29 -0
  131. package/playwright-tests/handle-manual-edits.spec.ts +55 -0
  132. package/playwright-tests/home-page.spec.ts +10 -0
  133. package/playwright-tests/images.spec.ts +17 -0
  134. package/playwright-tests/manual-edits.spec.ts +89 -0
  135. package/playwright-tests/preview-page.spec.ts +14 -0
  136. package/playwright-tests/quickstart-page.spec.ts +10 -0
  137. package/playwright-tests/search-links.spec.ts +21 -0
  138. package/playwright-tests/search.spec.ts +27 -0
  139. package/playwright-tests/snapshots/ai-page.spec.ts-AI-Page-lg.png +0 -0
  140. package/playwright-tests/snapshots/ai-page.spec.ts-AI-Page-md.png +0 -0
  141. package/playwright-tests/snapshots/ai-page.spec.ts-AI-Page-xs.png +0 -0
  142. package/playwright-tests/snapshots/cmd-click.spec.ts-underlined-imports.png +0 -0
  143. package/playwright-tests/snapshots/dashboard-page.spec.ts-Dashboard-page-lg.png +0 -0
  144. package/playwright-tests/snapshots/dashboard-page.spec.ts-Dashboard-page-md.png +0 -0
  145. package/playwright-tests/snapshots/dashboard-page.spec.ts-Dashboard-page-xs.png +0 -0
  146. package/playwright-tests/snapshots/editor-page.spec.ts-editor-with-snippet.png +0 -0
  147. package/playwright-tests/snapshots/error-fallback.spec.ts-error-fallback-lg.png +0 -0
  148. package/playwright-tests/snapshots/error-fallback.spec.ts-error-fallback-md.png +0 -0
  149. package/playwright-tests/snapshots/error-fallback.spec.ts-error-fallback-xs.png +0 -0
  150. package/playwright-tests/snapshots/files-dialog.spec.ts-view-snippet-files.png +0 -0
  151. package/playwright-tests/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-lg.png +0 -0
  152. package/playwright-tests/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-md.png +0 -0
  153. package/playwright-tests/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-xs.png +0 -0
  154. package/playwright-tests/snapshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-lg.png +0 -0
  155. package/playwright-tests/snapshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-md.png +0 -0
  156. package/playwright-tests/snapshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-xs.png +0 -0
  157. package/playwright-tests/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-lg.png +0 -0
  158. package/playwright-tests/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-md.png +0 -0
  159. package/playwright-tests/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-xs.png +0 -0
  160. package/playwright-tests/snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-lg.png +0 -0
  161. package/playwright-tests/snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-md.png +0 -0
  162. package/playwright-tests/snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-xs.png +0 -0
  163. package/playwright-tests/snapshots/handle-manual-edits.spec.ts-handle-manual-edits.png +0 -0
  164. package/playwright-tests/snapshots/home-page.spec.ts-Home-page-lg.png +0 -0
  165. package/playwright-tests/snapshots/home-page.spec.ts-Home-page-md.png +0 -0
  166. package/playwright-tests/snapshots/home-page.spec.ts-Home-page-xs.png +0 -0
  167. package/playwright-tests/snapshots/images.spec.ts-pcb-image.png +0 -0
  168. package/playwright-tests/snapshots/images.spec.ts-schematic-image.png +0 -0
  169. package/playwright-tests/snapshots/manual-edits.spec.ts-editor-manual-edits.png +0 -0
  170. package/playwright-tests/snapshots/manual-edits.spec.ts-manual-edits-view.png +0 -0
  171. package/playwright-tests/snapshots/preview-page.spec.ts-preview-snippet-pcb.png +0 -0
  172. package/playwright-tests/snapshots/preview-page.spec.ts-preview-snippet-schematic.png +0 -0
  173. package/playwright-tests/snapshots/quickstart-page.spec.ts-Quickstart-Pagelg.png +0 -0
  174. package/playwright-tests/snapshots/quickstart-page.spec.ts-Quickstart-Pagemd.png +0 -0
  175. package/playwright-tests/snapshots/quickstart-page.spec.ts-Quickstart-Pagexs.png +0 -0
  176. package/playwright-tests/snapshots/search-links.spec.ts-search-links.png +0 -0
  177. package/playwright-tests/snapshots/search.spec.ts-search-lg.png +0 -0
  178. package/playwright-tests/snapshots/search.spec.ts-search-md.png +0 -0
  179. package/playwright-tests/snapshots/search.spec.ts-search-xs.png +0 -0
  180. package/playwright-tests/snapshots/star.spec.ts-remove-star-button.png +0 -0
  181. package/playwright-tests/snapshots/star.spec.ts-star-button.png +0 -0
  182. package/playwright-tests/snapshots/update-description.spec.ts-update-description.png +0 -0
  183. package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-after-lg.png +0 -0
  184. package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-after-md.png +0 -0
  185. package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-after-xs.png +0 -0
  186. package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-before-lg.png +0 -0
  187. package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-before-md.png +0 -0
  188. package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-before-xs.png +0 -0
  189. package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-files.png +0 -0
  190. package/playwright-tests/star.spec.ts +40 -0
  191. package/playwright-tests/update-description.spec.ts +18 -0
  192. package/playwright-tests/view-snippet.spec.ts +35 -0
  193. package/playwright-tests/viewports.ts +5 -0
  194. package/playwright.config.ts +27 -0
  195. package/postcss.config.js +6 -0
  196. package/public/robots.txt +9 -0
  197. package/renovate.json +24 -0
  198. package/scripts/generate-image-sizes.ts +58 -0
  199. package/scripts/generate-sitemap.ts +103 -0
  200. package/scripts/generate_bundle_stats.js +192 -0
  201. package/scripts/snapshot.ts +35 -0
  202. package/src/App.tsx +113 -0
  203. package/src/ContextProviders.tsx +9 -0
  204. package/src/assets/originals/editor_example_1.webp +0 -0
  205. package/src/assets/originals/editor_example_1_more_square.webp +0 -0
  206. package/src/assets/originals/editor_example_2.webp +0 -0
  207. package/src/assets/originals/example_schematic.webp +0 -0
  208. package/src/components/AiChatInterface.tsx +221 -0
  209. package/src/components/AiChatMessage.tsx +86 -0
  210. package/src/components/Analytics.tsx +30 -0
  211. package/src/components/BomTable.tsx +69 -0
  212. package/src/components/ChatInput.tsx +53 -0
  213. package/src/components/CircuitToSvgWithMouseControl.tsx +78 -0
  214. package/src/components/CmdKMenu.tsx +301 -0
  215. package/src/components/CodeAndPreview.tsx +258 -0
  216. package/src/components/CodeEditor.tsx +460 -0
  217. package/src/components/CodeEditorHeader.tsx +160 -0
  218. package/src/components/CreateNewSnippetWithAiHero.tsx +77 -0
  219. package/src/components/DownloadButtonAndMenu.tsx +212 -0
  220. package/src/components/EditorNav.tsx +428 -0
  221. package/src/components/ErrorFallback.tsx +25 -0
  222. package/src/components/ErrorTabContent.tsx +122 -0
  223. package/src/components/FAQ.tsx +113 -0
  224. package/src/components/Footer.tsx +134 -0
  225. package/src/components/Footer2.tsx +100 -0
  226. package/src/components/FootprintDialog.tsx +342 -0
  227. package/src/components/Header.tsx +187 -0
  228. package/src/components/Header2.tsx +135 -0
  229. package/src/components/HeaderDropdown.tsx +83 -0
  230. package/src/components/HeaderLogin.tsx +94 -0
  231. package/src/components/JLCPCBImportDialog.tsx +155 -0
  232. package/src/components/LandingHero.tsx +175 -0
  233. package/src/components/LatestSnippets.tsx +39 -0
  234. package/src/components/OptimizedImage.tsx +96 -0
  235. package/src/components/OrderPreviewContent.tsx +61 -0
  236. package/src/components/ParametersEditor.tsx +140 -0
  237. package/src/components/PcbViewerWithContainerHeight.tsx +47 -0
  238. package/src/components/PrefetchPageLink.tsx +45 -0
  239. package/src/components/PreviewContent.tsx +375 -0
  240. package/src/components/PreviewEmptyState.tsx +16 -0
  241. package/src/components/RunButton.tsx +27 -0
  242. package/src/components/SearchComponent.tsx +163 -0
  243. package/src/components/ShippingInformationForm.tsx +423 -0
  244. package/src/components/SnippetLink.tsx +37 -0
  245. package/src/components/StaticPreviewContent.tsx +89 -0
  246. package/src/components/StaticViewSnippetHeader.tsx +70 -0
  247. package/src/components/StaticViewSnippetSidebar.tsx +100 -0
  248. package/src/components/TableViewer/CircuitJsonTableViewer.tsx +316 -0
  249. package/src/components/TableViewer/ClickableText.tsx +21 -0
  250. package/src/components/TableViewer/HeaderCell.tsx +27 -0
  251. package/src/components/TableViewer/Modal.tsx +39 -0
  252. package/src/components/TrendingSnippetCarousel.tsx +77 -0
  253. package/src/components/TypeBadge.tsx +31 -0
  254. package/src/components/ViewSnippetHeader.tsx +144 -0
  255. package/src/components/ViewSnippetSidebar.tsx +162 -0
  256. package/src/components/dialogs/confirm-delete-snippet-dialog.tsx +80 -0
  257. package/src/components/dialogs/create-order-dialog.tsx +146 -0
  258. package/src/components/dialogs/create-use-dialog.tsx +34 -0
  259. package/src/components/dialogs/edit-description-dialog.tsx +96 -0
  260. package/src/components/dialogs/files-dialog.tsx +70 -0
  261. package/src/components/dialogs/import-snippet-dialog.tsx +84 -0
  262. package/src/components/dialogs/rename-snippet-dialog.tsx +81 -0
  263. package/src/components/dialogs/view-ts-files-dialog.tsx +89 -0
  264. package/src/components/ui/accordion.tsx +55 -0
  265. package/src/components/ui/alert-dialog.tsx +139 -0
  266. package/src/components/ui/alert.tsx +59 -0
  267. package/src/components/ui/aspect-ratio.tsx +5 -0
  268. package/src/components/ui/avatar.tsx +48 -0
  269. package/src/components/ui/badge.tsx +36 -0
  270. package/src/components/ui/breadcrumb.tsx +118 -0
  271. package/src/components/ui/button.tsx +58 -0
  272. package/src/components/ui/calendar.tsx +73 -0
  273. package/src/components/ui/card.tsx +76 -0
  274. package/src/components/ui/carousel.tsx +260 -0
  275. package/src/components/ui/chart.tsx +363 -0
  276. package/src/components/ui/checkbox.tsx +28 -0
  277. package/src/components/ui/collapsible.tsx +9 -0
  278. package/src/components/ui/combobox.tsx +178 -0
  279. package/src/components/ui/command.tsx +151 -0
  280. package/src/components/ui/context-menu.tsx +202 -0
  281. package/src/components/ui/dialog.tsx +120 -0
  282. package/src/components/ui/drawer.tsx +116 -0
  283. package/src/components/ui/dropdown-menu.tsx +203 -0
  284. package/src/components/ui/form.tsx +182 -0
  285. package/src/components/ui/hover-card.tsx +27 -0
  286. package/src/components/ui/input-otp.tsx +69 -0
  287. package/src/components/ui/input.tsx +25 -0
  288. package/src/components/ui/label.tsx +24 -0
  289. package/src/components/ui/menubar.tsx +238 -0
  290. package/src/components/ui/navigation-menu.tsx +129 -0
  291. package/src/components/ui/pagination.tsx +121 -0
  292. package/src/components/ui/popover.tsx +31 -0
  293. package/src/components/ui/progress.tsx +26 -0
  294. package/src/components/ui/radio-group.tsx +42 -0
  295. package/src/components/ui/resizable.tsx +43 -0
  296. package/src/components/ui/scroll-area.tsx +46 -0
  297. package/src/components/ui/searchable-select.tsx +94 -0
  298. package/src/components/ui/select.tsx +162 -0
  299. package/src/components/ui/separator.tsx +29 -0
  300. package/src/components/ui/sheet.tsx +141 -0
  301. package/src/components/ui/skeleton.tsx +18 -0
  302. package/src/components/ui/slider.tsx +26 -0
  303. package/src/components/ui/sonner.tsx +30 -0
  304. package/src/components/ui/switch.tsx +27 -0
  305. package/src/components/ui/table.tsx +120 -0
  306. package/src/components/ui/tabs.tsx +53 -0
  307. package/src/components/ui/textarea.tsx +24 -0
  308. package/src/components/ui/toast.tsx +128 -0
  309. package/src/components/ui/toaster.tsx +33 -0
  310. package/src/components/ui/toggle-group.tsx +59 -0
  311. package/src/components/ui/toggle.tsx +43 -0
  312. package/src/components/ui/tooltip.tsx +28 -0
  313. package/src/entry-server.tsx +12 -0
  314. package/src/hooks/use-account-balance.ts +24 -0
  315. package/src/hooks/use-ai-api.ts +35 -0
  316. package/src/hooks/use-axios.ts +20 -0
  317. package/src/hooks/use-code-completion-ai-api.ts +11 -0
  318. package/src/hooks/use-compiled-tsx.ts +37 -0
  319. package/src/hooks/use-copy-to-clipboard.ts +26 -0
  320. package/src/hooks/use-create-snippet-mutation.ts +62 -0
  321. package/src/hooks/use-current-snippet-id.ts +75 -0
  322. package/src/hooks/use-current-snippet.ts +24 -0
  323. package/src/hooks/use-global-store.ts +33 -0
  324. package/src/hooks/use-is-using-fake-api.ts +3 -0
  325. package/src/hooks/use-run-tsx/construct-circuit.tsx +64 -0
  326. package/src/hooks/use-run-tsx/eval-compiled-js.ts +9 -0
  327. package/src/hooks/use-run-tsx/index.tsx +251 -0
  328. package/src/hooks/use-save-snippet.ts +66 -0
  329. package/src/hooks/use-sign-in.ts +22 -0
  330. package/src/hooks/use-snippet-by-name.ts +25 -0
  331. package/src/hooks/use-snippet.ts +23 -0
  332. package/src/hooks/use-snippets-base-api-url.ts +3 -0
  333. package/src/hooks/use-toast.tsx +208 -0
  334. package/src/hooks/use-typecheck.ts +54 -0
  335. package/src/hooks/use-url-params.ts +31 -0
  336. package/src/hooks/use-warn-user-on-page-change.ts +23 -0
  337. package/src/hooks/useForkSnippetMutation.ts +52 -0
  338. package/src/index.css +21 -0
  339. package/src/lib/__tests__/constants.test.ts +66 -0
  340. package/src/lib/base64ToBytes.ts +5 -0
  341. package/src/lib/bytesToBase64.ts +4 -0
  342. package/src/lib/codemirror/basic-setup.ts +51 -0
  343. package/src/lib/constants.ts +12 -0
  344. package/src/lib/decodeUrlHashToText.ts +15 -0
  345. package/src/lib/defaultCodeForBlankCode.tsx +7 -0
  346. package/src/lib/download-fns/createBlobURL.ts +4 -0
  347. package/src/lib/download-fns/download-assembly-svg.ts +12 -0
  348. package/src/lib/download-fns/download-circuit-json-fn.ts +12 -0
  349. package/src/lib/download-fns/download-dsn-file-fn.ts +12 -0
  350. package/src/lib/download-fns/download-fabrication-files.ts +233 -0
  351. package/src/lib/download-fns/download-gltf.ts +49 -0
  352. package/src/lib/download-fns/download-kicad-files.ts +27 -0
  353. package/src/lib/download-fns/download-readable-netlist.ts +12 -0
  354. package/src/lib/download-fns/download-schematic-svg.ts +12 -0
  355. package/src/lib/download-fns/download-simple-route-json.ts +17 -0
  356. package/src/lib/encodeTextToUrlHash.ts +17 -0
  357. package/src/lib/get-snippet-template.ts +26 -0
  358. package/src/lib/handleManualEditsImport.tsx +65 -0
  359. package/src/lib/jlc-parts-engine.ts +69 -0
  360. package/src/lib/templates/blank-3d-model-template.ts +12 -0
  361. package/src/lib/templates/blank-circuit-board-template.ts +24 -0
  362. package/src/lib/templates/blank-footprint-template.ts +29 -0
  363. package/src/lib/templates/blank-package-template.ts +22 -0
  364. package/src/lib/templates/blinking-led-board-template.ts +63 -0
  365. package/src/lib/templates/manual-edits-template.ts +5 -0
  366. package/src/lib/templates/usb-c-led-flashlight-template.ts +22 -0
  367. package/src/lib/utils/checkIfManualEditsImported.ts +6 -0
  368. package/src/lib/utils/getSyntaxError.ts +13 -0
  369. package/src/lib/utils/index.ts +6 -0
  370. package/src/lib/utils/load-prettier.ts +18 -0
  371. package/src/lib/utils/parseFootprintParams.ts +52 -0
  372. package/src/lib/utils/parseJsonOrNull.ts +8 -0
  373. package/src/lib/utils/pcbManualEditEventHandler.ts +156 -0
  374. package/src/main.tsx +10 -0
  375. package/src/pages/ai.tsx +92 -0
  376. package/src/pages/authorize.tsx +54 -0
  377. package/src/pages/dashboard.tsx +165 -0
  378. package/src/pages/dev-login.tsx +68 -0
  379. package/src/pages/editor.tsx +28 -0
  380. package/src/pages/landing.tsx +236 -0
  381. package/src/pages/my-orders.tsx +54 -0
  382. package/src/pages/newest.tsx +16 -0
  383. package/src/pages/preview.tsx +70 -0
  384. package/src/pages/quickstart.tsx +198 -0
  385. package/src/pages/search.tsx +26 -0
  386. package/src/pages/settings.tsx +25 -0
  387. package/src/pages/user-profile.tsx +97 -0
  388. package/src/pages/view-order.tsx +123 -0
  389. package/src/pages/view-snippet.tsx +149 -0
  390. package/src/prettier.ts +9 -0
  391. package/src/vite-env.d.ts +1 -0
  392. package/tailwind.config.js +47 -0
  393. package/tsconfig.json +30 -0
  394. package/vercel.json +50 -0
  395. package/vite.config.ts +146 -0
  396. package/winterspec.config.ts +6 -0
@@ -0,0 +1,1608 @@
1
+ import { DbClient } from "./db-client"
2
+ import { loadAutoloadSnippets } from "./autoload-dev-snippets"
3
+
4
+ export const seed = (db: DbClient) => {
5
+ const { account_id } = db.addAccount({
6
+ account_id: "account-1234",
7
+ github_username: "testuser",
8
+ shippingInfo: {
9
+ firstName: "Test",
10
+ lastName: "User",
11
+ companyName: "Test Company",
12
+ address: "123 Test St",
13
+ apartment: "Apt 4B",
14
+ city: "Testville",
15
+ state: "NY",
16
+ zipCode: "10001",
17
+ country: "United States of America",
18
+ phone: "555-123-4567",
19
+ },
20
+ })
21
+ db.addAccount({
22
+ github_username: "seveibar",
23
+ })
24
+
25
+ if (process.env.AUTOLOAD_SNIPPETS === "true") {
26
+ loadAutoloadSnippets(db)
27
+ }
28
+
29
+ db.addSnippet({
30
+ name: "testuser/my-test-board",
31
+ unscoped_name: "my-test-board",
32
+ owner_name: "testuser",
33
+ code: `
34
+ import { A555Timer } from "@tsci/seveibar.a555timer"
35
+
36
+ export default () => (
37
+ <board width="10mm" height="10mm">
38
+ <A555Timer name="U1" />
39
+ </board>
40
+ )`.trim(),
41
+ created_at: new Date().toISOString(),
42
+ updated_at: new Date().toISOString(),
43
+ snippet_type: "board",
44
+ description: "A simple board with an A555 Timer component",
45
+ circuit_json: [
46
+ {
47
+ type: "source_port",
48
+ source_port_id: "source_port_0",
49
+ name: "pin1",
50
+ pin_number: 1,
51
+ port_hints: ["pin1", "1"],
52
+ source_component_id: "source_component_0",
53
+ },
54
+ {
55
+ type: "source_port",
56
+ source_port_id: "source_port_1",
57
+ name: "pin2",
58
+ pin_number: 2,
59
+ port_hints: ["pin2", "2"],
60
+ source_component_id: "source_component_0",
61
+ },
62
+ {
63
+ type: "source_port",
64
+ source_port_id: "source_port_2",
65
+ name: "pin3",
66
+ pin_number: 3,
67
+ port_hints: ["pin3", "3"],
68
+ source_component_id: "source_component_0",
69
+ },
70
+ {
71
+ type: "source_port",
72
+ source_port_id: "source_port_3",
73
+ name: "pin4",
74
+ pin_number: 4,
75
+ port_hints: ["pin4", "4"],
76
+ source_component_id: "source_component_0",
77
+ },
78
+ {
79
+ type: "source_port",
80
+ source_port_id: "source_port_4",
81
+ name: "pin5",
82
+ pin_number: 5,
83
+ port_hints: ["pin5", "5"],
84
+ source_component_id: "source_component_0",
85
+ },
86
+ {
87
+ type: "source_port",
88
+ source_port_id: "source_port_5",
89
+ name: "pin6",
90
+ pin_number: 6,
91
+ port_hints: ["pin6", "6"],
92
+ source_component_id: "source_component_0",
93
+ },
94
+ {
95
+ type: "source_port",
96
+ source_port_id: "source_port_6",
97
+ name: "pin7",
98
+ pin_number: 7,
99
+ port_hints: ["pin7", "7"],
100
+ source_component_id: "source_component_0",
101
+ },
102
+ {
103
+ type: "source_port",
104
+ source_port_id: "source_port_7",
105
+ name: "pin8",
106
+ pin_number: 8,
107
+ port_hints: ["pin8", "8"],
108
+ source_component_id: "source_component_0",
109
+ },
110
+ {
111
+ type: "source_component",
112
+ source_component_id: "source_component_0",
113
+ ftype: "simple_chip",
114
+ name: "U1",
115
+ supplier_part_numbers: {},
116
+ },
117
+ {
118
+ type: "schematic_component",
119
+ schematic_component_id: "schematic_component_0",
120
+ center: {
121
+ x: 0,
122
+ y: 0,
123
+ },
124
+ rotation: 0,
125
+ size: {
126
+ width: 1.1,
127
+ height: 1,
128
+ },
129
+ pin_spacing: 0.2,
130
+ port_labels: {},
131
+ source_component_id: "source_component_0",
132
+ },
133
+ {
134
+ type: "schematic_port",
135
+ schematic_port_id: "schematic_port_0",
136
+ schematic_component_id: "schematic_component_0",
137
+ center: {
138
+ x: -0.9500000000000001,
139
+ y: 0.30000000000000004,
140
+ },
141
+ source_port_id: "source_port_0",
142
+ facing_direction: "left",
143
+ distance_from_component_edge: 0.4,
144
+ side_of_component: "left",
145
+ pin_number: 1,
146
+ true_ccw_index: 0,
147
+ },
148
+ {
149
+ type: "schematic_port",
150
+ schematic_port_id: "schematic_port_1",
151
+ schematic_component_id: "schematic_component_0",
152
+ center: {
153
+ x: -0.9500000000000001,
154
+ y: 0.10000000000000003,
155
+ },
156
+ source_port_id: "source_port_1",
157
+ facing_direction: "left",
158
+ distance_from_component_edge: 0.4,
159
+ side_of_component: "left",
160
+ pin_number: 2,
161
+ true_ccw_index: 1,
162
+ },
163
+ {
164
+ type: "schematic_port",
165
+ schematic_port_id: "schematic_port_2",
166
+ schematic_component_id: "schematic_component_0",
167
+ center: {
168
+ x: -0.9500000000000001,
169
+ y: -0.09999999999999998,
170
+ },
171
+ source_port_id: "source_port_2",
172
+ facing_direction: "left",
173
+ distance_from_component_edge: 0.4,
174
+ side_of_component: "left",
175
+ pin_number: 3,
176
+ true_ccw_index: 2,
177
+ },
178
+ {
179
+ type: "schematic_port",
180
+ schematic_port_id: "schematic_port_3",
181
+ schematic_component_id: "schematic_component_0",
182
+ center: {
183
+ x: -0.9500000000000001,
184
+ y: -0.30000000000000004,
185
+ },
186
+ source_port_id: "source_port_3",
187
+ facing_direction: "left",
188
+ distance_from_component_edge: 0.4,
189
+ side_of_component: "left",
190
+ pin_number: 4,
191
+ true_ccw_index: 3,
192
+ },
193
+ {
194
+ type: "schematic_port",
195
+ schematic_port_id: "schematic_port_4",
196
+ schematic_component_id: "schematic_component_0",
197
+ center: {
198
+ x: 0.9500000000000001,
199
+ y: -0.30000000000000004,
200
+ },
201
+ source_port_id: "source_port_4",
202
+ facing_direction: "right",
203
+ distance_from_component_edge: 0.4,
204
+ side_of_component: "right",
205
+ pin_number: 5,
206
+ true_ccw_index: 4,
207
+ },
208
+ {
209
+ type: "schematic_port",
210
+ schematic_port_id: "schematic_port_5",
211
+ schematic_component_id: "schematic_component_0",
212
+ center: {
213
+ x: 0.9500000000000001,
214
+ y: -0.10000000000000003,
215
+ },
216
+ source_port_id: "source_port_5",
217
+ facing_direction: "right",
218
+ distance_from_component_edge: 0.4,
219
+ side_of_component: "right",
220
+ pin_number: 6,
221
+ true_ccw_index: 5,
222
+ },
223
+ {
224
+ type: "schematic_port",
225
+ schematic_port_id: "schematic_port_6",
226
+ schematic_component_id: "schematic_component_0",
227
+ center: {
228
+ x: 0.9500000000000001,
229
+ y: 0.09999999999999998,
230
+ },
231
+ source_port_id: "source_port_6",
232
+ facing_direction: "right",
233
+ distance_from_component_edge: 0.4,
234
+ side_of_component: "right",
235
+ pin_number: 7,
236
+ true_ccw_index: 6,
237
+ },
238
+ {
239
+ type: "schematic_port",
240
+ schematic_port_id: "schematic_port_7",
241
+ schematic_component_id: "schematic_component_0",
242
+ center: {
243
+ x: 0.9500000000000001,
244
+ y: 0.30000000000000004,
245
+ },
246
+ source_port_id: "source_port_7",
247
+ facing_direction: "right",
248
+ distance_from_component_edge: 0.4,
249
+ side_of_component: "right",
250
+ pin_number: 8,
251
+ true_ccw_index: 7,
252
+ },
253
+ {
254
+ type: "pcb_component",
255
+ pcb_component_id: "pcb_component_0",
256
+ center: {
257
+ x: 0,
258
+ y: 0,
259
+ },
260
+ width: 8.82,
261
+ height: 8.82,
262
+ layer: "top",
263
+ rotation: 0,
264
+ source_component_id: "source_component_0",
265
+ },
266
+ {
267
+ type: "pcb_board",
268
+ pcb_board_id: "pcb_board_0",
269
+ center: {
270
+ x: 0,
271
+ y: 0,
272
+ },
273
+ thickness: 1.4,
274
+ num_layers: 4,
275
+ width: 10,
276
+ height: 10,
277
+ },
278
+ {
279
+ type: "pcb_plated_hole",
280
+ pcb_plated_hole_id: "pcb_plated_hole_0",
281
+ pcb_component_id: "pcb_component_0",
282
+ pcb_port_id: "pcb_port_0",
283
+ outer_diameter: 1.2,
284
+ hole_diameter: 1,
285
+ shape: "circle",
286
+ port_hints: ["1"],
287
+ x: -3.81,
288
+ y: 3.81,
289
+ layers: ["top", "bottom"],
290
+ },
291
+ {
292
+ type: "pcb_plated_hole",
293
+ pcb_plated_hole_id: "pcb_plated_hole_1",
294
+ pcb_component_id: "pcb_component_0",
295
+ pcb_port_id: "pcb_port_1",
296
+ outer_diameter: 1.2,
297
+ hole_diameter: 1,
298
+ shape: "circle",
299
+ port_hints: ["2"],
300
+ x: -3.81,
301
+ y: 1.27,
302
+ layers: ["top", "bottom"],
303
+ },
304
+ {
305
+ type: "pcb_plated_hole",
306
+ pcb_plated_hole_id: "pcb_plated_hole_2",
307
+ pcb_component_id: "pcb_component_0",
308
+ pcb_port_id: "pcb_port_2",
309
+ outer_diameter: 1.2,
310
+ hole_diameter: 1,
311
+ shape: "circle",
312
+ port_hints: ["3"],
313
+ x: -3.81,
314
+ y: -1.27,
315
+ layers: ["top", "bottom"],
316
+ },
317
+ {
318
+ type: "pcb_plated_hole",
319
+ pcb_plated_hole_id: "pcb_plated_hole_3",
320
+ pcb_component_id: "pcb_component_0",
321
+ pcb_port_id: "pcb_port_3",
322
+ outer_diameter: 1.2,
323
+ hole_diameter: 1,
324
+ shape: "circle",
325
+ port_hints: ["4"],
326
+ x: -3.81,
327
+ y: -3.81,
328
+ layers: ["top", "bottom"],
329
+ },
330
+ {
331
+ type: "pcb_plated_hole",
332
+ pcb_plated_hole_id: "pcb_plated_hole_4",
333
+ pcb_component_id: "pcb_component_0",
334
+ pcb_port_id: "pcb_port_4",
335
+ outer_diameter: 1.2,
336
+ hole_diameter: 1,
337
+ shape: "circle",
338
+ port_hints: ["5"],
339
+ x: 3.81,
340
+ y: -3.81,
341
+ layers: ["top", "bottom"],
342
+ },
343
+ {
344
+ type: "pcb_plated_hole",
345
+ pcb_plated_hole_id: "pcb_plated_hole_5",
346
+ pcb_component_id: "pcb_component_0",
347
+ pcb_port_id: "pcb_port_5",
348
+ outer_diameter: 1.2,
349
+ hole_diameter: 1,
350
+ shape: "circle",
351
+ port_hints: ["6"],
352
+ x: 3.81,
353
+ y: -1.27,
354
+ layers: ["top", "bottom"],
355
+ },
356
+ {
357
+ type: "pcb_plated_hole",
358
+ pcb_plated_hole_id: "pcb_plated_hole_6",
359
+ pcb_component_id: "pcb_component_0",
360
+ pcb_port_id: "pcb_port_6",
361
+ outer_diameter: 1.2,
362
+ hole_diameter: 1,
363
+ shape: "circle",
364
+ port_hints: ["7"],
365
+ x: 3.81,
366
+ y: 1.27,
367
+ layers: ["top", "bottom"],
368
+ },
369
+ {
370
+ type: "pcb_plated_hole",
371
+ pcb_plated_hole_id: "pcb_plated_hole_7",
372
+ pcb_component_id: "pcb_component_0",
373
+ pcb_port_id: "pcb_port_7",
374
+ outer_diameter: 1.2,
375
+ hole_diameter: 1,
376
+ shape: "circle",
377
+ port_hints: ["8"],
378
+ x: 3.81,
379
+ y: 3.81,
380
+ layers: ["top", "bottom"],
381
+ },
382
+ {
383
+ type: "pcb_silkscreen_path",
384
+ pcb_silkscreen_path_id: "pcb_silkscreen_path_0",
385
+ pcb_component_id: "pcb_component_0",
386
+ layer: "top",
387
+ route: [
388
+ {
389
+ x: -3.01,
390
+ y: -4.61,
391
+ },
392
+ {
393
+ x: -3.01,
394
+ y: 4.61,
395
+ },
396
+ {
397
+ x: -1.0033333333333332,
398
+ y: 4.61,
399
+ },
400
+ {
401
+ x: -0.9269591309529909,
402
+ y: 4.226040956193693,
403
+ },
404
+ {
405
+ x: -0.7094638037905026,
406
+ y: 3.9005361962094978,
407
+ },
408
+ {
409
+ x: -0.3839590438063067,
410
+ y: 3.6830408690470096,
411
+ },
412
+ {
413
+ x: 6.143644775722556e-17,
414
+ y: 3.6066666666666674,
415
+ },
416
+ {
417
+ x: 0.38395904380630674,
418
+ y: 3.6830408690470096,
419
+ },
420
+ {
421
+ x: 0.7094638037905027,
422
+ y: 3.9005361962094978,
423
+ },
424
+ {
425
+ x: 0.9269591309529909,
426
+ y: 4.226040956193693,
427
+ },
428
+ {
429
+ x: 1.0033333333333332,
430
+ y: 4.61,
431
+ },
432
+ {
433
+ x: 3.01,
434
+ y: 4.61,
435
+ },
436
+ {
437
+ x: 3.01,
438
+ y: -4.61,
439
+ },
440
+ {
441
+ x: -3.01,
442
+ y: -4.61,
443
+ },
444
+ ],
445
+ stroke_width: 0.1,
446
+ },
447
+ {
448
+ type: "pcb_port",
449
+ pcb_port_id: "pcb_port_0",
450
+ pcb_component_id: "pcb_component_0",
451
+ layers: ["top", "inner1", "inner2", "bottom"],
452
+ x: -3.81,
453
+ y: 3.81,
454
+ source_port_id: "source_port_0",
455
+ },
456
+ {
457
+ type: "pcb_port",
458
+ pcb_port_id: "pcb_port_1",
459
+ pcb_component_id: "pcb_component_0",
460
+ layers: ["top", "inner1", "inner2", "bottom"],
461
+ x: -3.81,
462
+ y: 1.27,
463
+ source_port_id: "source_port_1",
464
+ },
465
+ {
466
+ type: "pcb_port",
467
+ pcb_port_id: "pcb_port_2",
468
+ pcb_component_id: "pcb_component_0",
469
+ layers: ["top", "inner1", "inner2", "bottom"],
470
+ x: -3.81,
471
+ y: -1.27,
472
+ source_port_id: "source_port_2",
473
+ },
474
+ {
475
+ type: "pcb_port",
476
+ pcb_port_id: "pcb_port_3",
477
+ pcb_component_id: "pcb_component_0",
478
+ layers: ["top", "inner1", "inner2", "bottom"],
479
+ x: -3.81,
480
+ y: -3.81,
481
+ source_port_id: "source_port_3",
482
+ },
483
+ {
484
+ type: "pcb_port",
485
+ pcb_port_id: "pcb_port_4",
486
+ pcb_component_id: "pcb_component_0",
487
+ layers: ["top", "inner1", "inner2", "bottom"],
488
+ x: 3.81,
489
+ y: -3.81,
490
+ source_port_id: "source_port_4",
491
+ },
492
+ {
493
+ type: "pcb_port",
494
+ pcb_port_id: "pcb_port_5",
495
+ pcb_component_id: "pcb_component_0",
496
+ layers: ["top", "inner1", "inner2", "bottom"],
497
+ x: 3.81,
498
+ y: -1.27,
499
+ source_port_id: "source_port_5",
500
+ },
501
+ {
502
+ type: "pcb_port",
503
+ pcb_port_id: "pcb_port_6",
504
+ pcb_component_id: "pcb_component_0",
505
+ layers: ["top", "inner1", "inner2", "bottom"],
506
+ x: 3.81,
507
+ y: 1.27,
508
+ source_port_id: "source_port_6",
509
+ },
510
+ {
511
+ type: "pcb_port",
512
+ pcb_port_id: "pcb_port_7",
513
+ pcb_component_id: "pcb_component_0",
514
+ layers: ["top", "inner1", "inner2", "bottom"],
515
+ x: 3.81,
516
+ y: 3.81,
517
+ source_port_id: "source_port_7",
518
+ },
519
+ {
520
+ type: "cad_component",
521
+ cad_component_id: "cad_component_0",
522
+ position: {
523
+ x: 0,
524
+ y: 0,
525
+ z: 0.7,
526
+ },
527
+ rotation: {
528
+ x: 0,
529
+ y: 0,
530
+ z: 0,
531
+ },
532
+ pcb_component_id: "pcb_component_0",
533
+ source_component_id: "source_component_0",
534
+ footprinter_string: "dip8",
535
+ },
536
+ ],
537
+ })
538
+
539
+ // Define the @tsci/seveibar.a555timer package
540
+ db.addSnippet({
541
+ name: "seveibar/a555timer",
542
+ unscoped_name: "a555timer",
543
+ owner_name: "seveibar",
544
+ code: `
545
+ export const A555Timer = ({ name }: { name: string }) => (
546
+ <chip name={name} footprint="dip8" />
547
+ )
548
+ `.trim(),
549
+ dts: `
550
+ declare module "@tsci/seveibar.a555timer" {
551
+ export const A555Timer: ({ name }: {
552
+ name: string;
553
+ }) => any;
554
+ }
555
+ `.trim(),
556
+ compiled_js: `
557
+ "use strict";
558
+
559
+ Object.defineProperty(exports, "__esModule", {
560
+ value: true
561
+ });
562
+ exports.A555Timer = void 0;
563
+ const A555Timer = ({
564
+ name
565
+ }) => /*#__PURE__*/React.createElement("chip", {
566
+ name: name,
567
+ footprint: "dip8"
568
+ });
569
+ exports.A555Timer = A555Timer;
570
+ `.trim(),
571
+ created_at: new Date().toISOString(),
572
+ updated_at: new Date().toISOString(),
573
+ snippet_type: "package",
574
+ description: "A simple package with an A555 Timer component",
575
+ circuit_json: [
576
+ {
577
+ type: "source_port",
578
+ source_port_id: "source_port_0",
579
+ name: "pin1",
580
+ pin_number: 1,
581
+ port_hints: ["pin1", "1"],
582
+ source_component_id: "source_component_0",
583
+ },
584
+ {
585
+ type: "source_port",
586
+ source_port_id: "source_port_1",
587
+ name: "pin2",
588
+ pin_number: 2,
589
+ port_hints: ["pin2", "2"],
590
+ source_component_id: "source_component_0",
591
+ },
592
+ {
593
+ type: "source_port",
594
+ source_port_id: "source_port_2",
595
+ name: "pin3",
596
+ pin_number: 3,
597
+ port_hints: ["pin3", "3"],
598
+ source_component_id: "source_component_0",
599
+ },
600
+ {
601
+ type: "source_port",
602
+ source_port_id: "source_port_3",
603
+ name: "pin4",
604
+ pin_number: 4,
605
+ port_hints: ["pin4", "4"],
606
+ source_component_id: "source_component_0",
607
+ },
608
+ {
609
+ type: "source_port",
610
+ source_port_id: "source_port_4",
611
+ name: "pin5",
612
+ pin_number: 5,
613
+ port_hints: ["pin5", "5"],
614
+ source_component_id: "source_component_0",
615
+ },
616
+ {
617
+ type: "source_port",
618
+ source_port_id: "source_port_5",
619
+ name: "pin6",
620
+ pin_number: 6,
621
+ port_hints: ["pin6", "6"],
622
+ source_component_id: "source_component_0",
623
+ },
624
+ {
625
+ type: "source_port",
626
+ source_port_id: "source_port_6",
627
+ name: "pin7",
628
+ pin_number: 7,
629
+ port_hints: ["pin7", "7"],
630
+ source_component_id: "source_component_0",
631
+ },
632
+ {
633
+ type: "source_port",
634
+ source_port_id: "source_port_7",
635
+ name: "pin8",
636
+ pin_number: 8,
637
+ port_hints: ["pin8", "8"],
638
+ source_component_id: "source_component_0",
639
+ },
640
+ {
641
+ type: "source_component",
642
+ source_component_id: "source_component_0",
643
+ ftype: "simple_chip",
644
+ name: "U1",
645
+ },
646
+ {
647
+ type: "schematic_component",
648
+ schematic_component_id: "schematic_component_0",
649
+ center: {
650
+ x: 0,
651
+ y: 0,
652
+ },
653
+ rotation: 0,
654
+ size: {
655
+ width: 1.1,
656
+ height: 1,
657
+ },
658
+ pin_spacing: 0.2,
659
+ port_labels: {},
660
+ source_component_id: "source_component_0",
661
+ },
662
+ {
663
+ type: "schematic_port",
664
+ schematic_port_id: "schematic_port_0",
665
+ schematic_component_id: "schematic_component_0",
666
+ center: {
667
+ x: -0.9500000000000001,
668
+ y: 0.30000000000000004,
669
+ },
670
+ source_port_id: "source_port_0",
671
+ facing_direction: "left",
672
+ distance_from_component_edge: 0.4,
673
+ side_of_component: "left",
674
+ pin_number: 1,
675
+ true_ccw_index: 0,
676
+ },
677
+ {
678
+ type: "schematic_port",
679
+ schematic_port_id: "schematic_port_1",
680
+ schematic_component_id: "schematic_component_0",
681
+ center: {
682
+ x: -0.9500000000000001,
683
+ y: 0.10000000000000003,
684
+ },
685
+ source_port_id: "source_port_1",
686
+ facing_direction: "left",
687
+ distance_from_component_edge: 0.4,
688
+ side_of_component: "left",
689
+ pin_number: 2,
690
+ true_ccw_index: 1,
691
+ },
692
+ {
693
+ type: "schematic_port",
694
+ schematic_port_id: "schematic_port_2",
695
+ schematic_component_id: "schematic_component_0",
696
+ center: {
697
+ x: -0.9500000000000001,
698
+ y: -0.09999999999999998,
699
+ },
700
+ source_port_id: "source_port_2",
701
+ facing_direction: "left",
702
+ distance_from_component_edge: 0.4,
703
+ side_of_component: "left",
704
+ pin_number: 3,
705
+ true_ccw_index: 2,
706
+ },
707
+ {
708
+ type: "schematic_port",
709
+ schematic_port_id: "schematic_port_3",
710
+ schematic_component_id: "schematic_component_0",
711
+ center: {
712
+ x: -0.9500000000000001,
713
+ y: -0.30000000000000004,
714
+ },
715
+ source_port_id: "source_port_3",
716
+ facing_direction: "left",
717
+ distance_from_component_edge: 0.4,
718
+ side_of_component: "left",
719
+ pin_number: 4,
720
+ true_ccw_index: 3,
721
+ },
722
+ {
723
+ type: "schematic_port",
724
+ schematic_port_id: "schematic_port_4",
725
+ schematic_component_id: "schematic_component_0",
726
+ center: {
727
+ x: 0.9500000000000001,
728
+ y: -0.30000000000000004,
729
+ },
730
+ source_port_id: "source_port_4",
731
+ facing_direction: "right",
732
+ distance_from_component_edge: 0.4,
733
+ side_of_component: "right",
734
+ pin_number: 5,
735
+ true_ccw_index: 4,
736
+ },
737
+ {
738
+ type: "schematic_port",
739
+ schematic_port_id: "schematic_port_5",
740
+ schematic_component_id: "schematic_component_0",
741
+ center: {
742
+ x: 0.9500000000000001,
743
+ y: -0.10000000000000003,
744
+ },
745
+ source_port_id: "source_port_5",
746
+ facing_direction: "right",
747
+ distance_from_component_edge: 0.4,
748
+ side_of_component: "right",
749
+ pin_number: 6,
750
+ true_ccw_index: 5,
751
+ },
752
+ {
753
+ type: "schematic_port",
754
+ schematic_port_id: "schematic_port_6",
755
+ schematic_component_id: "schematic_component_0",
756
+ center: {
757
+ x: 0.9500000000000001,
758
+ y: 0.09999999999999998,
759
+ },
760
+ source_port_id: "source_port_6",
761
+ facing_direction: "right",
762
+ distance_from_component_edge: 0.4,
763
+ side_of_component: "right",
764
+ pin_number: 7,
765
+ true_ccw_index: 6,
766
+ },
767
+ {
768
+ type: "schematic_port",
769
+ schematic_port_id: "schematic_port_7",
770
+ schematic_component_id: "schematic_component_0",
771
+ center: {
772
+ x: 0.9500000000000001,
773
+ y: 0.30000000000000004,
774
+ },
775
+ source_port_id: "source_port_7",
776
+ facing_direction: "right",
777
+ distance_from_component_edge: 0.4,
778
+ side_of_component: "right",
779
+ pin_number: 8,
780
+ true_ccw_index: 7,
781
+ },
782
+ {
783
+ type: "pcb_component",
784
+ pcb_component_id: "pcb_component_0",
785
+ center: {
786
+ x: 0,
787
+ y: 0,
788
+ },
789
+ width: 8.82,
790
+ height: 8.82,
791
+ layer: "top",
792
+ rotation: 0,
793
+ source_component_id: "source_component_0",
794
+ },
795
+ {
796
+ type: "pcb_board",
797
+ pcb_board_id: "pcb_board_0",
798
+ center: {
799
+ x: 0,
800
+ y: 0,
801
+ },
802
+ thickness: 1.4,
803
+ num_layers: 4,
804
+ width: 50,
805
+ height: 50,
806
+ },
807
+ {
808
+ type: "pcb_plated_hole",
809
+ pcb_plated_hole_id: "pcb_plated_hole_0",
810
+ pcb_component_id: "pcb_component_0",
811
+ pcb_port_id: "pcb_port_0",
812
+ outer_diameter: 1.2,
813
+ hole_diameter: 1,
814
+ shape: "circle",
815
+ port_hints: ["1"],
816
+ x: -3.81,
817
+ y: 3.81,
818
+ layers: ["top", "bottom"],
819
+ },
820
+ {
821
+ type: "pcb_plated_hole",
822
+ pcb_plated_hole_id: "pcb_plated_hole_1",
823
+ pcb_component_id: "pcb_component_0",
824
+ pcb_port_id: "pcb_port_1",
825
+ outer_diameter: 1.2,
826
+ hole_diameter: 1,
827
+ shape: "circle",
828
+ port_hints: ["2"],
829
+ x: -3.81,
830
+ y: 1.27,
831
+ layers: ["top", "bottom"],
832
+ },
833
+ {
834
+ type: "pcb_plated_hole",
835
+ pcb_plated_hole_id: "pcb_plated_hole_2",
836
+ pcb_component_id: "pcb_component_0",
837
+ pcb_port_id: "pcb_port_2",
838
+ outer_diameter: 1.2,
839
+ hole_diameter: 1,
840
+ shape: "circle",
841
+ port_hints: ["3"],
842
+ x: -3.81,
843
+ y: -1.27,
844
+ layers: ["top", "bottom"],
845
+ },
846
+ {
847
+ type: "pcb_plated_hole",
848
+ pcb_plated_hole_id: "pcb_plated_hole_3",
849
+ pcb_component_id: "pcb_component_0",
850
+ pcb_port_id: "pcb_port_3",
851
+ outer_diameter: 1.2,
852
+ hole_diameter: 1,
853
+ shape: "circle",
854
+ port_hints: ["4"],
855
+ x: -3.81,
856
+ y: -3.81,
857
+ layers: ["top", "bottom"],
858
+ },
859
+ {
860
+ type: "pcb_plated_hole",
861
+ pcb_plated_hole_id: "pcb_plated_hole_4",
862
+ pcb_component_id: "pcb_component_0",
863
+ pcb_port_id: "pcb_port_4",
864
+ outer_diameter: 1.2,
865
+ hole_diameter: 1,
866
+ shape: "circle",
867
+ port_hints: ["5"],
868
+ x: 3.81,
869
+ y: -3.81,
870
+ layers: ["top", "bottom"],
871
+ },
872
+ {
873
+ type: "pcb_plated_hole",
874
+ pcb_plated_hole_id: "pcb_plated_hole_5",
875
+ pcb_component_id: "pcb_component_0",
876
+ pcb_port_id: "pcb_port_5",
877
+ outer_diameter: 1.2,
878
+ hole_diameter: 1,
879
+ shape: "circle",
880
+ port_hints: ["6"],
881
+ x: 3.81,
882
+ y: -1.27,
883
+ layers: ["top", "bottom"],
884
+ },
885
+ {
886
+ type: "pcb_plated_hole",
887
+ pcb_plated_hole_id: "pcb_plated_hole_6",
888
+ pcb_component_id: "pcb_component_0",
889
+ pcb_port_id: "pcb_port_6",
890
+ outer_diameter: 1.2,
891
+ hole_diameter: 1,
892
+ shape: "circle",
893
+ port_hints: ["7"],
894
+ x: 3.81,
895
+ y: 1.27,
896
+ layers: ["top", "bottom"],
897
+ },
898
+ {
899
+ type: "pcb_plated_hole",
900
+ pcb_plated_hole_id: "pcb_plated_hole_7",
901
+ pcb_component_id: "pcb_component_0",
902
+ pcb_port_id: "pcb_port_7",
903
+ outer_diameter: 1.2,
904
+ hole_diameter: 1,
905
+ shape: "circle",
906
+ port_hints: ["8"],
907
+ x: 3.81,
908
+ y: 3.81,
909
+ layers: ["top", "bottom"],
910
+ },
911
+ {
912
+ type: "pcb_silkscreen_path",
913
+ pcb_silkscreen_path_id: "pcb_silkscreen_path_0",
914
+ pcb_component_id: "pcb_component_0",
915
+ layer: "top",
916
+ route: [
917
+ {
918
+ x: -3.01,
919
+ y: -4.61,
920
+ },
921
+ {
922
+ x: -3.01,
923
+ y: 4.61,
924
+ },
925
+ {
926
+ x: -1.0033333333333332,
927
+ y: 4.61,
928
+ },
929
+ {
930
+ x: -0.9269591309529909,
931
+ y: 4.226040956193693,
932
+ },
933
+ {
934
+ x: -0.7094638037905026,
935
+ y: 3.9005361962094978,
936
+ },
937
+ {
938
+ x: -0.3839590438063067,
939
+ y: 3.6830408690470096,
940
+ },
941
+ {
942
+ x: 6.143644775722556e-17,
943
+ y: 3.6066666666666674,
944
+ },
945
+ {
946
+ x: 0.38395904380630674,
947
+ y: 3.6830408690470096,
948
+ },
949
+ {
950
+ x: 0.7094638037905027,
951
+ y: 3.9005361962094978,
952
+ },
953
+ {
954
+ x: 0.9269591309529909,
955
+ y: 4.226040956193693,
956
+ },
957
+ {
958
+ x: 1.0033333333333332,
959
+ y: 4.61,
960
+ },
961
+ {
962
+ x: 3.01,
963
+ y: 4.61,
964
+ },
965
+ {
966
+ x: 3.01,
967
+ y: -4.61,
968
+ },
969
+ {
970
+ x: -3.01,
971
+ y: -4.61,
972
+ },
973
+ ],
974
+ stroke_width: 0.1,
975
+ },
976
+ {
977
+ type: "pcb_port",
978
+ pcb_port_id: "pcb_port_0",
979
+ pcb_component_id: "pcb_component_0",
980
+ layers: ["top", "inner1", "inner2", "bottom"],
981
+ x: -3.81,
982
+ y: 3.81,
983
+ source_port_id: "source_port_0",
984
+ },
985
+ {
986
+ type: "pcb_port",
987
+ pcb_port_id: "pcb_port_1",
988
+ pcb_component_id: "pcb_component_0",
989
+ layers: ["top", "inner1", "inner2", "bottom"],
990
+ x: -3.81,
991
+ y: 1.27,
992
+ source_port_id: "source_port_1",
993
+ },
994
+ {
995
+ type: "pcb_port",
996
+ pcb_port_id: "pcb_port_2",
997
+ pcb_component_id: "pcb_component_0",
998
+ layers: ["top", "inner1", "inner2", "bottom"],
999
+ x: -3.81,
1000
+ y: -1.27,
1001
+ source_port_id: "source_port_2",
1002
+ },
1003
+ {
1004
+ type: "pcb_port",
1005
+ pcb_port_id: "pcb_port_3",
1006
+ pcb_component_id: "pcb_component_0",
1007
+ layers: ["top", "inner1", "inner2", "bottom"],
1008
+ x: -3.81,
1009
+ y: -3.81,
1010
+ source_port_id: "source_port_3",
1011
+ },
1012
+ {
1013
+ type: "pcb_port",
1014
+ pcb_port_id: "pcb_port_4",
1015
+ pcb_component_id: "pcb_component_0",
1016
+ layers: ["top", "inner1", "inner2", "bottom"],
1017
+ x: 3.81,
1018
+ y: -3.81,
1019
+ source_port_id: "source_port_4",
1020
+ },
1021
+ {
1022
+ type: "pcb_port",
1023
+ pcb_port_id: "pcb_port_5",
1024
+ pcb_component_id: "pcb_component_0",
1025
+ layers: ["top", "inner1", "inner2", "bottom"],
1026
+ x: 3.81,
1027
+ y: -1.27,
1028
+ source_port_id: "source_port_5",
1029
+ },
1030
+ {
1031
+ type: "pcb_port",
1032
+ pcb_port_id: "pcb_port_6",
1033
+ pcb_component_id: "pcb_component_0",
1034
+ layers: ["top", "inner1", "inner2", "bottom"],
1035
+ x: 3.81,
1036
+ y: 1.27,
1037
+ source_port_id: "source_port_6",
1038
+ },
1039
+ {
1040
+ type: "pcb_port",
1041
+ pcb_port_id: "pcb_port_7",
1042
+ pcb_component_id: "pcb_component_0",
1043
+ layers: ["top", "inner1", "inner2", "bottom"],
1044
+ x: 3.81,
1045
+ y: 3.81,
1046
+ source_port_id: "source_port_7",
1047
+ },
1048
+ {
1049
+ type: "cad_component",
1050
+ cad_component_id: "cad_component_0",
1051
+ position: {
1052
+ x: 0,
1053
+ y: 0,
1054
+ z: 0.7,
1055
+ },
1056
+ rotation: {
1057
+ x: 0,
1058
+ y: 0,
1059
+ z: 0,
1060
+ },
1061
+ pcb_component_id: "pcb_component_0",
1062
+ source_component_id: "source_component_0",
1063
+ footprinter_string: "dip8",
1064
+ },
1065
+ ],
1066
+ })
1067
+
1068
+ // Add a snippet that outputs a square waveform using the a555timer
1069
+
1070
+ db.addSnippet({
1071
+ name: "testuser/a555timer-square-wave",
1072
+ unscoped_name: "a555timer-square-wave",
1073
+ owner_name: "testuser",
1074
+ code: `
1075
+ import { A555Timer } from "@tsci/seveibar.a555timer"
1076
+
1077
+ export const SquareWaveModule = () => (
1078
+ <A555Timer name="U1" />
1079
+ )
1080
+ `.trim(),
1081
+ dts: 'export declare const SquareWaveModule: () => import("react/jsx-runtime").JSX.Element;\n',
1082
+ compiled_js:
1083
+ '"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nexports.SquareWaveModule = void 0;\nvar _seveibar = require("@tsci/seveibar.a555timer");\nconst SquareWaveModule = () => /*#__PURE__*/React.createElement(_seveibar.A555Timer, {\n name: "U1"\n});\nexports.SquareWaveModule = SquareWaveModule;',
1084
+ created_at: new Date().toISOString(),
1085
+ updated_at: new Date().toISOString(),
1086
+ snippet_type: "package",
1087
+ description:
1088
+ "A simple package that outputs a square waveform using the a555timer",
1089
+ circuit_json: [
1090
+ {
1091
+ type: "source_port",
1092
+ source_port_id: "source_port_0",
1093
+ name: "pin1",
1094
+ pin_number: 1,
1095
+ port_hints: ["pin1", "1"],
1096
+ source_component_id: "source_component_0",
1097
+ },
1098
+ {
1099
+ type: "source_port",
1100
+ source_port_id: "source_port_1",
1101
+ name: "pin2",
1102
+ pin_number: 2,
1103
+ port_hints: ["pin2", "2"],
1104
+ source_component_id: "source_component_0",
1105
+ },
1106
+ {
1107
+ type: "source_port",
1108
+ source_port_id: "source_port_2",
1109
+ name: "pin3",
1110
+ pin_number: 3,
1111
+ port_hints: ["pin3", "3"],
1112
+ source_component_id: "source_component_0",
1113
+ },
1114
+ {
1115
+ type: "source_port",
1116
+ source_port_id: "source_port_3",
1117
+ name: "pin4",
1118
+ pin_number: 4,
1119
+ port_hints: ["pin4", "4"],
1120
+ source_component_id: "source_component_0",
1121
+ },
1122
+ {
1123
+ type: "source_port",
1124
+ source_port_id: "source_port_4",
1125
+ name: "pin5",
1126
+ pin_number: 5,
1127
+ port_hints: ["pin5", "5"],
1128
+ source_component_id: "source_component_0",
1129
+ },
1130
+ {
1131
+ type: "source_port",
1132
+ source_port_id: "source_port_5",
1133
+ name: "pin6",
1134
+ pin_number: 6,
1135
+ port_hints: ["pin6", "6"],
1136
+ source_component_id: "source_component_0",
1137
+ },
1138
+ {
1139
+ type: "source_port",
1140
+ source_port_id: "source_port_6",
1141
+ name: "pin7",
1142
+ pin_number: 7,
1143
+ port_hints: ["pin7", "7"],
1144
+ source_component_id: "source_component_0",
1145
+ },
1146
+ {
1147
+ type: "source_port",
1148
+ source_port_id: "source_port_7",
1149
+ name: "pin8",
1150
+ pin_number: 8,
1151
+ port_hints: ["pin8", "8"],
1152
+ source_component_id: "source_component_0",
1153
+ },
1154
+ {
1155
+ type: "source_component",
1156
+ source_component_id: "source_component_0",
1157
+ ftype: "simple_chip",
1158
+ name: "U1",
1159
+ },
1160
+ {
1161
+ type: "schematic_component",
1162
+ schematic_component_id: "schematic_component_0",
1163
+ center: {
1164
+ x: 0,
1165
+ y: 0,
1166
+ },
1167
+ rotation: 0,
1168
+ size: {
1169
+ width: 1.1,
1170
+ height: 1,
1171
+ },
1172
+ pin_spacing: 0.2,
1173
+ port_labels: {},
1174
+ source_component_id: "source_component_0",
1175
+ },
1176
+ {
1177
+ type: "schematic_port",
1178
+ schematic_port_id: "schematic_port_0",
1179
+ schematic_component_id: "schematic_component_0",
1180
+ center: {
1181
+ x: -0.9500000000000001,
1182
+ y: 0.30000000000000004,
1183
+ },
1184
+ source_port_id: "source_port_0",
1185
+ facing_direction: "left",
1186
+ distance_from_component_edge: 0.4,
1187
+ side_of_component: "left",
1188
+ pin_number: 1,
1189
+ true_ccw_index: 0,
1190
+ },
1191
+ {
1192
+ type: "schematic_port",
1193
+ schematic_port_id: "schematic_port_1",
1194
+ schematic_component_id: "schematic_component_0",
1195
+ center: {
1196
+ x: -0.9500000000000001,
1197
+ y: 0.10000000000000003,
1198
+ },
1199
+ source_port_id: "source_port_1",
1200
+ facing_direction: "left",
1201
+ distance_from_component_edge: 0.4,
1202
+ side_of_component: "left",
1203
+ pin_number: 2,
1204
+ true_ccw_index: 1,
1205
+ },
1206
+ {
1207
+ type: "schematic_port",
1208
+ schematic_port_id: "schematic_port_2",
1209
+ schematic_component_id: "schematic_component_0",
1210
+ center: {
1211
+ x: -0.9500000000000001,
1212
+ y: -0.09999999999999998,
1213
+ },
1214
+ source_port_id: "source_port_2",
1215
+ facing_direction: "left",
1216
+ distance_from_component_edge: 0.4,
1217
+ side_of_component: "left",
1218
+ pin_number: 3,
1219
+ true_ccw_index: 2,
1220
+ },
1221
+ {
1222
+ type: "schematic_port",
1223
+ schematic_port_id: "schematic_port_3",
1224
+ schematic_component_id: "schematic_component_0",
1225
+ center: {
1226
+ x: -0.9500000000000001,
1227
+ y: -0.30000000000000004,
1228
+ },
1229
+ source_port_id: "source_port_3",
1230
+ facing_direction: "left",
1231
+ distance_from_component_edge: 0.4,
1232
+ side_of_component: "left",
1233
+ pin_number: 4,
1234
+ true_ccw_index: 3,
1235
+ },
1236
+ {
1237
+ type: "schematic_port",
1238
+ schematic_port_id: "schematic_port_4",
1239
+ schematic_component_id: "schematic_component_0",
1240
+ center: {
1241
+ x: 0.9500000000000001,
1242
+ y: -0.30000000000000004,
1243
+ },
1244
+ source_port_id: "source_port_4",
1245
+ facing_direction: "right",
1246
+ distance_from_component_edge: 0.4,
1247
+ side_of_component: "right",
1248
+ pin_number: 5,
1249
+ true_ccw_index: 4,
1250
+ },
1251
+ {
1252
+ type: "schematic_port",
1253
+ schematic_port_id: "schematic_port_5",
1254
+ schematic_component_id: "schematic_component_0",
1255
+ center: {
1256
+ x: 0.9500000000000001,
1257
+ y: -0.10000000000000003,
1258
+ },
1259
+ source_port_id: "source_port_5",
1260
+ facing_direction: "right",
1261
+ distance_from_component_edge: 0.4,
1262
+ side_of_component: "right",
1263
+ pin_number: 6,
1264
+ true_ccw_index: 5,
1265
+ },
1266
+ {
1267
+ type: "schematic_port",
1268
+ schematic_port_id: "schematic_port_6",
1269
+ schematic_component_id: "schematic_component_0",
1270
+ center: {
1271
+ x: 0.9500000000000001,
1272
+ y: 0.09999999999999998,
1273
+ },
1274
+ source_port_id: "source_port_6",
1275
+ facing_direction: "right",
1276
+ distance_from_component_edge: 0.4,
1277
+ side_of_component: "right",
1278
+ pin_number: 7,
1279
+ true_ccw_index: 6,
1280
+ },
1281
+ {
1282
+ type: "schematic_port",
1283
+ schematic_port_id: "schematic_port_7",
1284
+ schematic_component_id: "schematic_component_0",
1285
+ center: {
1286
+ x: 0.9500000000000001,
1287
+ y: 0.30000000000000004,
1288
+ },
1289
+ source_port_id: "source_port_7",
1290
+ facing_direction: "right",
1291
+ distance_from_component_edge: 0.4,
1292
+ side_of_component: "right",
1293
+ pin_number: 8,
1294
+ true_ccw_index: 7,
1295
+ },
1296
+ {
1297
+ type: "pcb_component",
1298
+ pcb_component_id: "pcb_component_0",
1299
+ center: {
1300
+ x: 0,
1301
+ y: 0,
1302
+ },
1303
+ width: 8.82,
1304
+ height: 8.82,
1305
+ layer: "top",
1306
+ rotation: 0,
1307
+ source_component_id: "source_component_0",
1308
+ },
1309
+ {
1310
+ type: "pcb_board",
1311
+ pcb_board_id: "pcb_board_0",
1312
+ center: {
1313
+ x: 0,
1314
+ y: 0,
1315
+ },
1316
+ thickness: 1.4,
1317
+ num_layers: 4,
1318
+ width: 50,
1319
+ height: 50,
1320
+ },
1321
+ {
1322
+ type: "pcb_plated_hole",
1323
+ pcb_plated_hole_id: "pcb_plated_hole_0",
1324
+ pcb_component_id: "pcb_component_0",
1325
+ pcb_port_id: "pcb_port_0",
1326
+ outer_diameter: 1.2,
1327
+ hole_diameter: 1,
1328
+ shape: "circle",
1329
+ port_hints: ["1"],
1330
+ x: -3.81,
1331
+ y: 3.81,
1332
+ layers: ["top", "bottom"],
1333
+ },
1334
+ {
1335
+ type: "pcb_plated_hole",
1336
+ pcb_plated_hole_id: "pcb_plated_hole_1",
1337
+ pcb_component_id: "pcb_component_0",
1338
+ pcb_port_id: "pcb_port_1",
1339
+ outer_diameter: 1.2,
1340
+ hole_diameter: 1,
1341
+ shape: "circle",
1342
+ port_hints: ["2"],
1343
+ x: -3.81,
1344
+ y: 1.27,
1345
+ layers: ["top", "bottom"],
1346
+ },
1347
+ {
1348
+ type: "pcb_plated_hole",
1349
+ pcb_plated_hole_id: "pcb_plated_hole_2",
1350
+ pcb_component_id: "pcb_component_0",
1351
+ pcb_port_id: "pcb_port_2",
1352
+ outer_diameter: 1.2,
1353
+ hole_diameter: 1,
1354
+ shape: "circle",
1355
+ port_hints: ["3"],
1356
+ x: -3.81,
1357
+ y: -1.27,
1358
+ layers: ["top", "bottom"],
1359
+ },
1360
+ {
1361
+ type: "pcb_plated_hole",
1362
+ pcb_plated_hole_id: "pcb_plated_hole_3",
1363
+ pcb_component_id: "pcb_component_0",
1364
+ pcb_port_id: "pcb_port_3",
1365
+ outer_diameter: 1.2,
1366
+ hole_diameter: 1,
1367
+ shape: "circle",
1368
+ port_hints: ["4"],
1369
+ x: -3.81,
1370
+ y: -3.81,
1371
+ layers: ["top", "bottom"],
1372
+ },
1373
+ {
1374
+ type: "pcb_plated_hole",
1375
+ pcb_plated_hole_id: "pcb_plated_hole_4",
1376
+ pcb_component_id: "pcb_component_0",
1377
+ pcb_port_id: "pcb_port_4",
1378
+ outer_diameter: 1.2,
1379
+ hole_diameter: 1,
1380
+ shape: "circle",
1381
+ port_hints: ["5"],
1382
+ x: 3.81,
1383
+ y: -3.81,
1384
+ layers: ["top", "bottom"],
1385
+ },
1386
+ {
1387
+ type: "pcb_plated_hole",
1388
+ pcb_plated_hole_id: "pcb_plated_hole_5",
1389
+ pcb_component_id: "pcb_component_0",
1390
+ pcb_port_id: "pcb_port_5",
1391
+ outer_diameter: 1.2,
1392
+ hole_diameter: 1,
1393
+ shape: "circle",
1394
+ port_hints: ["6"],
1395
+ x: 3.81,
1396
+ y: -1.27,
1397
+ layers: ["top", "bottom"],
1398
+ },
1399
+ {
1400
+ type: "pcb_plated_hole",
1401
+ pcb_plated_hole_id: "pcb_plated_hole_6",
1402
+ pcb_component_id: "pcb_component_0",
1403
+ pcb_port_id: "pcb_port_6",
1404
+ outer_diameter: 1.2,
1405
+ hole_diameter: 1,
1406
+ shape: "circle",
1407
+ port_hints: ["7"],
1408
+ x: 3.81,
1409
+ y: 1.27,
1410
+ layers: ["top", "bottom"],
1411
+ },
1412
+ {
1413
+ type: "pcb_plated_hole",
1414
+ pcb_plated_hole_id: "pcb_plated_hole_7",
1415
+ pcb_component_id: "pcb_component_0",
1416
+ pcb_port_id: "pcb_port_7",
1417
+ outer_diameter: 1.2,
1418
+ hole_diameter: 1,
1419
+ shape: "circle",
1420
+ port_hints: ["8"],
1421
+ x: 3.81,
1422
+ y: 3.81,
1423
+ layers: ["top", "bottom"],
1424
+ },
1425
+ {
1426
+ type: "pcb_silkscreen_path",
1427
+ pcb_silkscreen_path_id: "pcb_silkscreen_path_0",
1428
+ pcb_component_id: "pcb_component_0",
1429
+ layer: "top",
1430
+ route: [
1431
+ {
1432
+ x: -3.01,
1433
+ y: -4.61,
1434
+ },
1435
+ {
1436
+ x: -3.01,
1437
+ y: 4.61,
1438
+ },
1439
+ {
1440
+ x: -1.0033333333333332,
1441
+ y: 4.61,
1442
+ },
1443
+ {
1444
+ x: -0.9269591309529909,
1445
+ y: 4.226040956193693,
1446
+ },
1447
+ {
1448
+ x: -0.7094638037905026,
1449
+ y: 3.9005361962094978,
1450
+ },
1451
+ {
1452
+ x: -0.3839590438063067,
1453
+ y: 3.6830408690470096,
1454
+ },
1455
+ {
1456
+ x: 6.143644775722556e-17,
1457
+ y: 3.6066666666666674,
1458
+ },
1459
+ {
1460
+ x: 0.38395904380630674,
1461
+ y: 3.6830408690470096,
1462
+ },
1463
+ {
1464
+ x: 0.7094638037905027,
1465
+ y: 3.9005361962094978,
1466
+ },
1467
+ {
1468
+ x: 0.9269591309529909,
1469
+ y: 4.226040956193693,
1470
+ },
1471
+ {
1472
+ x: 1.0033333333333332,
1473
+ y: 4.61,
1474
+ },
1475
+ {
1476
+ x: 3.01,
1477
+ y: 4.61,
1478
+ },
1479
+ {
1480
+ x: 3.01,
1481
+ y: -4.61,
1482
+ },
1483
+ {
1484
+ x: -3.01,
1485
+ y: -4.61,
1486
+ },
1487
+ ],
1488
+ stroke_width: 0.1,
1489
+ },
1490
+ {
1491
+ type: "pcb_port",
1492
+ pcb_port_id: "pcb_port_0",
1493
+ pcb_component_id: "pcb_component_0",
1494
+ layers: ["top", "inner1", "inner2", "bottom"],
1495
+ x: -3.81,
1496
+ y: 3.81,
1497
+ source_port_id: "source_port_0",
1498
+ },
1499
+ {
1500
+ type: "pcb_port",
1501
+ pcb_port_id: "pcb_port_1",
1502
+ pcb_component_id: "pcb_component_0",
1503
+ layers: ["top", "inner1", "inner2", "bottom"],
1504
+ x: -3.81,
1505
+ y: 1.27,
1506
+ source_port_id: "source_port_1",
1507
+ },
1508
+ {
1509
+ type: "pcb_port",
1510
+ pcb_port_id: "pcb_port_2",
1511
+ pcb_component_id: "pcb_component_0",
1512
+ layers: ["top", "inner1", "inner2", "bottom"],
1513
+ x: -3.81,
1514
+ y: -1.27,
1515
+ source_port_id: "source_port_2",
1516
+ },
1517
+ {
1518
+ type: "pcb_port",
1519
+ pcb_port_id: "pcb_port_3",
1520
+ pcb_component_id: "pcb_component_0",
1521
+ layers: ["top", "inner1", "inner2", "bottom"],
1522
+ x: -3.81,
1523
+ y: -3.81,
1524
+ source_port_id: "source_port_3",
1525
+ },
1526
+ {
1527
+ type: "pcb_port",
1528
+ pcb_port_id: "pcb_port_4",
1529
+ pcb_component_id: "pcb_component_0",
1530
+ layers: ["top", "inner1", "inner2", "bottom"],
1531
+ x: 3.81,
1532
+ y: -3.81,
1533
+ source_port_id: "source_port_4",
1534
+ },
1535
+ {
1536
+ type: "pcb_port",
1537
+ pcb_port_id: "pcb_port_5",
1538
+ pcb_component_id: "pcb_component_0",
1539
+ layers: ["top", "inner1", "inner2", "bottom"],
1540
+ x: 3.81,
1541
+ y: -1.27,
1542
+ source_port_id: "source_port_5",
1543
+ },
1544
+ {
1545
+ type: "pcb_port",
1546
+ pcb_port_id: "pcb_port_6",
1547
+ pcb_component_id: "pcb_component_0",
1548
+ layers: ["top", "inner1", "inner2", "bottom"],
1549
+ x: 3.81,
1550
+ y: 1.27,
1551
+ source_port_id: "source_port_6",
1552
+ },
1553
+ {
1554
+ type: "pcb_port",
1555
+ pcb_port_id: "pcb_port_7",
1556
+ pcb_component_id: "pcb_component_0",
1557
+ layers: ["top", "inner1", "inner2", "bottom"],
1558
+ x: 3.81,
1559
+ y: 3.81,
1560
+ source_port_id: "source_port_7",
1561
+ },
1562
+ {
1563
+ type: "cad_component",
1564
+ cad_component_id: "cad_component_0",
1565
+ position: {
1566
+ x: 0,
1567
+ y: 0,
1568
+ z: 0.7,
1569
+ },
1570
+ rotation: {
1571
+ x: 0,
1572
+ y: 0,
1573
+ z: 0,
1574
+ },
1575
+ pcb_component_id: "pcb_component_0",
1576
+ source_component_id: "source_component_0",
1577
+ footprinter_string: "dip8",
1578
+ },
1579
+ ],
1580
+ })
1581
+
1582
+ db.addOrder({
1583
+ account_id,
1584
+ is_draft: true,
1585
+ is_pending_validation_by_fab: false,
1586
+ is_pending_review_by_fab: false,
1587
+ is_validated_by_fab: false,
1588
+ is_approved_by_fab_review: false,
1589
+ is_approved_by_orderer: false,
1590
+ is_in_production: false,
1591
+ is_shipped: false,
1592
+ is_cancelled: false,
1593
+ should_be_blank_pcb: false,
1594
+ should_include_stencil: false,
1595
+ jlcpcb_order_params: {},
1596
+ circuit_json: [
1597
+ {
1598
+ type: "source_component",
1599
+ ftype: "simple_resistor",
1600
+ source_component_id: "source_component_1",
1601
+ name: "R1",
1602
+ resistane: "1k",
1603
+ },
1604
+ ],
1605
+ created_at: new Date().toISOString(),
1606
+ updated_at: new Date().toISOString(),
1607
+ })
1608
+ }