@tscircuit/props 0.0.239 → 0.0.241
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 +27 -0
- package/dist/index.d.ts +83 -4
- package/dist/index.js +86 -72
- package/dist/index.js.map +1 -1
- package/lib/components/platedhole.ts +10 -0
- package/lib/components/smtpad.ts +10 -0
- package/lib/components/via.ts +17 -4
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ import { z } from "zod"
|
|
|
8
8
|
export interface CirclePlatedHoleProps
|
|
9
9
|
extends Omit<PcbLayoutProps, "pcbRotation" | "layer"> {
|
|
10
10
|
name?: string
|
|
11
|
+
connectsTo?: string | string[]
|
|
11
12
|
shape: "circle"
|
|
12
13
|
holeDiameter: number | string
|
|
13
14
|
outerDiameter: number | string
|
|
@@ -17,6 +18,7 @@ export interface CirclePlatedHoleProps
|
|
|
17
18
|
export interface OvalPlatedHoleProps
|
|
18
19
|
extends Omit<PcbLayoutProps, "pcbRotation" | "layer"> {
|
|
19
20
|
name?: string
|
|
21
|
+
connectsTo?: string | string[]
|
|
20
22
|
shape: "oval"
|
|
21
23
|
outerWidth: number | string
|
|
22
24
|
outerHeight: number | string
|
|
@@ -33,6 +35,7 @@ export interface OvalPlatedHoleProps
|
|
|
33
35
|
export interface PillPlatedHoleProps
|
|
34
36
|
extends Omit<PcbLayoutProps, "pcbRotation" | "layer"> {
|
|
35
37
|
name?: string
|
|
38
|
+
connectsTo?: string | string[]
|
|
36
39
|
shape: "pill"
|
|
37
40
|
outerWidth: number | string
|
|
38
41
|
outerHeight: number | string
|
|
@@ -50,6 +53,7 @@ export interface PillPlatedHoleProps
|
|
|
50
53
|
export interface CircularHoleWithRectPlatedProps
|
|
51
54
|
extends Omit<PcbLayoutProps, "pcbRotation" | "layer"> {
|
|
52
55
|
name?: string
|
|
56
|
+
connectsTo?: string | string[]
|
|
53
57
|
shape: "circular_hole_with_rect_pad"
|
|
54
58
|
holeDiameter: number | string
|
|
55
59
|
rectPadWidth: number | string
|
|
@@ -62,6 +66,7 @@ export interface CircularHoleWithRectPlatedProps
|
|
|
62
66
|
export interface PillWithRectPadPlatedHoleProps
|
|
63
67
|
extends Omit<PcbLayoutProps, "pcbRotation" | "layer"> {
|
|
64
68
|
name?: string
|
|
69
|
+
connectsTo?: string | string[]
|
|
65
70
|
shape: "pill_hole_with_rect_pad"
|
|
66
71
|
holeShape: "pill"
|
|
67
72
|
padShape: "rect"
|
|
@@ -90,6 +95,7 @@ export const platedHoleProps = z
|
|
|
90
95
|
.discriminatedUnion("shape", [
|
|
91
96
|
pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
|
|
92
97
|
name: z.string().optional(),
|
|
98
|
+
connectsTo: z.string().or(z.array(z.string())).optional(),
|
|
93
99
|
shape: z.literal("circle"),
|
|
94
100
|
holeDiameter: distance,
|
|
95
101
|
outerDiameter: distance,
|
|
@@ -97,6 +103,7 @@ export const platedHoleProps = z
|
|
|
97
103
|
}),
|
|
98
104
|
pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
|
|
99
105
|
name: z.string().optional(),
|
|
106
|
+
connectsTo: z.string().or(z.array(z.string())).optional(),
|
|
100
107
|
shape: z.literal("oval"),
|
|
101
108
|
outerWidth: distance,
|
|
102
109
|
outerHeight: distance,
|
|
@@ -108,6 +115,7 @@ export const platedHoleProps = z
|
|
|
108
115
|
}),
|
|
109
116
|
pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
|
|
110
117
|
name: z.string().optional(),
|
|
118
|
+
connectsTo: z.string().or(z.array(z.string())).optional(),
|
|
111
119
|
shape: z.literal("pill"),
|
|
112
120
|
outerWidth: distance,
|
|
113
121
|
outerHeight: distance,
|
|
@@ -119,6 +127,7 @@ export const platedHoleProps = z
|
|
|
119
127
|
}),
|
|
120
128
|
pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
|
|
121
129
|
name: z.string().optional(),
|
|
130
|
+
connectsTo: z.string().or(z.array(z.string())).optional(),
|
|
122
131
|
shape: z.literal("circular_hole_with_rect_pad"),
|
|
123
132
|
holeDiameter: distance,
|
|
124
133
|
rectPadWidth: distance,
|
|
@@ -129,6 +138,7 @@ export const platedHoleProps = z
|
|
|
129
138
|
}),
|
|
130
139
|
pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
|
|
131
140
|
name: z.string().optional(),
|
|
141
|
+
connectsTo: z.string().or(z.array(z.string())).optional(),
|
|
132
142
|
shape: z.literal("pill_hole_with_rect_pad"),
|
|
133
143
|
holeShape: z.literal("pill"),
|
|
134
144
|
padShape: z.literal("rect"),
|
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)
|