@tscircuit/props 0.0.328 → 0.0.329
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 +28 -22
- package/dist/index.d.ts +29 -13
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/lib/components/platedhole.ts +8 -4
- package/lib/platformConfig.ts +19 -0
- package/package.json +1 -1
|
@@ -61,8 +61,8 @@ export interface CircularHoleWithRectPlatedProps
|
|
|
61
61
|
holeShape?: "circle"
|
|
62
62
|
padShape?: "rect"
|
|
63
63
|
portHints?: PortHints
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
holeOffsetX?: number | string
|
|
65
|
+
holeOffsetY?: number | string
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
export interface PillWithRectPadPlatedHoleProps
|
|
@@ -77,6 +77,8 @@ export interface PillWithRectPadPlatedHoleProps
|
|
|
77
77
|
rectPadWidth: number | string
|
|
78
78
|
rectPadHeight: number | string
|
|
79
79
|
portHints?: PortHints
|
|
80
|
+
holeOffsetX?: number | string
|
|
81
|
+
holeOffsetY?: number | string
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
export type PlatedHoleProps =
|
|
@@ -139,8 +141,8 @@ export const platedHoleProps = z
|
|
|
139
141
|
holeShape: z.literal("circle").optional(),
|
|
140
142
|
padShape: z.literal("rect").optional(),
|
|
141
143
|
portHints: portHints.optional(),
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
holeOffsetX: distance.optional(),
|
|
145
|
+
holeOffsetY: distance.optional(),
|
|
144
146
|
}),
|
|
145
147
|
pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
|
|
146
148
|
name: z.string().optional(),
|
|
@@ -153,6 +155,8 @@ export const platedHoleProps = z
|
|
|
153
155
|
rectPadWidth: distance,
|
|
154
156
|
rectPadHeight: distance,
|
|
155
157
|
portHints: portHints.optional(),
|
|
158
|
+
holeOffsetX: distance.optional(),
|
|
159
|
+
holeOffsetY: distance.optional(),
|
|
156
160
|
}),
|
|
157
161
|
])
|
|
158
162
|
.refine((a) => {
|
package/lib/platformConfig.ts
CHANGED
|
@@ -13,6 +13,10 @@ export interface FootprintLibraryResult {
|
|
|
13
13
|
cadModel?: CadModelProp
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export interface FootprintFileParserEntry {
|
|
17
|
+
loadFromUrl: (url: string) => Promise<FootprintLibraryResult>
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
export interface PlatformConfig {
|
|
17
21
|
partsEngine?: PartsEngine
|
|
18
22
|
|
|
@@ -43,6 +47,8 @@ export interface PlatformConfig {
|
|
|
43
47
|
any[] | ((path: string) => Promise<FootprintLibraryResult>)
|
|
44
48
|
>
|
|
45
49
|
>
|
|
50
|
+
|
|
51
|
+
footprintFileParserMap?: Record<string, FootprintFileParserEntry>
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
const unvalidatedCircuitJson = z.array(z.any()).describe("Circuit JSON")
|
|
@@ -56,6 +62,16 @@ const pathToCircuitJsonFn = z
|
|
|
56
62
|
.returns(z.promise(footprintLibraryResult))
|
|
57
63
|
.describe("A function that takes a path and returns Circuit JSON")
|
|
58
64
|
|
|
65
|
+
const footprintFileParserEntry = z.object({
|
|
66
|
+
loadFromUrl: z
|
|
67
|
+
.function()
|
|
68
|
+
.args(z.string())
|
|
69
|
+
.returns(z.promise(footprintLibraryResult))
|
|
70
|
+
.describe(
|
|
71
|
+
"A function that takes a footprint file URL and returns Circuit JSON",
|
|
72
|
+
),
|
|
73
|
+
})
|
|
74
|
+
|
|
59
75
|
export const platformConfig = z.object({
|
|
60
76
|
partsEngine: partsEngine.optional(),
|
|
61
77
|
autorouter: autorouterProp.optional(),
|
|
@@ -82,6 +98,9 @@ export const platformConfig = z.object({
|
|
|
82
98
|
]),
|
|
83
99
|
)
|
|
84
100
|
.optional(),
|
|
101
|
+
footprintFileParserMap: z
|
|
102
|
+
.record(z.string(), footprintFileParserEntry)
|
|
103
|
+
.optional(),
|
|
85
104
|
}) as z.ZodType<PlatformConfig>
|
|
86
105
|
|
|
87
106
|
expectTypesMatch<PlatformConfig, z.infer<typeof platformConfig>>(true)
|