@tscircuit/core 0.0.256 → 0.0.258

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
@@ -85,6 +85,10 @@ interface SchematicBoxDimensions {
85
85
  width: number;
86
86
  height: number;
87
87
  };
88
+ getSizeIncludingPins(): {
89
+ width: number;
90
+ height: number;
91
+ };
88
92
  }
89
93
 
90
94
  type RootCircuitEventName = "asyncEffect:start" | "asyncEffect:end" | "renderable:renderLifecycle:anyEvent" | `renderable:renderLifecycle:${RenderPhase}:start` | `renderable:renderLifecycle:${RenderPhase}:end` | "external:evalError";
@@ -641,7 +645,8 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
641
645
  doInitialSourceTraceRender(): void;
642
646
  doInitialPcbTraceRender(): void;
643
647
  _doInitialSchematicTraceRenderWithDisplayLabel(): void;
644
- private _isPassiveToChipConnection;
648
+ private _isSymbolToChipConnection;
649
+ private _isSymbolToSymbolConnection;
645
650
  doInitialSchematicTraceRender(): void;
646
651
  }
647
652
 
@@ -1123,6 +1128,7 @@ declare class Board extends Group<typeof boardProps> {
1123
1128
  }[] | undefined;
1124
1129
  }>>;
1125
1130
  schAutoLayoutEnabled: z.ZodOptional<z.ZodBoolean>;
1131
+ schTraceAutoLabelEnabled: z.ZodOptional<z.ZodBoolean>;
1126
1132
  routingDisabled: z.ZodOptional<z.ZodBoolean>;
1127
1133
  defaultTraceWidth: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
1128
1134
  minTraceWidth: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
@@ -1212,6 +1218,7 @@ declare class Board extends Group<typeof boardProps> {
1212
1218
  cache?: _tscircuit_props.PcbRouteCache | undefined;
1213
1219
  } | undefined;
1214
1220
  schAutoLayoutEnabled?: boolean | undefined;
1221
+ schTraceAutoLabelEnabled?: boolean | undefined;
1215
1222
  partsEngine?: _tscircuit_props.PartsEngine | undefined;
