@tscircuit/props 0.0.462 → 0.0.463

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.
@@ -1,4 +1,4 @@
1
- import { distance, route_hint_point } from "circuit-json"
1
+ import { distance, layer_ref, route_hint_point } from "circuit-json"
2
2
  import { z } from "zod"
3
3
  import { point } from "../common/point"
4
4
 
@@ -9,7 +9,31 @@ export const portRef = z.union([
9
9
  ),
10
10
  ])
11
11
 
12
- const pcbPath = z.array(z.union([point, z.string()]))
12
+ const pcbPathPoint = point
13
+ .extend({
14
+ via: z.boolean().optional(),
15
+ fromLayer: layer_ref.optional(),
16
+ toLayer: layer_ref.optional(),
17
+ })
18
+ .superRefine((value, ctx) => {
19
+ if (value.via) {
20
+ if (!value.toLayer) {
21
+ ctx.addIssue({
22
+ code: z.ZodIssueCode.custom,
23
+ message: "toLayer is required when via is true",
24
+ path: ["toLayer"],
25
+ })
26
+ }
27
+ } else if (value.fromLayer || value.toLayer) {
28
+ ctx.addIssue({
29
+ code: z.ZodIssueCode.custom,
30
+ message: "fromLayer/toLayer are only allowed when via is true",
31
+ path: ["via"],
32
+ })
33
+ }
34
+ })
35
+
36
+ const pcbPath = z.array(z.union([pcbPathPoint, z.string()]))
13
37
 
14
38
  const baseTraceProps = z.object({
15
39
  key: z.string().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.462",
3
+ "version": "0.0.463",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",