@tscircuit/props 0.0.326 → 0.0.328

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.
@@ -3,16 +3,26 @@ import { distance, type Distance } from "lib/common/distance"
3
3
  import { pcbLayoutProps, type PcbLayoutProps } from "lib/common/layout"
4
4
  import { expectTypesMatch } from "lib/typecheck"
5
5
 
6
- export interface HoleProps extends Omit<PcbLayoutProps, "pcbRotation"> {
6
+ export interface CircleHoleProps extends PcbLayoutProps {
7
7
  name?: string
8
+ shape?: "circle"
8
9
  diameter?: Distance
9
10
  radius?: Distance
10
11
  }
11
12
 
12
- export const holeProps = pcbLayoutProps
13
- .omit({ pcbRotation: true })
13
+ export interface PillHoleProps extends PcbLayoutProps {
14
+ name?: string
15
+ shape: "pill"
16
+ width: Distance
17
+ height: Distance
18
+ }
19
+
20
+ export type HoleProps = CircleHoleProps | PillHoleProps
21
+
22
+ const circleHoleProps = pcbLayoutProps
14
23
  .extend({
15
24
  name: z.string().optional(),
25
+ shape: z.literal("circle").optional(),
16
26
  diameter: distance.optional(),
17
27
  radius: distance.optional(),
18
28
  })
@@ -22,6 +32,15 @@ export const holeProps = pcbLayoutProps
22
32
  radius: d.radius ?? d.diameter! / 2,
23
33
  }))
24
34
 
35
+ const pillHoleProps = pcbLayoutProps.extend({
36
+ name: z.string().optional(),
37
+ shape: z.literal("pill"),
38
+ width: distance,
39
+ height: distance,
40
+ })
41
+
42
+ export const holeProps = z.union([circleHoleProps, pillHoleProps])
43
+
25
44
  export type InferredHoleProps = z.input<typeof holeProps>
26
45
 
27
46
  expectTypesMatch<HoleProps, InferredHoleProps>(true)
@@ -15,8 +15,7 @@ export interface CirclePlatedHoleProps
15
15
  portHints?: PortHints
16
16
  }
17
17
 
18
- export interface OvalPlatedHoleProps
19
- extends Omit<PcbLayoutProps, "pcbRotation" | "layer"> {
18
+ export interface OvalPlatedHoleProps extends Omit<PcbLayoutProps, "layer"> {
20
19
  name?: string
21
20
  connectsTo?: string | string[]
22
21
  shape: "oval"
@@ -104,7 +103,7 @@ export const platedHoleProps = z
104
103
  outerDiameter: distance,
105
104
  portHints: portHints.optional(),
106
105
  }),
107
- pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
106
+ pcbLayoutProps.omit({ layer: true }).extend({
108
107
  name: z.string().optional(),
109
108
  connectsTo: z.string().or(z.array(z.string())).optional(),
110
109
  shape: z.literal("oval"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.326",
3
+ "version": "0.0.328",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",