@tscircuit/props 0.0.327 → 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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.327",
3
+ "version": "0.0.328",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",