@tscircuit/core 0.0.1980 → 0.0.1982

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -17
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -5466,21 +5466,15 @@ import {
5466
5466
 
5467
5467
  // lib/components/primitive-components/Trace/trace-utils/compute-trace-length.ts
5468
5468
  function getTraceLength(route) {
5469
- let totalLength = 0;
5470
- for (let i = 0; i < route.length; i++) {
5471
- const point6 = route[i];
5472
- if (point6.route_type === "wire") {
5473
- const nextPoint = route[i + 1];
5474
- if (nextPoint) {
5475
- const nextPosition = getRoutePointPosition(nextPoint);
5476
- const position = getRoutePointPosition(point6);
5477
- const dx = nextPosition.x - position.x;
5478
- const dy = nextPosition.y - position.y;
5479
- totalLength += Math.sqrt(dx * dx + dy * dy);
5480
- }
5481
- } else if (point6.route_type === "via") {
5482
- totalLength += 1.6;
5483
- }
5469
+ const routePositions = route.flatMap(getRoutePointPositions);
5470
+ let totalLength = route.filter(({ route_type }) => route_type === "via").length * 1.6;
5471
+ for (let i = 1; i < routePositions.length; i++) {
5472
+ const previousPosition = routePositions[i - 1];
5473
+ const position = routePositions[i];
5474
+ totalLength += Math.hypot(
5475
+ position.x - previousPosition.x,
5476
+ position.y - previousPosition.y
5477
+ );
5484
5478
  }
5485
5479
  return totalLength;
5486
5480
  }
@@ -64021,7 +64015,7 @@ function Group_getRoutingPhasePlans(group) {
64021
64015
  var package_default = {
64022
64016
  name: "@tscircuit/core",
64023
64017
  type: "module",
64024
- version: "0.0.1979",
64018
+ version: "0.0.1981",
64025
64019
  types: "dist/index.d.ts",
64026
64020
  main: "dist/index.js",
64027
64021
  module: "dist/index.js",
@@ -64143,7 +64137,7 @@ var package_default = {
64143
64137
  "@flatten-js/core": "^1.6.2",
64144
64138
  "@lume/kiwi": "^0.4.3",
64145
64139
  "calculate-cell-boundaries": "^0.0.21",
64146
- "calculate-packing": "^0.0.89",
64140
+ "calculate-packing": "^0.0.90",
64147
64141
  "css-select": "5.1.0",
64148
64142
  "format-si-unit": "^0.0.12",
64149
64143
  nanoid: "^5.0.7",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1980",
4
+ "version": "0.0.1982",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -123,7 +123,7 @@
123
123
  "@flatten-js/core": "^1.6.2",
124
124
  "@lume/kiwi": "^0.4.3",
125
125
  "calculate-cell-boundaries": "^0.0.21",
126
- "calculate-packing": "^0.0.89",
126
+ "calculate-packing": "^0.0.90",
127
127
  "css-select": "5.1.0",
128
128
  "format-si-unit": "^0.0.12",
129
129
  "nanoid": "^5.0.7",