circuit-to-svg 0.0.214 → 0.0.216

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
@@ -1783,7 +1783,7 @@ function getSoftwareUsedString(circuitJson) {
1783
1783
  var package_default = {
1784
1784
  name: "circuit-to-svg",
1785
1785
  type: "module",
1786
- version: "0.0.213",
1786
+ version: "0.0.215",
1787
1787
  description: "Convert Circuit JSON to SVG",
1788
1788
  main: "dist/index.js",
1789
1789
  files: [
@@ -3114,10 +3114,9 @@ function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY)
3114
3114
 
3115
3115
  // lib/pinout/convert-circuit-json-to-pinout-svg.ts
3116
3116
  import { stringify as stringify3 } from "svgson";
3117
- import "@tscircuit/circuit-json-util";
3118
3117
  import {
3119
3118
  compose as compose7,
3120
- scale as scale4,
3119
+ scale as matrixScale,
3121
3120
  translate as translate7
3122
3121
  } from "transformation-matrix";
3123
3122
 
@@ -3784,7 +3783,6 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
3784
3783
  },
3785
3784
  {}
3786
3785
  );
3787
- const line_points = [...elbow_path, label_pos].map((p) => `${p.x},${p.y}`).join(" ");
3788
3786
  const numberMatch = /^pin(\d+)$/i.exec(label);
3789
3787
  const tokensWithStyle = [
3790
3788
  {
@@ -3798,9 +3796,19 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
3798
3796
  color: LABEL_COLOR
3799
3797
  }))
3800
3798
  ];
3801
- const scale10 = Math.abs(ctx.transform.a);
3802
- const LABEL_RECT_HEIGHT_MM2 = 2.2;
3803
- const rectHeight = LABEL_RECT_HEIGHT_MM2 * scale10;
3799
+ const pxPerMm = Math.abs(ctx.transform.a);
3800
+ const labelScale = ctx.styleScale ?? 1;
3801
+ const LABEL_RECT_HEIGHT_MM = 1.6 * labelScale;
3802
+ const rectHeight = LABEL_RECT_HEIGHT_MM * pxPerMm;
3803
+ const STROKE_WIDTH_MM = Math.max(0.08, 0.25 * labelScale);
3804
+ const CORNER_RADIUS_MM = 0.3 * labelScale;
3805
+ const cornerRadius = CORNER_RADIUS_MM * pxPerMm;
3806
+ const strokeWidthPx = STROKE_WIDTH_MM * pxPerMm;
3807
+ const end_point = {
3808
+ x: label_pos.x + (edge === "left" ? -strokeWidthPx / 2 : strokeWidthPx / 2),
3809
+ y: label_pos.y
3810
+ };
3811
+ const line_points = [...elbow_path, end_point].map((p) => `${p.x},${p.y}`).join(" ");
3804
3812
  const fontSize = rectHeight * (11 / 21);
3805
3813
  const bgPadding = (rectHeight - fontSize) / 2;
3806
3814
  const gap = bgPadding;
@@ -3818,7 +3826,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
3818
3826
  attributes: {
3819
3827
  points: line_points,
3820
3828
  stroke: LINE_COLOR,
3821
- "stroke-width": "1.5",
3829
+ "stroke-width": (STROKE_WIDTH_MM * pxPerMm).toString(),
3822
3830
  fill: "none"
3823
3831
  },
3824
3832
  children: [],
@@ -3841,7 +3849,9 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
3841
3849
  text,
3842
3850
  fontSize,
3843
3851
  labelBackground: bg,
3844
- labelColor: color
3852
+ labelColor: color,
3853
+ rx: cornerRadius,
3854
+ ry: cornerRadius
3845
3855
  })
3846
3856
  );
3847
3857
  currentX = rectX - gap;
@@ -3862,7 +3872,9 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
3862
3872
  text,
3863
3873
  fontSize,
3864
3874
  labelBackground: bg,
3865
- labelColor: color
3875
+ labelColor: color,
3876
+ rx: cornerRadius,
3877
+ ry: cornerRadius
3866
3878
  })
3867
3879
  );
3868
3880
  currentX = rectX + rectWidth + gap;
@@ -3884,7 +3896,9 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
3884
3896
  text,
3885
3897
  fontSize,
3886
3898
  labelBackground: bg,
3887
- labelColor: color
3899
+ labelColor: color,
3900
+ rx: cornerRadius,
3901
+ ry: cornerRadius
3888
3902
  })
3889
3903
  );
3890
3904
  currentX = rectX + rectWidth + gap;
@@ -3894,19 +3908,25 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
3894
3908
  }
3895
3909
 
3896
3910
  // lib/pinout/calculate-label-positions.ts
3897
- import "@tscircuit/circuit-json-util";
3898
3911
  import { applyToPoint as applyToPoint34 } from "transformation-matrix";
3899
- var STAGGER_OFFSET_MIN = 20;
3900
- var STAGGER_OFFSET_PER_PIN = 3;
3901
- var STAGGER_OFFSET_STEP = 18;
3902
- var ALIGNED_OFFSET_MARGIN = 10;
3903
- var LABEL_RECT_HEIGHT_MM = 1.6;
3904
- var LABEL_PITCH_MM = 2.54;
3912
+
3913
+ // lib/pinout/constants.ts
3914
+ var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
3915
+ var FONT_HEIGHT_RATIO = 11 / 21;
3916
+ var CHAR_WIDTH_FACTOR = 0.6;
3917
+ var STAGGER_OFFSET_MIN = 0.1;
3918
+ var STAGGER_OFFSET_PER_PIN = 0.1;
3919
+ var STAGGER_OFFSET_STEP = 3;
3920
+ var ALIGNED_OFFSET_MARGIN = 0.1;
3921
+ var GROUP_SEPARATION_MM = 0.8;
3922
+
3923
+ // lib/pinout/calculate-label-positions.ts
3905
3924
  function calculateVerticalEdgeLabels(edge, pinout_labels, {
3906
3925
  transform,
3907
3926
  soup,
3908
3927
  board_bounds,
3909
- svgHeight
3928
+ svgHeight,
3929
+ styleScale
3910
3930
  }, label_positions) {
3911
3931
  const x_coords = pinout_labels.map((l) => l.pcb_port.x);
3912
3932
  const counts = {};
@@ -3979,13 +3999,17 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
3979
3999
  return -1;
3980
4000
  }).filter((i) => i !== -1);
3981
4001
  const geometric_middle_index = (num_labels - 1) / 2;
3982
- const scale10 = Math.abs(transform.a);
3983
- const label_rect_height = LABEL_RECT_HEIGHT_MM * scale10;
3984
- const label_pitch = LABEL_PITCH_MM * scale10;
3985
- const label_margin = Math.max(0, label_pitch - label_rect_height);
3986
- const stagger_offset_base = STAGGER_OFFSET_MIN + num_labels * STAGGER_OFFSET_PER_PIN;
3987
- const max_stagger_offset = stagger_offset_base + geometric_middle_index * STAGGER_OFFSET_STEP;
3988
- const aligned_label_offset = max_stagger_offset + ALIGNED_OFFSET_MARGIN;
4002
+ const pxPerMm = Math.abs(transform.a);
4003
+ const label_rect_height = LABEL_RECT_HEIGHT_BASE_MM * styleScale * pxPerMm;
4004
+ const BASE_GAP_MM = 0.3;
4005
+ const label_margin = Math.max(
4006
+ 0.2 * pxPerMm,
4007
+ BASE_GAP_MM * styleScale * pxPerMm
4008
+ );
4009
+ const group_gap_px = GROUP_SEPARATION_MM * styleScale * pxPerMm;
4010
+ const stagger_offset_base = (STAGGER_OFFSET_MIN + num_labels * STAGGER_OFFSET_PER_PIN) * styleScale * pxPerMm;
4011
+ const max_stagger_offset = stagger_offset_base + geometric_middle_index * (STAGGER_OFFSET_STEP * styleScale * pxPerMm);
4012
+ const aligned_label_offset = max_stagger_offset + ALIGNED_OFFSET_MARGIN * styleScale * pxPerMm;
3989
4013
  const num_other_pins = num_labels - main_group_indices.length;
3990
4014
  const num_pins_to_stack = main_group_indices.length === 0 ? num_labels : num_other_pins;
3991
4015
  const stack_total_height = num_pins_to_stack * label_rect_height + Math.max(0, num_pins_to_stack - 1) * label_margin;
@@ -3999,10 +4023,10 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
3999
4023
  const other_pin_indices = edge_ports.map((_, index) => index).filter((index) => !main_group_indices.includes(index));
4000
4024
  const others_are_above = other_pin_indices[0] < main_group_indices[0];
4001
4025
  if (others_are_above) {
4002
- const stack_bottom_edge = main_group_top_extent - label_margin;
4026
+ const stack_bottom_edge = main_group_top_extent - (label_margin * 2 + group_gap_px);
4003
4027
  current_y = stack_bottom_edge - stack_total_height + label_rect_height / 2;
4004
4028
  } else {
4005
- const stack_top_edge = main_group_bottom_extent + label_margin;
4029
+ const stack_top_edge = main_group_bottom_extent + (label_margin * 2 + group_gap_px);
4006
4030
  current_y = stack_top_edge + label_rect_height / 2;
4007
4031
  }
4008
4032
  } else {
@@ -4029,7 +4053,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
4029
4053
  const dist_from_middle = Math.abs(i - geometric_middle_index);
4030
4054
  stagger_rank = geometric_middle_index - dist_from_middle;
4031
4055
  }
4032
- const stagger_offset = stagger_offset_base + stagger_rank * STAGGER_OFFSET_STEP;
4056
+ const stagger_offset = stagger_offset_base + stagger_rank * (STAGGER_OFFSET_STEP * styleScale * pxPerMm);
4033
4057
  const sign = edge === "left" ? -1 : 1;
4034
4058
  const is_main_group_pin = main_group_indices.includes(i);
4035
4059
  const y_pos = is_all_main_group ? edge_ports[i].y : main_group_indices.length > 0 && is_main_group_pin ? edge_ports[i].y : current_y;
@@ -4060,7 +4084,8 @@ var calculateLabelPositions = ({
4060
4084
  soup,
4061
4085
  board_bounds,
4062
4086
  svgWidth,
4063
- svgHeight
4087
+ svgHeight,
4088
+ styleScale
4064
4089
  }) => {
4065
4090
  const label_positions = /* @__PURE__ */ new Map();
4066
4091
  const shared_params = { transform, soup, board_bounds };
@@ -4069,7 +4094,8 @@ var calculateLabelPositions = ({
4069
4094
  left_labels,
4070
4095
  {
4071
4096
  ...shared_params,
4072
- svgHeight
4097
+ svgHeight,
4098
+ styleScale
4073
4099
  },
4074
4100
  label_positions
4075
4101
  );
@@ -4078,7 +4104,8 @@ var calculateLabelPositions = ({
4078
4104
  right_labels,
4079
4105
  {
4080
4106
  ...shared_params,
4081
- svgHeight
4107
+ svgHeight,
4108
+ styleScale
4082
4109
  },
4083
4110
  label_positions
4084
4111
  );
@@ -4086,9 +4113,9 @@ var calculateLabelPositions = ({
4086
4113
  };
4087
4114
 
4088
4115
  // lib/pinout/pinout-utils.ts
4089
- import { su as su7 } from "@tscircuit/circuit-json-util";
4116
+ import { su as su6 } from "@tscircuit/circuit-json-util";
4090
4117
  function getPortLabelInfo(port, soup) {
4091
- const source_port = su7(soup).source_port.get(port.source_port_id);
4118
+ const source_port = su6(soup).source_port.get(port.source_port_id);
4092
4119
  if (!source_port) return null;
4093
4120
  const eligible_hints = source_port.port_hints?.filter(
4094
4121
  (h) => !/^\d+$/.test(h) && !["left", "right", "top", "bottom"].includes(h)
@@ -4157,23 +4184,9 @@ function convertCircuitJsonToPinoutSvg(soup, options) {
4157
4184
  }
4158
4185
  }
4159
4186
  }
4160
- const padding = 20;
4161
- const circuitWidth = maxX - minX + 2 * padding;
4162
- const circuitHeight = maxY - minY + 2 * padding;
4163
- const svgWidth = options?.width ?? 1200;
4164
- const svgHeight = options?.height ?? 768;
4165
- const scaleX = svgWidth / circuitWidth;
4166
- const scaleY = svgHeight / circuitHeight;
4167
- const scaleFactor = Math.min(scaleX, scaleY);
4168
- const offsetX = (svgWidth - circuitWidth * scaleFactor) / 2;
4169
- const offsetY = (svgHeight - circuitHeight * scaleFactor) / 2;
4170
- const transform = compose7(
4171
- translate7(
4172
- offsetX - minX * scaleFactor + padding * scaleFactor,
4173
- svgHeight - offsetY + minY * scaleFactor - padding * scaleFactor
4174
- ),
4175
- scale4(scaleFactor, -scaleFactor)
4176
- );
4187
+ const paddingMm = 2;
4188
+ let svgWidth = options?.width ?? 1200;
4189
+ let svgHeight = options?.height ?? 768;
4177
4190
  const board_bounds = { minX, minY, maxX, maxY };
4178
4191
  const pinout_ports = soup.filter(
4179
4192
  (elm) => elm.type === "pcb_port" && elm.is_board_pinout
@@ -4214,6 +4227,72 @@ function convertCircuitJsonToPinoutSvg(soup, options) {
4214
4227
  right_labels.push(...bottom_labels);
4215
4228
  }
4216
4229
  }
4230
+ const smtPads = soup.filter((e) => e.type === "pcb_smtpad");
4231
+ const padMinorDimensionsMm = smtPads.map((p) => {
4232
+ if (typeof p.height === "number")
4233
+ return p.height;
4234
+ if (typeof p.radius === "number")
4235
+ return p.radius * 2;
4236
+ return void 0;
4237
+ }).filter((v) => Number.isFinite(v));
4238
+ const averagePadMinorMm = padMinorDimensionsMm.length ? padMinorDimensionsMm.reduce((a, b) => a + b, 0) / padMinorDimensionsMm.length : void 0;
4239
+ const BASELINE_PAD_MINOR_MM = 1;
4240
+ const styleScale = averagePadMinorMm ? Math.max(0.5, Math.min(1, averagePadMinorMm / BASELINE_PAD_MINOR_MM)) : 1;
4241
+ const LABEL_RECT_HEIGHT_MM = LABEL_RECT_HEIGHT_BASE_MM * styleScale;
4242
+ function tokenize(label) {
4243
+ const tokens = [...label.aliases ?? []];
4244
+ if (tokens.length === 0) return tokens;
4245
+ const m = /^pin(\d+)$/i.exec(tokens[0]);
4246
+ if (m) tokens[0] = m[1];
4247
+ return tokens;
4248
+ }
4249
+ function getTotalTokenWidthMm(tokens) {
4250
+ if (tokens.length === 0) return 0;
4251
+ const rectHeightMm = LABEL_RECT_HEIGHT_MM;
4252
+ const fontSizeMm = rectHeightMm * FONT_HEIGHT_RATIO;
4253
+ const bgPaddingMm = (rectHeightMm - fontSizeMm) / 2;
4254
+ const gapMm = bgPaddingMm;
4255
+ const tokenWidthsMm = tokens.map((t) => {
4256
+ const safe = t ?? "";
4257
+ const textWidthMm = safe.length * fontSizeMm * CHAR_WIDTH_FACTOR;
4258
+ return textWidthMm + 2 * bgPaddingMm;
4259
+ });
4260
+ const totalWidthMm = tokenWidthsMm.reduce((a, b) => a + b, 0) + gapMm * Math.max(0, tokens.length - 1);
4261
+ return totalWidthMm;
4262
+ }
4263
+ function getAlignedOffsetMm(count) {
4264
+ if (count <= 0) return 0;
4265
+ const geometric_middle_index = (count - 1) / 2;
4266
+ const stagger_base = (STAGGER_OFFSET_MIN + count * STAGGER_OFFSET_PER_PIN) * styleScale;
4267
+ const max_stagger = stagger_base + geometric_middle_index * (STAGGER_OFFSET_STEP * styleScale);
4268
+ return max_stagger + ALIGNED_OFFSET_MARGIN * styleScale;
4269
+ }
4270
+ const leftMaxLabelWidthMm = Math.max(
4271
+ 0,
4272
+ ...left_labels.map((l) => getTotalTokenWidthMm(tokenize(l)))
4273
+ );
4274
+ const rightMaxLabelWidthMm = Math.max(
4275
+ 0,
4276
+ ...right_labels.map((l) => getTotalTokenWidthMm(tokenize(l)))
4277
+ );
4278
+ const extraLeftMm = getAlignedOffsetMm(left_labels.length) + leftMaxLabelWidthMm;
4279
+ const extraRightMm = getAlignedOffsetMm(right_labels.length) + rightMaxLabelWidthMm;
4280
+ const expandedMinX = minX - extraLeftMm;
4281
+ const expandedMaxX = maxX + extraRightMm;
4282
+ const circuitWidth = expandedMaxX - expandedMinX + 2 * paddingMm;
4283
+ const circuitHeight = maxY - minY + 2 * paddingMm;
4284
+ const pxPerMmX = svgWidth / circuitWidth;
4285
+ const pxPerMmY = svgHeight / circuitHeight;
4286
+ const pxPerMm = Math.min(pxPerMmX, pxPerMmY);
4287
+ const offsetX = (svgWidth - circuitWidth * pxPerMm) / 2;
4288
+ const offsetY = (svgHeight - circuitHeight * pxPerMm) / 2;
4289
+ const transform = compose7(
4290
+ translate7(
4291
+ offsetX - expandedMinX * pxPerMm + paddingMm * pxPerMm,
4292
+ svgHeight - offsetY + minY * pxPerMm - paddingMm * pxPerMm
4293
+ ),
4294
+ matrixScale(pxPerMm, -pxPerMm)
4295
+ );
4217
4296
  const label_positions = calculateLabelPositions({
4218
4297
  left_labels,
4219
4298
  right_labels,
@@ -4221,12 +4300,14 @@ function convertCircuitJsonToPinoutSvg(soup, options) {
4221
4300
  soup,
4222
4301
  board_bounds,
4223
4302
  svgWidth,
4224
- svgHeight
4303
+ svgHeight,
4304
+ styleScale
4225
4305
  });
4226
4306
  const ctx = {
4227
4307
  transform,
4228
4308
  soup,
4229
4309
  board_bounds,
4310
+ styleScale,
4230
4311
  label_positions
4231
4312
  };
4232
4313
  const svgObjects = soup.sort(
@@ -4537,14 +4618,14 @@ import {
4537
4618
  } from "transformation-matrix";
4538
4619
 
4539
4620
  // lib/sch/draw-schematic-grid.ts
4540
- import { applyToPoint as applyToPoint36 } from "transformation-matrix";
4621
+ import { applyToPoint as applyToPoint35 } from "transformation-matrix";
4541
4622
  function drawSchematicGrid(params) {
4542
4623
  const { minX, minY, maxX, maxY } = params.bounds;
4543
4624
  const cellSize = params.cellSize ?? 1;
4544
4625
  const labelCells = params.labelCells ?? false;
4545
4626
  const gridLines = [];
4546
4627
  const transformPoint = (x, y) => {
4547
- const [transformedX, transformedY] = applyToPoint36(params.transform, [x, y]);
4628
+ const [transformedX, transformedY] = applyToPoint35(params.transform, [x, y]);
4548
4629
  return { x: transformedX, y: transformedY };
4549
4630
  };
4550
4631
  for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
@@ -4625,15 +4706,15 @@ function drawSchematicGrid(params) {
4625
4706
  }
4626
4707
 
4627
4708
  // lib/sch/draw-schematic-labeled-points.ts
4628
- import { applyToPoint as applyToPoint37 } from "transformation-matrix";
4709
+ import { applyToPoint as applyToPoint36 } from "transformation-matrix";
4629
4710
  function drawSchematicLabeledPoints(params) {
4630
4711
  const { points, transform } = params;
4631
4712
  const labeledPointsGroup = [];
4632
4713
  for (const point of points) {
4633
- const [x1, y1] = applyToPoint37(transform, [point.x - 0.1, point.y - 0.1]);
4634
- const [x2, y2] = applyToPoint37(transform, [point.x + 0.1, point.y + 0.1]);
4635
- const [x3, y3] = applyToPoint37(transform, [point.x - 0.1, point.y + 0.1]);
4636
- const [x4, y4] = applyToPoint37(transform, [point.x + 0.1, point.y - 0.1]);
4714
+ const [x1, y1] = applyToPoint36(transform, [point.x - 0.1, point.y - 0.1]);
4715
+ const [x2, y2] = applyToPoint36(transform, [point.x + 0.1, point.y + 0.1]);
4716
+ const [x3, y3] = applyToPoint36(transform, [point.x - 0.1, point.y + 0.1]);
4717
+ const [x4, y4] = applyToPoint36(transform, [point.x + 0.1, point.y - 0.1]);
4637
4718
  labeledPointsGroup.push({
4638
4719
  name: "path",
4639
4720
  type: "element",
@@ -4644,7 +4725,7 @@ function drawSchematicLabeledPoints(params) {
4644
4725
  "stroke-opacity": "0.7"
4645
4726
  }
4646
4727
  });
4647
- const [labelX, labelY] = applyToPoint37(transform, [
4728
+ const [labelX, labelY] = applyToPoint36(transform, [
4648
4729
  point.x + 0.15,
4649
4730
  point.y - 0.15
4650
4731
  ]);
@@ -5734,11 +5815,11 @@ function getSchematicBoundsFromCircuitJson(soup, padding = 0.5) {
5734
5815
  }
5735
5816
 
5736
5817
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-component-with-symbol.ts
5737
- import { su as su9 } from "@tscircuit/circuit-json-util";
5818
+ import { su as su7 } from "@tscircuit/circuit-json-util";
5738
5819
  import { symbols } from "schematic-symbols";
5739
5820
  import "svgson";
5740
5821
  import {
5741
- applyToPoint as applyToPoint39,
5822
+ applyToPoint as applyToPoint38,
5742
5823
  compose as compose9
5743
5824
  } from "transformation-matrix";
5744
5825
 
@@ -5809,7 +5890,7 @@ var matchSchPortsToSymbolPorts = ({
5809
5890
  };
5810
5891
 
5811
5892
  // lib/utils/point-pairs-to-matrix.ts
5812
- import { compose as compose8, scale as scale5, translate as translate8 } from "transformation-matrix";
5893
+ import { compose as compose8, scale as scale4, translate as translate8 } from "transformation-matrix";
5813
5894
  function pointPairsToMatrix(a1, a2, b1, b2) {
5814
5895
  const tx = a2.x - a1.x;
5815
5896
  const ty = a2.y - a1.y;
@@ -5817,18 +5898,18 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
5817
5898
  const transformedDistance = Math.sqrt((b2.x - a2.x) ** 2 + (b2.y - a2.y) ** 2);
5818
5899
  const a = transformedDistance / originalDistance;
5819
5900
  const translateMatrix = translate8(tx, ty);
5820
- const scaleMatrix = scale5(a, a);
5901
+ const scaleMatrix = scale4(a, a);
5821
5902
  return compose8(translateMatrix, scaleMatrix);
5822
5903
  }
5823
5904
 
5824
5905
  // lib/sch/svg-object-fns/create-svg-error-text.ts
5825
- import { applyToPoint as applyToPoint38 } from "transformation-matrix";
5906
+ import { applyToPoint as applyToPoint37 } from "transformation-matrix";
5826
5907
  var createSvgSchErrorText = ({
5827
5908
  text,
5828
5909
  realCenter,
5829
5910
  realToScreenTransform
5830
5911
  }) => {
5831
- const screenCenter = applyToPoint38(realToScreenTransform, realCenter);
5912
+ const screenCenter = applyToPoint37(realToScreenTransform, realCenter);
5832
5913
  return {
5833
5914
  type: "element",
5834
5915
  name: "text",
@@ -5895,10 +5976,10 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
5895
5976
  })
5896
5977
  ];
5897
5978
  }
5898
- const schPorts = su9(circuitJson).schematic_port.list({
5979
+ const schPorts = su7(circuitJson).schematic_port.list({
5899
5980
  schematic_component_id: schComponent.schematic_component_id
5900
5981
  });
5901
- const srcComponent = su9(circuitJson).source_component.get(
5982
+ const srcComponent = su7(circuitJson).source_component.get(
5902
5983
  schComponent.source_component_id
5903
5984
  );
5904
5985
  const schPortsWithSymbolPorts = matchSchPortsToSymbolPorts({
@@ -5937,11 +6018,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
5937
6018
  minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
5938
6019
  maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
5939
6020
  };
5940
- const [screenMinX, screenMinY] = applyToPoint39(
6021
+ const [screenMinX, screenMinY] = applyToPoint38(
5941
6022
  compose9(realToScreenTransform, transformFromSymbolToReal),
5942
6023
  [bounds.minX, bounds.minY]
5943
6024
  );
5944
- const [screenMaxX, screenMaxY] = applyToPoint39(
6025
+ const [screenMaxX, screenMaxY] = applyToPoint38(
5945
6026
  compose9(realToScreenTransform, transformFromSymbolToReal),
5946
6027
  [bounds.maxX, bounds.maxY]
5947
6028
  );
@@ -5970,7 +6051,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
5970
6051
  name: "path",
5971
6052
  attributes: {
5972
6053
  d: points.map((p, i) => {
5973
- const [x, y] = applyToPoint39(
6054
+ const [x, y] = applyToPoint38(
5974
6055
  compose9(realToScreenTransform, transformFromSymbolToReal),
5975
6056
  [p.x, p.y]
5976
6057
  );
@@ -5986,7 +6067,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
5986
6067
  });
5987
6068
  }
5988
6069
  for (const text of texts) {
5989
- const screenTextPos = applyToPoint39(
6070
+ const screenTextPos = applyToPoint38(
5990
6071
  compose9(realToScreenTransform, transformFromSymbolToReal),
5991
6072
  text
5992
6073
  );
@@ -6038,7 +6119,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
6038
6119
  });
6039
6120
  }
6040
6121
  for (const box of boxes) {
6041
- const screenBoxPos = applyToPoint39(
6122
+ const screenBoxPos = applyToPoint38(
6042
6123
  compose9(realToScreenTransform, transformFromSymbolToReal),
6043
6124
  box
6044
6125
  );
@@ -6062,7 +6143,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
6062
6143
  }
6063
6144
  for (const port of symbol.ports) {
6064
6145
  if (connectedSymbolPorts.has(port)) continue;
6065
- const screenPortPos = applyToPoint39(
6146
+ const screenPortPos = applyToPoint38(
6066
6147
  compose9(realToScreenTransform, transformFromSymbolToReal),
6067
6148
  port
6068
6149
  );
@@ -6082,7 +6163,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
6082
6163
  });
6083
6164
  }
6084
6165
  for (const circle of circles) {
6085
- const screenCirclePos = applyToPoint39(
6166
+ const screenCirclePos = applyToPoint38(
6086
6167
  compose9(realToScreenTransform, transformFromSymbolToReal),
6087
6168
  circle
6088
6169
  );
@@ -6106,18 +6187,18 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
6106
6187
  };
6107
6188
 
6108
6189
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-component-with-box.ts
6109
- import { su as su12 } from "@tscircuit/circuit-json-util";
6190
+ import { su as su10 } from "@tscircuit/circuit-json-util";
6110
6191
  import "schematic-symbols";
6111
6192
  import "svgson";
6112
- import { applyToPoint as applyToPoint45 } from "transformation-matrix";
6193
+ import { applyToPoint as applyToPoint44 } from "transformation-matrix";
6113
6194
 
6114
6195
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
6115
6196
  import "transformation-matrix";
6116
6197
  import "@tscircuit/circuit-json-util";
6117
6198
 
6118
6199
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
6119
- import { applyToPoint as applyToPoint40 } from "transformation-matrix";
6120
- import { su as su10 } from "@tscircuit/circuit-json-util";
6200
+ import { applyToPoint as applyToPoint39 } from "transformation-matrix";
6201
+ import { su as su8 } from "@tscircuit/circuit-json-util";
6121
6202
  var PIN_CIRCLE_RADIUS_MM = 0.02;
6122
6203
  var createArrow = (tip, angle, size, color, strokeWidth) => {
6123
6204
  const arrowAngle = Math.PI / 6;
@@ -6149,7 +6230,7 @@ var createSvgObjectsForSchPortBoxLine = ({
6149
6230
  circuitJson
6150
6231
  }) => {
6151
6232
  const svgObjects = [];
6152
- const srcPort = su10(circuitJson).source_port.get(schPort.source_port_id);
6233
+ const srcPort = su8(circuitJson).source_port.get(schPort.source_port_id);
6153
6234
  const realEdgePos = {
6154
6235
  x: schPort.center.x,
6155
6236
  y: schPort.center.y
@@ -6169,8 +6250,8 @@ var createSvgObjectsForSchPortBoxLine = ({
6169
6250
  realEdgePos.y += realPinLineLength;
6170
6251
  break;
6171
6252
  }
6172
- const screenSchPortPos = applyToPoint40(transform, schPort.center);
6173
- const screenRealEdgePos = applyToPoint40(transform, realEdgePos);
6253
+ const screenSchPortPos = applyToPoint39(transform, schPort.center);
6254
+ const screenRealEdgePos = applyToPoint39(transform, realEdgePos);
6174
6255
  const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
6175
6256
  const realLineEnd = { ...schPort.center };
6176
6257
  if (!isConnected) {
@@ -6189,7 +6270,7 @@ var createSvgObjectsForSchPortBoxLine = ({
6189
6270
  break;
6190
6271
  }
6191
6272
  }
6192
- const screenLineEnd = applyToPoint40(transform, realLineEnd);
6273
+ const screenLineEnd = applyToPoint39(transform, realLineEnd);
6193
6274
  svgObjects.push({
6194
6275
  name: "line",
6195
6276
  type: "element",
@@ -6310,7 +6391,7 @@ var createSvgObjectsForSchPortBoxLine = ({
6310
6391
  };
6311
6392
 
6312
6393
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
6313
- import { applyToPoint as applyToPoint41 } from "transformation-matrix";
6394
+ import { applyToPoint as applyToPoint40 } from "transformation-matrix";
6314
6395
  var createSvgObjectsForSchPortPinNumberText = (params) => {
6315
6396
  const svgObjects = [];
6316
6397
  const { schPort, schComponent, transform, circuitJson } = params;
@@ -6328,7 +6409,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
6328
6409
  } else {
6329
6410
  realPinNumberPos.y += 0.02;
6330
6411
  }
6331
- const screenPinNumberTextPos = applyToPoint41(transform, realPinNumberPos);
6412
+ const screenPinNumberTextPos = applyToPoint40(transform, realPinNumberPos);
6332
6413
  svgObjects.push({
6333
6414
  name: "text",
6334
6415
  type: "element",
@@ -6358,7 +6439,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
6358
6439
  };
6359
6440
 
6360
6441
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
6361
- import { applyToPoint as applyToPoint42 } from "transformation-matrix";
6442
+ import { applyToPoint as applyToPoint41 } from "transformation-matrix";
6362
6443
  var LABEL_DIST_FROM_EDGE_MM = 0.1;
6363
6444
  var createSvgObjectsForSchPortPinLabel = (params) => {
6364
6445
  const svgObjects = [];
@@ -6372,7 +6453,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
6372
6453
  const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
6373
6454
  realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
6374
6455
  realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
6375
- const screenPinNumberTextPos = applyToPoint42(transform, realPinNumberPos);
6456
+ const screenPinNumberTextPos = applyToPoint41(transform, realPinNumberPos);
6376
6457
  const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
6377
6458
  if (!label) return [];
6378
6459
  const isNegated = label.startsWith("N_");
@@ -6420,13 +6501,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
6420
6501
  };
6421
6502
 
6422
6503
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
6423
- import { applyToPoint as applyToPoint44 } from "transformation-matrix";
6504
+ import { applyToPoint as applyToPoint43 } from "transformation-matrix";
6424
6505
  var createSvgSchText = ({
6425
6506
  elm,
6426
6507
  transform,
6427
6508
  colorMap: colorMap2
6428
6509
  }) => {
6429
- const center = applyToPoint44(transform, elm.position);
6510
+ const center = applyToPoint43(transform, elm.position);
6430
6511
  const textAnchorMap = {
6431
6512
  center: "middle",
6432
6513
  center_right: "end",
@@ -6510,11 +6591,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
6510
6591
  colorMap: colorMap2
6511
6592
  }) => {
6512
6593
  const svgObjects = [];
6513
- const componentScreenTopLeft = applyToPoint45(transform, {
6594
+ const componentScreenTopLeft = applyToPoint44(transform, {
6514
6595
  x: schComponent.center.x - schComponent.size.width / 2,
6515
6596
  y: schComponent.center.y + schComponent.size.height / 2
6516
6597
  });
6517
- const componentScreenBottomRight = applyToPoint45(transform, {
6598
+ const componentScreenBottomRight = applyToPoint44(transform, {
6518
6599
  x: schComponent.center.x + schComponent.size.width / 2,
6519
6600
  y: schComponent.center.y - schComponent.size.height / 2
6520
6601
  });
@@ -6550,7 +6631,7 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
6550
6631
  },
6551
6632
  children: []
6552
6633
  });
6553
- const schTexts = su12(circuitJson).schematic_text.list();
6634
+ const schTexts = su10(circuitJson).schematic_text.list();
6554
6635
  for (const schText of schTexts) {
6555
6636
  if (schText.schematic_component_id === schComponent.schematic_component_id) {
6556
6637
  svgObjects.push(
@@ -6562,7 +6643,7 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
6562
6643
  );
6563
6644
  }
6564
6645
  }
6565
- const schematicPorts = su12(circuitJson).schematic_port.list({
6646
+ const schematicPorts = su10(circuitJson).schematic_port.list({
6566
6647
  schematic_component_id: schComponent.schematic_component_id
6567
6648
  });
6568
6649
  for (const schPort of schematicPorts) {
@@ -6600,13 +6681,13 @@ function createSvgObjectsFromSchematicComponent(params) {
6600
6681
  }
6601
6682
 
6602
6683
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
6603
- import { applyToPoint as applyToPoint46 } from "transformation-matrix";
6684
+ import { applyToPoint as applyToPoint45 } from "transformation-matrix";
6604
6685
  function createSvgObjectsFromSchVoltageProbe({
6605
6686
  probe,
6606
6687
  transform,
6607
6688
  colorMap: colorMap2
6608
6689
  }) {
6609
- const [screenX, screenY] = applyToPoint46(transform, [
6690
+ const [screenX, screenY] = applyToPoint45(transform, [
6610
6691
  probe.position.x,
6611
6692
  probe.position.y
6612
6693
  ]);
@@ -6666,17 +6747,17 @@ function createSvgObjectsFromSchVoltageProbe({
6666
6747
  }
6667
6748
 
6668
6749
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
6669
- import { applyToPoint as applyToPoint47 } from "transformation-matrix";
6750
+ import { applyToPoint as applyToPoint46 } from "transformation-matrix";
6670
6751
  function createSvgObjectsFromSchDebugObject({
6671
6752
  debugObject,
6672
6753
  transform
6673
6754
  }) {
6674
6755
  if (debugObject.shape === "rect") {
6675
- let [screenLeft, screenTop] = applyToPoint47(transform, [
6756
+ let [screenLeft, screenTop] = applyToPoint46(transform, [
6676
6757
  debugObject.center.x - debugObject.size.width / 2,
6677
6758
  debugObject.center.y - debugObject.size.height / 2
6678
6759
  ]);
6679
- let [screenRight, screenBottom] = applyToPoint47(transform, [
6760
+ let [screenRight, screenBottom] = applyToPoint46(transform, [
6680
6761
  debugObject.center.x + debugObject.size.width / 2,
6681
6762
  debugObject.center.y + debugObject.size.height / 2
6682
6763
  ]);
@@ -6686,7 +6767,7 @@ function createSvgObjectsFromSchDebugObject({
6686
6767
  ];
6687
6768
  const width = Math.abs(screenRight - screenLeft);
6688
6769
  const height = Math.abs(screenBottom - screenTop);
6689
- const [screenCenterX, screenCenterY] = applyToPoint47(transform, [
6770
+ const [screenCenterX, screenCenterY] = applyToPoint46(transform, [
6690
6771
  debugObject.center.x,
6691
6772
  debugObject.center.y
6692
6773
  ]);
@@ -6732,11 +6813,11 @@ function createSvgObjectsFromSchDebugObject({
6732
6813
  ];
6733
6814
  }
6734
6815
  if (debugObject.shape === "line") {
6735
- const [screenStartX, screenStartY] = applyToPoint47(transform, [
6816
+ const [screenStartX, screenStartY] = applyToPoint46(transform, [
6736
6817
  debugObject.start.x,
6737
6818
  debugObject.start.y
6738
6819
  ]);
6739
- const [screenEndX, screenEndY] = applyToPoint47(transform, [
6820
+ const [screenEndX, screenEndY] = applyToPoint46(transform, [
6740
6821
  debugObject.end.x,
6741
6822
  debugObject.end.y
6742
6823
  ]);
@@ -6786,7 +6867,7 @@ function createSvgObjectsFromSchDebugObject({
6786
6867
  }
6787
6868
 
6788
6869
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
6789
- import { applyToPoint as applyToPoint48 } from "transformation-matrix";
6870
+ import { applyToPoint as applyToPoint47 } from "transformation-matrix";
6790
6871
  function createSchematicTrace({
6791
6872
  trace,
6792
6873
  transform,
@@ -6800,11 +6881,11 @@ function createSchematicTrace({
6800
6881
  for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
6801
6882
  const edge = edges[edgeIndex];
6802
6883
  if (edge.is_crossing) continue;
6803
- const [screenFromX, screenFromY] = applyToPoint48(transform, [
6884
+ const [screenFromX, screenFromY] = applyToPoint47(transform, [
6804
6885
  edge.from.x,
6805
6886
  edge.from.y
6806
6887
  ]);
6807
- const [screenToX, screenToY] = applyToPoint48(transform, [
6888
+ const [screenToX, screenToY] = applyToPoint47(transform, [
6808
6889
  edge.to.x,
6809
6890
  edge.to.y
6810
6891
  ]);
@@ -6848,11 +6929,11 @@ function createSchematicTrace({
6848
6929
  }
6849
6930
  for (const edge of edges) {
6850
6931
  if (!edge.is_crossing) continue;
6851
- const [screenFromX, screenFromY] = applyToPoint48(transform, [
6932
+ const [screenFromX, screenFromY] = applyToPoint47(transform, [
6852
6933
  edge.from.x,
6853
6934
  edge.from.y
6854
6935
  ]);
6855
- const [screenToX, screenToY] = applyToPoint48(transform, [
6936
+ const [screenToX, screenToY] = applyToPoint47(transform, [
6856
6937
  edge.to.x,
6857
6938
  edge.to.y
6858
6939
  ]);
@@ -6896,7 +6977,7 @@ function createSchematicTrace({
6896
6977
  }
6897
6978
  if (trace.junctions) {
6898
6979
  for (const junction of trace.junctions) {
6899
- const [screenX, screenY] = applyToPoint48(transform, [
6980
+ const [screenX, screenY] = applyToPoint47(transform, [
6900
6981
  junction.x,
6901
6982
  junction.y
6902
6983
  ]);
@@ -6951,19 +7032,19 @@ function createSchematicTrace({
6951
7032
 
6952
7033
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
6953
7034
  import {
6954
- applyToPoint as applyToPoint50,
7035
+ applyToPoint as applyToPoint49,
6955
7036
  compose as compose11,
6956
7037
  rotate as rotate6,
6957
- scale as scale7,
7038
+ scale as scale6,
6958
7039
  translate as translate11
6959
7040
  } from "transformation-matrix";
6960
7041
 
6961
7042
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
6962
7043
  import {
6963
- applyToPoint as applyToPoint49,
7044
+ applyToPoint as applyToPoint48,
6964
7045
  compose as compose10,
6965
7046
  rotate as rotate5,
6966
- scale as scale6,
7047
+ scale as scale5,
6967
7048
  translate as translate10
6968
7049
  } from "transformation-matrix";
6969
7050
  import { symbols as symbols3 } from "schematic-symbols";
@@ -7035,21 +7116,21 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
7035
7116
  x: symbolBounds.minX,
7036
7117
  y: (symbolBounds.minY + symbolBounds.maxY) / 2
7037
7118
  };
7038
- const rotatedSymbolEnd = applyToPoint49(rotationMatrix, symbolEndPoint);
7119
+ const rotatedSymbolEnd = applyToPoint48(rotationMatrix, symbolEndPoint);
7039
7120
  const symbolToRealTransform = compose10(
7040
7121
  translate10(
7041
7122
  realAnchorPosition.x - rotatedSymbolEnd.x,
7042
7123
  realAnchorPosition.y - rotatedSymbolEnd.y
7043
7124
  ),
7044
7125
  rotationMatrix,
7045
- scale6(1)
7126
+ scale5(1)
7046
7127
  // Use full symbol size
7047
7128
  );
7048
- const [screenMinX, screenMinY] = applyToPoint49(
7129
+ const [screenMinX, screenMinY] = applyToPoint48(
7049
7130
  compose10(realToScreenTransform, symbolToRealTransform),
7050
7131
  [bounds.minX, bounds.minY]
7051
7132
  );
7052
- const [screenMaxX, screenMaxY] = applyToPoint49(
7133
+ const [screenMaxX, screenMaxY] = applyToPoint48(
7053
7134
  compose10(realToScreenTransform, symbolToRealTransform),
7054
7135
  [bounds.maxX, bounds.maxY]
7055
7136
  );
@@ -7073,7 +7154,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
7073
7154
  });
7074
7155
  for (const path of symbolPaths) {
7075
7156
  const symbolPath = path.points.map((p, i) => {
7076
- const [x, y] = applyToPoint49(
7157
+ const [x, y] = applyToPoint48(
7077
7158
  compose10(realToScreenTransform, symbolToRealTransform),
7078
7159
  [p.x, p.y]
7079
7160
  );
@@ -7094,7 +7175,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
7094
7175
  });
7095
7176
  }
7096
7177
  for (const text of symbolTexts) {
7097
- const screenTextPos = applyToPoint49(
7178
+ const screenTextPos = applyToPoint48(
7098
7179
  compose10(realToScreenTransform, symbolToRealTransform),
7099
7180
  text
7100
7181
  );
@@ -7104,8 +7185,8 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
7104
7185
  } else if (textValue === "{VAL}") {
7105
7186
  textValue = "";
7106
7187
  }
7107
- const scale10 = Math.abs(realToScreenTransform.a);
7108
- const baseOffset = scale10 * 0.1;
7188
+ const scale9 = Math.abs(realToScreenTransform.a);
7189
+ const baseOffset = scale9 * 0.1;
7109
7190
  const offsetScreenPos = {
7110
7191
  x: screenTextPos.x,
7111
7192
  y: screenTextPos.y
@@ -7136,7 +7217,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
7136
7217
  });
7137
7218
  }
7138
7219
  for (const box of symbolBoxes) {
7139
- const screenBoxPos = applyToPoint49(
7220
+ const screenBoxPos = applyToPoint48(
7140
7221
  compose10(realToScreenTransform, symbolToRealTransform),
7141
7222
  box
7142
7223
  );
@@ -7159,7 +7240,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
7159
7240
  });
7160
7241
  }
7161
7242
  for (const circle of symbolCircles) {
7162
- const screenCirclePos = applyToPoint49(
7243
+ const screenCirclePos = applyToPoint48(
7163
7244
  compose10(realToScreenTransform, symbolToRealTransform),
7164
7245
  circle
7165
7246
  );
@@ -7204,14 +7285,14 @@ var createSvgObjectsForSchNetLabel = ({
7204
7285
  const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
7205
7286
  const fontSizeMm = getSchMmFontSize("net_label");
7206
7287
  const textWidthFSR = estimateTextWidth(labelText || "");
7207
- const screenCenter = applyToPoint50(realToScreenTransform, schNetLabel.center);
7288
+ const screenCenter = applyToPoint49(realToScreenTransform, schNetLabel.center);
7208
7289
  const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
7209
7290
  schNetLabel.anchor_side
7210
7291
  );
7211
7292
  const screenTextGrowthVec = { ...realTextGrowthVec };
7212
7293
  screenTextGrowthVec.y *= -1;
7213
7294
  const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
7214
- const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint50(realToScreenTransform, schNetLabel.anchor_position) : {
7295
+ const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint49(realToScreenTransform, schNetLabel.anchor_position) : {
7215
7296
  x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
7216
7297
  y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
7217
7298
  };
@@ -7252,11 +7333,11 @@ var createSvgObjectsForSchNetLabel = ({
7252
7333
  y: -0.6
7253
7334
  }
7254
7335
  ].map(
7255
- (fontRelativePoint) => applyToPoint50(
7336
+ (fontRelativePoint) => applyToPoint49(
7256
7337
  compose11(
7257
7338
  realToScreenTransform,
7258
7339
  translate11(realAnchorPosition.x, realAnchorPosition.y),
7259
- scale7(fontSizeMm),
7340
+ scale6(fontSizeMm),
7260
7341
  rotate6(pathRotation / 180 * Math.PI)
7261
7342
  ),
7262
7343
  fontRelativePoint
@@ -7329,17 +7410,17 @@ var createSvgObjectsForSchNetLabel = ({
7329
7410
  };
7330
7411
 
7331
7412
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
7332
- import { applyToPoint as applyToPoint51 } from "transformation-matrix";
7413
+ import { applyToPoint as applyToPoint50 } from "transformation-matrix";
7333
7414
  var createSvgObjectsFromSchematicBox = ({
7334
7415
  schematicBox,
7335
7416
  transform,
7336
7417
  colorMap: colorMap2
7337
7418
  }) => {
7338
- const topLeft = applyToPoint51(transform, {
7419
+ const topLeft = applyToPoint50(transform, {
7339
7420
  x: schematicBox.x,
7340
7421
  y: schematicBox.y
7341
7422
  });
7342
- const bottomRight = applyToPoint51(transform, {
7423
+ const bottomRight = applyToPoint50(transform, {
7343
7424
  x: schematicBox.x + schematicBox.width,
7344
7425
  y: schematicBox.y + schematicBox.height
7345
7426
  });
@@ -7375,7 +7456,7 @@ var createSvgObjectsFromSchematicBox = ({
7375
7456
  };
7376
7457
 
7377
7458
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
7378
- import { applyToPoint as applyToPoint52 } from "transformation-matrix";
7459
+ import { applyToPoint as applyToPoint51 } from "transformation-matrix";
7379
7460
  var createSvgObjectsFromSchematicTable = ({
7380
7461
  schematicTable,
7381
7462
  transform,
@@ -7408,11 +7489,11 @@ var createSvgObjectsFromSchematicTable = ({
7408
7489
  const svgObjects = [];
7409
7490
  const borderStrokeWidth = border_width * Math.abs(transform.a);
7410
7491
  const gridStrokeWidth = getSchStrokeSize(transform);
7411
- const [screenTopLeftX, screenTopLeftY] = applyToPoint52(transform, [
7492
+ const [screenTopLeftX, screenTopLeftY] = applyToPoint51(transform, [
7412
7493
  topLeftX,
7413
7494
  topLeftY
7414
7495
  ]);
7415
- const [screenBottomRightX, screenBottomRightY] = applyToPoint52(transform, [
7496
+ const [screenBottomRightX, screenBottomRightY] = applyToPoint51(transform, [
7416
7497
  topLeftX + totalWidth,
7417
7498
  topLeftY - totalHeight
7418
7499
  ]);
@@ -7444,8 +7525,8 @@ var createSvgObjectsFromSchematicTable = ({
7444
7525
  (cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
7445
7526
  );
7446
7527
  if (!isMerged) {
7447
- const start = applyToPoint52(transform, { x: currentX, y: segmentStartY });
7448
- const end = applyToPoint52(transform, { x: currentX, y: segmentEndY });
7528
+ const start = applyToPoint51(transform, { x: currentX, y: segmentStartY });
7529
+ const end = applyToPoint51(transform, { x: currentX, y: segmentEndY });
7449
7530
  svgObjects.push({
7450
7531
  name: "line",
7451
7532
  type: "element",
@@ -7474,11 +7555,11 @@ var createSvgObjectsFromSchematicTable = ({
7474
7555
  (cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
7475
7556
  );
7476
7557
  if (!isMerged) {
7477
- const start = applyToPoint52(transform, {
7558
+ const start = applyToPoint51(transform, {
7478
7559
  x: segmentStartX,
7479
7560
  y: currentY
7480
7561
  });
7481
- const end = applyToPoint52(transform, { x: segmentEndX, y: currentY });
7562
+ const end = applyToPoint51(transform, { x: segmentEndX, y: currentY });
7482
7563
  svgObjects.push({
7483
7564
  name: "line",
7484
7565
  type: "element",
@@ -7520,7 +7601,7 @@ var createSvgObjectsFromSchematicTable = ({
7520
7601
  } else if (vertical_align === "bottom") {
7521
7602
  realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
7522
7603
  }
7523
- const screenTextAnchorPos = applyToPoint52(transform, realTextAnchorPos);
7604
+ const screenTextAnchorPos = applyToPoint51(transform, realTextAnchorPos);
7524
7605
  const fontSize = getSchScreenFontSize(
7525
7606
  transform,
7526
7607
  "reference_designator",
@@ -7575,14 +7656,14 @@ var createSvgObjectsFromSchematicTable = ({
7575
7656
  };
7576
7657
 
7577
7658
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
7578
- import { su as su13 } from "@tscircuit/circuit-json-util";
7579
- import { applyToPoint as applyToPoint53 } from "transformation-matrix";
7659
+ import { su as su11 } from "@tscircuit/circuit-json-util";
7660
+ import { applyToPoint as applyToPoint52 } from "transformation-matrix";
7580
7661
  var PIN_CIRCLE_RADIUS_MM2 = 0.02;
7581
7662
  var createSvgObjectsForSchPortHover = ({
7582
7663
  schPort,
7583
7664
  transform
7584
7665
  }) => {
7585
- const screenSchPortPos = applyToPoint53(transform, schPort.center);
7666
+ const screenSchPortPos = applyToPoint52(transform, schPort.center);
7586
7667
  const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
7587
7668
  return [
7588
7669
  {
@@ -7616,7 +7697,7 @@ var createSvgObjectsForSchComponentPortHovers = ({
7616
7697
  transform,
7617
7698
  circuitJson
7618
7699
  }) => {
7619
- const schematicPorts = su13(circuitJson).schematic_port.list({
7700
+ const schematicPorts = su11(circuitJson).schematic_port.list({
7620
7701
  schematic_component_id: component.schematic_component_id
7621
7702
  });
7622
7703
  const svgs = [];
@@ -7627,14 +7708,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
7627
7708
  };
7628
7709
 
7629
7710
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
7630
- import { applyToPoint as applyToPoint54 } from "transformation-matrix";
7711
+ import { applyToPoint as applyToPoint53 } from "transformation-matrix";
7631
7712
  function createSvgObjectsFromSchematicLine({
7632
7713
  schLine,
7633
7714
  transform,
7634
7715
  colorMap: colorMap2
7635
7716
  }) {
7636
- const p1 = applyToPoint54(transform, { x: schLine.x1, y: schLine.y1 });
7637
- const p2 = applyToPoint54(transform, { x: schLine.x2, y: schLine.y2 });
7717
+ const p1 = applyToPoint53(transform, { x: schLine.x1, y: schLine.y1 });
7718
+ const p2 = applyToPoint53(transform, { x: schLine.x2, y: schLine.y2 });
7638
7719
  const strokeWidth = schLine.stroke_width ?? 0.02;
7639
7720
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
7640
7721
  return [
@@ -7663,13 +7744,13 @@ function createSvgObjectsFromSchematicLine({
7663
7744
  }
7664
7745
 
7665
7746
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
7666
- import { applyToPoint as applyToPoint55 } from "transformation-matrix";
7747
+ import { applyToPoint as applyToPoint54 } from "transformation-matrix";
7667
7748
  function createSvgObjectsFromSchematicCircle({
7668
7749
  schCircle,
7669
7750
  transform,
7670
7751
  colorMap: colorMap2
7671
7752
  }) {
7672
- const center = applyToPoint55(transform, schCircle.center);
7753
+ const center = applyToPoint54(transform, schCircle.center);
7673
7754
  const transformedRadius = Math.abs(transform.a) * schCircle.radius;
7674
7755
  const strokeWidth = schCircle.stroke_width ?? 0.02;
7675
7756
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
@@ -7699,13 +7780,13 @@ function createSvgObjectsFromSchematicCircle({
7699
7780
  }
7700
7781
 
7701
7782
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
7702
- import { applyToPoint as applyToPoint56 } from "transformation-matrix";
7783
+ import { applyToPoint as applyToPoint55 } from "transformation-matrix";
7703
7784
  function createSvgObjectsFromSchematicRect({
7704
7785
  schRect,
7705
7786
  transform,
7706
7787
  colorMap: colorMap2
7707
7788
  }) {
7708
- const center = applyToPoint56(transform, schRect.center);
7789
+ const center = applyToPoint55(transform, schRect.center);
7709
7790
  const transformedWidth = Math.abs(transform.a) * schRect.width;
7710
7791
  const transformedHeight = Math.abs(transform.d) * schRect.height;
7711
7792
  const strokeWidth = schRect.stroke_width ?? 0.02;
@@ -7741,13 +7822,13 @@ function createSvgObjectsFromSchematicRect({
7741
7822
  }
7742
7823
 
7743
7824
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
7744
- import { applyToPoint as applyToPoint57 } from "transformation-matrix";
7825
+ import { applyToPoint as applyToPoint56 } from "transformation-matrix";
7745
7826
  function createSvgObjectsFromSchematicArc({
7746
7827
  schArc,
7747
7828
  transform,
7748
7829
  colorMap: colorMap2
7749
7830
  }) {
7750
- const center = applyToPoint57(transform, schArc.center);
7831
+ const center = applyToPoint56(transform, schArc.center);
7751
7832
  const transformedRadius = Math.abs(transform.a) * schArc.radius;
7752
7833
  const strokeWidth = schArc.stroke_width ?? 0.02;
7753
7834
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
@@ -8644,9 +8725,9 @@ function convertCircuitJsonToSchematicSimulationSvg({
8644
8725
  const rawSchematicHeight = Math.max(1, height * clampedRatio);
8645
8726
  const rawSimulationHeight = Math.max(1, height - rawSchematicHeight);
8646
8727
  const totalRawHeight = rawSchematicHeight + rawSimulationHeight;
8647
- const scale10 = totalRawHeight === 0 ? 1 : height / totalRawHeight;
8648
- const schematicHeight = rawSchematicHeight * scale10;
8649
- const simulationHeight = rawSimulationHeight * scale10;
8728
+ const scale9 = totalRawHeight === 0 ? 1 : height / totalRawHeight;
8729
+ const schematicHeight = rawSchematicHeight * scale9;
8730
+ const simulationHeight = rawSimulationHeight * scale9;
8650
8731
  const schematicSvg = convertCircuitJsonToSchematicSvg(schematicElements, {
8651
8732
  ...schematicOptions,
8652
8733
  width,
@@ -8739,18 +8820,18 @@ function formatNumber2(value) {
8739
8820
  // lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
8740
8821
  import { stringify as stringify7 } from "svgson";
8741
8822
  import {
8742
- applyToPoint as applyToPoint60,
8823
+ applyToPoint as applyToPoint59,
8743
8824
  compose as compose14,
8744
- scale as scale9,
8825
+ scale as scale8,
8745
8826
  translate as translate14
8746
8827
  } from "transformation-matrix";
8747
8828
 
8748
8829
  // lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
8749
- import { applyToPoint as applyToPoint59 } from "transformation-matrix";
8830
+ import { applyToPoint as applyToPoint58 } from "transformation-matrix";
8750
8831
  function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
8751
8832
  const { transform, layer: layerFilter } = ctx;
8752
8833
  if (layerFilter && solderPaste.layer !== layerFilter) return [];
8753
- const [x, y] = applyToPoint59(transform, [solderPaste.x, solderPaste.y]);
8834
+ const [x, y] = applyToPoint58(transform, [solderPaste.x, solderPaste.y]);
8754
8835
  if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
8755
8836
  const width = solderPaste.width * Math.abs(transform.a);
8756
8837
  const height = solderPaste.height * Math.abs(transform.d);
@@ -8863,7 +8944,7 @@ function convertCircuitJsonToSolderPasteMask(circuitJson, options) {
8863
8944
  offsetX - minX * scaleFactor + padding * scaleFactor,
8864
8945
  svgHeight - offsetY + minY * scaleFactor - padding * scaleFactor
8865
8946
  ),
8866
- scale9(scaleFactor, -scaleFactor)
8947
+ scale8(scaleFactor, -scaleFactor)
8867
8948
  // Flip in y-direction
8868
8949
  );
8869
8950
  const ctx = {
@@ -8953,8 +9034,8 @@ function createSvgObjects4({ elm, ctx }) {
8953
9034
  }
8954
9035
  }
8955
9036
  function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
8956
- const [x1, y1] = applyToPoint60(transform, [minX, minY]);
8957
- const [x2, y2] = applyToPoint60(transform, [maxX, maxY]);
9037
+ const [x1, y1] = applyToPoint59(transform, [minX, minY]);
9038
+ const [x2, y2] = applyToPoint59(transform, [maxX, maxY]);
8958
9039
  const width = Math.abs(x2 - x1);
8959
9040
  const height = Math.abs(y2 - y1);
8960
9041
  const x = Math.min(x1, x2);