@tscircuit/props 0.0.676 → 0.0.677

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.
@@ -0,0 +1,56 @@
1
+ import { distance } from "lib/common/distance"
2
+ import { pcbLayoutProps } from "lib/common/layout"
3
+ import { z } from "zod"
4
+
5
+ const finiteDistance = distance.pipe(z.number().finite())
6
+ const positiveDistance = distance.pipe(z.number().finite().positive())
7
+ const openingBaseProps = pcbLayoutProps.omit({ layer: true }).extend({
8
+ name: z.string().optional(),
9
+ /** Face whose solder mask or flex coverlay is removed. Required. */
10
+ layer: z.enum(["top", "bottom"]),
11
+ })
12
+
13
+ export const pcbSoldermaskOpeningProps = z.discriminatedUnion("shape", [
14
+ openingBaseProps.extend({
15
+ shape: z.literal("rect"),
16
+ width: positiveDistance,
17
+ height: positiveDistance,
18
+ radius: z.never().optional(),
19
+ points: z.never().optional(),
20
+ }),
21
+ openingBaseProps.extend({
22
+ shape: z.literal("circle"),
23
+ radius: positiveDistance,
24
+ width: z.never().optional(),
25
+ height: z.never().optional(),
26
+ points: z.never().optional(),
27
+ }),
28
+ openingBaseProps.extend({
29
+ shape: z.literal("polygon"),
30
+ /** Local vertices; pcbX/pcbY/pcbRotation place the implicitly closed boundary. */
31
+ points: z
32
+ .array(z.object({ x: finiteDistance, y: finiteDistance }))
33
+ .min(3)
34
+ .refine((points) => {
35
+ const twiceArea = points.reduce((sum, point, index) => {
36
+ const next = points[(index + 1) % points.length]!
37
+ return sum + point.x * next.y - next.x * point.y
38
+ }, 0)
39
+ return Number.isFinite(twiceArea) && twiceArea !== 0
40
+ }, "Solder-mask opening must enclose a nonzero area"),
41
+ width: z.never().optional(),
42
+ height: z.never().optional(),
43
+ radius: z.never().optional(),
44
+ }),
45
+ ])
46
+
47
+ /**
48
+ * A solder-mask or flex-coverlay aperture independent of pads and holes.
49
+ * Exposes underlying copper or substrate without adding copper, paste, or connectivity.
50
+ * Geometry is local to its parent, in mm (+X right, +Y top); use pcbRotation for rectangles.
51
+ */
52
+ export type PcbSoldermaskOpeningProps = z.input<
53
+ typeof pcbSoldermaskOpeningProps
54
+ >
55
+
56
+ export type PcbSoldermaskOpeningPropsInput = PcbSoldermaskOpeningProps
package/lib/index.ts CHANGED
@@ -28,6 +28,7 @@ export * from "./customDrc"
28
28
 
29
29
  export * from "./components/board"
30
30
  export * from "./components/pcb-bend"
31
+ export * from "./components/pcb-soldermask-opening"
31
32
  export * from "./components/pcb-stiffener"
32
33
  export * from "./components/panel"
33
34
  export * from "./components/subpanel"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.676",
3
+ "version": "0.0.677",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",