@tscircuit/props 0.0.66 → 0.0.68

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.
@@ -37,10 +37,10 @@ export interface SchematicPortArrangementWithSides {
37
37
  bottomSide?: PinSideDefinition
38
38
  }
39
39
 
40
- export type SchematicPortArrangement =
41
- | SchematicPortArrangementWithSizes
42
- | SchematicPortArrangementWithSides
43
- | SchematicPortArrangementWithPinCounts
40
+ export interface SchematicPortArrangement
41
+ extends SchematicPortArrangementWithSizes,
42
+ SchematicPortArrangementWithSides,
43
+ SchematicPortArrangementWithPinCounts {}
44
44
 
45
45
  export const explicitPinSideDefinition = z.object({
46
46
  pins: z.array(z.number()),
@@ -52,32 +52,20 @@ export const explicitPinSideDefinition = z.object({
52
52
  ]),
53
53
  })
54
54
 
55
- export const schematicPortArrangement = z
56
- .object({
57
- leftSize: z.number().optional().describe("@deprecated, use leftPinCount"),
58
- topSize: z.number().optional().describe("@deprecated, use topPinCount"),
59
- rightSize: z.number().optional().describe("@deprecated, use rightPinCount"),
60
- bottomSize: z
61
- .number()
62
- .optional()
63
- .describe("@deprecated, use bottomPinCount"),
64
- })
65
- .or(
66
- z.object({
67
- leftPinCount: z.number().optional(),
68
- rightPinCount: z.number().optional(),
69
- topPinCount: z.number().optional(),
70
- bottomPinCount: z.number().optional(),
71
- }),
72
- )
73
- .or(
74
- z.object({
75
- leftSide: explicitPinSideDefinition.optional(),
76
- rightSide: explicitPinSideDefinition.optional(),
77
- topSide: explicitPinSideDefinition.optional(),
78
- bottomSide: explicitPinSideDefinition.optional(),
79
- }),
80
- )
55
+ export const schematicPortArrangement = z.object({
56
+ leftSize: z.number().optional().describe("@deprecated, use leftPinCount"),
57
+ topSize: z.number().optional().describe("@deprecated, use topPinCount"),
58
+ rightSize: z.number().optional().describe("@deprecated, use rightPinCount"),
59
+ bottomSize: z.number().optional().describe("@deprecated, use bottomPinCount"),
60
+ leftPinCount: z.number().optional(),
61
+ rightPinCount: z.number().optional(),
62
+ topPinCount: z.number().optional(),
63
+ bottomPinCount: z.number().optional(),
64
+ leftSide: explicitPinSideDefinition.optional(),
65
+ rightSide: explicitPinSideDefinition.optional(),
66
+ topSide: explicitPinSideDefinition.optional(),
67
+ bottomSide: explicitPinSideDefinition.optional(),
68
+ })
81
69
 
82
70
  expectTypesMatch<
83
71
  SchematicPortArrangement,
@@ -0,0 +1,48 @@
1
+ import { pcbLayoutProps, type PcbLayoutProps } from "lib/common/layout"
2
+ import { distance, type Distance } from "lib/common/distance"
3
+ import { boolean, string, z } from "zod"
4
+ import { expectTypesMatch } from "lib/typecheck"
5
+
6
+ export interface RectSolderPasteProps
7
+ extends Omit<PcbLayoutProps, "pcbRotation"> {
8
+ shape: "rect"
9
+ width: Distance
10
+ height: Distance
11
+ }
12
+
13
+ export interface CircleSolderPasteProps
14
+ extends Omit<PcbLayoutProps, "pcbRotation"> {
15
+ shape: "circle"
16
+ radius: Distance
17
+ }
18
+
19
+ export type SolderPasteProps = RectSolderPasteProps | CircleSolderPasteProps
20
+
21
+ // zod
22
+
23
+ export const rectSolderPasteProps = pcbLayoutProps
24
+ .omit({ pcbRotation: true })
25
+ .extend({
26
+ shape: z.literal("rect"),
27
+ width: distance,
28
+ height: distance,
29
+ })
30
+ type InferredRectSolderPasteProps = z.input<typeof rectSolderPasteProps>
31
+ expectTypesMatch<InferredRectSolderPasteProps, RectSolderPasteProps>(true)
32
+
33
+ export const circleSolderPasteProps = pcbLayoutProps
34
+ .omit({ pcbRotation: true })
35
+ .extend({
36
+ shape: z.literal("circle"),
37
+ radius: distance,
38
+ })
39
+ type InferredCircleSolderPasteProps = z.input<typeof circleSolderPasteProps>
40
+ expectTypesMatch<InferredCircleSolderPasteProps, CircleSolderPasteProps>(true)
41
+
42
+ export const solderPasteProps = z.union([
43
+ circleSolderPasteProps,
44
+ rectSolderPasteProps,
45
+ ])
46
+
47
+ export type InferredSolderPasteProps = z.input<typeof solderPasteProps>
48
+ expectTypesMatch<InferredSolderPasteProps, SolderPasteProps>(true)
package/lib/index.ts CHANGED
@@ -57,6 +57,7 @@ export * from "./components/net"
57
57
  export * from "./components/constrainedlayout"
58
58
  export * from "./components/constraint"
59
59
  export * from "./components/smtpad"
60
+ export * from "./components/solderpaste"
60
61
  export * from "./components/hole"
61
62
  export * from "./components/trace"
62
63
  export * from "./components/footprint"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.66",
3
+ "version": "0.0.68",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {