@tscircuit/props 0.0.459 → 0.0.460
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/README.md +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/lib/components/resistor.ts +19 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1334,6 +1334,7 @@ export interface ResistorProps<
|
|
|
1334
1334
|
PinLabel extends string = string,
|
|
1335
1335
|
> extends CommonComponentProps<PinLabel> {
|
|
1336
1336
|
resistance: number | string;
|
|
1337
|
+
tolerance?: number | string;
|
|
1337
1338
|
pullupFor?: string;
|
|
1338
1339
|
pullupTo?: string;
|
|
1339
1340
|
pulldownFor?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -64362,6 +64362,7 @@ declare const resistorPinLabels: readonly ["pin1", "pin2", "pos", "neg"];
|
|
|
64362
64362
|
type ResistorPinLabels = (typeof resistorPinLabels)[number];
|
|
64363
64363
|
interface ResistorProps<PinLabel extends string = string> extends CommonComponentProps<PinLabel> {
|
|
64364
64364
|
resistance: number | string;
|
|
64365
|
+
tolerance?: number | string;
|
|
64365
64366
|
pullupFor?: string;
|
|
64366
64367
|
pullupTo?: string;
|
|
64367
64368
|
pulldownFor?: string;
|
|
@@ -67436,6 +67437,7 @@ declare const resistorProps: z.ZodObject<{
|
|
|
67436
67437
|
manufacturerPartNumber: z.ZodOptional<z.ZodString>;
|
|
67437
67438
|
} & {
|
|
67438
67439
|
resistance: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
67440
|
+
tolerance: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>, z.ZodNumber>>;
|
|
67439
67441
|
pullupFor: z.ZodOptional<z.ZodString>;
|
|
67440
67442
|
pullupTo: z.ZodOptional<z.ZodString>;
|
|
67441
67443
|
pulldownFor: z.ZodOptional<z.ZodString>;
|
|
@@ -67941,6 +67943,7 @@ declare const resistorProps: z.ZodObject<{
|
|
|
67941
67943
|
manufacturerPartNumber?: string | undefined;
|
|
67942
67944
|
connections?: Partial<Record<"pin1" | "pin2" | "pos" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
67943
67945
|
schOrientation?: "vertical" | "horizontal" | "pos_top" | "pos_bottom" | "pos_left" | "pos_right" | "neg_top" | "neg_bottom" | "neg_left" | "neg_right" | undefined;
|
|
67946
|
+
tolerance?: number | undefined;
|
|
67944
67947
|
pullupFor?: string | undefined;
|
|
67945
67948
|
pullupTo?: string | undefined;
|
|
67946
67949
|
pulldownFor?: string | undefined;
|
|
@@ -68446,6 +68449,7 @@ declare const resistorProps: z.ZodObject<{
|
|
|
68446
68449
|
manufacturerPartNumber?: string | undefined;
|
|
68447
68450
|
connections?: Partial<Record<"pin1" | "pin2" | "pos" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
68448
68451
|
schOrientation?: "vertical" | "horizontal" | "pos_top" | "pos_bottom" | "pos_left" | "pos_right" | "neg_top" | "neg_bottom" | "neg_left" | "neg_right" | undefined;
|
|
68452
|
+
tolerance?: string | number | undefined;
|
|
68449
68453
|
pullupFor?: string | undefined;
|
|
68450
68454
|
pullupTo?: string | undefined;
|
|
68451
68455
|
pulldownFor?: string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -1231,6 +1231,17 @@ import { z as z45 } from "zod";
|
|
|
1231
1231
|
var resistorPinLabels = ["pin1", "pin2", "pos", "neg"];
|
|
1232
1232
|
var resistorProps = commonComponentProps.extend({
|
|
1233
1233
|
resistance,
|
|
1234
|
+
tolerance: z45.union([z45.string(), z45.number()]).transform((val) => {
|
|
1235
|
+
if (typeof val === "string") {
|
|
1236
|
+
if (val.endsWith("%")) {
|
|
1237
|
+
return parseFloat(val.slice(0, -1)) / 100;
|
|
1238
|
+
}
|
|
1239
|
+
return parseFloat(val);
|
|
1240
|
+
}
|
|
1241
|
+
return val;
|
|
1242
|
+
}).pipe(
|
|
1243
|
+
z45.number().min(0, "Tolerance must be non-negative").max(1, "Tolerance cannot be greater than 100%")
|
|
1244
|
+
).optional(),
|
|
1234
1245
|
pullupFor: z45.string().optional(),
|
|
1235
1246
|
pullupTo: z45.string().optional(),
|
|
1236
1247
|
pulldownFor: z45.string().optional(),
|