@tscircuit/props 0.0.687 → 0.0.689

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
@@ -661,6 +661,15 @@ var pinAttributeMap = z23.object({
661
661
  requiresGround: z23.boolean().optional(),
662
662
  providesVoltage: z23.union([z23.string(), z23.number()]).optional(),
663
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(),
664
673
  doNotConnect: z23.boolean().optional(),
665
674
  includeInBoardPinout: z23.boolean().optional(),
666
675
  highlightColor: z23.string().optional(),
@@ -19284,7 +19293,22 @@ var cadModelBaseWithUrl = cadModelBase.extend({
19284
19293
  });
19285
19294
  var cadModelObject = cadModelBaseWithUrl.merge(pcbPosition);
19286
19295
  expectTypesMatch(true);
19287
- var cadmodelProps = z128.union([z128.null(), url, cadModelObject]);
19296
+ var cadModelInputObject = cadModelBase.extend({
19297
+ /** Modelprinter specification or HTTP(S) URL; mutually exclusive with modelUrl. */
19298
+ model: z128.string().trim().min(1).optional(),
19299
+ modelUrl: url.optional()
19300
+ }).merge(pcbPosition).refine(
19301
+ (props) => props.model === void 0 !== (props.modelUrl === void 0),
19302
+ {
19303
+ message: "Provide exactly one of model or modelUrl",
19304
+ path: ["model"]
19305
+ }
19306
+ ).transform(({ model, ...props }) => ({
19307
+ ...props,
19308
+ modelUrl: model === void 0 ? props.modelUrl : /^https?:\/\//i.test(model) ? model : `https://modelcdn.tscircuit.com/jscad_models/${encodeURIComponent(model)}.glb`
19309
+ })).pipe(cadModelObject);
19310
+ expectTypesMatch(true);
19311
+ var cadmodelProps = z128.union([z128.null(), url, cadModelInputObject]);
19288
19312
 
19289
19313
  // lib/components/power-source.ts
19290
19314
  import { voltage as voltage5 } from "circuit-json";