copperflow 0.3.4 → 0.4.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 (411) hide show
  1. package/README.md +117 -14
  2. package/dist/app/THIRD_PARTY_LICENSES.txt +5 -0
  3. package/dist/app/assets/NewPartDialog-ZQ4Y3m45.js +1 -0
  4. package/dist/app/assets/PackagesDialog-C8ZyWl-g.css +1 -0
  5. package/dist/app/assets/PackagesDialog-vEzilmpR.js +2 -0
  6. package/dist/app/assets/VerifyPartDialog-BHLqD_WJ.css +1 -0
  7. package/dist/app/assets/VerifyPartDialog-DYr1UIds.js +2 -0
  8. package/dist/app/assets/footprint-preview-Nyk2poiN.js +160 -0
  9. package/dist/app/assets/index-BUjGdMvr.js +20 -0
  10. package/dist/app/assets/index-CF7-tL4t.css +1 -0
  11. package/dist/app/assets/texture-worker-CyI_g_XZ.js +1 -0
  12. package/dist/app/index.html +2 -2
  13. package/dist/cli-commands.js +141 -16
  14. package/dist/cli-commands.js.map +1 -1
  15. package/dist/cli-impedance.d.ts +4 -0
  16. package/dist/cli-impedance.js +56 -0
  17. package/dist/cli-impedance.js.map +1 -0
  18. package/dist/cli-simulate.d.ts +3 -0
  19. package/dist/cli-simulate.js +54 -0
  20. package/dist/cli-simulate.js.map +1 -0
  21. package/dist/core/analyze.js +5 -2
  22. package/dist/core/analyze.js.map +1 -1
  23. package/dist/core/bom.d.ts +6 -1
  24. package/dist/core/bom.js +23 -4
  25. package/dist/core/bom.js.map +1 -1
  26. package/dist/core/case-results.d.ts +4 -0
  27. package/dist/core/case-results.js +9 -0
  28. package/dist/core/case-results.js.map +1 -0
  29. package/dist/core/change-files.d.ts +31 -0
  30. package/dist/core/change-files.js +67 -0
  31. package/dist/core/change-files.js.map +1 -0
  32. package/dist/core/change-render.d.ts +18 -0
  33. package/dist/core/change-render.js +48 -0
  34. package/dist/core/change-render.js.map +1 -0
  35. package/dist/core/change-view.d.ts +33 -0
  36. package/dist/core/change-view.js +73 -0
  37. package/dist/core/change-view.js.map +1 -0
  38. package/dist/core/change-words.d.ts +39 -0
  39. package/dist/core/change-words.js +214 -0
  40. package/dist/core/change-words.js.map +1 -0
  41. package/dist/core/checklist-text.d.ts +21 -0
  42. package/dist/core/checklist-text.js +59 -0
  43. package/dist/core/checklist-text.js.map +1 -0
  44. package/dist/core/edit.js +5 -2
  45. package/dist/core/edit.js.map +1 -1
  46. package/dist/core/fabrication.d.ts +9 -2
  47. package/dist/core/fabrication.js +29 -10
  48. package/dist/core/fabrication.js.map +1 -1
  49. package/dist/core/library.d.ts +46 -0
  50. package/dist/core/library.js +54 -16
  51. package/dist/core/library.js.map +1 -1
  52. package/dist/core/model-export.d.ts +33 -0
  53. package/dist/core/model-export.js +33 -0
  54. package/dist/core/model-export.js.map +1 -0
  55. package/dist/core/modules.d.ts +1 -0
  56. package/dist/core/modules.js +17 -0
  57. package/dist/core/modules.js.map +1 -1
  58. package/dist/core/order-report.d.ts +10 -0
  59. package/dist/core/order-report.js +93 -0
  60. package/dist/core/order-report.js.map +1 -0
  61. package/dist/core/packages.d.ts +18 -0
  62. package/dist/core/packages.js +49 -0
  63. package/dist/core/packages.js.map +1 -0
  64. package/dist/core/pin-header.d.ts +5 -0
  65. package/dist/core/pin-header.js +77 -0
  66. package/dist/core/pin-header.js.map +1 -0
  67. package/dist/core/pin-map.d.ts +46 -0
  68. package/dist/core/pin-map.js +101 -0
  69. package/dist/core/pin-map.js.map +1 -0
  70. package/dist/core/render.d.ts +26 -5
  71. package/dist/core/render.js +16 -6
  72. package/dist/core/render.js.map +1 -1
  73. package/dist/core/sheet-card.d.ts +4 -0
  74. package/dist/core/sheet-card.js +46 -1
  75. package/dist/core/sheet-card.js.map +1 -1
  76. package/dist/core/sheet-files.js +10 -3
  77. package/dist/core/sheet-files.js.map +1 -1
  78. package/dist/core/simulate.d.ts +19 -0
  79. package/dist/core/simulate.js +72 -0
  80. package/dist/core/simulate.js.map +1 -0
  81. package/dist/core/step-export.d.ts +17 -0
  82. package/dist/core/step-export.js +35 -0
  83. package/dist/core/step-export.js.map +1 -0
  84. package/dist/core/supplier-prop.d.ts +6 -0
  85. package/dist/core/supplier-prop.js +21 -0
  86. package/dist/core/supplier-prop.js.map +1 -0
  87. package/dist/core/workspace.d.ts +2 -1
  88. package/dist/core/workspace.js +2 -1
  89. package/dist/core/workspace.js.map +1 -1
  90. package/dist/engine/board.js +3 -1
  91. package/dist/engine/board.js.map +1 -1
  92. package/dist/engine/checks/fast-lines.d.ts +60 -0
  93. package/dist/engine/checks/fast-lines.js +209 -0
  94. package/dist/engine/checks/fast-lines.js.map +1 -0
  95. package/dist/engine/checks/index.js +2 -0
  96. package/dist/engine/checks/index.js.map +1 -1
  97. package/dist/engine/design-diff.d.ts +120 -0
  98. package/dist/engine/design-diff.js +249 -0
  99. package/dist/engine/design-diff.js.map +1 -0
  100. package/dist/engine/design.d.ts +3 -0
  101. package/dist/engine/design.js +7 -2
  102. package/dist/engine/design.js.map +1 -1
  103. package/dist/engine/fab/export.d.ts +17 -1
  104. package/dist/engine/fab/export.js +26 -4
  105. package/dist/engine/fab/export.js.map +1 -1
  106. package/dist/engine/fab/names.d.ts +2 -2
  107. package/dist/engine/fab/names.js +4 -2
  108. package/dist/engine/fab/names.js.map +1 -1
  109. package/dist/engine/fab/picture/board-picture.d.ts +52 -0
  110. package/dist/engine/fab/picture/board-picture.js +102 -0
  111. package/dist/engine/fab/picture/board-picture.js.map +1 -0
  112. package/dist/engine/fab/picture/board-view.d.ts +20 -0
  113. package/dist/engine/fab/picture/board-view.js +50 -0
  114. package/dist/engine/fab/picture/board-view.js.map +1 -0
  115. package/dist/engine/fab/picture/compose.d.ts +50 -0
  116. package/dist/engine/fab/picture/compose.js +208 -0
  117. package/dist/engine/fab/picture/compose.js.map +1 -0
  118. package/dist/engine/fab/picture/layer-images.d.ts +9 -0
  119. package/dist/engine/fab/picture/layer-images.js +67 -0
  120. package/dist/engine/fab/picture/layer-images.js.map +1 -0
  121. package/dist/engine/fab/picture/looks.d.ts +152 -0
  122. package/dist/engine/fab/picture/looks.js +53 -0
  123. package/dist/engine/fab/picture/looks.js.map +1 -0
  124. package/dist/engine/fab/picture/png.d.ts +31 -0
  125. package/dist/engine/fab/picture/png.js +47 -0
  126. package/dist/engine/fab/picture/png.js.map +1 -0
  127. package/dist/engine/fab/picture/raster.d.ts +46 -0
  128. package/dist/engine/fab/picture/raster.js +170 -0
  129. package/dist/engine/fab/picture/raster.js.map +1 -0
  130. package/dist/engine/fab/zip.d.ts +2 -1
  131. package/dist/engine/fab/zip.js +1 -1
  132. package/dist/engine/fab/zip.js.map +1 -1
  133. package/dist/engine/footprints/array.d.ts +4 -0
  134. package/dist/engine/footprints/array.js +51 -0
  135. package/dist/engine/footprints/array.js.map +1 -0
  136. package/dist/engine/footprints/axial.d.ts +6 -0
  137. package/dist/engine/footprints/axial.js +115 -0
  138. package/dist/engine/footprints/axial.js.map +1 -0
  139. package/dist/engine/footprints/catalogue.d.ts +39 -0
  140. package/dist/engine/footprints/catalogue.js +284 -0
  141. package/dist/engine/footprints/catalogue.js.map +1 -0
  142. package/dist/engine/footprints/chip.js +10 -1
  143. package/dist/engine/footprints/chip.js.map +1 -1
  144. package/dist/engine/footprints/connector.d.ts +16 -0
  145. package/dist/engine/footprints/connector.js +31 -0
  146. package/dist/engine/footprints/connector.js.map +1 -0
  147. package/dist/engine/footprints/dcjack.d.ts +3 -0
  148. package/dist/engine/footprints/dcjack.js +46 -0
  149. package/dist/engine/footprints/dcjack.js.map +1 -0
  150. package/dist/engine/footprints/dpak.d.ts +7 -0
  151. package/dist/engine/footprints/dpak.js +172 -0
  152. package/dist/engine/footprints/dpak.js.map +1 -0
  153. package/dist/engine/footprints/dual.d.ts +11 -2
  154. package/dist/engine/footprints/dual.js +113 -12
  155. package/dist/engine/footprints/dual.js.map +1 -1
  156. package/dist/engine/footprints/index.js +46 -3
  157. package/dist/engine/footprints/index.js.map +1 -1
  158. package/dist/engine/footprints/inductor.d.ts +3 -0
  159. package/dist/engine/footprints/inductor.js +32 -0
  160. package/dist/engine/footprints/inductor.js.map +1 -0
  161. package/dist/engine/footprints/known.js +114 -14
  162. package/dist/engine/footprints/known.js.map +1 -1
  163. package/dist/engine/footprints/ledsmd.d.ts +3 -0
  164. package/dist/engine/footprints/ledsmd.js +52 -0
  165. package/dist/engine/footprints/ledsmd.js.map +1 -0
  166. package/dist/engine/footprints/ledth.d.ts +4 -0
  167. package/dist/engine/footprints/ledth.js +45 -0
  168. package/dist/engine/footprints/ledth.js.map +1 -0
  169. package/dist/engine/footprints/melf.d.ts +8 -0
  170. package/dist/engine/footprints/melf.js +56 -0
  171. package/dist/engine/footprints/melf.js.map +1 -0
  172. package/dist/engine/footprints/plcc.d.ts +4 -0
  173. package/dist/engine/footprints/plcc.js +117 -0
  174. package/dist/engine/footprints/plcc.js.map +1 -0
  175. package/dist/engine/footprints/resonator.d.ts +3 -0
  176. package/dist/engine/footprints/resonator.js +33 -0
  177. package/dist/engine/footprints/resonator.js.map +1 -0
  178. package/dist/engine/footprints/screw.d.ts +3 -0
  179. package/dist/engine/footprints/screw.js +51 -0
  180. package/dist/engine/footprints/screw.js.map +1 -0
  181. package/dist/engine/footprints/smallsot.d.ts +8 -0
  182. package/dist/engine/footprints/smallsot.js +143 -0
  183. package/dist/engine/footprints/smallsot.js.map +1 -0
  184. package/dist/engine/footprints/smdbox.d.ts +33 -0
  185. package/dist/engine/footprints/smdbox.js +76 -0
  186. package/dist/engine/footprints/smdbox.js.map +1 -0
  187. package/dist/engine/footprints/smdcan.d.ts +3 -0
  188. package/dist/engine/footprints/smdcan.js +61 -0
  189. package/dist/engine/footprints/smdcan.js.map +1 -0
  190. package/dist/engine/footprints/smdip.d.ts +4 -0
  191. package/dist/engine/footprints/smdip.js +58 -0
  192. package/dist/engine/footprints/smdip.js.map +1 -0
  193. package/dist/engine/footprints/socket.d.ts +8 -0
  194. package/dist/engine/footprints/socket.js +21 -0
  195. package/dist/engine/footprints/socket.js.map +1 -0
  196. package/dist/engine/footprints/sod.d.ts +6 -0
  197. package/dist/engine/footprints/sod.js +63 -6
  198. package/dist/engine/footprints/sod.js.map +1 -1
  199. package/dist/engine/footprints/sot.d.ts +1 -1
  200. package/dist/engine/footprints/sot.js +17 -2
  201. package/dist/engine/footprints/sot.js.map +1 -1
  202. package/dist/engine/footprints/tact.d.ts +3 -0
  203. package/dist/engine/footprints/tact.js +65 -0
  204. package/dist/engine/footprints/tact.js.map +1 -0
  205. package/dist/engine/footprints/tantalum.d.ts +7 -0
  206. package/dist/engine/footprints/tantalum.js +91 -0
  207. package/dist/engine/footprints/tantalum.js.map +1 -0
  208. package/dist/engine/footprints/to92inline.d.ts +14 -0
  209. package/dist/engine/footprints/to92inline.js +21 -0
  210. package/dist/engine/footprints/to92inline.js.map +1 -0
  211. package/dist/engine/footprints/topower.d.ts +7 -0
  212. package/dist/engine/footprints/topower.js +119 -0
  213. package/dist/engine/footprints/topower.js.map +1 -0
  214. package/dist/engine/footprints/usb.d.ts +32 -0
  215. package/dist/engine/footprints/usb.js +109 -0
  216. package/dist/engine/footprints/usb.js.map +1 -0
  217. package/dist/engine/footprints/xtal.d.ts +4 -0
  218. package/dist/engine/footprints/xtal.js +61 -0
  219. package/dist/engine/footprints/xtal.js.map +1 -0
  220. package/dist/engine/impedance.d.ts +72 -0
  221. package/dist/engine/impedance.js +133 -0
  222. package/dist/engine/impedance.js.map +1 -0
  223. package/dist/engine/line-length.d.ts +15 -0
  224. package/dist/engine/line-length.js +116 -0
  225. package/dist/engine/line-length.js.map +1 -0
  226. package/dist/engine/model.d.ts +2 -0
  227. package/dist/engine/model.js.map +1 -1
  228. package/dist/engine/pcb-place/roles.d.ts +3 -1
  229. package/dist/engine/pcb-place/roles.js +5 -0
  230. package/dist/engine/pcb-place/roles.js.map +1 -1
  231. package/dist/engine/rules/impedance-widths.d.ts +20 -0
  232. package/dist/engine/rules/impedance-widths.js +57 -0
  233. package/dist/engine/rules/impedance-widths.js.map +1 -0
  234. package/dist/engine/rules/load.js +11 -2
  235. package/dist/engine/rules/load.js.map +1 -1
  236. package/dist/engine/rules/pairs.d.ts +27 -0
  237. package/dist/engine/rules/pairs.js +86 -0
  238. package/dist/engine/rules/pairs.js.map +1 -0
  239. package/dist/engine/rules/profiles.js +16 -0
  240. package/dist/engine/rules/profiles.js.map +1 -1
  241. package/dist/engine/rules/rotations.d.ts +12 -3
  242. package/dist/engine/rules/rotations.js +77 -2
  243. package/dist/engine/rules/rotations.js.map +1 -1
  244. package/dist/engine/rules/schema.d.ts +44 -0
  245. package/dist/engine/rules/schema.js +16 -1
  246. package/dist/engine/rules/schema.js.map +1 -1
  247. package/dist/engine/sim/answer.d.ts +13 -0
  248. package/dist/engine/sim/answer.js +101 -0
  249. package/dist/engine/sim/answer.js.map +1 -0
  250. package/dist/engine/sim/cases.d.ts +29 -0
  251. package/dist/engine/sim/cases.js +63 -0
  252. package/dist/engine/sim/cases.js.map +1 -0
  253. package/dist/engine/sim/devices.d.ts +109 -0
  254. package/dist/engine/sim/devices.js +137 -0
  255. package/dist/engine/sim/devices.js.map +1 -0
  256. package/dist/engine/sim/elements.d.ts +49 -0
  257. package/dist/engine/sim/elements.js +2 -0
  258. package/dist/engine/sim/elements.js.map +1 -0
  259. package/dist/engine/sim/from-circuit.d.ts +52 -0
  260. package/dist/engine/sim/from-circuit.js +354 -0
  261. package/dist/engine/sim/from-circuit.js.map +1 -0
  262. package/dist/engine/sim/limits.d.ts +12 -0
  263. package/dist/engine/sim/limits.js +79 -0
  264. package/dist/engine/sim/limits.js.map +1 -0
  265. package/dist/engine/sim/linear.d.ts +2 -0
  266. package/dist/engine/sim/linear.js +49 -0
  267. package/dist/engine/sim/linear.js.map +1 -0
  268. package/dist/engine/sim/model-schema.d.ts +246 -0
  269. package/dist/engine/sim/model-schema.js +115 -0
  270. package/dist/engine/sim/model-schema.js.map +1 -0
  271. package/dist/engine/sim/part-models.d.ts +47 -0
  272. package/dist/engine/sim/part-models.js +102 -0
  273. package/dist/engine/sim/part-models.js.map +1 -0
  274. package/dist/engine/sim/run.d.ts +14 -0
  275. package/dist/engine/sim/run.js +13 -0
  276. package/dist/engine/sim/run.js.map +1 -0
  277. package/dist/engine/sim/solve.d.ts +42 -0
  278. package/dist/engine/sim/solve.js +294 -0
  279. package/dist/engine/sim/solve.js.map +1 -0
  280. package/dist/engine/sim/spice.d.ts +5 -0
  281. package/dist/engine/sim/spice.js +66 -0
  282. package/dist/engine/sim/spice.js.map +1 -0
  283. package/dist/engine/sim/values.d.ts +4 -0
  284. package/dist/engine/sim/values.js +40 -0
  285. package/dist/engine/sim/values.js.map +1 -0
  286. package/dist/engine/solid/heights-smd.d.ts +3 -0
  287. package/dist/engine/solid/heights-smd.js +81 -0
  288. package/dist/engine/solid/heights-smd.js.map +1 -0
  289. package/dist/engine/solid/heights-through.d.ts +7 -0
  290. package/dist/engine/solid/heights-through.js +93 -0
  291. package/dist/engine/solid/heights-through.js.map +1 -0
  292. package/dist/engine/solid/heights-uno.d.ts +2 -0
  293. package/dist/engine/solid/heights-uno.js +15 -0
  294. package/dist/engine/solid/heights-uno.js.map +1 -0
  295. package/dist/engine/solid/heights.d.ts +31 -0
  296. package/dist/engine/solid/heights.js +112 -0
  297. package/dist/engine/solid/heights.js.map +1 -0
  298. package/dist/engine/solid/limits.d.ts +7 -0
  299. package/dist/engine/solid/limits.js +20 -0
  300. package/dist/engine/solid/limits.js.map +1 -0
  301. package/dist/engine/solid/model.d.ts +54 -0
  302. package/dist/engine/solid/model.js +147 -0
  303. package/dist/engine/solid/model.js.map +1 -0
  304. package/dist/engine/solid/step.d.ts +5 -0
  305. package/dist/engine/solid/step.js +164 -0
  306. package/dist/engine/solid/step.js.map +1 -0
  307. package/dist/engine/solid/thickness.d.ts +11 -0
  308. package/dist/engine/solid/thickness.js +10 -0
  309. package/dist/engine/solid/thickness.js.map +1 -0
  310. package/dist/library/kicad/board.d.ts +26 -0
  311. package/dist/library/kicad/board.js +96 -0
  312. package/dist/library/kicad/board.js.map +1 -0
  313. package/dist/library/kicad/copper.d.ts +44 -0
  314. package/dist/library/kicad/copper.js +106 -0
  315. package/dist/library/kicad/copper.js.map +1 -0
  316. package/dist/library/kicad/footprints.d.ts +62 -0
  317. package/dist/library/kicad/footprints.js +184 -0
  318. package/dist/library/kicad/footprints.js.map +1 -0
  319. package/dist/library/kicad/geometry.d.ts +36 -0
  320. package/dist/library/kicad/geometry.js +84 -0
  321. package/dist/library/kicad/geometry.js.map +1 -0
  322. package/dist/library/kicad/import.d.ts +58 -0
  323. package/dist/library/kicad/import.js +240 -0
  324. package/dist/library/kicad/import.js.map +1 -0
  325. package/dist/library/kicad/plan.d.ts +40 -0
  326. package/dist/library/kicad/plan.js +139 -0
  327. package/dist/library/kicad/plan.js.map +1 -0
  328. package/dist/library/kicad/read.d.ts +30 -0
  329. package/dist/library/kicad/read.js +105 -0
  330. package/dist/library/kicad/read.js.map +1 -0
  331. package/dist/library/kicad/sexpr.d.ts +36 -0
  332. package/dist/library/kicad/sexpr.js +153 -0
  333. package/dist/library/kicad/sexpr.js.map +1 -0
  334. package/dist/library/kicad/tally.d.ts +32 -0
  335. package/dist/library/kicad/tally.js +55 -0
  336. package/dist/library/kicad/tally.js.map +1 -0
  337. package/dist/library/kicad/write.d.ts +37 -0
  338. package/dist/library/kicad/write.js +146 -0
  339. package/dist/library/kicad/write.js.map +1 -0
  340. package/dist/library/new-part.d.ts +2 -0
  341. package/dist/library/new-part.js +1 -0
  342. package/dist/library/new-part.js.map +1 -1
  343. package/dist/mcp/board-import-tool.d.ts +1 -1
  344. package/dist/mcp/board-import-tool.js +14 -4
  345. package/dist/mcp/board-import-tool.js.map +1 -1
  346. package/dist/mcp/copper-summary.d.ts +2 -0
  347. package/dist/mcp/copper-summary.js +4 -2
  348. package/dist/mcp/copper-summary.js.map +1 -1
  349. package/dist/mcp/create-part.d.ts +23 -0
  350. package/dist/mcp/create-part.js +1 -0
  351. package/dist/mcp/create-part.js.map +1 -1
  352. package/dist/mcp/fast-summary.d.ts +3 -0
  353. package/dist/mcp/fast-summary.js +46 -0
  354. package/dist/mcp/fast-summary.js.map +1 -0
  355. package/dist/mcp/guide.d.ts +3 -1
  356. package/dist/mcp/guide.js +15 -4
  357. package/dist/mcp/guide.js.map +1 -1
  358. package/dist/mcp/model-tool.d.ts +31 -0
  359. package/dist/mcp/model-tool.js +27 -0
  360. package/dist/mcp/model-tool.js.map +1 -0
  361. package/dist/mcp/render-tool.d.ts +33 -2
  362. package/dist/mcp/render-tool.js +21 -5
  363. package/dist/mcp/render-tool.js.map +1 -1
  364. package/dist/mcp/server.js +20 -8
  365. package/dist/mcp/server.js.map +1 -1
  366. package/dist/mcp/sheet-card-tools.d.ts +3 -1
  367. package/dist/mcp/sheet-card-tools.js +3 -1
  368. package/dist/mcp/sheet-card-tools.js.map +1 -1
  369. package/dist/mcp/simulate-tool.d.ts +10 -0
  370. package/dist/mcp/simulate-tool.js +12 -0
  371. package/dist/mcp/simulate-tool.js.map +1 -0
  372. package/dist/render/render.js +11327 -1645
  373. package/dist/studio/change-route.d.ts +18 -0
  374. package/dist/studio/change-route.js +24 -0
  375. package/dist/studio/change-route.js.map +1 -0
  376. package/dist/studio/http-error.d.ts +5 -0
  377. package/dist/studio/http-error.js +9 -0
  378. package/dist/studio/http-error.js.map +1 -0
  379. package/dist/studio/live.d.ts +2 -0
  380. package/dist/studio/live.js.map +1 -1
  381. package/dist/studio/server.js +43 -15
  382. package/dist/studio/server.js.map +1 -1
  383. package/dist/studio/verify-routes.d.ts +42 -0
  384. package/dist/studio/verify-routes.js +110 -0
  385. package/dist/studio/verify-routes.js.map +1 -0
  386. package/dist/version.d.ts +1 -1
  387. package/dist/version.js +1 -1
  388. package/library/modules/CanNode/CanNode.sheet.tsx +1 -1
  389. package/library/modules/CanNode/parts/MCP2515-I-SO/MCP2515_I_SO.tsx +1 -0
  390. package/library/modules/CanNode/parts/MCP2515-I-SO/part.yaml +2 -0
  391. package/library/modules/CanNode/parts/MCP2515-I-SO/verification.md +2 -1
  392. package/library/modules/CanNode/parts/TJA1051T-3/TJA1051T_3.tsx +1 -0
  393. package/library/modules/CanNode/parts/TJA1051T-3/part.yaml +2 -0
  394. package/library/modules/CanNode/parts/TJA1051T-3/verification.md +2 -1
  395. package/library/modules/DigitalInput24V/DigitalInput24V.sheet.tsx +7 -7
  396. package/library/modules/RelayDriver/RelayDriver.sheet.tsx +3 -3
  397. package/library/modules/RelayDriver/parts/AO3400A/part.yaml +34 -0
  398. package/library/modules/RelayDriver/parts/AO3400A/verification.md +11 -1
  399. package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/SRD_12VDC_SL_C.tsx +1 -0
  400. package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/part.yaml +14 -0
  401. package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/verification.md +4 -1
  402. package/package.json +2 -1
  403. package/skills/copperflow/references/copper.md +8 -0
  404. package/skills/copperflow/references/design-rules.md +57 -6
  405. package/skills/copperflow/references/editable-subset.md +18 -8
  406. package/skills/copperflow/references/modules.md +26 -0
  407. package/skills/copperflow/references/parts-library.md +2 -1
  408. package/skills/copperflow/references/writing-circuits.md +9 -0
  409. package/dist/app/assets/NewPartDialog-C4sKWnGI.js +0 -160
  410. package/dist/app/assets/index-BgzJedaB.css +0 -1
  411. package/dist/app/assets/index-C_U9me2P.js +0 -19
