@tscircuit/props 0.0.489 → 0.0.491

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.
@@ -121,6 +121,51 @@ export type PlatedHoleProps =
121
121
  | PillWithRectPadPlatedHoleProps
122
122
  | HoleWithPolygonPadPlatedHoleProps
123
123
 
124
+ const DEFAULT_PIN_HEADER_HOLE_DIAMETER = "0.04in"
125
+ const DEFAULT_PIN_HEADER_OUTER_DIAMETER = "0.1in"
126
+
127
+ const inferPlatedHoleShapeAndDefaults = (rawProps: unknown): unknown => {
128
+ if (!rawProps || typeof rawProps !== "object") return rawProps
129
+
130
+ const props = { ...(rawProps as Record<string, unknown>) }
131
+
132
+ if (props.shape !== undefined) return props
133
+
134
+ if (props.padOutline !== undefined) {
135
+ props.shape = "hole_with_polygon_pad"
136
+ return props
137
+ }
138
+
139
+ if (props.rectPadWidth !== undefined || props.rectPadHeight !== undefined) {
140
+ if (props.holeDiameter !== undefined) {
141
+ props.shape = "circular_hole_with_rect_pad"
142
+ return props
143
+ }
144
+
145
+ props.shape = "pill_hole_with_rect_pad"
146
+ return props
147
+ }
148
+
149
+ if (
150
+ props.outerDiameter !== undefined ||
151
+ props.holeDiameter !== undefined ||
152
+ props.padDiameter !== undefined
153
+ ) {
154
+ props.shape = "circle"
155
+ return props
156
+ }
157
+
158
+ if (props.outerWidth !== undefined || props.outerHeight !== undefined) {
159
+ props.shape = props.rectPad === true ? "pill" : "oval"
160
+ return props
161
+ }
162
+
163
+ props.shape = "circle"
164
+ props.holeDiameter = DEFAULT_PIN_HEADER_HOLE_DIAMETER
165
+ props.outerDiameter = DEFAULT_PIN_HEADER_OUTER_DIAMETER
166
+ return props
167
+ }
168
+
124
169
  const distanceHiddenUndefined = z
125
170
  .custom<z.input<typeof distance>>()
126
171
  .transform((a) => {
@@ -128,7 +173,7 @@ const distanceHiddenUndefined = z
128
173
  return distance.parse(a)
129
174
  })
130
175
 
131
- export const platedHoleProps = z
176
+ const platedHolePropsByShape = z
132
177
  .discriminatedUnion("shape", [
133
178
  pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
134
179
  name: z.string().optional(),
@@ -220,7 +265,7 @@ export const platedHoleProps = z
220
265
  coveredWithSolderMask: z.boolean().optional(),
221
266
  }),
222
267
  ])
223
- .refine((a) => {
268
+ .transform((a) => {
224
269
  if ("innerWidth" in a && a.innerWidth !== undefined) {
225
270
  a.holeWidth ??= a.innerWidth
226
271
  }
@@ -230,6 +275,11 @@ export const platedHoleProps = z
230
275
  return a
231
276
  })
232
277
 
233
- type InferredPlatedHoleProps = z.input<typeof platedHoleProps>
278
+ export const platedHoleProps = z.preprocess(
279
+ inferPlatedHoleShapeAndDefaults,
280
+ platedHolePropsByShape,
281
+ )
282
+
283
+ type InferredPlatedHoleProps = z.input<typeof platedHolePropsByShape>
234
284
 
235
285
  expectTypesMatch<PlatedHoleProps, InferredPlatedHoleProps>(true)
@@ -75,6 +75,7 @@ export interface PlatformConfig {
75
75
  routingDisabled?: boolean
76
76
  schematicDisabled?: boolean
77
77
  partsEngineDisabled?: boolean
78
+ drcChecksDisabled?: boolean
78
79
  netlistDrcChecksDisabled?: boolean
79
80
  routingDrcChecksDisabled?: boolean
80
81
  placementDrcChecksDisabled?: boolean
@@ -208,6 +209,7 @@ export const platformConfig = z.object({
208
209
  routingDisabled: z.boolean().optional(),
209
210
  schematicDisabled: z.boolean().optional(),
210
211
  partsEngineDisabled: z.boolean().optional(),
212
+ drcChecksDisabled: z.boolean().optional(),
211
213
  netlistDrcChecksDisabled: z.boolean().optional(),
212
214
  routingDrcChecksDisabled: z.boolean().optional(),
213
215
  placementDrcChecksDisabled: z.boolean().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.489",
3
+ "version": "0.0.491",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",