@tscircuit/footprinter 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/ava.config.js +5 -0
- package/dist/index.cjs +11615 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +33 -0
- package/package.json +25 -0
- package/src/fn/bga.ts +71 -0
- package/src/fn/cap.ts +7 -0
- package/src/fn/diode.ts +8 -0
- package/src/fn/dip.ts +56 -0
- package/src/fn/led.ts +6 -0
- package/src/fn/res.ts +6 -0
- package/src/footprinter.ts +102 -0
- package/src/helpers/passive-fn.ts +175 -0
- package/src/helpers/platedhole.ts +21 -0
- package/src/helpers/rectpad.ts +20 -0
- package/src/helpers/zod/bga-def.ts +48 -0
- package/src/helpers/zod/dim-2d.ts +17 -0
- package/src/helpers/zod/function-call.ts +16 -0
- package/src/index.ts +1 -0
- package/tests/bga.test.ts +49 -0
- package/tests/cap.test.ts +30 -0
- package/tests/dip.test.ts +42 -0
- package/tests/fixtures/index.ts +30 -0
- package/tsconfig.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @tscircuit/footprinter
|
|
2
|
+
|
|
3
|
+
Footprinter is tscircuit's DSL and micro-builder for creating footprints
|
|
4
|
+
|
|
5
|
+
You can create very custom footprints using the `<footprint>` element, but the
|
|
6
|
+
compressability is poor. `footprinter` produces very short, low parameter
|
|
7
|
+
mini-programs for generating footprints, this makes it suitable for standardized
|
|
8
|
+
footprints.
|
|
9
|
+
|
|
10
|
+
Here are some example programs:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { fp } from "@tscircuit/footprinter"
|
|
14
|
+
|
|
15
|
+
fp.cap().w(0.4).h(0.2)
|
|
16
|
+
fp.cap().p(0.1).pw(0.1).ph(0.1) // pitch, pad width and pad height
|
|
17
|
+
fp.cap().metric("0402")
|
|
18
|
+
fp.res().imperial("01005")
|
|
19
|
+
fp.dip(4).w(7.62)
|
|
20
|
+
fp.dip(4).w(7.62).socket()
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Footprinter Strings
|
|
24
|
+
|
|
25
|
+
A footprinter string is a string that maps to a set of builder calls.
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { fp } from "@tscircuit/footprinter"
|
|
29
|
+
|
|
30
|
+
fp.string("dip4_w7.62") // same as fp.dip(4).w(7.62)
|
|
31
|
+
fp.string("dip4_w7.62mm") // same as fp.dip(4).w(7.62)
|
|
32
|
+
fp.string("dip4_w0.3in") // same as fp.dip(4).w("0.3in")
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Magic
|
|
36
|
+
|
|
37
|
+
`footprinter` comes with a `fp.magic` function which calls a remote server that
|
|
38
|
+
attempts to convert the specified string into a `footprinter` string. This can
|
|
39
|
+
help when you're looking at a random package designator from an online site. You
|
|
40
|
+
should always confirm these footprints against the datasheet.
|
|
41
|
+
|
|
42
|
+
## Generation Defaults
|
|
43
|
+
|
|
44
|
+
- Pins are CCW starting at the top left
|
|
45
|
+
- Y is upward-positive, X is rightward-positive
|