@tscircuit/props 0.0.543 → 0.0.545

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.
@@ -21,6 +21,15 @@ export interface PillHoleProps extends PcbLayoutProps {
21
21
  coveredWithSolderMask?: boolean
22
22
  }
23
23
 
24
+ export interface OvalHoleProps extends PcbLayoutProps {
25
+ name?: string
26
+ shape: "oval"
27
+ width: Distance
28
+ height: Distance
29
+ solderMaskMargin?: Distance
30
+ coveredWithSolderMask?: boolean
31
+ }
32
+
24
33
  export interface RectHoleProps extends PcbLayoutProps {
25
34
  name?: string
26
35
  shape: "rect"
@@ -30,7 +39,11 @@ export interface RectHoleProps extends PcbLayoutProps {
30
39
  coveredWithSolderMask?: boolean
31
40
  }
32
41
 
33
- export type HoleProps = CircleHoleProps | PillHoleProps | RectHoleProps
42
+ export type HoleProps =
43
+ | CircleHoleProps
44
+ | PillHoleProps
45
+ | OvalHoleProps
46
+ | RectHoleProps
34
47
 
35
48
  const circleHoleProps = pcbLayoutProps
36
49
  .extend({
@@ -56,6 +69,15 @@ const pillHoleProps = pcbLayoutProps.extend({
56
69
  coveredWithSolderMask: z.boolean().optional(),
57
70
  })
58
71
 
72
+ const ovalHoleProps = pcbLayoutProps.extend({
73
+ name: z.string().optional(),
74
+ shape: z.literal("oval"),
75
+ width: distance,
76
+ height: distance,
77
+ solderMaskMargin: distance.optional(),
78
+ coveredWithSolderMask: z.boolean().optional(),
79
+ })
80
+
59
81
  const rectHoleProps = pcbLayoutProps.extend({
60
82
  name: z.string().optional(),
61
83
  shape: z.literal("rect"),
@@ -68,6 +90,7 @@ const rectHoleProps = pcbLayoutProps.extend({
68
90
  export const holeProps = z.union([
69
91
  circleHoleProps,
70
92
  pillHoleProps,
93
+ ovalHoleProps,
71
94
  rectHoleProps,
72
95
  ])
73
96
 
@@ -0,0 +1,56 @@
1
+ import { type VisibleLayer, visible_layer } from "circuit-json"
2
+ import { type Distance, distance } from "lib/common/distance"
3
+ import { pcbLayoutProps } from "lib/common/layout"
4
+ import { url } from "lib/common/url"
5
+ import { expectTypesMatch } from "lib/typecheck"
6
+ import { z } from "zod"
7
+
8
+ export interface SilkscreenGraphicProps {
9
+ /**
10
+ * URL or static-file import for the source image. tscircuit/core converts the
11
+ * image into the pcb_silkscreen_graphic BRep in circuit-json.
12
+ */
13
+ imageUrl: string
14
+ /** Width of the rendered silkscreen graphic on the PCB. */
15
+ width: Distance
16
+ /** Height of the rendered silkscreen graphic on the PCB. */
17
+ height: Distance
18
+ /** PCB layer for the silkscreen graphic. */
19
+ layer?: VisibleLayer
20
+ pcbX?: string | number
21
+ pcbY?: string | number
22
+ pcbLeftEdgeX?: string | number
23
+ pcbRightEdgeX?: string | number
24
+ pcbTopEdgeY?: string | number
25
+ pcbBottomEdgeY?: string | number
26
+ pcbOffsetX?: string | number
27
+ pcbOffsetY?: string | number
28
+ pcbRotation?: string | number
29
+ pcbPositionAnchor?: string
30
+ pcbPositionMode?:
31
+ | "relative_to_group_anchor"
32
+ | "auto"
33
+ | "relative_to_board_anchor"
34
+ | "relative_to_component_anchor"
35
+ shouldBeOnEdgeOfBoard?: boolean
36
+ pcbMarginTop?: string | number
37
+ pcbMarginRight?: string | number
38
+ pcbMarginBottom?: string | number
39
+ pcbMarginLeft?: string | number
40
+ pcbMarginX?: string | number
41
+ pcbMarginY?: string | number
42
+ pcbRelative?: boolean
43
+ relative?: boolean
44
+ }
45
+
46
+ export const silkscreenGraphicProps = pcbLayoutProps
47
+ .omit({ layer: true, pcbStyle: true, pcbSx: true })
48
+ .extend({
49
+ imageUrl: url,
50
+ width: distance,
51
+ height: distance,
52
+ layer: visible_layer.optional(),
53
+ })
54
+
55
+ type InferredSilkscreenGraphicProps = z.input<typeof silkscreenGraphicProps>
56
+ expectTypesMatch<SilkscreenGraphicProps, InferredSilkscreenGraphicProps>(true)
package/lib/index.ts CHANGED
@@ -113,6 +113,7 @@ export * from "./components/silkscreen-path"
113
113
  export * from "./components/silkscreen-line"
114
114
  export * from "./components/silkscreen-rect"
115
115
  export * from "./components/silkscreen-circle"
116
+ export * from "./components/silkscreen-graphic"
116
117
  export * from "./components/trace-hint"
117
118
  export * from "./components/port"
118
119
  export * from "./components/pcb-note-text"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.543",
3
+ "version": "0.0.545",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  "@types/node": "^20.12.11",
33
33
  "@types/react": "^18.3.2",
34
34
  "ava": "^6.1.3",
35
- "circuit-json": "^0.0.428",
35
+ "circuit-json": "^0.0.433",
36
36
  "expect-type": "^1.3.0",
37
37
  "glob": "^11.0.0",
38
38
  "madge": "^8.0.0",