@tscircuit/props 0.0.370 → 0.0.371
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 +21 -5
- package/dist/index.d.ts +841 -16
- package/dist/index.js +74 -8
- package/dist/index.js.map +1 -1
- package/lib/common/layout.ts +35 -0
- package/lib/components/cadmodel.ts +4 -0
- package/lib/components/courtyard-outline.ts +7 -1
- package/lib/components/fabrication-note-dimension.ts +11 -2
- package/lib/components/fabrication-note-path.ts +7 -1
- package/lib/components/group.ts +1 -1
- package/lib/components/pcb-note-dimension.ts +11 -2
- package/lib/components/pcb-note-line.ts +11 -2
- package/lib/components/pcb-note-path.ts +11 -2
- package/lib/components/silkscreen-line.ts +7 -1
- package/lib/components/silkscreen-path.ts +7 -1
- package/package.json +1 -1
package/lib/common/layout.ts
CHANGED
|
@@ -11,11 +11,23 @@ import { type CadModelProp, cadModelProp } from "./cadModel"
|
|
|
11
11
|
import { type FootprintProp, footprintProp } from "./footprintProp"
|
|
12
12
|
import { type SymbolProp, symbolProp } from "./symbolProp"
|
|
13
13
|
|
|
14
|
+
export type PcbPositionMode =
|
|
15
|
+
| "relative_to_group_anchor"
|
|
16
|
+
| "auto"
|
|
17
|
+
| "relative_to_board_anchor"
|
|
18
|
+
| "relative_to_component_anchor"
|
|
19
|
+
|
|
20
|
+
/** @deprecated Use {@link PcbPositionMode} instead. */
|
|
21
|
+
export type PositionMode = PcbPositionMode
|
|
22
|
+
|
|
14
23
|
export interface PcbLayoutProps {
|
|
15
24
|
pcbX?: string | number
|
|
16
25
|
pcbY?: string | number
|
|
26
|
+
pcbOffsetX?: string | number
|
|
27
|
+
pcbOffsetY?: string | number
|
|
17
28
|
pcbRotation?: string | number
|
|
18
29
|
pcbPositionAnchor?: string
|
|
30
|
+
pcbPositionMode?: PcbPositionMode
|
|
19
31
|
layer?: LayerRefInput
|
|
20
32
|
pcbMarginTop?: string | number
|
|
21
33
|
pcbMarginRight?: string | number
|
|
@@ -36,8 +48,11 @@ export interface PcbLayoutProps {
|
|
|
36
48
|
export interface CommonLayoutProps {
|
|
37
49
|
pcbX?: string | number
|
|
38
50
|
pcbY?: string | number
|
|
51
|
+
pcbOffsetX?: string | number
|
|
52
|
+
pcbOffsetY?: string | number
|
|
39
53
|
pcbRotation?: string | number
|
|
40
54
|
pcbPositionAnchor?: string
|
|
55
|
+
pcbPositionMode?: PcbPositionMode
|
|
41
56
|
|
|
42
57
|
pcbMarginTop?: string | number
|
|
43
58
|
pcbMarginRight?: string | number
|
|
@@ -80,8 +95,18 @@ export interface CommonLayoutProps {
|
|
|
80
95
|
export const pcbLayoutProps = z.object({
|
|
81
96
|
pcbX: distance.optional(),
|
|
82
97
|
pcbY: distance.optional(),
|
|
98
|
+
pcbOffsetX: distance.optional(),
|
|
99
|
+
pcbOffsetY: distance.optional(),
|
|
83
100
|
pcbRotation: rotation.optional(),
|
|
84
101
|
pcbPositionAnchor: z.string().optional(),
|
|
102
|
+
pcbPositionMode: z
|
|
103
|
+
.enum([
|
|
104
|
+
"relative_to_group_anchor",
|
|
105
|
+
"auto",
|
|
106
|
+
"relative_to_board_anchor",
|
|
107
|
+
"relative_to_component_anchor",
|
|
108
|
+
])
|
|
109
|
+
.optional(),
|
|
85
110
|
layer: layer_ref.optional(),
|
|
86
111
|
pcbMarginTop: distance.optional(),
|
|
87
112
|
pcbMarginRight: distance.optional(),
|
|
@@ -98,8 +123,18 @@ expectTypesMatch<PcbLayoutProps, InferredPcbLayoutProps>(true)
|
|
|
98
123
|
export const commonLayoutProps = z.object({
|
|
99
124
|
pcbX: distance.optional(),
|
|
100
125
|
pcbY: distance.optional(),
|
|
126
|
+
pcbOffsetX: distance.optional(),
|
|
127
|
+
pcbOffsetY: distance.optional(),
|
|
101
128
|
pcbRotation: rotation.optional(),
|
|
102
129
|
pcbPositionAnchor: z.string().optional(),
|
|
130
|
+
pcbPositionMode: z
|
|
131
|
+
.enum([
|
|
132
|
+
"relative_to_group_anchor",
|
|
133
|
+
"auto",
|
|
134
|
+
"relative_to_board_anchor",
|
|
135
|
+
"relative_to_component_anchor",
|
|
136
|
+
])
|
|
137
|
+
.optional(),
|
|
103
138
|
pcbMarginTop: distance.optional(),
|
|
104
139
|
pcbMarginRight: distance.optional(),
|
|
105
140
|
pcbMarginBottom: distance.optional(),
|
|
@@ -8,12 +8,16 @@ export interface CadModelProps extends CadModelBase {
|
|
|
8
8
|
stepUrl?: string
|
|
9
9
|
pcbX?: Distance
|
|
10
10
|
pcbY?: Distance
|
|
11
|
+
pcbOffsetX?: Distance
|
|
12
|
+
pcbOffsetY?: Distance
|
|
11
13
|
pcbZ?: Distance
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
const pcbPosition = z.object({
|
|
15
17
|
pcbX: distance.optional(),
|
|
16
18
|
pcbY: distance.optional(),
|
|
19
|
+
pcbOffsetX: distance.optional(),
|
|
20
|
+
pcbOffsetY: distance.optional(),
|
|
17
21
|
pcbZ: distance.optional(),
|
|
18
22
|
})
|
|
19
23
|
|
|
@@ -4,7 +4,13 @@ import { point } from "lib/common/point"
|
|
|
4
4
|
import { z } from "zod"
|
|
5
5
|
|
|
6
6
|
export const courtyardOutlineProps = pcbLayoutProps
|
|
7
|
-
.omit({
|
|
7
|
+
.omit({
|
|
8
|
+
pcbX: true,
|
|
9
|
+
pcbY: true,
|
|
10
|
+
pcbOffsetX: true,
|
|
11
|
+
pcbOffsetY: true,
|
|
12
|
+
pcbRotation: true,
|
|
13
|
+
})
|
|
8
14
|
.extend({
|
|
9
15
|
outline: z.array(point),
|
|
10
16
|
strokeWidth: length.optional(),
|
|
@@ -7,7 +7,10 @@ import { z } from "zod"
|
|
|
7
7
|
const dimensionTarget = z.union([z.string(), point])
|
|
8
8
|
|
|
9
9
|
export interface FabricationNoteDimensionProps
|
|
10
|
-
extends Omit<
|
|
10
|
+
extends Omit<
|
|
11
|
+
PcbLayoutProps,
|
|
12
|
+
"pcbX" | "pcbY" | "pcbOffsetX" | "pcbOffsetY" | "pcbRotation"
|
|
13
|
+
> {
|
|
11
14
|
from: string | Point
|
|
12
15
|
to: string | Point
|
|
13
16
|
text?: string
|
|
@@ -19,7 +22,13 @@ export interface FabricationNoteDimensionProps
|
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
export const fabricationNoteDimensionProps = pcbLayoutProps
|
|
22
|
-
.omit({
|
|
25
|
+
.omit({
|
|
26
|
+
pcbX: true,
|
|
27
|
+
pcbY: true,
|
|
28
|
+
pcbOffsetX: true,
|
|
29
|
+
pcbOffsetY: true,
|
|
30
|
+
pcbRotation: true,
|
|
31
|
+
})
|
|
23
32
|
.extend({
|
|
24
33
|
from: dimensionTarget,
|
|
25
34
|
to: dimensionTarget,
|
|
@@ -3,7 +3,13 @@ import { pcbLayoutProps } from "lib/common/layout"
|
|
|
3
3
|
import { z } from "zod"
|
|
4
4
|
|
|
5
5
|
export const fabricationNotePathProps = pcbLayoutProps
|
|
6
|
-
.omit({
|
|
6
|
+
.omit({
|
|
7
|
+
pcbX: true,
|
|
8
|
+
pcbY: true,
|
|
9
|
+
pcbOffsetX: true,
|
|
10
|
+
pcbOffsetY: true,
|
|
11
|
+
pcbRotation: true,
|
|
12
|
+
})
|
|
7
13
|
.extend({
|
|
8
14
|
route: z.array(route_hint_point),
|
|
9
15
|
strokeWidth: length.optional(),
|
package/lib/components/group.ts
CHANGED
|
@@ -212,7 +212,7 @@ export interface BaseGroupProps extends CommonLayoutProps, LayoutConfig {
|
|
|
212
212
|
pcbPaddingTop?: Distance
|
|
213
213
|
pcbPaddingBottom?: Distance
|
|
214
214
|
/**
|
|
215
|
-
* Anchor to use when interpreting pcbX/pcbY relative to pcbPosition
|
|
215
|
+
* Anchor to use when interpreting pcbX/pcbY/pcbOffsetX/pcbOffsetY relative to pcbPosition
|
|
216
216
|
*/
|
|
217
217
|
pcbPositionAnchor?: AutocompleteString<z.infer<typeof ninePointAnchor>>
|
|
218
218
|
|
|
@@ -7,7 +7,10 @@ import { z } from "zod"
|
|
|
7
7
|
const dimensionTarget = z.union([z.string(), point])
|
|
8
8
|
|
|
9
9
|
export interface PcbNoteDimensionProps
|
|
10
|
-
extends Omit<
|
|
10
|
+
extends Omit<
|
|
11
|
+
PcbLayoutProps,
|
|
12
|
+
"pcbX" | "pcbY" | "pcbOffsetX" | "pcbOffsetY" | "pcbRotation"
|
|
13
|
+
> {
|
|
11
14
|
from: string | Point
|
|
12
15
|
to: string | Point
|
|
13
16
|
text?: string
|
|
@@ -19,7 +22,13 @@ export interface PcbNoteDimensionProps
|
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
export const pcbNoteDimensionProps = pcbLayoutProps
|
|
22
|
-
.omit({
|
|
25
|
+
.omit({
|
|
26
|
+
pcbX: true,
|
|
27
|
+
pcbY: true,
|
|
28
|
+
pcbOffsetX: true,
|
|
29
|
+
pcbOffsetY: true,
|
|
30
|
+
pcbRotation: true,
|
|
31
|
+
})
|
|
23
32
|
.extend({
|
|
24
33
|
from: dimensionTarget,
|
|
25
34
|
to: dimensionTarget,
|
|
@@ -4,7 +4,10 @@ import { expectTypesMatch } from "lib/typecheck"
|
|
|
4
4
|
import { z } from "zod"
|
|
5
5
|
|
|
6
6
|
export interface PcbNoteLineProps
|
|
7
|
-
extends Omit<
|
|
7
|
+
extends Omit<
|
|
8
|
+
PcbLayoutProps,
|
|
9
|
+
"pcbX" | "pcbY" | "pcbOffsetX" | "pcbOffsetY" | "pcbRotation"
|
|
10
|
+
> {
|
|
8
11
|
x1: string | number
|
|
9
12
|
y1: string | number
|
|
10
13
|
x2: string | number
|
|
@@ -15,7 +18,13 @@ export interface PcbNoteLineProps
|
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
export const pcbNoteLineProps = pcbLayoutProps
|
|
18
|
-
.omit({
|
|
21
|
+
.omit({
|
|
22
|
+
pcbX: true,
|
|
23
|
+
pcbY: true,
|
|
24
|
+
pcbOffsetX: true,
|
|
25
|
+
pcbOffsetY: true,
|
|
26
|
+
pcbRotation: true,
|
|
27
|
+
})
|
|
19
28
|
.extend({
|
|
20
29
|
x1: distance,
|
|
21
30
|
y1: distance,
|
|
@@ -8,14 +8,23 @@ import { expectTypesMatch } from "lib/typecheck"
|
|
|
8
8
|
import { z } from "zod"
|
|
9
9
|
|
|
10
10
|
export interface PcbNotePathProps
|
|
11
|
-
extends Omit<
|
|
11
|
+
extends Omit<
|
|
12
|
+
PcbLayoutProps,
|
|
13
|
+
"pcbX" | "pcbY" | "pcbOffsetX" | "pcbOffsetY" | "pcbRotation"
|
|
14
|
+
> {
|
|
12
15
|
route: RouteHintPointInput[]
|
|
13
16
|
strokeWidth?: string | number
|
|
14
17
|
color?: string
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
export const pcbNotePathProps = pcbLayoutProps
|
|
18
|
-
.omit({
|
|
21
|
+
.omit({
|
|
22
|
+
pcbX: true,
|
|
23
|
+
pcbY: true,
|
|
24
|
+
pcbOffsetX: true,
|
|
25
|
+
pcbOffsetY: true,
|
|
26
|
+
pcbRotation: true,
|
|
27
|
+
})
|
|
19
28
|
.extend({
|
|
20
29
|
route: z.array(route_hint_point),
|
|
21
30
|
strokeWidth: length.optional(),
|
|
@@ -3,7 +3,13 @@ import { pcbLayoutProps } from "lib/common/layout"
|
|
|
3
3
|
import type { z } from "zod"
|
|
4
4
|
|
|
5
5
|
export const silkscreenLineProps = pcbLayoutProps
|
|
6
|
-
.omit({
|
|
6
|
+
.omit({
|
|
7
|
+
pcbX: true,
|
|
8
|
+
pcbY: true,
|
|
9
|
+
pcbOffsetX: true,
|
|
10
|
+
pcbOffsetY: true,
|
|
11
|
+
pcbRotation: true,
|
|
12
|
+
})
|
|
7
13
|
.extend({
|
|
8
14
|
strokeWidth: distance,
|
|
9
15
|
x1: distance,
|
|
@@ -3,7 +3,13 @@ import { pcbLayoutProps } from "lib/common/layout"
|
|
|
3
3
|
import { z } from "zod"
|
|
4
4
|
|
|
5
5
|
export const silkscreenPathProps = pcbLayoutProps
|
|
6
|
-
.omit({
|
|
6
|
+
.omit({
|
|
7
|
+
pcbX: true,
|
|
8
|
+
pcbY: true,
|
|
9
|
+
pcbOffsetX: true,
|
|
10
|
+
pcbOffsetY: true,
|
|
11
|
+
pcbRotation: true,
|
|
12
|
+
})
|
|
7
13
|
.extend({
|
|
8
14
|
route: z.array(route_hint_point),
|
|
9
15
|
strokeWidth: length.optional(),
|