@tscircuit/props 0.0.600 → 0.0.602

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,65 @@
1
+ import { layer_ref, type LayerRef, type LayerRefInput } from "circuit-json"
2
+ import { expectTypesMatch } from "lib/typecheck"
3
+ import { z } from "zod"
4
+ import type { BusName } from "../components/bus"
5
+ import {
6
+ type FanoutBoundaryPadding,
7
+ fanoutBoundaryPadding,
8
+ } from "./fanoutBoundaryPadding"
9
+ import { type NinePointAnchor, ninePointAnchor } from "./ninePointAnchor"
10
+
11
+ export type BusFanoutDirection =
12
+ | NinePointAnchor
13
+ | {
14
+ direction: NinePointAnchor
15
+ }
16
+
17
+ export type FanoutPourNetMap = Partial<
18
+ Record<Extract<LayerRef, string>, string | string[]>
19
+ >
20
+
21
+ /**
22
+ * Routing controls shared by fanout autorouting phases and breakout groups.
23
+ */
24
+ export interface FanoutProps {
25
+ /**
26
+ * Fanout direction for each named bus. `center` leaves the direction
27
+ * unconstrained.
28
+ */
29
+ busFanoutDirections?: Record<BusName, BusFanoutDirection>
30
+ /**
31
+ * Padding between the union of the fanout source pads and the shared
32
+ * boundary where fanout traces terminate.
33
+ */
34
+ fanoutBoundaryPadding?: FanoutBoundaryPadding
35
+ /**
36
+ * Copper layers available to boundary-terminated fanout buses. Source-only
37
+ * traces whose nets are mapped by `fanoutPourNetMap` terminate on their
38
+ * mapped plane layer.
39
+ */
40
+ fanoutRoutingLayers?: LayerRefInput[]
41
+ /**
42
+ * Maps copper layers to the net or nets poured on them. During fanout,
43
+ * source-only traces on those nets drop to the mapped layer instead of
44
+ * routing to the breakout boundary.
45
+ *
46
+ * This is inferred from `<copperpour>` components when omitted.
47
+ */
48
+ fanoutPourNetMap?: FanoutPourNetMap
49
+ }
50
+
51
+ export const busFanoutDirection = z.union([
52
+ ninePointAnchor,
53
+ z.object({ direction: ninePointAnchor }),
54
+ ])
55
+
56
+ export const fanoutProps = z.object({
57
+ busFanoutDirections: z.record(busFanoutDirection).optional(),
58
+ fanoutBoundaryPadding: fanoutBoundaryPadding.optional(),
59
+ fanoutRoutingLayers: z.array(layer_ref).min(1).optional(),
60
+ fanoutPourNetMap: z
61
+ .record(layer_ref, z.union([z.string(), z.array(z.string()).min(1)]))
62
+ .optional(),
63
+ })
64
+
65
+ expectTypesMatch<FanoutProps, z.input<typeof fanoutProps>>(true)
@@ -1,15 +1,6 @@
1
1
  import { expectTypesMatch } from "lib/typecheck"
2
2
  import { z } from "zod"
