@tscircuit/props 0.0.420 → 0.0.421

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,5 +1,11 @@
1
+ import { distance as baseDistance, length } from "circuit-json"
1
2
  import { z } from "zod"
2
3
 
3
4
  export type Distance = number | string
4
5
 
5
- export { distance, length } from "circuit-json"
6
+ const calcString = z.string().regex(/^calc\(.*\)$/)
7
+
8
+ export const distance = baseDistance
9
+ export const pcbCoordinate = calcString.or(baseDistance)
10
+
11
+ export { length }
@@ -6,6 +6,7 @@ import {
6
6
  supplier_name,
7
7
  } from "circuit-json"
8
8
  import { expectTypesMatch } from "lib/typecheck"
9
+ import { pcbCoordinate } from "./distance"
9
10
  import { z } from "zod"
10
11
  import { type CadModelProp, cadModelProp } from "./cadModel"
11
12
  import { type FootprintProp, footprintProp } from "./footprintProp"
@@ -98,8 +99,8 @@ export interface CommonLayoutProps {
98
99
  }
99
100
 
100
101
  export const pcbLayoutProps = z.object({
101
- pcbX: distance.optional(),
102
- pcbY: distance.optional(),
102
+ pcbX: pcbCoordinate.optional(),
103
+ pcbY: pcbCoordinate.optional(),
103
104
  pcbOffsetX: distance.optional(),
104
105
  pcbOffsetY: distance.optional(),
105
106
  pcbRotation: rotation.optional(),
@@ -127,8 +128,8 @@ type InferredPcbLayoutProps = z.input<typeof pcbLayoutProps>
127
128
  expectTypesMatch<PcbLayoutProps, InferredPcbLayoutProps>(true)
128
129
 
129
130
  export const commonLayoutProps = z.object({
130
- pcbX: distance.optional(),
131
- pcbY: distance.optional(),
131
+ pcbX: pcbCoordinate.optional(),
132
+ pcbY: pcbCoordinate.optional(),
132
133
  pcbOffsetX: distance.optional(),
133
134
  pcbOffsetY: distance.optional(),
134
135
  pcbRotation: rotation.optional(),
@@ -1,4 +1,4 @@
1
- import { distance, type Distance } from "lib/common/distance"
1
+ import { distance, pcbCoordinate, type Distance } from "lib/common/distance"
2
2
  import { expectTypesMatch } from "lib/typecheck"
3
3
  import { cadModelBase, type CadModelBase } from "../common/cadModel"
4
4
  import { z } from "zod"
@@ -14,8 +14,8 @@ export interface CadModelProps extends CadModelBase {
14
14
  }
15
15
 
16
16
  const pcbPosition = z.object({
17
- pcbX: distance.optional(),
18
- pcbY: distance.optional(),
17
+ pcbX: pcbCoordinate.optional(),
18
+ pcbY: pcbCoordinate.optional(),
19
19
  pcbOffsetX: distance.optional(),
20
20
  pcbOffsetY: distance.optional(),
21
21
  pcbZ: distance.optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.420",
3
+ "version": "0.0.421",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",