@tscircuit/core 0.0.259 → 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 +24 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5034,12 +5034,13 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5034
5034
  const isFirstPortSchematicBox = firstPort.parent?.config.shouldRenderAsSchematicBox;
5035
5035
  const pinFullName = isFirstPortSchematicBox ? `${firstPort?.parent?.props.name}_${firstPort?.props.name}` : `${secondPort?.parent?.props.name}_${secondPort?.props.name}`;
5036
5036
  const netLabelText = this.props.schDisplayLabel ?? pinFullName;
5037
- if (existingFromNetLabel && existingFromNetLabel.text !== netLabelText || existingToNetLabel && existingToNetLabel?.text !== netLabelText) {
5038
- throw new Error(
5039
- `Cannot create net label "${netLabelText}" for port ${existingFromNetLabel ? fromPortName : toPortName} because it already has a net label with text "${existingFromNetLabel ? existingFromNetLabel.text : existingToNetLabel?.text}".`
5040
- );
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}`;
5041
5042
  }
5042
- if (netLabelText?.toLocaleLowerCase().includes("gnd") || netLabelText?.toLocaleLowerCase().includes("ground")) {
5043
+ if (!existingFromNetLabel && !existingToNetLabel && (netLabelText?.toLocaleLowerCase().includes("gnd") || netLabelText?.toLocaleLowerCase().includes("ground"))) {
5043
5044
  createDownwardNetLabelGroundSymbol(
5044
5045
  {
5045
5046
  fromPort,
@@ -5053,20 +5054,24 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5053
5054
  );
5054
5055
  return;
5055
5056
  }
5056
- db.schematic_net_label.insert({
5057
- text: this.props.schDisplayLabel ?? pinFullName,
5058
- source_net_id: toPort.source_port_id,
5059
- anchor_position: toAnchorPos,
5060
- center: toAnchorPos,
5061
- anchor_side: getEnteringEdgeFromDirection(toPort.facingDirection) ?? "bottom"
5062
- });
5063
- db.schematic_net_label.insert({
5064
- text: this.props.schDisplayLabel ?? pinFullName,
5065
- source_net_id: fromPort.source_port_id,
5066
- anchor_position: fromAnchorPos,
5067
- center: fromAnchorPos,
5068
- anchor_side: getEnteringEdgeFromDirection(fromPort.facingDirection) ?? "bottom"
5069
- });
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
+ }
5070
5075
  }
5071
5076
  _isSymbolToChipConnection() {
5072
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.259",
4
+ "version": "0.0.260",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",