package/README.md CHANGED
@@ -14,8 +14,8 @@ its own engine. You and your agent work on them together:
14
14
  Everything runs locally. There is no chat inside copperflow: use the agent you already use,
15
15
  for example Claude Code, through MCP.
16
16
 
17
- > **Status: 0.3, early.** The core, the MCP server, the CLI, the visual editor and the parts
18
- > library work. The project hierarchy for large boards is next; see [docs/design.md](docs/design.md).
17
+ > **Status: 0.4, early.** The core, the MCP server, the CLI, the visual editor, the parts library,
18
+ > placement, routing and the fabrication export work. Expect rough edges; see [docs/design.md](docs/design.md).
19
19
 
20
20
  ## Quick start
21
21
 
@@ -95,8 +95,8 @@ that way stops by itself an hour after the last tab closes; `copperflow studio s
95
95
 
96
96
  The schematic and the PCB are drawn from the design copperflow's engine builds, with
97
97
  copperflow's own footprints and schematic symbols. The PCB shows the ratsnest, a straight line
98
- for each connection still to be made, until routing arrives: hand routing in stage 4 and the
99
- router in stage 5 of [the engine design](docs/engine-design.md#stages).
98
+ for each connection still to be made, until it is routed by hand or by the router. A third tab,
99
+ 3D, shows the board as it will be made with its parts on it (see [Pictures and 3D](#beyond-drawing)).
100
100
 
101
101
  The window is laid out like a desktop EDA editor:
102
102
 
@@ -178,7 +178,8 @@ other way.
178
178
  **Parts library.** Chips and connectors live in `parts/<id>/part.yaml` in your project: pins
179
179
  with names and electrical types, a footprint, MPN and supplier numbers. The footprint is either a
180
180
  string such as `sot23_5`, from which copperflow makes the pads (the strings it knows are listed in
181
- [editable-subset.md](skills/copperflow/references/editable-subset.md#footprint-strings)), or
181
+ [editable-subset.md](skills/copperflow/references/editable-subset.md#footprint-strings), and
182
+ `copperflow packages [words]` browses the standard packages by name, with pads and size), or
182
183
  `footprint.yaml`, a file next to `part.yaml` with every pad transcribed from the datasheet's
183
184
  recommended land pattern; the example's USB-C connector has one. copperflow generates the part's
184
185
  component from `part.yaml`. The agent creates parts from datasheets, or `copperflow parts import
@@ -200,6 +201,52 @@ is no `--build` option.
200
201
  who made it. `copperflow undo` reverts the newest change; the agent can undo only its own.
201
202
  The agent sees what you undid and does not repeat it.
202
203
 
