@tscircuit/footprinter 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +256 -246
- package/dist/index.cjs.map +1 -1
- package/package.json +1 -1
- package/src/fn/dip.ts +12 -0
- package/src/footprinter.ts +1 -1
- package/tests/dip.test.ts +2 -2
package/package.json
CHANGED
package/src/fn/dip.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { AnySoupElement } from "@tscircuit/soup"
|
|
2
2
|
import { platedhole } from "../helpers/platedhole"
|
|
3
|
+
import { z } from "zod"
|
|
4
|
+
import { length } from "@tscircuit/soup"
|
|
5
|
+
|
|
6
|
+
const dip_def = z.object({
|
|
7
|
+
dip: z.literal(true),
|
|
8
|
+
num_pins: z.number(),
|
|
9
|
+
w: length,
|
|
10
|
+
p: length.optional(),
|
|
11
|
+
id: length.optional(),
|
|
12
|
+
od: length.optional(),
|
|
13
|
+
})
|
|
3
14
|
|
|
4
15
|
export const getCcwDipCoords = (
|
|
5
16
|
pinCount: number,
|
|
@@ -40,6 +51,7 @@ export const dip = (params: {
|
|
|
40
51
|
id?: string | number
|
|
41
52
|
od?: string | number
|
|
42
53
|
}): AnySoupElement[] => {
|
|
54
|
+
params = dip_def.parse(params)
|
|
43
55
|
const platedHoles: AnySoupElement[] = []
|
|
44
56
|
for (let i = 0; i < params.num_pins; i++) {
|
|
45
57
|
const { x, y } = getCcwDipCoords(
|
package/src/footprinter.ts
CHANGED
|
@@ -47,7 +47,7 @@ export const string = (def: string): Footprinter => {
|
|
|
47
47
|
let fp = footprinter()
|
|
48
48
|
|
|
49
49
|
const def_parts = def.split("_").map((s) => {
|
|
50
|
-
const m = s.match(/([a-z]+)([\(\d
|
|
50
|
+
const m = s.match(/([a-z]+)([\(\d\.\+].*)?/)
|
|
51
51
|
const [_, fn, v] = m ?? []
|
|
52
52
|
return { fn: m?.[1]!, v: m?.[2]! }
|
|
53
53
|
})
|
package/tests/dip.test.ts
CHANGED