@tscircuit/core 0.0.258 → 0.0.260

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 +29 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4187,6 +4187,11 @@ var createSchematicTraceCrossingSegments = ({
4187
4187
  differentNetOnly: true
4188
4188
  }).flatMap((t) => t.edges);
4189
4189
  for (let i = 0; i < edges.length; i++) {
4190
+ if (i > 2e3) {
4191
+ throw new Error(
4192
+ "Over 2000 iterations spent inside createSchematicTraceCrossingSegments, you have triggered an infinite loop, please report this!"
4193
+ );
4194
+ }
4190
4195
  const edge = edges[i];
4191
4196
  const edgeOrientation = Math.abs(edge.from.x - edge.to.x) < 0.01 ? "vertical" : "horizontal";
4192
4197
  const otherEdgesIntersections = [];
@@ -5029,12 +5034,13 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5029
5034
  const isFirstPortSchematicBox = firstPort.parent?.config.shouldRenderAsSchematicBox;
5030
5035
  const pinFullName = isFirstPortSchematicBox ? `${firstPort?.parent?.props.name}_${firstPort?.props.name}` : `${secondPort?.parent?.props.name}_${secondPort?.props.name}`;
5031
5036
  const netLabelText = this.props.schDisplayLabel ?? pinFullName;
5032
- if (existingFromNetLabel && existingFromNetLabel.text !== netLabelText || existingToNetLabel && existingToNetLabel?.text !== netLabelText) {
5033
- throw new Error(
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}".`
5035
- );
5037
+ if (existingFromNetLabel && existingFromNetLabel.text !== netLabelText) {
5038
+ existingFromNetLabel.text = `${netLabelText} / ${existingFromNetLabel.text}`;
5039
+ }
5040
+ if (existingToNetLabel && existingToNetLabel?.text !== netLabelText) {
5041
+ existingToNetLabel.text = `${netLabelText} / ${existingToNetLabel.text}`;
5036
5042
  }
5037
- if (netLabelText?.toLocaleLowerCase().includes("gnd") || netLabelText?.toLocaleLowerCase().includes("ground")) {
5043
+ if (!existingFromNetLabel && !existingToNetLabel && (netLabelText?.toLocaleLowerCase().includes("gnd") || netLabelText?.toLocaleLowerCase().includes("ground"))) {
5038
5044
  createDownwardNetLabelGroundSymbol(
5039
5045
  {
5040
5046
  fromPort,
@@ -5048,20 +5054,24 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5048
5054
  );
5049
5055
  return;
5050
5056
  }
5051
- db.schematic_net_label.insert({
5052
- text: this.props.schDisplayLabel ?? pinFullName,
5053
- source_net_id: toPort.source_port_id,
5054
- anchor_position: toAnchorPos,
5055
- center: toAnchorPos,
5056
- anchor_side: getEnteringEdgeFromDirection(toPort.facingDirection) ?? "bottom"
5057
- });
5058
- db.schematic_net_label.insert({
5059
- text: this.props.schDisplayLabel ?? pinFullName,
5060
- source_net_id: fromPort.source_port_id,
5061
- anchor_position: fromAnchorPos,
5062
- center: fromAnchorPos,
5063
- anchor_side: getEnteringEdgeFromDirection(fromPort.facingDirection) ?? "bottom"
5064
- });
5057
+ if (!existingToNetLabel) {
5058
+ db.schematic_net_label.insert({
5059
+ text: this.props.schDisplayLabel ?? pinFullName,
5060
+ source_net_id: toPort.source_port_id,
5061
+ anchor_position: toAnchorPos,
5062
+ center: toAnchorPos,
5063
+ anchor_side: getEnteringEdgeFromDirection(toPort.facingDirection) ?? "bottom"
5064
+ });
5065
+ }
5066
+ if (!existingFromNetLabel) {
5067
+ db.schematic_net_label.insert({
5068
+ text: this.props.schDisplayLabel ?? pinFullName,
5069
+ source_net_id: fromPort.source_port_id,
5070
+ anchor_position: fromAnchorPos,
5071
+ center: fromAnchorPos,
5072
+ anchor_side: getEnteringEdgeFromDirection(fromPort.facingDirection) ?? "bottom"
5073
+ });
5074
+ }
5065
5075
  }
5066
5076
  _isSymbolToChipConnection() {
5067
5077
  const { allPortsFound, ports } = this._findConnectedPorts();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.258",
4
+ "version": "0.0.260",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",