@tscircuit/props 0.0.313 → 0.0.314

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.
@@ -1,79 +1,24 @@
1
1
  import { z } from "zod"
2
2
  import { distance, type Distance } from "lib/common/distance"
3
- import { point, type Point } from "lib/common/point"
4
- import { pcbLayoutProps, type PcbLayoutProps } from "lib/common/layout"
5
3
  import { expectTypesMatch } from "lib/typecheck"
6
-
7
- export interface RectCopperPourProps
8
- extends Omit<PcbLayoutProps, "pcbRotation"> {
9
- shape: "rect"
10
- width: Distance
11
- height: Distance
12
- connectsTo?: string | string[]
13
- }
14
-
15
- export const rectCopperPourProps = pcbLayoutProps
16
- .omit({
17
- pcbRotation: true,
18
- })
19
- .extend({
20
- shape: z.literal("rect"),
21
- width: distance,
22
- height: distance,
23
- connectsTo: z.string().or(z.array(z.string())).optional(),
24
- })
25
- expectTypesMatch<RectCopperPourProps, z.input<typeof rectCopperPourProps>>(true)
26
-
27
- export interface CircleCopperPourProps
28
- extends Omit<PcbLayoutProps, "pcbRotation"> {
29
- shape: "circle"
30
- radius: Distance
31
- connectsTo?: string | string[]
4
+ import { layer_ref, type LayerRefInput } from "circuit-json"
5
+
6
+ export interface CopperPourProps {
7
+ name?: string
8
+ layer: LayerRefInput
9
+ connectsTo: string
10
+ padMargin?: Distance
11
+ traceMargin?: Distance
32
12
  }
33
13
 
34
- export const circleCopperPourProps = pcbLayoutProps
35
- .omit({
36
- pcbRotation: true,
37
- })
38
- .extend({
39
- shape: z.literal("circle"),
40
- radius: distance,
41
- connectsTo: z.string().or(z.array(z.string())).optional(),
42
- })
43
- expectTypesMatch<CircleCopperPourProps, z.input<typeof circleCopperPourProps>>(
44
- true,
45
- )
46
-
47
- export interface PolygonCopperPourProps
48
- extends Omit<PcbLayoutProps, "pcbRotation"> {
49
- shape: "polygon"
50
- points: Point[]
51
- connectsTo?: string | string[]
52
- }
53
-
54
- export const polygonCopperPourProps = pcbLayoutProps
55
- .omit({
56
- pcbRotation: true,
57
- })
58
- .extend({
59
- shape: z.literal("polygon"),
60
- points: z.array(point),
61
- connectsTo: z.string().or(z.array(z.string())).optional(),
62
- })
63
- expectTypesMatch<
64
- PolygonCopperPourProps,
65
- z.input<typeof polygonCopperPourProps>
66
- >(true)
67
-
68
- export type CopperPourProps =
69
- | RectCopperPourProps
70
- | CircleCopperPourProps
71
- | PolygonCopperPourProps
14
+ export const copperPourProps = z.object({
15
+ name: z.string().optional(),
16
+ layer: layer_ref,
17
+ connectsTo: z.string(),
18
+ padMargin: distance.optional(),
19
+ traceMargin: distance.optional(),
20
+ })
72
21
 
73
- export const copperPourProps = z.discriminatedUnion("shape", [
74
- rectCopperPourProps,
75
- circleCopperPourProps,
76
- polygonCopperPourProps,
77
- ])
22
+ expectTypesMatch<CopperPourProps, z.input<typeof copperPourProps>>(true)
78
23
 
79
24
  export type CopperPourPropsInput = z.input<typeof copperPourProps>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.313",
3
+ "version": "0.0.314",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",