@tscircuit/props 0.0.359 → 0.0.360
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 +193 -75
- package/dist/index.d.ts +588 -5
- package/dist/index.js +343 -249
- package/dist/index.js.map +1 -1
- package/lib/components/fabrication-note-dimension.ts +41 -0
- package/lib/components/fabrication-note-text.ts +24 -2
- package/lib/components/pcb-note-dimension.ts +38 -0
- package/lib/components/pcb-note-line.ts +31 -0
- package/lib/components/pcb-note-path.ts +27 -0
- package/lib/components/pcb-note-rect.ts +30 -0
- package/lib/components/pcb-note-text.ts +31 -0
- package/lib/index.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { distance, length } from "circuit-json"
|
|
2
|
+
import { pcbLayoutProps, type PcbLayoutProps } from "lib/common/layout"
|
|
3
|
+
import { point, type Point } from "lib/common/point"
|
|
4
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
5
|
+
import { z } from "zod"
|
|
6
|
+
|
|
7
|
+
const dimensionTarget = z.union([z.string(), point])
|
|
8
|
+
|
|
9
|
+
export interface FabricationNoteDimensionProps
|
|
10
|
+
extends Omit<PcbLayoutProps, "pcbX" | "pcbY" | "pcbRotation"> {
|
|
11
|
+
from: string | Point
|
|
12
|
+
to: string | Point
|
|
13
|
+
text?: string
|
|
14
|
+
offset?: string | number
|
|
15
|
+
font?: "tscircuit2024"
|
|
16
|
+
fontSize?: string | number
|
|
17
|
+
color?: string
|
|
18
|
+
arrowSize?: string | number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const fabricationNoteDimensionProps = pcbLayoutProps
|
|
22
|
+
.omit({ pcbX: true, pcbY: true, pcbRotation: true })
|
|
23
|
+
.extend({
|
|
24
|
+
from: dimensionTarget,
|
|
25
|
+
to: dimensionTarget,
|
|
26
|
+
text: z.string().optional(),
|
|
27
|
+
offset: distance.optional(),
|
|
28
|
+
font: z.enum(["tscircuit2024"]).optional(),
|
|
29
|
+
fontSize: length.optional(),
|
|
30
|
+
color: z.string().optional(),
|
|
31
|
+
arrowSize: distance.optional(),
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
expectTypesMatch<
|
|
35
|
+
FabricationNoteDimensionProps,
|
|
36
|
+
z.input<typeof fabricationNoteDimensionProps>
|
|
37
|
+
>(true)
|
|
38
|
+
|
|
39
|
+
export type FabricationNoteDimensionPropsInput = z.input<
|
|
40
|
+
typeof fabricationNoteDimensionProps
|
|
41
|
+
>
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { length } from "circuit-json"
|
|
2
|
-
import { pcbLayoutProps } from "lib/common/layout"
|
|
2
|
+
import { pcbLayoutProps, type PcbLayoutProps } from "lib/common/layout"
|
|
3
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
3
4
|
import { z } from "zod"
|
|
4
5
|
|
|
6
|
+
export interface FabricationNoteTextProps extends PcbLayoutProps {
|
|
7
|
+
text: string
|
|
8
|
+
anchorAlignment?:
|
|
9
|
+
| "center"
|
|
10
|
+
| "top_left"
|
|
11
|
+
| "top_right"
|
|
12
|
+
| "bottom_left"
|
|
13
|
+
| "bottom_right"
|
|
14
|
+
font?: "tscircuit2024"
|
|
15
|
+
fontSize?: string | number
|
|
16
|
+
color?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
5
19
|
export const fabricationNoteTextProps = pcbLayoutProps.extend({
|
|
6
20
|
text: z.string(),
|
|
7
21
|
anchorAlignment: z
|
|
@@ -11,4 +25,12 @@ export const fabricationNoteTextProps = pcbLayoutProps.extend({
|
|
|
11
25
|
fontSize: length.optional(),
|
|
12
26
|
color: z.string().optional(),
|
|
13
27
|
})
|
|
14
|
-
|
|
28
|
+
|
|
29
|
+
expectTypesMatch<
|
|
30
|
+
FabricationNoteTextProps,
|
|
31
|
+
z.input<typeof fabricationNoteTextProps>
|
|
32
|
+
>(true)
|
|
33
|
+
|
|
34
|
+
export type FabricationNoteTextPropsInput = z.input<
|
|
35
|
+
typeof fabricationNoteTextProps
|
|
36
|
+
>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { distance, length } from "circuit-json"
|
|
2
|
+
import { pcbLayoutProps, type PcbLayoutProps } from "lib/common/layout"
|
|
3
|
+
import { point, type Point } from "lib/common/point"
|
|
4
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
5
|
+
import { z } from "zod"
|
|
6
|
+
|
|
7
|
+
const dimensionTarget = z.union([z.string(), point])
|
|
8
|
+
|
|
9
|
+
export interface PcbNoteDimensionProps
|
|
10
|
+
extends Omit<PcbLayoutProps, "pcbX" | "pcbY" | "pcbRotation"> {
|
|
11
|
+
from: string | Point
|
|
12
|
+
to: string | Point
|
|
13
|
+
text?: string
|
|
14
|
+
offset?: string | number
|
|
15
|
+
font?: "tscircuit2024"
|
|
16
|
+
fontSize?: string | number
|
|
17
|
+
color?: string
|
|
18
|
+
arrowSize?: string | number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const pcbNoteDimensionProps = pcbLayoutProps
|
|
22
|
+
.omit({ pcbX: true, pcbY: true, pcbRotation: true })
|
|
23
|
+
.extend({
|
|
24
|
+
from: dimensionTarget,
|
|
25
|
+
to: dimensionTarget,
|
|
26
|
+
text: z.string().optional(),
|
|
27
|
+
offset: distance.optional(),
|
|
28
|
+
font: z.enum(["tscircuit2024"]).optional(),
|
|
29
|
+
fontSize: length.optional(),
|
|
30
|
+
color: z.string().optional(),
|
|
31
|
+
arrowSize: distance.optional(),
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
expectTypesMatch<PcbNoteDimensionProps, z.input<typeof pcbNoteDimensionProps>>(
|
|
35
|
+
true,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
export type PcbNoteDimensionPropsInput = z.input<typeof pcbNoteDimensionProps>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { distance } from "circuit-json"
|
|
2
|
+
import { pcbLayoutProps, type PcbLayoutProps } from "lib/common/layout"
|
|
3
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
4
|
+
import { z } from "zod"
|
|
5
|
+
|
|
6
|
+
export interface PcbNoteLineProps
|
|
7
|
+
extends Omit<PcbLayoutProps, "pcbX" | "pcbY" | "pcbRotation"> {
|
|
8
|
+
x1: string | number
|
|
9
|
+
y1: string | number
|
|
10
|
+
x2: string | number
|
|
11
|
+
y2: string | number
|
|
12
|
+
strokeWidth?: string | number
|
|
13
|
+
color?: string
|
|
14
|
+
isDashed?: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const pcbNoteLineProps = pcbLayoutProps
|
|
18
|
+
.omit({ pcbX: true, pcbY: true, pcbRotation: true })
|
|
19
|
+
.extend({
|
|
20
|
+
x1: distance,
|
|
21
|
+
y1: distance,
|
|
22
|
+
x2: distance,
|
|
23
|
+
y2: distance,
|
|
24
|
+
strokeWidth: distance.optional(),
|
|
25
|
+
color: z.string().optional(),
|
|
26
|
+
isDashed: z.boolean().optional(),
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
expectTypesMatch<PcbNoteLineProps, z.input<typeof pcbNoteLineProps>>(true)
|
|
30
|
+
|
|
31
|
+
export type PcbNoteLinePropsInput = z.input<typeof pcbNoteLineProps>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
length,
|
|
3
|
+
route_hint_point,
|
|
4
|
+
type RouteHintPointInput,
|
|
5
|
+
} from "circuit-json"
|
|
6
|
+
import { pcbLayoutProps, type PcbLayoutProps } from "lib/common/layout"
|
|
7
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
8
|
+
import { z } from "zod"
|
|
9
|
+
|
|
10
|
+
export interface PcbNotePathProps
|
|
11
|
+
extends Omit<PcbLayoutProps, "pcbX" | "pcbY" | "pcbRotation"> {
|
|
12
|
+
route: RouteHintPointInput[]
|
|
13
|
+
strokeWidth?: string | number
|
|
14
|
+
color?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const pcbNotePathProps = pcbLayoutProps
|
|
18
|
+
.omit({ pcbX: true, pcbY: true, pcbRotation: true })
|
|
19
|
+
.extend({
|
|
20
|
+
route: z.array(route_hint_point),
|
|
21
|
+
strokeWidth: length.optional(),
|
|
22
|
+
color: z.string().optional(),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
expectTypesMatch<PcbNotePathProps, z.input<typeof pcbNotePathProps>>(true)
|
|
26
|
+
|
|
27
|
+
export type PcbNotePathPropsInput = z.input<typeof pcbNotePathProps>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { distance } from "circuit-json"
|
|
2
|
+
import { pcbLayoutProps, type PcbLayoutProps } from "lib/common/layout"
|
|
3
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
4
|
+
import { z } from "zod"
|
|
5
|
+
|
|
6
|
+
export interface PcbNoteRectProps extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
7
|
+
width: string | number
|
|
8
|
+
height: string | number
|
|
9
|
+
strokeWidth?: string | number
|
|
10
|
+
isFilled?: boolean
|
|
11
|
+
hasStroke?: boolean
|
|
12
|
+
isStrokeDashed?: boolean
|
|
13
|
+
color?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const pcbNoteRectProps = pcbLayoutProps
|
|
17
|
+
.omit({ pcbRotation: true })
|
|
18
|
+
.extend({
|
|
19
|
+
width: distance,
|
|
20
|
+
height: distance,
|
|
21
|
+
strokeWidth: distance.optional(),
|
|
22
|
+
isFilled: z.boolean().optional(),
|
|
23
|
+
hasStroke: z.boolean().optional(),
|
|
24
|
+
isStrokeDashed: z.boolean().optional(),
|
|
25
|
+
color: z.string().optional(),
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
expectTypesMatch<PcbNoteRectProps, z.input<typeof pcbNoteRectProps>>(true)
|
|
29
|
+
|
|
30
|
+
export type PcbNoteRectPropsInput = z.input<typeof pcbNoteRectProps>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { length } from "circuit-json"
|
|
2
|
+
import { pcbLayoutProps, type PcbLayoutProps } from "lib/common/layout"
|
|
3
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
4
|
+
import { z } from "zod"
|
|
5
|
+
|
|
6
|
+
export interface PcbNoteTextProps extends PcbLayoutProps {
|
|
7
|
+
text: string
|
|
8
|
+
anchorAlignment?:
|
|
9
|
+
| "center"
|
|
10
|
+
| "top_left"
|
|
11
|
+
| "top_right"
|
|
12
|
+
| "bottom_left"
|
|
13
|
+
| "bottom_right"
|
|
14
|
+
font?: "tscircuit2024"
|
|
15
|
+
fontSize?: string | number
|
|
16
|
+
color?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const pcbNoteTextProps = pcbLayoutProps.extend({
|
|
20
|
+
text: z.string(),
|
|
21
|
+
anchorAlignment: z
|
|
22
|
+
.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"])
|
|
23
|
+
.default("center"),
|
|
24
|
+
font: z.enum(["tscircuit2024"]).optional(),
|
|
25
|
+
fontSize: length.optional(),
|
|
26
|
+
color: z.string().optional(),
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
expectTypesMatch<PcbNoteTextProps, z.input<typeof pcbNoteTextProps>>(true)
|
|
30
|
+
|
|
31
|
+
export type PcbNoteTextPropsInput = z.input<typeof pcbNoteTextProps>
|
package/lib/index.ts
CHANGED
|
@@ -57,6 +57,7 @@ export * from "./components/switch"
|
|
|
57
57
|
export * from "./components/fabrication-note-text"
|
|
58
58
|
export * from "./components/fabrication-note-rect"
|
|
59
59
|
export * from "./components/fabrication-note-path"
|
|
60
|
+
export * from "./components/fabrication-note-dimension"
|
|
60
61
|
export * from "./components/pcb-trace"
|
|
61
62
|
export * from "./components/via"
|
|
62
63
|
export * from "./components/testpoint"
|
|
@@ -87,6 +88,11 @@ export * from "./components/silkscreen-rect"
|
|
|
87
88
|
export * from "./components/silkscreen-circle"
|
|
88
89
|
export * from "./components/trace-hint"
|
|
89
90
|
export * from "./components/port"
|
|
91
|
+
export * from "./components/pcb-note-text"
|
|
92
|
+
export * from "./components/pcb-note-rect"
|
|
93
|
+
export * from "./components/pcb-note-path"
|
|
94
|
+
export * from "./components/pcb-note-line"
|
|
95
|
+
export * from "./components/pcb-note-dimension"
|
|
90
96
|
export * from "./platformConfig"
|
|
91
97
|
export * from "./projectConfig"
|
|
92
98
|
export * from "./utility-types/connections-and-selectors"
|