@tscircuit/props 0.0.599 → 0.0.601
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 +4 -35
- package/dist/index.d.ts +267 -115
- package/dist/index.js +723 -707
- package/dist/index.js.map +1 -1
- package/lib/common/fanoutProps.ts +65 -0
- package/lib/components/autoroutingphase.ts +7 -55
- package/lib/components/breakout.ts +4 -12
- package/lib/components/smtpad.ts +10 -0
- package/lib/components/transistor.ts +3 -3
- package/lib/index.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { layer_ref, type LayerRef, type LayerRefInput } from "circuit-json"
|
|
2
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
3
|
+
import { z } from "zod"
|
|
4
|
+
import type { BusName } from "../components/bus"
|
|
5
|
+
import {
|
|
6
|
+
type FanoutBoundaryPadding,
|
|
7
|
+
fanoutBoundaryPadding,
|
|
8
|
+
} from "./fanoutBoundaryPadding"
|
|
9
|
+
import { type NinePointAnchor, ninePointAnchor } from "./ninePointAnchor"
|
|
10
|
+
|
|
11
|
+
export type BusFanoutDirection =
|
|
12
|
+
| NinePointAnchor
|
|
13
|
+
| {
|
|
14
|
+
direction: NinePointAnchor
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type FanoutPourNetMap = Partial<
|
|
18
|
+
Record<Extract<LayerRef, string>, string | string[]>
|
|
19
|
+
>
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Routing controls shared by fanout autorouting phases and breakout groups.
|
|
23
|
+
*/
|
|
24
|
+
export interface FanoutProps {
|
|
25
|
+
/**
|
|
26
|
+
* Fanout direction for each named bus. `center` leaves the direction
|
|
27
|
+
* unconstrained.
|
|
28
|
+
*/
|
|
29
|
+
busFanoutDirections?: Record<BusName, BusFanoutDirection>
|
|
30
|
+
/**
|
|
31
|
+
* Padding between the union of the fanout source pads and the shared
|
|
32
|
+
* boundary where fanout traces terminate.
|
|
33
|
+
*/
|
|
34
|
+
fanoutBoundaryPadding?: FanoutBoundaryPadding
|
|
35
|
+
/**
|
|
36
|
+
* Copper layers available to boundary-terminated fanout buses. Source-only
|
|
37
|
+
* traces whose nets are mapped by `fanoutPourNetMap` terminate on their
|
|
38
|
+
* mapped plane layer.
|
|
39
|
+
*/
|
|
40
|
+
fanoutRoutingLayers?: LayerRefInput[]
|
|
41
|
+
/**
|
|
42
|
+
* Maps copper layers to the net or nets poured on them. During fanout,
|
|
43
|
+
* source-only traces on those nets drop to the mapped layer instead of
|
|
44
|
+
* routing to the breakout boundary.
|
|
45
|
+
*
|
|
46
|
+
* This is inferred from `<copperpour>` components when omitted.
|
|
47
|
+
*/
|
|
48
|
+
fanoutPourNetMap?: FanoutPourNetMap
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const busFanoutDirection = z.union([
|
|
52
|
+
ninePointAnchor,
|
|
53
|
+
z.object({ direction: ninePointAnchor }),
|
|
54
|
+
])
|
|
55
|
+
|
|
56
|
+
export const fanoutProps = z.object({
|
|
57
|
+
busFanoutDirections: z.record(busFanoutDirection).optional(),
|
|
58
|
+
fanoutBoundaryPadding: fanoutBoundaryPadding.optional(),
|
|
59
|
+
fanoutRoutingLayers: z.array(layer_ref).min(1).optional(),
|
|
60
|
+
fanoutPourNetMap: z
|
|
61
|
+
.record(layer_ref, z.union([z.string(), z.array(z.string()).min(1)]))
|
|
62
|
+
.optional(),
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
expectTypesMatch<FanoutProps, z.input<typeof fanoutProps>>(true)
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import { expectTypesMatch } from "lib/typecheck"
|
|
2
2
|
import { z } from "zod"
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
type FanoutBoundaryPadding,
|
|
6
|
-
fanoutBoundaryPadding,
|
|
7
|
-
} from "../common/fanoutBoundaryPadding"
|
|
8
|
-
import {
|
|
9
|
-
type NinePointAnchor,
|
|
10
|
-
ninePointAnchor,
|
|
11
|
-
} from "../common/ninePointAnchor"
|
|
12
|
-
import type { BusName } from "./bus"
|
|
3
|
+
import { type FanoutProps, fanoutProps } from "../common/fanoutProps"
|
|
13
4
|
import {
|
|
14
5
|
type AutorouterProp,
|
|
15
6
|
type RoutingTolerances,
|
|
@@ -17,17 +8,12 @@ import {
|
|
|
17
8
|
routingTolerances,
|
|
18
9
|
} from "./group"
|
|
19
10
|
|
|
20
|
-
export type
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type FanoutPourNetMap = Partial<
|
|
27
|
-
Record<Extract<LayerRef, string>, string | string[]>
|
|
28
|
-
>
|
|
11
|
+
export type {
|
|
12
|
+
BusFanoutDirection,
|
|
13
|
+
FanoutPourNetMap,
|
|
14
|
+
} from "../common/fanoutProps"
|
|
29
15
|
|
|
30
|
-
export interface AutoroutingPhaseProps extends RoutingTolerances {
|
|
16
|
+
export interface AutoroutingPhaseProps extends RoutingTolerances, FanoutProps {
|
|
31
17
|
key?: any
|
|
32
18
|
name?: string
|
|
33
19
|
autorouter?: AutorouterProp
|
|
@@ -42,37 +28,8 @@ export interface AutoroutingPhaseProps extends RoutingTolerances {
|
|
|
42
28
|
connection?: string
|
|
43
29
|
connections?: string[]
|
|
44
30
|
reroute?: boolean
|
|
45
|
-
/**
|
|
46
|
-
* Fanout direction for each named bus in this phase. `center` leaves the
|
|
47
|
-
* direction unconstrained.
|
|
48
|
-
*/
|
|
49
|
-
busFanoutDirections?: Record<BusName, BusFanoutDirection>
|
|
50
|
-
/**
|
|
51
|
-
* Padding between the union of the fanout source pads and the shared
|
|
52
|
-
* boundary where fanout traces terminate.
|
|
53
|
-
*/
|
|
54
|
-
fanoutBoundaryPadding?: FanoutBoundaryPadding
|
|
55
|
-
/**
|
|
56
|
-
* Copper layers available to boundary-terminated fanout buses. Source-only
|
|
57
|
-
* traces whose nets are mapped by `fanoutPourNetMap` terminate on their
|
|
58
|
-
* mapped plane layer.
|
|
59
|
-
*/
|
|
60
|
-
fanoutRoutingLayers?: LayerRefInput[]
|
|
61
|
-
/**
|
|
62
|
-
* Maps copper layers to the net or nets poured on them. During fanout,
|
|
63
|
-
* source-only traces on those nets drop to the mapped layer instead of
|
|
64
|
-
* routing to the breakout boundary.
|
|
65
|
-
*
|
|
66
|
-
* This is inferred from `<copperpour>` components when omitted.
|
|
67
|
-
*/
|
|
68
|
-
fanoutPourNetMap?: FanoutPourNetMap
|
|
69
31
|
}
|
|
70
32
|
|
|
71
|
-
const busFanoutDirection = z.union([
|
|
72
|
-
ninePointAnchor,
|
|
73
|
-
z.object({ direction: ninePointAnchor }),
|
|
74
|
-
])
|
|
75
|
-
|
|
76
33
|
export const autoroutingPhaseProps = z
|
|
77
34
|
.object({
|
|
78
35
|
key: z.any().optional(),
|
|
@@ -92,12 +49,7 @@ export const autoroutingPhaseProps = z
|
|
|
92
49
|
connection: z.string().optional(),
|
|
93
50
|
connections: z.array(z.string()).optional(),
|
|
94
51
|
reroute: z.boolean().optional(),
|
|
95
|
-
|
|
96
|
-
fanoutBoundaryPadding: fanoutBoundaryPadding.optional(),
|
|
97
|
-
fanoutRoutingLayers: z.array(layer_ref).min(1).optional(),
|
|
98
|
-
fanoutPourNetMap: z
|
|
99
|
-
.record(layer_ref, z.union([z.string(), z.array(z.string()).min(1)]))
|
|
100
|
-
.optional(),
|
|
52
|
+
...fanoutProps.shape,
|
|
101
53
|
})
|
|
102
54
|
.superRefine((value, ctx) => {
|
|
103
55
|
if (
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { distance, type Distance } from "lib/common/distance"
|
|
2
|
-
import {
|
|
3
|
-
type FanoutBoundaryPadding,
|
|
4
|
-
fanoutBoundaryPadding,
|
|
5
|
-
} from "lib/common/fanoutBoundaryPadding"
|
|
2
|
+
import { type FanoutProps, fanoutProps } from "lib/common/fanoutProps"
|
|
6
3
|
import { expectTypesMatch } from "lib/typecheck"
|
|
7
4
|
import { z } from "zod"
|
|
8
5
|
import {
|
|
@@ -13,7 +10,8 @@ import {
|
|
|
13
10
|
} from "./group"
|
|
14
11
|
|
|
15
12
|
export interface BreakoutProps
|
|
16
|
-
extends Omit<SubcircuitGroupProps, "subcircuit"
|
|
13
|
+
extends Omit<SubcircuitGroupProps, "subcircuit">,
|
|
14
|
+
FanoutProps {
|
|
17
15
|
/**
|
|
18
16
|
* Autorouter used to escape the components inside the breakout boundary.
|
|
19
17
|
* Defaults to the multilayer fanout autorouter.
|
|
@@ -24,12 +22,6 @@ export interface BreakoutProps
|
|
|
24
22
|
paddingRight?: Distance
|
|
25
23
|
paddingTop?: Distance
|
|
26
24
|
paddingBottom?: Distance
|
|
27
|
-
/**
|
|
28
|
-
* Padding between the union of the fanout source pads and the shared
|
|
29
|
-
* boundary where fanout traces terminate. This is independent of the
|
|
30
|
-
* breakout group's layout padding.
|
|
31
|
-
*/
|
|
32
|
-
fanoutBoundaryPadding?: FanoutBoundaryPadding
|
|
33
25
|
}
|
|
34
26
|
|
|
35
27
|
export const breakoutProps = subcircuitGroupProps.extend({
|
|
@@ -39,7 +31,7 @@ export const breakoutProps = subcircuitGroupProps.extend({
|
|
|
39
31
|
paddingRight: distance.optional(),
|
|
40
32
|
paddingTop: distance.optional(),
|
|
41
33
|
paddingBottom: distance.optional(),
|
|
42
|
-
|
|
34
|
+
...fanoutProps.shape,
|
|
43
35
|
})
|
|
44
36
|
|
|
45
37
|
type InferredBreakoutProps = z.input<typeof breakoutProps>
|
package/lib/components/smtpad.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface RectSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
|
23
23
|
solderMaskMarginRight?: Distance
|
|
24
24
|
solderMaskMarginTop?: Distance
|
|
25
25
|
solderMaskMarginBottom?: Distance
|
|
26
|
+
solderPasteMargin?: Distance
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export interface RotatedRectSmtPadProps
|
|
@@ -40,6 +41,7 @@ export interface RotatedRectSmtPadProps
|
|
|
40
41
|
solderMaskMarginRight?: Distance
|
|
41
42
|
solderMaskMarginTop?: Distance
|
|
42
43
|
solderMaskMarginBottom?: Distance
|
|
44
|
+
solderPasteMargin?: Distance
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
export interface CircleSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
@@ -49,6 +51,7 @@ export interface CircleSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
|
49
51
|
portHints?: PortHints
|
|
50
52
|
coveredWithSolderMask?: boolean
|
|
51
53
|
solderMaskMargin?: Distance
|
|
54
|
+
solderPasteMargin?: Distance
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
export interface PillSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
@@ -60,6 +63,7 @@ export interface PillSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
|
60
63
|
portHints?: PortHints
|
|
61
64
|
coveredWithSolderMask?: boolean
|
|
62
65
|
solderMaskMargin?: Distance
|
|
66
|
+
solderPasteMargin?: Distance
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
export interface PolygonSmtPadProps
|
|
@@ -70,6 +74,7 @@ export interface PolygonSmtPadProps
|
|
|
70
74
|
portHints?: PortHints
|
|
71
75
|
coveredWithSolderMask?: boolean
|
|
72
76
|
solderMaskMargin?: Distance
|
|
77
|
+
solderPasteMargin?: Distance
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
export type SmtPadProps =
|
|
@@ -99,6 +104,7 @@ export const rectSmtPadProps = pcbLayoutProps
|
|
|
99
104
|
solderMaskMarginRight: distance.optional(),
|
|
100
105
|
solderMaskMarginTop: distance.optional(),
|
|
101
106
|
solderMaskMarginBottom: distance.optional(),
|
|
107
|
+
solderPasteMargin: distance.optional(),
|
|
102
108
|
})
|
|
103
109
|
type InferredRectSmtPadProps = z.input<typeof rectSmtPadProps>
|
|
104
110
|
expectTypesMatch<InferredRectSmtPadProps, RectSmtPadProps>(true)
|
|
@@ -119,6 +125,7 @@ export const rotatedRectSmtPadProps = pcbLayoutProps
|
|
|
119
125
|
solderMaskMarginRight: distance.optional(),
|
|
120
126
|
solderMaskMarginTop: distance.optional(),
|
|
121
127
|
solderMaskMarginBottom: distance.optional(),
|
|
128
|
+
solderPasteMargin: distance.optional(),
|
|
122
129
|
})
|
|
123
130
|
type InferredRotatedRectSmtPadProps = z.input<typeof rotatedRectSmtPadProps>
|
|
124
131
|
expectTypesMatch<InferredRotatedRectSmtPadProps, RotatedRectSmtPadProps>(true)
|
|
@@ -132,6 +139,7 @@ export const circleSmtPadProps = pcbLayoutProps
|
|
|
132
139
|
portHints: portHints.optional(),
|
|
133
140
|
coveredWithSolderMask: z.boolean().optional(),
|
|
134
141
|
solderMaskMargin: distance.optional(),
|
|
142
|
+
solderPasteMargin: distance.optional(),
|
|
135
143
|
})
|
|
136
144
|
type InferredCircleSmtPadProps = z.input<typeof circleSmtPadProps>
|
|
137
145
|
expectTypesMatch<InferredCircleSmtPadProps, CircleSmtPadProps>(true)
|
|
@@ -147,6 +155,7 @@ export const pillSmtPadProps = pcbLayoutProps
|
|
|
147
155
|
portHints: portHints.optional(),
|
|
148
156
|
coveredWithSolderMask: z.boolean().optional(),
|
|
149
157
|
solderMaskMargin: distance.optional(),
|
|
158
|
+
solderPasteMargin: distance.optional(),
|
|
150
159
|
})
|
|
151
160
|
type InferredPillSmtPadProps = z.input<typeof pillSmtPadProps>
|
|
152
161
|
expectTypesMatch<InferredPillSmtPadProps, PillSmtPadProps>(true)
|
|
@@ -160,6 +169,7 @@ export const polygonSmtPadProps = pcbLayoutProps
|
|
|
160
169
|
portHints: portHints.optional(),
|
|
161
170
|
coveredWithSolderMask: z.boolean().optional(),
|
|
162
171
|
solderMaskMargin: distance.optional(),
|
|
172
|
+
solderPasteMargin: distance.optional(),
|
|
163
173
|
})
|
|
164
174
|
type InferredPolygonSmtPadProps = z.input<typeof polygonSmtPadProps>
|
|
165
175
|
expectTypesMatch<InferredPolygonSmtPadProps, PolygonSmtPadProps>(true)
|
|
@@ -33,11 +33,11 @@ export const transistorProps = commonComponentProps.extend({
|
|
|
33
33
|
|
|
34
34
|
export const transistorPins = [
|
|
35
35
|
"pin1",
|
|
36
|
-
"emitter",
|
|
37
|
-
"pin2",
|
|
38
36
|
"collector",
|
|
39
|
-
"
|
|
37
|
+
"pin2",
|
|
40
38
|
"base",
|
|
39
|
+
"pin3",
|
|
40
|
+
"emitter",
|
|
41
41
|
] as const
|
|
42
42
|
export type TransistorPinLabels = (typeof transistorPins)[number]
|
|
43
43
|
|
package/lib/index.ts
CHANGED