@tscircuit/props 0.0.341 → 0.0.342

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.
@@ -1,3 +1,4 @@
1
+ import type { AutocompleteString } from "lib/common/autocomplete"
1
2
  import { distance, type Distance } from "lib/common/distance"
2
3
  import { ninePointAnchor } from "lib/common/ninePointAnchor"
3
4
  import { type Point, point } from "lib/common/point"
@@ -5,6 +6,23 @@ import { expectTypesMatch } from "lib/typecheck"
5
6
  import { z } from "zod"
6
7
  import { subcircuitGroupProps, type SubcircuitGroupProps } from "./group"
7
8
 
9
+ const boardColorPresets = [
10
+ "not_specified",
11
+ "green",
12
+ "red",
13
+ "blue",
14
+ "purple",
15
+ "black",
16
+ "white",
17
+ "yellow",
18
+ ] as const
19
+
20
+ export type BoardColorPreset = (typeof boardColorPresets)[number]
21
+
22
+ export type BoardColor = AutocompleteString<BoardColorPreset>
23
+
24
+ const boardColor = z.custom<BoardColor>((value) => typeof value === "string")
25
+
8
26
  export interface BoardProps extends Omit<SubcircuitGroupProps, "subcircuit"> {
9
27
  material?: "fr4" | "fr1"
10
28
  /** Number of layers for the PCB */
@@ -12,6 +30,18 @@ export interface BoardProps extends Omit<SubcircuitGroupProps, "subcircuit"> {
12
30
  borderRadius?: Distance
13
31
  boardAnchorPosition?: Point
14
32
  boardAnchorAlignment?: z.infer<typeof ninePointAnchor>
33
+ /** Color applied to both top and bottom solder masks */
34
+ solderMaskColor?: BoardColor
35
+ /** Color of the top solder mask */
36
+ topSolderMaskColor?: BoardColor
37
+ /** Color of the bottom solder mask */
38
+ bottomSolderMaskColor?: BoardColor
39
+ /** Color applied to both top and bottom silkscreens */
40
+ silkscreenColor?: BoardColor
41
+ /** Color of the top silkscreen */
42
+ topSilkscreenColor?: BoardColor
43
+ /** Color of the bottom silkscreen */
44
+ bottomSilkscreenColor?: BoardColor
15
45
  }
16
46
 
17
47
  export const boardProps = subcircuitGroupProps.extend({
@@ -20,6 +50,12 @@ export const boardProps = subcircuitGroupProps.extend({
20
50
  borderRadius: distance.optional(),
21
51
  boardAnchorPosition: point.optional(),
22
52
  boardAnchorAlignment: ninePointAnchor.optional(),
53
+ solderMaskColor: boardColor.optional(),
54
+ topSolderMaskColor: boardColor.optional(),
55
+ bottomSolderMaskColor: boardColor.optional(),
56
+ silkscreenColor: boardColor.optional(),
57
+ topSilkscreenColor: boardColor.optional(),
58
+ bottomSilkscreenColor: boardColor.optional(),
23
59
  })
24
60
 
25
61
  type InferredBoardProps = z.input<typeof boardProps>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.341",
3
+ "version": "0.0.342",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",