@tscircuit/props 0.0.239 → 0.0.240
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/dist/index.d.ts +51 -2
- package/dist/index.js +81 -72
- package/dist/index.js.map +1 -1
- package/lib/components/smtpad.ts +10 -0
- package/lib/components/via.ts +17 -4
- package/package.json +1 -1
package/lib/components/smtpad.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { point, type Point } from "lib/common/point"
|
|
|
10
10
|
import { expectTypesMatch } from "lib/typecheck"
|
|
11
11
|
|
|
12
12
|
export interface RectSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
13
|
+
name?: string
|
|
13
14
|
shape: "rect"
|
|
14
15
|
width: Distance
|
|
15
16
|
height: Distance
|
|
@@ -18,6 +19,7 @@ export interface RectSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
|
18
19
|
|
|
19
20
|
export interface RotatedRectSmtPadProps
|
|
20
21
|
extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
22
|
+
name?: string
|
|
21
23
|
shape: "rotated_rect"
|
|
22
24
|
width: Distance
|
|
23
25
|
height: Distance
|
|
@@ -26,12 +28,14 @@ export interface RotatedRectSmtPadProps
|
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
export interface CircleSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
31
|
+
name?: string
|
|
29
32
|
shape: "circle"
|
|
30
33
|
radius: Distance
|
|
31
34
|
portHints?: PortHints
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
export interface PillSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
38
|
+
name?: string
|
|
35
39
|
shape: "pill"
|
|
36
40
|
width: Distance
|
|
37
41
|
height: Distance
|
|
@@ -41,6 +45,7 @@ export interface PillSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
|
41
45
|
|
|
42
46
|
export interface PolygonSmtPadProps
|
|
43
47
|
extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
48
|
+
name?: string
|
|
44
49
|
shape: "polygon"
|
|
45
50
|
points: Point[]
|
|
46
51
|
portHints?: PortHints
|
|
@@ -60,6 +65,7 @@ export type SmtPadProps =
|
|
|
60
65
|
export const rectSmtPadProps = pcbLayoutProps
|
|
61
66
|
.omit({ pcbRotation: true })
|
|
62
67
|
.extend({
|
|
68
|
+
name: z.string().optional(),
|
|
63
69
|
shape: z.literal("rect"),
|
|
64
70
|
width: distance,
|
|
65
71
|
height: distance,
|
|
@@ -71,6 +77,7 @@ expectTypesMatch<InferredRectSmtPadProps, RectSmtPadProps>(true)
|
|
|
71
77
|
export const rotatedRectSmtPadProps = pcbLayoutProps
|
|
72
78
|
.omit({ pcbRotation: true })
|
|
73
79
|
.extend({
|
|
80
|
+
name: z.string().optional(),
|
|
74
81
|
shape: z.literal("rotated_rect"),
|
|
75
82
|
width: distance,
|
|
76
83
|
height: distance,
|
|
@@ -83,6 +90,7 @@ expectTypesMatch<InferredRotatedRectSmtPadProps, RotatedRectSmtPadProps>(true)
|
|
|
83
90
|
export const circleSmtPadProps = pcbLayoutProps
|
|
84
91
|
.omit({ pcbRotation: true })
|
|
85
92
|
.extend({
|
|
93
|
+
name: z.string().optional(),
|
|
86
94
|
shape: z.literal("circle"),
|
|
87
95
|
radius: distance,
|
|
88
96
|
portHints: portHints.optional(),
|
|
@@ -93,6 +101,7 @@ expectTypesMatch<InferredCircleSmtPadProps, CircleSmtPadProps>(true)
|
|
|
93
101
|
export const pillSmtPadProps = pcbLayoutProps
|
|
94
102
|
.omit({ pcbRotation: true })
|
|
95
103
|
.extend({
|
|
104
|
+
name: z.string().optional(),
|
|
96
105
|
shape: z.literal("pill"),
|
|
97
106
|
width: distance,
|
|
98
107
|
height: distance,
|
|
@@ -105,6 +114,7 @@ expectTypesMatch<InferredPillSmtPadProps, PillSmtPadProps>(true)
|
|
|
105
114
|
export const polygonSmtPadProps = pcbLayoutProps
|
|
106
115
|
.omit({ pcbRotation: true })
|
|
107
116
|
.extend({
|
|
117
|
+
name: z.string().optional(),
|
|
108
118
|
shape: z.literal("polygon"),
|
|
109
119
|
points: z.array(point),
|
|
110
120
|
portHints: portHints.optional(),
|
package/lib/components/via.ts
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
import { distance, layer_ref } from "circuit-json"
|
|
2
|
-
import { commonLayoutProps } from "lib/common/layout"
|
|
3
|
-
import
|
|
1
|
+
import { distance, layer_ref, type LayerRefInput } from "circuit-json"
|
|
2
|
+
import { commonLayoutProps, type CommonLayoutProps } from "lib/common/layout"
|
|
3
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
4
|
+
import { z } from "zod"
|
|
5
|
+
|
|
6
|
+
export interface ViaProps extends CommonLayoutProps {
|
|
7
|
+
name?: string
|
|
8
|
+
fromLayer: LayerRefInput
|
|
9
|
+
toLayer: LayerRefInput
|
|
10
|
+
holeDiameter: number | string
|
|
11
|
+
outerDiameter: number | string
|
|
12
|
+
connectsTo?: string | string[]
|
|
13
|
+
}
|
|
4
14
|
|
|
5
15
|
export const viaProps = commonLayoutProps.extend({
|
|
16
|
+
name: z.string().optional(),
|
|
6
17
|
fromLayer: layer_ref,
|
|
7
18
|
toLayer: layer_ref,
|
|
8
19
|
holeDiameter: distance,
|
|
9
20
|
outerDiameter: distance,
|
|
21
|
+
connectsTo: z.string().or(z.array(z.string())).optional(),
|
|
10
22
|
})
|
|
11
|
-
export type
|
|
23
|
+
export type InferredViaProps = z.input<typeof viaProps>
|
|
24
|
+
expectTypesMatch<ViaProps, InferredViaProps>(true)
|