@tscircuit/props 0.0.261 → 0.0.262
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 +2 -0
- package/dist/index.d.ts +1000 -81
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/lib/common/layout.ts +22 -4
- package/package.json +1 -1
package/lib/common/layout.ts
CHANGED
|
@@ -70,11 +70,31 @@ export const supplierProps = z.object({
|
|
|
70
70
|
|
|
71
71
|
expectTypesMatch<SupplierProps, z.input<typeof supplierProps>>(true)
|
|
72
72
|
|
|
73
|
+
export interface PinAttributeMap {
|
|
74
|
+
providesPower?: boolean
|
|
75
|
+
requiresPower?: boolean
|
|
76
|
+
providesGround?: boolean
|
|
77
|
+
requiresGround?: boolean
|
|
78
|
+
providesVoltage?: string | number
|
|
79
|
+
requiresVoltage?: string | number
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const pinAttributeMap = z.object({
|
|
83
|
+
providesPower: z.boolean().optional(),
|
|
84
|
+
requiresPower: z.boolean().optional(),
|
|
85
|
+
providesGround: z.boolean().optional(),
|
|
86
|
+
requiresGround: z.boolean().optional(),
|
|
87
|
+
providesVoltage: z.union([z.string(), z.number()]).optional(),
|
|
88
|
+
requiresVoltage: z.union([z.string(), z.number()]).optional(),
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
expectTypesMatch<PinAttributeMap, z.input<typeof pinAttributeMap>>(true)
|
|
92
|
+
|
|
73
93
|
export interface CommonComponentProps<PinLabel extends string = string>
|
|
74
94
|
extends CommonLayoutProps {
|
|
75
95
|
key?: any
|
|
76
96
|
name: string
|
|
77
|
-
pinAttributes?: Record<PinLabel,
|
|
97
|
+
pinAttributes?: Record<PinLabel, PinAttributeMap>
|
|
78
98
|
supplierPartNumbers?: SupplierPartNumbers
|
|
79
99
|
cadModel?: CadModelProp
|
|
80
100
|
children?: any
|
|
@@ -91,9 +111,7 @@ export const commonComponentProps = commonLayoutProps
|
|
|
91
111
|
children: z.any().optional(),
|
|
92
112
|
symbolName: z.string().optional(),
|
|
93
113
|
doNotPlace: z.boolean().optional(),
|
|
94
|
-
pinAttributes: z
|
|
95
|
-
.record(z.string(), z.record(z.string(), z.any()))
|
|
96
|
-
.optional(),
|
|
114
|
+
pinAttributes: z.record(z.string(), pinAttributeMap).optional(),
|
|
97
115
|
})
|
|
98
116
|
|
|
99
117
|
type InferredCommonComponentProps = z.input<typeof commonComponentProps>
|