@tscircuit/props 0.0.633 → 0.0.634

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.
@@ -1,4 +1,4 @@
1
- import { layer_ref, type LayerRef, type LayerRefInput } from "circuit-json"
1
+ import { type LayerRef, type LayerRefInput, layer_ref } from "circuit-json"
2
2
  import { expectTypesMatch } from "lib/typecheck"
3
3
  import { z } from "zod"
4
4
  import type { BusName } from "../components/bus"
@@ -8,10 +8,59 @@ import {
8
8
  } from "./fanoutBoundaryPadding"
9
9
  import { type NinePointAnchor, ninePointAnchor } from "./ninePointAnchor"
10
10
 
11
- export type BusFanoutDirection =
11
+ /**
12
+ * An unambiguous fanout direction and boundary position.
13
+ *
14
+ * The prefix before `side` names the physical boundary edge. The suffix names
15
+ * the region along that edge; for corner regions it also names the local
16
+ * direction used to escape the source pads. For example, `rightside_top`
17
+ * terminates on the right edge in its upper region after escaping the source
18
+ * pads toward the top, while `topside_right` terminates on the top edge in its
19
+ * right region after escaping toward the right. Center regions escape toward
20
+ * their named edge. Directions are in board/circuit world coordinates, where
21
+ * right is +X and top is +Y; they do not rotate with the source component.
22
+ * `center` leaves the fanout direction unconstrained.
23
+ */
24
+ export const canonicalBusFanoutDirectionValues = [
25
+ "topside_left",
26
+ "topside_center",
27
+ "topside_right",
28
+ "rightside_top",
29
+ "rightside_center",
30
+ "rightside_bottom",
31
+ "bottomside_right",
32
+ "bottomside_center",
33
+ "bottomside_left",
34
+ "leftside_bottom",
35
+ "leftside_center",
36
+ "leftside_top",
37
+ "center",
38
+ ] as const
39
+
40
+ export const canonicalBusFanoutDirection = z.enum(
41
+ canonicalBusFanoutDirectionValues,
42
+ )
43
+
44
+ export type CanonicalBusFanoutDirection =
45
+ (typeof canonicalBusFanoutDirectionValues)[number]
46
+
47
+ /**
48
+ * Legacy NinePointAnchor fanout names. `top_left`, `top_center`, `top_right`,
49
+ * `center_left`, `center`, `center_right`, `bottom_left`, `bottom_center`, and
50
+ * `bottom_right` remain accepted unchanged and retain their destination-guided
51
+ * behavior. Prefer `CanonicalBusFanoutDirection` when the physical exit edge
52
+ * matters.
53
+ */
54
+ export type LegacyBusFanoutDirection = NinePointAnchor
55
+
56
+ export type BusFanoutDirectionLiteral =
12
57
  | NinePointAnchor
58
+ | CanonicalBusFanoutDirection
59
+
60
+ export type BusFanoutDirection =
61
+ | BusFanoutDirectionLiteral
13
62
  | {
14
- direction: NinePointAnchor
63
+ direction: BusFanoutDirectionLiteral
15
64
  }
16
65
 
17
66
  export type FanoutPourNetMap = Partial<
@@ -23,8 +72,14 @@ export type FanoutPourNetMap = Partial<
23
72
  */
24
73
  export interface FanoutProps {
25
74
  /**
26
- * Fanout direction for each named bus. `center` leaves the direction
27
- * unconstrained.
75
+ * Fanout direction and boundary position for each named bus. Prefer the
76
+ * edge-first names such as `rightside_top` and `topside_right` when selecting
77
+ * a corner region; their physical exit edges are unambiguous. All legacy
78
+ * NinePointAnchor names remain accepted unchanged and retain their
79
+ * destination-guided behavior. `center` leaves the direction unconstrained.
80
+ * Directions use board/circuit world coordinates. For a bus that terminates
81
+ * on a copper plane, the physical-edge prefix is ignored and only the
82
+ * position's local escape direction is used.
28
83
  */
29
84
  busFanoutDirections?: Record<BusName, BusFanoutDirection>
30
85
  /**
@@ -50,7 +105,10 @@ export interface FanoutProps {
50
105
 
51
106
  export const busFanoutDirection = z.union([
52
107
  ninePointAnchor,
53
- z.object({ direction: ninePointAnchor }),
108
+ canonicalBusFanoutDirection,
109
+ z.object({
110
+ direction: z.union([ninePointAnchor, canonicalBusFanoutDirection]),
111
+ }),
54
112
  ])
55
113
 
56
114
  export const fanoutProps = z.object({
@@ -10,7 +10,10 @@ import {
10
10
 
11
11
  export type {
12
12
  BusFanoutDirection,
13
+ BusFanoutDirectionLiteral,
14
+ CanonicalBusFanoutDirection,
13
15
  FanoutPourNetMap,
16
+ LegacyBusFanoutDirection,
14
17
  } from "../common/fanoutProps"
15
18
 
16
19
  export interface AutoroutingPhaseProps extends RoutingTolerances, FanoutProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.633",
3
+ "version": "0.0.634",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",