@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.
- package/README.md +8 -8
- package/dist/index.d.ts +25 -406
- package/dist/index.js +11 -37
- package/dist/index.js.map +1 -1
- package/lib/components/copper-pour.ts +16 -71
- package/package.json +1 -1
|
@@ -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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
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>
|