copperflow 0.4.0 → 0.4.2

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 (361) hide show
  1. package/README.md +21 -4
  2. package/dist/app/assets/NewPartDialog-PSXlbLR2.js +1 -0
  3. package/dist/app/assets/PackagesDialog-C8ZyWl-g.css +1 -0
  4. package/dist/app/assets/PackagesDialog-DmIT8b2D.js +2 -0
  5. package/dist/app/assets/{VerifyPartDialog-Ey6xpQ_U.js → VerifyPartDialog-KiW1nDnZ.js} +2 -2
  6. package/dist/app/assets/footprint-preview-oJ27yBAB.js +160 -0
  7. package/dist/app/assets/index-CArKmuM_.css +1 -0
  8. package/dist/app/assets/index-Yj6ATP2T.js +20 -0
  9. package/dist/app/assets/texture-worker-e8zKC6dv.js +1 -0
  10. package/dist/app/index.html +2 -2
  11. package/dist/cli-commands.d.ts +2 -0
  12. package/dist/cli-commands.js +45 -0
  13. package/dist/cli-commands.js.map +1 -1
  14. package/dist/cli-graphic.d.ts +9 -0
  15. package/dist/cli-graphic.js +62 -0
  16. package/dist/cli-graphic.js.map +1 -0
  17. package/dist/core/annotations.js +2 -2
  18. package/dist/core/annotations.js.map +1 -1
  19. package/dist/core/board-edits.d.ts +2 -0
  20. package/dist/core/board-edits.js +14 -0
  21. package/dist/core/board-edits.js.map +1 -1
  22. package/dist/core/board-graphic-edits.d.ts +8 -0
  23. package/dist/core/board-graphic-edits.js +88 -0
  24. package/dist/core/board-graphic-edits.js.map +1 -0
  25. package/dist/core/board-items.d.ts +6 -0
  26. package/dist/core/board-items.js +8 -3
  27. package/dist/core/board-items.js.map +1 -1
  28. package/dist/core/board-shape-edit.js +4 -2
  29. package/dist/core/board-shape-edit.js.map +1 -1
  30. package/dist/core/edit.js +17 -1
  31. package/dist/core/edit.js.map +1 -1
  32. package/dist/core/graphic-import.d.ts +43 -0
  33. package/dist/core/graphic-import.js +142 -0
  34. package/dist/core/graphic-import.js.map +1 -0
  35. package/dist/core/html-export.d.ts +37 -0
  36. package/dist/core/html-export.js +139 -0
  37. package/dist/core/html-export.js.map +1 -0
  38. package/dist/core/html-page.d.ts +39 -0
  39. package/dist/core/html-page.js +114 -0
  40. package/dist/core/html-page.js.map +1 -0
  41. package/dist/core/html-style.d.ts +3 -0
  42. package/dist/core/html-style.js +117 -0
  43. package/dist/core/html-style.js.map +1 -0
  44. package/dist/core/model-export.d.ts +33 -0
  45. package/dist/core/model-export.js +36 -0
  46. package/dist/core/model-export.js.map +1 -0
  47. package/dist/core/out-name.d.ts +5 -0
  48. package/dist/core/out-name.js +10 -0
  49. package/dist/core/out-name.js.map +1 -0
  50. package/dist/core/packages.d.ts +22 -0
  51. package/dist/core/packages.js +64 -0
  52. package/dist/core/packages.js.map +1 -0
  53. package/dist/core/pad-lines.d.ts +7 -0
  54. package/dist/core/pad-lines.js +15 -0
  55. package/dist/core/pad-lines.js.map +1 -0
  56. package/dist/core/pour-edits.d.ts +12 -1
  57. package/dist/core/pour-edits.js +6 -6
  58. package/dist/core/pour-edits.js.map +1 -1
  59. package/dist/core/render.d.ts +2 -1
  60. package/dist/core/render.js.map +1 -1
  61. package/dist/core/rules-patch.d.ts +17 -0
  62. package/dist/core/rules-patch.js +102 -0
  63. package/dist/core/rules-patch.js.map +1 -0
  64. package/dist/core/silk-text-edits.d.ts +8 -0
  65. package/dist/core/silk-text-edits.js +72 -0
  66. package/dist/core/silk-text-edits.js.map +1 -0
  67. package/dist/core/step-export.js +3 -0
  68. package/dist/core/step-export.js.map +1 -1
  69. package/dist/core/types.d.ts +55 -3
  70. package/dist/engine/board-graphic.d.ts +49 -0
  71. package/dist/engine/board-graphic.js +175 -0
  72. package/dist/engine/board-graphic.js.map +1 -0
  73. package/dist/engine/checks/copper-clearance.d.ts +1 -1
  74. package/dist/engine/checks/copper-clearance.js +19 -1
  75. package/dist/engine/checks/copper-clearance.js.map +1 -1
  76. package/dist/engine/checks/copper-pieces.d.ts +8 -2
  77. package/dist/engine/checks/copper-pieces.js +23 -2
  78. package/dist/engine/checks/copper-pieces.js.map +1 -1
  79. package/dist/engine/checks/drc-board-graphic.d.ts +10 -0
  80. package/dist/engine/checks/drc-board-graphic.js +95 -0
  81. package/dist/engine/checks/drc-board-graphic.js.map +1 -0
  82. package/dist/engine/checks/drc-parts.js +3 -1
  83. package/dist/engine/checks/drc-parts.js.map +1 -1
  84. package/dist/engine/checks/drc-pours.js +3 -3
  85. package/dist/engine/checks/drc-pours.js.map +1 -1
  86. package/dist/engine/checks/drc-silk-text.d.ts +15 -0
  87. package/dist/engine/checks/drc-silk-text.js +65 -0
  88. package/dist/engine/checks/drc-silk-text.js.map +1 -0
  89. package/dist/engine/checks/fill-point.d.ts +7 -0
  90. package/dist/engine/checks/fill-point.js +58 -0
  91. package/dist/engine/checks/fill-point.js.map +1 -0
  92. package/dist/engine/checks/stranded-copper.d.ts +14 -0
  93. package/dist/engine/checks/stranded-copper.js +43 -0
  94. package/dist/engine/checks/stranded-copper.js.map +1 -0
  95. package/dist/engine/design.js +1 -1
  96. package/dist/engine/design.js.map +1 -1
  97. package/dist/engine/elaborate.d.ts +2 -0
  98. package/dist/engine/elaborate.js +30 -1
  99. package/dist/engine/elaborate.js.map +1 -1
  100. package/dist/engine/engine.d.ts +4 -1
  101. package/dist/engine/engine.js +5 -2
  102. package/dist/engine/engine.js.map +1 -1
  103. package/dist/engine/fab/graphic-objects.d.ts +7 -0
  104. package/dist/engine/fab/graphic-objects.js +24 -0
  105. package/dist/engine/fab/graphic-objects.js.map +1 -0
  106. package/dist/engine/fab/layers.d.ts +9 -0
  107. package/dist/engine/fab/layers.js +60 -8
  108. package/dist/engine/fab/layers.js.map +1 -1
  109. package/dist/engine/fab/silk-text-strokes.d.ts +16 -0
  110. package/dist/engine/fab/silk-text-strokes.js +28 -0
  111. package/dist/engine/fab/silk-text-strokes.js.map +1 -0
  112. package/dist/engine/fab/stroke-font.d.ts +4 -0
  113. package/dist/engine/fab/stroke-font.js +38 -1
  114. package/dist/engine/fab/stroke-font.js.map +1 -1
  115. package/dist/engine/footprints/array.d.ts +4 -0
  116. package/dist/engine/footprints/array.js +51 -0
  117. package/dist/engine/footprints/array.js.map +1 -0
  118. package/dist/engine/footprints/axial.d.ts +6 -0
  119. package/dist/engine/footprints/axial.js +115 -0
  120. package/dist/engine/footprints/axial.js.map +1 -0
  121. package/dist/engine/footprints/catalogue.d.ts +39 -0
  122. package/dist/engine/footprints/catalogue.js +284 -0
  123. package/dist/engine/footprints/catalogue.js.map +1 -0
  124. package/dist/engine/footprints/chip.js +10 -1
  125. package/dist/engine/footprints/chip.js.map +1 -1
  126. package/dist/engine/footprints/connector.d.ts +16 -0
  127. package/dist/engine/footprints/connector.js +31 -0
  128. package/dist/engine/footprints/connector.js.map +1 -0
  129. package/dist/engine/footprints/dcjack.d.ts +3 -0
  130. package/dist/engine/footprints/dcjack.js +46 -0
  131. package/dist/engine/footprints/dcjack.js.map +1 -0
  132. package/dist/engine/footprints/dpak.d.ts +7 -0
  133. package/dist/engine/footprints/dpak.js +172 -0
  134. package/dist/engine/footprints/dpak.js.map +1 -0
  135. package/dist/engine/footprints/dual.d.ts +11 -2
  136. package/dist/engine/footprints/dual.js +113 -12
  137. package/dist/engine/footprints/dual.js.map +1 -1
  138. package/dist/engine/footprints/index.js +46 -3
  139. package/dist/engine/footprints/index.js.map +1 -1
  140. package/dist/engine/footprints/inductor.d.ts +3 -0
  141. package/dist/engine/footprints/inductor.js +32 -0
  142. package/dist/engine/footprints/inductor.js.map +1 -0
  143. package/dist/engine/footprints/known.js +114 -14
  144. package/dist/engine/footprints/known.js.map +1 -1
  145. package/dist/engine/footprints/ledsmd.d.ts +3 -0
  146. package/dist/engine/footprints/ledsmd.js +52 -0
  147. package/dist/engine/footprints/ledsmd.js.map +1 -0
  148. package/dist/engine/footprints/ledth.d.ts +4 -0
  149. package/dist/engine/footprints/ledth.js +45 -0
  150. package/dist/engine/footprints/ledth.js.map +1 -0
  151. package/dist/engine/footprints/melf.d.ts +8 -0
  152. package/dist/engine/footprints/melf.js +56 -0
  153. package/dist/engine/footprints/melf.js.map +1 -0
  154. package/dist/engine/footprints/pad-roles.d.ts +4 -0
  155. package/dist/engine/footprints/pad-roles.js +32 -0
  156. package/dist/engine/footprints/pad-roles.js.map +1 -0
  157. package/dist/engine/footprints/plcc.d.ts +4 -0
  158. package/dist/engine/footprints/plcc.js +117 -0
  159. package/dist/engine/footprints/plcc.js.map +1 -0
  160. package/dist/engine/footprints/resonator.d.ts +3 -0
  161. package/dist/engine/footprints/resonator.js +33 -0
  162. package/dist/engine/footprints/resonator.js.map +1 -0
  163. package/dist/engine/footprints/screw.d.ts +3 -0
  164. package/dist/engine/footprints/screw.js +51 -0
  165. package/dist/engine/footprints/screw.js.map +1 -0
  166. package/dist/engine/footprints/smallsot.d.ts +8 -0
  167. package/dist/engine/footprints/smallsot.js +143 -0
  168. package/dist/engine/footprints/smallsot.js.map +1 -0
  169. package/dist/engine/footprints/smdbox.d.ts +33 -0
  170. package/dist/engine/footprints/smdbox.js +76 -0
  171. package/dist/engine/footprints/smdbox.js.map +1 -0
  172. package/dist/engine/footprints/smdcan.d.ts +3 -0
  173. package/dist/engine/footprints/smdcan.js +61 -0
  174. package/dist/engine/footprints/smdcan.js.map +1 -0
  175. package/dist/engine/footprints/smdip.d.ts +4 -0
  176. package/dist/engine/footprints/smdip.js +58 -0
  177. package/dist/engine/footprints/smdip.js.map +1 -0
  178. package/dist/engine/footprints/socket.d.ts +8 -0
  179. package/dist/engine/footprints/socket.js +21 -0
  180. package/dist/engine/footprints/socket.js.map +1 -0
  181. package/dist/engine/footprints/sod.d.ts +6 -0
  182. package/dist/engine/footprints/sod.js +63 -6
  183. package/dist/engine/footprints/sod.js.map +1 -1
  184. package/dist/engine/footprints/sot.d.ts +1 -1
  185. package/dist/engine/footprints/sot.js +17 -2
  186. package/dist/engine/footprints/sot.js.map +1 -1
  187. package/dist/engine/footprints/tact.d.ts +3 -0
  188. package/dist/engine/footprints/tact.js +65 -0
  189. package/dist/engine/footprints/tact.js.map +1 -0
  190. package/dist/engine/footprints/tantalum.d.ts +7 -0
  191. package/dist/engine/footprints/tantalum.js +91 -0
  192. package/dist/engine/footprints/tantalum.js.map +1 -0
  193. package/dist/engine/footprints/to92inline.d.ts +14 -0
  194. package/dist/engine/footprints/to92inline.js +21 -0
  195. package/dist/engine/footprints/to92inline.js.map +1 -0
  196. package/dist/engine/footprints/topower.d.ts +7 -0
  197. package/dist/engine/footprints/topower.js +119 -0
  198. package/dist/engine/footprints/topower.js.map +1 -0
  199. package/dist/engine/footprints/usb.d.ts +32 -0
  200. package/dist/engine/footprints/usb.js +109 -0
  201. package/dist/engine/footprints/usb.js.map +1 -0
  202. package/dist/engine/footprints/xtal.d.ts +4 -0
  203. package/dist/engine/footprints/xtal.js +61 -0
  204. package/dist/engine/footprints/xtal.js.map +1 -0
  205. package/dist/engine/graphic-place.d.ts +34 -0
  206. package/dist/engine/graphic-place.js +132 -0
  207. package/dist/engine/graphic-place.js.map +1 -0
  208. package/dist/engine/graphics/curves.d.ts +18 -0
  209. package/dist/engine/graphics/curves.js +75 -0
  210. package/dist/engine/graphics/curves.js.map +1 -0
  211. package/dist/engine/graphics/dxf-entities.d.ts +20 -0
  212. package/dist/engine/graphics/dxf-entities.js +184 -0
  213. package/dist/engine/graphics/dxf-entities.js.map +1 -0
  214. package/dist/engine/graphics/dxf-pairs.d.ts +22 -0
  215. package/dist/engine/graphics/dxf-pairs.js +77 -0
  216. package/dist/engine/graphics/dxf-pairs.js.map +1 -0
  217. package/dist/engine/graphics/dxf.d.ts +5 -0
  218. package/dist/engine/graphics/dxf.js +110 -0
  219. package/dist/engine/graphics/dxf.js.map +1 -0
  220. package/dist/engine/graphics/index.d.ts +9 -0
  221. package/dist/engine/graphics/index.js +30 -0
  222. package/dist/engine/graphics/index.js.map +1 -0
  223. package/dist/engine/graphics/path-data.d.ts +12 -0
  224. package/dist/engine/graphics/path-data.js +162 -0
  225. package/dist/engine/graphics/path-data.js.map +1 -0
  226. package/dist/engine/graphics/rings.d.ts +7 -0
  227. package/dist/engine/graphics/rings.js +93 -0
  228. package/dist/engine/graphics/rings.js.map +1 -0
  229. package/dist/engine/graphics/shapes.d.ts +47 -0
  230. package/dist/engine/graphics/shapes.js +85 -0
  231. package/dist/engine/graphics/shapes.js.map +1 -0
  232. package/dist/engine/graphics/svg-attributes.d.ts +26 -0
  233. package/dist/engine/graphics/svg-attributes.js +116 -0
  234. package/dist/engine/graphics/svg-attributes.js.map +1 -0
  235. package/dist/engine/graphics/svg.d.ts +5 -0
  236. package/dist/engine/graphics/svg.js +118 -0
  237. package/dist/engine/graphics/svg.js.map +1 -0
  238. package/dist/engine/graphics/transform.d.ts +21 -0
  239. package/dist/engine/graphics/transform.js +88 -0
  240. package/dist/engine/graphics/transform.js.map +1 -0
  241. package/dist/engine/graphics/xml.d.ts +10 -0
  242. package/dist/engine/graphics/xml.js +130 -0
  243. package/dist/engine/graphics/xml.js.map +1 -0
  244. package/dist/engine/model.d.ts +55 -0
  245. package/dist/engine/model.js.map +1 -1
  246. package/dist/engine/pcb-place/grow.d.ts +12 -0
  247. package/dist/engine/pcb-place/grow.js +100 -0
  248. package/dist/engine/pcb-place/grow.js.map +1 -0
  249. package/dist/engine/pcb.d.ts +5 -1
  250. package/dist/engine/pcb.js +2 -0
  251. package/dist/engine/pcb.js.map +1 -1
  252. package/dist/engine/pour/cache.js +1 -0
  253. package/dist/engine/pour/cache.js.map +1 -1
  254. package/dist/engine/pour/obstacles.js +18 -1
  255. package/dist/engine/pour/obstacles.js.map +1 -1
  256. package/dist/engine/router/route-board.d.ts +2 -0
  257. package/dist/engine/router/route-board.js +7 -2
  258. package/dist/engine/router/route-board.js.map +1 -1
  259. package/dist/engine/router/unplaced.d.ts +18 -0
  260. package/dist/engine/router/unplaced.js +27 -0
  261. package/dist/engine/router/unplaced.js.map +1 -0
  262. package/dist/engine/rules/rotations.d.ts +12 -3
  263. package/dist/engine/rules/rotations.js +77 -2
  264. package/dist/engine/rules/rotations.js.map +1 -1
  265. package/dist/engine/silk-text.d.ts +40 -0
  266. package/dist/engine/silk-text.js +85 -0
  267. package/dist/engine/silk-text.js.map +1 -0
  268. package/dist/engine/solid/heights-smd.d.ts +3 -0
  269. package/dist/engine/solid/heights-smd.js +81 -0
  270. package/dist/engine/solid/heights-smd.js.map +1 -0
  271. package/dist/engine/solid/heights-through.d.ts +7 -0
  272. package/dist/engine/solid/heights-through.js +93 -0
  273. package/dist/engine/solid/heights-through.js.map +1 -0
  274. package/dist/engine/solid/heights-uno.d.ts +2 -0
  275. package/dist/engine/solid/heights-uno.js +15 -0
  276. package/dist/engine/solid/heights-uno.js.map +1 -0
  277. package/dist/engine/solid/heights.d.ts +2 -0
  278. package/dist/engine/solid/heights.js +43 -18
  279. package/dist/engine/solid/heights.js.map +1 -1
  280. package/dist/library/attach-datasheet.d.ts +2 -0
  281. package/dist/library/attach-datasheet.js +1 -1
  282. package/dist/library/attach-datasheet.js.map +1 -1
  283. package/dist/library/part-fields.d.ts +23 -0
  284. package/dist/library/part-fields.js +55 -0
  285. package/dist/library/part-fields.js.map +1 -0
  286. package/dist/mcp/batch-steps.d.ts +33 -0
  287. package/dist/mcp/batch-steps.js +211 -0
  288. package/dist/mcp/batch-steps.js.map +1 -0
  289. package/dist/mcp/batch.d.ts +16 -0
  290. package/dist/mcp/batch.js +18 -5
  291. package/dist/mcp/batch.js.map +1 -1
  292. package/dist/mcp/board-import-tool.d.ts +1 -1
  293. package/dist/mcp/board-import-tool.js +1 -1
  294. package/dist/mcp/board-import-tool.js.map +1 -1
  295. package/dist/mcp/board-summary.d.ts +1 -1
  296. package/dist/mcp/board-summary.js +32 -1
  297. package/dist/mcp/board-summary.js.map +1 -1
  298. package/dist/mcp/board-tool.d.ts +36 -0
  299. package/dist/mcp/board-tool.js +109 -0
  300. package/dist/mcp/board-tool.js.map +1 -0
  301. package/dist/mcp/copper-summary.d.ts +2 -0
  302. package/dist/mcp/copper-summary.js +10 -2
  303. package/dist/mcp/copper-summary.js.map +1 -1
  304. package/dist/mcp/copper-tools.d.ts +1 -1
  305. package/dist/mcp/copper-tools.js +1 -1
  306. package/dist/mcp/copper-tools.js.map +1 -1
  307. package/dist/mcp/create-part.js +2 -2
  308. package/dist/mcp/create-part.js.map +1 -1
  309. package/dist/mcp/graphic-tool.d.ts +34 -0
  310. package/dist/mcp/graphic-tool.js +29 -0
  311. package/dist/mcp/graphic-tool.js.map +1 -0
  312. package/dist/mcp/guide.d.ts +3 -1
  313. package/dist/mcp/guide.js +15 -4
  314. package/dist/mcp/guide.js.map +1 -1
  315. package/dist/mcp/html-tool.d.ts +28 -0
  316. package/dist/mcp/html-tool.js +21 -0
  317. package/dist/mcp/html-tool.js.map +1 -0
  318. package/dist/mcp/model-tool.d.ts +31 -0
  319. package/dist/mcp/model-tool.js +27 -0
  320. package/dist/mcp/model-tool.js.map +1 -0
  321. package/dist/mcp/new-circuit.d.ts +1 -1
  322. package/dist/mcp/new-circuit.js +10 -11
  323. package/dist/mcp/new-circuit.js.map +1 -1
  324. package/dist/mcp/part-tools.d.ts +20 -0
  325. package/dist/mcp/part-tools.js +40 -0
  326. package/dist/mcp/part-tools.js.map +1 -0
  327. package/dist/mcp/place-tools.d.ts +1 -1
  328. package/dist/mcp/place-tools.js +11 -5
  329. package/dist/mcp/place-tools.js.map +1 -1
  330. package/dist/mcp/project-tools.js +2 -0
  331. package/dist/mcp/project-tools.js.map +1 -1
  332. package/dist/mcp/render-tool.d.ts +2 -0
  333. package/dist/mcp/render-tool.js +32 -1
  334. package/dist/mcp/render-tool.js.map +1 -1
  335. package/dist/mcp/route-tools.d.ts +1 -1
  336. package/dist/mcp/route-tools.js +3 -1
  337. package/dist/mcp/route-tools.js.map +1 -1
  338. package/dist/mcp/rules-tool.d.ts +19 -0
  339. package/dist/mcp/rules-tool.js +73 -0
  340. package/dist/mcp/rules-tool.js.map +1 -0
  341. package/dist/mcp/server.js +53 -17
  342. package/dist/mcp/server.js.map +1 -1
  343. package/dist/mcp/text-tool.d.ts +34 -0
  344. package/dist/mcp/text-tool.js +37 -0
  345. package/dist/mcp/text-tool.js.map +1 -0
  346. package/dist/render/render.js +2335 -389
  347. package/dist/studio/server.js +32 -0
  348. package/dist/studio/server.js.map +1 -1
  349. package/dist/version.d.ts +1 -1
  350. package/dist/version.js +1 -1
  351. package/package.json +2 -1
  352. package/skills/copperflow/SKILL.md +8 -8
  353. package/skills/copperflow/references/copper.md +9 -1
  354. package/skills/copperflow/references/design-rules.md +36 -7
  355. package/skills/copperflow/references/editable-subset.md +18 -8
  356. package/skills/copperflow/references/parts-library.md +19 -1
  357. package/skills/copperflow/references/writing-circuits.md +71 -0
  358. package/dist/app/assets/NewPartDialog-BBJaZFCo.js +0 -160
  359. package/dist/app/assets/index-BKoIKo22.css +0 -1
  360. package/dist/app/assets/index-DPmr2dR1.js +0 -20
  361. package/dist/app/assets/texture-worker-CyI_g_XZ.js +0 -1
