@tscircuit/props 0.0.686 → 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.js CHANGED
@@ -243,9 +243,33 @@ var assemblyMotorProps = z11.object({
243
243
  displayName: z11.string().optional(),
244
244
  standard: z11.enum(["nema8", "nema17", "nema23"]).optional(),
245
245
  model: z11.string().trim().min(1).optional(),
246
- shaftFacingDirection: cadModelAxisDirection.default("z+"),
247
- wireConnection: z11.enum(["none", "stubs", "jst-ph-6"]).optional()
246
+ shaftFacingDirection: cadModelAxisDirection.optional(),
247
+ wireConnection: z11.enum(["none", "stubs", "jst-ph-6"]).optional(),
248
+ mountedTo: z11.string().trim().regex(/^.+\.[^.]+$/, "Expected part.face").optional(),
249
+ mountFace: z11.string().trim().min(1).optional(),
250
+ mountGap: distance.pipe(z11.number().nonnegative().finite()).optional()
248
251
  }).superRefine((motor, context) => {
252
+ if (motor.mountedTo === void 0 !== (motor.mountFace === void 0)) {
253
+ context.addIssue({
254
+ code: z11.ZodIssueCode.custom,
255
+ message: "Provide mountedTo and mountFace together",
256
+ path: ["mountFace"]
257
+ });
258
+ }
259
+ if (motor.mountGap !== void 0 && motor.mountedTo === void 0) {
260
+ context.addIssue({
261
+ code: z11.ZodIssueCode.custom,
262
+ message: "mountGap requires mountedTo",
263
+ path: ["mountGap"]
264
+ });
265
+ }
266
+ if (motor.mountedTo !== void 0 && motor.shaftFacingDirection !== void 0) {
267
+ context.addIssue({
268
+ code: z11.ZodIssueCode.custom,
269
+ message: "Mounted motors derive shaft direction from the mating faces",
270
+ path: ["shaftFacingDirection"]
271
+ });
272
+ }
249
273
  if (motor.model !== void 0 && motor.wireConnection !== void 0) {
250
274
  context.addIssue({
251
275
  code: z11.ZodIssueCode.custom,
@@ -267,7 +291,12 @@ var assemblyMotorProps = z11.object({
267
291
  path: ["model"]
268
292
  });
269
293
  }
270
- });
294
+ }).transform(
295
+ (motor) => motor.mountedTo === void 0 ? {
296
+ ...motor,
297
+ shaftFacingDirection: motor.shaftFacingDirection ?? "z+"
298
+ } : motor
299
+ );
271
300
  expectTypesMatch(true);
272
301
 
273
302
  // lib/assembly/screen.ts
@@ -632,6 +661,15 @@ var pinAttributeMap = z23.object({
632
661
  requiresGround: z23.boolean().optional(),
633
662
  providesVoltage: z23.union([z23.string(), z23.number()]).optional(),
634
663
  requiresVoltage: z23.union([z23.string(), z23.number()]).optional(),
664
+ requiredVoltageTolerance: z23.union([
665
+ z23.number(),
666
+ z23.string().trim().regex(
667
+ /^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?\s*%?$/,
668
+ "Expected a tolerance fraction or percentage"
669
+ ).transform(
670
+ (value) => value.endsWith("%") ? Number(value.slice(0, -1)) / 100 : Number(value)
671
+ )
672
+ ]).pipe(z23.number().finite().min(0).max(1)).optional(),
635
673
  doNotConnect: z23.boolean().optional(),
636
674
  includeInBoardPinout: z23.boolean().optional(),
637
675
  highlightColor: z23.string().optional(),