@tscircuit/props 0.0.244 → 0.0.246
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 +5 -0
- package/dist/index.d.ts +103 -13
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/lib/common/layout.ts +6 -1
- package/lib/components/battery.ts +3 -1
- package/lib/components/capacitor.ts +2 -1
- package/lib/components/chip.ts +1 -1
- package/lib/components/crystal.ts +3 -1
- package/lib/components/diode.ts +3 -1
- package/lib/components/fuse.ts +3 -2
- package/lib/components/inductor.ts +3 -1
- package/lib/components/mosfet.ts +3 -1
- package/lib/components/resistor.ts +2 -1
- package/lib/components/transistor.ts +3 -1
- package/lib/platformConfig.ts +9 -0
- package/package.json +1 -1
package/lib/common/layout.ts
CHANGED
|
@@ -70,9 +70,11 @@ export const supplierProps = z.object({
|
|
|
70
70
|
|
|
71
71
|
expectTypesMatch<SupplierProps, z.input<typeof supplierProps>>(true)
|
|
72
72
|
|
|
73
|
-
export interface CommonComponentProps extends
|
|
73
|
+
export interface CommonComponentProps<PinLabel extends string = string>
|
|
74
|
+
extends CommonLayoutProps {
|
|
74
75
|
key?: any
|
|
75
76
|
name: string
|
|
77
|
+
pinAttributes?: Record<PinLabel, Record<string, any>>
|
|
76
78
|
supplierPartNumbers?: SupplierPartNumbers
|
|
77
79
|
cadModel?: CadModelProp
|
|
78
80
|
children?: any
|
|
@@ -89,6 +91,9 @@ export const commonComponentProps = commonLayoutProps
|
|
|
89
91
|
children: z.any().optional(),
|
|
90
92
|
symbolName: z.string().optional(),
|
|
91
93
|
doNotPlace: z.boolean().optional(),
|
|
94
|
+
pinAttributes: z
|
|
95
|
+
.record(z.string(), z.record(z.string(), z.any()))
|
|
96
|
+
.optional(),
|
|
92
97
|
})
|
|
93
98
|
|
|
94
99
|
type InferredCommonComponentProps = z.input<typeof commonComponentProps>
|
|
@@ -28,7 +28,8 @@ const capacity = z
|
|
|
28
28
|
})
|
|
29
29
|
.describe("Battery capacity in mAh")
|
|
30
30
|
|
|
31
|
-
export interface BatteryProps extends
|
|
31
|
+
export interface BatteryProps<PinLabel extends string = string>
|
|
32
|
+
extends CommonComponentProps<PinLabel> {
|
|
32
33
|
capacity?: number | string
|
|
33
34
|
schOrientation?: SchematicOrientation
|
|
34
35
|
}
|
|
@@ -38,5 +39,6 @@ export const batteryProps = commonComponentProps.extend({
|
|
|
38
39
|
schOrientation: schematicOrientation.optional(),
|
|
39
40
|
})
|
|
40
41
|
export const batteryPins = lrPolarPins
|
|
42
|
+
export type BatteryPinLabels = (typeof batteryPins)[number]
|
|
41
43
|
|
|
42
44
|
expectTypesMatch<BatteryProps, z.input<typeof batteryProps>>(true)
|
|
@@ -23,7 +23,8 @@ export const capacitorPinLabels = [
|
|
|
23
23
|
] as const
|
|
24
24
|
export type CapacitorPinLabels = (typeof capacitorPinLabels)[number]
|
|
25
25
|
|
|
26
|
-
export interface CapacitorProps extends
|
|
26
|
+
export interface CapacitorProps<PinLabel extends string = string>
|
|
27
|
+
extends CommonComponentProps<PinLabel> {
|
|
27
28
|
capacitance: number | string
|
|
28
29
|
maxVoltageRating?: number | string
|
|
29
30
|
schShowRatings?: boolean
|
package/lib/components/chip.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface PinCompatibleVariant {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export interface ChipPropsSU<PinLabel extends string = string>
|
|
36
|
-
extends CommonComponentProps {
|
|
36
|
+
extends CommonComponentProps<PinLabel> {
|
|
37
37
|
manufacturerPartNumber?: string
|
|
38
38
|
pinLabels?: PinLabelsProp<string, PinLabel>
|
|
39
39
|
/**
|
|
@@ -13,7 +13,8 @@ import { z } from "zod"
|
|
|
13
13
|
|
|
14
14
|
export type PinVariant = "two_pin" | "four_pin"
|
|
15
15
|
|
|
16
|
-
export interface CrystalProps extends
|
|
16
|
+
export interface CrystalProps<PinLabel extends string = string>
|
|
17
|
+
extends CommonComponentProps<PinLabel> {
|
|
17
18
|
frequency: number | string
|
|
18
19
|
loadCapacitance: number | string
|
|
19
20
|
pinVariant?: PinVariant
|
|
@@ -27,6 +28,7 @@ export const crystalProps = commonComponentProps.extend({
|
|
|
27
28
|
schOrientation: schematicOrientation.optional(),
|
|
28
29
|
})
|
|
29
30
|
export const crystalPins = lrPins
|
|
31
|
+
export type CrystalPinLabels = (typeof crystalPins)[number]
|
|
30
32
|
|
|
31
33
|
type InferredCrystalProps = z.input<typeof crystalProps>
|
|
32
34
|
expectTypesMatch<CrystalProps, InferredCrystalProps>(true)
|
package/lib/components/diode.ts
CHANGED
|
@@ -100,8 +100,10 @@ export const diodeProps = commonComponentProps
|
|
|
100
100
|
})
|
|
101
101
|
|
|
102
102
|
export const diodePins = lrPolarPins
|
|
103
|
+
export type DiodePinLabels = (typeof diodePins)[number]
|
|
103
104
|
|
|
104
|
-
export interface DiodeProps extends
|
|
105
|
+
export interface DiodeProps<PinLabel extends string = string>
|
|
106
|
+
extends CommonComponentProps<PinLabel> {
|
|
105
107
|
connections?: {
|
|
106
108
|
anode?: string | string[] | readonly string[]
|
|
107
109
|
cathode?: string | string[] | readonly string[]
|
package/lib/components/fuse.ts
CHANGED
|
@@ -16,7 +16,8 @@ export const fusePinLabels = ["pin1", "pin2"] as const
|
|
|
16
16
|
|
|
17
17
|
export type FusePinLabels = (typeof fusePinLabels)[number]
|
|
18
18
|
|
|
19
|
-
export interface FuseProps extends
|
|
19
|
+
export interface FuseProps<PinLabel extends string = string>
|
|
20
|
+
extends CommonComponentProps<PinLabel> {
|
|
20
21
|
/**
|
|
21
22
|
* Current rating of the fuse in amperes
|
|
22
23
|
*/
|
|
@@ -37,7 +38,7 @@ export interface FuseProps extends CommonComponentProps {
|
|
|
37
38
|
/**
|
|
38
39
|
* Connections to other components
|
|
39
40
|
*/
|
|
40
|
-
connections?: Connections<
|
|
41
|
+
connections?: Connections<PinLabel>
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
/**
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
import { expectTypesMatch } from "lib/typecheck"
|
|
12
12
|
import { z } from "zod"
|
|
13
13
|
|
|
14
|
-
export interface InductorProps extends
|
|
14
|
+
export interface InductorProps<PinLabel extends string = string>
|
|
15
|
+
extends CommonComponentProps<PinLabel> {
|
|
15
16
|
inductance: number | string
|
|
16
17
|
maxCurrentRating?: number | string
|
|
17
18
|
schOrientation?: SchematicOrientation
|
|
@@ -24,6 +25,7 @@ export const inductorProps = commonComponentProps.extend({
|
|
|
24
25
|
})
|
|
25
26
|
|
|
26
27
|
export const inductorPins = lrPins
|
|
28
|
+
export type InductorPinLabels = (typeof inductorPins)[number]
|
|
27
29
|
|
|
28
30
|
type InferredInductorProps = z.input<typeof inductorProps>
|
|
29
31
|
|
package/lib/components/mosfet.ts
CHANGED
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
import { expectTypesMatch } from "../typecheck"
|
|
6
6
|
import { z } from "zod"
|
|
7
7
|
|
|
8
|
-
export interface MosfetProps extends
|
|
8
|
+
export interface MosfetProps<PinLabel extends string = string>
|
|
9
|
+
extends CommonComponentProps<PinLabel> {
|
|
9
10
|
channelType: "n" | "p"
|
|
10
11
|
mosfetMode: "enhancement" | "depletion"
|
|
11
12
|
}
|
|
@@ -23,6 +24,7 @@ export const mosfetPins = [
|
|
|
23
24
|
"pin3",
|
|
24
25
|
"gate",
|
|
25
26
|
] as const
|
|
27
|
+
export type MosfetPinLabels = (typeof mosfetPins)[number]
|
|
26
28
|
|
|
27
29
|
type InferredMosfetProps = z.input<typeof mosfetProps>
|
|
28
30
|
expectTypesMatch<MosfetProps, InferredMosfetProps>(true)
|
|
@@ -16,7 +16,8 @@ import { z } from "zod"
|
|
|
16
16
|
export const resistorPinLabels = ["pin1", "pin2", "pos", "neg"] as const
|
|
17
17
|
export type ResistorPinLabels = (typeof resistorPinLabels)[number]
|
|
18
18
|
|
|
19
|
-
export interface ResistorProps extends
|
|
19
|
+
export interface ResistorProps<PinLabel extends string = string>
|
|
20
|
+
extends CommonComponentProps<PinLabel> {
|
|
20
21
|
resistance: number | string
|
|
21
22
|
pullupFor?: string
|
|
22
23
|
pullupTo?: string
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
import { expectTypesMatch } from "lib/typecheck"
|
|
6
6
|
import { z } from "zod"
|
|
7
7
|
|
|
8
|
-
export interface TransistorProps extends
|
|
8
|
+
export interface TransistorProps<PinLabel extends string = string>
|
|
9
|
+
extends CommonComponentProps<PinLabel> {
|
|
9
10
|
type: "npn" | "pnp" | "bjt" | "jfet" | "mosfet" | "igbt"
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -21,6 +22,7 @@ export const transistorPins = [
|
|
|
21
22
|
"pin3",
|
|
22
23
|
"base",
|
|
23
24
|
] as const
|
|
25
|
+
export type TransistorPinLabels = (typeof transistorPins)[number]
|
|
24
26
|
|
|
25
27
|
type InferredTransistorProps = z.input<typeof transistorProps>
|
|
26
28
|
expectTypesMatch<TransistorProps, InferredTransistorProps>(true)
|
package/lib/platformConfig.ts
CHANGED
|
@@ -19,6 +19,11 @@ export interface PlatformConfig {
|
|
|
19
19
|
|
|
20
20
|
cloudAutorouterUrl?: string
|
|
21
21
|
|
|
22
|
+
projectName?: string
|
|
23
|
+
version?: string
|
|
24
|
+
url?: string
|
|
25
|
+
printBoardInformationToSilkscreen?: boolean
|
|
26
|
+
|
|
22
27
|
pcbDisabled?: boolean
|
|
23
28
|
schematicDisabled?: boolean
|
|
24
29
|
partsEngineDisabled?: boolean
|
|
@@ -47,6 +52,10 @@ export const platformConfig = z.object({
|
|
|
47
52
|
autorouter: autorouterProp.optional(),
|
|
48
53
|
registryApiUrl: z.string().optional(),
|
|
49
54
|
cloudAutorouterUrl: z.string().optional(),
|
|
55
|
+
projectName: z.string().optional(),
|
|
56
|
+
version: z.string().optional(),
|
|
57
|
+
url: z.string().optional(),
|
|
58
|
+
printBoardInformationToSilkscreen: z.boolean().optional(),
|
|
50
59
|
localCacheEngine: z.any().optional(),
|
|
51
60
|
pcbDisabled: z.boolean().optional(),
|
|
52
61
|
schematicDisabled: z.boolean().optional(),
|