@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.
- package/dist/index.d.ts +372 -372
- package/dist/index.js +15 -10
- package/dist/index.js.map +1 -1
- package/lib/common/distance.ts +7 -1
- package/lib/common/layout.ts +5 -4
- package/lib/components/cadmodel.ts +3 -3
- package/package.json +1 -1
package/lib/common/distance.ts
CHANGED
|
@@ -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
|
-
|
|
6
|
+
const calcString = z.string().regex(/^calc\(.*\)$/)
|
|
7
|
+
|
|
8
|
+
export const distance = baseDistance
|
|
9
|
+
export const pcbCoordinate = calcString.or(baseDistance)
|
|
10
|
+
|
|
11
|
+
export { length }
|
package/lib/common/layout.ts
CHANGED
|
@@ -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:
|
|
102
|
-
pcbY:
|
|
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:
|
|
131
|
-
pcbY:
|
|
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:
|
|
18
|
-
pcbY:
|
|
17
|
+
pcbX: pcbCoordinate.optional(),
|
|
18
|
+
pcbY: pcbCoordinate.optional(),
|
|
19
19
|
pcbOffsetX: distance.optional(),
|
|
20
20
|
pcbOffsetY: distance.optional(),
|
|
21
21
|
pcbZ: distance.optional(),
|