@tscircuit/footprinter 0.0.16 → 0.0.17

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/biome.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
3
+ "organizeImports": {
4
+ "enabled": true
5
+ },
6
+ "linter": {
7
+ "enabled": true,
8
+ "rules": {
9
+ "recommended": true,
10
+ "style": {
11
+ "noNonNullAssertion": "off"
12
+ }
13
+ }
14
+ }
15
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/footprinter",
3
3
  "type": "module",
4
- "version": "0.0.16",
4
+ "version": "0.0.17",
5
5
  "description": "",
6
6
  "main": "dist/index.cjs",
7
7
  "scripts": {
@@ -12,6 +12,7 @@
12
12
  "author": "",
13
13
  "license": "ISC",
14
14
  "devDependencies": {
15
+ "@biomejs/biome": "^1.7.3",
15
16
  "@tscircuit/log-soup": "^1.0.1",
16
17
  "@tscircuit/soup": "^0.0.17",
17
18
  "@tscircuit/soup-util": "^0.0.11",
package/src/fn/quad.ts CHANGED
@@ -5,6 +5,7 @@ import type { NowDefined } from "../helpers/zod/now-defined"
5
5
  import { rectpad } from "../helpers/rectpad"
6
6
  import { pin_order_specifier } from "src/helpers/zod/pin-order-specifier"
7
7
  import { getQuadPinMap } from "src/helpers/get-quad-pin-map"
8
+ import { dim2d } from "src/helpers/zod/dim-2d"
8
9
 
9
10
  const base_quad_def = z.object({
10
11
  quad: z.literal(true),
@@ -17,6 +18,7 @@ const base_quad_def = z.object({
17
18
  p: length.default(length.parse("0.5mm")),
18
19
  pw: length.optional(),
19
20
  pl: length.optional(),
21
+ thermalpad: z.union([z.literal(true), dim2d]).optional(),
20
22
  })
21
23
 
22
24
  const quad_def = base_quad_def.transform((v) => {
@@ -86,15 +88,9 @@ export const getQuadCoords = (
86
88
  }
87
89
  }
88
90
 
89
- export const quad = (raw_params: {
90
- quad: true
91
- num_pins: number
92
- w: number
93
- l: number
94
- p?: number
95
- id?: string | number
96
- od?: string | number
97
- }): AnySoupElement[] => {
91
+ export const quad = (
92
+ raw_params: z.input<typeof quad_def>
93
+ ): AnySoupElement[] => {
98
94
  const params = quad_def.parse(raw_params)
99
95
  const pads: AnySoupElement[] = []
100
96
  const pin_map = getQuadPinMap(params)
@@ -111,14 +107,28 @@ export const quad = (raw_params: {
111
107
  params.p ?? 0.5
112
108
  )
113
109
 
114
- let pw = params.pw,
115
- pl = params.pl
110
+ let pw = params.pw
111
+ let pl = params.pl
116
112
  if (orientation === "vert") {
117
113
  ;[pw, pl] = [pl, pw]
118
114
  }
119
115
 
120
- const pn = pin_map[i + 1]
121
- pads.push(rectpad(pn!, x, y, pw, pl))
116
+ const pn = pin_map[i + 1]!
117
+ pads.push(rectpad(pn, x, y, pw, pl))
122
118
  }
119
+
120
+ if (params.thermalpad) {
121
+ if (typeof params.thermalpad === "boolean") {
122
+ const sidePinCount = params.num_pins / 4
123
+ const ibw = params.p * (sidePinCount - 1) + params.pw
124
+ const ibh = params.p * (sidePinCount - 1) + params.pw
125
+ pads.push(rectpad(["thermalpad"], 0, 0, ibw, ibh))
126
+ } else {
127
+ pads.push(
128
+ rectpad(["thermalpad"], 0, 0, params.thermalpad.x, params.thermalpad.y)
129
+ )
130
+ }
131
+ }
132
+
123
133
  return pads
124
134
  }
@@ -89,7 +89,7 @@ export const getQuadPinMap = ({
89
89
  // decrementing
90
90
  for (let i = 0; i < num_pins; i++) {
91
91
  pin_map.push(current_position_ccw_normal)
92
- if (ccw) {
92
+ if (ccw || !cw) {
93
93
  current_position_ccw_normal++
94
94
  if (current_position_ccw_normal > num_pins) {
95
95
  current_position_ccw_normal = 1
@@ -11,6 +11,14 @@ test("quad16_w4_l4_p0.4_pw0.25_pl0.4", async (t) => {
11
11
  t.pass()
12
12
  })
13
13
 
14
+ test("quad16_w4_l4_p0.4_pw0.25_pl0.4_thermalpad", async (t) => {
15
+ const { fp, logSoup } = await getTestFixture(t)
16
+ const soup = fp.string("quad16_w4_l4_p0.4_pw0.25_pl0.4_thermalpad").soup()
17
+
18
+ await logSoup(soup)
19
+ t.pass()
20
+ })
21
+
14
22
  // const ps = toPinPositionString(soup)
15
23
 
16
24
  // t.is(