@tscircuit/core 0.0.873 → 0.0.875

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
@@ -660,6 +660,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
660
660
  x: string | number;
661
661
  y: string | number;
662
662
  }>, z.ZodString]>, "many">>;
663
+ pcbStraightLine: z.ZodOptional<z.ZodBoolean>;
663
664
  schDisplayLabel: z.ZodOptional<z.ZodString>;
664
665
  schStroke: z.ZodOptional<z.ZodString>;
665
666
  highlightColor: z.ZodOptional<z.ZodString>;
@@ -695,6 +696,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
695
696
  x: number;
696
697
  y: number;
697
698
  })[] | undefined;
699
+ pcbStraightLine?: boolean | undefined;
698
700
  schDisplayLabel?: string | undefined;
699
701
  schStroke?: string | undefined;
700
702
  }, {
@@ -724,6 +726,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
724
726
  x: string | number;
725
727
  y: string | number;
726
728
  })[] | undefined;
729
+ pcbStraightLine?: boolean | undefined;
727
730
  schDisplayLabel?: string | undefined;
728
731
  schStroke?: string | undefined;
729
732
  }>, z.ZodObject<{
@@ -780,6 +783,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
780
783
  x: string | number;
781
784
  y: string | number;
782
785
  }>, z.ZodString]>, "many">>;
786
+ pcbStraightLine: z.ZodOptional<z.ZodBoolean>;
783
787
  schDisplayLabel: z.ZodOptional<z.ZodString>;
784
788
  schStroke: z.ZodOptional<z.ZodString>;
785
789
  highlightColor: z.ZodOptional<z.ZodString>;
@@ -823,6 +827,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
823
827
  x: number;
824
828
  y: number;
825
829
  })[] | undefined;
830
+ pcbStraightLine?: boolean | undefined;
826
831
  schDisplayLabel?: string | undefined;
827
832
  schStroke?: string | undefined;
828
833
  }, {
@@ -855,6 +860,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
855
860
  x: string | number;
856
861
  y: string | number;
857
862
  })[] | undefined;
863
+ pcbStraightLine?: boolean | undefined;
858
864
  schDisplayLabel?: string | undefined;
859
865
  schStroke?: string | undefined;
860
866
  }>]>;
