@tscircuit/props 0.0.667 → 0.0.668

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.
@@ -13,6 +13,10 @@ const routePoint = z.discriminatedUnion("route_type", [
13
13
  x: coordinate,
14
14
  y: coordinate,
15
15
  width: positiveDistance,
16
+ width_interpolation_mode: z
17
+ .enum(["linear", "quadratic"])
18
+ .optional()
19
+ .describe("Interpolate width from this point to the next wire point."),
16
20
  layer: layer_ref,
17
21
  }),
18
22
  z.object({
@@ -31,6 +35,10 @@ const routePoint = z.discriminatedUnion("route_type", [
31
35
  * fanout's local PCB frame, in mm: +X right, +Y up, right-handed with +Z
32
36
  * above the board. They are points (placement adds translation), not
33
37
  * directions. Numeric distances are mm; unit strings are parsed to mm.
38
+ * A wire point's optional width_interpolation_mode interpolates its width to
39
+ * the next wire point's width. Omitted means the existing constant-width
40
+ * behavior; there are no aliases or migration requirements. Interpolation
41
+ * cannot terminate at a via directly: put a wire point at the via position.
34
42
  * Layers are physical board layers, independent of placement. Either endpoint
35
43
  * may be a via: the initial layer is its from_layer and the final layer is its
36
44
  * to_layer. Placement legality (including allowViaInPad) is checked by core,
@@ -44,7 +52,22 @@ export const fanoutTracePath = z.object({
44
52
  .superRefine((route, ctx) => {
45
53
  const first = route[0]
46
54
  let layer = first?.route_type === "via" ? first.from_layer : first?.layer
47
- for (const point of route) {
55
+ for (const [index, point] of route.entries()) {
56
+ if (point.route_type === "wire" && point.width_interpolation_mode) {
57
+ const next = route[index + 1]
58
+ if (
59
+ next?.route_type !== "wire" ||
60
+ next.layer !== point.layer ||
61
+ (next.x === point.x && next.y === point.y)
62
+ ) {
63
+ ctx.addIssue({
64
+ code: "custom",
65
+ path: [index, "width_interpolation_mode"],
66
+ message:
67
+ "Width interpolation requires a distinct next wire point on the same layer",
68
+ })
69
+ }
70
+ }
48
71
  if (
49
72
  (point.route_type === "wire" ? point.layer : point.from_layer) !==
50
73
  layer
@@ -22,6 +22,15 @@ const baseTraceProps = z.object({
22
22
  width: distance.optional().describe("Alias for trace thickness"),
23
23
  schematicRouteHints: z.array(point).optional(),
24
24
  pcbRouteHints: z.array(route_hint_point).optional(),
25
+ pcbTeardrops: z.boolean().optional().describe("Enable PCB trace teardrops."),
26
+ pcbTeardropStart: z
27
+ .boolean()
28
+ .optional()
29
+ .describe("Teardrop at the start (from) of trace"),
30
+ pcbTeardropEnd: z
31
+ .boolean()
32
+ .optional()
33
+ .describe("Teardrop at the end (to) of trace"),
25
34
  pcbPathRelativeTo: z.string().optional(),
26
35
  pcbPath: pcbPath.optional(),
27
36
  pcbPaths: z.array(pcbPath).optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.667",
3
+ "version": "0.0.668",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",