Skip to content

Commit a942024

Browse files
Merge pull request #609 from ShiboSoftwareDev/main
Add fabricationnotetext selector support in pcbSx
2 parents 96edf4c + efd9d62 commit a942024

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

generated/COMPONENT_TYPES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,7 @@ export interface PcbSxValue {
735735
fontSize?: string | number
736736
pcbX?: string | number
737737
pcbY?: string | number
738+
visible?: boolean
738739
}
739740
export type PcbSx = PcbSxBase & {
740741
[K in PcbSxSelector]?: PcbSxValue
@@ -743,6 +744,7 @@ export const pcbSxValue = z.object({
743744
fontSize: length.optional(),
744745
pcbX: pcbCoordinate.optional(),
745746
pcbY: pcbCoordinate.optional(),
747+
visible: z.boolean().optional(),
746748
})
747749
```
748750

generated/PROPS_OVERVIEW.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,7 @@ export interface PcbSxValue {
13601360
fontSize?: string | number
13611361
pcbX?: string | number
13621362
pcbY?: string | number
1363+
visible?: boolean
13631364
}
13641365

13651366

lib/common/pcbSx.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import { z } from "zod"
66
export type PcbSxSelector =
77
| "& footprint[src^='kicad:'] silkscreentext"
88
| "& silkscreentext"
9+
| "& fabricationnotetext"
910

1011
export interface PcbSxValue {
1112
fontSize?: string | number
1213
pcbX?: string | number
1314
pcbY?: string | number
15+
visible?: boolean
1416
}
1517

1618
type PcbSxBase = Record<string, PcbSxValue>
@@ -23,6 +25,7 @@ export const pcbSxValue = z.object({
2325
fontSize: length.optional(),
2426
pcbX: pcbCoordinate.optional(),
2527
pcbY: pcbCoordinate.optional(),
28+
visible: z.boolean().optional(),
2629
})
2730

2831
export const pcbSx = z.record(

tests/fabrication-note.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
fabricationNotePathProps,
88
type FabricationNotePathProps,
99
} from "lib/components/fabrication-note-path"
10+
import { fabricationNoteTextProps } from "lib/components/fabrication-note-text"
1011

1112
test("fabrication note rect parses minimal props", () => {
1213
const rect: FabricationNoteRectProps = {
@@ -82,3 +83,16 @@ test("fabrication note path parses route points", () => {
8283
expect(parsed.strokeWidth).toBe(0.5)
8384
expect(parsed.color).toBe("#0000ff")
8485
})
86+
87+
test("fabrication note text accepts pcbSx fabrication note text visibility", () => {
88+
const parsed = fabricationNoteTextProps.parse({
89+
text: "FAB NOTE",
90+
pcbSx: {
91+
"& fabricationnotetext": {
92+
visible: true,
93+
},
94+
},
95+
})
96+
97+
expect(parsed.pcbSx?.["& fabricationnotetext"]?.visible).toBe(true)
98+
})

0 commit comments

Comments
 (0)