package/README.md CHANGED
@@ -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
@@ -225,9 +226,15 @@ picture of each side of the board. A circuit with errors is refused.
225
226
  fabrication layer is drawn by itself, from the same data the Gerbers are written from, and they are
226
227
  put together as mask, finish, print and holes, in the maker's usual colours (`--mask`, `--finish`,
227
228
  `--silk`). `--view 3d` and the Studio's 3D tab lay that picture on the board and stand the parts on
228
- it. The parts are simple shapes, not their real models, in the 3D view and in the STEP file; a part's
229
- height comes from its `height` in `part.yaml`, else a typical figure for its package, else 1 mm, and
230
- the view says which.
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. `copperflow html <file>` (MCP `export_html`) writes the whole design as
232
+ one web page to hand to someone: every schematic page, the PCB view, the board as made top and bottom,
233
+ 3D from three angles and the BOM as a table, with the fabrication zip, the GLB, the STEP file and the
234
+ BOM as CSV inside it as downloads. It opens from disk with no network; a design with errors is written
235
+ too, without the fabrication files, and says why. The parts are simple shapes, not their real models, in the 3D
236
+ view, the GLB file and the STEP file; a part's height comes from its `height` in `part.yaml`, else a
237
+ typical figure for its package, else 1 mm, and the view says which.
231
238
 