@@ -2712,7 +2718,6 @@ declare class Board extends Group<typeof boardProps> {
2712
2718
  doInitialSourceRender(): void;
2713
2719
  doInitialPcbComponentRender(): void;
2714
2720
  removePcbComponentRender(): void;
2715
- _computePcbGlobalTransformBeforeLayout(): Matrix;
2716
2721
  doInitialPcbDesignRuleChecks(): void;
2717
2722
  updatePcbDesignRuleChecks(): void;
2718
2723
  _emitRenderLifecycleEvent(phase: RenderPhase, startOrEnd: "start" | "end"): void;
package/dist/index.js CHANGED
@@ -6457,6 +6457,9 @@ function Trace_doInitialPcbTraceRender(trace) {
6457
6457
  if (props.pcbPath && props.pcbPath.length > 0) {
6458
6458
  return;
6459
6459
  }
6460
+ if (props.pcbStraightLine) {
6461
+ return;
6462
+ }
6460
6463
  if (!subcircuit._shouldUseTraceByTraceRouting()) {
6461
6464
  return;
6462
6465
  }
@@ -6718,7 +6721,9 @@ function Trace_doInitialPcbManualTraceRender(trace) {
6718
6721
  const { db } = trace.root;
6719
6722
  const { _parsedProps: props } = trace;
6720
6723
  const subcircuit = trace.getSubcircuit();
6721
- if (!props.pcbPath) return;
6724
+ const hasPcbPath = props.pcbPath !== void 0;
6725
+ const wantsStraightLine = Boolean(props.pcbStraightLine);
6726
+ if (!hasPcbPath && !wantsStraightLine) return;
6722
6727
  const { allPortsFound, ports, portsWithSelectors } = trace._findConnectedPorts();
6723
6728
  if (!allPortsFound) return;
6724
6729
  const portsWithoutMatchedPcbPrimitive = [];
@@ -6738,6 +6743,51 @@ function Trace_doInitialPcbManualTraceRender(trace) {
6738
6743
  });
6739
6744
  return;
6740
6745
  }
6746
+ const width = trace._getExplicitTraceThickness() ?? trace.getSubcircuit()._parsedProps.minTraceWidth ?? 0.16;
6747
+ if (wantsStraightLine && !hasPcbPath) {
6748
+ if (!ports || ports.length < 2) {
6749
+ trace.renderError("pcbStraightLine requires exactly two connected ports");
6750
+ return;
6751
+ }
6752
+ const [startPort, endPort] = ports;
6753
+ const startLayers = startPort.getAvailablePcbLayers();
6754
+ const endLayers = endPort.getAvailablePcbLayers();
6755
+ const sharedLayer = startLayers.find((layer3) => endLayers.includes(layer3));
6756
+ const layer2 = sharedLayer ?? startLayers[0] ?? endLayers[0] ?? "top";
6757
+ const startPos = startPort._getGlobalPcbPositionAfterLayout();
6758
+ const endPos = endPort._getGlobalPcbPositionAfterLayout();
6759
+ const route2 = [
6760
+ {
6761
+ route_type: "wire",
6762
+ x: startPos.x,
6763
+ y: startPos.y,
6764
+ width,
6765
+ layer: layer2,
6766
+ start_pcb_port_id: startPort.pcb_port_id
6767
+ },
6768
+ {
6769
+ route_type: "wire",
6770
+ x: endPos.x,
6771
+ y: endPos.y,
6772
+ width,
6773
+ layer: layer2,
6774
+ end_pcb_port_id: endPort.pcb_port_id
6775
+ }
6776
+ ];
6777
+ const traceLength2 = getTraceLength(route2);
6778
+ const pcb_trace2 = db.pcb_trace.insert({
6779
+ route: route2,
6780
+ source_trace_id: trace.source_trace_id,
6781
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
6782
+ pcb_group_id: trace.getGroup()?.pcb_group_id ?? void 0,
6783
+ trace_length: traceLength2
6784
+ });
6785
+ trace._portsRoutedOnPcb = ports;
6786
+ trace.pcb_trace_id = pcb_trace2.pcb_trace_id;
6787
+ trace._insertErrorIfTraceIsOutsideBoard(route2, ports);
6788
+ return;
6789
+ }
6790
+ if (!props.pcbPath) return;
6741
6791
  let anchorPort;
6742
6792
  if (props.pcbPathRelativeTo) {
6743
6793
  anchorPort = portsWithSelectors.find(
@@ -6752,7 +6802,6 @@ function Trace_doInitialPcbManualTraceRender(trace) {
6752
6802
  }
6753
6803
  const otherPort = ports.find((p) => p !== anchorPort) ?? ports[1];
6754
6804
  const layer = anchorPort.getAvailablePcbLayers()[0] || "top";
6755
- const width = trace._getExplicitTraceThickness() ?? trace.getSubcircuit()._parsedProps.minTraceWidth ?? 0.16;
6756
6805
  const anchorPos = anchorPort._getGlobalPcbPositionAfterLayout();
6757
6806
  const otherPos = otherPort._getGlobalPcbPositionAfterLayout();
6758
6807
  const route = [];
@@ -9030,7 +9079,7 @@ var getBoardCenterFromAnchor = ({
9030
9079
 
9031
9080
  // lib/components/normal-components/Board.ts
9032
9081
  import { boardProps } from "@tscircuit/props";
9033
- import { identity as identity4 } from "transformation-matrix";
9082
+ import "transformation-matrix";
9034
9083
 
9035
9084
  // lib/components/primitive-components/Group/Group.ts
9036
9085
  import {
@@ -14271,9 +14320,6 @@ var Board = class extends Group6 {
14271
14320
  db.pcb_board.delete(this.pcb_board_id);
14272
14321
  this.pcb_board_id = null;
14273
14322
  }
14274
- _computePcbGlobalTransformBeforeLayout() {
14275
- return identity4();
14276
- }
14277
14323
  doInitialPcbDesignRuleChecks() {
14278
14324
  if (this.root?.pcbDisabled) return;
14279
14325
  if (this.getInheritedProperty("routingDisabled")) return;
@@ -14654,6 +14700,7 @@ var Panel = class extends Group6 {
14654
14700
  if (!pcbBoard || !pcbBoard.width || !pcbBoard.height) return;
14655
14701
  const xPos = colXOffsets[col] + colWidths[col] / 2;
14656
14702
  const yPos = rowYOffsets[row] + rowHeights[row] / 2;
14703
+ board._repositionOnPcb({ x: xPos, y: yPos });
14657
14704
  db.pcb_board.update(board.pcb_board_id, {
14658
14705
  center: { x: xPos, y: yPos }
14659
14706
  });
@@ -18528,7 +18575,7 @@ import { identity as identity6 } from "transformation-matrix";
18528
18575
  var package_default = {
18529
18576
  name: "@tscircuit/core",
18530
18577
  type: "module",
18531
- version: "0.0.872",
18578
+ version: "0.0.874",
18532
18579
  types: "dist/index.d.ts",
18533
18580
  main: "dist/index.js",
18534
18581
  module: "dist/index.js",
@@ -18572,7 +18619,7 @@ var package_default = {
18572
18619
  "@tscircuit/math-utils": "^0.0.29",
18573
18620
  "@tscircuit/miniflex": "^0.0.4",
18574
18621
  "@tscircuit/ngspice-spice-engine": "^0.0.3",
18575
- "@tscircuit/props": "^0.0.409",
18622
+ "@tscircuit/props": "^0.0.410",
18576
18623
  "@tscircuit/schematic-autolayout": "^0.0.6",
18577
18624
  "@tscircuit/schematic-match-adapt": "^0.0.16",
18578
18625
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.873",
4
+ "version": "0.0.875",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "@tscircuit/math-utils": "^0.0.29",
46
46
  "@tscircuit/miniflex": "^0.0.4",
47
47
  "@tscircuit/ngspice-spice-engine": "^0.0.3",
48
- "@tscircuit/props": "^0.0.409",
48
+ "@tscircuit/props": "^0.0.410",
49
49
  "@tscircuit/schematic-autolayout": "^0.0.6",
50
50
  "@tscircuit/schematic-match-adapt": "^0.0.16",
51
51
  "@tscircuit/schematic-trace-solver": "^v0.0.45",