@tscircuit/props 0.0.687 → 0.0.688
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 +184 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/lib/common/pinAttributeMap.ts +23 -0
- package/package.json +1 -1
|
@@ -44,6 +44,11 @@ export interface PinAttributeMap {
|
|
|
44
44
|
requiresGround?: boolean
|
|
45
45
|
providesVoltage?: string | number
|
|
46
46
|
requiresVoltage?: string | number
|
|
47
|
+
/**
|
|
48
|
+
* Allowed relative deviation from requiresVoltage, e.g. 0.05 or "5%" for ±5%.
|
|
49
|
+
* Parsed as a fraction from 0 to 1; omitted values remain undefined.
|
|
50
|
+
*/
|
|
51
|
+
requiredVoltageTolerance?: number | string
|
|
47
52
|
doNotConnect?: boolean
|
|
48
53
|
includeInBoardPinout?: boolean
|
|
49
54
|
highlightColor?: string
|
|
@@ -83,6 +88,24 @@ export const pinAttributeMap = z.object({
|
|
|
83
88
|
requiresGround: z.boolean().optional(),
|
|
84
89
|
providesVoltage: z.union([z.string(), z.number()]).optional(),
|
|
85
90
|
requiresVoltage: z.union([z.string(), z.number()]).optional(),
|
|
91
|
+
requiredVoltageTolerance: z
|
|
92
|
+
.union([
|
|
93
|
+
z.number(),
|
|
94
|
+
z
|
|
95
|
+
.string()
|
|
96
|
+
.trim()
|
|
97
|
+
.regex(
|
|
98
|
+
/^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?\s*%?$/,
|
|
99
|
+
"Expected a tolerance fraction or percentage",
|
|
100
|
+
)
|
|
101
|
+
.transform((value) =>
|
|
102
|
+
value.endsWith("%")
|
|
103
|
+
? Number(value.slice(0, -1)) / 100
|
|
104
|
+
: Number(value),
|
|
105
|
+
),
|
|
106
|
+
])
|
|
107
|
+
.pipe(z.number().finite().min(0).max(1))
|
|
108
|
+
.optional(),
|
|
86
109
|
doNotConnect: z.boolean().optional(),
|
|
87
110
|
includeInBoardPinout: z.boolean().optional(),
|
|
88
111
|
highlightColor: z.string().optional(),
|