204
+ ## Beyond drawing
205
+
206
+ **Checking a part against its datasheet.** Verify on a library part opens a screen in the Studio: the
207
+ footprint drawn with its dimensions, each pin as a row to tick, and the recorded datasheet beside them.
208
+ The part can be marked verified only when every item is ticked, and only a person can do it.
209
+
210
+ **What a change did.** `copperflow history <id>` (the agent's `recent_changes { id }`) says what one
211
+ change did: parts added, removed and moved, nets and copper; `--since <id>` covers everything after
212
+ it. `copperflow render <file> --change <id>` draws it on the board, and each row of the Studio's Log
213
+ has Show.
214
+
215
+ **Ready to order.** `copperflow bom` ends with whether the board is ready to order bare and ready for
216
+ assembly, and names the lines with no supplier part number. No price or stock is checked.
217
+
218
+ **Pin map for firmware.** `copperflow pins <file>` lists which net is on each pin of the chips and
219
+ connectors, as a table, CSV or a C header (`--format c`); `copperflow package` writes them too.
220
+
221
+ **Fabrication files.** `copperflow export <file>` writes the Gerbers, drills, pick-and-place file and
222
+ BOM for JLCPCB into `<name>-fab/` and a zip, with `<name>.step` for a mechanical CAD program and a
223
+ picture of each side of the board. A circuit with errors is refused.
224
+
225
+ **Pictures and 3D.** `copperflow render <file> --view board` draws the bare board as made: every
226
+ fabrication layer is drawn by itself, from the same data the Gerbers are written from, and they are
227
+ put together as mask, finish, print and holes, in the maker's usual colours (`--mask`, `--finish`,
228
+ `--silk`). `--view 3d` and the Studio's 3D tab lay that picture on the board and stand the parts on
229
+ it. `copperflow glb <file>` writes that same board and its parts as a GLB file, a 3D model a viewer, a
230
+ 3D editor or a web page opens and turns; `copperflow step <file>` writes the STEP file alone. Both
231
+ write a board that is not finished too. The parts are simple shapes, not their real models, in the 3D
232
+ view, the GLB file and the STEP file; a part's height comes from its `height` in `part.yaml`, else a
233
+ typical figure for its package, else 1 mm, and the view says which.
234
+
235
+ **Fast lines.** Net classes in `rules.yaml` take an impedance, a differential pair with its gap and
236
+ skew, a longest length and length-matched groups; the checks report a pair that runs apart or differs
237
+ in length, and `copperflow impedance` gives widths and gaps for the board's stack. The figures are
238
+ estimates, and the router does not route pairs together or tune lengths yet. See
239
+ [design-rules.md](skills/copperflow/references/design-rules.md).
240
+
241
+ **Simulation.** `copperflow simulate` (the agent's `simulate`) finds the DC operating point from ideal
242
+ sources and simple part models: no time, no frequency, no temperature, no tolerance, and chips are not
243
+ modelled. A sheet's card can hold cases ("at 24 V in, the output is between 3.0 and 3.5 V") that it
244
+ runs; `copperflow spice` writes the same circuit as a SPICE netlist for another simulator.
245
+
246
+ **A board from KiCad.** `copperflow import kicad board.kicad_pcb` (the agent's `import_board`, or
247
+ File, Import board in the Studio) makes a new circuit from a KiCad 6 or newer board: its outline,
248
+ parts, nets, tracks, vias and pours. The parts arrive as library parts, not verified.
249
+
203
250
  ## MCP tools
204
251
 
205
252
  | Tool | What it does |
@@ -213,7 +260,15 @@ The agent sees what you undid and does not repeat it.
213
260
  | `new_circuit` | Writes a whole new circuit from a netlist in one call: parts (a built-in `kind` or a library `part`, `value`, `footprint`, `props` such as `pinCount` or a `pinLabels` object to name pins, no positions) and `nets` (`{ GND: ["R1.pin2", "U1.GND"] }`, no wire corners). Pins are checked first (a wrong one is refused with the part's real pin names); an existing file needs `replace: true`; one history entry, and undo removes the file. It then places the board (`autoplace`, a second entry; the board is fitted when no `board` size is given) unless `place: false` |
214
261
  | `autoplace` | Places the parts nobody placed or locked (or only `parts`, or one `instance`) by their connections, as one change: answers "Placed 12 parts; wire length 184 mm (was 412); board 42 × 28 mm; 0 overlaps", then the parts it found no room for and its notes; `fit: true` fits the board too; `budgetSeconds` (20 s by default); `connectors: "ahead"` tries each connector beside the part it serves (route and compare before keeping it) |
215
262
  | `fit_board` | Shrinks or grows a rectangular board to the parts' courtyards plus `margin` (2 mm by default), as one change |
216
- | `import_board` | Sets the board's outline, mounting holes and keepouts from a DXF drawing in the project folder, as one change |
263
+ | `import_board` | Sets the board's outline, mounting holes and keepouts from a DXF drawing in the project folder, as one change; a `.kicad_pcb` file makes a new circuit from a KiCad board |
264
+ | `autoroute` / `unroute` | Routes the unrouted connections (the whole board, some nets, some parts or one instance) and names each one it could not route with the reason; or removes the router's copper |
265
+ | `add_pour` / `remove_pour` / `add_hole` / `remove_hole` | A copper pour of a net on one layer, or a non-plated mounting hole, each as one change |
266
+ | `simulate` | The DC operating point of a circuit or a sheet: set nets to volts, close switches, energise relay coils; with a sheet and no values it runs the sheet's cases |
267
+ | `make_sheet` / `describe_sheet` | Moves parts into a sub-sheet with ports, and writes a sheet's card: what it does, its ports and its cases |
268
+ | `list_modules` / `module_info` / `use_module` / `save_module` | The shelf of modules and the libraries: read one, bring one into the project, save a described sheet |
269
+ | `export_fabrication` | Writes the fabrication files, the STEP model and the board's pictures; refused when the circuit has errors |
270
+ | `export_model` | Writes the board and its parts as one 3D model file, STEP for mechanical CAD or GLB for a 3D viewer; an unfinished board too |
271
+ | `attach_datasheet` / `guide` | Records the datasheet a part came from; and the copperflow skill's texts for an agent that has no skills |
217
272
  | `edit_circuit` | Several edits in one call, applied as one change (one history entry); stops at the first refused edit and writes nothing |
218
273
  | `connect_nets` | Connects many pins to named nets in one call, e.g. `{ "GND": ["R1.pin2", "C1.pin2"] }` |
219
274
  | `route_track` | Draws one track of a net by hand from a pad, track or via of that net, as one change; refused when a point lands on another net's copper; the answer lists the copper violations it introduced |
@@ -222,13 +277,13 @@ The agent sees what you undid and does not repeat it.
222
277
  | `copper_summary` | Per net: tracks, vias, length and unrouted connections, then copper violations by rule (at most 60 lines) |
223
278
  | `board_summary` / `project_status` / `note_decision` / `set_project` | The board in about 60 lines (size, one line per part, longest connections with both pads' places, overlaps, edge, pours; `detail: "full"` for the rest); and the project memory `PROJECT.md` (Intent, Blocks, Decisions, Open) with each circuit's counts and last changes, a dated decision, or rewritten sections, each write one change |
224
279
  | `open_studio` | Starts the Studio for the project if none runs, opens it in your browser and answers with the address |
225
- | `render` | A PNG of the board or of one schematic page, drawn by the Studio's own code; `parts` zooms to some parts (needs the optional package `@napi-rs/canvas`) |
280
+ | `render` | A PNG of the board or of one schematic page, drawn by the Studio's own code; `view: "board"` is the bare board as made: mask, finish, print and holes drawn from the fabrication layers, either side, in the maker's usual colours; `view: "3d"` is that board with its parts as simple shapes, at an angle; `change` or `since` draws what a change did; `parts` zooms to some parts (needs the optional package `@napi-rs/canvas`) |
226
281
  | `list_parts` / `part_info` | Shows the parts library and a part's data and checklist |
227
282
  | `create_part` | Adds a part from a datasheet: pins, footprint string or footprint file, MPN, suppliers |
228
283
  | `import_part` | Fetches one part by its LCSC number from EasyEDA into `parts/<id>/`, unverified, for personal, non-commercial use only (see [licences](docs/licences.md)) |
229
284
  | `place_part` | Adds a library or built-in part to a circuit, with its import |
230
- | `bom` / `export_package` | Bill of materials; folder with BOM, datasheets and part status |
231
- | `recent_changes` | Recent changes by you and the agent, including undos |
285
+ | `bom` / `export_package` | Bill of materials, with whether the board is ready to order; folder with BOM, datasheets, part status and pin maps |
286
+ | `recent_changes` | Recent changes by you and the agent, including undos; `id` says what one change did, `since` everything after it |
232
287
  | `undo_change` | Undoes one of the agent's own changes |
233
288
 
234
289
  There is no unlock tool and no verify tool on purpose.
@@ -237,8 +292,12 @@ There is no unlock tool and no verify tool on purpose.
237
292
 
238
293
  ```text
239
294
  copperflow mcp start the MCP server on stdio
240
- copperflow studio [--port n] open the visual editor at http://127.0.0.1:4777
241
- copperflow skill [--global] copy the copperflow skills into .claude/skills
295
+ copperflow studio [--port n] [--idle-minutes n]
296
+ open the visual editor at http://127.0.0.1:4777 (or a free port);
297
+ with --idle-minutes it stops after n minutes with no tab open
298
+ copperflow studio stop stop the Studio of this folder
299
+ copperflow skill [--global] copy the copperflow skills into .claude/skills of this folder
300
+ (or of your home folder), for agents that read skills
242
301
  copperflow summary <file> print a circuit summary
243
302
  copperflow check <file> list the errors and warnings of copperflow's own rule checks
244
303
  copperflow lock <file> <part...> lock parts so the agent cannot change them
@@ -253,19 +312,60 @@ copperflow parts verify <id> --by <name> --against <datasheet, page>
253
312
  copperflow parts import <C-number> [--id <id>] [--replace]
254
313
  fetch a part by its LCSC number from EasyEDA into parts/,
255
314
  not verified (needs the internet; see docs/licences.md)
315
+ copperflow modules list the shelf of modules (COPPERFLOW_MODULES, default ~/.copperflow/modules)
316
+ copperflow modules verify <name> --by <name>
317
+ mark a module (or <library>/<name>) as checked by you
318
+ copperflow modules remove <name> take a module off the shelf
319
+ copperflow library list the libraries of modules: built in, git and folders
320
+ copperflow library add <name> <address or folder> [--ref <branch or tag>]
321
+ add a library from git (https://, ssh:// or user@host:path)
322
+ or a folder; its modules read NOT verified until you verify them
323
+ copperflow library update [name] bring git libraries to the newest commit of their ref
324
+ copperflow library remove <name> forget a library (a clone is deleted, a folder never)
325
+ copperflow packages [words...] the standard packages with their footprint strings, pads and size
326
+ (words narrow the list: soic, sot 5, sc70, crystal)
256
327
  copperflow place <file> <part> <name> [key=value ...]
257
328
  add a library or built-in part to a circuit
258
329
  copperflow bom <file> [--csv] print the bill of materials
259
330
  copperflow package <file> [--out dir]
260
- write BOM, datasheets and part status to a folder
261
- copperflow render <file> [--view pcb|schematic] [--page <name>] [--parts U1,C3] [--width n] [--out file.png]
331
+ write BOM, datasheets, part status and pin maps to a folder
332
+ copperflow pins <file> [--part <name>] [--format md|csv|c]
333
+ which net is on each pin of the library chips and connectors
334
+ copperflow export <file> [--out dir] write the fabrication files for JLCPCB: Gerbers, drills,
335
+ pick-and-place and BOM in <name>-fab/ and <name>-fab.zip
336
+ beside the circuit (or in the project folder --out), with <name>.step
337
+ copperflow step <file> [--out file.step] write the board and its parts (as boxes) as a STEP file for CAD,
338
+ <name>.step beside the circuit
339
+ copperflow glb <file> [--out file.glb] [--mask black] [--finish hasl] [--silk black]
340
+ write the board as made and its parts (as simple shapes) as a GLB
341
+ file a 3D viewer turns, <name>.glb beside the circuit
342
+ copperflow render <file> [--view pcb|schematic|board|3d] [--page <name>] [--parts U1,C3] [--width n] [--out file.png]
343
+ board: the bare board as made [--side bottom] [--mask black] [--finish hasl] [--silk black] [--background #rrggbb]
344
+ 3d: the board as made with its parts as simple shapes [--angle top|bottom|front|iso] and the same look options
345
+ [--change <id> | --since <id>]
262
346
  draw the board or a schematic page to a PNG, as the Studio shows it
347
+ (<name>-pcb.png or <name>-schematic-<page>.png beside the circuit)
348
+ copperflow simulate <file> --set V12=12 --set CTRL=3.3 [--sheet <name>] [--closed SW1,J2] [--coil K1] [--all]
349
+ the DC operating point from ideal sources and simple models: no time,
350
+ no frequency, no temperature, no tolerance; chips are not modelled.
351
+ With --sheet and no --set it runs the sheet's cases
352
+ copperflow spice <file> [--sheet <name>] [--set net=volts ...] [--out file.cir]
353
+ write the same circuit as a SPICE3 netlist for another simulator
263
354
  copperflow board <file> --dxf <path> [--layer <name>] [--units mm|inch] [--origin keep] [--replace]
264
355
  set the board's outline, holes and keepouts from a DXF drawing
356
+ copperflow import kicad <board.kicad_pcb> [--name <circuit name>] [--replace] [--origin keep]
357
+ make a new circuit from a KiCad board: its outline, parts (as
358
+ library parts, not verified), nets, tracks, vias and pours
359
+ copperflow impedance [--single 50] [--pair 90] [--gap 0.2] [--width 0.3]
360
+ line widths and gaps for an impedance on the board's stack (rules.yaml);
361
+ an estimate: the router does not route pairs together or tune lengths
265
362
  copperflow history [--limit n] list recent changes
363
+ copperflow history <id> | --since <id> what one change did, or everything after it
266
364
  copperflow undo [id] undo the newest change, or the given one
267
365
  ```
268
366
 
367
+ Every command accepts `--root <dir>` (default: the current directory).
368
+
269
369
  ## Libraries
270
370
 
271
371
  A library is a folder of modules laid out as the shelf is: `modules/<Name>/` (or `<Name>/` at the top
@@ -290,7 +390,10 @@ their component files written by copperflow. A library module reads NOT verified
290
390
 
291
391
  - **0.2** (done) Visual editor in the browser: drag, rotate, lock, delete and reconnect wires, marks.
292
392
  - **0.3** (done) Parts library (one folder per part) and datasheet-to-part import; BOM and datasheet package.
293
- - **0.4** Project hierarchy for large boards: a project map, blocks with interfaces, generated summaries, project rules.
393
+ - **0.4** (done) Placement, routing, pours and the fabrication export; sheets, modules and libraries; part
394
+ verification on screen, the change view, the order report, pin maps, STEP and the 3D view, fast-line rules,
395
+ DC simulation, KiCad board import and the board drawn as made.
396
+ - **Next** Routing pairs together and tuning lengths, time and frequency in the simulator, real part models in 3D.
294
397
 
295
398
  ## Contributing
296
399
 
@@ -1,5 +1,10 @@
1
1
  copperflow studio bundles the following packages. Their licences follow.
2
2
 
3
+ ========================================================================
4
+ clipper-lib@6.4.2 BSL
5
+ ========================================================================
6
+ (no licence file in the package)
7
+
3
8
  ========================================================================
4
9
  react-dom@19.1.0 MIT
5
10
  ========================================================================
@@ -0,0 +1 @@
1
+ import{A as e,O as t,k as n,v as r,w as i}from"./index-BUjGdMvr.js";import{n as a,t as o}from"./footprint-preview-Nyk2poiN.js";var s=e(),c=[`power_in`,`power_out`,`ground`,`input`,`output`,`bidirectional`,`passive`,`no_connect`],l=/^[A-Za-z](?:[A-Za-z0-9._-]{0,62}[A-Za-z0-9])?$/,u=/^[1-9][0-9]*$/,d=/^[A-Za-z_][A-Za-z0-9_]*$/,f=`${c.slice(0,-1).join(`, `)} or ${c[c.length-1]}`;function p(e){let t=e.split(/\r?\n/),n=h(t),r=t.findIndex(e=>e.trim()!==``),i=[],a=[],o=new Map;return t.forEach((e,t)=>{let s=e.trim();if(s===``)return;let c=g(s,n);if(t===r&&v(s,c[0]??``))return;let l=t+1,u=y(c,o);typeof u==`string`?a.push({line:l,text:s,message:`Line ${l}: ${u}`}):(o.set(u.number,l),i.push(u))}),{pins:i,errors:a}}function m(e){let t=e.replace(/[^A-Za-z0-9_]/g,`_`);return/^[A-Za-z_]/.test(t)?t:`_${t}`}function h(e){let t=e.map(e=>e.trim()).filter(e=>e!==``);return t.some(e=>e.includes(` `))?`tab`:t.some(e=>/^[^\s,]+\s*,/.test(e))?`comma`:t.some(e=>/ {2,}/.test(e))?`spaces`:`space`}function g(e,t){let n={tab:/\t/,comma:/,/,spaces:/ {2,}/,space:/\s+/}[t],r=t===`space`||t===`spaces`&&!/ {2,}/.test(e),i=e.split(r?/\s+/:n).map(e=>e.trim());return r&&i.length>3?[...i.slice(0,3),i.slice(3).join(` `)]:i}var _=/\b(pin|no|number|name|type|function|description)\b/i;function v(e,t){return!/[0-9]/.test(e)||!u.test(t)&&_.test(e)}function y(e,t){let[n=``,r=``,i=``,...a]=e;if(!u.test(n))return`"${n}" is not a pin number; pins are numbered 1, 2, 3 …`;let o=t.get(n);if(o!==void 0)return`pin ${n} is already on line ${o}`;if(r===``)return`pin ${n} has no name`;if(!d.test(r))return`"${r}" is not a pin name; use letters, digits and _, starting with a letter (e.g. ${m(r)})`;let s=i===``?`passive`:b(i);if(!s)return`"${i}" is not a pin type; use ${f}`;let c=a.filter(e=>e!==``).join(`, `);return{number:n,name:r,type:s,...c?{description:c}:{}}}function b(e){let t=e.toLowerCase().replace(/[-\s]+/g,`_`);return c.find(e=>e===t)}var x={id:``,title:``,manufacturer:``,mpn:``,packageKind:`string`,packageText:``,pins:[],suppliers:[{supplier:`lcsc`,number:``}],datasheet:``,replace:!1},S=/^[a-z0-9_]+$/,C=e=>e.number.trim()===``&&e.name.trim()===``,w=(e,t)=>(Number(e.number)||1/0)-(Number(t.number)||1/0);function T(e){let t=Math.max(0,...e.map(e=>Number(e.number)).filter(e=>Number.isInteger(e)));return[...e,{number:String(t+1),name:``,type:`passive`,description:``}]}function E(e,t,n){return e.map((e,r)=>r===t?{...e,...n}:e)}function D(e,t){return e.filter((e,n)=>n!==t)}function O(e,t){let n=p(t),r=new Map(n.pins.map(e=>[e.number,{...e,description:e.description??``}]));return{pins:[...e.filter(e=>!C(e)&&!r.has(e.number.trim())),...r.values()].sort(w),errors:n.errors}}function k(e){let t=e.id.trim(),n=e.title.trim(),r=j(e.pins),i=M(e.suppliers),a=e.datasheet.trim(),o=[...t===``?[`Give the part an id, such as its part number.`]:l.test(t)&&!t.includes(`..`)?[]:[`"${t}" is not a part id: start with a letter, end with a letter or digit, and use letters, digits, ".", "_" or "-".`],...n===``?[`Give the part a title.`]:[],...A(e),...r.problems,...i.problems,...a===``||/^https?:\/\/\S+$/.test(a)?[]:[`The datasheet link must start with http:// or https://.`]];if(o.length>0)return{problems:o};let s=t=>e[t].trim()?{[t]:e[t].trim()}:{};return{id:t,title:n,...s(`manufacturer`),...s(`mpn`),package:e.packageKind===`file`?{file:`footprint.yaml`}:e.packageText.trim(),pins:r.rows,...Object.keys(i.record).length>0?{suppliers:i.record}:{},...a?{datasheet:{url:a}}:{},replace:e.replace}}function A(e){if(e.packageKind===`file`)return[];let t=e.packageText.trim();if(t===``)return[`Type a footprint string such as soic8, or choose a footprint file.`];if(t.includes(`/`))return[`"${t}" is not a footprint string.`];let n=a(t);return`error`in n?[n.error]:[]}function j(e){let t=e.map((e,t)=>({pin:e,row:t+1})).filter(({pin:e})=>!C(e));if(t.length===0)return{rows:[],problems:[`Add the pins: type them in the rows or paste the datasheet's pin table.`]};let n=[],r=[],i=new Map;for(let{pin:e,row:a}of t){let[t,o,s]=[e.number.trim(),e.name.trim(),e.description.trim()],c=e=>r.push(`Pin row ${a}: ${e}`);if(!u.test(t)){c(`"${t}" is not a pin number; pins are numbered 1, 2, 3 ….`);continue}let l=i.get(t);l===void 0?i.set(t,a):c(`pin ${t} is already in row ${l}.`),o===``?c(`pin ${t} has no name.`):d.test(o)||c(`"${o}" is not a pin name; use letters, digits and _, starting with a letter (e.g. ${m(o)}).`),n.push({number:t,name:o,type:e.type,...s?{description:s}:{}})}return{rows:n,problems:r}}function M(e){let t={},n=[];for(let r of e){let[e,i]=[r.supplier.trim(),r.number.trim()];if(e===``&&i===``)continue;let a=e.toLowerCase();if(!S.test(a)||i===``||a in t){let t=a.split(/[^a-z0-9_]/)[0]||`lcsc`;n.push(`Supplier "${e}": name it with lower-case letters, digits and _ (e.g. ${t}) and give its part number.`)}else t[a]=i}return{record:t,problems:n}}var N=t(),P={width:240,height:150},F={board:n.background,pad:n.topCopper,throughPad:n.multiLayer,drill:n.drill,outline:n.topAssembly,silk:n.topSilk};function I(e,t){let n=window.devicePixelRatio||1;e.width=P.width*n,e.height=P.height*n;let r=e.getContext(`2d`);if(!r)return;r.setTransform(n,0,0,n,0,0),r.fillStyle=F.board,r.fillRect(0,0,P.width,P.height);let i=(e,t,n,i=[])=>{r.strokeStyle=t,r.lineWidth=1,r.setLineDash(i);for(let t of e)r.beginPath(),t.forEach((e,t)=>t===0?r.moveTo(e.x,e.y):r.lineTo(e.x,e.y)),n&&r.closePath(),r.stroke();r.setLineDash([])};i([t.courtyard],F.outline,!0,[3,3]),i(t.body,F.outline,!1),i(t.silkscreen,F.silk,!1);for(let e of t.pads)r.save(),r.translate(e.x,e.y),r.rotate(e.rotation*Math.PI/180),r.fillStyle=e.through?F.throughPad:F.pad,r.beginPath(),e.shape===`circle`||e.shape===`oval`?r.ellipse(0,0,e.width/2,e.height/2,0,0,2*Math.PI):r.rect(-e.width/2,-e.height/2,e.width,e.height),r.fill(),e.drill&&(r.fillStyle=F.drill,r.beginPath(),r.arc(0,0,e.drill/2,0,2*Math.PI),r.fill()),r.restore();let a=t.pads.find(e=>e.number===`1`);a&&(r.fillStyle=F.silk,r.font=`10px sans-serif`,r.fillText(`1`,a.x-a.width/2-8,a.y+3))}function L({text:e}){let t=(0,s.useRef)(null),n=(0,s.useMemo)(()=>o(e,P),[e]);return(0,s.useEffect)(()=>{t.current&&!(`error`in n)&&I(t.current,n)},[n]),`error`in n?(0,N.jsx)(`p`,{className:`new-part-preview-note`,children:n.error}):(0,N.jsxs)(`figure`,{className:`new-part-preview`,children:[(0,N.jsx)(`canvas`,{ref:t,style:P,role:`img`,"aria-label":`Footprint ${e.trim()}: ${n.summary}`}),(0,N.jsx)(`figcaption`,{children:n.summary})]})}function R({pins:e,onChange:t}){return(0,N.jsxs)(`table`,{className:`new-part-pins`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{children:[(0,N.jsx)(`th`,{children:`Pin`}),(0,N.jsx)(`th`,{children:`Name`}),(0,N.jsx)(`th`,{children:`Type`}),(0,N.jsx)(`th`,{children:`Description`}),(0,N.jsx)(`th`,{})]})}),(0,N.jsx)(`tbody`,{children:e.map((n,r)=>(0,N.jsxs)(`tr`,{children:[(0,N.jsx)(`td`,{children:(0,N.jsx)(`input`,{"aria-label":`Row ${r+1} pin number`,value:n.number,onChange:n=>t(E(e,r,{number:n.target.value}))})}),(0,N.jsx)(`td`,{children:(0,N.jsx)(`input`,{"aria-label":`Row ${r+1} pin name`,value:n.name,onChange:n=>t(E(e,r,{name:n.target.value}))})}),(0,N.jsx)(`td`,{children:(0,N.jsx)(`select`,{"aria-label":`Row ${r+1} pin type`,value:n.type,onChange:n=>t(E(e,r,{type:n.target.value})),children:c.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))})}),(0,N.jsx)(`td`,{children:(0,N.jsx)(`input`,{"aria-label":`Row ${r+1} description`,value:n.description,onChange:n=>t(E(e,r,{description:n.target.value}))})}),(0,N.jsx)(`td`,{children:(0,N.jsx)(`button`,{type:`button`,"aria-label":`Remove row ${r+1}`,onClick:()=>t(D(e,r)),children:`×`})})]},r))})]})}function z({pins:e,onChange:t}){let[n,r]=(0,s.useState)(``),[i,a]=(0,s.useState)([]),o=(0,s.useId)();return(0,N.jsxs)(`div`,{className:`new-part-paste`,children:[(0,N.jsx)(`label`,{htmlFor:o,children:`Paste a pin table: one pin per line, "1 VDD power_in", tab or comma separated; no type means passive.`}),(0,N.jsx)(`textarea`,{id:o,rows:4,value:n,onChange:e=>r(e.target.value)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>{let i=O(e,n);t(i.pins),a(i.errors),i.errors.length===0&&r(``)},disabled:n.trim()===``,children:`Add pasted pins`}),i.length>0&&(0,N.jsx)(`ul`,{role:`alert`,children:i.map(e=>(0,N.jsx)(`li`,{children:e.message},e.line))})]})}function B({fields:e,onChange:t}){let n=(n,r,i)=>t(e.map((e,t)=>t===n?{...e,[r]:i}:e));return(0,N.jsxs)(N.Fragment,{children:[e.map((e,t)=>(0,N.jsxs)(`div`,{className:`new-part-supplier`,children:[(0,N.jsx)(`input`,{"aria-label":`Supplier ${t+1}`,placeholder:`lcsc`,value:e.supplier,onChange:e=>n(t,`supplier`,e.target.value)}),(0,N.jsx)(`input`,{"aria-label":`Supplier ${t+1} part number`,placeholder:`C16212`,value:e.number,onChange:e=>n(t,`number`,e.target.value)})]},t)),(0,N.jsx)(`button`,{type:`button`,className:`new-part-add`,onClick:()=>t([...e,{supplier:``,number:``}]),children:`Add supplier`})]})}function V({result:e}){return(0,N.jsxs)(`div`,{className:`import-result`,role:`status`,children:[(0,N.jsx)(`p`,{children:(0,N.jsx)(`strong`,{children:r(e)})}),e.notes.length>0&&(0,N.jsx)(`ul`,{children:e.notes.map(e=>(0,N.jsx)(`li`,{children:e},e))}),(0,N.jsx)(`h3`,{children:`Written`}),(0,N.jsx)(`ul`,{children:e.files.map(e=>(0,N.jsx)(`li`,{children:(0,N.jsx)(`code`,{children:e})},e))}),(0,N.jsx)(`h3`,{children:(0,N.jsx)(`code`,{children:e.verification})}),(0,N.jsx)(`pre`,{className:`new-part-checklist`,children:e.checklist})]})}function H({panel:e,onClose:t}){let[n,r]=(0,s.useState)(()=>({...x,pins:T([])})),[a,o]=(0,s.useState)([]),[c,l]=(0,s.useState)(!1),[u,d]=(0,s.useState)(),f=(0,s.useId)(),p=(e,t)=>r(n=>({...n,[e]:t})),m=async r=>{if(r.preventDefault(),c)return;if(u)return t();let i=k(n);if(`problems`in i)return o(i.problems);l(!0),o([]);try{d(await e.create(i))}catch(e){o([e.message])}finally{l(!1)}};if(u)return(0,N.jsxs)(`form`,{className:`rules-form new-part-form`,onSubmit:e=>void m(e),children:[(0,N.jsx)(V,{result:u}),(0,N.jsx)(`button`,{type:`submit`,children:`Close`})]});let h=(e,t,r)=>(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`label`,{htmlFor:`${f}-${e}`,children:t}),(0,N.jsx)(`input`,{id:`${f}-${e}`,value:n[e],placeholder:r,onChange:t=>p(e,t.target.value)})]});return(0,N.jsxs)(`form`,{className:`rules-form new-part-form`,onSubmit:e=>void m(e),children:[(0,N.jsxs)(`fieldset`,{className:`new-part-fields`,disabled:c,children:[h(`id`,`Part id`,`AP2112K-3.3`),h(`title`,`Title`,`3.3 V LDO regulator`),h(`manufacturer`,`Manufacturer`,`Diodes Incorporated`),h(`mpn`,`MPN`,`AP2112K-3.3TRG1`),(0,N.jsx)(`span`,{children:`Package`}),(0,N.jsxs)(`div`,{className:`new-part-package`,children:[(0,N.jsxs)(`label`,{children:[(0,N.jsx)(`input`,{type:`radio`,name:`${f}-kind`,checked:n.packageKind===`string`,onChange:()=>p(`packageKind`,`string`)}),` Footprint string`]}),(0,N.jsxs)(`label`,{children:[(0,N.jsx)(`input`,{type:`radio`,name:`${f}-kind`,checked:n.packageKind===`file`,onChange:()=>p(`packageKind`,`file`)}),` Footprint file`]})]}),n.packageKind===`string`?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`label`,{htmlFor:`${f}-package`,children:`Footprint`}),(0,N.jsxs)(`div`,{className:`new-part-package`,children:[(0,N.jsx)(`input`,{id:`${f}-package`,value:n.packageText,placeholder:`soic8, qfn32_5x5_p0.5, hc49s`,onChange:e=>p(`packageText`,e.target.value)}),(0,N.jsx)(`button`,{type:`button`,title:`Search the standard packages and see their pads and shape`,onClick:()=>i.open({purpose:{kind:`newPart`},initial:n.packageText,choose:e=>p(`packageText`,e)}),children:`Choose…`})]}),(0,N.jsx)(L,{text:n.packageText})]}):(0,N.jsx)(`p`,{children:`footprint.yaml is written as a placeholder, one pad per pin. The schematic can use the part now; the board reports an error for it until you draw its pads from the datasheet's land pattern and delete "placeholder: true".`}),(0,N.jsx)(`h3`,{children:`Pins`}),(0,N.jsx)(R,{pins:n.pins,onChange:e=>p(`pins`,e)}),(0,N.jsx)(`button`,{type:`button`,className:`new-part-add`,onClick:()=>p(`pins`,T(n.pins)),children:`Add pin`}),(0,N.jsx)(z,{pins:n.pins,onChange:e=>p(`pins`,e)}),(0,N.jsx)(`h3`,{children:`Suppliers`}),(0,N.jsx)(B,{fields:n.suppliers,onChange:e=>p(`suppliers`,e)}),h(`datasheet`,`Datasheet URL`,`https://…`),(0,N.jsxs)(`label`,{className:`make-sheet-rename`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:n.replace,onChange:e=>p(`replace`,e.target.checked)}),`Replace a part with this id that is not verified`]})]}),a.length>0&&(0,N.jsx)(`ul`,{className:`new-part-problems`,role:`alert`,children:a.map(e=>(0,N.jsx)(`li`,{children:e},e))}),(0,N.jsx)(`p`,{children:`The part is written unverified; check it against the datasheet in its verification.md.`}),(0,N.jsx)(`button`,{type:`submit`,disabled:c,children:c?`Writing…`:`Create part`})]})}export{H as NewPartForm};
@@ -0,0 +1 @@
1
+ .packages{grid-template-columns:minmax(0,1fr) 280px;gap:12px;font-size:12px;display:grid}.packages-browse,.packages-side{align-content:start;gap:6px;min-width:0;display:grid}.packages-search{gap:6px;display:flex}.packages-search input{flex:1;min-width:0}.packages-count,.packages-note,.packages-empty{color:var(--muted);margin:0}.packages-list{border:1px solid var(--line);border-radius:4px;max-height:46vh;scroll-padding-top:26px;overflow:auto}.packages-row{cursor:default;grid-template-columns:minmax(0,1.6fr) minmax(0,1.2fr) 40px 96px 40px;align-items:center;gap:8px;min-height:24px;padding:0 8px;display:grid}.packages-row>*{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.packages-head{background:var(--panel);color:var(--muted);border-bottom:1px solid var(--line);position:sticky;top:0}.packages-row[role=option]:hover{background:var(--raised)}.packages-row[aria-selected=true]{background:var(--copper-wash);color:var(--text)}.packages-forms summary{color:var(--muted);cursor:pointer}.packages-forms pre{white-space:pre-wrap;max-height:20vh;color:var(--muted);margin:4px 0 0;font-size:12px;overflow:auto}.packages-preview{gap:6px;display:grid}.packages-preview h3{margin:0;font-size:12px;font-weight:600}.packages-pictures{gap:6px;display:grid}.packages-canvas{border:1px solid var(--line);border-radius:4px;max-width:100%}.packages-shape{touch-action:none;cursor:grab}.packages-shape:active{cursor:grabbing}.packages-facts{grid-template-columns:88px minmax(0,1fr);gap:2px 8px;margin:0;display:grid}.packages-facts dt{color:var(--muted)}.packages-facts dd{overflow-wrap:anywhere;margin:0}.packages-problem{max-height:30vh;color:var(--danger-text);overflow-wrap:anywhere;margin:0;overflow:auto}.packages-actions{flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:6px;display:flex}.packages-status{color:var(--muted);flex:1}@media (width<=760px){.packages{grid-template-columns:minmax(0,1fr)}}
@@ -0,0 +1,2 @@
1
+ import{A as e,D as t,E as n,O as r,T as i,a,c as o,d as s,f as c,h as l,i as u,k as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b}from"./index-BUjGdMvr.js";import{n as x,t as S}from"./footprint-preview-Nyk2poiN.js";var C=e(),w=[`Chip passives`,`Diodes`,`Transistors and regulators`,`ICs with leads`,`ICs without leads`,`Capacitors`,`Crystals and oscillators`,`Inductors`,`LEDs`,`Through-hole`,`Connectors`,`Switches`],T=(e,t,n=!1)=>t.map(([t,r,...i])=>({footprint:t,name:r,group:e,...i.length>0?{also:i}:{},...n?{extra:!0}:{}})),E=T(`Chip passives`,[[`01005`,`01005 (0402 metric)`],[`0201`,`0201 (0603 metric)`],[`0402`,`0402 (1005 metric)`],[`0603`,`0603 (1608 metric)`],[`0805`,`0805 (2012 metric)`],[`1206`,`1206 (3216 metric)`],[`1210`,`1210 (3225 metric)`],[`1812`,`1812 (4532 metric)`],[`2010`,`2010 (5025 metric)`],[`2220`,`2220 (5750 metric)`],[`2512`,`2512 (6332 metric)`],[`array2x0402`,`2x0402 resistor array`],[`array4x0402`,`4x0402 resistor array`],[`array4x0603`,`4x0603 resistor array`]]),D=T(`Diodes`,[[`sod923`,`SOD-923`],[`sod523`,`SOD-523 (SC-79)`],[`sod323`,`SOD-323 (SC-76)`],[`sod123`,`SOD-123`],[`sod123f`,`SOD-123F, flat leads`],[`sod128`,`SOD-128`],[`sma`,`SMA (DO-214AC)`,`do214ac`],[`smb`,`SMB (DO-214AA)`,`do214aa`],[`smc`,`SMC (DO-214AB)`,`do214ab`],[`minimelf`,`MiniMELF (SOD-80, DO-213AA)`,`sod80`,`do213aa`],[`melf`,`MELF (DO-213AB)`,`do213ab`],[`do35`,`DO-35 axial`],[`do41`,`DO-41 axial`],[`do15`,`DO-15 axial`],[`do201ad`,`DO-201AD axial`]]),O=T(`Transistors and regulators`,[[`sot723`,`SOT-723`],[`sot523`,`SOT-523 (SC-89)`],[`sot563`,`SOT-563`],[`sot323`,`SOT-323 (SC-70)`,`sc70`],[`sot353`,`SOT-353 (SC-70-5)`,`sc70_5`],[`sot363`,`SOT-363 (SC-70-6)`,`sc70_6`],[`sot143`,`SOT-143`],[`sot23`,`SOT-23 (TO-236)`],[`sot23_5`,`SOT-23-5 (SOT-25)`],[`sot23_6`,`SOT-23-6 (SOT-26)`],[`sot23_8`,`SOT-23-8`],[`sot89`,`SOT-89 (TO-243)`],[`sot223`,`SOT-223 (TO-261)`],[`dpak`,`DPAK (TO-252)`,`to252`],[`d2pak`,`D2PAK (TO-263)`,`to263`],[`d2pak_5`,`D2PAK-5 (TO-263-5)`,`to263_5`],[`d2pak_7`,`D2PAK-7 (TO-263-7)`,`to263_7`],[`to92`,`TO-92, leads at 2.54`],[`to126`,`TO-126`],[`to220`,`TO-220-3`],[`to220_2`,`TO-220-2`],[`to220_5`,`TO-220-5`],[`to247`,`TO-247`]]),k=T(`ICs with leads`,[[`soic8`,`SOIC-8, 3.9 mm`],[`soic14`,`SOIC-14, 3.9 mm`],[`soic16`,`SOIC-16, 3.9 mm`],[`soic16w`,`SOIC-16 wide, 7.5 mm`],[`sop8`,`SOP-8, 5.3 mm`],[`msop8`,`MSOP-8, 0.65 pitch`],[`msop10`,`MSOP-10, 0.5 pitch`],[`ssop20`,`SSOP-20, 5.3 mm`],[`tssop20`,`TSSOP-20, 4.4 mm`],[`smdip4`,`SMD DIP-4 (optocoupler)`],[`smdip8`,`SMD DIP-8`],[`lqfp48_7x7_p0.5`,`LQFP-48 7x7, 0.5 pitch`,`qfp48`,`tqfp48_7x7_p0.5`],[`lqfp64_10x10_p0.5`,`LQFP-64 10x10, 0.5 pitch`,`qfp64`,`tqfp64_10x10_p0.5`],[`lqfp100_14x14_p0.5`,`LQFP-100 14x14, 0.5 pitch`,`qfp100`,`tqfp100_14x14_p0.5`],[`lqfp144_20x20_p0.5`,`LQFP-144 20x20, 0.5 pitch`,`tqfp144_20x20_p0.5`],[`plcc28`,`PLCC-28, J-leads`],[`plcc44`,`PLCC-44, J-leads`],[`dip8`,`DIP-8, 300 mil`],[`dip14`,`DIP-14, 300 mil`],[`dip28_w15.24`,`DIP-28, 600 mil`],[`dip40_w15.24`,`DIP-40, 600 mil`]]),ee=T(`ICs without leads`,[[`qfn16_3x3_p0.5`,`QFN-16 3x3, 0.5 pitch`,`qfn16`],[`qfn20_4x4_p0.5`,`QFN-20 4x4, 0.5 pitch`],[`qfn32_5x5_p0.5`,`QFN-32 5x5, 0.5 pitch`,`qfn32`],[`qfn32_5x5_p0.5_ep3.1`,`QFN-32 5x5, exposed pad 3.1`,`qfn32_ep`],[`qfn48_7x7_p0.5`,`QFN-48 7x7, 0.5 pitch`,`qfn48`],[`qfn64_9x9_p0.5`,`QFN-64 9x9, 0.5 pitch`],[`dfn6_2x2_p0.65`,`DFN-6 (SON) 2x2, 0.65 pitch`],[`dfn8_3x3_p0.65`,`DFN-8 (SON) 3x3, 0.65 pitch`],[`bga100_11x11_p1`,`BGA-100 11x11, 1 pitch`],[`bga256_17x17_p1`,`BGA-256 17x17, 1 pitch`]]),te=T(`Capacitors`,[[`tant_a`,`Tantalum A (EIA 3216-18)`,`tant3216`],[`tant_b`,`Tantalum B (EIA 3528-21)`,`tant3528`],[`tant_c`,`Tantalum C (EIA 6032-28)`,`tant6032`],[`tant_d`,`Tantalum D (EIA 7343-31)`,`tant7343`],[`tant_e`,`Tantalum E (EIA 7343-43)`],[`smdcan4x5.4`,`SMD electrolytic 4x5.4`],[`smdcan6.3x5.4`,`SMD electrolytic 6.3x5.4`],[`smdcan8x10.2`,`SMD electrolytic 8x10.2`],[`smdcan10x10.2`,`SMD electrolytic 10x10.2`],[`radial6.3x2.5`,`Radial electrolytic 6.3, leads 2.5`],[`radial8x3.5`,`Radial electrolytic 8, leads 3.5`],[`radial10x5`,`Radial electrolytic 10, leads 5`]]),ne=T(`Crystals and oscillators`,[[`xtal2016`,`Crystal 2.0x1.6`],[`xtal2520`,`Crystal 2.5x2.0`],[`xtal3225`,`Crystal 3.2x2.5`],[`xtal5032`,`Crystal 5.0x3.2, 4 pads`],[`xtal5032_2`,`Crystal 5.0x3.2, 2 pads`],[`xtal3215`,`Crystal 3.2x1.5, 32.768 kHz`],[`xtal7050`,`Oscillator 7.0x5.0`],[`hc49smd`,`HC-49/US SMD crystal`],[`hc49`,`HC-49/U crystal`],[`hc49s`,`HC-49/S crystal`]]),re=T(`Crystals and oscillators`,[[`resonator3213`,`Ceramic resonator 3.2x1.3, 3 pads`]],!0),ie=T(`Inductors`,[4,5,6,8,10,12].map(e=>[`ind${e}x${e}`,`Shielded power inductor ${e}x${e}`]),!0),ae=T(`LEDs`,[[`led3528`,`PLCC-2 LED 3.5x2.8`],[`led5050`,`PLCC-4 LED 5.0x5.0`],[`led5050_6`,`PLCC-6 LED 5.0x5.0`],[`led3mm`,`LED 3 mm round`],[`led5mm`,`LED 5 mm round`]]),oe=T(`Through-hole`,[[`axial3.5x7.62`,`Axial 1/8 W resistor`],[`axial6.3x10.16`,`Axial 1/4 W resistor`],[`axial9x12.7`,`Axial 1/2 W resistor`],[`axial11x15.24`,`Axial 1 W resistor`]]),se=T(`Connectors`,[...[2,4,6,8,10].map(e=>[`pinrow${e}`,`Pin header 1x${e}`]),...[5,10,20].map(e=>[`pinrow2x${e}`,`Pin header 2x${e}`]),...[8].map(e=>[`socket${e}`,`Pin socket 1x${e}`]),[`socket2x5`,`Pin socket 2x5`],[`screw2`,`Screw terminal 2 poles, 5.08`],[`screw3`,`Screw terminal 3 poles, 5.08`],[`screw2_p3.5`,`Screw terminal 2 poles, 3.5`]]),ce=T(`Switches`,[[`tact6x6`,`Tact switch 6 × 6 mm, through-hole`],[`tact6x6_smd`,`Tact switch 6 × 6 mm, surface-mount`]],!0),le=T(`ICs with leads`,[...[10,12].map(e=>[`soic${e}`,`SOIC-${e}, 3.9 mm`]),...[18,20,24,28].map(e=>[`soic${e}w`,`SOIC-${e} wide, 7.5 mm`]),...[10,12,14,16].map(e=>[`sop${e}`,`SOP-${e}, 5.3 mm`]),...[14,16,24,28].map(e=>[`ssop${e}`,`SSOP-${e}, 5.3 mm`]),...[8,10,12,14,16,18,22,24,26,28].map(e=>[`tssop${e}`,`TSSOP-${e}, 4.4 mm`]),...[16,20,24,28].map(e=>[`qsop${e}`,`QSOP-${e}, 0.635 pitch`]),[`smdip6`,`SMD DIP-6 (optocoupler)`],[`lqfp32_7x7_p0.8`,`LQFP-32 7x7, 0.8 pitch`,`qfp32`,`tqfp32_7x7_p0.8`],[`lqfp44_10x10_p0.8`,`LQFP-44 10x10, 0.8 pitch`,`tqfp44_10x10_p0.8`],[`lqfp80_12x12_p0.5`,`LQFP-80 12x12, 0.5 pitch`,`tqfp80_12x12_p0.5`],[`lqfp176_24x24_p0.5`,`LQFP-176 24x24, 0.5 pitch`,`tqfp176_24x24_p0.5`],...[20,32,52,68,84].map(e=>[`plcc${e}`,`PLCC-${e}, J-leads`]),...[4,6,16,18,20,24].map(e=>[`dip${e}`,`DIP-${e}, 300 mil`]),...[24,32].map(e=>[`dip${e}_w15.24`,`DIP-${e}, 600 mil`])],!0),ue=T(`ICs without leads`,[[`qfn24_4x4_p0.5`,`QFN-24 4x4, 0.5 pitch`],[`qfn28_5x5_p0.5`,`QFN-28 5x5, 0.5 pitch`],[`qfn40_6x6_p0.5`,`QFN-40 6x6, 0.5 pitch`],[`qfn56_8x8_p0.5`,`QFN-56 8x8, 0.5 pitch`],[`dfn8_2x2_p0.5`,`DFN-8 (SON) 2x2, 0.5 pitch`],[`dfn10_3x3_p0.5`,`DFN-10 (SON) 3x3, 0.5 pitch`],[`bga49_7x7_p0.8`,`BGA-49 7x7, 0.8 pitch`],[`bga64_8x8_p0.8`,`BGA-64 8x8, 0.8 pitch`],[`bga100_10x10_p0.8`,`BGA-100 10x10, 0.8 pitch`],[`bga144_13x13_p1`,`BGA-144 13x13, 1 pitch`]],!0),A=T(`Capacitors`,[[`smdcan5x5.4`,`SMD electrolytic 5x5.4`],[`smdcan6.3x7.7`,`SMD electrolytic 6.3x7.7`],[`radial5x2`,`Radial electrolytic 5, leads 2`],[`radial12.5x5`,`Radial electrolytic 12.5, leads 5`],[`radial16x7.5`,`Radial electrolytic 16, leads 7.5`]],!0),j=T(`Connectors`,[...[1,3,5,7,9,12,16,20].map(e=>[`pinrow${e}`,`Pin header 1x${e}`]),...[2,3,4,6,7,8,9,13,17].map(e=>[`pinrow2x${e}`,`Pin header 2x${e}`]),...[4,6,10].map(e=>[`socket${e}`,`Pin socket 1x${e}`]),...[10,20].map(e=>[`socket2x${e}`,`Pin socket 2x${e}`]),...[4,5,6].map(e=>[`screw${e}`,`Screw terminal ${e} poles, 5.08`]),...[3,4,5,6].map(e=>[`screw${e}_p3.5`,`Screw terminal ${e} poles, 3.5`]),[`usb_b`,`USB Type-B receptacle, through-hole`],[`usb_c16`,`USB Type-C receptacle, 16 pins (USB 2.0)`],[`dcjack`,`DC barrel jack 5.5 / 2.1 mm`,`dcjack2.1`,`dcjack2.5`]],!0),M=[...E,...D,...O,...k,...le,...ee,...ue,...te,...A,...ne,...re,...ie,...ae,...oe,...se,...j,...ce],N=[{form:`soic<N>[w] sop<N> ssop<N> tssop<N>`,says:`dual gull-wing ICs by pin count`},{form:`qfn<N>_<b>x<b>_p<pitch>[_ep<size>]`,says:`any square QFN by body and pitch`},{form:`dfn<N>_<a>x<b>_p<pitch>[_ep<w>x<h>]`,says:`any DFN by body and pitch`},{form:`lqfp<N>_<b>x<b>_p<pitch>`,says:`any square QFP (tqfp, qfp too)`},{form:`bga<N>_<x>x<y>_p<pitch>`,says:`any ball grid by body and pitch`},{form:`dip<N>[_w<spacing>]`,says:`DIP; wide is _w15.24`},{form:`plcc<N>`,says:`PLCC 20, 28, 32, 44, 52, 68, 84`},{form:`pinrow<N>[_p<pitch>] pinrow2x<N>`,says:`pin headers`},{form:`socket<N> socket2x<N>`,says:`pin sockets`},{form:`screw<N>[_p<pitch>]`,says:`screw terminals, 2-24 poles`},{form:`radial<can>x<spacing>`,says:`radial electrolytic`},{form:`axial<body>x<spacing>[_d<dia>]`,says:`axial resistor`},{form:`ind<a>x<a>`,says:`power inductor 4 to 12 mm`},{form:`parts/<id>/footprint.yaml`,says:`any other package: its own pads`}],P=e=>e.toLowerCase().replace(/[\s-]+/g,``);function F(e){let t=e.map(P).filter(e=>e!==``);return M.filter(e=>{let n=[e.footprint,e.name,e.group,...e.also??[]].map(P);return t.every(e=>n.some(t=>t.includes(e)))})}var I=`Shapes are simple generated shapes, not the makers' models.`,L=`is not a footprint string; this preview shows generated footprints only`,R=`Type a footprint string such as soic8, 0603 or qfn32_5x5_p0.5.`,z=e=>Math.round(e*10)/10;function B(e){let t=e.courtyard.map(e=>e.x),n=e.courtyard.map(e=>e.y),[r,i]=t.length===0?[0,0]:[z(Math.max(...t)-Math.min(...t)),z(Math.max(...n)-Math.min(...n))];return{pads:new Set(e.pads.map(e=>e.number)).size,size:`${r} × ${i} mm`,mount:e.pads.some(e=>e.layers===`through`)?`Through-hole`:`Surface-mount`}}function V(e){let t=e.trim();return t===``?{error:R}:t.includes(`/`)?{error:`"${t}" ${L}`}:x(t)}var H=new Map;function U(e){let t=H.get(e.footprint);if(t)return t;let n=V(e.footprint),r=`error`in n?{pads:0,size:``,mount:`Surface-mount`}:B(n);return H.set(e.footprint,r),r}function de(e,t){return F(e.split(/\s+/)).filter(e=>t===`all`||e.group===t).map(e=>({footprint:e.footprint,name:e.name,group:e.group,...U(e)}))}function fe(e,t,n=!0){return e.some(e=>e.footprint===t)?t:n?e[0]?.footprint:void 0}function pe(e){let t=e?.trim()??``;return t===``?{typed:``}:F([]).some(e=>e.footprint===t)?{selected:t,typed:``}:{typed:t}}var W=10,G={ArrowDown:e=>e+1,ArrowUp:e=>e-1,PageDown:e=>e+W,PageUp:e=>e-W,Home:()=>0,End:(e,t)=>t},me=new Set([`Home`,`End`]),he=(e,t=!1)=>e in G&&!(t&&me.has(e));function ge(e,t,n){let r=G[n];if(e.length===0)return;let i=e.findIndex(e=>e.footprint===t);if(i<0||!r)return e[Math.max(i,0)]?.footprint;let a=e.length-1;return e[Math.max(0,Math.min(a,r(i,a)))]?.footprint}function _e(e){let t=l({footprint:e,props:{}});return t.state===`read`?{height:t.height,note:`from ${t.source}`}:t.state===`typical`?{height:t.height,note:`typical for the package, not read from a datasheet`}:t.state===`given`?{height:t.height,note:`given by the part`}:{height:t.height,note:`assumed: the package's height is not known`}}function ve(e){let t=V(e);if(`error`in t)return{error:t.error};let n=e.trim(),{height:r,note:i}=_e(n);return{footprint:n,...B(t),height:r,heightNote:i,origin:t.origin}}var ye=()=>N.map(e=>`${e.form}: ${e.says}`).join(`
2
+ `),be=1.6,K=1,xe=e=>`"${e}" is not a footprint string; a part's own footprint.yaml has no shape to show here`;function Se(e){let t=e.trim();return t===``?{error:`Type a footprint string such as soic8 or 0603.`}:t.includes(`/`)?{error:xe(t)}:x(t)}var Ce=e=>({component:``,x:0,y:0,rotation:0,side:`top`,autoPlaced:!1,footprint:e,pads:[],courtyard:e.courtyard,silkscreen:e.silkscreen,fabrication:e.fabrication});function q(e){let t=e.flatMap(e=>e.loops.flat());if(t.length===0)return[[0,0,0],[0,0,0]];let n=e=>t.map(t=>t[e]),[r,i,a]=[n(0),n(1),n(2)];return[[Math.min(...r),Math.min(...i),Math.min(...a)],[Math.max(...r),Math.max(...i),Math.max(...a)]]}function we(e,t=``){let n=Se(e);if(`error`in n)return{error:n.error};let r=e.trim(),i=l({footprint:r,props:{}}),s=n.pads.some(e=>e.layers===`through`),{family:c,look:u,parsed:d}=o(t,r,s),p=c===`ledth`?f(v[u],void 0):v[u],m=h(Ce(n),i.height,p,d,be,u),g=a[c](m).map(e=>({...e,alpha:1,part:0}));return{faces:g,bounds:q(g),height:i,limit:m.limit}}function Te(e){let t=s([{x:Math.min(e.limit.minX,e.bounds[0][0])-K,y:Math.min(e.limit.minY,e.bounds[0][1])-K},{x:Math.max(e.limit.maxX,e.bounds[1][0])+K,y:Math.max(e.limit.maxY,e.bounds[1][1])+K}]),n=[{x:t.minX,y:t.minY},{x:t.maxX,y:t.minY},{x:t.maxX,y:t.maxY},{x:t.minX,y:t.maxY}],{mask:r,laminate:i}=m({}),a=b(n,-1.6,0,{top:r,side:i},`matt`,`board`).map(e=>({...e,alpha:1,part:-1})),o=[...e.faces,...a];return{faces:o,bounds:q(o)}}var J=r(),Y={width:260,height:190},Ee=9,De=160,X={board:d.background,pad:d.topCopper,throughPad:d.multiLayer,drill:d.drill,outline:d.topAssembly,silk:d.topSilk,number:d.background};function Oe(e){let t=window.devicePixelRatio||1;e.width=Y.width*t,e.height=Y.height*t;let n=e.getContext(`2d`);return n?.setTransform(t,0,0,t,0,0),n}function Z(e,t,n,r,i=[]){e.strokeStyle=n,e.lineWidth=1,e.setLineDash(i);for(let n of t)e.beginPath(),n.forEach((t,n)=>n===0?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)),r&&e.closePath(),e.stroke();e.setLineDash([])}function ke(e,t){e.save(),e.translate(t.x,t.y),e.rotate(t.rotation*Math.PI/180),e.fillStyle=t.through?X.throughPad:X.pad,e.beginPath(),t.shape===`circle`||t.shape===`oval`?e.ellipse(0,0,t.width/2,t.height/2,0,0,2*Math.PI):e.rect(-t.width/2,-t.height/2,t.width,t.height),e.fill(),t.drill&&(e.fillStyle=X.drill,e.beginPath(),e.arc(0,0,t.drill/2,0,2*Math.PI),e.fill()),e.restore(),Math.min(t.width,t.height)<Ee||(e.fillStyle=X.number,e.font=`${Math.min(11,Math.floor(Math.min(t.width,t.height)*.7))}px sans-serif`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(t.number,t.x,t.y))}function Ae(e,t){let n=Oe(e);if(n){n.fillStyle=X.board,n.fillRect(0,0,Y.width,Y.height),Z(n,[t.courtyard],X.outline,!0,[3,3]),Z(n,t.body,X.outline,!1),Z(n,t.silkscreen,X.silk,!1);for(let e of t.pads)ke(n,e)}}function je({text:e}){let t=(0,C.useRef)(null),n=(0,C.useMemo)(()=>S(e,Y),[e]);return(0,C.useEffect)(()=>{t.current&&!(`error`in n)&&Ae(t.current,n)},[n]),`error`in n?null:(0,J.jsx)(`canvas`,{ref:t,className:`packages-canvas`,style:Y,role:`img`,"aria-label":`Pads of ${e.trim()}: ${n.summary}`})}function Me(e){let t=(0,C.useRef)(void 0),n=(0,C.useRef)(0);return(0,C.useEffect)(()=>()=>cancelAnimationFrame(n.current),[]),r=>{t.current=r,n.current===0&&(n.current=requestAnimationFrame(()=>{n.current=0,t.current&&e(t.current)}))}}function Ne({text:e,kind:t,orbit:n,onOrbit:r,focusRef:i,describedBy:a}){let o=(0,C.useMemo)(()=>{let n=we(e,t);return`error`in n?void 0:Te(n)},[e,t]),s=(0,C.useRef)(void 0),[l,f]=(0,C.useState)(n),p=Me(r);(0,C.useEffect)(()=>{let e=setTimeout(()=>f(n),De);return()=>clearTimeout(e)},[n]);let m=l===n;if((0,C.useEffect)(()=>{let e=i.current;if(!e||!o)return;let t=window.devicePixelRatio||1,[r,a]=[Math.round(Y.width*t),Math.round(Y.height*t)],s={background:y(d.background),lit:!0},c=m?u(o,n,r,a,s):_(o,n,r,a,s);e.width=r,e.height=a,e.getContext(`2d`)?.putImageData(new ImageData(c.color,r,a),0,0)},[o,n,m,i]),!o)return null;let h=e=>{e.currentTarget.setPointerCapture(e.pointerId),s.current={x:e.clientX,y:e.clientY,orbit:n}},v=e=>{s.current&&p(g(s.current.orbit,e.clientX-s.current.x,e.clientY-s.current.y))},b=()=>s.current=void 0;return(0,J.jsx)(`canvas`,{ref:i,className:`packages-canvas packages-shape`,style:Y,tabIndex:0,role:`img`,"aria-label":`3D shape of ${e.trim()}; drag or use the arrow keys to turn it, Home to go back`,"aria-describedby":a,onPointerDown:h,onPointerMove:v,onPointerUp:b,onPointerCancel:b,onDoubleClick:()=>r(c)})}var Q=`all`,Pe=(0,C.memo)(function({rows:e,selected:t,listId:n,onSelect:r,onChoose:i}){let a=(0,C.useRef)(null);return(0,C.useEffect)(()=>{a.current?.querySelector(`[aria-selected=true]`)?.scrollIntoView({block:`nearest`})},[t]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`packages-list`,ref:a,id:n,role:`listbox`,"aria-label":`Packages`,children:[(0,J.jsxs)(`div`,{className:`packages-row packages-head`,"aria-hidden":`true`,children:[(0,J.jsx)(`span`,{children:`Name`}),(0,J.jsx)(`span`,{children:`String`}),(0,J.jsx)(`span`,{children:`Pads`}),(0,J.jsx)(`span`,{children:`Courtyard`}),(0,J.jsx)(`span`,{children:`Mount`})]}),e.map(e=>(0,J.jsxs)(`div`,{id:`${n}-${e.footprint}`,role:`option`,"aria-selected":e.footprint===t,className:`packages-row`,onMouseDown:e=>e.preventDefault(),onClick:()=>r(e.footprint),onDoubleClick:()=>i(e.footprint),children:[(0,J.jsx)(`span`,{children:e.name}),(0,J.jsx)(`code`,{children:e.footprint}),(0,J.jsx)(`span`,{children:e.pads}),(0,J.jsx)(`span`,{children:e.size}),(0,J.jsx)(`span`,{children:e.mount===`Surface-mount`?`SMD`:`THT`})]},e.footprint))]}),e.length===0&&(0,J.jsx)(`p`,{className:`packages-empty`,children:`No package matches. Type the string below if the family takes your size.`})]})});function $({facts:e,id:t}){return(0,J.jsxs)(`dl`,{className:`packages-facts`,id:t,children:[(0,J.jsx)(`dt`,{children:`Pads`}),(0,J.jsx)(`dd`,{children:e.pads}),(0,J.jsx)(`dt`,{children:`Courtyard`}),(0,J.jsx)(`dd`,{children:e.size}),(0,J.jsx)(`dt`,{children:`Mount`}),(0,J.jsx)(`dd`,{children:e.mount}),(0,J.jsx)(`dt`,{children:`Height`}),(0,J.jsxs)(`dd`,{children:[e.height,` mm, `,e.heightNote]}),(0,J.jsx)(`dt`,{children:`Numbers from`}),(0,J.jsx)(`dd`,{children:e.origin})]})}function Fe({text:e,details:t,kind:n,orbit:r,onOrbit:i,shape:a,factsId:o}){return e===``?(0,J.jsx)(`p`,{className:`packages-note`,children:`Select a package with the arrows or a click, or type a footprint string.`}):`error`in t?(0,J.jsx)(`p`,{className:`packages-problem`,role:`alert`,children:t.error}):(0,J.jsxs)(`div`,{className:`packages-preview`,children:[(0,J.jsx)(`h3`,{children:(0,J.jsx)(`code`,{children:t.footprint})}),(0,J.jsxs)(`div`,{className:`packages-pictures`,children:[(0,J.jsx)(je,{text:e}),(0,J.jsx)(Ne,{text:e,kind:n,orbit:r,onOrbit:i,focusRef:a,describedBy:o})]}),(0,J.jsxs)(`p`,{className:`packages-note`,children:[I,` Drag the shape to turn it.`]}),(0,J.jsx)($,{facts:t,id:o})]})}function Ie(e,n){let r=(0,C.useMemo)(()=>pe(e),[e]),[i,a]=(0,C.useState)(``),[o,s]=(0,C.useState)(Q),[c,l]=(0,C.useState)(r.selected),[u,d]=(0,C.useState)(r.typed),f=(0,C.useMemo)(()=>de(i,o),[i,o]),p=fe(f,c,t(n)),m=u.trim()===``?p??``:u.trim();return{query:i,setQuery:a,group:o,setGroup:s,rows:f,selected:p,select:(0,C.useCallback)(e=>{l(e),d(``)},[]),typed:u,setTyped:d,shown:m}}function Le(e){let[t,n]=(0,C.useState)({about:``,text:``});return{status:t.about===e?t.text:``,copy:e=>{if(e===``)return;let t=()=>n({about:e,text:`Could not copy; select ${e} and copy it by hand`});if(!navigator.clipboard?.writeText)return t();try{navigator.clipboard.writeText(e).then(()=>n({about:e,text:`Copied ${e}`}),t)}catch{t()}}}}function Re(e){let[t,n]=(0,C.useState)({about:e,orbit:c}),r=(0,C.useCallback)(t=>n({about:e,orbit:t}),[e]);return[t.about===e?t.orbit:c,r]}function ze(e,t){(0,C.useEffect)(()=>{e.current=t}),(0,C.useEffect)(()=>()=>void(e.current=void 0),[e])}function Be(e){let t=(0,C.useRef)(e);return(0,C.useLayoutEffect)(()=>{t.current=e}),(0,C.useCallback)((...e)=>t.current(...e),[])}var Ve=e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,He=e=>e instanceof HTMLButtonElement||e instanceof HTMLSelectElement||e?.tagName===`SUMMARY`;function Ue({request:e,onClose:t,keys:r}){let a=Ie(e.initial,e.purpose),o=(0,C.useMemo)(()=>ve(a.shown),[a.shown]),s=a.shown!==``&&!(`error`in o),{status:c,copy:l}=Le(a.shown),[u,d]=Re(a.shown),f=(0,C.useRef)(null),m=(0,C.useRef)(null),h=(0,C.useId)(),g=i(e.purpose),_=n=>{e.choose?.(n),t()},v=(t,r)=>{let i=n(e.purpose,r);i===`use`?_(t):i===`copy`&&l(t)},y=Be(e=>v(e,!0));return ze(r,e=>{let t=document.activeElement;if(t===m.current){let t=p(u,e.key);t&&(e.preventDefault(),d(t))}else if(!He(t)){if(e.key===`Enter`)return e.preventDefault(),v(a.shown,s);t!==f.current&&he(e.key,Ve(t))&&(e.preventDefault(),a.select(ge(a.rows,a.selected,e.key)))}}),(0,J.jsxs)(`div`,{className:`packages`,children:[(0,J.jsxs)(`div`,{className:`packages-browse`,children:[(0,J.jsxs)(`div`,{className:`packages-search`,children:[(0,J.jsx)(`input`,{"data-default":!0,type:`search`,placeholder:`Search packages: sot23, QFN 5x5, crystal`,"aria-label":`Search packages`,"aria-controls":`${h}-list`,"aria-activedescendant":a.selected&&a.typed===``?`${h}-list-${a.selected}`:void 0,value:a.query,onChange:e=>a.setQuery(e.target.value)}),(0,J.jsxs)(`select`,{"aria-label":`Group`,value:a.group,onChange:e=>a.setGroup(e.target.value),children:[(0,J.jsx)(`option`,{value:Q,children:`All groups`}),w.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]})]}),(0,J.jsxs)(`p`,{className:`packages-count`,"aria-live":`polite`,children:[a.rows.length,` package`,a.rows.length===1?``:`s`]}),(0,J.jsx)(Pe,{rows:a.rows,selected:a.typed===``?a.selected:void 0,listId:`${h}-list`,onSelect:a.select,onChoose:y}),(0,J.jsx)(`label`,{htmlFor:`${h}-typed`,children:`Or type any footprint string`}),(0,J.jsx)(`input`,{id:`${h}-typed`,ref:f,value:a.typed,placeholder:`tssop24, qfn40_6x6_p0.5`,spellCheck:!1,"aria-describedby":`${h}-forms`,onChange:e=>a.setTyped(e.target.value)}),(0,J.jsxs)(`details`,{className:`packages-forms`,children:[(0,J.jsx)(`summary`,{children:`Families that take any size`}),(0,J.jsx)(`pre`,{id:`${h}-forms`,children:ye()})]})]}),(0,J.jsxs)(`div`,{className:`packages-side`,children:[(0,J.jsx)(Fe,{text:a.shown,details:o,kind:e.kind,orbit:u,onOrbit:d,shape:m,factsId:`${h}-facts`}),(0,J.jsxs)(`div`,{className:`packages-actions`,children:[(0,J.jsx)(`span`,{className:`packages-status`,role:`status`,children:c}),(0,J.jsx)(`button`,{type:`button`,disabled:a.shown===``,onClick:()=>l(a.shown),children:`Copy string`}),g&&(0,J.jsx)(`button`,{type:`button`,className:`primary`,disabled:!s,onClick:()=>_(a.shown),children:g})]})]})]})}export{Ue as PackagesForm};
@@ -0,0 +1 @@
1
+ .verify-screen{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;font-size:12px;display:grid}.verify-notes{grid-column:1/-1}.verify-notes:empty{display:none}.verify-notes .note{margin:0 0 4px}@media (width<=1000px){.verify-screen{grid-template-columns:minmax(0,1fr)}}.verify-column{align-content:start;gap:8px;min-width:0;display:grid}.verify-column h3{margin:4px 0 0;font-size:12px;font-weight:600}.verify-column .note,.verify-column .hint{margin:0}.verify-drawing{border:1px solid var(--line);background:var(--pcb-background);border-radius:4px;width:100%;max-height:46vh}.verify-pad{cursor:pointer;outline:none}.verify-pad:focus-visible>g{stroke:var(--copper);stroke-width:.12px}.verify-pad text{pointer-events:none;font-family:sans-serif}.verify-readout{min-height:2.6em;color:var(--text);overflow-wrap:anywhere;margin:0}.verify-actions,.verify-confirm{flex-wrap:wrap;gap:8px;display:flex}.dialog .verify-figures th,.dialog .verify-pins th{text-align:left;color:var(--muted);padding:0 8px 0 0;font-weight:400}.dialog .verify-figures td:first-child,.dialog .verify-pins td:first-child{width:auto;color:var(--text)}.verify-kind{border:1px solid var(--line-strong);border-radius:3px;margin-left:6px;padding:0 4px;font-weight:600}.verify-power .verify-kind{color:var(--danger-text)}.verify-ground .verify-kind,.verify-pads,.verify-missing{color:var(--muted)}.verify-items{gap:6px;margin:0;padding:0;list-style:none;display:grid}.verify-items label{overflow-wrap:anywhere;align-items:flex-start;gap:6px;display:flex}.verify-count{color:var(--muted);margin:0}.verify-mark{grid-template-columns:110px minmax(0,1fr);align-items:center;gap:8px;display:grid}.verify-mark button{grid-column:2;justify-self:end}.verify-missing-line{color:var(--muted);grid-column:1/-1;justify-self:end;margin:0}.verify-missing-line:empty{display:none}.verify-url{overflow-wrap:anywhere}.verify-open{justify-self:start}.verify-pdf{border:1px solid var(--line);background:var(--panel);border-radius:4px;width:100%;height:60vh}
@@ -0,0 +1,2 @@
1
+ import{A as e,C as t,O as n,S as r,b as i,k as a,x as o,y as s}from"./index-BUjGdMvr.js";var c=e(),l=/^- \[([ xX])\] (.*?)\r?$/,u=/^Content: ([0-9a-f]{12})\b/m,d=12;function f(e){return e.split(`
2
+ `).flatMap(e=>{let t=l.exec(e);return t?[{text:t[2]??``,ticked:t[1]!==` `}]:[]})}function p(e){return u.exec(e)?.[1]}function m(e,t){return p(e)===t.slice(0,d)}var h=/^Pin (\S+) is /;function g(e,t,n,r){let i=m(e,t),a=f(e),o=a.map(e=>i?e:{...e,ticked:!1}),c=new Map;for(let e of o){let t=h.exec(e.text)?.[1];t!==void 0&&n[t]!==void 0&&!c.has(t)&&c.set(t,e)}let l=Object.entries(n).sort(([e],[t])=>s(e,t)).map(([e,t])=>{let n=c.get(e);return{number:e,name:t.name,type:t.type.replace(`_`,` `),kind:_(t.type),pads:r?.pads.filter(t=>t.number===e).length??0,...n?{item:n}:{}}}),u=new Set(c.values());return{pins:l,others:o.filter(e=>!u.has(e)),total:o.length,open:o.filter(e=>!e.ticked).length,stale:!i&&a.some(e=>e.ticked)}}function _(e){return e===`power_in`||e===`power_out`?`Power`:e===`ground`?`Ground`:``}function v(e,t,n,r){return!r&&t.open===0&&n.by.trim()!==``&&n.against.trim()!==``&&n.confirm.trim()===e}function y(e,t,n,r){let i=[...r?[`a real footprint (this one is a placeholder)`]:[],...t.open>0?[`${t.open} item${t.open===1?``:`s`} open`]:[],...n.by.trim()===``?[`your name`]:[],...n.against.trim()===``?[`what it was checked against`]:[],...n.confirm.trim()===e?[]:[`type the id`]];return i.length===0?``:`Still missing: ${i.join(`; `)}.`}function b(e){return e.pins.flatMap(e=>e.item&&!e.item.ticked?[e.item.text]:[])}function x(e){let t=/^\s*(\d+)/.exec(e??``),n=t?Number(t[1]):void 0;return n!==void 0&&n>0?n:void 0}function S(e){try{return new URL(e).pathname.toLowerCase().endsWith(`.pdf`)}catch{return!1}}function C(e,t){let n=x(t);return n===void 0||!S(e)?e:`${e.replace(/#.*$/,``)}#page=${n}`}function w(e,t){let n=x(t);return n===void 0?e:`${e}#page=${n}`}function T(e,t){let n=e?.title??e?.url??e?.file??``;return n===``?``:t===void 0?n:`${n}, page(s) ${t}`}var E=`This part records no datasheet. Ask the agent to attach it (attach_datasheet), or add it to part.yaml: datasheet: { url: "https://…", title: "…" } and datasheet_pages: "3-4".`,D=n();function O({id:e,file:t,pages:n,frame:r,release:i}){let[a,o]=(0,c.useState)(),[s,l]=(0,c.useState)();return(0,c.useEffect)(()=>{let n,a=!0;return r(e,t).then(e=>{a?o(n=e):i(e)},e=>a&&l(e.message)),()=>{a=!1,n!==void 0&&i(n)}},[e,t,r,i]),s?(0,D.jsx)(`p`,{className:`note error`,role:`alert`,children:s}):a?(0,D.jsx)(`iframe`,{className:`verify-pdf`,title:`Datasheet ${t}`,src:w(a,n)}):(0,D.jsxs)(`p`,{className:`note`,children:[`Loading `,t,`…`]})}function k({id:e,datasheet:t,pages:n,frame:r,release:i}){return!t||t.url===void 0&&t.file===void 0?(0,D.jsxs)(`section`,{className:`verify-column`,"aria-label":`Datasheet`,children:[(0,D.jsx)(`h3`,{children:`Datasheet`}),(0,D.jsx)(`p`,{className:`note warn`,children:E})]}):(0,D.jsxs)(`section`,{className:`verify-column`,"aria-label":`Datasheet`,children:[(0,D.jsx)(`h3`,{children:`Datasheet`}),(0,D.jsxs)(`dl`,{className:`facts`,children:[t.title&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`dt`,{children:`Title`}),(0,D.jsx)(`dd`,{children:t.title})]}),t.url&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`dt`,{children:`Link`}),(0,D.jsx)(`dd`,{className:`verify-url`,children:t.url})]}),t.file&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`dt`,{children:`File`}),(0,D.jsx)(`dd`,{children:(0,D.jsx)(`code`,{children:t.file})})]}),(0,D.jsx)(`dt`,{children:`Pages`}),(0,D.jsx)(`dd`,{children:n??`not recorded`})]}),t.url&&(0,D.jsx)(`a`,{className:`verify-open`,href:C(t.url,n),target:`_blank`,rel:`noreferrer noopener`,children:`Open the datasheet`}),t.file&&(0,D.jsx)(O,{id:e,file:t.file,pages:n,frame:r,release:i})]})}var A=e=>Number(r(e));function j(e,t){let[n,r]=[t.x-e.x,t.y-e.y];return{dx:A(n),dy:A(r),straight:A(Math.hypot(n,r)),gap:A(i(e,t))}}function M(e,t){let n=j(e,t);return`Pad ${e.number} to pad ${t.number}: dx ${n.dx} mm, dy ${n.dy} mm, straight ${n.straight} mm, gap ${n.gap} mm`}function N(e,n){let i=t(e),a=e.drill===void 0?``:e.drill.width===e.drill.height?`, drill ${r(e.drill.width)} mm`:`, drill ${r(e.drill.width)} × ${r(e.drill.height)} mm`;return`Pad ${e.number}${n===void 0?``:`, ${n}`}: x ${r(e.x)} mm, y ${r(e.y)} mm, ${r(i.width)} × ${r(i.height)} mm${a}`}function P(e){return[...e].sort((e,t)=>s(e.number,t.number))}var F={board:a.background,pad:a.topCopper,throughPad:a.multiLayer,drill:a.drill,courtyard:a.topAssembly,silk:a.topSilk,origin:a.document,picked:a.highlight},I=1,L=`Hover over or focus a pad to read it. A click, Enter or Space picks it for the measure.`,R=`Pick two pads to measure between them.`;function z(e){let n=[...e.courtyard,{x:0,y:0},...e.pads.flatMap(e=>{let n=t(e);return[{x:e.x-n.width/2,y:e.y-n.height/2},{x:e.x+n.width/2,y:e.y+n.height/2}]})],[i,a]=[Math.min(...n.map(e=>e.x)),Math.max(...n.map(e=>e.x))],[o,s]=[Math.min(...n.map(e=>-e.y)),Math.max(...n.map(e=>-e.y))];return`${r(i-I)} ${r(o-I)} ${r(a-i+2)} ${r(s-o+2)}`}function B({pad:e,pin:t,picked:n,onShow:r,onPick:i}){let a=N(e,t),o=Math.max(.25,Math.min(e.width,e.height)*.5),s=t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),i(e))},c=e.shape===`circle`||e.shape===`oval`?(0,D.jsx)(`ellipse`,{rx:e.width/2,ry:e.height/2}):(0,D.jsx)(`rect`,{x:-e.width/2,y:-e.height/2,width:e.width,height:e.height,rx:e.cornerRadius??0});return(0,D.jsxs)(`g`,{className:`verify-pad`,role:`button`,tabIndex:0,"aria-label":a,"aria-pressed":n,onMouseEnter:()=>r(e),onFocus:()=>r(e),onClick:()=>i(e),onKeyDown:s,children:[(0,D.jsx)(`title`,{children:a}),(0,D.jsxs)(`g`,{transform:`translate(${e.x} ${-e.y}) rotate(${-e.rotation})`,fill:e.layers===`through`?F.throughPad:F.pad,stroke:n?F.picked:`none`,strokeWidth:.08,children:[c,e.drill&&(0,D.jsx)(`ellipse`,{rx:e.drill.width/2,ry:e.drill.height/2,fill:F.drill})]}),(0,D.jsx)(`text`,{x:e.x,y:-e.y+o/3,fontSize:o,textAnchor:`middle`,fill:F.origin,children:e.number})]})}function V({pads:e}){let n=e.find(e=>e.number===`1`);if(!n)return null;let r=t(n),i=Math.abs(n.x)>=Math.abs(n.y)?{x:Math.sign(n.x)||-1,y:0}:{x:0,y:Math.sign(n.y)||1},a={x:n.x+i.x*(r.width/2+.4),y:n.y+i.y*(r.height/2+.4)};return(0,D.jsx)(`circle`,{className:`verify-pin-one`,cx:a.x,cy:-a.y,r:.2,fill:F.silk,"aria-hidden":`true`})}function H({footprint:e,pins:t,picked:n,onShow:r,onPick:i}){let a=z(e),[o,s,c,l]=a.split(` `).map(Number),u=e.courtyard.map(e=>`${e.x},${-e.y}`).join(` `);return(0,D.jsxs)(`svg`,{className:`verify-drawing`,viewBox:a,role:`group`,"aria-label":`Footprint ${e.name}, top view, pad 1 marked with a dot`,children:[(0,D.jsx)(`rect`,{x:o,y:s,width:c,height:l,fill:F.board}),u!==``&&(0,D.jsx)(`polygon`,{points:u,fill:`none`,stroke:F.courtyard,strokeWidth:.05,strokeDasharray:`0.2 0.2`}),e.silkscreen.map((e,t)=>(0,D.jsx)(`polyline`,{points:e.map(e=>`${e.x},${-e.y}`).join(` `),fill:`none`,stroke:F.silk,strokeWidth:.1},t)),(0,D.jsx)(`path`,{d:`M -0.5 0 H 0.5 M 0 -0.5 V 0.5`,stroke:F.origin,strokeWidth:.05,"aria-hidden":`true`}),(0,D.jsx)(V,{pads:e.pads}),P(e.pads).map((e,a)=>(0,D.jsx)(B,{pad:e,pin:t[e.number]?.name,picked:n.includes(e),onShow:r,onPick:i},`${e.number}-${a}`))]})}function U({footprint:e,pins:t,placeholder:n,onPrint:r}){let[i,a]=(0,c.useState)(),[s,l]=(0,c.useState)([]),u=(0,c.useMemo)(()=>o(e.pads),[e]),d=e=>l(t=>t.includes(e)?t.filter(t=>t!==e):[...t.slice(-1),e]),[f,p]=s;return(0,D.jsxs)(`section`,{className:`verify-column`,"aria-label":`Footprint`,children:[(0,D.jsxs)(`h3`,{children:[`Footprint `,e.name]}),n&&(0,D.jsx)(`p`,{className:`note warn`,children:n}),(0,D.jsx)(H,{footprint:e,pins:t,picked:s,onShow:a,onPick:d}),(0,D.jsx)(`p`,{className:`verify-readout`,"aria-live":`polite`,children:i?N(i,t[i.number]?.name):L}),(0,D.jsx)(`p`,{className:`verify-readout`,"aria-live":`polite`,children:f&&p?M(f,p):f?`Pad ${f.number} picked; pick a second pad.`:R}),(0,D.jsxs)(`div`,{className:`verify-actions`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>l([]),disabled:s.length===0,children:`Clear the measure`}),(0,D.jsx)(`button`,{type:`button`,onClick:r,children:`Print at 1:1`})]}),(0,D.jsx)(`table`,{className:`verify-figures`,"aria-label":`Land pattern figures`,children:(0,D.jsx)(`tbody`,{children:u.map(e=>(0,D.jsxs)(`tr`,{children:[(0,D.jsx)(`th`,{scope:`row`,children:e.label}),(0,D.jsx)(`td`,{children:e.value})]},e.label))})}),(0,D.jsx)(`p`,{className:`hint`,children:`Courtyard dashed, origin a cross, pad 1 marked with a dot; mm, top view.`})]})}var W=`verification.md changed since the screen showed it; it shows the file as it is now.`,G=`The print window did not open; allow pop-ups for the Studio and try again.`;function K({label:e,ticked:t,off:n,onTick:r}){return(0,D.jsx)(`input`,{type:`checkbox`,"aria-label":e,checked:t,disabled:n,onChange:e=>r(e.target.checked)})}function q({items:e,off:t,onTick:n}){return(0,D.jsxs)(`table`,{className:`verify-pins`,"aria-label":`Pins`,children:[(0,D.jsx)(`thead`,{children:(0,D.jsxs)(`tr`,{children:[(0,D.jsx)(`th`,{scope:`col`,children:`Pad`}),(0,D.jsx)(`th`,{scope:`col`,children:`Name`}),(0,D.jsx)(`th`,{scope:`col`,children:`Type`}),(0,D.jsx)(`th`,{scope:`col`,children:`Checked`})]})}),(0,D.jsx)(`tbody`,{children:e.pins.map(e=>(0,D.jsxs)(`tr`,{className:e.kind===``?void 0:`verify-${e.kind.toLowerCase()}`,children:[(0,D.jsxs)(`td`,{children:[e.number,e.pads>1&&(0,D.jsxs)(`span`,{className:`verify-pads`,children:[` (`,e.pads,` pads)`]})]}),(0,D.jsx)(`td`,{children:e.name}),(0,D.jsxs)(`td`,{children:[e.type,e.kind!==``&&(0,D.jsx)(`span`,{className:`verify-kind`,children:e.kind})]}),(0,D.jsx)(`td`,{children:e.item?(0,D.jsx)(K,{label:`Pin ${e.number} ${e.name} matches the datasheet`,ticked:e.item.ticked,off:t,onTick:t=>n([e.item?.text??``],t)}):(0,D.jsx)(`span`,{className:`verify-missing`,children:`not in verification.md`})})]},e.number))})]})}function J({items:e,off:t,onTick:n}){let[r,i]=(0,c.useState)(!1),a=e.pins.flatMap(e=>e.item?[e.item.text]:[]);return a.length===0?null:r?(0,D.jsxs)(`div`,{className:`verify-confirm`,role:`group`,"aria-label":`Tick all pins`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>{i(!1),n(a,!0)},children:[`I compared all `,a.length,` pins with the datasheet`]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>i(!1),children:`Cancel`})]}):(0,D.jsx)(`button`,{type:`button`,onClick:()=>i(!0),disabled:t||b(e).length===0,children:`Tick all pins…`})}function Y({details:e,items:t,busy:n,onMark:r}){let{id:i,part:a}=e,[o,s]=(0,c.useState)({by:``,against:T(a.datasheet,a.datasheet_pages),confirm:``}),l=(0,c.useId)(),u=(e,t)=>s(n=>({...n,[e]:t})),d=v(i,t,o,e.placeholder!==void 0);return(0,D.jsxs)(`form`,{className:`verify-mark`,onSubmit:e=>{e.preventDefault(),d&&r({by:o.by.trim(),against:o.against.trim(),confirm:o.confirm})},children:[(0,D.jsx)(`label`,{htmlFor:`${l}-against`,children:`Checked against`}),(0,D.jsx)(`input`,{id:`${l}-against`,value:o.against,onChange:e=>u(`against`,e.target.value),placeholder:`Datasheet, revision, page`}),(0,D.jsx)(`label`,{htmlFor:`${l}-by`,children:`Your name`}),(0,D.jsx)(`input`,{id:`${l}-by`,value:o.by,onChange:e=>u(`by`,e.target.value)}),(0,D.jsxs)(`label`,{htmlFor:`${l}-confirm`,children:[`Type `,i,` to confirm`]}),(0,D.jsx)(`input`,{id:`${l}-confirm`,value:o.confirm,onChange:e=>u(`confirm`,e.target.value),spellCheck:!1}),(0,D.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!d||n,"aria-describedby":`${l}-missing`,children:`Mark verified`}),(0,D.jsx)(`p`,{id:`${l}-missing`,className:`verify-missing-line`,children:y(i,t,o,e.placeholder!==void 0)})]})}function X({details:e,items:t,busy:n,onTick:r,onMark:i}){let a=e.verified||n;return(0,D.jsxs)(`section`,{className:`verify-column`,"aria-label":`Pins and checklist`,children:[(0,D.jsx)(`h3`,{children:`Pins`}),(0,D.jsx)(q,{items:t,off:a,onTick:r}),!e.verified&&(0,D.jsx)(J,{items:t,off:a,onTick:r}),(0,D.jsx)(`h3`,{children:`Also check`}),t.others.length===0?(0,D.jsx)(`p`,{className:`note`,children:`Nothing else in verification.md.`}):(0,D.jsx)(`ul`,{className:`verify-items`,children:t.others.map(e=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(`label`,{children:[(0,D.jsx)(K,{label:e.text,ticked:e.ticked,off:a,onTick:t=>r([e.text],t)}),` `,e.text]})},e.text))}),!e.verified&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`p`,{className:`verify-count`,role:`status`,children:[t.total-t.open,` of `,t.total,` items ticked`,t.open===0?`; all checked`:``,`. Each tick is written to parts/`,e.id,`/verification.md, so you can stop and come back.`]}),e.placeholder&&(0,D.jsx)(`p`,{className:`note warn`,children:e.placeholder}),(0,D.jsx)(Y,{details:e,items:t,busy:n,onMark:i})]})]})}function Z({details:e,checklist:t,panel:n,busy:r,problem:i,onTick:a,onMark:o,onProblem:s}){let{part:c}=e,l=g(t,e.hash,c.pins,e.footprint),u=e.verified?c.verified:void 0,d=()=>{e.footprint&&!n.print(`${e.id} ${c.footprint}`,e.footprint)&&s(G)};return(0,D.jsxs)(`div`,{className:`verify-screen`,children:[(0,D.jsxs)(`div`,{className:`verify-notes`,children:[u&&(0,D.jsxs)(`p`,{className:`note ok`,children:[`Verified by `,u.by,` against `,u.against,` on `,u.date.slice(0,10),`. The screen is read-only: a change to part.yaml or footprint.yaml makes the part unverified again.`]}),!e.verified&&l.stale&&(0,D.jsx)(`p`,{className:`note warn`,children:`The part changed since these items were ticked: those ticks no longer count, and the next tick clears them from verification.md. Check each item again.`}),i&&(0,D.jsx)(`p`,{className:`note error`,role:`alert`,children:i})]}),e.footprint?(0,D.jsx)(U,{footprint:e.footprint,pins:c.pins,...e.placeholder?{placeholder:e.placeholder}:{},onPrint:d}):(0,D.jsxs)(`section`,{className:`verify-column`,"aria-label":`Footprint`,children:[(0,D.jsxs)(`h3`,{children:[`Footprint `,c.footprint]}),(0,D.jsx)(`p`,{className:`note error`,children:e.footprintError??`The footprint cannot be drawn.`})]}),(0,D.jsx)(X,{details:e,items:l,busy:r,onTick:a,onMark:o}),(0,D.jsx)(k,{id:e.id,datasheet:c.datasheet,pages:c.datasheet_pages,frame:n.frame,release:n.release})]})}function Q({panel:e,id:t}){let[n,r]=(0,c.useState)(),[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)(!1),[l,u]=(0,c.useState)(),d=(0,c.useCallback)(async()=>{let n=await e.load(t);r(n),a(n.checklist)},[e,t]);(0,c.useEffect)(()=>{d().catch(e=>u(e.message))},[d]);let f=async e=>{s(!0),u(void 0);try{await e()}catch(e){u(e.message)}finally{s(!1)}},p=(n,r)=>void f(async()=>{let o=await e.tick(t,n,r,i);`changed`in o?(a(o.changed),u(W)):a(o.checklist)}),m=n=>void f(async()=>{await e.mark(t,n),await d()});return n?(0,D.jsx)(Z,{details:n,checklist:i,panel:e,busy:o,...l?{problem:l}:{},onTick:p,onMark:m,onProblem:u}):l?(0,D.jsx)(`p`,{className:`note error`,role:`alert`,children:l}):(0,D.jsx)(`p`,{children:`Loading…`})}export{Q as VerifyPartForm};