@tscircuit/props 0.0.179 → 0.0.180

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.
Files changed (2) hide show
  1. package/README.md +537 -0
  2. package/package.json +7 -2
package/README.md CHANGED
@@ -13,3 +13,540 @@ import { resistorProps } from "@tscircuit/props"
13
13
  resistorProps.parse({ resistance: "10k" } as ResistorPropsInput)
14
14
  // { resistance: 10_000 }
15
15
  ```
16
+
17
+ <!-- COMPONENT_TABLE_START -->
18
+ ## Available Components
19
+
20
+ | Component | Props Interface |
21
+ | --------- | -------------- |
22
+ | `<battery />` | [`BatteryProps`](#batteryprops-battery) |
23
+ | `<board />` | [`BoardProps`](#boardprops-board) |
24
+ | `<capacitor />` | [`CapacitorProps`](#capacitorprops-capacitor) |
25
+ | `<chip />` | [`ChipProps`](#chipprops-chip) |
26
+ | `<constrainedlayout />` | [`ConstrainedLayoutProps`](#constrainedlayoutprops-constrainedlayout) |
27
+ | `<crystal />` | [`CrystalProps`](#crystalprops-crystal) |
28
+ | `<diode />` | [`DiodeProps`](#diodeprops-diode) |
29
+ | `<footprint />` | [`FootprintProps`](#footprintprops-footprint) |
30
+ | `<group />` | [`BaseGroupProps`](#basegroupprops-group) |
31
+ | `<hole />` | [`HoleProps`](#holeprops-hole) |
32
+ | `<jumper />` | [`JumperProps`](#jumperprops-jumper) |
33
+ | `<mosfet />` | [`MosfetProps`](#mosfetprops-mosfet) |
34
+ | `<net />` | [`NetProps`](#netprops-net) |
35
+ | `<netalias />` | [`NetAliasProps`](#netaliasprops-netalias) |
36
+ | `<pinheader />` | [`PinHeaderProps`](#pinheaderprops-pinheader) |
37
+ | `<platedhole />` | [`CirclePlatedHoleProps`](#circleplatedholeprops-platedhole) |
38
+ | `<potentiometer />` | [`PotentiometerProps`](#potentiometerprops-potentiometer) |
39
+ | `<resistor />` | [`ResistorProps`](#resistorprops-resistor) |
40
+ | `<resonator />` | [`ResonatorProps`](#resonatorprops-resonator) |
41
+ | `<smtpad />` | [`RectSmtPadProps`](#rectsmtpadprops-smtpad) |
42
+ | `<solderpaste />` | [`RectSolderPasteProps`](#rectsolderpasteprops-solderpaste) |
43
+ | `<stampboard />` | [`StampboardProps`](#stampboardprops-stampboard) |
44
+ | `<switch />` | [`SwitchProps`](#switchprops-switch) |
45
+ | `<transistor />` | [`TransistorProps`](#transistorprops-transistor) |
46
+ <!-- COMPONENT_TABLE_END -->
47
+
48
+ <!-- USAGE_EXAMPLES_START -->
49
+ ## Usage Examples
50
+
51
+ ```tsx
52
+ import { resistorProps, type ResistorProps } from "@tscircuit/props"
53
+
54
+ // Validate component props
55
+ const validatedProps = resistorProps.parse({ resistance: "10k" })
56
+ // { resistance: 10000 }
57
+
58
+ // Type safety
59
+ const myResistor: ResistorProps = {
60
+ name: "R1",
61
+ resistance: 10000,
62
+ footprint: "0805"
63
+ }
64
+ ```
65
+ <!-- USAGE_EXAMPLES_END -->
66
+
67
+ <!-- INTERFACE_DEFINITIONS_START -->
68
+ ## Component Interface Definitions
69
+
70
+ Below are the TypeScript interface definitions for all component props:
71
+
72
+
73
+ ### CommonComponentProps
74
+
75
+ ```ts
76
+ export interface CommonComponentProps extends CommonLayoutProps {
77
+ key?: any
78
+ name: string
79
+ supplierPartNumbers?: SupplierPartNumbers
80
+ cadModel?: CadModelProp
81
+ children?: any
82
+ symbolName?: string
83
+ }
84
+ ```
85
+
86
+ [Source](https://github.com/tscircuit/props/blob/main/lib/common/layout.ts)
87
+
88
+
89
+ ### SubcircuitGroupProps
90
+
91
+ ```ts
92
+ export interface SubcircuitGroupProps extends BaseGroupProps {
93
+ layout?: LayoutBuilder
94
+ manualEdits?: ManualEditsFileInput
95
+ routingDisabled?: boolean
96
+ defaultTraceWidth?: Distance
97
+ minTraceWidth?: Distance
98
+ pcbRouteCache?: PcbRouteCache
99
+
100
+ autorouter?: AutorouterProp
101
+
102
+ /**
103
+ * If true, we'll automatically layout the schematic for this group. Must be
104
+ * a subcircuit (currently). This is eventually going to be replaced with more
105
+ * sophisticated layout options/modes and will be enabled by default.
106
+ */
107
+ schAutoLayoutEnabled?: boolean
108
+
109
+ /**
110
+ * If true, net labels will automatically be created for complex traces
111
+ */
112
+ schTraceAutoLabelEnabled?: boolean
113
+
114
+ partsEngine?: PartsEngine
115
+ }
116
+ ```
117
+
118
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/group.ts)
119
+
120
+
121
+ ### BatteryProps `<battery />`
122
+
123
+ ```ts
124
+ export interface BatteryProps extends CommonComponentProps {
125
+ capacity?: number | string
126
+ }
127
+ ```
128
+
129
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/battery.ts)
130
+
131
+
132
+ ### BoardProps `<board />`
133
+
134
+ ```ts
135
+ export interface BoardProps extends Omit<SubcircuitGroupProps, "subcircuit"> {
136
+ width?: number | string
137
+ height?: number | string
138
+ outline?: Point[]
139
+ outlineOffsetX?: number | string
140
+ outlineOffsetY?: number | string
141
+ material?: "fr4" | "fr1"
142
+ }
143
+ ```
144
+
145
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/board.ts)
146
+
147
+
148
+ ### CapacitorProps `<capacitor />`
149
+
150
+ ```ts
151
+ export interface CapacitorProps extends CommonComponentProps {
152
+ capacitance: number | string
153
+ maxVoltageRating?: number | string
154
+ schShowRatings?: boolean
155
+ polarized?: boolean
156
+ decouplingFor?: string
157
+ decouplingTo?: string
158
+ bypassFor?: string
159
+ bypassTo?: string
160
+ maxDecouplingTraceLength?: number
161
+ connections?: Connections<CapacitorPinLabels>
162
+ }
163
+ ```
164
+
165
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/capacitor.ts)
166
+
167
+
168
+ ### ChipProps `<chip />`
169
+
170
+ ```ts
171
+ export interface ChipPropsSU<PinLabel extends string = string>
172
+ extends CommonComponentProps {
173
+ manufacturerPartNumber?: string
174
+ pinLabels?: PinLabelsProp<string, PinLabel>
175
+ schPinArrangement?: SchematicPortArrangement
176
+ /** @deprecated Use schPinArrangement instead. */
177
+ schPortArrangement?: SchematicPortArrangement
178
+ schPinStyle?: SchematicPinStyle
179
+ schPinSpacing?: Distance
180
+ schWidth?: Distance
181
+ schHeight?: Distance
182
+ noSchematicRepresentation?: boolean
183
+ internallyConnectedPins?: string[][]
184
+ externallyConnectedPins?: string[][]
185
+ connections?: Connections<PinLabel>
186
+ }
187
+ ```
188
+
189
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/chip.ts)
190
+
191
+
192
+ ### ConstrainedLayoutProps `<constrainedlayout />`
193
+
194
+ ```ts
195
+ export interface ConstrainedLayoutProps {
196
+ name?: string
197
+ pcbOnly?: boolean
198
+ schOnly?: boolean
199
+ }
200
+ ```
201
+
202
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/constrainedlayout.ts)
203
+
204
+
205
+ ### CrystalProps `<crystal />`
206
+
207
+ ```ts
208
+ export interface CrystalProps extends CommonComponentProps {
209
+ frequency: number | string
210
+ loadCapacitance: number | string
211
+ pinVariant?: PinVariant
212
+ }
213
+ ```
214
+
215
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/crystal.ts)
216
+
217
+
218
+ ### DiodeProps `<diode />`
219
+
220
+ ```ts
221
+ export interface DiodeProps extends CommonComponentProps {
222
+ connections?: {
223
+ anode?: string | string[] | readonly string[]
224
+ cathode?: string | string[] | readonly string[]
225
+ pin1?: string | string[] | readonly string[]
226
+ pin2?: string | string[] | readonly string[]
227
+ pos?: string | string[] | readonly string[]
228
+ neg?: string | string[] | readonly string[]
229
+ }
230
+ variant?: "standard" | "schottky" | "zener" | "photo" | "tvs"
231
+ standard?: boolean
232
+ schottky?: boolean
233
+ zener?: boolean
234
+ photo?: boolean
235
+ tvs?: boolean
236
+ }
237
+ ```
238
+
239
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/diode.ts)
240
+
241
+
242
+ ### FootprintProps `<footprint />`
243
+
244
+ ```ts
245
+ export interface FootprintProps {
246
+ /**
247
+ * The layer that the footprint is designed for. If you set this to "top"
248
+ * then it means the children were intended to represent the top layer. If
249
+ * the <chip /> with this footprint is moved to the bottom layer, then the
250
+ * components will be mirrored.
251
+ *
252
+ * Generally, you shouldn't set this except where it can help prevent
253
+ * confusion because you have a complex multi-layer footprint. Default is
254
+ * "top" and this is most intuitive.
255
+ */
256
+ originalLayer?: LayerRef
257
+ }
258
+ ```
259
+
260
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/footprint.ts)
261
+
262
+
263
+ ### BaseGroupProps
264
+
265
+ ```ts
266
+ export interface BaseGroupProps extends CommonLayoutProps, LayoutConfig {
267
+ name?: string
268
+ key?: any
269
+ children?: any
270
+
271
+ pcbWidth?: Distance
272
+ pcbHeight?: Distance
273
+ schWidth?: Distance
274
+ schHeight?: Distance
275
+
276
+ pcbLayout?: LayoutConfig
277
+ schLayout?: LayoutConfig
278
+ }
279
+ ```
280
+
281
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/group.ts)
282
+
283
+
284
+ ### HoleProps `<hole />`
285
+
286
+ ```ts
287
+ export interface HoleProps extends Omit<PcbLayoutProps, "pcbRotation"> {
288
+ name?: string
289
+ diameter?: Distance
290
+ radius?: Distance
291
+ }
292
+ ```
293
+
294
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/hole.ts)
295
+
296
+
297
+ ### JumperProps `<jumper />`
298
+
299
+ ```ts
300
+ export interface JumperProps extends CommonComponentProps {
301
+ manufacturerPartNumber?: string
302
+ pinLabels?: Record<number | string, string | string[]>
303
+ schPinStyle?: SchematicPinStyle
304
+ schPinSpacing?: number | string
305
+ schWidth?: number | string
306
+ schHeight?: number | string
307
+ schDirection?: "left" | "right"
308
+ schPortArrangement?: SchematicPortArrangement
309
+ /**
310
+ * Number of pins on the jumper (2 or 3)
311
+ */
312
+ pinCount?: 2 | 3
313
+ /**
314
+ * Groups of pins that are internally connected (bridged)
315
+ * e.g., [["1","2"], ["2","3"]]
316
+ */
317
+ internallyConnectedPins?: string[][]
318
+ }
319
+ ```
320
+
321
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/jumper.ts)
322
+
323
+
324
+ ### MosfetProps `<mosfet />`
325
+
326
+ ```ts
327
+ export interface MosfetProps extends CommonComponentProps {
328
+ channelType: "n" | "p"
329
+ mosfetMode: "enhancement" | "depletion"
330
+ }
331
+ ```
332
+
333
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/mosfet.ts)
334
+
335
+
336
+ ### NetProps `<net />`
337
+
338
+ ```ts
339
+ export interface NetProps {
340
+ name: string
341
+ }
342
+ ```
343
+
344
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/net.ts)
345
+
346
+
347
+ ### NetAliasProps `<netalias />`
348
+
349
+ ```ts
350
+ export interface NetAliasProps {
351
+ net?: string
352
+ schX?: number | string
353
+ schY?: number | string
354
+ schRotation?: number | string
355
+ anchorSide?: "left" | "up" | "right" | "down"
356
+ }
357
+ ```
358
+
359
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/netalias.ts)
360
+
361
+
362
+ ### PinHeaderProps `<pinheader />`
363
+
364
+ ```ts
365
+ export interface PinHeaderProps extends CommonComponentProps {
366
+ /**
367
+ * Number of pins in the header
368
+ */
369
+ pinCount: number
370
+
371
+ /**
372
+ * Distance between pins
373
+ */
374
+ pitch?: number | string
375
+
376
+ /**
377
+ * Schematic facing direction
378
+ */
379
+ schFacingDirection?: "up" | "down" | "left" | "right"
380
+
381
+ /**
382
+ * Whether the header is male or female
383
+ */
384
+ gender?: "male" | "female"
385
+
386
+ /**
387
+ * Whether to show pin labels in silkscreen
388
+ */
389
+ showSilkscreenPinLabels?: boolean
390
+
391
+ /**
392
+ * Whether the header has two rows of pins
393
+ */
394
+ doubleRow?: boolean
395
+
396
+ /**
397
+ * Diameter of the through-hole for each pin
398
+ */
399
+ holeDiameter?: number | string
400
+
401
+ /**
402
+ * Diameter of the plated area around each hole
403
+ */
404
+ platedDiameter?: number | string
405
+
406
+ /**
407
+ * Labels for each pin
408
+ */
409
+ pinLabels?: string[]
410
+
411
+ /**
412
+ * Direction the header is facing
413
+ */
414
+ facingDirection?: "left" | "right"
415
+ }
416
+ ```
417
+
418
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/pin-header.ts)
419
+
420
+
421
+ ### CirclePlatedHoleProps `<platedhole />`
422
+
423
+ ```ts
424
+ export interface CirclePlatedHoleProps
425
+ extends Omit<PcbLayoutProps, "pcbRotation" | "layer"> {
426
+ name?: string
427
+ shape: "circle"
428
+ holeDiameter: number | string
429
+ outerDiameter: number | string
430
+ portHints?: PortHints
431
+ }
432
+ ```
433
+
434
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/platedhole.ts)
435
+
436
+
437
+ ### PotentiometerProps `<potentiometer />`
438
+
439
+ ```ts
440
+ export interface PotentiometerProps extends CommonComponentProps {
441
+ maxResistance: number | string
442
+ pinVariant?: PotentiometerPinVariant
443
+ }
444
+ ```
445
+
446
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/potentiometer.ts)
447
+
448
+
449
+ ### ResistorProps `<resistor />`
450
+
451
+ ```ts
452
+ export interface ResistorProps extends CommonComponentProps {
453
+ resistance: number | string
454
+ pullupFor?: string
455
+ pullupTo?: string
456
+ pulldownFor?: string
457
+ pulldownTo?: string
458
+ connections?: Connections<ResistorPinLabels>
459
+ }
460
+ ```
461
+
462
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/resistor.ts)
463
+
464
+
465
+ ### ResonatorProps `<resonator />`
466
+
467
+ ```ts
468
+ export interface ResonatorProps extends CommonComponentProps {
469
+ frequency: number | string
470
+ loadCapacitance: number | string
471
+ pinVariant?: ResonatorPinVariant
472
+ }
473
+ ```
474
+
475
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/resonator.ts)
476
+
477
+
478
+ ### RectSmtPadProps `<smtpad />`
479
+
480
+ ```ts
481
+ export interface RectSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
482
+ shape: "rect"
483
+ width: Distance
484
+ height: Distance
485
+ portHints?: PortHints
486
+ }
487
+ ```
488
+
489
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/smtpad.ts)
490
+
491
+
492
+ ### RectSolderPasteProps `<solderpaste />`
493
+
494
+ ```ts
495
+ export interface RectSolderPasteProps
496
+ extends Omit<PcbLayoutProps, "pcbRotation"> {
497
+ shape: "rect"
498
+ width: Distance
499
+ height: Distance
500
+ }
501
+ ```
502
+
503
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/solderpaste.ts)
504
+
505
+
506
+ ### StampboardProps `<stampboard />`
507
+
508
+ ```ts
509
+ export interface StampboardProps extends BoardProps {
510
+ leftPinCount?: number
511
+ rightPinCount?: number
512
+ topPinCount?: number
513
+ bottomPinCount?: number
514
+ leftPins?: string[]
515
+ rightPins?: string[]
516
+ topPins?: string[]
517
+ bottomPins?: string[]
518
+ pinPitch?: number | string
519
+ innerHoles?: boolean
520
+ }
521
+ ```
522
+
523
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/stampboard.ts)
524
+
525
+
526
+ ### SwitchProps `<switch />`
527
+
528
+ ```ts
529
+ export interface SwitchProps extends CommonComponentProps {
530
+ type?: "spst" | "spdt" | "dpst" | "dpdt"
531
+ isNormallyClosed?: boolean
532
+ spdt?: boolean
533
+ spst?: boolean
534
+ dpst?: boolean
535
+ dpdt?: boolean
536
+ }
537
+ ```
538
+
539
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/switch.ts)
540
+
541
+
542
+ ### TransistorProps `<transistor />`
543
+
544
+ ```ts
545
+ export interface TransistorProps extends CommonComponentProps {
546
+ type: "npn" | "pnp" | "bjt" | "jfet" | "mosfet"
547
+ }
548
+ ```
549
+
550
+ [Source](https://github.com/tscircuit/props/blob/main/lib/components/transistor.ts)
551
+
552
+ <!-- INTERFACE_DEFINITIONS_END -->
package/package.json CHANGED
@@ -1,16 +1,21 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.179",
3
+ "version": "0.0.180",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/tscircuit/props.git"
10
+ },
7
11
  "scripts": {
8
12
  "build": "tsup lib/index.ts --format esm --dts --sourcemap",
9
13
  "check-circular-deps": "madge --circular --extensions ts ./lib",
10
14
  "format": "biome format . --write",
11
15
  "format:check": "biome format .",
12
16
  "generate:manual-edits-docs": "tsx scripts/generate-manual-edits-docs.ts",
13
- "generate:component-types": "tsx scripts/generate-component-types.ts"
17
+ "generate:component-types": "tsx scripts/generate-component-types.ts",
18
+ "generate:readme-docs": "tsx scripts/generate-readme-docs.ts"
14
19
  },
15
20
  "keywords": [],
16
21
  "files": [