1216
1223
  outline?: {
1217
1224
  x: number;
@@ -1276,6 +1283,7 @@ declare class Board extends Group<typeof boardProps> {
1276
1283
  cache?: _tscircuit_props.PcbRouteCache | undefined;
1277
1284
  } | undefined;
1278
1285
  schAutoLayoutEnabled?: boolean | undefined;
1286
+ schTraceAutoLabelEnabled?: boolean | undefined;
1279
1287
  partsEngine?: _tscircuit_props.PartsEngine | undefined;
1280
1288
  outline?: {
1281
1289
  x: string | number;
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ __export(components_exports, {
44
44
  SilkscreenText: () => SilkscreenText,
45
45
  SmtPad: () => SmtPad,
46
46
  Subcircuit: () => Subcircuit,
47
- Trace: () => Trace,
47
+ Trace: () => Trace2,
48
48
  TraceHint: () => TraceHint,
49
49
  Transistor: () => Transistor,
50
50
  Via: () => Via
@@ -53,12 +53,14 @@ __export(components_exports, {
53
53
  // lib/components/base-components/NormalComponent.ts
54
54
  import { fp } from "@tscircuit/footprinter";
55
55
  import { point3, rotation } from "circuit-json";
56
- import Debug3 from "debug";
56
+ import Debug4 from "debug";
57
57
 
58
58
  // lib/fiber/create-instance-from-react-element.ts
59
59
  import ReactReconciler from "react-reconciler";
60
60
 
61
61
  // lib/components/base-components/Renderable.ts
62
+ import Debug from "debug";
63
+ var debug = Debug("tscircuit:renderable");
62
64
  var orderedRenderPhases = [
63
65
  "ReactSubtreesRender",
64
66
  "InitializePortsFromChildren",
@@ -163,6 +165,7 @@ ${error.stack}`
163
165
  });
164
166
  }
165
167
  _emitRenderLifecycleEvent(phase, startOrEnd) {
168
+ debug(`${phase}:${startOrEnd} ${this.getString()}`);
166
169
  const granular_event_type = `renderable:renderLifecycle:${phase}:${startOrEnd}`;
167
170
  const eventPayload = {
168
171
  renderId: this._renderId,
@@ -564,8 +567,8 @@ import {
564
567
  translate
565
568
  } from "transformation-matrix";
566
569
  import { z as z2 } from "zod";
567
- import Debug from "debug";
568
- var debugSelectAll = Debug("tscircuit:primitive-component:selectAll");
570
+ import Debug2 from "debug";
571
+ var debugSelectAll = Debug2("tscircuit:primitive-component:selectAll");
569
572
  var PrimitiveComponent = class extends Renderable {
570
573
  parent = null;
571
574
  children;
@@ -2480,6 +2483,12 @@ var getAllDimensionsForSchematicBox = (params) => {
2480
2483
  getSize() {
2481
2484
  return { width: schWidth, height: schHeight };
2482
2485
  },
2486
+ getSizeIncludingPins() {
2487
+ return {
2488
+ width: schWidth + (sidePinCounts.leftSize || sidePinCounts.rightSize ? 0.4 : 0),
2489
+ height: schHeight + (sidePinCounts.topSize || sidePinCounts.bottomSize ? 0.4 : 0)
2490
+ };
2491
+ },
2483
2492
  pinCount
2484
2493
  };
2485
2494
  };
@@ -2495,8 +2504,8 @@ import { z as z5 } from "zod";
2495
2504
  // lib/components/primitive-components/Footprint.ts
2496
2505
  import { footprintProps } from "@tscircuit/props";
2497
2506
  import * as kiwi from "@lume/kiwi";
2498
- import Debug2 from "debug";
2499
- var debug = Debug2("tscircuit:core:footprint");
2507
+ import Debug3 from "debug";
2508
+ var debug2 = Debug3("tscircuit:core:footprint");
2500
2509
  var Footprint = class extends PrimitiveComponent {
2501
2510
  get config() {
2502
2511
  return {
@@ -2654,7 +2663,7 @@ var Footprint = class extends PrimitiveComponent {
2654
2663
  }
2655
2664
  }
2656
2665
  solver.updateVariables();
2657
- if (debug.enabled) {
2666
+ if (debug2.enabled) {
2658
2667
  console.log("Solution to layout constraints:");
2659
2668
  console.table(
2660
2669
  Object.entries(kVars).map(([key, kvar]) => ({
@@ -2717,7 +2726,7 @@ var getNumericSchPinStyle = (pinStyles, pinLabels) => {
2717
2726
  };
2718
2727
 
2719
2728
  // lib/components/base-components/NormalComponent.ts
2720
- var debug2 = Debug3("tscircuit:core");
2729
+ var debug3 = Debug4("tscircuit:core");
2721
2730
  var rotation3 = z5.object({
2722
2731
  x: rotation,
2723
2732
  y: rotation,
@@ -3010,6 +3019,10 @@ var NormalComponent = class extends PrimitiveComponent {
3010
3019
  center,
3011
3020
  rotation: props.schRotation ?? 0,
3012
3021
  size: dimensions.getSize(),
3022
+ // We should be using the full size, but circuit-to-svg incorrectly
3023
+ // uses the schematic_component size to draw boxes instead of the
3024
+ // schematic_box size
3025
+ // size: dimensions.getSizeIncludingPins(),
3013
3026
  port_arrangement: underscorifyPortArrangement(
3014
3027
  props.schPortArrangement
3015
3028
  ),
@@ -3145,7 +3158,7 @@ var NormalComponent = class extends PrimitiveComponent {
3145
3158
  (p) => p.isMatchingAnyOf(component.getNameAndAliases())
3146
3159
  );
3147
3160
  if (conflictingPort) {
3148
- debug2(
3161
+ debug3(
3149
3162
  `Similar ports added. Port 1: ${conflictingPort}, Port 2: ${component}`
3150
3163
  );
3151
3164
  }
@@ -3536,7 +3549,7 @@ var getSimpleRouteJsonFromTracesAndDb = ({
3536
3549
  };
3537
3550
 
3538
3551
  // lib/components/primitive-components/Group/Group.ts
3539
- import Debug4 from "debug";
3552
+ import Debug5 from "debug";
3540
3553
  var Group = class extends NormalComponent {
3541
3554
  _asyncAutoroutingResult = null;
3542
3555
  get config() {
@@ -3604,9 +3617,9 @@ var Group = class extends NormalComponent {
3604
3617
  if (this._shouldUseTraceByTraceRouting()) return;
3605
3618
  const serverUrl = this.props.autorouter?.serverUrl ?? "https://registry-api.tscircuit.com";
3606
3619
  const serverMode = this.props.autorouter?.serverMode ?? "job";
3607
- const debug3 = Debug4("tscircuit:core:autorouting");
3620
+ const debug4 = Debug5("tscircuit:core:autorouting");
3608
3621
  const fetchWithDebug = (url, options) => {
3609
- debug3("fetching", url);
3622
+ debug4("fetching", url);
3610
3623
  return fetch(url, options);
3611
3624
  };
3612
3625
  this._queueAsyncEffect("make-http-autorouting-request", async () => {
@@ -4475,6 +4488,72 @@ function getTraceDisplayName({
4475
4488
  return void 0;
4476
4489
  }
4477
4490
 
4491
+ // lib/components/primitive-components/Trace/get-obstacles-for-trace.ts
4492
+ import { getUnitVectorFromDirection } from "@tscircuit/math-utils";
4493
+ var getSchematicObstaclesForTrace = (trace) => {
4494
+ const db = trace.root.db;
4495
+ const connectedPorts = trace._findConnectedPorts().ports ?? [];
4496
+ const connectedPortIds = new Set(
4497
+ connectedPorts.map((p) => p.schematic_port_id)
4498
+ );
4499
+ const obstacles = [];
4500
+ for (const elm of db.toArray()) {
4501
+ if (elm.type === "schematic_component") {
4502
+ const isSymbol = Boolean(elm.symbol_name);
4503
+ const dominateAxis = elm.size.width > elm.size.height ? "horz" : "vert";
4504
+ obstacles.push({
4505
+ type: "rect",
4506
+ layers: ["top"],
4507
+ center: elm.center,
4508
+ width: elm.size.width + (isSymbol && dominateAxis === "horz" ? -0.5 : 0),
4509
+ height: elm.size.height + (isSymbol && dominateAxis === "vert" ? -0.5 : 0),
4510
+ connectedTo: []
4511
+ });
4512
+ }
4513
+ if (elm.type === "schematic_port") {
4514
+ if (connectedPortIds.has(elm.schematic_port_id)) {
4515
+ continue;
4516
+ }
4517
+ const dirVec = elm.facing_direction ? getUnitVectorFromDirection(elm.facing_direction) : {
4518
+ x: 0,
4519
+ y: 0
4520
+ };
4521
+ obstacles.push({
4522
+ type: "rect",
4523
+ layers: ["top"],
4524
+ center: {
4525
+ x: elm.center.x - dirVec.x * 0.1,
4526
+ y: elm.center.y - dirVec.y * 0.1
4527
+ },
4528
+ width: 0.1 + Math.abs(dirVec.x) * 0.3,
4529
+ height: 0.1 + Math.abs(dirVec.y) * 0.3,
4530
+ connectedTo: []
4531
+ });
4532
+ }
4533
+ if (elm.type === "schematic_text") {
4534
+ obstacles.push({
4535
+ type: "rect",
4536
+ layers: ["top"],
4537
+ center: elm.position,
4538
+ width: (elm.text?.length ?? 0) * 0.1,
4539
+ height: 0.2,
4540
+ connectedTo: []
4541
+ });
4542
+ }
4543
+ if (elm.type === "schematic_box") {
4544
+ obstacles.push({
4545
+ type: "rect",
4546
+ layers: ["top"],
4547
+ center: { x: elm.x, y: elm.y },
4548
+ width: elm.width,
4549
+ height: elm.height,
4550
+ connectedTo: []
4551
+ });
4552
+ }
4553
+ }
4554
+ return obstacles;
4555
+ };
4556
+
4478
4557
  // lib/components/primitive-components/Trace/Trace.ts
4479
4558
  var portToObjective = (port) => {
4480
4559
  const portPosition = port._getGlobalPcbPositionAfterLayout();
@@ -4484,7 +4563,7 @@ var portToObjective = (port) => {
4484
4563
  };
4485
4564
  };
4486
4565
  var SHOULD_USE_SINGLE_LAYER_ROUTING = false;
4487
- var Trace = class extends PrimitiveComponent {
4566
+ var Trace2 = class extends PrimitiveComponent {
4488
4567
  source_trace_id = null;
4489
4568
  pcb_trace_id = null;
4490
4569
  schematic_trace_id = null;
@@ -4946,12 +5025,16 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
4946
5025
  }
4947
5026
  const existingFromNetLabel = db.schematic_net_label.list().find((label) => label.source_net_id === fromPort.source_port_id);
4948
5027
  const existingToNetLabel = db.schematic_net_label.list().find((label) => label.source_net_id === toPort.source_port_id);
4949
- if (existingFromNetLabel && existingFromNetLabel.text !== this.props.schDisplayLabel || existingToNetLabel && existingToNetLabel?.text !== this.props.schDisplayLabel) {
5028
+ const [firstPort, secondPort] = connectedPorts.map(({ port }) => port);
5029
+ const isFirstPortSchematicBox = firstPort.parent?.config.shouldRenderAsSchematicBox;
5030
+ const pinFullName = isFirstPortSchematicBox ? `${firstPort?.parent?.props.name}_${firstPort?.props.name}` : `${secondPort?.parent?.props.name}_${secondPort?.props.name}`;
5031
+ const netLabelText = this.props.schDisplayLabel ?? pinFullName;
5032
+ if (existingFromNetLabel && existingFromNetLabel.text !== netLabelText || existingToNetLabel && existingToNetLabel?.text !== netLabelText) {
4950
5033
  throw new Error(
4951
- `Cannot create net label for port ${existingFromNetLabel ? fromPortName : toPortName} because it already has a net label with text "${existingFromNetLabel ? existingFromNetLabel.text : existingToNetLabel?.text}".`
5034
+ `Cannot create net label "${netLabelText}" for port ${existingFromNetLabel ? fromPortName : toPortName} because it already has a net label with text "${existingFromNetLabel ? existingFromNetLabel.text : existingToNetLabel?.text}".`
4952
5035
  );
4953
5036
  }
4954
- if (this.props.schDisplayLabel?.toLocaleLowerCase().includes("gnd") || this.props.schDisplayLabel?.toLocaleLowerCase().includes("ground")) {
5037
+ if (netLabelText?.toLocaleLowerCase().includes("gnd") || netLabelText?.toLocaleLowerCase().includes("ground")) {
4955
5038
  createDownwardNetLabelGroundSymbol(
4956
5039
  {
4957
5040
  fromPort,
@@ -4965,9 +5048,6 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
4965
5048
  );
4966
5049
  return;
4967
5050
  }
4968
- const [firstPort, secondPort] = connectedPorts.map(({ port }) => port);
4969
- const isFirstPortSchematicBox = firstPort.parent?.config.shouldRenderAsSchematicBox;
4970
- const pinFullName = isFirstPortSchematicBox ? `${firstPort?.parent?.props.name}_${firstPort?.props.name}` : `${secondPort?.parent?.props.name}_${secondPort?.props.name}`;
4971
5051
  db.schematic_net_label.insert({
4972
5052
  text: this.props.schDisplayLabel ?? pinFullName,
4973
5053
  source_net_id: toPort.source_port_id,
@@ -4983,7 +5063,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
4983
5063
  anchor_side: getEnteringEdgeFromDirection(fromPort.facingDirection) ?? "bottom"
4984
5064
  });
4985
5065
  }
4986
- _isPassiveToChipConnection() {
5066
+ _isSymbolToChipConnection() {
4987
5067
  const { allPortsFound, ports } = this._findConnectedPorts();
4988
5068
  if (!allPortsFound || ports.length !== 2) return false;
4989
5069
  const [port1, port2] = ports;
@@ -4992,6 +5072,15 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
4992
5072
  const isPort2Chip = port2.parent.config.shouldRenderAsSchematicBox;
4993
5073
  return isPort1Chip && !isPort2Chip || !isPort1Chip && isPort2Chip;
4994
5074
  }
5075
+ _isSymbolToSymbolConnection() {
5076
+ const { allPortsFound, ports } = this._findConnectedPorts();
5077
+ if (!allPortsFound || ports.length !== 2) return false;
5078
+ const [port1, port2] = ports;
5079
+ if (!port1?.parent || !port2?.parent) return false;
5080
+ const isPort1Symbol = !port1.parent.config.shouldRenderAsSchematicBox;
5081
+ const isPort2Symbol = !port2.parent.config.shouldRenderAsSchematicBox;
5082
+ return isPort1Symbol && isPort2Symbol;
5083
+ }
4995
5084
  doInitialSchematicTraceRender() {
4996
5085
  if (this.root?.schematicDisabled) return;
4997
5086
  const { db } = this.root;
@@ -5000,76 +5089,15 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5000
5089
  const { allPortsFound, portsWithSelectors: connectedPorts } = this._findConnectedPorts();
5001
5090
  const { netsWithSelectors } = this._findConnectedNets();
5002
5091
  if (!allPortsFound) return;
5003
- const obstacles = [];
5004
- const connection = {
5005
- name: this.source_trace_id,
5006
- pointsToConnect: []
5007
- };
5008
5092
  if (this.props.schDisplayLabel && ("from" in this.props && "to" in this.props || "path" in this.props)) {
5009
5093
  this._doInitialSchematicTraceRenderWithDisplayLabel();
5010
5094
  return;
5011
5095
  }
5012
- for (const elm of db.toArray()) {
5013
- if (elm.type === "schematic_component") {
5014
- obstacles.push({
5015
- type: "rect",
5016
- layers: ["top"],
5017
- center: elm.center,
5018
- width: elm.size.width,
5019
- height: elm.size.height,
5020
- connectedTo: []
5021
- });
5022
- }
5023
- if (elm.type === "schematic_port") {
5024
- obstacles.push({
5025
- type: "rect",
5026
- layers: ["top"],
5027
- center: elm.center,
5028
- width: 0.1,
5029
- height: 0.1,
5030
- connectedTo: []
5031
- });
5032
- }
5033
- if (elm.type === "schematic_text") {
5034
- obstacles.push({
5035
- type: "rect",
5036
- layers: ["top"],
5037
- center: elm.position,
5038
- width: (elm.text?.length ?? 0) * 0.1,
5039
- height: 0.2,
5040
- connectedTo: []
5041
- });
5042
- }
5043
- if (elm.type === "schematic_box") {
5044
- obstacles.push({
5045
- type: "rect",
5046
- layers: ["top"],
5047
- center: { x: elm.x, y: elm.y },
5048
- width: elm.width,
5049
- height: elm.width,
5050
- connectedTo: []
5051
- });
5052
- }
5053
- if (elm.type === "schematic_net_label" && elm.symbol_name) {
5054
- obstacles.push({
5055
- type: "rect",
5056
- layers: ["top"],
5057
- center: elm.center,
5058
- width: 0.25,
5059
- height: 0.6,
5060
- connectedTo: []
5061
- });
5062
- } else if (elm.type === "schematic_net_label") {
5063
- obstacles.push({
5064
- type: "rect",
5065
- layers: ["top"],
5066
- center: elm.center,
5067
- width: (elm.text?.length ?? 0) * 0.1,
5068
- height: 0.2,
5069
- connectedTo: []
5070
- });
5071
- }
5072
- }
5096
+ const connection = {
5097
+ name: this.source_trace_id,
5098
+ pointsToConnect: []
5099
+ };
5100
+ const obstacles = getSchematicObstaclesForTrace(this);
5073
5101
  const portsWithPosition = connectedPorts.map(({ port }) => ({
5074
5102
  port,
5075
5103
  position: port._getGlobalSchematicPositionAfterLayout(),
@@ -5098,24 +5126,66 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5098
5126
  layer: "top"
5099
5127
  }));
5100
5128
  const bounds = computeObstacleBounds(obstacles);
5129
+ const BOUNDS_MARGIN = 2;
5101
5130
  const simpleRouteJsonInput = {
5102
5131
  minTraceWidth: 0.1,
5103
5132
  obstacles,
5104
5133
  connections: [connection],
5105
- bounds,
5134
+ bounds: {
5135
+ minX: bounds.minX - BOUNDS_MARGIN,
5136
+ maxX: bounds.maxX + BOUNDS_MARGIN,
5137
+ minY: bounds.minY - BOUNDS_MARGIN,
5138
+ maxY: bounds.maxY + BOUNDS_MARGIN
5139
+ },
5106
5140
  layerCount: 1
5107
5141
  };
5108
5142
  let Autorouter = MultilayerIjump;
5143
+ let skipOtherTraceInteraction = false;
5109
5144
  if (this.getSubcircuit().props._schDirectLineRoutingEnabled) {
5110
5145
  Autorouter = DirectLineRouter;
5146
+ skipOtherTraceInteraction = true;
5111
5147
  }
5112
5148
  const autorouter = new Autorouter({
5113
5149
  input: simpleRouteJsonInput,
5150
+ MAX_ITERATIONS: 100,
5114
5151
  OBSTACLE_MARGIN: 0.1,
5115
- isRemovePathLoopsEnabled: true
5152
+ isRemovePathLoopsEnabled: true,
5153
+ isShortenPathWithShortcutsEnabled: true,
5154
+ marginsWithCosts: [
5155
+ {
5156
+ margin: 1,
5157
+ enterCost: 0,
5158
+ travelCostFactor: 1
5159
+ },
5160
+ {
5161
+ margin: 0.3,
5162
+ enterCost: 0,
5163
+ travelCostFactor: 1
5164
+ },
5165
+ {
5166
+ margin: 0.2,
5167
+ enterCost: 0,
5168
+ travelCostFactor: 2
5169
+ },
5170
+ {
5171
+ margin: 0.1,
5172
+ enterCost: 0,
5173
+ travelCostFactor: 3
5174
+ }
5175
+ ]
5116
5176
  });
5117
- const results = autorouter.solveAndMapToTraces();
5118
- if (results.length === 0) return;
5177
+ let results = autorouter.solveAndMapToTraces();
5178
+ if (results.length === 0) {
5179
+ if (this._isSymbolToChipConnection() || this._isSymbolToSymbolConnection()) {
5180
+ this._doInitialSchematicTraceRenderWithDisplayLabel();
5181
+ return;
5182
+ }
5183
+ const directLineRouter = new DirectLineRouter({
5184
+ input: simpleRouteJsonInput
5185
+ });
5186
+ results = directLineRouter.solveAndMapToTraces();
5187
+ skipOtherTraceInteraction = true;
5188
+ }
5119
5189
  const [{ route }] = results;
5120
5190
  const edges = [];
5121
5191
  for (let i = 0; i < route.length - 1; i++) {
@@ -5125,13 +5195,16 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5125
5195
  });
5126
5196
  }
5127
5197
  const source_trace_id = this.source_trace_id;
5128
- pushEdgesOfSchematicTraceToPreventOverlap({ edges, db, source_trace_id });
5129
- createSchematicTraceCrossingSegments({ edges, db, source_trace_id });
5130
- const junctions = createSchematicTraceJunctions({
5131
- edges,
5132
- db,
5133
- source_trace_id: this.source_trace_id
5134
- });
5198
+ let junctions = [];
5199
+ if (!skipOtherTraceInteraction) {
5200
+ pushEdgesOfSchematicTraceToPreventOverlap({ edges, db, source_trace_id });
5201
+ createSchematicTraceCrossingSegments({ edges, db, source_trace_id });
5202
+ junctions = createSchematicTraceJunctions({
5203
+ edges,
5204
+ db,
5205
+ source_trace_id: this.source_trace_id
5206
+ });
5207
+ }
5135
5208
  const lastEdge = edges[edges.length - 1];
5136
5209
  const lastEdgePort = portsWithPosition[portsWithPosition.length - 1];
5137
5210
  const lastDominantDirection = getDominantDirection(lastEdge);
@@ -5151,17 +5224,16 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5151
5224
  if (!this.source_trace_id) {
5152
5225
  throw new Error("Missing source_trace_id for schematic trace insertion.");
5153
5226
  }
5154
- if (countComplexElements(junctions, edges) >= 5 && this._isPassiveToChipConnection()) {
5227
+ if (this.getSubcircuit()._parsedProps.schTraceAutoLabelEnabled && countComplexElements(junctions, edges) >= 5 && (this._isSymbolToChipConnection() || this._isSymbolToSymbolConnection())) {
5155
5228
  this._doInitialSchematicTraceRenderWithDisplayLabel();
5156
- db.schematic_trace.delete(this.schematic_trace_id);
5157
- } else {
5158
- const trace = db.schematic_trace.insert({
5159
- source_trace_id: this.source_trace_id,
5160
- edges,
5161
- junctions
5162
- });
5163
- this.schematic_trace_id = trace.schematic_trace_id;
5229
+ return;
5164
5230
  }
5231
+ const trace = db.schematic_trace.insert({
5232
+ source_trace_id: this.source_trace_id,
5233
+ edges,
5234
+ junctions
5235
+ });
5236
+ this.schematic_trace_id = trace.schematic_trace_id;
5165
5237
  }
5166
5238
  };
5167
5239
 
@@ -5197,13 +5269,13 @@ var Capacitor = class extends NormalComponent {
5197
5269
  doInitialCreateTracesFromProps() {
5198
5270
  if (this.props.decouplingFor && this.props.decouplingTo) {
5199
5271
  this.add(
5200
- new Trace({
5272
+ new Trace2({
5201
5273
  from: `${this.getSubcircuitSelector()} > port.1`,
5202
5274
  to: this.props.decouplingFor
5203
5275
  })
5204
5276
  );
5205
5277
  this.add(
5206
- new Trace({
5278
+ new Trace2({
5207
5279
  from: `${this.getSubcircuitSelector()} > port.2`,
5208
5280
  to: this.props.decouplingTo
5209
5281
  })
@@ -5421,13 +5493,13 @@ var Resistor = class extends NormalComponent {
5421
5493
  doInitialCreateTracesFromProps() {
5422
5494
  if (this.props.pullupFor && this.props.pullupTo) {
5423
5495
  this.add(
5424
- new Trace({
5496
+ new Trace2({
5425
5497
  from: `${this.getSubcircuitSelector()} > port.1`,
5426
5498
  to: this.props.pullupFor
5427
5499
  })
5428
5500
  );
5429
5501
  this.add(
5430
- new Trace({
5502
+ new Trace2({
5431
5503
  from: `${this.getSubcircuitSelector()} > port.2`,
5432
5504
  to: this.props.pullupTo
5433
5505
  })
@@ -6493,7 +6565,7 @@ export {
6493
6565
  SilkscreenText,
6494
6566
  SmtPad,
6495
6567
  Subcircuit,
6496
- Trace,
6568
+ Trace2 as Trace,
6497
6569
  TraceHint,
6498
6570
  Transistor,
6499
6571
  Via,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.256",
4
+ "version": "0.0.258",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -27,8 +27,9 @@
27
27
  "@types/react": "^19.0.1",
28
28
  "@types/react-reconciler": "^0.28.8",
29
29
  "bun-match-svg": "0.0.8",
30
- "circuit-to-svg": "^0.0.97",
30
+ "circuit-to-svg": "^0.0.99",
31
31
  "debug": "^4.3.6",
32
+ "graphics-debug": "^0.0.4",
32
33
  "howfat": "^0.3.8",
33
34
  "looks-same": "^9.0.1",
34
35
  "pkg-pr-new": "^0.0.37",
@@ -41,9 +42,9 @@
41
42
  "dependencies": {
42
43
  "@lume/kiwi": "^0.4.3",
43
44
  "@tscircuit/footprinter": "^0.0.97",
44
- "@tscircuit/infgrid-ijump-astar": "^0.0.26",
45
+ "@tscircuit/infgrid-ijump-astar": "^0.0.33",
45
46
  "@tscircuit/math-utils": "^0.0.5",
46
- "@tscircuit/props": "^0.0.128",
47
+ "@tscircuit/props": "^0.0.129",
47
48
  "@tscircuit/schematic-autolayout": "^0.0.6",
48
49
  "@tscircuit/soup-util": "^0.0.41",
49
50
  "circuit-json": "^0.0.128",
@@ -53,7 +54,7 @@
53
54
  "performance-now": "^2.1.0",
54
55
  "react": "^18.3.1",
55
56
  "react-reconciler": "^0.29.2",
56
- "schematic-symbols": "^0.0.111",
57
+ "schematic-symbols": "^0.0.113",
57
58
  "transformation-matrix": "^2.16.1",
58
59
  "zod": "^3.23.8"
59
60
  }