circuit-to-svg 0.0.198 → 0.0.200

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.js CHANGED
@@ -680,8 +680,8 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
680
680
  const transformedFontSize = font_size * Math.abs(transform.a);
681
681
  let textAnchor = "middle";
682
682
  let dominantBaseline = "central";
683
- let dx = 0;
684
- let dy = 0;
683
+ const dx = 0;
684
+ const dy = 0;
685
685
  switch (anchor_alignment) {
686
686
  case "top_left":
687
687
  textAnchor = "start";
@@ -723,7 +723,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
723
723
  }
724
724
  const textTransform = compose2(
725
725
  translate2(transformedX, transformedY),
726
- rotate2(ccw_rotation * Math.PI / 180),
726
+ rotate2(-ccw_rotation * Math.PI / 180),
727
727
  ...layer === "bottom" ? [scale(-1, 1)] : []
728
728
  );
729
729
  const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
@@ -1743,7 +1743,7 @@ function getSoftwareUsedString(circuitJson) {
1743
1743
  var package_default = {
1744
1744
  name: "circuit-to-svg",
1745
1745
  type: "module",
1746
- version: "0.0.197",
1746
+ version: "0.0.199",
1747
1747
  description: "Convert Circuit JSON to SVG",
1748
1748
  main: "dist/index.js",
1749
1749
  files: [
@@ -3073,9 +3073,8 @@ function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY)
3073
3073
 
3074
3074
  // lib/pinout/convert-circuit-json-to-pinout-svg.ts
3075
3075
  import { stringify as stringify3 } from "svgson";
3076
- import { su as su6 } from "@tscircuit/circuit-json-util";
3076
+ import "@tscircuit/circuit-json-util";
3077
3077
  import {
3078
- applyToPoint as applyToPoint34,
3079
3078
  compose as compose7,
3080
3079
  scale as scale4,
3081
3080
  translate as translate7
@@ -3754,15 +3753,11 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
3754
3753
  ];
3755
3754
  }
3756
3755
 
3757
- // lib/pinout/convert-circuit-json-to-pinout-svg.ts
3758
- var OBJECT_ORDER3 = [
3759
- "pcb_board",
3760
- "pcb_smtpad",
3761
- "pcb_hole",
3762
- "pcb_plated_hole",
3763
- "pcb_component",
3764
- "pcb_port"
3765
- ];
3756
+ // lib/pinout/calculate-label-positions.ts
3757
+ import { applyToPoint as applyToPoint34 } from "transformation-matrix";
3758
+
3759
+ // lib/pinout/pinout-utils.ts
3760
+ import { su as su6 } from "@tscircuit/circuit-json-util";
3766
3761
  function getPortLabelInfo(port, soup) {
3767
3762
  const source_port = su6(soup).source_port.get(port.source_port_id);
3768
3763
  if (!source_port) return null;
@@ -3798,6 +3793,173 @@ function getClosestEdge(port_pos_real, board_bounds) {
3798
3793
  }
3799
3794
  return closest_edge;
3800
3795
  }
3796
+
3797
+ // lib/pinout/calculate-label-positions.ts
3798
+ var STAGGER_OFFSET_MIN = 20;
3799
+ var STAGGER_OFFSET_PER_PIN = 2;
3800
+ var STAGGER_OFFSET_STEP = 15;
3801
+ var ALIGNED_OFFSET_MARGIN = 10;
3802
+ var FONT_SIZE = 11;
3803
+ var BG_PADDING = 5;
3804
+ var LABEL_RECT_HEIGHT = FONT_SIZE + 2 * BG_PADDING;
3805
+ var LABEL_MARGIN = 5;
3806
+ function calculateVerticalEdgeLabels(edge, ports, {
3807
+ transform,
3808
+ soup,
3809
+ board_bounds,
3810
+ svgHeight
3811
+ }, label_positions) {
3812
+ const edge_ports = ports.map((port) => ({
3813
+ port,
3814
+ y: applyToPoint34(transform, [port.x, port.y])[1],
3815
+ label_info: getPortLabelInfo(port, soup)
3816
+ })).filter((p) => p.label_info).sort((a, b) => a.y - b.y);
3817
+ if (edge_ports.length === 0) return;
3818
+ const board_edge_x = applyToPoint34(transform, [
3819
+ edge === "left" ? board_bounds.minX : board_bounds.maxX,
3820
+ 0
3821
+ ])[0];
3822
+ const num_labels = edge_ports.length;
3823
+ const middle_index = (num_labels - 1) / 2;
3824
+ const stagger_offset_base = STAGGER_OFFSET_MIN + num_labels * STAGGER_OFFSET_PER_PIN;
3825
+ const max_stagger_offset = stagger_offset_base + middle_index * STAGGER_OFFSET_STEP;
3826
+ const aligned_label_offset = max_stagger_offset + ALIGNED_OFFSET_MARGIN;
3827
+ const total_labels_height = num_labels * LABEL_RECT_HEIGHT + Math.max(0, num_labels - 1) * LABEL_MARGIN;
3828
+ let current_y = (svgHeight - total_labels_height) / 2 + LABEL_RECT_HEIGHT / 2;
3829
+ edge_ports.forEach(({ port, label_info }, i) => {
3830
+ const dist_from_middle = Math.abs(i - middle_index);
3831
+ const stagger_rank = middle_index - dist_from_middle;
3832
+ const stagger_offset = stagger_offset_base + stagger_rank * STAGGER_OFFSET_STEP;
3833
+ const sign = edge === "left" ? -1 : 1;
3834
+ const elbow_end = {
3835
+ x: board_edge_x + sign * stagger_offset,
3836
+ y: current_y
3837
+ };
3838
+ const label_pos = {
3839
+ x: board_edge_x + sign * aligned_label_offset,
3840
+ y: current_y
3841
+ };
3842
+ label_positions.set(port.pcb_port_id, {
3843
+ text: label_info.text,
3844
+ aliases: label_info.aliases,
3845
+ elbow_end,
3846
+ label_pos,
3847
+ edge
3848
+ });
3849
+ current_y += LABEL_RECT_HEIGHT + LABEL_MARGIN;
3850
+ });
3851
+ }
3852
+ function calculateHorizontalEdgeLabels(edge, ports, {
3853
+ transform,
3854
+ soup,
3855
+ board_bounds,
3856
+ svgWidth
3857
+ }, label_positions) {
3858
+ const edge_ports = ports.map((port) => ({
3859
+ port,
3860
+ x: applyToPoint34(transform, [port.x, port.y])[0],
3861
+ label_info: getPortLabelInfo(port, soup)
3862
+ })).filter((p) => p.label_info).sort((a, b) => a.x - b.x);
3863
+ if (edge_ports.length === 0) return;
3864
+ const board_edge_y = applyToPoint34(transform, [
3865
+ 0,
3866
+ edge === "top" ? board_bounds.maxY : board_bounds.minY
3867
+ ])[1];
3868
+ const labels_with_widths = edge_ports.map((p) => {
3869
+ const label = [p.label_info.text, ...p.label_info.aliases].join(" | ");
3870
+ const textWidth = label.length * FONT_SIZE * 0.6;
3871
+ const rectWidth = textWidth + 2 * BG_PADDING;
3872
+ return { ...p, rectWidth };
3873
+ });
3874
+ const num_labels = labels_with_widths.length;
3875
+ const middle_index = (num_labels - 1) / 2;
3876
+ const stagger_offset_base = STAGGER_OFFSET_MIN + num_labels * STAGGER_OFFSET_PER_PIN;
3877
+ const max_stagger_offset = stagger_offset_base + middle_index * STAGGER_OFFSET_STEP;
3878
+ const aligned_label_offset = max_stagger_offset + ALIGNED_OFFSET_MARGIN;
3879
+ const total_labels_width = labels_with_widths.reduce((sum, l) => sum + l.rectWidth, 0) + Math.max(0, num_labels - 1) * LABEL_MARGIN;
3880
+ let current_x = (svgWidth - total_labels_width) / 2;
3881
+ labels_with_widths.forEach(({ port, label_info, rectWidth }, i) => {
3882
+ const dist_from_middle = Math.abs(i - middle_index);
3883
+ const stagger_rank = middle_index - dist_from_middle;
3884
+ const stagger_offset = stagger_offset_base + stagger_rank * STAGGER_OFFSET_STEP;
3885
+ const sign = edge === "top" ? -1 : 1;
3886
+ const label_center_x = current_x + rectWidth / 2;
3887
+ const elbow_end = {
3888
+ x: label_center_x,
3889
+ y: board_edge_y + sign * stagger_offset
3890
+ };
3891
+ const label_pos = {
3892
+ x: label_center_x,
3893
+ y: board_edge_y + sign * aligned_label_offset
3894
+ };
3895
+ label_positions.set(port.pcb_port_id, {
3896
+ text: label_info.text,
3897
+ aliases: label_info.aliases,
3898
+ elbow_end,
3899
+ label_pos,
3900
+ edge
3901
+ });
3902
+ current_x += rectWidth + LABEL_MARGIN;
3903
+ });
3904
+ }
3905
+ var calculateLabelPositions = ({
3906
+ ports_by_edge,
3907
+ transform,
3908
+ soup,
3909
+ board_bounds,
3910
+ svgWidth,
3911
+ svgHeight
3912
+ }) => {
3913
+ const label_positions = /* @__PURE__ */ new Map();
3914
+ const shared_params = { transform, soup, board_bounds };
3915
+ calculateVerticalEdgeLabels(
3916
+ "left",
3917
+ ports_by_edge.left,
3918
+ {
3919
+ ...shared_params,
3920
+ svgHeight
3921
+ },
3922
+ label_positions
3923
+ );
3924
+ calculateVerticalEdgeLabels(
3925
+ "right",
3926
+ ports_by_edge.right,
3927
+ {
3928
+ ...shared_params,
3929
+ svgHeight
3930
+ },
3931
+ label_positions
3932
+ );
3933
+ calculateHorizontalEdgeLabels(
3934
+ "top",
3935
+ ports_by_edge.top,
3936
+ {
3937
+ ...shared_params,
3938
+ svgWidth
3939
+ },
3940
+ label_positions
3941
+ );
3942
+ calculateHorizontalEdgeLabels(
3943
+ "bottom",
3944
+ ports_by_edge.bottom,
3945
+ {
3946
+ ...shared_params,
3947
+ svgWidth
3948
+ },
3949
+ label_positions
3950
+ );
3951
+ return label_positions;
3952
+ };
3953
+
3954
+ // lib/pinout/convert-circuit-json-to-pinout-svg.ts
3955
+ var OBJECT_ORDER3 = [
3956
+ "pcb_board",
3957
+ "pcb_smtpad",
3958
+ "pcb_hole",
3959
+ "pcb_plated_hole",
3960
+ "pcb_component",
3961
+ "pcb_port"
3962
+ ];
3801
3963
  function convertCircuitJsonToPinoutSvg(soup, options) {
3802
3964
  let minX = Number.POSITIVE_INFINITY;
3803
3965
  let minY = Number.POSITIVE_INFINITY;
@@ -3854,162 +4016,14 @@ function convertCircuitJsonToPinoutSvg(soup, options) {
3854
4016
  const edge = getClosestEdge({ x: port.x, y: port.y }, board_bounds);
3855
4017
  ports_by_edge[edge].push(port);
3856
4018
  }
3857
- const label_positions = /* @__PURE__ */ new Map();
3858
- const V_SPACING = 20;
3859
- const STAGGER_OFFSET_MIN = 20;
3860
- const STAGGER_OFFSET_PER_PIN = 2;
3861
- const STAGGER_OFFSET_STEP = 15;
3862
- const ALIGNED_OFFSET_MARGIN = 10;
3863
- const FONT_SIZE = 11;
3864
- const BG_PADDING = 5;
3865
- const LABEL_RECT_HEIGHT = FONT_SIZE + 2 * BG_PADDING;
3866
- const LABEL_MARGIN = 5;
3867
- const left_ports = ports_by_edge.left.map((port) => ({
3868
- port,
3869
- y: applyToPoint34(transform, [port.x, port.y])[1],
3870
- label_info: getPortLabelInfo(port, soup)
3871
- })).filter((p) => p.label_info).sort((a, b) => a.y - b.y);
3872
- if (left_ports.length > 0) {
3873
- const board_left_x = applyToPoint34(transform, [board_bounds.minX, 0])[0];
3874
- const num_labels = left_ports.length;
3875
- const middle_index = (num_labels - 1) / 2;
3876
- const stagger_offset_base = STAGGER_OFFSET_MIN + num_labels * STAGGER_OFFSET_PER_PIN;
3877
- const max_stagger_offset = stagger_offset_base + middle_index * STAGGER_OFFSET_STEP;
3878
- const aligned_label_offset = max_stagger_offset + ALIGNED_OFFSET_MARGIN;
3879
- const total_labels_height = num_labels * LABEL_RECT_HEIGHT + Math.max(0, num_labels - 1) * LABEL_MARGIN;
3880
- let current_y = (svgHeight - total_labels_height) / 2 + LABEL_RECT_HEIGHT / 2;
3881
- left_ports.forEach(({ port, label_info }, i) => {
3882
- const dist_from_middle = Math.abs(i - middle_index);
3883
- const stagger_rank = middle_index - dist_from_middle;
3884
- const stagger_offset = stagger_offset_base + stagger_rank * STAGGER_OFFSET_STEP;
3885
- const elbow_end = { x: board_left_x - stagger_offset, y: current_y };
3886
- const label_pos = { x: board_left_x - aligned_label_offset, y: current_y };
3887
- label_positions.set(port.pcb_port_id, {
3888
- text: label_info.text,
3889
- aliases: label_info.aliases,
3890
- elbow_end,
3891
- label_pos,
3892
- edge: "left"
3893
- });
3894
- current_y += LABEL_RECT_HEIGHT + LABEL_MARGIN;
3895
- });
3896
- }
3897
- const right_ports = ports_by_edge.right.map((port) => ({
3898
- port,
3899
- y: applyToPoint34(transform, [port.x, port.y])[1],
3900
- label_info: getPortLabelInfo(port, soup)
3901
- })).filter((p) => p.label_info).sort((a, b) => a.y - b.y);
3902
- if (right_ports.length > 0) {
3903
- const board_right_x = applyToPoint34(transform, [board_bounds.maxX, 0])[0];
3904
- const num_labels = right_ports.length;
3905
- const middle_index = (num_labels - 1) / 2;
3906
- const stagger_offset_base = STAGGER_OFFSET_MIN + num_labels * STAGGER_OFFSET_PER_PIN;
3907
- const max_stagger_offset = stagger_offset_base + middle_index * STAGGER_OFFSET_STEP;
3908
- const aligned_label_offset = max_stagger_offset + ALIGNED_OFFSET_MARGIN;
3909
- const total_labels_height = num_labels * LABEL_RECT_HEIGHT + Math.max(0, num_labels - 1) * LABEL_MARGIN;
3910
- let current_y = (svgHeight - total_labels_height) / 2 + LABEL_RECT_HEIGHT / 2;
3911
- right_ports.forEach(({ port, label_info }, i) => {
3912
- const dist_from_middle = Math.abs(i - middle_index);
3913
- const stagger_rank = middle_index - dist_from_middle;
3914
- const stagger_offset = stagger_offset_base + stagger_rank * STAGGER_OFFSET_STEP;
3915
- const elbow_end = { x: board_right_x + stagger_offset, y: current_y };
3916
- const label_pos = {
3917
- x: board_right_x + aligned_label_offset,
3918
- y: current_y
3919
- };
3920
- label_positions.set(port.pcb_port_id, {
3921
- text: label_info.text,
3922
- aliases: label_info.aliases,
3923
- elbow_end,
3924
- label_pos,
3925
- edge: "right"
3926
- });
3927
- current_y += LABEL_RECT_HEIGHT + LABEL_MARGIN;
3928
- });
3929
- }
3930
- const top_ports = ports_by_edge.top.map((port) => ({
3931
- port,
3932
- x: applyToPoint34(transform, [port.x, port.y])[0],
3933
- label_info: getPortLabelInfo(port, soup)
3934
- })).filter((p) => p.label_info).sort((a, b) => a.x - b.x);
3935
- if (top_ports.length > 0) {
3936
- const board_top_y = applyToPoint34(transform, [0, board_bounds.maxY])[1];
3937
- const labels_with_widths = top_ports.map((p) => {
3938
- const label = [p.label_info.text, ...p.label_info.aliases].join(" | ");
3939
- const textWidth = label.length * FONT_SIZE * 0.6;
3940
- const rectWidth = textWidth + 2 * BG_PADDING;
3941
- return { ...p, rectWidth };
3942
- });
3943
- const num_labels = labels_with_widths.length;
3944
- const middle_index = (num_labels - 1) / 2;
3945
- const stagger_offset_base = STAGGER_OFFSET_MIN + num_labels * STAGGER_OFFSET_PER_PIN;
3946
- const max_stagger_offset = stagger_offset_base + middle_index * STAGGER_OFFSET_STEP;
3947
- const aligned_label_offset = max_stagger_offset + ALIGNED_OFFSET_MARGIN;
3948
- const total_labels_width = labels_with_widths.reduce((sum, l) => sum + l.rectWidth, 0) + Math.max(0, num_labels - 1) * LABEL_MARGIN;
3949
- let current_x = (svgWidth - total_labels_width) / 2;
3950
- labels_with_widths.forEach(({ port, label_info, rectWidth }, i) => {
3951
- const dist_from_middle = Math.abs(i - middle_index);
3952
- const stagger_rank = middle_index - dist_from_middle;
3953
- const stagger_offset = stagger_offset_base + stagger_rank * STAGGER_OFFSET_STEP;
3954
- const label_center_x = current_x + rectWidth / 2;
3955
- const elbow_end = { x: label_center_x, y: board_top_y - stagger_offset };
3956
- const label_pos = {
3957
- x: label_center_x,
3958
- y: board_top_y - aligned_label_offset
3959
- };
3960
- label_positions.set(port.pcb_port_id, {
3961
- text: label_info.text,
3962
- aliases: label_info.aliases,
3963
- elbow_end,
3964
- label_pos,
3965
- edge: "top"
3966
- });
3967
- current_x += rectWidth + LABEL_MARGIN;
3968
- });
3969
- }
3970
- const bottom_ports = ports_by_edge.bottom.map((port) => ({
3971
- port,
3972
- x: applyToPoint34(transform, [port.x, port.y])[0],
3973
- label_info: getPortLabelInfo(port, soup)
3974
- })).filter((p) => p.label_info).sort((a, b) => a.x - b.x);
3975
- if (bottom_ports.length > 0) {
3976
- const board_bottom_y = applyToPoint34(transform, [0, board_bounds.minY])[1];
3977
- const labels_with_widths = bottom_ports.map((p) => {
3978
- const label = [p.label_info.text, ...p.label_info.aliases].join(" | ");
3979
- const textWidth = label.length * FONT_SIZE * 0.6;
3980
- const rectWidth = textWidth + 2 * BG_PADDING;
3981
- return { ...p, rectWidth };
3982
- });
3983
- const num_labels = labels_with_widths.length;
3984
- const middle_index = (num_labels - 1) / 2;
3985
- const stagger_offset_base = STAGGER_OFFSET_MIN + num_labels * STAGGER_OFFSET_PER_PIN;
3986
- const max_stagger_offset = stagger_offset_base + middle_index * STAGGER_OFFSET_STEP;
3987
- const aligned_label_offset = max_stagger_offset + ALIGNED_OFFSET_MARGIN;
3988
- const total_labels_width = labels_with_widths.reduce((sum, l) => sum + l.rectWidth, 0) + Math.max(0, num_labels - 1) * LABEL_MARGIN;
3989
- let current_x = (svgWidth - total_labels_width) / 2;
3990
- labels_with_widths.forEach(({ port, label_info, rectWidth }, i) => {
3991
- const dist_from_middle = Math.abs(i - middle_index);
3992
- const stagger_rank = middle_index - dist_from_middle;
3993
- const stagger_offset = stagger_offset_base + stagger_rank * STAGGER_OFFSET_STEP;
3994
- const label_center_x = current_x + rectWidth / 2;
3995
- const elbow_end = {
3996
- x: label_center_x,
3997
- y: board_bottom_y + stagger_offset
3998
- };
3999
- const label_pos = {
4000
- x: label_center_x,
4001
- y: board_bottom_y + aligned_label_offset
4002
- };
4003
- label_positions.set(port.pcb_port_id, {
4004
- text: label_info.text,
4005
- aliases: label_info.aliases,
4006
- elbow_end,
4007
- label_pos,
4008
- edge: "bottom"
4009
- });
4010
- current_x += rectWidth + LABEL_MARGIN;
4011
- });
4012
- }
4019
+ const label_positions = calculateLabelPositions({
4020
+ ports_by_edge,
4021
+ transform,
4022
+ soup,
4023
+ board_bounds,
4024
+ svgWidth,
4025
+ svgHeight
4026
+ });
4013
4027
  const ctx = {
4014
4028
  transform,
4015
4029
  soup,
@@ -4324,14 +4338,14 @@ import {
4324
4338
  } from "transformation-matrix";
4325
4339
 
4326
4340
  // lib/sch/draw-schematic-grid.ts
4327
- import { applyToPoint as applyToPoint35 } from "transformation-matrix";
4341
+ import { applyToPoint as applyToPoint36 } from "transformation-matrix";
4328
4342
  function drawSchematicGrid(params) {
4329
4343
  const { minX, minY, maxX, maxY } = params.bounds;
4330
4344
  const cellSize = params.cellSize ?? 1;
4331
4345
  const labelCells = params.labelCells ?? false;
4332
4346
  const gridLines = [];
4333
4347
  const transformPoint = (x, y) => {
4334
- const [transformedX, transformedY] = applyToPoint35(params.transform, [x, y]);
4348
+ const [transformedX, transformedY] = applyToPoint36(params.transform, [x, y]);
4335
4349
  return { x: transformedX, y: transformedY };
4336
4350
  };
4337
4351
  for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
@@ -4412,15 +4426,15 @@ function drawSchematicGrid(params) {
4412
4426
  }
4413
4427
 
4414
4428
  // lib/sch/draw-schematic-labeled-points.ts
4415
- import { applyToPoint as applyToPoint36 } from "transformation-matrix";
4429
+ import { applyToPoint as applyToPoint37 } from "transformation-matrix";
4416
4430
  function drawSchematicLabeledPoints(params) {
4417
4431
  const { points, transform } = params;
4418
4432
  const labeledPointsGroup = [];
4419
4433
  for (const point of points) {
4420
- const [x1, y1] = applyToPoint36(transform, [point.x - 0.1, point.y - 0.1]);
4421
- const [x2, y2] = applyToPoint36(transform, [point.x + 0.1, point.y + 0.1]);
4422
- const [x3, y3] = applyToPoint36(transform, [point.x - 0.1, point.y + 0.1]);
4423
- const [x4, y4] = applyToPoint36(transform, [point.x + 0.1, point.y - 0.1]);
4434
+ const [x1, y1] = applyToPoint37(transform, [point.x - 0.1, point.y - 0.1]);
4435
+ const [x2, y2] = applyToPoint37(transform, [point.x + 0.1, point.y + 0.1]);
4436
+ const [x3, y3] = applyToPoint37(transform, [point.x - 0.1, point.y + 0.1]);
4437
+ const [x4, y4] = applyToPoint37(transform, [point.x + 0.1, point.y - 0.1]);
4424
4438
  labeledPointsGroup.push({
4425
4439
  name: "path",
4426
4440
  type: "element",
@@ -4431,7 +4445,7 @@ function drawSchematicLabeledPoints(params) {
4431
4445
  "stroke-opacity": "0.7"
4432
4446
  }
4433
4447
  });
4434
- const [labelX, labelY] = applyToPoint36(transform, [
4448
+ const [labelX, labelY] = applyToPoint37(transform, [
4435
4449
  point.x + 0.15,
4436
4450
  point.y - 0.15
4437
4451
  ]);
@@ -5521,11 +5535,11 @@ function getSchematicBoundsFromCircuitJson(soup, padding = 0.5) {
5521
5535
  }
5522
5536
 
5523
5537
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-component-with-symbol.ts
5524
- import { su as su7 } from "@tscircuit/circuit-json-util";
5538
+ import { su as su8 } from "@tscircuit/circuit-json-util";
5525
5539
  import { symbols } from "schematic-symbols";
5526
5540
  import "svgson";
5527
5541
  import {
5528
- applyToPoint as applyToPoint38,
5542
+ applyToPoint as applyToPoint39,
5529
5543
  compose as compose9
5530
5544
  } from "transformation-matrix";
5531
5545
 
@@ -5609,13 +5623,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
5609
5623
  }
5610
5624
 
5611
5625
  // lib/sch/svg-object-fns/create-svg-error-text.ts
5612
- import { applyToPoint as applyToPoint37 } from "transformation-matrix";
5626
+ import { applyToPoint as applyToPoint38 } from "transformation-matrix";
5613
5627
  var createSvgSchErrorText = ({
5614
5628
  text,
5615
5629
  realCenter,
5616
5630
  realToScreenTransform
5617
5631
  }) => {
5618
- const screenCenter = applyToPoint37(realToScreenTransform, realCenter);
5632
+ const screenCenter = applyToPoint38(realToScreenTransform, realCenter);
5619
5633
  return {
5620
5634
  type: "element",
5621
5635
  name: "text",
@@ -5682,10 +5696,10 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
5682
5696
  })
5683
5697
  ];
5684
5698
  }
5685
- const schPorts = su7(circuitJson).schematic_port.list({
5699
+ const schPorts = su8(circuitJson).schematic_port.list({
5686
5700
  schematic_component_id: schComponent.schematic_component_id
5687
5701
  });
5688
- const srcComponent = su7(circuitJson).source_component.get(
5702
+ const srcComponent = su8(circuitJson).source_component.get(
5689
5703
  schComponent.source_component_id
5690
5704
  );
5691
5705
  const schPortsWithSymbolPorts = matchSchPortsToSymbolPorts({
@@ -5724,11 +5738,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
5724
5738
  minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
5725
5739
  maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
5726
5740
  };
5727
- const [screenMinX, screenMinY] = applyToPoint38(
5741
+ const [screenMinX, screenMinY] = applyToPoint39(
5728
5742
  compose9(realToScreenTransform, transformFromSymbolToReal),
5729
5743
  [bounds.minX, bounds.minY]
5730
5744
  );
5731
- const [screenMaxX, screenMaxY] = applyToPoint38(
5745
+ const [screenMaxX, screenMaxY] = applyToPoint39(
5732
5746
  compose9(realToScreenTransform, transformFromSymbolToReal),
5733
5747
  [bounds.maxX, bounds.maxY]
5734
5748
  );
@@ -5757,7 +5771,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
5757
5771
  name: "path",
5758
5772
  attributes: {
5759
5773
  d: points.map((p, i) => {
5760
- const [x, y] = applyToPoint38(
5774
+ const [x, y] = applyToPoint39(
5761
5775
  compose9(realToScreenTransform, transformFromSymbolToReal),
5762
5776
  [p.x, p.y]
5763
5777
  );
@@ -5773,7 +5787,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
5773
5787
  });
5774
5788
  }
5775
5789
  for (const text of texts) {
5776
- const screenTextPos = applyToPoint38(
5790
+ const screenTextPos = applyToPoint39(
5777
5791
  compose9(realToScreenTransform, transformFromSymbolToReal),
5778
5792
  text
5779
5793
  );
@@ -5825,7 +5839,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
5825
5839
  });
5826
5840
  }
5827
5841
  for (const box of boxes) {
5828
- const screenBoxPos = applyToPoint38(
5842
+ const screenBoxPos = applyToPoint39(
5829
5843
  compose9(realToScreenTransform, transformFromSymbolToReal),
5830
5844
  box
5831
5845
  );
@@ -5849,7 +5863,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
5849
5863
  }
5850
5864
  for (const port of symbol.ports) {
5851
5865
  if (connectedSymbolPorts.has(port)) continue;
5852
- const screenPortPos = applyToPoint38(
5866
+ const screenPortPos = applyToPoint39(
5853
5867
  compose9(realToScreenTransform, transformFromSymbolToReal),
5854
5868
  port
5855
5869
  );
@@ -5869,7 +5883,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
5869
5883
  });
5870
5884
  }
5871
5885
  for (const circle of circles) {
5872
- const screenCirclePos = applyToPoint38(
5886
+ const screenCirclePos = applyToPoint39(
5873
5887
  compose9(realToScreenTransform, transformFromSymbolToReal),
5874
5888
  circle
5875
5889
  );
@@ -5893,18 +5907,18 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
5893
5907
  };
5894
5908
 
5895
5909
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-component-with-box.ts
5896
- import { su as su10 } from "@tscircuit/circuit-json-util";
5910
+ import { su as su11 } from "@tscircuit/circuit-json-util";
5897
5911
  import "schematic-symbols";
5898
5912
  import "svgson";
5899
- import { applyToPoint as applyToPoint44 } from "transformation-matrix";
5913
+ import { applyToPoint as applyToPoint45 } from "transformation-matrix";
5900
5914
 
5901
5915
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
5902
5916
  import "transformation-matrix";
5903
5917
  import "@tscircuit/circuit-json-util";
5904
5918
 
5905
5919
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
5906
- import { applyToPoint as applyToPoint39 } from "transformation-matrix";
5907
- import { su as su8 } from "@tscircuit/circuit-json-util";
5920
+ import { applyToPoint as applyToPoint40 } from "transformation-matrix";
5921
+ import { su as su9 } from "@tscircuit/circuit-json-util";
5908
5922
  var PIN_CIRCLE_RADIUS_MM = 0.02;
5909
5923
  var createArrow = (tip, angle, size, color, strokeWidth) => {
5910
5924
  const arrowAngle = Math.PI / 6;
@@ -5936,7 +5950,7 @@ var createSvgObjectsForSchPortBoxLine = ({
5936
5950
  circuitJson
5937
5951
  }) => {
5938
5952
  const svgObjects = [];
5939
- const srcPort = su8(circuitJson).source_port.get(schPort.source_port_id);
5953
+ const srcPort = su9(circuitJson).source_port.get(schPort.source_port_id);
5940
5954
  const realEdgePos = {
5941
5955
  x: schPort.center.x,
5942
5956
  y: schPort.center.y
@@ -5956,8 +5970,8 @@ var createSvgObjectsForSchPortBoxLine = ({
5956
5970
  realEdgePos.y += realPinLineLength;
5957
5971
  break;
5958
5972
  }
5959
- const screenSchPortPos = applyToPoint39(transform, schPort.center);
5960
- const screenRealEdgePos = applyToPoint39(transform, realEdgePos);
5973
+ const screenSchPortPos = applyToPoint40(transform, schPort.center);
5974
+ const screenRealEdgePos = applyToPoint40(transform, realEdgePos);
5961
5975
  const realLineEnd = { ...schPort.center };
5962
5976
  switch (schPort.side_of_component) {
5963
5977
  case "left":
@@ -5973,7 +5987,7 @@ var createSvgObjectsForSchPortBoxLine = ({
5973
5987
  realLineEnd.y += PIN_CIRCLE_RADIUS_MM;
5974
5988
  break;
5975
5989
  }
5976
- const screenLineEnd = applyToPoint39(transform, realLineEnd);
5990
+ const screenLineEnd = applyToPoint40(transform, realLineEnd);
5977
5991
  svgObjects.push({
5978
5992
  name: "line",
5979
5993
  type: "element",
@@ -6095,7 +6109,7 @@ var createSvgObjectsForSchPortBoxLine = ({
6095
6109
  };
6096
6110
 
6097
6111
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
6098
- import { applyToPoint as applyToPoint40 } from "transformation-matrix";
6112
+ import { applyToPoint as applyToPoint41 } from "transformation-matrix";
6099
6113
  var createSvgObjectsForSchPortPinNumberText = (params) => {
6100
6114
  const svgObjects = [];
6101
6115
  const { schPort, schComponent, transform, circuitJson } = params;
@@ -6113,7 +6127,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
6113
6127
  } else {
6114
6128
  realPinNumberPos.y += 0.02;
6115
6129
  }
6116
- const screenPinNumberTextPos = applyToPoint40(transform, realPinNumberPos);
6130
+ const screenPinNumberTextPos = applyToPoint41(transform, realPinNumberPos);
6117
6131
  svgObjects.push({
6118
6132
  name: "text",
6119
6133
  type: "element",
@@ -6143,7 +6157,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
6143
6157
  };
6144
6158
 
6145
6159
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
6146
- import { applyToPoint as applyToPoint41 } from "transformation-matrix";
6160
+ import { applyToPoint as applyToPoint42 } from "transformation-matrix";
6147
6161
  var LABEL_DIST_FROM_EDGE_MM = 0.1;
6148
6162
  var createSvgObjectsForSchPortPinLabel = (params) => {
6149
6163
  const svgObjects = [];
@@ -6157,7 +6171,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
6157
6171
  const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
6158
6172
  realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
6159
6173
  realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
6160
- const screenPinNumberTextPos = applyToPoint41(transform, realPinNumberPos);
6174
+ const screenPinNumberTextPos = applyToPoint42(transform, realPinNumberPos);
6161
6175
  const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
6162
6176
  if (!label) return [];
6163
6177
  const isNegated = label.startsWith("N_");
@@ -6205,13 +6219,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
6205
6219
  };
6206
6220
 
6207
6221
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
6208
- import { applyToPoint as applyToPoint43 } from "transformation-matrix";
6222
+ import { applyToPoint as applyToPoint44 } from "transformation-matrix";
6209
6223
  var createSvgSchText = ({
6210
6224
  elm,
6211
6225
  transform,
6212
6226
  colorMap: colorMap2
6213
6227
  }) => {
6214
- const center = applyToPoint43(transform, elm.position);
6228
+ const center = applyToPoint44(transform, elm.position);
6215
6229
  const textAnchorMap = {
6216
6230
  center: "middle",
6217
6231
  center_right: "end",
@@ -6295,11 +6309,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
6295
6309
  colorMap: colorMap2
6296
6310
  }) => {
6297
6311
  const svgObjects = [];
6298
- const componentScreenTopLeft = applyToPoint44(transform, {
6312
+ const componentScreenTopLeft = applyToPoint45(transform, {
6299
6313
  x: schComponent.center.x - schComponent.size.width / 2,
6300
6314
  y: schComponent.center.y + schComponent.size.height / 2
6301
6315
  });
6302
- const componentScreenBottomRight = applyToPoint44(transform, {
6316
+ const componentScreenBottomRight = applyToPoint45(transform, {
6303
6317
  x: schComponent.center.x + schComponent.size.width / 2,
6304
6318
  y: schComponent.center.y - schComponent.size.height / 2
6305
6319
  });
@@ -6335,7 +6349,7 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
6335
6349
  },
6336
6350
  children: []
6337
6351
  });
6338
- const schTexts = su10(circuitJson).schematic_text.list();
6352
+ const schTexts = su11(circuitJson).schematic_text.list();
6339
6353
  for (const schText of schTexts) {
6340
6354
  if (schText.schematic_component_id === schComponent.schematic_component_id) {
6341
6355
  svgObjects.push(
@@ -6347,7 +6361,7 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
6347
6361
  );
6348
6362
  }
6349
6363
  }
6350
- const schematicPorts = su10(circuitJson).schematic_port.list({
6364
+ const schematicPorts = su11(circuitJson).schematic_port.list({
6351
6365
  schematic_component_id: schComponent.schematic_component_id
6352
6366
  });
6353
6367
  for (const schPort of schematicPorts) {
@@ -6385,13 +6399,13 @@ function createSvgObjectsFromSchematicComponent(params) {
6385
6399
  }
6386
6400
 
6387
6401
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
6388
- import { applyToPoint as applyToPoint45 } from "transformation-matrix";
6402
+ import { applyToPoint as applyToPoint46 } from "transformation-matrix";
6389
6403
  function createSvgObjectsFromSchVoltageProbe({
6390
6404
  probe,
6391
6405
  transform,
6392
6406
  colorMap: colorMap2
6393
6407
  }) {
6394
- const [screenX, screenY] = applyToPoint45(transform, [
6408
+ const [screenX, screenY] = applyToPoint46(transform, [
6395
6409
  probe.position.x,
6396
6410
  probe.position.y
6397
6411
  ]);
@@ -6451,17 +6465,17 @@ function createSvgObjectsFromSchVoltageProbe({
6451
6465
  }
6452
6466
 
6453
6467
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
6454
- import { applyToPoint as applyToPoint46 } from "transformation-matrix";
6468
+ import { applyToPoint as applyToPoint47 } from "transformation-matrix";
6455
6469
  function createSvgObjectsFromSchDebugObject({
6456
6470
  debugObject,
6457
6471
  transform
6458
6472
  }) {
6459
6473
  if (debugObject.shape === "rect") {
6460
- let [screenLeft, screenTop] = applyToPoint46(transform, [
6474
+ let [screenLeft, screenTop] = applyToPoint47(transform, [
6461
6475
  debugObject.center.x - debugObject.size.width / 2,
6462
6476
  debugObject.center.y - debugObject.size.height / 2
6463
6477
  ]);
6464
- let [screenRight, screenBottom] = applyToPoint46(transform, [
6478
+ let [screenRight, screenBottom] = applyToPoint47(transform, [
6465
6479
  debugObject.center.x + debugObject.size.width / 2,
6466
6480
  debugObject.center.y + debugObject.size.height / 2
6467
6481
  ]);
@@ -6471,7 +6485,7 @@ function createSvgObjectsFromSchDebugObject({
6471
6485
  ];
6472
6486
  const width = Math.abs(screenRight - screenLeft);
6473
6487
  const height = Math.abs(screenBottom - screenTop);
6474
- const [screenCenterX, screenCenterY] = applyToPoint46(transform, [
6488
+ const [screenCenterX, screenCenterY] = applyToPoint47(transform, [
6475
6489
  debugObject.center.x,
6476
6490
  debugObject.center.y
6477
6491
  ]);
@@ -6517,11 +6531,11 @@ function createSvgObjectsFromSchDebugObject({
6517
6531
  ];
6518
6532
  }
6519
6533
  if (debugObject.shape === "line") {
6520
- const [screenStartX, screenStartY] = applyToPoint46(transform, [
6534
+ const [screenStartX, screenStartY] = applyToPoint47(transform, [
6521
6535
  debugObject.start.x,
6522
6536
  debugObject.start.y
6523
6537
  ]);
6524
- const [screenEndX, screenEndY] = applyToPoint46(transform, [
6538
+ const [screenEndX, screenEndY] = applyToPoint47(transform, [
6525
6539
  debugObject.end.x,
6526
6540
  debugObject.end.y
6527
6541
  ]);
@@ -6571,7 +6585,7 @@ function createSvgObjectsFromSchDebugObject({
6571
6585
  }
6572
6586
 
6573
6587
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
6574
- import { applyToPoint as applyToPoint47 } from "transformation-matrix";
6588
+ import { applyToPoint as applyToPoint48 } from "transformation-matrix";
6575
6589
  function createSchematicTrace({
6576
6590
  trace,
6577
6591
  transform,
@@ -6585,11 +6599,11 @@ function createSchematicTrace({
6585
6599
  for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
6586
6600
  const edge = edges[edgeIndex];
6587
6601
  if (edge.is_crossing) continue;
6588
- const [screenFromX, screenFromY] = applyToPoint47(transform, [
6602
+ const [screenFromX, screenFromY] = applyToPoint48(transform, [
6589
6603
  edge.from.x,
6590
6604
  edge.from.y
6591
6605
  ]);
6592
- const [screenToX, screenToY] = applyToPoint47(transform, [
6606
+ const [screenToX, screenToY] = applyToPoint48(transform, [
6593
6607
  edge.to.x,
6594
6608
  edge.to.y
6595
6609
  ]);
@@ -6633,11 +6647,11 @@ function createSchematicTrace({
6633
6647
  }
6634
6648
  for (const edge of edges) {
6635
6649
  if (!edge.is_crossing) continue;
6636
- const [screenFromX, screenFromY] = applyToPoint47(transform, [
6650
+ const [screenFromX, screenFromY] = applyToPoint48(transform, [
6637
6651
  edge.from.x,
6638
6652
  edge.from.y
6639
6653
  ]);
6640
- const [screenToX, screenToY] = applyToPoint47(transform, [
6654
+ const [screenToX, screenToY] = applyToPoint48(transform, [
6641
6655
  edge.to.x,
6642
6656
  edge.to.y
6643
6657
  ]);
@@ -6681,7 +6695,7 @@ function createSchematicTrace({
6681
6695
  }
6682
6696
  if (trace.junctions) {
6683
6697
  for (const junction of trace.junctions) {
6684
- const [screenX, screenY] = applyToPoint47(transform, [
6698
+ const [screenX, screenY] = applyToPoint48(transform, [
6685
6699
  junction.x,
6686
6700
  junction.y
6687
6701
  ]);
@@ -6736,7 +6750,7 @@ function createSchematicTrace({
6736
6750
 
6737
6751
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
6738
6752
  import {
6739
- applyToPoint as applyToPoint49,
6753
+ applyToPoint as applyToPoint50,
6740
6754
  compose as compose11,
6741
6755
  rotate as rotate6,
6742
6756
  scale as scale7,
@@ -6745,7 +6759,7 @@ import {
6745
6759
 
6746
6760
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
6747
6761
  import {
6748
- applyToPoint as applyToPoint48,
6762
+ applyToPoint as applyToPoint49,
6749
6763
  compose as compose10,
6750
6764
  rotate as rotate5,
6751
6765
  scale as scale6,
@@ -6820,7 +6834,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
6820
6834
  x: symbolBounds.minX,
6821
6835
  y: (symbolBounds.minY + symbolBounds.maxY) / 2
6822
6836
  };
6823
- const rotatedSymbolEnd = applyToPoint48(rotationMatrix, symbolEndPoint);
6837
+ const rotatedSymbolEnd = applyToPoint49(rotationMatrix, symbolEndPoint);
6824
6838
  const symbolToRealTransform = compose10(
6825
6839
  translate10(
6826
6840
  realAnchorPosition.x - rotatedSymbolEnd.x,
@@ -6830,11 +6844,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
6830
6844
  scale6(1)
6831
6845
  // Use full symbol size
6832
6846
  );
6833
- const [screenMinX, screenMinY] = applyToPoint48(
6847
+ const [screenMinX, screenMinY] = applyToPoint49(
6834
6848
  compose10(realToScreenTransform, symbolToRealTransform),
6835
6849
  [bounds.minX, bounds.minY]
6836
6850
  );
6837
- const [screenMaxX, screenMaxY] = applyToPoint48(
6851
+ const [screenMaxX, screenMaxY] = applyToPoint49(
6838
6852
  compose10(realToScreenTransform, symbolToRealTransform),
6839
6853
  [bounds.maxX, bounds.maxY]
6840
6854
  );
@@ -6858,7 +6872,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
6858
6872
  });
6859
6873
  for (const path of symbolPaths) {
6860
6874
  const symbolPath = path.points.map((p, i) => {
6861
- const [x, y] = applyToPoint48(
6875
+ const [x, y] = applyToPoint49(
6862
6876
  compose10(realToScreenTransform, symbolToRealTransform),
6863
6877
  [p.x, p.y]
6864
6878
  );
@@ -6879,7 +6893,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
6879
6893
  });
6880
6894
  }
6881
6895
  for (const text of symbolTexts) {
6882
- const screenTextPos = applyToPoint48(
6896
+ const screenTextPos = applyToPoint49(
6883
6897
  compose10(realToScreenTransform, symbolToRealTransform),
6884
6898
  text
6885
6899
  );
@@ -6921,7 +6935,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
6921
6935
  });
6922
6936
  }
6923
6937
  for (const box of symbolBoxes) {
6924
- const screenBoxPos = applyToPoint48(
6938
+ const screenBoxPos = applyToPoint49(
6925
6939
  compose10(realToScreenTransform, symbolToRealTransform),
6926
6940
  box
6927
6941
  );
@@ -6944,7 +6958,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
6944
6958
  });
6945
6959
  }
6946
6960
  for (const circle of symbolCircles) {
6947
- const screenCirclePos = applyToPoint48(
6961
+ const screenCirclePos = applyToPoint49(
6948
6962
  compose10(realToScreenTransform, symbolToRealTransform),
6949
6963
  circle
6950
6964
  );
@@ -6989,14 +7003,14 @@ var createSvgObjectsForSchNetLabel = ({
6989
7003
  const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
6990
7004
  const fontSizeMm = getSchMmFontSize("net_label");
6991
7005
  const textWidthFSR = estimateTextWidth(labelText || "");
6992
- const screenCenter = applyToPoint49(realToScreenTransform, schNetLabel.center);
7006
+ const screenCenter = applyToPoint50(realToScreenTransform, schNetLabel.center);
6993
7007
  const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
6994
7008
  schNetLabel.anchor_side
6995
7009
  );
6996
7010
  const screenTextGrowthVec = { ...realTextGrowthVec };
6997
7011
  screenTextGrowthVec.y *= -1;
6998
7012
  const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
6999
- const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint49(realToScreenTransform, schNetLabel.anchor_position) : {
7013
+ const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint50(realToScreenTransform, schNetLabel.anchor_position) : {
7000
7014
  x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
7001
7015
  y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
7002
7016
  };
@@ -7037,7 +7051,7 @@ var createSvgObjectsForSchNetLabel = ({
7037
7051
  y: -0.6
7038
7052
  }
7039
7053
  ].map(
7040
- (fontRelativePoint) => applyToPoint49(
7054
+ (fontRelativePoint) => applyToPoint50(
7041
7055
  compose11(
7042
7056
  realToScreenTransform,
7043
7057
  translate11(realAnchorPosition.x, realAnchorPosition.y),
@@ -7114,17 +7128,17 @@ var createSvgObjectsForSchNetLabel = ({
7114
7128
  };
7115
7129
 
7116
7130
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
7117
- import { applyToPoint as applyToPoint50 } from "transformation-matrix";
7131
+ import { applyToPoint as applyToPoint51 } from "transformation-matrix";
7118
7132
  var createSvgObjectsFromSchematicBox = ({
7119
7133
  schematicBox,
7120
7134
  transform,
7121
7135
  colorMap: colorMap2
7122
7136
  }) => {
7123
- const topLeft = applyToPoint50(transform, {
7137
+ const topLeft = applyToPoint51(transform, {
7124
7138
  x: schematicBox.x,
7125
7139
  y: schematicBox.y
7126
7140
  });
7127
- const bottomRight = applyToPoint50(transform, {
7141
+ const bottomRight = applyToPoint51(transform, {
7128
7142
  x: schematicBox.x + schematicBox.width,
7129
7143
  y: schematicBox.y + schematicBox.height
7130
7144
  });
@@ -7160,7 +7174,7 @@ var createSvgObjectsFromSchematicBox = ({
7160
7174
  };
7161
7175
 
7162
7176
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
7163
- import { applyToPoint as applyToPoint51 } from "transformation-matrix";
7177
+ import { applyToPoint as applyToPoint52 } from "transformation-matrix";
7164
7178
  var createSvgObjectsFromSchematicTable = ({
7165
7179
  schematicTable,
7166
7180
  transform,
@@ -7193,11 +7207,11 @@ var createSvgObjectsFromSchematicTable = ({
7193
7207
  const svgObjects = [];
7194
7208
  const borderStrokeWidth = border_width * Math.abs(transform.a);
7195
7209
  const gridStrokeWidth = getSchStrokeSize(transform);
7196
- const [screenTopLeftX, screenTopLeftY] = applyToPoint51(transform, [
7210
+ const [screenTopLeftX, screenTopLeftY] = applyToPoint52(transform, [
7197
7211
  topLeftX,
7198
7212
  topLeftY
7199
7213
  ]);
7200
- const [screenBottomRightX, screenBottomRightY] = applyToPoint51(transform, [
7214
+ const [screenBottomRightX, screenBottomRightY] = applyToPoint52(transform, [
7201
7215
  topLeftX + totalWidth,
7202
7216
  topLeftY - totalHeight
7203
7217
  ]);
@@ -7229,8 +7243,8 @@ var createSvgObjectsFromSchematicTable = ({
7229
7243
  (cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
7230
7244
  );
7231
7245
  if (!isMerged) {
7232
- const start = applyToPoint51(transform, { x: currentX, y: segmentStartY });
7233
- const end = applyToPoint51(transform, { x: currentX, y: segmentEndY });
7246
+ const start = applyToPoint52(transform, { x: currentX, y: segmentStartY });
7247
+ const end = applyToPoint52(transform, { x: currentX, y: segmentEndY });
7234
7248
  svgObjects.push({
7235
7249
  name: "line",
7236
7250
  type: "element",
@@ -7259,11 +7273,11 @@ var createSvgObjectsFromSchematicTable = ({
7259
7273
  (cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
7260
7274
  );
7261
7275
  if (!isMerged) {
7262
- const start = applyToPoint51(transform, {
7276
+ const start = applyToPoint52(transform, {
7263
7277
  x: segmentStartX,
7264
7278
  y: currentY
7265
7279
  });
7266
- const end = applyToPoint51(transform, { x: segmentEndX, y: currentY });
7280
+ const end = applyToPoint52(transform, { x: segmentEndX, y: currentY });
7267
7281
  svgObjects.push({
7268
7282
  name: "line",
7269
7283
  type: "element",
@@ -7305,7 +7319,7 @@ var createSvgObjectsFromSchematicTable = ({
7305
7319
  } else if (vertical_align === "bottom") {
7306
7320
  realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
7307
7321
  }
7308
- const screenTextAnchorPos = applyToPoint51(transform, realTextAnchorPos);
7322
+ const screenTextAnchorPos = applyToPoint52(transform, realTextAnchorPos);
7309
7323
  const fontSize = getSchScreenFontSize(
7310
7324
  transform,
7311
7325
  "reference_designator",
@@ -7360,14 +7374,14 @@ var createSvgObjectsFromSchematicTable = ({
7360
7374
  };
7361
7375
 
7362
7376
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
7363
- import { su as su11 } from "@tscircuit/circuit-json-util";
7364
- import { applyToPoint as applyToPoint52 } from "transformation-matrix";
7377
+ import { su as su12 } from "@tscircuit/circuit-json-util";
7378
+ import { applyToPoint as applyToPoint53 } from "transformation-matrix";
7365
7379
  var PIN_CIRCLE_RADIUS_MM2 = 0.02;
7366
7380
  var createSvgObjectsForSchPortHover = ({
7367
7381
  schPort,
7368
7382
  transform
7369
7383
  }) => {
7370
- const screenSchPortPos = applyToPoint52(transform, schPort.center);
7384
+ const screenSchPortPos = applyToPoint53(transform, schPort.center);
7371
7385
  const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
7372
7386
  return [
7373
7387
  {
@@ -7401,7 +7415,7 @@ var createSvgObjectsForSchComponentPortHovers = ({
7401
7415
  transform,
7402
7416
  circuitJson
7403
7417
  }) => {
7404
- const schematicPorts = su11(circuitJson).schematic_port.list({
7418
+ const schematicPorts = su12(circuitJson).schematic_port.list({
7405
7419
  schematic_component_id: component.schematic_component_id
7406
7420
  });
7407
7421
  const svgs = [];
@@ -7412,14 +7426,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
7412
7426
  };
7413
7427
 
7414
7428
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
7415
- import { applyToPoint as applyToPoint53 } from "transformation-matrix";
7429
+ import { applyToPoint as applyToPoint54 } from "transformation-matrix";
7416
7430
  function createSvgObjectsFromSchematicLine({
7417
7431
  schLine,
7418
7432
  transform,
7419
7433
  colorMap: colorMap2
7420
7434
  }) {
7421
- const p1 = applyToPoint53(transform, { x: schLine.x1, y: schLine.y1 });
7422
- const p2 = applyToPoint53(transform, { x: schLine.x2, y: schLine.y2 });
7435
+ const p1 = applyToPoint54(transform, { x: schLine.x1, y: schLine.y1 });
7436
+ const p2 = applyToPoint54(transform, { x: schLine.x2, y: schLine.y2 });
7423
7437
  const strokeWidth = schLine.stroke_width ?? 0.02;
7424
7438
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
7425
7439
  return [
@@ -7448,13 +7462,13 @@ function createSvgObjectsFromSchematicLine({
7448
7462
  }
7449
7463
 
7450
7464
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
7451
- import { applyToPoint as applyToPoint54 } from "transformation-matrix";
7465
+ import { applyToPoint as applyToPoint55 } from "transformation-matrix";
7452
7466
  function createSvgObjectsFromSchematicCircle({
7453
7467
  schCircle,
7454
7468
  transform,
7455
7469
  colorMap: colorMap2
7456
7470
  }) {
7457
- const center = applyToPoint54(transform, schCircle.center);
7471
+ const center = applyToPoint55(transform, schCircle.center);
7458
7472
  const transformedRadius = Math.abs(transform.a) * schCircle.radius;
7459
7473
  const strokeWidth = schCircle.stroke_width ?? 0.02;
7460
7474
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
@@ -7484,13 +7498,13 @@ function createSvgObjectsFromSchematicCircle({
7484
7498
  }
7485
7499
 
7486
7500
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
7487
- import { applyToPoint as applyToPoint55 } from "transformation-matrix";
7501
+ import { applyToPoint as applyToPoint56 } from "transformation-matrix";
7488
7502
  function createSvgObjectsFromSchematicRect({
7489
7503
  schRect,
7490
7504
  transform,
7491
7505
  colorMap: colorMap2
7492
7506
  }) {
7493
- const center = applyToPoint55(transform, schRect.center);
7507
+ const center = applyToPoint56(transform, schRect.center);
7494
7508
  const transformedWidth = Math.abs(transform.a) * schRect.width;
7495
7509
  const transformedHeight = Math.abs(transform.d) * schRect.height;
7496
7510
  const strokeWidth = schRect.stroke_width ?? 0.02;
@@ -7526,13 +7540,13 @@ function createSvgObjectsFromSchematicRect({
7526
7540
  }
7527
7541
 
7528
7542
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
7529
- import { applyToPoint as applyToPoint56 } from "transformation-matrix";
7543
+ import { applyToPoint as applyToPoint57 } from "transformation-matrix";
7530
7544
  function createSvgObjectsFromSchematicArc({
7531
7545
  schArc,
7532
7546
  transform,
7533
7547
  colorMap: colorMap2
7534
7548
  }) {
7535
- const center = applyToPoint56(transform, schArc.center);
7549
+ const center = applyToPoint57(transform, schArc.center);
7536
7550
  const transformedRadius = Math.abs(transform.a) * schArc.radius;
7537
7551
  const strokeWidth = schArc.stroke_width ?? 0.02;
7538
7552
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
@@ -7879,18 +7893,18 @@ var circuitJsonToSchematicSvg = convertCircuitJsonToSchematicSvg;
7879
7893
  // lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
7880
7894
  import { stringify as stringify5 } from "svgson";
7881
7895
  import {
7882
- applyToPoint as applyToPoint59,
7896
+ applyToPoint as applyToPoint60,
7883
7897
  compose as compose14,
7884
7898
  scale as scale9,
7885
7899
  translate as translate14
7886
7900
  } from "transformation-matrix";
7887
7901
 
7888
7902
  // lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
7889
- import { applyToPoint as applyToPoint58 } from "transformation-matrix";
7903
+ import { applyToPoint as applyToPoint59 } from "transformation-matrix";
7890
7904
  function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
7891
7905
  const { transform, layer: layerFilter } = ctx;
7892
7906
  if (layerFilter && solderPaste.layer !== layerFilter) return [];
7893
- const [x, y] = applyToPoint58(transform, [solderPaste.x, solderPaste.y]);
7907
+ const [x, y] = applyToPoint59(transform, [solderPaste.x, solderPaste.y]);
7894
7908
  if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
7895
7909
  const width = solderPaste.width * Math.abs(transform.a);
7896
7910
  const height = solderPaste.height * Math.abs(transform.d);
@@ -8093,8 +8107,8 @@ function createSvgObjects4({ elm, ctx }) {
8093
8107
  }
8094
8108
  }
8095
8109
  function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
8096
- const [x1, y1] = applyToPoint59(transform, [minX, minY]);
8097
- const [x2, y2] = applyToPoint59(transform, [maxX, maxY]);
8110
+ const [x1, y1] = applyToPoint60(transform, [minX, minY]);
8111
+ const [x2, y2] = applyToPoint60(transform, [maxX, maxY]);
8098
8112
  const width = Math.abs(x2 - x1);
8099
8113
  const height = Math.abs(y2 - y1);
8100
8114
  const x = Math.min(x1, x2);