232
239
  **Fast lines.** Net classes in `rules.yaml` take an impedance, a differential pair with its gap and
233
240
  skew, a longest length and length-matched groups; the checks report a pair that runs apart or differs
@@ -264,6 +271,8 @@ parts, nets, tracks, vias and pours. The parts arrive as library parts, not veri
264
271
  | `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 |
265
272
  | `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 |
266
273
  | `export_fabrication` | Writes the fabrication files, the STEP model and the board's pictures; refused when the circuit has errors |
274
+ | `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 |
275
+ | `export_html` | Writes the design as one web page (schematic, board, 3D, BOM, with the fabrication and model files inside) to hand to a person; opens offline |
267
276
  | `attach_datasheet` / `guide` | Records the datasheet a part came from; and the copperflow skill's texts for an agent that has no skills |
268
277
  | `edit_circuit` | Several edits in one call, applied as one change (one history entry); stops at the first refused edit and writes nothing |
269
278
  | `connect_nets` | Connects many pins to named nets in one call, e.g. `{ "GND": ["R1.pin2", "C1.pin2"] }` |
@@ -318,6 +327,8 @@ copperflow library add <name> <address or folder> [--ref <branch or tag>]
318
327
  or a folder; its modules read NOT verified until you verify them
319
328
  copperflow library update [name] bring git libraries to the newest commit of their ref
320
329
  copperflow library remove <name> forget a library (a clone is deleted, a folder never)
330
+ copperflow packages [words...] the standard packages with their footprint strings, pads and size
331
+ (words narrow the list: soic, sot 5, sc70, crystal)
321
332
  copperflow place <file> <part> <name> [key=value ...]
322
333
  add a library or built-in part to a circuit
323
334
  copperflow bom <file> [--csv] print the bill of materials
@@ -330,6 +341,12 @@ copperflow export <file> [--out dir] write the fabrication files for JLCP
330
341
  beside the circuit (or in the project folder --out), with <name>.step
331
342
  copperflow step <file> [--out file.step] write the board and its parts (as boxes) as a STEP file for CAD,
332
343
  <name>.step beside the circuit
344
+ copperflow glb <file> [--out file.glb] [--mask black] [--finish hasl] [--silk black]
345
+ write the board as made and its parts (as simple shapes) as a GLB
346
+ file a 3D viewer turns, <name>.glb beside the circuit
347
+ copperflow html <file> [--out file.html] [--mask black] [--finish hasl] [--silk black]
348
+ write the design as one web page with its files inside,
349
+ <name>.html beside the circuit
333
350
  copperflow render <file> [--view pcb|schematic|board|3d] [--page <name>] [--parts U1,C3] [--width n] [--out file.png]
334
351
  board: the bare board as made [--side bottom] [--mask black] [--finish hasl] [--silk black] [--background #rrggbb]
335
352
  3d: the board as made with its parts as simple shapes [--angle top|bottom|front|iso] and the same look options
@@ -0,0 +1 @@
1
+ import{A as e,O as t,k as n,v as r,w as i}from"./index-Yj6ATP2T.js";import{n as a,t as o}from"./footprint-preview-oJ27yBAB.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-Yj6ATP2T.js";import{n as x,t as S}from"./footprint-preview-oJ27yBAB.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};
@@ -1,2 +1,2 @@
1
- import{a as e,c as t,d as n,i as r,l as i,o as a,s as o,u as s}from"./index-DPmr2dR1.js";var c=n(),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,i){let a=m(e,t),o=f(e),s=o.map(e=>a?e:{...e,ticked:!1}),c=new Map;for(let e of s){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])=>r(e,t)).map(([e,t])=>{let n=c.get(e);return{number:e,name:t.name,type:t.type.replace(`_`,` `),kind:_(t.type),pads:i?.pads.filter(t=>t.number===e).length??0,...n?{item:n}:{}}}),u=new Set(c.values());return{pins:l,others:s.filter(e=>!u.has(e)),total:s.length,open:s.filter(e=>!e.ticked).length,stale:!a&&o.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=i();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(o(e));function j(t,n){let[r,i]=[n.x-t.x,n.y-t.y];return{dx:A(r),dy:A(i),straight:A(Math.hypot(r,i)),gap:A(e(t,n))}}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 r=t(e),i=e.drill===void 0?``:e.drill.width===e.drill.height?`, drill ${o(e.drill.width)} mm`:`, drill ${o(e.drill.width)} × ${o(e.drill.height)} mm`;return`Pad ${e.number}${n===void 0?``:`, ${n}`}: x ${o(e.x)} mm, y ${o(e.y)} mm, ${o(r.width)} × ${o(r.height)} mm${i}`}function P(e){return[...e].sort((e,t)=>r(e.number,t.number))}var F={board:s.background,pad:s.topCopper,throughPad:s.multiLayer,drill:s.drill,courtyard:s.topAssembly,silk:s.topSilk,origin:s.document,picked:s.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}]})],[r,i]=[Math.min(...n.map(e=>e.x)),Math.max(...n.map(e=>e.x))],[a,s]=[Math.min(...n.map(e=>-e.y)),Math.max(...n.map(e=>-e.y))];return`${o(r-I)} ${o(a-I)} ${o(i-r+2)} ${o(s-a+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,o]=(0,c.useState)(),[s,l]=(0,c.useState)([]),u=(0,c.useMemo)(()=>a(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:o,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};
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-Yj6ATP2T.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};