@tscircuit/props 0.0.129 → 0.0.131
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 +1257 -1215
- package/dist/index.js +165 -104
- package/dist/index.js.map +1 -1
- package/lib/common/layout.ts +3 -0
- package/lib/components/diode.ts +6 -0
- package/lib/components/fabrication-note-path.ts +12 -0
- package/lib/components/fabrication-note-text.ts +14 -0
- package/lib/components/group.ts +2 -0
- package/lib/components/inductor.ts +9 -0
- package/lib/components/led.ts +8 -0
- package/lib/components/pcb-keepout.ts +16 -0
- package/lib/components/pcb-trace.ts +9 -0
- package/lib/components/port.ts +11 -0
- package/lib/components/power-source.ts +8 -0
- package/lib/components/schematic-box.ts +10 -0
- package/lib/components/schematic-line.ts +10 -0
- package/lib/components/schematic-path.ts +9 -0
- package/lib/components/schematic-text.ts +9 -0
- package/lib/components/silkscreen-circle.ts +13 -0
- package/lib/components/silkscreen-line.ts +14 -0
- package/lib/components/silkscreen-path.ts +11 -0
- package/lib/components/silkscreen-rect.ts +14 -0
- package/lib/components/silkscreen-text.ts +13 -0
- package/lib/components/switch.ts +9 -0
- package/lib/components/trace-hint.ts +27 -0
- package/lib/components/via.ts +11 -0
- package/lib/index.ts +21 -232
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { distance } from "circuit-json"
|
|
2
|
+
import { pcbLayoutProps } from "lib/common/layout"
|
|
3
|
+
import { z } from "zod"
|
|
4
|
+
|
|
5
|
+
export const silkscreenCircleProps = pcbLayoutProps
|
|
6
|
+
.omit({ pcbRotation: true })
|
|
7
|
+
.extend({
|
|
8
|
+
isFilled: z.boolean().optional(),
|
|
9
|
+
isOutline: z.boolean().optional(),
|
|
10
|
+
strokeWidth: distance.optional(),
|
|
11
|
+
radius: distance,
|
|
12
|
+
})
|
|
13
|
+
export type SilkscreenCircleProps = z.input<typeof silkscreenCircleProps>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { distance } from "circuit-json"
|
|
2
|
+
import { pcbLayoutProps } from "lib/common/layout"
|
|
3
|
+
import type { z } from "zod"
|
|
4
|
+
|
|
5
|
+
export const silkscreenLineProps = pcbLayoutProps
|
|
6
|
+
.omit({ pcbX: true, pcbY: true, pcbRotation: true })
|
|
7
|
+
.extend({
|
|
8
|
+
strokeWidth: distance,
|
|
9
|
+
x1: distance,
|
|
10
|
+
y1: distance,
|
|
11
|
+
x2: distance,
|
|
12
|
+
y2: distance,
|
|
13
|
+
})
|
|
14
|
+
export type SilkscreenLineProps = z.input<typeof silkscreenLineProps>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { length, route_hint_point } from "circuit-json"
|
|
2
|
+
import { pcbLayoutProps } from "lib/common/layout"
|
|
3
|
+
import { z } from "zod"
|
|
4
|
+
|
|
5
|
+
export const silkscreenPathProps = pcbLayoutProps
|
|
6
|
+
.omit({ pcbX: true, pcbY: true, pcbRotation: true })
|
|
7
|
+
.extend({
|
|
8
|
+
route: z.array(route_hint_point),
|
|
9
|
+
strokeWidth: length.optional(),
|
|
10
|
+
})
|
|
11
|
+
export type SilkscreenPathProps = z.input<typeof silkscreenPathProps>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { distance } from "circuit-json"
|
|
2
|
+
import { pcbLayoutProps } from "lib/common/layout"
|
|
3
|
+
import { z } from "zod"
|
|
4
|
+
|
|
5
|
+
export const silkscreenRectProps = pcbLayoutProps
|
|
6
|
+
.omit({ pcbRotation: true })
|
|
7
|
+
.extend({
|
|
8
|
+
isFilled: z.boolean().optional(),
|
|
9
|
+
isOutline: z.boolean().optional(),
|
|
10
|
+
strokeWidth: distance.optional(),
|
|
11
|
+
width: distance,
|
|
12
|
+
height: distance,
|
|
13
|
+
})
|
|
14
|
+
export type SilkscreenRectProps = z.input<typeof silkscreenRectProps>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { length } from "circuit-json"
|
|
2
|
+
import { pcbLayoutProps } from "lib/common/layout"
|
|
3
|
+
import { z } from "zod"
|
|
4
|
+
|
|
5
|
+
export const silkscreenTextProps = pcbLayoutProps.extend({
|
|
6
|
+
text: z.string(),
|
|
7
|
+
anchorAlignment: z
|
|
8
|
+
.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"])
|
|
9
|
+
.default("center"),
|
|
10
|
+
font: z.enum(["tscircuit2024"]).optional(),
|
|
11
|
+
fontSize: length.optional(),
|
|
12
|
+
})
|
|
13
|
+
export type SilkscreenTextProps = z.input<typeof silkscreenTextProps>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { commonComponentProps } from "lib/common/layout"
|
|
2
|
+
import { z } from "zod"
|
|
3
|
+
|
|
4
|
+
export const switchProps = commonComponentProps.extend({
|
|
5
|
+
ftype: z.literal("switch"),
|
|
6
|
+
switchType: z.enum(["spst"]).default("spst"),
|
|
7
|
+
isNormallyClosed: z.boolean().default(false),
|
|
8
|
+
})
|
|
9
|
+
export type SwitchProps = z.input<typeof switchProps>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { distance, layer_ref, route_hint_point } from "circuit-json"
|
|
2
|
+
import { z } from "zod"
|
|
3
|
+
|
|
4
|
+
export const routeHintPointProps = z.object({
|
|
5
|
+
x: distance,
|
|
6
|
+
y: distance,
|
|
7
|
+
via: z.boolean().optional(),
|
|
8
|
+
toLayer: layer_ref.optional(),
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const traceHintProps = z.object({
|
|
12
|
+
for: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe(
|
|
16
|
+
"Selector for the port you're targeting, not required if you're inside a trace",
|
|
17
|
+
),
|
|
18
|
+
order: z.number().optional(),
|
|
19
|
+
offset: route_hint_point.or(routeHintPointProps).optional(),
|
|
20
|
+
offsets: z
|
|
21
|
+
.array(route_hint_point)
|
|
22
|
+
.or(z.array(routeHintPointProps))
|
|
23
|
+
.optional(),
|
|
24
|
+
traceWidth: z.number().optional(),
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export type TraceHintProps = z.input<typeof traceHintProps>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { distance, layer_ref } from "circuit-json"
|
|
2
|
+
import { commonLayoutProps } from "lib/common/layout"
|
|
3
|
+
import type { z } from "zod"
|
|
4
|
+
|
|
5
|
+
export const viaProps = commonLayoutProps.extend({
|
|
6
|
+
fromLayer: layer_ref,
|
|
7
|
+
toLayer: layer_ref,
|
|
8
|
+
holeDiameter: distance,
|
|
9
|
+
outerDiameter: distance,
|
|
10
|
+
})
|
|
11
|
+
export type ViaProps = z.input<typeof viaProps>
|
package/lib/index.ts
CHANGED
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* THINKING ABOUT ADDING SOMETHING TO THIS FILE?
|
|
3
|
-
*
|
|
4
|
-
* THINK AGAIN!
|
|
5
|
-
*
|
|
6
|
-
* This file is TOO BIG! Create files using the pattern in the surrounding
|
|
7
|
-
* directories, then export from this file.
|
|
8
|
-
*/
|
|
9
|
-
import type { LayoutBuilder } from "@tscircuit/layout"
|
|
10
|
-
import {
|
|
11
|
-
type AnySoupElementInput,
|
|
12
|
-
capacitance,
|
|
13
|
-
distance,
|
|
14
|
-
inductance,
|
|
15
|
-
layer_ref,
|
|
16
|
-
length,
|
|
17
|
-
type PCBPlatedHoleInput,
|
|
18
|
-
type PCBSMTPadInput,
|
|
19
|
-
point,
|
|
20
|
-
resistance,
|
|
21
|
-
rotation,
|
|
22
|
-
route_hint_point,
|
|
23
|
-
supplier_name,
|
|
24
|
-
voltage,
|
|
25
|
-
} from "circuit-json"
|
|
26
|
-
import type { ReactElement } from "react"
|
|
27
|
-
import { z } from "zod"
|
|
28
|
-
import { direction } from "./common/direction"
|
|
29
|
-
import { portHints } from "./common/portHints"
|
|
30
|
-
import {
|
|
31
|
-
commonComponentProps,
|
|
32
|
-
commonLayoutProps,
|
|
33
|
-
lrPins,
|
|
34
|
-
lrPolarPins,
|
|
35
|
-
pcbLayoutProps,
|
|
36
|
-
} from "./common/layout"
|
|
37
|
-
import { explicitPinSideDefinition } from "./common/schematicPinDefinitions"
|
|
38
|
-
|
|
39
1
|
export * from "./common/direction"
|
|
40
2
|
export * from "./common/portHints"
|
|
41
3
|
export * from "./common/layout"
|
|
@@ -73,197 +35,24 @@ export * from "./components/subcircuit"
|
|
|
73
35
|
export * from "./manual-edits"
|
|
74
36
|
export * from "./components/transistor"
|
|
75
37
|
export * from "./components/mosfet"
|
|
76
|
-
|
|
77
|
-
export
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
export
|
|
81
|
-
export
|
|
82
|
-
|
|
83
|
-
export
|
|
84
|
-
export
|
|
85
|
-
export
|
|
86
|
-
|
|
87
|
-
export
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
export
|
|
91
|
-
export
|
|
92
|
-
|
|
93
|
-
export
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
})
|
|
98
|
-
export type SwitchProps = z.input<typeof switchProps>
|
|
99
|
-
|
|
100
|
-
export const distanceOrMultiplier = distance.or(z.enum(["2x", "3x", "4x"]))
|
|
101
|
-
|
|
102
|
-
export const viaProps = commonLayoutProps.extend({
|
|
103
|
-
fromLayer: layer_ref,
|
|
104
|
-
toLayer: layer_ref,
|
|
105
|
-
holeDiameter: distance,
|
|
106
|
-
outerDiameter: distance,
|
|
107
|
-
})
|
|
108
|
-
export type ViaProps = z.input<typeof viaProps>
|
|
109
|
-
|
|
110
|
-
export const pcbKeepoutProps = z.union([
|
|
111
|
-
pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
112
|
-
shape: z.literal("circle"),
|
|
113
|
-
radius: distance,
|
|
114
|
-
}),
|
|
115
|
-
pcbLayoutProps.extend({
|
|
116
|
-
shape: z.literal("rect"),
|
|
117
|
-
width: distance,
|
|
118
|
-
height: distance,
|
|
119
|
-
}),
|
|
120
|
-
])
|
|
121
|
-
export type PcbKeepoutProps = z.input<typeof pcbKeepoutProps>
|
|
122
|
-
|
|
123
|
-
export const schematicBoxProps = z.object({
|
|
124
|
-
schX: distance,
|
|
125
|
-
schY: distance,
|
|
126
|
-
width: distance,
|
|
127
|
-
height: distance,
|
|
128
|
-
})
|
|
129
|
-
export type SchematicBoxProps = z.input<typeof schematicBoxProps>
|
|
130
|
-
|
|
131
|
-
export const schematicTextProps = z.object({
|
|
132
|
-
schX: distance,
|
|
133
|
-
schY: distance,
|
|
134
|
-
text: z.string(),
|
|
135
|
-
})
|
|
136
|
-
export type SchematicTextProps = z.input<typeof schematicTextProps>
|
|
137
|
-
|
|
138
|
-
export const schematicLineProps = z.object({
|
|
139
|
-
x1: distance,
|
|
140
|
-
y1: distance,
|
|
141
|
-
x2: distance,
|
|
142
|
-
y2: distance,
|
|
143
|
-
})
|
|
144
|
-
export type SchematicLineProps = z.input<typeof schematicLineProps>
|
|
145
|
-
|
|
146
|
-
export const schematicPathProps = z.object({
|
|
147
|
-
points: z.array(point),
|
|
148
|
-
isFilled: z.boolean().optional().default(false),
|
|
149
|
-
fillColor: z.enum(["red", "blue"]).optional(),
|
|
150
|
-
})
|
|
151
|
-
export type SchematicPathProps = z.input<typeof schematicPathProps>
|
|
152
|
-
|
|
153
|
-
export const componentProps = commonComponentProps
|
|
154
|
-
export type ComponentProps = z.input<typeof componentProps>
|
|
155
|
-
|
|
156
|
-
export const powerSourceProps = commonComponentProps.extend({
|
|
157
|
-
voltage,
|
|
158
|
-
})
|
|
159
|
-
export type PowerSourceProps = z.input<typeof powerSourceProps>
|
|
160
|
-
|
|
161
|
-
export const portProps = commonLayoutProps.extend({
|
|
162
|
-
name: z.string(),
|
|
163
|
-
pinNumber: z.number().optional(),
|
|
164
|
-
aliases: z.array(z.string()).optional(),
|
|
165
|
-
direction: direction,
|
|
166
|
-
})
|
|
167
|
-
export type PortProps = z.input<typeof portProps>
|
|
168
|
-
|
|
169
|
-
export const silkscreenTextProps = pcbLayoutProps.extend({
|
|
170
|
-
text: z.string(),
|
|
171
|
-
anchorAlignment: z
|
|
172
|
-
.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"])
|
|
173
|
-
.default("center"),
|
|
174
|
-
font: z.enum(["tscircuit2024"]).optional(),
|
|
175
|
-
fontSize: length.optional(),
|
|
176
|
-
})
|
|
177
|
-
export type SilkscreenTextProps = z.input<typeof silkscreenTextProps>
|
|
178
|
-
|
|
179
|
-
export const silkscreenPathProps = pcbLayoutProps
|
|
180
|
-
.omit({ pcbX: true, pcbY: true, pcbRotation: true })
|
|
181
|
-
.extend({
|
|
182
|
-
route: z.array(route_hint_point),
|
|
183
|
-
strokeWidth: length.optional(),
|
|
184
|
-
})
|
|
185
|
-
export type SilkscreenPathProps = z.input<typeof silkscreenPathProps>
|
|
186
|
-
|
|
187
|
-
export const silkscreenLineProps = pcbLayoutProps
|
|
188
|
-
.omit({ pcbX: true, pcbY: true, pcbRotation: true })
|
|
189
|
-
.extend({
|
|
190
|
-
strokeWidth: distance,
|
|
191
|
-
x1: distance,
|
|
192
|
-
y1: distance,
|
|
193
|
-
x2: distance,
|
|
194
|
-
y2: distance,
|
|
195
|
-
})
|
|
196
|
-
export type SilkscreenLineProps = z.input<typeof silkscreenLineProps>
|
|
197
|
-
|
|
198
|
-
export const silkscreenRectProps = pcbLayoutProps
|
|
199
|
-
.omit({ pcbRotation: true })
|
|
200
|
-
.extend({
|
|
201
|
-
isFilled: z.boolean().optional(),
|
|
202
|
-
isOutline: z.boolean().optional(),
|
|
203
|
-
strokeWidth: distance.optional(),
|
|
204
|
-
width: distance,
|
|
205
|
-
height: distance,
|
|
206
|
-
})
|
|
207
|
-
export type SilkscreenRectProps = z.input<typeof silkscreenRectProps>
|
|
208
|
-
|
|
209
|
-
export const silkscreenCircleProps = pcbLayoutProps
|
|
210
|
-
.omit({ pcbRotation: true })
|
|
211
|
-
.extend({
|
|
212
|
-
isFilled: z.boolean().optional(),
|
|
213
|
-
isOutline: z.boolean().optional(),
|
|
214
|
-
strokeWidth: distance.optional(),
|
|
215
|
-
radius: distance,
|
|
216
|
-
})
|
|
217
|
-
export type SilkscreenCircleProps = z.input<typeof silkscreenCircleProps>
|
|
218
|
-
|
|
219
|
-
export const routeHintPointProps = z.object({
|
|
220
|
-
x: distance,
|
|
221
|
-
y: distance,
|
|
222
|
-
via: z.boolean().optional(),
|
|
223
|
-
toLayer: layer_ref.optional(),
|
|
224
|
-
})
|
|
225
|
-
|
|
226
|
-
export const traceHintProps = z.object({
|
|
227
|
-
for: z
|
|
228
|
-
.string()
|
|
229
|
-
.optional()
|
|
230
|
-
.describe(
|
|
231
|
-
"Selector for the port you're targeting, not required if you're inside a trace",
|
|
232
|
-
),
|
|
233
|
-
order: z.number().optional(),
|
|
234
|
-
offset: route_hint_point.or(routeHintPointProps).optional(),
|
|
235
|
-
offsets: z
|
|
236
|
-
.array(route_hint_point)
|
|
237
|
-
.or(z.array(routeHintPointProps))
|
|
238
|
-
.optional(),
|
|
239
|
-
traceWidth: z.number().optional(),
|
|
240
|
-
})
|
|
241
|
-
|
|
242
|
-
export type TraceHintProps = z.input<typeof traceHintProps>
|
|
243
|
-
|
|
244
|
-
export const pcbTraceProps = z.object({
|
|
245
|
-
layer: z.string().optional(),
|
|
246
|
-
thickness: distance.optional(),
|
|
247
|
-
route: z.array(route_hint_point),
|
|
248
|
-
})
|
|
249
|
-
export type PcbTraceProps = z.input<typeof pcbTraceProps>
|
|
250
|
-
|
|
251
|
-
export const fabricationNoteTextProps = pcbLayoutProps.extend({
|
|
252
|
-
text: z.string(),
|
|
253
|
-
anchorAlignment: z
|
|
254
|
-
.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"])
|
|
255
|
-
.default("center"),
|
|
256
|
-
font: z.enum(["tscircuit2024"]).optional(),
|
|
257
|
-
fontSize: length.optional(),
|
|
258
|
-
color: z.string().optional(),
|
|
259
|
-
})
|
|
260
|
-
export type FabricationNoteTextProps = z.input<typeof fabricationNoteTextProps>
|
|
261
|
-
|
|
262
|
-
export const fabricationNotePathProps = pcbLayoutProps
|
|
263
|
-
.omit({ pcbX: true, pcbY: true, pcbRotation: true })
|
|
264
|
-
.extend({
|
|
265
|
-
route: z.array(route_hint_point),
|
|
266
|
-
strokeWidth: length.optional(),
|
|
267
|
-
color: z.string().optional(),
|
|
268
|
-
})
|
|
269
|
-
export type FabricationNotePathProps = z.input<typeof fabricationNotePathProps>
|
|
38
|
+
export * from "./components/inductor"
|
|
39
|
+
export * from "./components/diode"
|
|
40
|
+
export * from "./components/led"
|
|
41
|
+
export * from "./components/switch"
|
|
42
|
+
export * from "./components/fabrication-note-text"
|
|
43
|
+
export * from "./components/fabrication-note-path"
|
|
44
|
+
export * from "./components/pcb-trace"
|
|
45
|
+
export * from "./components/via"
|
|
46
|
+
export * from "./components/pcb-keepout"
|
|
47
|
+
export * from "./components/power-source"
|
|
48
|
+
export * from "./components/schematic-box"
|
|
49
|
+
export * from "./components/schematic-line"
|
|
50
|
+
export * from "./components/schematic-text"
|
|
51
|
+
export * from "./components/schematic-path"
|
|
52
|
+
export * from "./components/silkscreen-text"
|
|
53
|
+
export * from "./components/silkscreen-path"
|
|
54
|
+
export * from "./components/silkscreen-line"
|
|
55
|
+
export * from "./components/silkscreen-rect"
|
|
56
|
+
export * from "./components/silkscreen-circle"
|
|
57
|
+
export * from "./components/trace-hint"
|
|
58
|
+
export * from "./components/port"
|