@tscircuit/props 0.0.530 → 0.0.531

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.
@@ -57,40 +57,44 @@ const mapResistorFootprint = (
57
57
  if (!resistorImperialFootprintNames.has(footprint)) return footprint
58
58
  return `res${footprint}`
59
59
  }
60
- export const resistorProps: z.ZodType<ResistorProps> =
61
- commonComponentProps.extend({
62
- footprint: footprintProp.optional().transform(mapResistorFootprint),
63
- resistance,
64
- tolerance: z
65
- .union([z.string(), z.number()])
66
- .transform((val) => {
67
- if (typeof val === "string") {
68
- if (val.endsWith("%")) {
69
- return parseFloat(val.slice(0, -1)) / 100
70
- }
71
- return parseFloat(val)
60
+
61
+ const resistorFootprintProp: z.ZodType<ResistorFootprint> = footprintProp
62
+ .optional()
63
+ .transform(mapResistorFootprint)
64
+
65
+ export const resistorProps = commonComponentProps.extend({
66
+ footprint: resistorFootprintProp,
67
+ resistance,
68
+ tolerance: z
69
+ .union([z.string(), z.number()])
70
+ .transform((val) => {
71
+ if (typeof val === "string") {
72
+ if (val.endsWith("%")) {
73
+ return parseFloat(val.slice(0, -1)) / 100
72
74
  }
73
- return val
74
- })
75
- .pipe(
76
- z
77
- .number()
78
- .min(0, "Tolerance must be non-negative")
79
- .max(1, "Tolerance cannot be greater than 100%"),
80
- )
81
- .optional(),
75
+ return parseFloat(val)
76
+ }
77
+ return val
78
+ })
79
+ .pipe(
80
+ z
81
+ .number()
82
+ .min(0, "Tolerance must be non-negative")
83
+ .max(1, "Tolerance cannot be greater than 100%"),
84
+ )
85
+ .optional(),
82
86
 
83
- pullupFor: z.string().optional(),
84
- pullupTo: z.string().optional(),
87
+ pullupFor: z.string().optional(),
88
+ pullupTo: z.string().optional(),
85
89
 
86
- pulldownFor: z.string().optional(),
87
- pulldownTo: z.string().optional(),
90
+ pulldownFor: z.string().optional(),
91
+ pulldownTo: z.string().optional(),
88
92
 
89
- schOrientation: schematicOrientation.optional(),
90
- schSize: schematicSymbolSize.optional(),
93
+ schOrientation: schematicOrientation.optional(),
94
+ schSize: schematicSymbolSize.optional(),
91
95
 
92
- connections: createConnectionsProp(resistorPinLabels).optional(),
93
- })
96
+ connections: createConnectionsProp(resistorPinLabels).optional(),
97
+ })
94
98
  export const resistorPins = lrPins
95
99
 
96
100
  type InferredResistorProps = z.input<typeof resistorProps>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.530",
3
+ "version": "0.0.531",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",