@tscircuit/props 0.0.543 → 0.0.544
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.
- package/README.md +45 -0
- package/dist/index.d.ts +157 -2
- package/dist/index.js +105 -93
- package/dist/index.js.map +1 -1
- package/lib/components/silkscreen-graphic.ts +56 -0
- package/lib/index.ts +1 -0
- package/package.json +2 -2
|
@@ -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.
|
|
3
|
+
"version": "0.0.544",
|
|
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.
|
|
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",
|