3
- import { layer_ref, type LayerRef, type LayerRefInput } from "circuit-json"
4
- import {
5
- type FanoutBoundaryPadding,
6
- fanoutBoundaryPadding,
7
- } from "../common/fanoutBoundaryPadding"
8
- import {
9
- type NinePointAnchor,
10
- ninePointAnchor,
11
- } from "../common/ninePointAnchor"
12
- import type { BusName } from "./bus"
3
+ import { type FanoutProps, fanoutProps } from "../common/fanoutProps"
13
4
  import {
14
5
  type AutorouterProp,
15
6
  type RoutingTolerances,
@@ -17,17 +8,12 @@ import {
17
8
  routingTolerances,
18
9
  } from "./group"
19
10
 
20
- export type BusFanoutDirection =
21
- | NinePointAnchor
22
- | {
23
- direction: NinePointAnchor
24
- }
25
-
26
- export type FanoutPourNetMap = Partial<
27
- Record<Extract<LayerRef, string>, string | string[]>
28
- >
11
+ export type {
12
+ BusFanoutDirection,
13
+ FanoutPourNetMap,
14
+ } from "../common/fanoutProps"
29
15
 
30
- export interface AutoroutingPhaseProps extends RoutingTolerances {
16
+ export interface AutoroutingPhaseProps extends RoutingTolerances, FanoutProps {
31
17
  key?: any
32
18
  name?: string
33
19
  autorouter?: AutorouterProp
@@ -42,37 +28,8 @@ export interface AutoroutingPhaseProps extends RoutingTolerances {
42
28
  connection?: string
43
29
  connections?: string[]
44
30
  reroute?: boolean
45
- /**
46
- * Fanout direction for each named bus in this phase. `center` leaves the
47
- * direction unconstrained.
48
- */
49
- busFanoutDirections?: Record<BusName, BusFanoutDirection>
50
- /**
51
- * Padding between the union of the fanout source pads and the shared
52
- * boundary where fanout traces terminate.
53
- */
54
- fanoutBoundaryPadding?: FanoutBoundaryPadding
55
- /**
56
- * Copper layers available to boundary-terminated fanout buses. Source-only
57
- * traces whose nets are mapped by `fanoutPourNetMap` terminate on their
58
- * mapped plane layer.
59
- */
60
- fanoutRoutingLayers?: LayerRefInput[]
61
- /**
62
- * Maps copper layers to the net or nets poured on them. During fanout,
63
- * source-only traces on those nets drop to the mapped layer instead of
64
- * routing to the breakout boundary.
65
- *
66
- * This is inferred from `<copperpour>` components when omitted.
67
- */
68
- fanoutPourNetMap?: FanoutPourNetMap
69
31
  }
70
32
 
71
- const busFanoutDirection = z.union([
72
- ninePointAnchor,
73
- z.object({ direction: ninePointAnchor }),
74
- ])
75
-
76
33
  export const autoroutingPhaseProps = z
77
34
  .object({
78
35
  key: z.any().optional(),
@@ -92,12 +49,7 @@ export const autoroutingPhaseProps = z
92
49
  connection: z.string().optional(),
93
50
  connections: z.array(z.string()).optional(),
94
51
  reroute: z.boolean().optional(),
95
- busFanoutDirections: z.record(busFanoutDirection).optional(),
96
- fanoutBoundaryPadding: fanoutBoundaryPadding.optional(),
97
- fanoutRoutingLayers: z.array(layer_ref).min(1).optional(),
98
- fanoutPourNetMap: z
99
- .record(layer_ref, z.union([z.string(), z.array(z.string()).min(1)]))
100
- .optional(),
52
+ ...fanoutProps.shape,
101
53
  })
102
54
  .superRefine((value, ctx) => {
103
55
  if (
@@ -1,8 +1,5 @@
1
1
  import { distance, type Distance } from "lib/common/distance"
2
- import {
3
- type FanoutBoundaryPadding,
4
- fanoutBoundaryPadding,
5
- } from "lib/common/fanoutBoundaryPadding"
2
+ import { type FanoutProps, fanoutProps } from "lib/common/fanoutProps"
6
3
  import { expectTypesMatch } from "lib/typecheck"
7
4
  import { z } from "zod"
8
5
  import {
@@ -13,7 +10,8 @@ import {
13
10
  } from "./group"
14
11
 
15
12
  export interface BreakoutProps
16
- extends Omit<SubcircuitGroupProps, "subcircuit"> {
13
+ extends Omit<SubcircuitGroupProps, "subcircuit">,
14
+ FanoutProps {
17
15
  /**
18
16
  * Autorouter used to escape the components inside the breakout boundary.
19
17
  * Defaults to the multilayer fanout autorouter.
@@ -24,12 +22,6 @@ export interface BreakoutProps
24
22
  paddingRight?: Distance
25
23
  paddingTop?: Distance
26
24
  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
33
25
  }
34
26
 
35
27
  export const breakoutProps = subcircuitGroupProps.extend({
@@ -39,7 +31,7 @@ export const breakoutProps = subcircuitGroupProps.extend({
39
31
  paddingRight: distance.optional(),
40
32
  paddingTop: distance.optional(),
41
33
  paddingBottom: distance.optional(),
42
- fanoutBoundaryPadding: fanoutBoundaryPadding.optional(),
34
+ ...fanoutProps.shape,
43
35
  })
44
36
 
45
37
  type InferredBreakoutProps = z.input<typeof breakoutProps>
@@ -11,11 +11,14 @@ export interface BusProps {
11
11
  name?: string
12
12
  /** Trace names or port selectors for the connections in the bus. */
13
13
  connections: string[]
14
+ /** Autorouting phase in which this bus constraint should be applied. */
15
+ routingPhaseIndex?: number | null
14
16
  }
15
17
 
16
18
  export const busProps = z.object({
17
19
  name: z.string().optional(),
18
20
  connections: z.array(z.string()).min(2),
21
+ routingPhaseIndex: z.number().nullable().optional(),
19
22
  })
20
23
 
21
24
  type InferredBusProps = z.input<typeof busProps>
package/lib/index.ts CHANGED
@@ -140,3 +140,4 @@ export * from "./projectConfig"
140
140
  export * from "./utility-types/connections-and-selectors"
141
141
  export * from "./common/ninePointAnchor"
142
142
  export * from "./common/fanoutBoundaryPadding"
143
+ export * from "./common/fanoutProps"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.600",
3
+ "version": "0.0.602",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",