@tscircuit/props 0.0.574 → 0.0.576

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.
@@ -0,0 +1,26 @@
1
+ import { expectTypesMatch } from "lib/typecheck"
2
+ import { z } from "zod"
3
+
4
+ /**
5
+ * Defines matched routing constraints for two named traces that form a
6
+ * differential pair. Both connections must refer to trace `name` values.
7
+ */
8
+ export interface DifferentialPairProps {
9
+ name?: string
10
+ /** Name of the trace or pin carrying the positive signal. */
11
+ positiveConnection: string
12
+ /** Name of the trace or pin carrying the negative signal. */
13
+ negativeConnection: string
14
+ /** Maximum permitted routed-length skew, expressed as a ratio from 0 to 1. */
15
+ maxLengthSkew?: number
16
+ }
17
+
18
+ export const differentialPairProps = z.object({
19
+ name: z.string().optional(),
20
+ positiveConnection: z.string(),
21
+ negativeConnection: z.string(),
22
+ maxLengthSkew: z.number().min(0).max(1).optional(),
23
+ })
24
+
25
+ type InferredDifferentialPairProps = z.input<typeof differentialPairProps>
26
+ expectTypesMatch<DifferentialPairProps, InferredDifferentialPairProps>(true)
@@ -13,15 +13,23 @@ export interface NetLabelProps {
13
13
  anchorSide?: "left" | "top" | "right" | "bottom"
14
14
  }
15
15
 
16
- export const netLabelProps = z.object({
17
- net: z.string().optional(),
18
- connection: z.string().optional(),
19
- connectsTo: z.string().or(z.array(z.string())).optional(),
20
- schX: distance.optional(),
21
- schY: distance.optional(),
22
- schRotation: rotation.optional(),
23
- anchorSide: z.enum(["left", "top", "right", "bottom"]).optional(),
24
- })
16
+ export const netLabelProps = z
17
+ .object({
18
+ net: z.string().optional(),
19
+ connection: z.string().optional(),
20
+ connectsTo: z.string().or(z.array(z.string())).optional(),
21
+ schX: distance.optional(),
22
+ schY: distance.optional(),
23
+ schRotation: rotation.optional(),
24
+ anchorSide: z.enum(["left", "top", "right", "bottom"]).optional(),
25
+ })
26
+ .refine(
27
+ (props) => props.net === undefined || props.connection === undefined,
28
+ {
29
+ message: "net and connection cannot be provided together",
30
+ path: ["connection"],
31
+ },
32
+ )
25
33
 
26
34
  type InferredNetLabelProps = z.input<typeof netLabelProps>
27
35
  expectTypesMatch<NetLabelProps, InferredNetLabelProps>(true)
package/lib/index.ts CHANGED
@@ -55,6 +55,7 @@ export * from "./components/smtpad"
55
55
  export * from "./components/solderpaste"
56
56
  export * from "./components/hole"
57
57
  export * from "./components/trace"
58
+ export * from "./components/differentialpair"
58
59
  export * from "./components/footprint"
59
60
  export * from "./components/symbol"
60
61
  export * from "./components/battery"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.574",
3
+ "version": "0.0.576",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",