forked from tscircuit/props
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpcbSx.ts
More file actions
36 lines (29 loc) · 854 Bytes
/
pcbSx.ts
File metadata and controls
36 lines (29 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { length } from "circuit-json"
import { expectTypesMatch } from "lib/typecheck"
import { pcbCoordinate } from "./distance"
import { z } from "zod"
export type PcbSxSelector =
| "& footprint[src^='kicad:'] silkscreentext"
| "& silkscreentext"
| "& fabricationnotetext"
export interface PcbSxValue {
fontSize?: string | number
pcbX?: string | number
pcbY?: string | number
visible?: boolean
}
type PcbSxBase = Record<string, PcbSxValue>
export type PcbSx = PcbSxBase & {
[K in PcbSxSelector]?: PcbSxValue
}
export const pcbSxValue = z.object({
fontSize: length.optional(),
pcbX: pcbCoordinate.optional(),
pcbY: pcbCoordinate.optional(),
visible: z.boolean().optional(),
})
export const pcbSx = z.record(
z.string(),
pcbSxValue,
) as unknown as z.ZodType<PcbSx>
expectTypesMatch<PcbSx, z.input<typeof pcbSx>>(true)