@tscircuit/props 0.0.686 → 0.0.687

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 CHANGED
@@ -3158,40 +3158,87 @@ interface AssemblyMotorProps {
3158
3158
  shaftFacingDirection?: CadModelAxisDirection;
3159
3159
  /** e.g. "jst-ph-6". */
3160
3160
  wireConnection?: "none" | "stubs" | "jst-ph-6";
3161
+ /** Assembly mounting target, e.g. "FRAME.xMotor"; paired with mountFace.
3162
+ * Face mating determines orientation, so shaftFacingDirection must be omitted.
3163
+ */
3164
+ mountedTo?: string;
3165
+ /** This motor's mating face, e.g. "frontface" or "backface".
3166
+ * Outward normals oppose and in-plane X directions align with the target.
3167
+ */
3168
+ mountFace?: string;
3169
+ /** Nonnegative surface clearance in mm or a unit string; defaults to zero.
3170
+ * Requires mountedTo. Positive values separate the mating faces.
3171
+ */
3172
+ mountGap?: Distance;
3161
3173
  }
3162
- declare const assemblyMotorProps: z.ZodEffects<z.ZodObject<{
3174
+ declare const assemblyMotorProps: z.ZodEffects<z.ZodEffects<z.ZodObject<{
3163
3175
  name: z.ZodEffects<z.ZodString, string, string>;
3164
3176
  displayName: z.ZodOptional<z.ZodString>;
3165
3177
  standard: z.ZodOptional<z.ZodEnum<["nema8", "nema17", "nema23"]>>;
3166
3178
  model: z.ZodOptional<z.ZodString>;
3167
- shaftFacingDirection: z.ZodDefault<z.ZodEnum<["x+", "x-", "y+", "y-", "z+", "z-"]>>;
3179
+ shaftFacingDirection: z.ZodOptional<z.ZodEnum<["x+", "x-", "y+", "y-", "z+", "z-"]>>;
3168
3180
  wireConnection: z.ZodOptional<z.ZodEnum<["none", "stubs", "jst-ph-6"]>>;
3181
+ mountedTo: z.ZodOptional<z.ZodString>;
3182
+ mountFace: z.ZodOptional<z.ZodString>;
3183
+ mountGap: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>, z.ZodNumber>>;
3169
3184
  }, "strip", z.ZodTypeAny, {
3170
3185
  name: string;
3171
- shaftFacingDirection: "x+" | "x-" | "y+" | "y-" | "z+" | "z-";
3172
3186
  displayName?: string | undefined;
3173
3187
  model?: string | undefined;
3174
3188
  standard?: "nema8" | "nema17" | "nema23" | undefined;
3189
+ mountedTo?: string | undefined;
3190
+ mountFace?: string | undefined;
3191
+ mountGap?: number | undefined;
3192
+ shaftFacingDirection?: "x+" | "x-" | "y+" | "y-" | "z+" | "z-" | undefined;
3175
3193
  wireConnection?: "none" | "stubs" | "jst-ph-6" | undefined;
3176
3194
  }, {
3177
3195
  name: string;
3178
3196
  displayName?: string | undefined;
3179
3197
  model?: string | undefined;
3180
3198
  standard?: "nema8" | "nema17" | "nema23" | undefined;
3199
+ mountedTo?: string | undefined;
3200
+ mountFace?: string | undefined;
3201
+ mountGap?: string | number | undefined;
3181
3202
  shaftFacingDirection?: "x+" | "x-" | "y+" | "y-" | "z+" | "z-" | undefined;
3182
3203
  wireConnection?: "none" | "stubs" | "jst-ph-6" | undefined;
3183
3204
  }>, {
3184
3205
  name: string;
3185
- shaftFacingDirection: "x+" | "x-" | "y+" | "y-" | "z+" | "z-";
3186
3206
  displayName?: string | undefined;
3187
3207
  model?: string | undefined;
3188
3208
  standard?: "nema8" | "nema17" | "nema23" | undefined;
3209
+ mountedTo?: string | undefined;
3210
+ mountFace?: string | undefined;
3211
+ mountGap?: number | undefined;
3212
+ shaftFacingDirection?: "x+" | "x-" | "y+" | "y-" | "z+" | "z-" | undefined;
3213
+ wireConnection?: "none" | "stubs" | "jst-ph-6" | undefined;
3214
+ }, {
3215
+ name: string;
3216
+ displayName?: string | undefined;
3217
+ model?: string | undefined;
3218
+ standard?: "nema8" | "nema17" | "nema23" | undefined;
3219
+ mountedTo?: string | undefined;
3220
+ mountFace?: string | undefined;
3221
+ mountGap?: string | number | undefined;
3222
+ shaftFacingDirection?: "x+" | "x-" | "y+" | "y-" | "z+" | "z-" | undefined;
3223
+ wireConnection?: "none" | "stubs" | "jst-ph-6" | undefined;
3224
+ }>, {
3225
+ name: string;
3226
+ displayName?: string | undefined;
3227
+ model?: string | undefined;
3228
+ standard?: "nema8" | "nema17" | "nema23" | undefined;
3229
+ mountedTo?: string | undefined;
3230
+ mountFace?: string | undefined;
3231
+ mountGap?: number | undefined;
3232
+ shaftFacingDirection?: "x+" | "x-" | "y+" | "y-" | "z+" | "z-" | undefined;
3189
3233
  wireConnection?: "none" | "stubs" | "jst-ph-6" | undefined;
3190
3234
  }, {
3191
3235
  name: string;
3192
3236
  displayName?: string | undefined;
3193
3237
  model?: string | undefined;
3194
3238
  standard?: "nema8" | "nema17" | "nema23" | undefined;
3239
+ mountedTo?: string | undefined;
3240
+ mountFace?: string | undefined;
3241
+ mountGap?: string | number | undefined;
3195
3242
  shaftFacingDirection?: "x+" | "x-" | "y+" | "y-" | "z+" | "z-" | undefined;
3196
3243
  wireConnection?: "none" | "stubs" | "jst-ph-6" | undefined;
3197
3244
  }>;
@@ -11991,39 +12038,74 @@ declare const assemblyProps: {
11991
12038
  model?: string | undefined;
11992
12039
  modelUrl?: string | undefined;
11993
12040
  }>;
11994
- readonly motor: zod.ZodEffects<zod.ZodObject<{
12041
+ readonly motor: zod.ZodEffects<zod.ZodEffects<zod.ZodObject<{
11995
12042
  name: zod.ZodEffects<zod.ZodString, string, string>;
11996
12043
  displayName: zod.ZodOptional<zod.ZodString>;
11997
12044
  standard: zod.ZodOptional<zod.ZodEnum<["nema8", "nema17", "nema23"]>>;
11998
12045
  model: zod.ZodOptional<zod.ZodString>;
11999
- shaftFacingDirection: zod.ZodDefault<zod.ZodEnum<["x+", "x-", "y+", "y-", "z+", "z-"]>>;
12046
+ shaftFacingDirection: zod.ZodOptional<zod.ZodEnum<["x+", "x-", "y+", "y-", "z+", "z-"]>>;
12000
12047
  wireConnection: zod.ZodOptional<zod.ZodEnum<["none", "stubs", "jst-ph-6"]>>;
12048
+ mountedTo: zod.ZodOptional<zod.ZodString>;
12049
+ mountFace: zod.ZodOptional<zod.ZodString>;
12050
+ mountGap: zod.ZodOptional<zod.ZodPipeline<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>, zod.ZodNumber>>;
12001
12051
  }, "strip", zod.ZodTypeAny, {
12002
12052
  name: string;
12003
- shaftFacingDirection: "x+" | "x-" | "y+" | "y-" | "z+" | "z-";
12004
12053
  displayName?: string | undefined;
12005
12054
  model?: string | undefined;
12006
12055
  standard?: "nema8" | "nema17" | "nema23" | undefined;
12056
+ mountedTo?: string | undefined;
12057
+ mountFace?: string | undefined;
12058
+ mountGap?: number | undefined;
12059
+ shaftFacingDirection?: "x+" | "x-" | "y+" | "y-" | "z+" | "z-" | undefined;
12007
12060
  wireConnection?: "none" | "stubs" | "jst-ph-6" | undefined;
12008
12061
  }, {
12009
12062
  name: string;
12010
12063
  displayName?: string | undefined;
12011
12064
  model?: string | undefined;
12012
12065
  standard?: "nema8" | "nema17" | "nema23" | undefined;
12066
+ mountedTo?: string | undefined;
12067
+ mountFace?: string | undefined;
12068
+ mountGap?: string | number | undefined;
12013
12069
  shaftFacingDirection?: "x+" | "x-" | "y+" | "y-" | "z+" | "z-" | undefined;
12014
12070
  wireConnection?: "none" | "stubs" | "jst-ph-6" | undefined;
12015
12071
  }>, {
12016
12072
  name: string;
12017
- shaftFacingDirection: "x+" | "x-" | "y+" | "y-" | "z+" | "z-";
12018
12073
  displayName?: string | undefined;
12019
12074
  model?: string | undefined;
12020
12075
  standard?: "nema8" | "nema17" | "nema23" | undefined;
12076
+ mountedTo?: string | undefined;
12077
+ mountFace?: string | undefined;
12078
+ mountGap?: number | undefined;
12079
+ shaftFacingDirection?: "x+" | "x-" | "y+" | "y-" | "z+" | "z-" | undefined;
12021
12080
  wireConnection?: "none" | "stubs" | "jst-ph-6" | undefined;
12022
12081
  }, {
12023
12082
  name: string;
12024
12083
  displayName?: string | undefined;
12025
12084
  model?: string | undefined;
12026
12085
  standard?: "nema8" | "nema17" | "nema23" | undefined;
12086
+ mountedTo?: string | undefined;
12087
+ mountFace?: string | undefined;
12088
+ mountGap?: string | number | undefined;
12089
+ shaftFacingDirection?: "x+" | "x-" | "y+" | "y-" | "z+" | "z-" | undefined;
12090
+ wireConnection?: "none" | "stubs" | "jst-ph-6" | undefined;
12091
+ }>, {
12092
+ name: string;
12093
+ displayName?: string | undefined;
12094
+ model?: string | undefined;
12095
+ standard?: "nema8" | "nema17" | "nema23" | undefined;
12096
+ mountedTo?: string | undefined;
12097
+ mountFace?: string | undefined;
12098
+ mountGap?: number | undefined;
12099
+ shaftFacingDirection?: "x+" | "x-" | "y+" | "y-" | "z+" | "z-" | undefined;
12100
+ wireConnection?: "none" | "stubs" | "jst-ph-6" | undefined;
12101
+ }, {
12102
+ name: string;
12103
+ displayName?: string | undefined;
12104
+ model?: string | undefined;
12105
+ standard?: "nema8" | "nema17" | "nema23" | undefined;
12106
+ mountedTo?: string | undefined;
12107
+ mountFace?: string | undefined;
12108
+ mountGap?: string | number | undefined;
12027
12109
  shaftFacingDirection?: "x+" | "x-" | "y+" | "y-" | "z+" | "z-" | undefined;
12028
12110
  wireConnection?: "none" | "stubs" | "jst-ph-6" | undefined;
12029
12111
  }>;
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