Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions generated/COMPONENT_TYPES.md
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ export interface PcbSxValue {
fontSize?: string | number
pcbX?: string | number
pcbY?: string | number
visible?: boolean
}
export type PcbSx = PcbSxBase & {
[K in PcbSxSelector]?: PcbSxValue
Expand All @@ -743,6 +744,7 @@ export const pcbSxValue = z.object({
fontSize: length.optional(),
pcbX: pcbCoordinate.optional(),
pcbY: pcbCoordinate.optional(),
visible: z.boolean().optional(),
})
```

Expand Down
1 change: 1 addition & 0 deletions generated/PROPS_OVERVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,7 @@ export interface PcbSxValue {
fontSize?: string | number
pcbX?: string | number
pcbY?: string | number
visible?: boolean
}


Expand Down
3 changes: 3 additions & 0 deletions lib/common/pcbSx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ 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>
Expand All @@ -23,6 +25,7 @@ export const pcbSxValue = z.object({
fontSize: length.optional(),
pcbX: pcbCoordinate.optional(),
pcbY: pcbCoordinate.optional(),
visible: z.boolean().optional(),
})

export const pcbSx = z.record(
Expand Down
14 changes: 14 additions & 0 deletions tests/fabrication-note.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
fabricationNotePathProps,
type FabricationNotePathProps,
} from "lib/components/fabrication-note-path"
import { fabricationNoteTextProps } from "lib/components/fabrication-note-text"

test("fabrication note rect parses minimal props", () => {
const rect: FabricationNoteRectProps = {
Expand Down Expand Up @@ -82,3 +83,16 @@ test("fabrication note path parses route points", () => {
expect(parsed.strokeWidth).toBe(0.5)
expect(parsed.color).toBe("#0000ff")
})

test("fabrication note text accepts pcbSx fabrication note text visibility", () => {
const parsed = fabricationNoteTextProps.parse({
text: "FAB NOTE",
pcbSx: {
"& fabricationnotetext": {
visible: true,
},
},
})

expect(parsed.pcbSx?.["& fabricationnotetext"]?.visible).toBe(true)
})