@tscircuit/props 0.0.595 → 0.0.597

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.
@@ -113,10 +113,18 @@ export const cadModelJscad = cadModelBase.extend({
113
113
  jscad: z.record(z.any()),
114
114
  })
115
115
 
116
+ /**
117
+ * A Footprinter string used to procedurally generate the component's CAD model,
118
+ * independently of the component's PCB footprint.
119
+ *
120
+ * @example "soic8"
121
+ */
122
+ export type CadModelFootprinterString = string
123
+
116
124
  export type CadModelProp =
117
125
  | null
118
- | string
119
126
  | ReactElement
127
+ | CadModelFootprinterString
120
128
  | CadModelStl
121
129
  | CadModelObj
122
130
  | CadModelGltf
@@ -127,7 +135,7 @@ export type CadModelProp =
127
135
 
128
136
  export const cadModelProp = z.union([
129
137
  z.null(),
130
- url,
138
+ z.string().min(1),
131
139
  z.custom<ReactElement>((v) => {
132
140
  return v && typeof v === "object" && "type" in v && "props" in v
133
141
  }),
@@ -0,0 +1,35 @@
1
+ import { expectTypesMatch } from "lib/typecheck"
2
+ import { z } from "zod"
3
+ import { distance, type Distance } from "./distance"
4
+
5
+ export interface DirectionalFanoutBoundaryPadding {
6
+ top?: Distance
7
+ right?: Distance
8
+ bottom?: Distance
9
+ left?: Distance
10
+ }
11
+
12
+ /**
13
+ * Padding between the union of the fanout source pads and the shared boundary
14
+ * where fanout traces terminate. Omitted directional values are treated as
15
+ * zero.
16
+ */
17
+ export type FanoutBoundaryPadding = Distance | DirectionalFanoutBoundaryPadding
18
+
19
+ const nonnegativeDistance = distance.refine((value) => value >= 0, {
20
+ message: "Fanout boundary padding cannot be negative",
21
+ })
22
+
23
+ export const fanoutBoundaryPadding = z.union([
24
+ nonnegativeDistance,
25
+ z.object({
26
+ top: nonnegativeDistance.optional(),
27
+ right: nonnegativeDistance.optional(),
28
+ bottom: nonnegativeDistance.optional(),
29
+ left: nonnegativeDistance.optional(),
30
+ }),
31
+ ])
32
+
33
+ expectTypesMatch<FanoutBoundaryPadding, z.input<typeof fanoutBoundaryPadding>>(
34
+ true,
35
+ )
@@ -1,5 +1,9 @@
1
1
  import { expectTypesMatch } from "lib/typecheck"
2
2
  import { z } from "zod"
3
+ import {
4
+ type FanoutBoundaryPadding,
5
+ fanoutBoundaryPadding,
6
+ } from "../common/fanoutBoundaryPadding"
3
7
  import {
4
8
  type NinePointAnchor,
5
9
  ninePointAnchor,
@@ -38,6 +42,11 @@ export interface AutoroutingPhaseProps extends RoutingTolerances {
38
42
  * direction unconstrained.
39
43
  */
40
44
  busFanoutDirections?: Record<BusName, BusFanoutDirection>
45
+ /**
46
+ * Padding between the union of the fanout source pads and the shared
47
+ * boundary where fanout traces terminate.
48
+ */
49
+ fanoutBoundaryPadding?: FanoutBoundaryPadding
41
50
  }
42
51
 
43
52
  const busFanoutDirection = z.union([
@@ -65,6 +74,7 @@ export const autoroutingPhaseProps = z
65
74
  connections: z.array(z.string()).optional(),
66
75
  reroute: z.boolean().optional(),
67
76
  busFanoutDirections: z.record(busFanoutDirection).optional(),
77
+ fanoutBoundaryPadding: fanoutBoundaryPadding.optional(),
68
78
  })
69
79
  .superRefine((value, ctx) => {
70
80
  if (
@@ -1,5 +1,8 @@
1
- import { distance } from "circuit-json"
2
- import type { Distance } from "lib/common/distance"
1
+ import { distance, type Distance } from "lib/common/distance"
2
+ import {
3
+ type FanoutBoundaryPadding,
4
+ fanoutBoundaryPadding,
5
+ } from "lib/common/fanoutBoundaryPadding"
3
6
  import { expectTypesMatch } from "lib/typecheck"
4
7
  import { z } from "zod"
5
8
  import {
@@ -21,6 +24,12 @@ export interface BreakoutProps
21
24
  paddingRight?: Distance
22
25
  paddingTop?: Distance
23
26
  paddingBottom?: Distance
27
+ /**
28
+ * Padding between the union of the fanout source pads and the shared
29
+ * boundary where fanout traces terminate. This is independent of the
30
+ * breakout group's layout padding.
31
+ */
32
+ fanoutBoundaryPadding?: FanoutBoundaryPadding
24
33
  }
25
34
 
26
35
  export const breakoutProps = subcircuitGroupProps.extend({
@@ -30,6 +39,7 @@ export const breakoutProps = subcircuitGroupProps.extend({
30
39
  paddingRight: distance.optional(),
31
40
  paddingTop: distance.optional(),
32
41
  paddingBottom: distance.optional(),
42
+ fanoutBoundaryPadding: fanoutBoundaryPadding.optional(),
33
43
  })
34
44
 
35
45
  type InferredBreakoutProps = z.input<typeof breakoutProps>
@@ -335,6 +335,7 @@ export interface AutorouterConfig {
335
335
  cache?: PcbRouteCache
336
336
  traceClearance?: Distance
337
337
  availableJumperTypes?: Array<"1206x4" | "0603">
338
+ allowViaInPad?: boolean
338
339
  groupMode?:
339
340
  | "sequential_trace"
340
341
  | "subcircuit"
@@ -408,6 +409,12 @@ export const autorouterConfig = z.object({
408
409
  cache: z.custom<PcbRouteCache>((v) => true).optional(),
409
410
  traceClearance: length.optional(),
410
411
  availableJumperTypes: z.array(z.enum(["1206x4", "0603"])).optional(),
412
+ allowViaInPad: z
413
+ .boolean()
414
+ .optional()
415
+ .describe(
416
+ "Allows the autorouter to place vias inside connected pads. Omitted or false keeps via-in-pad routing disabled.",
417
+ ),
411
418
  groupMode: z
412
419
  .enum(["sequential_trace", "subcircuit", "sequential-trace"])
413
420
  .optional(),
package/lib/index.ts CHANGED
@@ -139,3 +139,4 @@ export * from "./platformConfig"
139
139
  export * from "./projectConfig"
140
140
  export * from "./utility-types/connections-and-selectors"
141
141
  export * from "./common/ninePointAnchor"
142
+ export * from "./common/fanoutBoundaryPadding"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.595",
3
+ "version": "0.0.597",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",