@tscircuit/core 0.0.1979 → 0.0.1981

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.
package/dist/index.d.ts CHANGED
@@ -2494,9 +2494,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
2494
2494
  */
2495
2495
  doInitialPcbComponentSizeCalculation(): void;
2496
2496
  updatePcbComponentSizeCalculation(): void;
2497
- /**
2498
- * Calculate and update the size of a custom schematic symbol based on its children
2499
- */
2497
+ /** Calculate a custom schematic symbol's body bounds from its graphics. */
2500
2498
  doInitialSchematicComponentSizeCalculation(): void;
2501
2499
  updateSchematicComponentSizeCalculation(): void;
2502
2500
  doInitialPcbComponentAnchorAlignment(): void;
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
  }
@@ -16236,9 +16230,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
16236
16230
  updatePcbComponentSizeCalculation() {
16237
16231
  this.doInitialPcbComponentSizeCalculation();
16238
16232
  }
16239
- /**
16240
- * Calculate and update the size of a custom schematic symbol based on its children
16241
- */
16233
+ /** Calculate a custom schematic symbol's body bounds from its graphics. */
16242
16234
  doInitialSchematicComponentSizeCalculation() {
16243
16235
  if (this.root?.schematicDisabled) return;
16244
16236
  if (!this.schematic_component_id) return;
@@ -16268,10 +16260,6 @@ var NormalComponent = class extends PrimitiveComponent2 {
16268
16260
  const arc = db.schematic_arc.get(child.schematic_arc_id);
16269
16261
  if (arc) schematicElements.push(arc);
16270
16262
  }
16271
- if (child.isSchematicPrimitive && child.componentName === "SchematicText") {
16272
- const text = db.schematic_text.get(child.schematic_text_id);
16273
- if (text) schematicElements.push(text);
16274
- }
16275
16263
  if (child.isSchematicPrimitive && child.componentName === "SchematicPath") {
16276
16264
  const pathIds = child.schematic_path_ids;
16277
16265
  if (pathIds) {
@@ -64027,7 +64015,7 @@ function Group_getRoutingPhasePlans(group) {
64027
64015
  var package_default = {
64028
64016
  name: "@tscircuit/core",
64029
64017
  type: "module",
64030
- version: "0.0.1978",
64018
+ version: "0.0.1980",
64031
64019
  types: "dist/index.d.ts",
64032
64020
  main: "dist/index.js",
64033
64021
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1979",
4
+ "version": "0.0.1981",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",