@tscircuit/props 0.0.207 → 0.0.209

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.
@@ -39,6 +39,7 @@ export const layoutConfig = z.object({
39
39
  height: length.optional(),
40
40
 
41
41
  matchAdapt: z.boolean().optional(),
42
+ matchAdaptTemplate: z.any().optional(),
42
43
  })
43
44
 
44
45
  export interface LayoutConfig {
@@ -65,6 +66,7 @@ export interface LayoutConfig {
65
66
  height?: Distance
66
67
 
67
68
  matchAdapt?: boolean
69
+ matchAdaptTemplate?: any
68
70
  }
69
71
 
70
72
  expectTypesMatch<LayoutConfig, z.input<typeof layoutConfig>>(true)
@@ -0,0 +1,52 @@
1
+ import { distance } from "circuit-json"
2
+ import {
3
+ type CommonComponentProps,
4
+ commonComponentProps,
5
+ } from "lib/common/layout"
6
+ import { expectTypesMatch } from "lib/typecheck"
7
+ import { z } from "zod"
8
+
9
+ export interface TestpointProps extends CommonComponentProps {
10
+ /**
11
+ * The footprint variant of the testpoint either a surface pad or through-hole
12
+ */
13
+ footprintVariant?: "pad" | "through_hole"
14
+ /**
15
+ * The shape of the pad if using a pad variant
16
+ */
17
+ padShape?: "rect" | "circle"
18
+ /**
19
+ * Diameter of the copper pad (applies to both SMD pads and plated holes)
20
+ */
21
+ padDiameter?: number | string
22
+ /**
23
+ * Diameter of the hole if using a through-hole testpoint
24
+ */
25
+ holeDiameter?: number | string
26
+ /**
27
+ * Width of the pad when padShape is rect
28
+ */
29
+ width?: number | string
30
+ /**
31
+ * Height of the pad when padShape is rect
32
+ */
33
+ height?: number | string
34
+ }
35
+
36
+ export const testpointProps = commonComponentProps
37
+ .extend({
38
+ footprintVariant: z.enum(["pad", "through_hole"]).optional().default("pad"),
39
+ padShape: z.enum(["rect", "circle"]).optional().default("circle"),
40
+ padDiameter: distance.optional(),
41
+ holeDiameter: distance.optional(),
42
+ width: distance.optional(),
43
+ height: distance.optional(),
44
+ })
45
+ .refine(
46
+ (props) =>
47
+ props.footprintVariant === "pad" || props.holeDiameter !== undefined,
48
+ { message: "holeDiameter is required for through_hole testpoints" },
49
+ )
50
+
51
+ export type InferredTestpointProps = z.input<typeof testpointProps>
52
+ expectTypesMatch<TestpointProps, InferredTestpointProps>(true)
package/lib/index.ts CHANGED
@@ -47,6 +47,7 @@ export * from "./components/fabrication-note-text"
47
47
  export * from "./components/fabrication-note-path"
48
48
  export * from "./components/pcb-trace"
49
49
  export * from "./components/via"
50
+ export * from "./components/testpoint"
50
51
  export * from "./components/pcb-keepout"
51
52
  export * from "./components/power-source"
52
53
  export * from "./components/schematic-box"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.207",
3
+ "version": "0.0.209",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",