circuit-to-svg 0.0.284 → 0.0.286

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
@@ -1,11 +1,11 @@
1
1
  // lib/pcb/convert-circuit-json-to-pcb-svg.ts
2
- import { distance } from "circuit-json";
2
+ import { distance as distance2 } from "circuit-json";
3
3
  import { stringify } from "svgson";
4
4
  import {
5
- applyToPoint as applyToPoint32,
6
- compose as compose5,
7
- scale as scale2,
8
- translate as translate5
5
+ applyToPoint as applyToPoint33,
6
+ compose as compose6,
7
+ scale as scale3,
8
+ translate as translate6
9
9
  } from "transformation-matrix";
10
10
 
11
11
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace-error.ts
@@ -2677,8 +2677,329 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
2677
2677
  return [svgObject];
2678
2678
  }
2679
2679
 
2680
+ // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-text.ts
2681
+ import {
2682
+ applyToPoint as applyToPoint16,
2683
+ compose as compose3,
2684
+ rotate as rotate3,
2685
+ translate as translate3,
2686
+ scale as scale2,
2687
+ toString as matrixToString4
2688
+ } from "transformation-matrix";
2689
+
2690
+ // lib/pcb/colors.ts
2691
+ var DEFAULT_PCB_COLOR_MAP = {
2692
+ copper: {
2693
+ top: "rgb(200, 52, 52)",
2694
+ inner1: "rgb(255, 140, 0)",
2695
+ inner2: "rgb(255, 215, 0)",
2696
+ inner3: "rgb(50, 205, 50)",
2697
+ inner4: "rgb(64, 224, 208)",
2698
+ inner5: "rgb(138, 43, 226)",
2699
+ inner6: "rgb(255, 105, 180)",
2700
+ bottom: "rgb(77, 127, 196)"
2701
+ },
2702
+ soldermaskWithCopperUnderneath: {
2703
+ top: "rgb(18, 82, 50)",
2704
+ bottom: "rgb(77, 127, 196)"
2705
+ },
2706
+ soldermask: {
2707
+ top: "rgb(12, 55, 33)",
2708
+ bottom: "rgb(12, 55, 33)"
2709
+ },
2710
+ soldermaskOverCopper: {
2711
+ top: "rgb(52, 135, 73)",
2712
+ bottom: "rgb(52, 135, 73)"
2713
+ },
2714
+ substrate: "rgb(201, 162, 110)",
2715
+ // FR4 substrate color (tan/beige)
2716
+ drill: "#FF26E2",
2717
+ silkscreen: {
2718
+ top: "#f2eda1",
2719
+ bottom: "#5da9e9"
2720
+ },
2721
+ boardOutline: "rgba(255, 255, 255, 0.5)",
2722
+ courtyard: "#FF00FF",
2723
+ debugComponent: {
2724
+ fill: null,
2725
+ stroke: null
2726
+ }
2727
+ };
2728
+ var HOLE_COLOR = DEFAULT_PCB_COLOR_MAP.drill;
2729
+ var SILKSCREEN_TOP_COLOR = DEFAULT_PCB_COLOR_MAP.silkscreen.top;
2730
+ var SILKSCREEN_BOTTOM_COLOR = DEFAULT_PCB_COLOR_MAP.silkscreen.bottom;
2731
+
2732
+ // lib/pcb/layer-name-to-color.ts
2733
+ var LAYER_NAME_TO_COLOR = {
2734
+ ...DEFAULT_PCB_COLOR_MAP.copper
2735
+ };
2736
+ function layerNameToColor(layerName, colorMap2 = DEFAULT_PCB_COLOR_MAP) {
2737
+ return colorMap2.copper[layerName] ?? "white";
2738
+ }
2739
+ var SOLDER_PASTE_LAYER_NAME_TO_COLOR = {
2740
+ bottom: "rgb(105, 105, 105)",
2741
+ top: "rgb(105, 105, 105)"
2742
+ };
2743
+ function solderPasteLayerNameToColor(layerName) {
2744
+ return SOLDER_PASTE_LAYER_NAME_TO_COLOR[layerName] ?? "rgb(105, 105, 105)";
2745
+ }
2746
+
2747
+ // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-text.ts
2748
+ import { distance } from "circuit-json";
2749
+ import { lineAlphabet } from "@tscircuit/alphabet";
2750
+ var CHAR_WIDTH = 1;
2751
+ var CHAR_SPACING = 0.2;
2752
+ var LINE_HEIGHT = 1.4;
2753
+ var FONT_SCALE = 0.53;
2754
+ function linesToPathData(lines, offsetX, offsetY, charScale) {
2755
+ return lines.map((line) => {
2756
+ const x1 = offsetX + line.x1 * charScale;
2757
+ const y1 = offsetY + (1 - line.y1) * charScale;
2758
+ const x2 = offsetX + line.x2 * charScale;
2759
+ const y2 = offsetY + (1 - line.y2) * charScale;
2760
+ return `M${x1} ${y1}L${x2} ${y2}`;
2761
+ }).join(" ");
2762
+ }
2763
+ function textToAlphabetPath(text, fontSize) {
2764
+ const paths = [];
2765
+ const charAdvance = (CHAR_WIDTH + CHAR_SPACING) * fontSize;
2766
+ let x = 0;
2767
+ for (const char of text) {
2768
+ if (char === " ") {
2769
+ x += charAdvance * 0.6;
2770
+ continue;
2771
+ }
2772
+ const lines = lineAlphabet[char];
2773
+ if (lines) {
2774
+ paths.push(linesToPathData(lines, x, 0, fontSize));
2775
+ }
2776
+ x += charAdvance;
2777
+ }
2778
+ const width = x > 0 ? x - CHAR_SPACING * fontSize : 0;
2779
+ return { pathData: paths.join(" "), width };
2780
+ }
2781
+ var maskIdCounter = 0;
2782
+ function textToCenteredAlphabetPaths(text, fontSize) {
2783
+ const textLines = text.split("\n");
2784
+ const lineHeight = fontSize * LINE_HEIGHT;
2785
+ const totalHeight = textLines.length * lineHeight;
2786
+ const lineWidths = [];
2787
+ let maxWidth = 0;
2788
+ for (const line of textLines) {
2789
+ const { width } = textToAlphabetPath(line, fontSize);
2790
+ lineWidths.push(width);
2791
+ if (width > maxWidth) maxWidth = width;
2792
+ }
2793
+ const paths = [];
2794
+ let y = -totalHeight / 2;
2795
+ for (let i = 0; i < textLines.length; i++) {
2796
+ const line = textLines[i];
2797
+ const lineWidth = lineWidths[i];
2798
+ const charAdvance = (CHAR_WIDTH + CHAR_SPACING) * fontSize;
2799
+ let x = -lineWidth / 2;
2800
+ for (const char of line) {
2801
+ if (char === " ") {
2802
+ x += charAdvance * 0.6;
2803
+ continue;
2804
+ }
2805
+ const charLines = lineAlphabet[char];
2806
+ if (charLines) {
2807
+ paths.push(linesToPathData(charLines, x, y, fontSize));
2808
+ }
2809
+ x += charAdvance;
2810
+ }
2811
+ y += lineHeight;
2812
+ }
2813
+ return {
2814
+ pathData: paths.join(" "),
2815
+ width: maxWidth,
2816
+ height: totalHeight
2817
+ };
2818
+ }
2819
+ function createSvgObjectsFromPcbCopperText(pcbCopperText, ctx) {
2820
+ const { transform, layer: filterLayer, colorMap: colorMap2 } = ctx;
2821
+ const {
2822
+ anchor_position,
2823
+ text,
2824
+ font_size = "0.2mm",
2825
+ layer,
2826
+ ccw_rotation = 0,
2827
+ anchor_alignment = "center",
2828
+ is_knockout = false,
2829
+ knockout_padding,
2830
+ is_mirrored = false
2831
+ } = pcbCopperText;
2832
+ const layerName = layer ?? "top";
2833
+ if (filterLayer && filterLayer !== layerName) return [];
2834
+ if (!anchor_position) return [];
2835
+ const [ax, ay] = applyToPoint16(transform, [
2836
+ anchor_position.x,
2837
+ anchor_position.y
2838
+ ]);
2839
+ const fontSizeNum = distance.parse(font_size) ?? 0.2;
2840
+ const scaleFactor = Math.abs(transform.a);
2841
+ const copperColor = layerNameToColor(layerName, colorMap2);
2842
+ const isBottom = layerName === "bottom";
2843
+ const applyMirror = isBottom ? true : is_mirrored === true;
2844
+ if (is_knockout) {
2845
+ const scaledFontSize2 = fontSizeNum * FONT_SCALE;
2846
+ const { pathData: pathData2, width: width2, height: height2 } = textToCenteredAlphabetPaths(
2847
+ text,
2848
+ scaledFontSize2
2849
+ );
2850
+ const padX = knockout_padding?.left ?? scaledFontSize2 * 0.5;
2851
+ const padY = knockout_padding?.top ?? scaledFontSize2 * 0.3;
2852
+ const rectW = width2 + padX * 2;
2853
+ const rectH = height2 + padY * 2;
2854
+ const strokeWidth2 = scaledFontSize2 * 0.15;
2855
+ const knockoutTransform = matrixToString4(
2856
+ compose3(
2857
+ translate3(ax, ay),
2858
+ rotate3(-ccw_rotation * Math.PI / 180),
2859
+ ...applyMirror ? [scale2(-1, 1)] : [],
2860
+ scale2(scaleFactor, scaleFactor)
2861
+ )
2862
+ );
2863
+ const maskId = `knockout-mask-${pcbCopperText.pcb_copper_text_id}-${maskIdCounter++}`;
2864
+ return [
2865
+ {
2866
+ name: "defs",
2867
+ type: "element",
2868
+ value: "",
2869
+ children: [
2870
+ {
2871
+ name: "mask",
2872
+ type: "element",
2873
+ value: "",
2874
+ attributes: {
2875
+ id: maskId
2876
+ },
2877
+ children: [
2878
+ // White background - area that will show copper
2879
+ {
2880
+ name: "rect",
2881
+ type: "element",
2882
+ value: "",
2883
+ attributes: {
2884
+ x: (-rectW / 2).toString(),
2885
+ y: (-rectH / 2).toString(),
2886
+ width: rectW.toString(),
2887
+ height: rectH.toString(),
2888
+ fill: "white"
2889
+ },
2890
+ children: []
2891
+ },
2892
+ // Black text strokes - area that will be cut out
2893
+ {
2894
+ name: "path",
2895
+ type: "element",
2896
+ value: "",
2897
+ attributes: {
2898
+ d: pathData2,
2899
+ fill: "none",
2900
+ stroke: "black",
2901
+ "stroke-width": strokeWidth2.toString(),
2902
+ "stroke-linecap": "round",
2903
+ "stroke-linejoin": "round"
2904
+ },
2905
+ children: []
2906
+ }
2907
+ ]
2908
+ }
2909
+ ],
2910
+ attributes: {}
2911
+ },
2912
+ {
2913
+ name: "rect",
2914
+ type: "element",
2915
+ value: "",
2916
+ children: [],
2917
+ attributes: {
2918
+ x: (-rectW / 2).toString(),
2919
+ y: (-rectH / 2).toString(),
2920
+ width: rectW.toString(),
2921
+ height: rectH.toString(),
2922
+ fill: copperColor,
2923
+ mask: `url(#${maskId})`,
2924
+ transform: knockoutTransform,
2925
+ class: `pcb-copper-text-knockout pcb-copper-${layerName}`,
2926
+ "data-type": "pcb_copper_text",
2927
+ "data-pcb-copper-text-id": pcbCopperText.pcb_copper_text_id
2928
+ }
2929
+ }
2930
+ ];
2931
+ }
2932
+ const scaledFontSize = fontSizeNum * FONT_SCALE;
2933
+ const { pathData, width, height } = textToCenteredAlphabetPaths(
2934
+ text,
2935
+ scaledFontSize
2936
+ );
2937
+ let offsetX = 0;
2938
+ let offsetY = 0;
2939
+ switch (anchor_alignment) {
2940
+ case "top_left":
2941
+ offsetX = width / 2;
2942
+ offsetY = height / 2;
2943
+ break;
2944
+ case "top_center":
2945
+ offsetY = height / 2;
2946
+ break;
2947
+ case "top_right":
2948
+ offsetX = -width / 2;
2949
+ offsetY = height / 2;
2950
+ break;
2951
+ case "center_left":
2952
+ offsetX = width / 2;
2953
+ break;
2954
+ case "center_right":
2955
+ offsetX = -width / 2;
2956
+ break;
2957
+ case "bottom_left":
2958
+ offsetX = width / 2;
2959
+ offsetY = -height / 2;
2960
+ break;
2961
+ case "bottom_center":
2962
+ offsetY = -height / 2;
2963
+ break;
2964
+ case "bottom_right":
2965
+ offsetX = -width / 2;
2966
+ offsetY = -height / 2;
2967
+ break;
2968
+ }
2969
+ const textTransform = matrixToString4(
2970
+ compose3(
2971
+ translate3(ax, ay),
2972
+ rotate3(-ccw_rotation * Math.PI / 180),
2973
+ ...applyMirror ? [scale2(-1, 1)] : [],
2974
+ translate3(offsetX, offsetY),
2975
+ scale2(scaleFactor, scaleFactor)
2976
+ )
2977
+ );
2978
+ const strokeWidth = scaledFontSize * 0.15;
2979
+ return [
2980
+ {
2981
+ name: "path",
2982
+ type: "element",
2983
+ attributes: {
2984
+ d: pathData,
2985
+ fill: "none",
2986
+ stroke: copperColor,
2987
+ "stroke-width": strokeWidth.toString(),
2988
+ "stroke-linecap": "round",
2989
+ "stroke-linejoin": "round",
2990
+ transform: textTransform,
2991
+ class: `pcb-copper-text pcb-copper-${layerName}`,
2992
+ "data-type": "pcb_copper_text",
2993
+ "data-pcb-copper-text-id": pcbCopperText.pcb_copper_text_id
2994
+ },
2995
+ children: [],
2996
+ value: ""
2997
+ }
2998
+ ];
2999
+ }
3000
+
2680
3001
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-circle.ts
2681
- import { applyToPoint as applyToPoint16 } from "transformation-matrix";
3002
+ import { applyToPoint as applyToPoint17 } from "transformation-matrix";
2682
3003
  function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
2683
3004
  const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
2684
3005
  const {
@@ -2693,7 +3014,7 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
2693
3014
  console.error("Invalid PCB Silkscreen Circle data:", { center, radius });
2694
3015
  return [];
2695
3016
  }
2696
- const [transformedX, transformedY] = applyToPoint16(transform, [
3017
+ const [transformedX, transformedY] = applyToPoint17(transform, [
2697
3018
  center.x,
2698
3019
  center.y
2699
3020
  ]);
@@ -2721,7 +3042,7 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
2721
3042
  }
2722
3043
 
2723
3044
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-line.ts
2724
- import { applyToPoint as applyToPoint17 } from "transformation-matrix";
3045
+ import { applyToPoint as applyToPoint18 } from "transformation-matrix";
2725
3046
  function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
2726
3047
  const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
2727
3048
  const {
@@ -2738,8 +3059,8 @@ function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
2738
3059
  console.error("Invalid coordinates:", { x1, y1, x2, y2 });
2739
3060
  return [];
2740
3061
  }
2741
- const [transformedX1, transformedY1] = applyToPoint17(transform, [x1, y1]);
2742
- const [transformedX2, transformedY2] = applyToPoint17(transform, [x2, y2]);
3062
+ const [transformedX1, transformedY1] = applyToPoint18(transform, [x1, y1]);
3063
+ const [transformedX2, transformedY2] = applyToPoint18(transform, [x2, y2]);
2743
3064
  const transformedStrokeWidth = stroke_width * Math.abs(transform.a);
2744
3065
  const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
2745
3066
  return [
@@ -2765,7 +3086,7 @@ function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
2765
3086
  }
2766
3087
 
2767
3088
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-courtyard-rect.ts
2768
- import { applyToPoint as applyToPoint18 } from "transformation-matrix";
3089
+ import { applyToPoint as applyToPoint19 } from "transformation-matrix";
2769
3090
  function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect, ctx) {
2770
3091
  const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
2771
3092
  const {
@@ -2784,7 +3105,7 @@ function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect, ctx) {
2784
3105
  });
2785
3106
  return [];
2786
3107
  }
2787
- const [transformedX, transformedY] = applyToPoint18(transform, [
3108
+ const [transformedX, transformedY] = applyToPoint19(transform, [
2788
3109
  center.x,
2789
3110
  center.y
2790
3111
  ]);
@@ -2825,66 +3146,7 @@ function pairs(arr) {
2825
3146
  }
2826
3147
 
2827
3148
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace.ts
2828
- import { applyToPoint as applyToPoint19 } from "transformation-matrix";
2829
-
2830
- // lib/pcb/colors.ts
2831
- var DEFAULT_PCB_COLOR_MAP = {
2832
- copper: {
2833
- top: "rgb(200, 52, 52)",
2834
- inner1: "rgb(255, 140, 0)",
2835
- inner2: "rgb(255, 215, 0)",
2836
- inner3: "rgb(50, 205, 50)",
2837
- inner4: "rgb(64, 224, 208)",
2838
- inner5: "rgb(138, 43, 226)",
2839
- inner6: "rgb(255, 105, 180)",
2840
- bottom: "rgb(77, 127, 196)"
2841
- },
2842
- soldermaskWithCopperUnderneath: {
2843
- top: "rgb(18, 82, 50)",
2844
- bottom: "rgb(77, 127, 196)"
2845
- },
2846
- soldermask: {
2847
- top: "rgb(12, 55, 33)",
2848
- bottom: "rgb(12, 55, 33)"
2849
- },
2850
- soldermaskOverCopper: {
2851
- top: "rgb(52, 135, 73)",
2852
- bottom: "rgb(52, 135, 73)"
2853
- },
2854
- substrate: "rgb(201, 162, 110)",
2855
- // FR4 substrate color (tan/beige)
2856
- drill: "#FF26E2",
2857
- silkscreen: {
2858
- top: "#f2eda1",
2859
- bottom: "#5da9e9"
2860
- },
2861
- boardOutline: "rgba(255, 255, 255, 0.5)",
2862
- courtyard: "#FF00FF",
2863
- debugComponent: {
2864
- fill: null,
2865
- stroke: null
2866
- }
2867
- };
2868
- var HOLE_COLOR = DEFAULT_PCB_COLOR_MAP.drill;
2869
- var SILKSCREEN_TOP_COLOR = DEFAULT_PCB_COLOR_MAP.silkscreen.top;
2870
- var SILKSCREEN_BOTTOM_COLOR = DEFAULT_PCB_COLOR_MAP.silkscreen.bottom;
2871
-
2872
- // lib/pcb/layer-name-to-color.ts
2873
- var LAYER_NAME_TO_COLOR = {
2874
- ...DEFAULT_PCB_COLOR_MAP.copper
2875
- };
2876
- function layerNameToColor(layerName, colorMap2 = DEFAULT_PCB_COLOR_MAP) {
2877
- return colorMap2.copper[layerName] ?? "white";
2878
- }
2879
- var SOLDER_PASTE_LAYER_NAME_TO_COLOR = {
2880
- bottom: "rgb(105, 105, 105)",
2881
- top: "rgb(105, 105, 105)"
2882
- };
2883
- function solderPasteLayerNameToColor(layerName) {
2884
- return SOLDER_PASTE_LAYER_NAME_TO_COLOR[layerName] ?? "rgb(105, 105, 105)";
2885
- }
2886
-
2887
- // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace.ts
3149
+ import { applyToPoint as applyToPoint20 } from "transformation-matrix";
2888
3150
  function createSvgObjectsFromPcbTrace(trace, ctx) {
2889
3151
  const { transform, layer: layerFilter, colorMap: colorMap2, showSolderMask } = ctx;
2890
3152
  if (!trace.route || !Array.isArray(trace.route) || trace.route.length < 2)
@@ -2892,8 +3154,8 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
2892
3154
  const segments = pairs(trace.route);
2893
3155
  const svgObjects = [];
2894
3156
  for (const [start, end] of segments) {
2895
- const startPoint = applyToPoint19(transform, [start.x, start.y]);
2896
- const endPoint = applyToPoint19(transform, [end.x, end.y]);
3157
+ const startPoint = applyToPoint20(transform, [start.x, start.y]);
3158
+ const endPoint = applyToPoint20(transform, [end.x, end.y]);
2897
3159
  const layer = "layer" in start ? start.layer : "layer" in end ? end.layer : null;
2898
3160
  if (!layer) continue;
2899
3161
  if (layerFilter && layer !== layerFilter) continue;
@@ -2948,7 +3210,7 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
2948
3210
  }
2949
3211
 
2950
3212
  // lib/pcb/svg-object-fns/create-svg-objects-from-smt-pads.ts
2951
- import { applyToPoint as applyToPoint20 } from "transformation-matrix";
3213
+ import { applyToPoint as applyToPoint21 } from "transformation-matrix";
2952
3214
  function createSvgObjectsFromSmtPad(pad, ctx) {
2953
3215
  const { transform, layer: layerFilter, colorMap: colorMap2, showSolderMask } = ctx;
2954
3216
  if (layerFilter && pad.layer !== layerFilter) return [];
@@ -2959,7 +3221,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
2959
3221
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
2960
3222
  const width = pad.width * Math.abs(transform.a);
2961
3223
  const height = pad.height * Math.abs(transform.d);
2962
- const [x, y] = applyToPoint20(transform, [pad.x, pad.y]);
3224
+ const [x, y] = applyToPoint21(transform, [pad.x, pad.y]);
2963
3225
  const cornerRadiusValue = pad.corner_radius ?? pad.rect_border_radius ?? 0;
2964
3226
  const scaledBorderRadius = cornerRadiusValue * Math.abs(transform.a);
2965
3227
  if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
@@ -3201,7 +3463,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3201
3463
  const width = pad.width * Math.abs(transform.a);
3202
3464
  const height = pad.height * Math.abs(transform.d);
3203
3465
  const radius = pad.radius * Math.abs(transform.a);
3204
- const [x, y] = applyToPoint20(transform, [pad.x, pad.y]);
3466
+ const [x, y] = applyToPoint21(transform, [pad.x, pad.y]);
3205
3467
  const rotationTransformAttributes = isRotated ? {
3206
3468
  transform: `translate(${x} ${y}) rotate(${-(pad.ccw_rotation ?? 0)})`
3207
3469
  } : void 0;
@@ -3319,7 +3581,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3319
3581
  }
3320
3582
  if (pad.shape === "circle") {
3321
3583
  const radius = pad.radius * Math.abs(transform.a);
3322
- const [x, y] = applyToPoint20(transform, [pad.x, pad.y]);
3584
+ const [x, y] = applyToPoint21(transform, [pad.x, pad.y]);
3323
3585
  const padElement = {
3324
3586
  name: "circle",
3325
3587
  type: "element",
@@ -3409,7 +3671,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3409
3671
  }
3410
3672
  if (pad.shape === "polygon") {
3411
3673
  const points = (pad.points ?? []).map(
3412
- (point) => applyToPoint20(transform, [point.x, point.y])
3674
+ (point) => applyToPoint21(transform, [point.x, point.y])
3413
3675
  );
3414
3676
  const padElement = {
3415
3677
  name: "polygon",
@@ -3434,10 +3696,10 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3434
3696
  maskPoints = points.map(([px, py]) => {
3435
3697
  const dx = px - centroidX;
3436
3698
  const dy = py - centroidY;
3437
- const distance3 = Math.sqrt(dx * dx + dy * dy);
3438
- if (distance3 === 0) return [px, py];
3439
- const normalizedDx = dx / distance3;
3440
- const normalizedDy = dy / distance3;
3699
+ const distance4 = Math.sqrt(dx * dx + dy * dy);
3700
+ if (distance4 === 0) return [px, py];
3701
+ const normalizedDx = dx / distance4;
3702
+ const normalizedDy = dy / distance4;
3441
3703
  return [
3442
3704
  px + normalizedDx * soldermaskMargin,
3443
3705
  py + normalizedDy * soldermaskMargin
@@ -3508,10 +3770,10 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3508
3770
  }
3509
3771
 
3510
3772
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-board.ts
3511
- import { applyToPoint as applyToPoint22 } from "transformation-matrix";
3773
+ import { applyToPoint as applyToPoint23 } from "transformation-matrix";
3512
3774
 
3513
3775
  // lib/utils/create-pcb-component-anchor-offset-indicators.ts
3514
- import { applyToPoint as applyToPoint21 } from "transformation-matrix";
3776
+ import { applyToPoint as applyToPoint22 } from "transformation-matrix";
3515
3777
  var OFFSET_THRESHOLD_MM = 0.01;
3516
3778
  var TICK_SIZE_PX = 4;
3517
3779
  var LABEL_GAP_PX = 8;
@@ -3532,19 +3794,19 @@ function createAnchorOffsetIndicators(params) {
3532
3794
  componentHeight = 0
3533
3795
  } = params;
3534
3796
  const objects = [];
3535
- const [screenGroupAnchorX, screenGroupAnchorY] = applyToPoint21(transform, [
3797
+ const [screenGroupAnchorX, screenGroupAnchorY] = applyToPoint22(transform, [
3536
3798
  groupAnchorPosition.x,
3537
3799
  groupAnchorPosition.y
3538
3800
  ]);
3539
- const [screenComponentX, screenComponentY] = applyToPoint21(transform, [
3801
+ const [screenComponentX, screenComponentY] = applyToPoint22(transform, [
3540
3802
  componentPosition.x,
3541
3803
  componentPosition.y
3542
3804
  ]);
3543
3805
  const offsetX = componentPosition.x - groupAnchorPosition.x;
3544
3806
  const offsetY = componentPosition.y - groupAnchorPosition.y;
3545
- const scale9 = Math.abs(transform.a);
3546
- const screenComponentWidth = componentWidth * scale9;
3547
- const screenComponentHeight = componentHeight * scale9;
3807
+ const scale10 = Math.abs(transform.a);
3808
+ const screenComponentWidth = componentWidth * scale10;
3809
+ const screenComponentHeight = componentHeight * scale10;
3548
3810
  objects.push(createAnchorMarker(screenGroupAnchorX, screenGroupAnchorY));
3549
3811
  objects.push({
3550
3812
  name: "line",
@@ -3821,25 +4083,25 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
3821
4083
  let path;
3822
4084
  if (outline && Array.isArray(outline) && outline.length >= 3) {
3823
4085
  path = outline.map((point, index) => {
3824
- const [x, y] = applyToPoint22(transform, [point.x, point.y]);
4086
+ const [x, y] = applyToPoint23(transform, [point.x, point.y]);
3825
4087
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
3826
4088
  }).join(" ");
3827
4089
  } else {
3828
4090
  const halfWidth = width / 2;
3829
4091
  const halfHeight = height / 2;
3830
- const topLeft = applyToPoint22(transform, [
4092
+ const topLeft = applyToPoint23(transform, [
3831
4093
  center.x - halfWidth,
3832
4094
  center.y - halfHeight
3833
4095
  ]);
3834
- const topRight = applyToPoint22(transform, [
4096
+ const topRight = applyToPoint23(transform, [
3835
4097
  center.x + halfWidth,
3836
4098
  center.y - halfHeight
3837
4099
  ]);
3838
- const bottomRight = applyToPoint22(transform, [
4100
+ const bottomRight = applyToPoint23(transform, [
3839
4101
  center.x + halfWidth,
3840
4102
  center.y + halfHeight
3841
4103
  ]);
3842
- const bottomLeft = applyToPoint22(transform, [
4104
+ const bottomLeft = applyToPoint23(transform, [
3843
4105
  center.x - halfWidth,
3844
4106
  center.y + halfHeight
3845
4107
  ]);
@@ -3902,7 +4164,7 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
3902
4164
  }
3903
4165
 
3904
4166
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-panel.ts
3905
- import { applyToPoint as applyToPoint23 } from "transformation-matrix";
4167
+ import { applyToPoint as applyToPoint24 } from "transformation-matrix";
3906
4168
  function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
3907
4169
  const { transform, colorMap: colorMap2, showSolderMask } = ctx;
3908
4170
  const width = Number(pcbPanel.width);
@@ -3910,19 +4172,19 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
3910
4172
  const center = pcbPanel.center ?? { x: width / 2, y: height / 2 };
3911
4173
  const halfWidth = width / 2;
3912
4174
  const halfHeight = height / 2;
3913
- const topLeft = applyToPoint23(transform, [
4175
+ const topLeft = applyToPoint24(transform, [
3914
4176
  center.x - halfWidth,
3915
4177
  center.y - halfHeight
3916
4178
  ]);
3917
- const topRight = applyToPoint23(transform, [
4179
+ const topRight = applyToPoint24(transform, [
3918
4180
  center.x + halfWidth,
3919
4181
  center.y - halfHeight
3920
4182
  ]);
3921
- const bottomRight = applyToPoint23(transform, [
4183
+ const bottomRight = applyToPoint24(transform, [
3922
4184
  center.x + halfWidth,
3923
4185
  center.y + halfHeight
3924
4186
  ]);
3925
- const bottomLeft = applyToPoint23(transform, [
4187
+ const bottomLeft = applyToPoint24(transform, [
3926
4188
  center.x - halfWidth,
3927
4189
  center.y + halfHeight
3928
4190
  ]);
@@ -3951,10 +4213,10 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
3951
4213
  }
3952
4214
 
3953
4215
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
3954
- import { applyToPoint as applyToPoint24 } from "transformation-matrix";
4216
+ import { applyToPoint as applyToPoint25 } from "transformation-matrix";
3955
4217
  function createSvgObjectsFromPcbVia(hole, ctx) {
3956
4218
  const { transform, colorMap: colorMap2 } = ctx;
3957
- const [x, y] = applyToPoint24(transform, [hole.x, hole.y]);
4219
+ const [x, y] = applyToPoint25(transform, [hole.x, hole.y]);
3958
4220
  const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
3959
4221
  const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
3960
4222
  const scaledHoleWidth = hole.hole_diameter * Math.abs(transform.a);
@@ -4000,11 +4262,11 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
4000
4262
  }
4001
4263
 
4002
4264
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
4003
- import { applyToPoint as applyToPoint25 } from "transformation-matrix";
4265
+ import { applyToPoint as applyToPoint26 } from "transformation-matrix";
4004
4266
  function createSvgObjectsFromPcbHole(hole, ctx) {
4005
4267
  const { transform, colorMap: colorMap2, showSolderMask } = ctx;
4006
4268
  const layer = ctx.layer ?? "top";
4007
- const [x, y] = applyToPoint25(transform, [hole.x, hole.y]);
4269
+ const [x, y] = applyToPoint26(transform, [hole.x, hole.y]);
4008
4270
  const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
4009
4271
  const soldermaskMargin = (hole.soldermask_margin ?? 0) * Math.abs(transform.a);
4010
4272
  const shouldShowSolderMask = showSolderMask && isCoveredWithSolderMask && soldermaskMargin !== 0;
@@ -4501,7 +4763,7 @@ import {
4501
4763
  getFullConnectivityMapFromCircuitJson
4502
4764
  } from "circuit-json-to-connectivity-map";
4503
4765
  import "svgson";
4504
- import { applyToPoint as applyToPoint26 } from "transformation-matrix";
4766
+ import { applyToPoint as applyToPoint27 } from "transformation-matrix";
4505
4767
 
4506
4768
  // lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
4507
4769
  import { su } from "@tscircuit/circuit-json-util";
@@ -4528,9 +4790,9 @@ var findNearestPointInNet = (sourcePoint, netId, connectivity, circuitJson) => {
4528
4790
  if (pos) {
4529
4791
  const dx = sourcePoint.x - pos.x;
4530
4792
  const dy = sourcePoint.y - pos.y;
4531
- const distance3 = Math.sqrt(dx * dx + dy * dy);
4532
- if (distance3 > 0 && distance3 < minDistance) {
4533
- minDistance = distance3;
4793
+ const distance4 = Math.sqrt(dx * dx + dy * dy);
4794
+ if (distance4 > 0 && distance4 < minDistance) {
4795
+ minDistance = distance4;
4534
4796
  nearestPoint = pos;
4535
4797
  }
4536
4798
  }
@@ -4581,11 +4843,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
4581
4843
  });
4582
4844
  const svgObjects = [];
4583
4845
  for (const line of ratsNestLines) {
4584
- const transformedStart = applyToPoint26(transform, [
4846
+ const transformedStart = applyToPoint27(transform, [
4585
4847
  line.startPoint.x,
4586
4848
  line.startPoint.y
4587
4849
  ]);
4588
- const transformedEnd = applyToPoint26(transform, [
4850
+ const transformedEnd = applyToPoint27(transform, [
4589
4851
  line.endPoint.x,
4590
4852
  line.endPoint.y
4591
4853
  ]);
@@ -4613,17 +4875,17 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
4613
4875
 
4614
4876
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout.ts
4615
4877
  import {
4616
- applyToPoint as applyToPoint27,
4617
- compose as compose3,
4618
- rotate as rotate3,
4619
- translate as translate3,
4620
- toString as matrixToString6
4878
+ applyToPoint as applyToPoint28,
4879
+ compose as compose4,
4880
+ rotate as rotate4,
4881
+ translate as translate4,
4882
+ toString as matrixToString7
4621
4883
  } from "transformation-matrix";
4622
4884
  function createSvgObjectsFromPcbCutout(cutout, ctx) {
4623
4885
  const { transform, colorMap: colorMap2 } = ctx;
4624
4886
  if (cutout.shape === "rect") {
4625
4887
  const rectCutout = cutout;
4626
- const [cx, cy] = applyToPoint27(transform, [
4888
+ const [cx, cy] = applyToPoint28(transform, [
4627
4889
  rectCutout.center.x,
4628
4890
  rectCutout.center.y
4629
4891
  ]);
@@ -4641,8 +4903,8 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
4641
4903
  width: scaledWidth.toString(),
4642
4904
  height: scaledHeight.toString(),
4643
4905
  fill: colorMap2.drill,
4644
- transform: matrixToString6(
4645
- compose3(translate3(cx, cy), rotate3(svgRotation * Math.PI / 180))
4906
+ transform: matrixToString7(
4907
+ compose4(translate4(cx, cy), rotate4(svgRotation * Math.PI / 180))
4646
4908
  ),
4647
4909
  "data-type": "pcb_cutout",
4648
4910
  "data-pcb-layer": "drill"
@@ -4665,7 +4927,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
4665
4927
  }
4666
4928
  if (cutout.shape === "circle") {
4667
4929
  const circleCutout = cutout;
4668
- const [cx, cy] = applyToPoint27(transform, [
4930
+ const [cx, cy] = applyToPoint28(transform, [
4669
4931
  circleCutout.center.x,
4670
4932
  circleCutout.center.y
4671
4933
  ]);
@@ -4692,7 +4954,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
4692
4954
  const polygonCutout = cutout;
4693
4955
  if (!polygonCutout.points || polygonCutout.points.length === 0) return [];
4694
4956
  const transformedPoints = polygonCutout.points.map(
4695
- (p) => applyToPoint27(transform, [p.x, p.y])
4957
+ (p) => applyToPoint28(transform, [p.x, p.y])
4696
4958
  );
4697
4959
  const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
4698
4960
  return [
@@ -4716,19 +4978,19 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
4716
4978
 
4717
4979
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
4718
4980
  import {
4719
- applyToPoint as applyToPoint29,
4720
- compose as compose4,
4721
- rotate as rotate4,
4722
- toString as matrixToString7,
4723
- translate as translate4
4981
+ applyToPoint as applyToPoint30,
4982
+ compose as compose5,
4983
+ rotate as rotate5,
4984
+ toString as matrixToString8,
4985
+ translate as translate5
4724
4986
  } from "transformation-matrix";
4725
4987
 
4726
4988
  // lib/utils/ring-to-path-d.ts
4727
- import { applyToPoint as applyToPoint28 } from "transformation-matrix";
4989
+ import { applyToPoint as applyToPoint29 } from "transformation-matrix";
4728
4990
  function ringToPathD(vertices, transform) {
4729
4991
  if (vertices.length === 0) return "";
4730
4992
  const transformedVertices = vertices.map((v) => {
4731
- const [x, y] = applyToPoint28(transform, [v.x, v.y]);
4993
+ const [x, y] = applyToPoint29(transform, [v.x, v.y]);
4732
4994
  return { ...v, x, y };
4733
4995
  });
4734
4996
  let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
@@ -4817,7 +5079,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
4817
5079
  const maskOverlayColor = layer === "bottom" ? colorMap2.soldermaskOverCopper.bottom : colorMap2.soldermaskOverCopper.top;
4818
5080
  const maskOverlayOpacity = "0.9";
4819
5081
  if (pour.shape === "rect") {
4820
- const [cx, cy] = applyToPoint29(transform, [pour.center.x, pour.center.y]);
5082
+ const [cx, cy] = applyToPoint30(transform, [pour.center.x, pour.center.y]);
4821
5083
  const scaledWidth = pour.width * Math.abs(transform.a);
4822
5084
  const scaledHeight = pour.height * Math.abs(transform.d);
4823
5085
  const svgRotation = -(pour.rotation ?? 0);
@@ -4826,8 +5088,8 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
4826
5088
  y: (-scaledHeight / 2).toString(),
4827
5089
  width: scaledWidth.toString(),
4828
5090
  height: scaledHeight.toString(),
4829
- transform: matrixToString7(
4830
- compose4(translate4(cx, cy), rotate4(svgRotation * Math.PI / 180))
5091
+ transform: matrixToString8(
5092
+ compose5(translate5(cx, cy), rotate5(svgRotation * Math.PI / 180))
4831
5093
  )
4832
5094
  };
4833
5095
  const copperRect = {
@@ -4869,7 +5131,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
4869
5131
  if (pour.shape === "polygon") {
4870
5132
  if (!pour.points || pour.points.length === 0) return [];
4871
5133
  const transformedPoints = pour.points.map(
4872
- (p) => applyToPoint29(transform, [p.x, p.y])
5134
+ (p) => applyToPoint30(transform, [p.x, p.y])
4873
5135
  );
4874
5136
  const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
4875
5137
  const copperPolygon = {
@@ -5092,11 +5354,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
5092
5354
  }
5093
5355
 
5094
5356
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
5095
- import { applyToPoint as applyToPoint30 } from "transformation-matrix";
5357
+ import { applyToPoint as applyToPoint31 } from "transformation-matrix";
5096
5358
  function createSvgObjectsFromPcbComponent(component, ctx) {
5097
5359
  const { transform, circuitJson } = ctx;
5098
5360
  const { center, width, height, rotation = 0 } = component;
5099
- const [x, y] = applyToPoint30(transform, [center.x, center.y]);
5361
+ const [x, y] = applyToPoint31(transform, [center.x, center.y]);
5100
5362
  const scaledWidth = width * Math.abs(transform.a);
5101
5363
  const scaledHeight = height * Math.abs(transform.d);
5102
5364
  const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
@@ -5151,7 +5413,7 @@ function createSvgObjectsFromPcbComponent(component, ctx) {
5151
5413
  }
5152
5414
 
5153
5415
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
5154
- import { applyToPoint as applyToPoint31 } from "transformation-matrix";
5416
+ import { applyToPoint as applyToPoint32 } from "transformation-matrix";
5155
5417
  var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
5156
5418
  var DEFAULT_STROKE_WIDTH = 0.1;
5157
5419
  function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
@@ -5178,7 +5440,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
5178
5440
  (point) => point && typeof point.x === "number" && typeof point.y === "number"
5179
5441
  )) {
5180
5442
  const path = outline.map((point, index) => {
5181
- const [x, y] = applyToPoint31(transform, [point.x, point.y]);
5443
+ const [x, y] = applyToPoint32(transform, [point.x, point.y]);
5182
5444
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
5183
5445
  }).join(" ");
5184
5446
  return [
@@ -5200,11 +5462,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
5200
5462
  }
5201
5463
  const halfWidth = width / 2;
5202
5464
  const halfHeight = height / 2;
5203
- const [topLeftX, topLeftY] = applyToPoint31(transform, [
5465
+ const [topLeftX, topLeftY] = applyToPoint32(transform, [
5204
5466
  center.x - halfWidth,
5205
5467
  center.y + halfHeight
5206
5468
  ]);
5207
- const [bottomRightX, bottomRightY] = applyToPoint31(transform, [
5469
+ const [bottomRightX, bottomRightY] = applyToPoint32(transform, [
5208
5470
  center.x + halfWidth,
5209
5471
  center.y - halfHeight
5210
5472
  ]);
@@ -5240,7 +5502,7 @@ function getSoftwareUsedString(circuitJson) {
5240
5502
  var package_default = {
5241
5503
  name: "circuit-to-svg",
5242
5504
  type: "module",
5243
- version: "0.0.283",
5505
+ version: "0.0.285",
5244
5506
  description: "Convert Circuit JSON to SVG",
5245
5507
  main: "dist/index.js",
5246
5508
  files: [
@@ -5258,13 +5520,14 @@ var package_default = {
5258
5520
  license: "ISC",
5259
5521
  devDependencies: {
5260
5522
  "@biomejs/biome": "^1.9.4",
5523
+ "@tscircuit/alphabet": "^0.0.8",
5261
5524
  "@types/bun": "^1.2.8",
5262
5525
  "@vitejs/plugin-react": "5.0.0",
5263
5526
  biome: "^0.3.3",
5264
5527
  "bun-match-svg": "^0.0.12",
5528
+ "circuit-json": "^0.0.327",
5265
5529
  esbuild: "^0.20.2",
5266
5530
  "performance-now": "^2.1.0",
5267
- "circuit-json": "^0.0.327",
5268
5531
  react: "19.1.0",
5269
5532
  "react-cosmos": "7.0.0",
5270
5533
  "react-cosmos-plugin-vite": "7.0.0",
@@ -5274,6 +5537,9 @@ var package_default = {
5274
5537
  typescript: "^5.4.5",
5275
5538
  "vite-tsconfig-paths": "^5.0.1"
5276
5539
  },
5540
+ peerDependencies: {
5541
+ "@tscircuit/alphabet": "*"
5542
+ },
5277
5543
  dependencies: {
5278
5544
  "@types/node": "^22.5.5",
5279
5545
  "bun-types": "^1.1.40",
@@ -5469,8 +5735,8 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
5469
5735
  for (const circuitJsonElm of circuitJson) {
5470
5736
  if (circuitJsonElm.type === "pcb_panel") {
5471
5737
  const panel = circuitJsonElm;
5472
- const width = distance.parse(panel.width);
5473
- const height = distance.parse(panel.height);
5738
+ const width = distance2.parse(panel.width);
5739
+ const height = distance2.parse(panel.height);
5474
5740
  if (width === void 0 || height === void 0) {
5475
5741
  continue;
5476
5742
  }
@@ -5497,7 +5763,7 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
5497
5763
  if (pad.shape === "rect" || pad.shape === "rotated_rect" || pad.shape === "pill") {
5498
5764
  updateBounds({ x: pad.x, y: pad.y }, pad.width, pad.height);
5499
5765
  } else if (pad.shape === "circle") {
5500
- const radius = distance.parse(pad.radius);
5766
+ const radius = distance2.parse(pad.radius);
5501
5767
  if (radius !== void 0) {
5502
5768
  updateBounds({ x: pad.x, y: pad.y }, radius * 2, radius * 2);
5503
5769
  }
@@ -5519,7 +5785,7 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
5519
5785
  if (cutout.shape === "rect") {
5520
5786
  updateBounds(cutout.center, cutout.width, cutout.height);
5521
5787
  } else if (cutout.shape === "circle") {
5522
- const radius = distance.parse(cutout.radius);
5788
+ const radius = distance2.parse(cutout.radius);
5523
5789
  if (radius !== void 0) {
5524
5790
  updateBounds(cutout.center, radius * 2, radius * 2);
5525
5791
  }
@@ -5528,6 +5794,8 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
5528
5794
  }
5529
5795
  } else if (circuitJsonElm.type === "pcb_silkscreen_text" || circuitJsonElm.type === "pcb_silkscreen_rect" || circuitJsonElm.type === "pcb_silkscreen_circle" || circuitJsonElm.type === "pcb_silkscreen_line") {
5530
5796
  updateSilkscreenBounds(circuitJsonElm);
5797
+ } else if (circuitJsonElm.type === "pcb_copper_text") {
5798
+ updateBounds(circuitJsonElm.anchor_position, 0, 0);
5531
5799
  } else if (circuitJsonElm.type === "pcb_copper_pour") {
5532
5800
  if (circuitJsonElm.shape === "rect") {
5533
5801
  updateBounds(
@@ -5574,12 +5842,12 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
5574
5842
  const scaleFactor = Math.min(scaleX, scaleY);
5575
5843
  const offsetX = (svgWidth - circuitWidth * scaleFactor) / 2;
5576
5844
  const offsetY = (svgHeight - circuitHeight * scaleFactor) / 2;
5577
- const transform = compose5(
5578
- translate5(
5845
+ const transform = compose6(
5846
+ translate6(
5579
5847
  offsetX - boundsMinX * scaleFactor + padding * scaleFactor,
5580
5848
  svgHeight - offsetY + boundsMinY * scaleFactor - padding * scaleFactor
5581
5849
  ),
5582
- scale2(scaleFactor, -scaleFactor)
5850
+ scale3(scaleFactor, -scaleFactor)
5583
5851
  // Flip in y-direction
5584
5852
  );
5585
5853
  const ctx = {
@@ -5695,11 +5963,11 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
5695
5963
  }
5696
5964
  function updateBounds(center, width, height) {
5697
5965
  if (!center) return;
5698
- const centerX = distance.parse(center.x);
5699
- const centerY = distance.parse(center.y);
5966
+ const centerX = distance2.parse(center.x);
5967
+ const centerY = distance2.parse(center.y);
5700
5968
  if (centerX === void 0 || centerY === void 0) return;
5701
- const numericWidth = distance.parse(width) ?? 0;
5702
- const numericHeight = distance.parse(height) ?? 0;
5969
+ const numericWidth = distance2.parse(width) ?? 0;
5970
+ const numericHeight = distance2.parse(height) ?? 0;
5703
5971
  const halfWidth = numericWidth / 2;
5704
5972
  const halfHeight = numericHeight / 2;
5705
5973
  minX = Math.min(minX, centerX - halfWidth);
@@ -5710,11 +5978,11 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
5710
5978
  }
5711
5979
  function updateBoardBounds(center, width, height) {
5712
5980
  if (!center) return;
5713
- const centerX = distance.parse(center.x);
5714
- const centerY = distance.parse(center.y);
5981
+ const centerX = distance2.parse(center.x);
5982
+ const centerY = distance2.parse(center.y);
5715
5983
  if (centerX === void 0 || centerY === void 0) return;
5716
- const numericWidth = distance.parse(width) ?? 0;
5717
- const numericHeight = distance.parse(height) ?? 0;
5984
+ const numericWidth = distance2.parse(width) ?? 0;
5985
+ const numericHeight = distance2.parse(height) ?? 0;
5718
5986
  const halfWidth = numericWidth / 2;
5719
5987
  const halfHeight = numericHeight / 2;
5720
5988
  boardMinX = Math.min(boardMinX, centerX - halfWidth);
@@ -5727,8 +5995,8 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
5727
5995
  function updateBoundsToIncludeOutline(outline) {
5728
5996
  let updated = false;
5729
5997
  for (const point of outline) {
5730
- const x = distance.parse(point.x);
5731
- const y = distance.parse(point.y);
5998
+ const x = distance2.parse(point.x);
5999
+ const y = distance2.parse(point.y);
5732
6000
  if (x === void 0 || y === void 0) continue;
5733
6001
  minX = Math.min(minX, x);
5734
6002
  minY = Math.min(minY, y);
@@ -5743,8 +6011,8 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
5743
6011
  function updateBoardBoundsToIncludeOutline(outline) {
5744
6012
  let updated = false;
5745
6013
  for (const point of outline) {
5746
- const x = distance.parse(point.x);
5747
- const y = distance.parse(point.y);
6014
+ const x = distance2.parse(point.x);
6015
+ const y = distance2.parse(point.y);
5748
6016
  if (x === void 0 || y === void 0) continue;
5749
6017
  boardMinX = Math.min(boardMinX, x);
5750
6018
  boardMinY = Math.min(boardMinY, y);
@@ -5760,8 +6028,8 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
5760
6028
  function updateTraceBounds(route) {
5761
6029
  let updated = false;
5762
6030
  for (const point of route) {
5763
- const x = distance.parse(point?.x);
5764
- const y = distance.parse(point?.y);
6031
+ const x = distance2.parse(point?.x);
6032
+ const y = distance2.parse(point?.y);
5765
6033
  if (x === void 0 || y === void 0) continue;
5766
6034
  minX = Math.min(minX, x);
5767
6035
  minY = Math.min(minY, y);
@@ -5781,7 +6049,7 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
5781
6049
  } else if (item.type === "pcb_silkscreen_rect") {
5782
6050
  updateBounds(item.center, item.width, item.height);
5783
6051
  } else if (item.type === "pcb_silkscreen_circle") {
5784
- const radius = distance.parse(item.radius);
6052
+ const radius = distance2.parse(item.radius);
5785
6053
  if (radius !== void 0) {
5786
6054
  updateBounds(item.center, radius * 2, radius * 2);
5787
6055
  }
@@ -5793,7 +6061,7 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
5793
6061
  if (cutout.shape === "rect") {
5794
6062
  updateBounds(cutout.center, cutout.width, cutout.height);
5795
6063
  } else if (cutout.shape === "circle") {
5796
- const radius = distance.parse(cutout.radius);
6064
+ const radius = distance2.parse(cutout.radius);
5797
6065
  if (radius !== void 0) {
5798
6066
  updateBounds(cutout.center, radius * 2, radius * 2);
5799
6067
  }
@@ -5839,6 +6107,8 @@ function createSvgObjects({
5839
6107
  return createSvgObjectsFromPcbSilkscreenCircle(elm, ctx);
5840
6108
  case "pcb_silkscreen_line":
5841
6109
  return createSvgObjectsFromPcbSilkscreenLine(elm, ctx);
6110
+ case "pcb_copper_text":
6111
+ return createSvgObjectsFromPcbCopperText(elm, ctx);
5842
6112
  case "pcb_courtyard_rect":
5843
6113
  if (!ctx.showCourtyards) return [];
5844
6114
  return createSvgObjectsFromPcbCourtyardRect(elm, ctx);
@@ -5877,8 +6147,8 @@ function createSvgObjects({
5877
6147
  }
5878
6148
  }
5879
6149
  function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
5880
- const [x1, y1] = applyToPoint32(transform, [minX, minY]);
5881
- const [x2, y2] = applyToPoint32(transform, [maxX, maxY]);
6150
+ const [x1, y1] = applyToPoint33(transform, [minX, minY]);
6151
+ const [x2, y2] = applyToPoint33(transform, [maxX, maxY]);
5882
6152
  const width = Math.abs(x2 - x1);
5883
6153
  const height = Math.abs(y2 - y1);
5884
6154
  const x = Math.min(x1, x2);
@@ -5908,14 +6178,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
5908
6178
  import { stringify as stringify2 } from "svgson";
5909
6179
  import { su as su3 } from "@tscircuit/circuit-json-util";
5910
6180
  import {
5911
- applyToPoint as applyToPoint39,
5912
- compose as compose6,
5913
- scale as scale3,
5914
- translate as translate6
6181
+ applyToPoint as applyToPoint40,
6182
+ compose as compose7,
6183
+ scale as scale4,
6184
+ translate as translate7
5915
6185
  } from "transformation-matrix";
5916
6186
 
5917
6187
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
5918
- import { applyToPoint as applyToPoint33 } from "transformation-matrix";
6188
+ import { applyToPoint as applyToPoint34 } from "transformation-matrix";
5919
6189
  var DEFAULT_BOARD_STYLE = {
5920
6190
  fill: "none",
5921
6191
  stroke: "rgb(0,0,0)",
@@ -5927,25 +6197,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
5927
6197
  let path;
5928
6198
  if (outline && Array.isArray(outline) && outline.length >= 3) {
5929
6199
  path = outline.map((point, index) => {
5930
- const [x, y] = applyToPoint33(transform, [point.x, point.y]);
6200
+ const [x, y] = applyToPoint34(transform, [point.x, point.y]);
5931
6201
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
5932
6202
  }).join(" ");
5933
6203
  } else {
5934
6204
  const halfWidth = width / 2;
5935
6205
  const halfHeight = height / 2;
5936
- const topLeft = applyToPoint33(transform, [
6206
+ const topLeft = applyToPoint34(transform, [
5937
6207
  center.x - halfWidth,
5938
6208
  center.y - halfHeight
5939
6209
  ]);
5940
- const topRight = applyToPoint33(transform, [
6210
+ const topRight = applyToPoint34(transform, [
5941
6211
  center.x + halfWidth,
5942
6212
  center.y - halfHeight
5943
6213
  ]);
5944
- const bottomRight = applyToPoint33(transform, [
6214
+ const bottomRight = applyToPoint34(transform, [
5945
6215
  center.x + halfWidth,
5946
6216
  center.y + halfHeight
5947
6217
  ]);
5948
- const bottomLeft = applyToPoint33(transform, [
6218
+ const bottomLeft = applyToPoint34(transform, [
5949
6219
  center.x - halfWidth,
5950
6220
  center.y + halfHeight
5951
6221
  ]);
@@ -5971,7 +6241,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
5971
6241
  }
5972
6242
 
5973
6243
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
5974
- import { applyToPoint as applyToPoint35 } from "transformation-matrix";
6244
+ import { applyToPoint as applyToPoint36 } from "transformation-matrix";
5975
6245
 
5976
6246
  // lib/utils/get-sch-font-size.ts
5977
6247
  import "transformation-matrix";
@@ -5997,8 +6267,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
5997
6267
  const { center, width, height, rotation = 0, layer = "top" } = elm;
5998
6268
  if (!center || typeof width !== "number" || typeof height !== "number")
5999
6269
  return null;
6000
- const [x, y] = applyToPoint35(transform, [center.x, center.y]);
6001
- const [pinX, pinY] = applyToPoint35(transform, [portPosition.x, portPosition.y]);
6270
+ const [x, y] = applyToPoint36(transform, [center.x, center.y]);
6271
+ const [pinX, pinY] = applyToPoint36(transform, [portPosition.x, portPosition.y]);
6002
6272
  const scaledWidth = width * Math.abs(transform.a);
6003
6273
  const scaledHeight = height * Math.abs(transform.d);
6004
6274
  const isTopLayer = layer === "top";
@@ -6160,11 +6430,11 @@ function getRectPathData(w, h, rotation) {
6160
6430
  }
6161
6431
 
6162
6432
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
6163
- import { applyToPoint as applyToPoint36 } from "transformation-matrix";
6433
+ import { applyToPoint as applyToPoint37 } from "transformation-matrix";
6164
6434
  var HOLE_COLOR2 = "rgb(190, 190, 190)";
6165
6435
  function createSvgObjectsFromAssemblyHole(hole, ctx) {
6166
6436
  const { transform } = ctx;
6167
- const [x, y] = applyToPoint36(transform, [hole.x, hole.y]);
6437
+ const [x, y] = applyToPoint37(transform, [hole.x, hole.y]);
6168
6438
  if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
6169
6439
  const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
6170
6440
  const radius = scaledDiameter / 2;
@@ -6228,12 +6498,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
6228
6498
  }
6229
6499
 
6230
6500
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
6231
- import { applyToPoint as applyToPoint37 } from "transformation-matrix";
6501
+ import { applyToPoint as applyToPoint38 } from "transformation-matrix";
6232
6502
  var PAD_COLOR = "rgb(210, 210, 210)";
6233
6503
  var HOLE_COLOR3 = "rgb(190, 190, 190)";
6234
6504
  function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
6235
6505
  const { transform } = ctx;
6236
- const [x, y] = applyToPoint37(transform, [hole.x, hole.y]);
6506
+ const [x, y] = applyToPoint38(transform, [hole.x, hole.y]);
6237
6507
  if (hole.shape === "pill") {
6238
6508
  const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
6239
6509
  const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
@@ -6328,7 +6598,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
6328
6598
  const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
6329
6599
  const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
6330
6600
  const holeRadius = scaledHoleDiameter / 2;
6331
- const [holeCx, holeCy] = applyToPoint37(transform, [
6601
+ const [holeCx, holeCy] = applyToPoint38(transform, [
6332
6602
  circularHole.x + circularHole.hole_offset_x,
6333
6603
  circularHole.y + circularHole.hole_offset_y
6334
6604
  ]);
@@ -6386,7 +6656,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
6386
6656
  const pillHoleWithOffsets = pillHole;
6387
6657
  const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
6388
6658
  const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
6389
- const [holeCenterX, holeCenterY] = applyToPoint37(transform, [
6659
+ const [holeCenterX, holeCenterY] = applyToPoint38(transform, [
6390
6660
  pillHole.x + holeOffsetX,
6391
6661
  pillHole.y + holeOffsetY
6392
6662
  ]);
@@ -6448,7 +6718,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
6448
6718
  const rotatedHoleWithOffsets = rotatedHole;
6449
6719
  const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
6450
6720
  const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
6451
- const [holeCenterX, holeCenterY] = applyToPoint37(transform, [
6721
+ const [holeCenterX, holeCenterY] = applyToPoint38(transform, [
6452
6722
  rotatedHole.x + holeOffsetX,
6453
6723
  rotatedHole.y + holeOffsetY
6454
6724
  ]);
@@ -6504,14 +6774,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
6504
6774
  }
6505
6775
 
6506
6776
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
6507
- import { applyToPoint as applyToPoint38 } from "transformation-matrix";
6777
+ import { applyToPoint as applyToPoint39 } from "transformation-matrix";
6508
6778
  var PAD_COLOR2 = "rgb(210, 210, 210)";
6509
6779
  function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
6510
6780
  const { transform } = ctx;
6511
6781
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
6512
6782
  const width = pad.width * Math.abs(transform.a);
6513
6783
  const height = pad.height * Math.abs(transform.d);
6514
- const [x, y] = applyToPoint38(transform, [pad.x, pad.y]);
6784
+ const [x, y] = applyToPoint39(transform, [pad.x, pad.y]);
6515
6785
  const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
6516
6786
  if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
6517
6787
  return [
@@ -6563,7 +6833,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
6563
6833
  const width = pad.width * Math.abs(transform.a);
6564
6834
  const height = pad.height * Math.abs(transform.d);
6565
6835
  const radius = pad.radius * Math.abs(transform.a);
6566
- const [x, y] = applyToPoint38(transform, [pad.x, pad.y]);
6836
+ const [x, y] = applyToPoint39(transform, [pad.x, pad.y]);
6567
6837
  return [
6568
6838
  {
6569
6839
  name: "rect",
@@ -6586,7 +6856,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
6586
6856
  }
6587
6857
  if (pad.shape === "circle") {
6588
6858
  const radius = pad.radius * Math.abs(transform.a);
6589
- const [x, y] = applyToPoint38(transform, [pad.x, pad.y]);
6859
+ const [x, y] = applyToPoint39(transform, [pad.x, pad.y]);
6590
6860
  return [
6591
6861
  {
6592
6862
  name: "circle",
@@ -6606,7 +6876,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
6606
6876
  }
6607
6877
  if (pad.shape === "polygon") {
6608
6878
  const points = (pad.points ?? []).map(
6609
- (point) => applyToPoint38(transform, [point.x, point.y])
6879
+ (point) => applyToPoint39(transform, [point.x, point.y])
6610
6880
  );
6611
6881
  return [
6612
6882
  {
@@ -6660,12 +6930,12 @@ function convertCircuitJsonToAssemblySvg(soup, options) {
6660
6930
  const scaleFactor = Math.min(scaleX, scaleY);
6661
6931
  const offsetX = (svgWidth - circuitWidth * scaleFactor) / 2;
6662
6932
  const offsetY = (svgHeight - circuitHeight * scaleFactor) / 2;
6663
- const transform = compose6(
6664
- translate6(
6933
+ const transform = compose7(
6934
+ translate7(
6665
6935
  offsetX - minX * scaleFactor + padding * scaleFactor,
6666
6936
  svgHeight - offsetY + minY * scaleFactor - padding * scaleFactor
6667
6937
  ),
6668
- scale3(scaleFactor, -scaleFactor)
6938
+ scale4(scaleFactor, -scaleFactor)
6669
6939
  // Flip in y-direction
6670
6940
  );
6671
6941
  const ctx = { transform };
@@ -6790,8 +7060,8 @@ function createSvgObjects2(elm, ctx, soup) {
6790
7060
  }
6791
7061
  }
6792
7062
  function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
6793
- const [x1, y1] = applyToPoint39(transform, [minX, minY]);
6794
- const [x2, y2] = applyToPoint39(transform, [maxX, maxY]);
7063
+ const [x1, y1] = applyToPoint40(transform, [minX, minY]);
7064
+ const [x2, y2] = applyToPoint40(transform, [maxX, maxY]);
6795
7065
  const width = Math.abs(x2 - x1);
6796
7066
  const height = Math.abs(y2 - y1);
6797
7067
  const x = Math.min(x1, x2);
@@ -6814,13 +7084,13 @@ function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY)
6814
7084
  // lib/pinout/convert-circuit-json-to-pinout-svg.ts
6815
7085
  import { stringify as stringify3 } from "svgson";
6816
7086
  import {
6817
- compose as compose7,
7087
+ compose as compose8,
6818
7088
  scale as matrixScale,
6819
- translate as translate7
7089
+ translate as translate8
6820
7090
  } from "transformation-matrix";
6821
7091
 
6822
7092
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
6823
- import { applyToPoint as applyToPoint40 } from "transformation-matrix";
7093
+ import { applyToPoint as applyToPoint41 } from "transformation-matrix";
6824
7094
  import { su as su4 } from "@tscircuit/circuit-json-util";
6825
7095
  var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
6826
7096
  var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
@@ -6834,25 +7104,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
6834
7104
  let path;
6835
7105
  if (outline && Array.isArray(outline) && outline.length >= 3) {
6836
7106
  path = outline.map((point, index) => {
6837
- const [x, y] = applyToPoint40(transform, [point.x, point.y]);
7107
+ const [x, y] = applyToPoint41(transform, [point.x, point.y]);
6838
7108
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
6839
7109
  }).join(" ");
6840
7110
  } else {
6841
7111
  const halfWidth = width / 2;
6842
7112
  const halfHeight = height / 2;
6843
- const topLeft = applyToPoint40(transform, [
7113
+ const topLeft = applyToPoint41(transform, [
6844
7114
  center.x - halfWidth,
6845
7115
  center.y - halfHeight
6846
7116
  ]);
6847
- const topRight = applyToPoint40(transform, [
7117
+ const topRight = applyToPoint41(transform, [
6848
7118
  center.x + halfWidth,
6849
7119
  center.y - halfHeight
6850
7120
  ]);
6851
- const bottomRight = applyToPoint40(transform, [
7121
+ const bottomRight = applyToPoint41(transform, [
6852
7122
  center.x + halfWidth,
6853
7123
  center.y + halfHeight
6854
7124
  ]);
6855
- const bottomLeft = applyToPoint40(transform, [
7125
+ const bottomLeft = applyToPoint41(transform, [
6856
7126
  center.x - halfWidth,
6857
7127
  center.y + halfHeight
6858
7128
  ]);
@@ -6870,10 +7140,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
6870
7140
  const halfWidth = width2 / 2;
6871
7141
  const halfHeight = height2 / 2;
6872
7142
  const [tl, tr, br, bl] = [
6873
- applyToPoint40(transform, [x - halfWidth, y - halfHeight]),
6874
- applyToPoint40(transform, [x + halfWidth, y - halfHeight]),
6875
- applyToPoint40(transform, [x + halfWidth, y + halfHeight]),
6876
- applyToPoint40(transform, [x - halfWidth, y + halfHeight])
7143
+ applyToPoint41(transform, [x - halfWidth, y - halfHeight]),
7144
+ applyToPoint41(transform, [x + halfWidth, y - halfHeight]),
7145
+ applyToPoint41(transform, [x + halfWidth, y + halfHeight]),
7146
+ applyToPoint41(transform, [x - halfWidth, y + halfHeight])
6877
7147
  ];
6878
7148
  path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
6879
7149
  } else if (cutout.shape === "circle") {
@@ -6923,7 +7193,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
6923
7193
 
6924
7194
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
6925
7195
  import { su as su5 } from "@tscircuit/circuit-json-util";
6926
- import { applyToPoint as applyToPoint41 } from "transformation-matrix";
7196
+ import { applyToPoint as applyToPoint42 } from "transformation-matrix";
6927
7197
  var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
6928
7198
  var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
6929
7199
  function createSvgObjectsFromPinoutComponent(elm, ctx) {
@@ -6933,7 +7203,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
6933
7203
  if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
6934
7204
  return [];
6935
7205
  }
6936
- const [x, y] = applyToPoint41(transform, [center.x, center.y]);
7206
+ const [x, y] = applyToPoint42(transform, [center.x, center.y]);
6937
7207
  const scaledWidth = width * Math.abs(transform.a);
6938
7208
  const scaledHeight = height * Math.abs(transform.d);
6939
7209
  const transformStr = `translate(${x}, ${y})`;
@@ -6994,11 +7264,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
6994
7264
  }
6995
7265
 
6996
7266
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
6997
- import { applyToPoint as applyToPoint42 } from "transformation-matrix";
7267
+ import { applyToPoint as applyToPoint43 } from "transformation-matrix";
6998
7268
  var HOLE_COLOR4 = "rgb(50, 50, 50)";
6999
7269
  function createSvgObjectsFromPinoutHole(hole, ctx) {
7000
7270
  const { transform } = ctx;
7001
- const [x, y] = applyToPoint42(transform, [hole.x, hole.y]);
7271
+ const [x, y] = applyToPoint43(transform, [hole.x, hole.y]);
7002
7272
  if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
7003
7273
  const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
7004
7274
  const radius = scaledDiameter / 2;
@@ -7062,12 +7332,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
7062
7332
  }
7063
7333
 
7064
7334
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
7065
- import { applyToPoint as applyToPoint43 } from "transformation-matrix";
7335
+ import { applyToPoint as applyToPoint44 } from "transformation-matrix";
7066
7336
  var PAD_COLOR3 = "rgb(218, 165, 32)";
7067
7337
  var HOLE_COLOR5 = "rgb(40, 40, 40)";
7068
7338
  function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
7069
7339
  const { transform } = ctx;
7070
- const [x, y] = applyToPoint43(transform, [hole.x, hole.y]);
7340
+ const [x, y] = applyToPoint44(transform, [hole.x, hole.y]);
7071
7341
  if (hole.shape === "pill") {
7072
7342
  const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
7073
7343
  const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
@@ -7302,14 +7572,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
7302
7572
  }
7303
7573
 
7304
7574
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
7305
- import { applyToPoint as applyToPoint44 } from "transformation-matrix";
7575
+ import { applyToPoint as applyToPoint45 } from "transformation-matrix";
7306
7576
  var PAD_COLOR4 = "rgb(218, 165, 32)";
7307
7577
  function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
7308
7578
  const { transform } = ctx;
7309
7579
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
7310
7580
  const width = pad.width * Math.abs(transform.a);
7311
7581
  const height = pad.height * Math.abs(transform.d);
7312
- const [x, y] = applyToPoint44(transform, [pad.x, pad.y]);
7582
+ const [x, y] = applyToPoint45(transform, [pad.x, pad.y]);
7313
7583
  if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
7314
7584
  return [
7315
7585
  {
@@ -7352,7 +7622,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
7352
7622
  const width = pad.width * Math.abs(transform.a);
7353
7623
  const height = pad.height * Math.abs(transform.d);
7354
7624
  const radius = pad.radius * Math.abs(transform.a);
7355
- const [x, y] = applyToPoint44(transform, [pad.x, pad.y]);
7625
+ const [x, y] = applyToPoint45(transform, [pad.x, pad.y]);
7356
7626
  return [
7357
7627
  {
7358
7628
  name: "rect",
@@ -7375,7 +7645,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
7375
7645
  }
7376
7646
  if (pad.shape === "circle") {
7377
7647
  const radius = pad.radius * Math.abs(transform.a);
7378
- const [x, y] = applyToPoint44(transform, [pad.x, pad.y]);
7648
+ const [x, y] = applyToPoint45(transform, [pad.x, pad.y]);
7379
7649
  return [
7380
7650
  {
7381
7651
  name: "circle",
@@ -7395,7 +7665,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
7395
7665
  }
7396
7666
  if (pad.shape === "polygon") {
7397
7667
  const points = (pad.points ?? []).map(
7398
- (point) => applyToPoint44(transform, [point.x, point.y])
7668
+ (point) => applyToPoint45(transform, [point.x, point.y])
7399
7669
  );
7400
7670
  return [
7401
7671
  {
@@ -7416,7 +7686,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
7416
7686
  }
7417
7687
 
7418
7688
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
7419
- import { applyToPoint as applyToPoint45 } from "transformation-matrix";
7689
+ import { applyToPoint as applyToPoint46 } from "transformation-matrix";
7420
7690
  import { calculateElbow } from "calculate-elbow";
7421
7691
 
7422
7692
  // lib/pinout/svg-object-fns/pinout-label-box.ts
@@ -7493,7 +7763,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
7493
7763
  const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
7494
7764
  if (!label_info) return [];
7495
7765
  const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
7496
- const [port_x, port_y] = applyToPoint45(ctx.transform, [pcb_port.x, pcb_port.y]);
7766
+ const [port_x, port_y] = applyToPoint46(ctx.transform, [pcb_port.x, pcb_port.y]);
7497
7767
  const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
7498
7768
  const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
7499
7769
  const elbow_path = calculateElbow(
@@ -7634,7 +7904,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
7634
7904
  }
7635
7905
 
7636
7906
  // lib/pinout/calculate-label-positions.ts
7637
- import { applyToPoint as applyToPoint46 } from "transformation-matrix";
7907
+ import { applyToPoint as applyToPoint47 } from "transformation-matrix";
7638
7908
 
7639
7909
  // lib/pinout/constants.ts
7640
7910
  var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
@@ -7672,7 +7942,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
7672
7942
  );
7673
7943
  const mapToEdgePort = (pinout_label) => ({
7674
7944
  pcb_port: pinout_label.pcb_port,
7675
- y: applyToPoint46(transform, [
7945
+ y: applyToPoint47(transform, [
7676
7946
  pinout_label.pcb_port.x,
7677
7947
  pinout_label.pcb_port.y
7678
7948
  ])[1],
@@ -7687,7 +7957,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
7687
7957
  } else {
7688
7958
  edge_ports = pinout_labels.map((pinout_label) => ({
7689
7959
  pcb_port: pinout_label.pcb_port,
7690
- y: applyToPoint46(transform, [
7960
+ y: applyToPoint47(transform, [
7691
7961
  pinout_label.pcb_port.x,
7692
7962
  pinout_label.pcb_port.y
7693
7963
  ])[1],
@@ -7695,7 +7965,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
7695
7965
  })).sort((a, b) => a.y - b.y);
7696
7966
  }
7697
7967
  if (edge_ports.length === 0) return;
7698
- const board_edge_x = applyToPoint46(transform, [
7968
+ const board_edge_x = applyToPoint47(transform, [
7699
7969
  edge === "left" ? board_bounds.minX : board_bounds.maxX,
7700
7970
  0
7701
7971
  ])[0];
@@ -8015,8 +8285,8 @@ function convertCircuitJsonToPinoutSvg(soup, options) {
8015
8285
  const pxPerMm = Math.min(pxPerMmX, pxPerMmY);
8016
8286
  const offsetX = (svgWidth - circuitWidth * pxPerMm) / 2;
8017
8287
  const offsetY = (svgHeight - circuitHeight * pxPerMm) / 2;
8018
- const transform = compose7(
8019
- translate7(
8288
+ const transform = compose8(
8289
+ translate8(
8020
8290
  offsetX - expandedMinX * pxPerMm + paddingMm * pxPerMm,
8021
8291
  svgHeight - offsetY + minY * pxPerMm - paddingMm * pxPerMm
8022
8292
  ),
@@ -8117,14 +8387,14 @@ import {
8117
8387
  } from "transformation-matrix";
8118
8388
 
8119
8389
  // lib/sch/draw-schematic-grid.ts
8120
- import { applyToPoint as applyToPoint47 } from "transformation-matrix";
8390
+ import { applyToPoint as applyToPoint48 } from "transformation-matrix";
8121
8391
  function drawSchematicGrid(params) {
8122
8392
  const { minX, minY, maxX, maxY } = params.bounds;
8123
8393
  const cellSize = params.cellSize ?? 1;
8124
8394
  const labelCells = params.labelCells ?? false;
8125
8395
  const gridLines = [];
8126
8396
  const transformPoint = (x, y) => {
8127
- const [transformedX, transformedY] = applyToPoint47(params.transform, [x, y]);
8397
+ const [transformedX, transformedY] = applyToPoint48(params.transform, [x, y]);
8128
8398
  return { x: transformedX, y: transformedY };
8129
8399
  };
8130
8400
  for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
@@ -8205,15 +8475,15 @@ function drawSchematicGrid(params) {
8205
8475
  }
8206
8476
 
8207
8477
  // lib/sch/draw-schematic-labeled-points.ts
8208
- import { applyToPoint as applyToPoint48 } from "transformation-matrix";
8478
+ import { applyToPoint as applyToPoint49 } from "transformation-matrix";
8209
8479
  function drawSchematicLabeledPoints(params) {
8210
8480
  const { points, transform } = params;
8211
8481
  const labeledPointsGroup = [];
8212
8482
  for (const point of points) {
8213
- const [x1, y1] = applyToPoint48(transform, [point.x - 0.1, point.y - 0.1]);
8214
- const [x2, y2] = applyToPoint48(transform, [point.x + 0.1, point.y + 0.1]);
8215
- const [x3, y3] = applyToPoint48(transform, [point.x - 0.1, point.y + 0.1]);
8216
- const [x4, y4] = applyToPoint48(transform, [point.x + 0.1, point.y - 0.1]);
8483
+ const [x1, y1] = applyToPoint49(transform, [point.x - 0.1, point.y - 0.1]);
8484
+ const [x2, y2] = applyToPoint49(transform, [point.x + 0.1, point.y + 0.1]);
8485
+ const [x3, y3] = applyToPoint49(transform, [point.x - 0.1, point.y + 0.1]);
8486
+ const [x4, y4] = applyToPoint49(transform, [point.x + 0.1, point.y - 0.1]);
8217
8487
  labeledPointsGroup.push({
8218
8488
  name: "path",
8219
8489
  type: "element",
@@ -8224,7 +8494,7 @@ function drawSchematicLabeledPoints(params) {
8224
8494
  "stroke-opacity": "0.7"
8225
8495
  }
8226
8496
  });
8227
- const [labelX, labelY] = applyToPoint48(transform, [
8497
+ const [labelX, labelY] = applyToPoint49(transform, [
8228
8498
  point.x + 0.15,
8229
8499
  point.y - 0.15
8230
8500
  ]);
@@ -9318,8 +9588,8 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
9318
9588
  import { symbols } from "schematic-symbols";
9319
9589
  import "svgson";
9320
9590
  import {
9321
- applyToPoint as applyToPoint50,
9322
- compose as compose9
9591
+ applyToPoint as applyToPoint51,
9592
+ compose as compose10
9323
9593
  } from "transformation-matrix";
9324
9594
 
9325
9595
  // lib/utils/get-sch-stroke-size.ts
@@ -9389,26 +9659,26 @@ var matchSchPortsToSymbolPorts = ({
9389
9659
  };
9390
9660
 
9391
9661
  // lib/utils/point-pairs-to-matrix.ts
9392
- import { compose as compose8, scale as scale4, translate as translate8 } from "transformation-matrix";
9662
+ import { compose as compose9, scale as scale5, translate as translate9 } from "transformation-matrix";
9393
9663
  function pointPairsToMatrix(a1, a2, b1, b2) {
9394
9664
  const tx = a2.x - a1.x;
9395
9665
  const ty = a2.y - a1.y;
9396
9666
  const originalDistance = Math.sqrt((b1.x - a1.x) ** 2 + (b1.y - a1.y) ** 2);
9397
9667
  const transformedDistance = Math.sqrt((b2.x - a2.x) ** 2 + (b2.y - a2.y) ** 2);
9398
9668
  const a = transformedDistance / originalDistance;
9399
- const translateMatrix = translate8(tx, ty);
9400
- const scaleMatrix = scale4(a, a);
9401
- return compose8(translateMatrix, scaleMatrix);
9669
+ const translateMatrix = translate9(tx, ty);
9670
+ const scaleMatrix = scale5(a, a);
9671
+ return compose9(translateMatrix, scaleMatrix);
9402
9672
  }
9403
9673
 
9404
9674
  // lib/sch/svg-object-fns/create-svg-error-text.ts
9405
- import { applyToPoint as applyToPoint49 } from "transformation-matrix";
9675
+ import { applyToPoint as applyToPoint50 } from "transformation-matrix";
9406
9676
  var createSvgSchErrorText = ({
9407
9677
  text,
9408
9678
  realCenter,
9409
9679
  realToScreenTransform
9410
9680
  }) => {
9411
- const screenCenter = applyToPoint49(realToScreenTransform, realCenter);
9681
+ const screenCenter = applyToPoint50(realToScreenTransform, realCenter);
9412
9682
  return {
9413
9683
  type: "element",
9414
9684
  name: "text",
@@ -9517,12 +9787,12 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
9517
9787
  minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
9518
9788
  maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
9519
9789
  };
9520
- const [screenMinX, screenMinY] = applyToPoint50(
9521
- compose9(realToScreenTransform, transformFromSymbolToReal),
9790
+ const [screenMinX, screenMinY] = applyToPoint51(
9791
+ compose10(realToScreenTransform, transformFromSymbolToReal),
9522
9792
  [bounds.minX, bounds.minY]
9523
9793
  );
9524
- const [screenMaxX, screenMaxY] = applyToPoint50(
9525
- compose9(realToScreenTransform, transformFromSymbolToReal),
9794
+ const [screenMaxX, screenMaxY] = applyToPoint51(
9795
+ compose10(realToScreenTransform, transformFromSymbolToReal),
9526
9796
  [bounds.maxX, bounds.maxY]
9527
9797
  );
9528
9798
  const rectHeight = Math.abs(screenMaxY - screenMinY);
@@ -9550,8 +9820,8 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
9550
9820
  name: "path",
9551
9821
  attributes: {
9552
9822
  d: points.map((p, i) => {
9553
- const [x, y] = applyToPoint50(
9554
- compose9(realToScreenTransform, transformFromSymbolToReal),
9823
+ const [x, y] = applyToPoint51(
9824
+ compose10(realToScreenTransform, transformFromSymbolToReal),
9555
9825
  [p.x, p.y]
9556
9826
  );
9557
9827
  return `${i === 0 ? "M" : "L"} ${x} ${y}`;
@@ -9566,8 +9836,8 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
9566
9836
  });
9567
9837
  }
9568
9838
  for (const text of texts) {
9569
- const screenTextPos = applyToPoint50(
9570
- compose9(realToScreenTransform, transformFromSymbolToReal),
9839
+ const screenTextPos = applyToPoint51(
9840
+ compose10(realToScreenTransform, transformFromSymbolToReal),
9571
9841
  text
9572
9842
  );
9573
9843
  let textValue = "";
@@ -9618,11 +9888,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
9618
9888
  });
9619
9889
  }
9620
9890
  for (const box of boxes) {
9621
- const screenBoxPos = applyToPoint50(
9622
- compose9(realToScreenTransform, transformFromSymbolToReal),
9891
+ const screenBoxPos = applyToPoint51(
9892
+ compose10(realToScreenTransform, transformFromSymbolToReal),
9623
9893
  box
9624
9894
  );
9625
- const symbolToScreenScale = compose9(
9895
+ const symbolToScreenScale = compose10(
9626
9896
  realToScreenTransform,
9627
9897
  transformFromSymbolToReal
9628
9898
  ).a;
@@ -9642,8 +9912,8 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
9642
9912
  }
9643
9913
  for (const port of symbol.ports) {
9644
9914
  if (connectedSymbolPorts.has(port)) continue;
9645
- const screenPortPos = applyToPoint50(
9646
- compose9(realToScreenTransform, transformFromSymbolToReal),
9915
+ const screenPortPos = applyToPoint51(
9916
+ compose10(realToScreenTransform, transformFromSymbolToReal),
9647
9917
  port
9648
9918
  );
9649
9919
  svgObjects.push({
@@ -9662,8 +9932,8 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
9662
9932
  });
9663
9933
  }
9664
9934
  for (const circle of circles) {
9665
- const screenCirclePos = applyToPoint50(
9666
- compose9(realToScreenTransform, transformFromSymbolToReal),
9935
+ const screenCirclePos = applyToPoint51(
9936
+ compose10(realToScreenTransform, transformFromSymbolToReal),
9667
9937
  circle
9668
9938
  );
9669
9939
  const screenRadius = Math.abs(circle.radius * realToScreenTransform.a);
@@ -9689,14 +9959,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
9689
9959
  import { su as su10 } from "@tscircuit/circuit-json-util";
9690
9960
  import "schematic-symbols";
9691
9961
  import "svgson";
9692
- import { applyToPoint as applyToPoint56 } from "transformation-matrix";
9962
+ import { applyToPoint as applyToPoint57 } from "transformation-matrix";
9693
9963
 
9694
9964
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
9695
9965
  import "transformation-matrix";
9696
9966
  import "@tscircuit/circuit-json-util";
9697
9967
 
9698
9968
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
9699
- import { applyToPoint as applyToPoint51 } from "transformation-matrix";
9969
+ import { applyToPoint as applyToPoint52 } from "transformation-matrix";
9700
9970
  import { su as su8 } from "@tscircuit/circuit-json-util";
9701
9971
  var PIN_CIRCLE_RADIUS_MM = 0.02;
9702
9972
  var createArrow = (tip, angle, size, color, strokeWidth) => {
@@ -9749,8 +10019,8 @@ var createSvgObjectsForSchPortBoxLine = ({
9749
10019
  realEdgePos.y += realPinLineLength;
9750
10020
  break;
9751
10021
  }
9752
- const screenSchPortPos = applyToPoint51(transform, schPort.center);
9753
- const screenRealEdgePos = applyToPoint51(transform, realEdgePos);
10022
+ const screenSchPortPos = applyToPoint52(transform, schPort.center);
10023
+ const screenRealEdgePos = applyToPoint52(transform, realEdgePos);
9754
10024
  const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
9755
10025
  const realLineEnd = { ...schPort.center };
9756
10026
  if (!isConnected) {
@@ -9769,7 +10039,7 @@ var createSvgObjectsForSchPortBoxLine = ({
9769
10039
  break;
9770
10040
  }
9771
10041
  }
9772
- const screenLineEnd = applyToPoint51(transform, realLineEnd);
10042
+ const screenLineEnd = applyToPoint52(transform, realLineEnd);
9773
10043
  svgObjects.push({
9774
10044
  name: "line",
9775
10045
  type: "element",
@@ -9890,7 +10160,7 @@ var createSvgObjectsForSchPortBoxLine = ({
9890
10160
  };
9891
10161
 
9892
10162
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
9893
- import { applyToPoint as applyToPoint52 } from "transformation-matrix";
10163
+ import { applyToPoint as applyToPoint53 } from "transformation-matrix";
9894
10164
  var createSvgObjectsForSchPortPinNumberText = (params) => {
9895
10165
  const svgObjects = [];
9896
10166
  const { schPort, schComponent, transform, circuitJson } = params;
@@ -9908,7 +10178,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
9908
10178
  } else {
9909
10179
  realPinNumberPos.y += 0.02;
9910
10180
  }
9911
- const screenPinNumberTextPos = applyToPoint52(transform, realPinNumberPos);
10181
+ const screenPinNumberTextPos = applyToPoint53(transform, realPinNumberPos);
9912
10182
  svgObjects.push({
9913
10183
  name: "text",
9914
10184
  type: "element",
@@ -9938,7 +10208,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
9938
10208
  };
9939
10209
 
9940
10210
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
9941
- import { applyToPoint as applyToPoint53 } from "transformation-matrix";
10211
+ import { applyToPoint as applyToPoint54 } from "transformation-matrix";
9942
10212
  var LABEL_DIST_FROM_EDGE_MM = 0.1;
9943
10213
  var createSvgObjectsForSchPortPinLabel = (params) => {
9944
10214
  const svgObjects = [];
@@ -9952,7 +10222,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
9952
10222
  const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
9953
10223
  realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
9954
10224
  realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
9955
- const screenPinNumberTextPos = applyToPoint53(transform, realPinNumberPos);
10225
+ const screenPinNumberTextPos = applyToPoint54(transform, realPinNumberPos);
9956
10226
  const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
9957
10227
  if (!label) return [];
9958
10228
  const isNegated = label.startsWith("N_");
@@ -10000,13 +10270,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
10000
10270
  };
10001
10271
 
10002
10272
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
10003
- import { applyToPoint as applyToPoint55 } from "transformation-matrix";
10273
+ import { applyToPoint as applyToPoint56 } from "transformation-matrix";
10004
10274
  var createSvgSchText = ({
10005
10275
  elm,
10006
10276
  transform,
10007
10277
  colorMap: colorMap2
10008
10278
  }) => {
10009
- const center = applyToPoint55(transform, elm.position);
10279
+ const center = applyToPoint56(transform, elm.position);
10010
10280
  const textAnchorMap = {
10011
10281
  center: "middle",
10012
10282
  center_right: "end",
@@ -10090,11 +10360,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
10090
10360
  colorMap: colorMap2
10091
10361
  }) => {
10092
10362
  const svgObjects = [];
10093
- const componentScreenTopLeft = applyToPoint56(transform, {
10363
+ const componentScreenTopLeft = applyToPoint57(transform, {
10094
10364
  x: schComponent.center.x - schComponent.size.width / 2,
10095
10365
  y: schComponent.center.y + schComponent.size.height / 2
10096
10366
  });
10097
- const componentScreenBottomRight = applyToPoint56(transform, {
10367
+ const componentScreenBottomRight = applyToPoint57(transform, {
10098
10368
  x: schComponent.center.x + schComponent.size.width / 2,
10099
10369
  y: schComponent.center.y - schComponent.size.height / 2
10100
10370
  });
@@ -10180,13 +10450,13 @@ function createSvgObjectsFromSchematicComponent(params) {
10180
10450
  }
10181
10451
 
10182
10452
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
10183
- import { applyToPoint as applyToPoint57 } from "transformation-matrix";
10453
+ import { applyToPoint as applyToPoint58 } from "transformation-matrix";
10184
10454
  function createSvgObjectsFromSchVoltageProbe({
10185
10455
  probe,
10186
10456
  transform,
10187
10457
  colorMap: colorMap2
10188
10458
  }) {
10189
- const [screenX, screenY] = applyToPoint57(transform, [
10459
+ const [screenX, screenY] = applyToPoint58(transform, [
10190
10460
  probe.position.x,
10191
10461
  probe.position.y
10192
10462
  ]);
@@ -10293,17 +10563,17 @@ function createSvgObjectsFromSchVoltageProbe({
10293
10563
  }
10294
10564
 
10295
10565
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
10296
- import { applyToPoint as applyToPoint58 } from "transformation-matrix";
10566
+ import { applyToPoint as applyToPoint59 } from "transformation-matrix";
10297
10567
  function createSvgObjectsFromSchDebugObject({
10298
10568
  debugObject,
10299
10569
  transform
10300
10570
  }) {
10301
10571
  if (debugObject.shape === "rect") {
10302
- let [screenLeft, screenTop] = applyToPoint58(transform, [
10572
+ let [screenLeft, screenTop] = applyToPoint59(transform, [
10303
10573
  debugObject.center.x - debugObject.size.width / 2,
10304
10574
  debugObject.center.y - debugObject.size.height / 2
10305
10575
  ]);
10306
- let [screenRight, screenBottom] = applyToPoint58(transform, [
10576
+ let [screenRight, screenBottom] = applyToPoint59(transform, [
10307
10577
  debugObject.center.x + debugObject.size.width / 2,
10308
10578
  debugObject.center.y + debugObject.size.height / 2
10309
10579
  ]);
@@ -10313,7 +10583,7 @@ function createSvgObjectsFromSchDebugObject({
10313
10583
  ];
10314
10584
  const width = Math.abs(screenRight - screenLeft);
10315
10585
  const height = Math.abs(screenBottom - screenTop);
10316
- const [screenCenterX, screenCenterY] = applyToPoint58(transform, [
10586
+ const [screenCenterX, screenCenterY] = applyToPoint59(transform, [
10317
10587
  debugObject.center.x,
10318
10588
  debugObject.center.y
10319
10589
  ]);
@@ -10359,11 +10629,11 @@ function createSvgObjectsFromSchDebugObject({
10359
10629
  ];
10360
10630
  }
10361
10631
  if (debugObject.shape === "line") {
10362
- const [screenStartX, screenStartY] = applyToPoint58(transform, [
10632
+ const [screenStartX, screenStartY] = applyToPoint59(transform, [
10363
10633
  debugObject.start.x,
10364
10634
  debugObject.start.y
10365
10635
  ]);
10366
- const [screenEndX, screenEndY] = applyToPoint58(transform, [
10636
+ const [screenEndX, screenEndY] = applyToPoint59(transform, [
10367
10637
  debugObject.end.x,
10368
10638
  debugObject.end.y
10369
10639
  ]);
@@ -10413,7 +10683,7 @@ function createSvgObjectsFromSchDebugObject({
10413
10683
  }
10414
10684
 
10415
10685
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
10416
- import { applyToPoint as applyToPoint59 } from "transformation-matrix";
10686
+ import { applyToPoint as applyToPoint60 } from "transformation-matrix";
10417
10687
  function createSchematicTrace({
10418
10688
  trace,
10419
10689
  transform,
@@ -10427,11 +10697,11 @@ function createSchematicTrace({
10427
10697
  for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
10428
10698
  const edge = edges[edgeIndex];
10429
10699
  if (edge.is_crossing) continue;
10430
- const [screenFromX, screenFromY] = applyToPoint59(transform, [
10700
+ const [screenFromX, screenFromY] = applyToPoint60(transform, [
10431
10701
  edge.from.x,
10432
10702
  edge.from.y
10433
10703
  ]);
10434
- const [screenToX, screenToY] = applyToPoint59(transform, [
10704
+ const [screenToX, screenToY] = applyToPoint60(transform, [
10435
10705
  edge.to.x,
10436
10706
  edge.to.y
10437
10707
  ]);
@@ -10475,11 +10745,11 @@ function createSchematicTrace({
10475
10745
  }
10476
10746
  for (const edge of edges) {
10477
10747
  if (!edge.is_crossing) continue;
10478
- const [screenFromX, screenFromY] = applyToPoint59(transform, [
10748
+ const [screenFromX, screenFromY] = applyToPoint60(transform, [
10479
10749
  edge.from.x,
10480
10750
  edge.from.y
10481
10751
  ]);
10482
- const [screenToX, screenToY] = applyToPoint59(transform, [
10752
+ const [screenToX, screenToY] = applyToPoint60(transform, [
10483
10753
  edge.to.x,
10484
10754
  edge.to.y
10485
10755
  ]);
@@ -10523,7 +10793,7 @@ function createSchematicTrace({
10523
10793
  }
10524
10794
  if (trace.junctions) {
10525
10795
  for (const junction of trace.junctions) {
10526
- const [screenX, screenY] = applyToPoint59(transform, [
10796
+ const [screenX, screenY] = applyToPoint60(transform, [
10527
10797
  junction.x,
10528
10798
  junction.y
10529
10799
  ]);
@@ -10577,6 +10847,15 @@ function createSchematicTrace({
10577
10847
  }
10578
10848
 
10579
10849
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
10850
+ import {
10851
+ applyToPoint as applyToPoint62,
10852
+ compose as compose12,
10853
+ rotate as rotate7,
10854
+ scale as scale7,
10855
+ translate as translate12
10856
+ } from "transformation-matrix";
10857
+
10858
+ // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
10580
10859
  import {
10581
10860
  applyToPoint as applyToPoint61,
10582
10861
  compose as compose11,
@@ -10584,15 +10863,6 @@ import {
10584
10863
  scale as scale6,
10585
10864
  translate as translate11
10586
10865
  } from "transformation-matrix";
10587
-
10588
- // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
10589
- import {
10590
- applyToPoint as applyToPoint60,
10591
- compose as compose10,
10592
- rotate as rotate5,
10593
- scale as scale5,
10594
- translate as translate10
10595
- } from "transformation-matrix";
10596
10866
  import { symbols as symbols3 } from "schematic-symbols";
10597
10867
  var createSvgObjectsForSchNetLabelWithSymbol = ({
10598
10868
  schNetLabel,
@@ -10635,7 +10905,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
10635
10905
  y: schNetLabel.center.y - realTextGrowthVec.y * fullWidthFsr * fontSizeMm / 2
10636
10906
  };
10637
10907
  const pathRotation = 0;
10638
- const rotationMatrix = rotate5(pathRotation / 180 * Math.PI);
10908
+ const rotationMatrix = rotate6(pathRotation / 180 * Math.PI);
10639
10909
  const symbolBounds = {
10640
10910
  minX: Math.min(
10641
10911
  ...symbol.primitives.flatMap(
@@ -10662,22 +10932,22 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
10662
10932
  x: symbolBounds.minX,
10663
10933
  y: (symbolBounds.minY + symbolBounds.maxY) / 2
10664
10934
  };
10665
- const rotatedSymbolEnd = applyToPoint60(rotationMatrix, symbolEndPoint);
10666
- const symbolToRealTransform = compose10(
10667
- translate10(
10935
+ const rotatedSymbolEnd = applyToPoint61(rotationMatrix, symbolEndPoint);
10936
+ const symbolToRealTransform = compose11(
10937
+ translate11(
10668
10938
  realAnchorPosition.x - rotatedSymbolEnd.x,
10669
10939
  realAnchorPosition.y - rotatedSymbolEnd.y
10670
10940
  ),
10671
10941
  rotationMatrix,
10672
- scale5(1)
10942
+ scale6(1)
10673
10943
  // Use full symbol size
10674
10944
  );
10675
- const [screenMinX, screenMinY] = applyToPoint60(
10676
- compose10(realToScreenTransform, symbolToRealTransform),
10945
+ const [screenMinX, screenMinY] = applyToPoint61(
10946
+ compose11(realToScreenTransform, symbolToRealTransform),
10677
10947
  [bounds.minX, bounds.minY]
10678
10948
  );
10679
- const [screenMaxX, screenMaxY] = applyToPoint60(
10680
- compose10(realToScreenTransform, symbolToRealTransform),
10949
+ const [screenMaxX, screenMaxY] = applyToPoint61(
10950
+ compose11(realToScreenTransform, symbolToRealTransform),
10681
10951
  [bounds.maxX, bounds.maxY]
10682
10952
  );
10683
10953
  const rectHeight = Math.abs(screenMaxY - screenMinY);
@@ -10700,8 +10970,8 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
10700
10970
  });
10701
10971
  for (const path of symbolPaths) {
10702
10972
  const symbolPath = path.points.map((p, i) => {
10703
- const [x, y] = applyToPoint60(
10704
- compose10(realToScreenTransform, symbolToRealTransform),
10973
+ const [x, y] = applyToPoint61(
10974
+ compose11(realToScreenTransform, symbolToRealTransform),
10705
10975
  [p.x, p.y]
10706
10976
  );
10707
10977
  return `${i === 0 ? "M" : "L"} ${x} ${y}`;
@@ -10721,8 +10991,8 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
10721
10991
  });
10722
10992
  }
10723
10993
  for (const text of symbolTexts) {
10724
- const screenTextPos = applyToPoint60(
10725
- compose10(realToScreenTransform, symbolToRealTransform),
10994
+ const screenTextPos = applyToPoint61(
10995
+ compose11(realToScreenTransform, symbolToRealTransform),
10726
10996
  text
10727
10997
  );
10728
10998
  let textValue = text.text;
@@ -10731,8 +11001,8 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
10731
11001
  } else if (textValue === "{VAL}") {
10732
11002
  textValue = "";
10733
11003
  }
10734
- const scale9 = Math.abs(realToScreenTransform.a);
10735
- const baseOffset = scale9 * 0.1;
11004
+ const scale10 = Math.abs(realToScreenTransform.a);
11005
+ const baseOffset = scale10 * 0.1;
10736
11006
  const offsetScreenPos = {
10737
11007
  x: screenTextPos.x,
10738
11008
  y: screenTextPos.y
@@ -10763,11 +11033,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
10763
11033
  });
10764
11034
  }
10765
11035
  for (const box of symbolBoxes) {
10766
- const screenBoxPos = applyToPoint60(
10767
- compose10(realToScreenTransform, symbolToRealTransform),
11036
+ const screenBoxPos = applyToPoint61(
11037
+ compose11(realToScreenTransform, symbolToRealTransform),
10768
11038
  box
10769
11039
  );
10770
- const symbolToScreenScale = compose10(
11040
+ const symbolToScreenScale = compose11(
10771
11041
  realToScreenTransform,
10772
11042
  symbolToRealTransform
10773
11043
  ).a;
@@ -10786,11 +11056,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
10786
11056
  });
10787
11057
  }
10788
11058
  for (const circle of symbolCircles) {
10789
- const screenCirclePos = applyToPoint60(
10790
- compose10(realToScreenTransform, symbolToRealTransform),
11059
+ const screenCirclePos = applyToPoint61(
11060
+ compose11(realToScreenTransform, symbolToRealTransform),
10791
11061
  circle
10792
11062
  );
10793
- const symbolToScreenScale = compose10(
11063
+ const symbolToScreenScale = compose11(
10794
11064
  realToScreenTransform,
10795
11065
  symbolToRealTransform
10796
11066
  ).a;
@@ -10831,14 +11101,14 @@ var createSvgObjectsForSchNetLabel = ({
10831
11101
  const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
10832
11102
  const fontSizeMm = getSchMmFontSize("net_label");
10833
11103
  const textWidthFSR = estimateTextWidth(labelText || "");
10834
- const screenCenter = applyToPoint61(realToScreenTransform, schNetLabel.center);
11104
+ const screenCenter = applyToPoint62(realToScreenTransform, schNetLabel.center);
10835
11105
  const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
10836
11106
  schNetLabel.anchor_side
10837
11107
  );
10838
11108
  const screenTextGrowthVec = { ...realTextGrowthVec };
10839
11109
  screenTextGrowthVec.y *= -1;
10840
11110
  const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
10841
- const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint61(realToScreenTransform, schNetLabel.anchor_position) : {
11111
+ const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint62(realToScreenTransform, schNetLabel.anchor_position) : {
10842
11112
  x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
10843
11113
  y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
10844
11114
  };
@@ -10879,12 +11149,12 @@ var createSvgObjectsForSchNetLabel = ({
10879
11149
  y: -0.6
10880
11150
  }
10881
11151
  ].map(
10882
- (fontRelativePoint) => applyToPoint61(
10883
- compose11(
11152
+ (fontRelativePoint) => applyToPoint62(
11153
+ compose12(
10884
11154
  realToScreenTransform,
10885
- translate11(realAnchorPosition.x, realAnchorPosition.y),
10886
- scale6(fontSizeMm),
10887
- rotate6(pathRotation / 180 * Math.PI)
11155
+ translate12(realAnchorPosition.x, realAnchorPosition.y),
11156
+ scale7(fontSizeMm),
11157
+ rotate7(pathRotation / 180 * Math.PI)
10888
11158
  ),
10889
11159
  fontRelativePoint
10890
11160
  )
@@ -10956,17 +11226,17 @@ var createSvgObjectsForSchNetLabel = ({
10956
11226
  };
10957
11227
 
10958
11228
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
10959
- import { applyToPoint as applyToPoint62 } from "transformation-matrix";
11229
+ import { applyToPoint as applyToPoint63 } from "transformation-matrix";
10960
11230
  var createSvgObjectsFromSchematicBox = ({
10961
11231
  schematicBox,
10962
11232
  transform,
10963
11233
  colorMap: colorMap2
10964
11234
  }) => {
10965
- const topLeft = applyToPoint62(transform, {
11235
+ const topLeft = applyToPoint63(transform, {
10966
11236
  x: schematicBox.x,
10967
11237
  y: schematicBox.y
10968
11238
  });
10969
- const bottomRight = applyToPoint62(transform, {
11239
+ const bottomRight = applyToPoint63(transform, {
10970
11240
  x: schematicBox.x + schematicBox.width,
10971
11241
  y: schematicBox.y + schematicBox.height
10972
11242
  });
@@ -11002,7 +11272,7 @@ var createSvgObjectsFromSchematicBox = ({
11002
11272
  };
11003
11273
 
11004
11274
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
11005
- import { applyToPoint as applyToPoint63 } from "transformation-matrix";
11275
+ import { applyToPoint as applyToPoint64 } from "transformation-matrix";
11006
11276
  var createSvgObjectsFromSchematicTable = ({
11007
11277
  schematicTable,
11008
11278
  transform,
@@ -11035,11 +11305,11 @@ var createSvgObjectsFromSchematicTable = ({
11035
11305
  const svgObjects = [];
11036
11306
  const borderStrokeWidth = border_width * Math.abs(transform.a);
11037
11307
  const gridStrokeWidth = getSchStrokeSize(transform);
11038
- const [screenTopLeftX, screenTopLeftY] = applyToPoint63(transform, [
11308
+ const [screenTopLeftX, screenTopLeftY] = applyToPoint64(transform, [
11039
11309
  topLeftX,
11040
11310
  topLeftY
11041
11311
  ]);
11042
- const [screenBottomRightX, screenBottomRightY] = applyToPoint63(transform, [
11312
+ const [screenBottomRightX, screenBottomRightY] = applyToPoint64(transform, [
11043
11313
  topLeftX + totalWidth,
11044
11314
  topLeftY - totalHeight
11045
11315
  ]);
@@ -11071,8 +11341,8 @@ var createSvgObjectsFromSchematicTable = ({
11071
11341
  (cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
11072
11342
  );
11073
11343
  if (!isMerged) {
11074
- const start = applyToPoint63(transform, { x: currentX, y: segmentStartY });
11075
- const end = applyToPoint63(transform, { x: currentX, y: segmentEndY });
11344
+ const start = applyToPoint64(transform, { x: currentX, y: segmentStartY });
11345
+ const end = applyToPoint64(transform, { x: currentX, y: segmentEndY });
11076
11346
  svgObjects.push({
11077
11347
  name: "line",
11078
11348
  type: "element",
@@ -11101,11 +11371,11 @@ var createSvgObjectsFromSchematicTable = ({
11101
11371
  (cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
11102
11372
  );
11103
11373
  if (!isMerged) {
11104
- const start = applyToPoint63(transform, {
11374
+ const start = applyToPoint64(transform, {
11105
11375
  x: segmentStartX,
11106
11376
  y: currentY
11107
11377
  });
11108
- const end = applyToPoint63(transform, { x: segmentEndX, y: currentY });
11378
+ const end = applyToPoint64(transform, { x: segmentEndX, y: currentY });
11109
11379
  svgObjects.push({
11110
11380
  name: "line",
11111
11381
  type: "element",
@@ -11147,7 +11417,7 @@ var createSvgObjectsFromSchematicTable = ({
11147
11417
  } else if (vertical_align === "bottom") {
11148
11418
  realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
11149
11419
  }
11150
- const screenTextAnchorPos = applyToPoint63(transform, realTextAnchorPos);
11420
+ const screenTextAnchorPos = applyToPoint64(transform, realTextAnchorPos);
11151
11421
  const fontSize = getSchScreenFontSize(
11152
11422
  transform,
11153
11423
  "reference_designator",
@@ -11203,13 +11473,13 @@ var createSvgObjectsFromSchematicTable = ({
11203
11473
 
11204
11474
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
11205
11475
  import { su as su11 } from "@tscircuit/circuit-json-util";
11206
- import { applyToPoint as applyToPoint64 } from "transformation-matrix";
11476
+ import { applyToPoint as applyToPoint65 } from "transformation-matrix";
11207
11477
  var PIN_CIRCLE_RADIUS_MM2 = 0.02;
11208
11478
  var createSvgObjectsForSchPortHover = ({
11209
11479
  schPort,
11210
11480
  transform
11211
11481
  }) => {
11212
- const screenSchPortPos = applyToPoint64(transform, schPort.center);
11482
+ const screenSchPortPos = applyToPoint65(transform, schPort.center);
11213
11483
  const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
11214
11484
  return [
11215
11485
  {
@@ -11254,14 +11524,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
11254
11524
  };
11255
11525
 
11256
11526
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
11257
- import { applyToPoint as applyToPoint65 } from "transformation-matrix";
11527
+ import { applyToPoint as applyToPoint66 } from "transformation-matrix";
11258
11528
  function createSvgObjectsFromSchematicLine({
11259
11529
  schLine,
11260
11530
  transform,
11261
11531
  colorMap: colorMap2
11262
11532
  }) {
11263
- const p1 = applyToPoint65(transform, { x: schLine.x1, y: schLine.y1 });
11264
- const p2 = applyToPoint65(transform, { x: schLine.x2, y: schLine.y2 });
11533
+ const p1 = applyToPoint66(transform, { x: schLine.x1, y: schLine.y1 });
11534
+ const p2 = applyToPoint66(transform, { x: schLine.x2, y: schLine.y2 });
11265
11535
  const strokeWidth = schLine.stroke_width ?? 0.02;
11266
11536
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
11267
11537
  return [
@@ -11290,13 +11560,13 @@ function createSvgObjectsFromSchematicLine({
11290
11560
  }
11291
11561
 
11292
11562
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
11293
- import { applyToPoint as applyToPoint66 } from "transformation-matrix";
11563
+ import { applyToPoint as applyToPoint67 } from "transformation-matrix";
11294
11564
  function createSvgObjectsFromSchematicCircle({
11295
11565
  schCircle,
11296
11566
  transform,
11297
11567
  colorMap: colorMap2
11298
11568
  }) {
11299
- const center = applyToPoint66(transform, schCircle.center);
11569
+ const center = applyToPoint67(transform, schCircle.center);
11300
11570
  const transformedRadius = Math.abs(transform.a) * schCircle.radius;
11301
11571
  const strokeWidth = schCircle.stroke_width ?? 0.02;
11302
11572
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
@@ -11326,13 +11596,13 @@ function createSvgObjectsFromSchematicCircle({
11326
11596
  }
11327
11597
 
11328
11598
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
11329
- import { applyToPoint as applyToPoint67 } from "transformation-matrix";
11599
+ import { applyToPoint as applyToPoint68 } from "transformation-matrix";
11330
11600
  function createSvgObjectsFromSchematicRect({
11331
11601
  schRect,
11332
11602
  transform,
11333
11603
  colorMap: colorMap2
11334
11604
  }) {
11335
- const center = applyToPoint67(transform, schRect.center);
11605
+ const center = applyToPoint68(transform, schRect.center);
11336
11606
  const transformedWidth = Math.abs(transform.a) * schRect.width;
11337
11607
  const transformedHeight = Math.abs(transform.d) * schRect.height;
11338
11608
  const strokeWidth = schRect.stroke_width ?? 0.02;
@@ -11368,13 +11638,13 @@ function createSvgObjectsFromSchematicRect({
11368
11638
  }
11369
11639
 
11370
11640
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
11371
- import { applyToPoint as applyToPoint68 } from "transformation-matrix";
11641
+ import { applyToPoint as applyToPoint69 } from "transformation-matrix";
11372
11642
  function createSvgObjectsFromSchematicArc({
11373
11643
  schArc,
11374
11644
  transform,
11375
11645
  colorMap: colorMap2
11376
11646
  }) {
11377
- const center = applyToPoint68(transform, schArc.center);
11647
+ const center = applyToPoint69(transform, schArc.center);
11378
11648
  const transformedRadius = Math.abs(transform.a) * schArc.radius;
11379
11649
  const strokeWidth = schArc.stroke_width ?? 0.02;
11380
11650
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
@@ -12381,9 +12651,9 @@ function convertCircuitJsonToSchematicSimulationSvg({
12381
12651
  const rawSchematicHeight = Math.max(1, height * clampedRatio);
12382
12652
  const rawSimulationHeight = Math.max(1, height - rawSchematicHeight);
12383
12653
  const totalRawHeight = rawSchematicHeight + rawSimulationHeight;
12384
- const scale9 = totalRawHeight === 0 ? 1 : height / totalRawHeight;
12385
- const schematicHeight = rawSchematicHeight * scale9;
12386
- const simulationHeight = rawSimulationHeight * scale9;
12654
+ const scale10 = totalRawHeight === 0 ? 1 : height / totalRawHeight;
12655
+ const schematicHeight = rawSchematicHeight * scale10;
12656
+ const simulationHeight = rawSimulationHeight * scale10;
12387
12657
  const schematicSvg = convertCircuitJsonToSchematicSvg(schematicElements, {
12388
12658
  ...schematicOptions,
12389
12659
  width,
@@ -12475,21 +12745,21 @@ function formatNumber2(value) {
12475
12745
  }
12476
12746
 
12477
12747
  // lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
12478
- import { distance as distance2 } from "circuit-json";
12748
+ import { distance as distance3 } from "circuit-json";
12479
12749
  import { stringify as stringify7 } from "svgson";
12480
12750
  import {
12481
- applyToPoint as applyToPoint71,
12482
- compose as compose14,
12483
- scale as scale8,
12484
- translate as translate14
12751
+ applyToPoint as applyToPoint72,
12752
+ compose as compose15,
12753
+ scale as scale9,
12754
+ translate as translate15
12485
12755
  } from "transformation-matrix";
12486
12756
 
12487
12757
  // lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
12488
- import { applyToPoint as applyToPoint70 } from "transformation-matrix";
12758
+ import { applyToPoint as applyToPoint71 } from "transformation-matrix";
12489
12759
  function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
12490
12760
  const { transform, layer: layerFilter } = ctx;
12491
12761
  if (layerFilter && solderPaste.layer !== layerFilter) return [];
12492
- const [x, y] = applyToPoint70(transform, [solderPaste.x, solderPaste.y]);
12762
+ const [x, y] = applyToPoint71(transform, [solderPaste.x, solderPaste.y]);
12493
12763
  if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
12494
12764
  const width = solderPaste.width * Math.abs(transform.a);
12495
12765
  const height = solderPaste.height * Math.abs(transform.d);
@@ -12593,8 +12863,8 @@ function convertCircuitJsonToSolderPasteMask(circuitJson, options) {
12593
12863
  }
12594
12864
  } else if (item.type === "pcb_panel") {
12595
12865
  const panel = item;
12596
- const width = distance2.parse(panel.width);
12597
- const height = distance2.parse(panel.height);
12866
+ const width = distance3.parse(panel.width);
12867
+ const height = distance3.parse(panel.height);
12598
12868
  if (width !== void 0 && height !== void 0) {
12599
12869
  const center = panel.center ?? { x: width / 2, y: height / 2 };
12600
12870
  updateBounds(center, width, height);
@@ -12613,12 +12883,12 @@ function convertCircuitJsonToSolderPasteMask(circuitJson, options) {
12613
12883
  const scaleFactor = Math.min(scaleX, scaleY);
12614
12884
  const offsetX = (svgWidth - circuitWidth * scaleFactor) / 2;
12615
12885
  const offsetY = (svgHeight - circuitHeight * scaleFactor) / 2;
12616
- const transform = compose14(
12617
- translate14(
12886
+ const transform = compose15(
12887
+ translate15(
12618
12888
  offsetX - minX * scaleFactor + padding * scaleFactor,
12619
12889
  svgHeight - offsetY + minY * scaleFactor - padding * scaleFactor
12620
12890
  ),
12621
- scale8(scaleFactor, -scaleFactor)
12891
+ scale9(scaleFactor, -scaleFactor)
12622
12892
  // Flip in y-direction
12623
12893
  );
12624
12894
  const ctx = {
@@ -12715,8 +12985,8 @@ function createSvgObjects4({ elm, ctx }) {
12715
12985
  }
12716
12986
  }
12717
12987
  function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
12718
- const [x1, y1] = applyToPoint71(transform, [minX, minY]);
12719
- const [x2, y2] = applyToPoint71(transform, [maxX, maxY]);
12988
+ const [x1, y1] = applyToPoint72(transform, [minX, minY]);
12989
+ const [x2, y2] = applyToPoint72(transform, [maxX, maxY]);
12720
12990
  const width = Math.abs(x2 - x1);
12721
12991
  const height = Math.abs(y2 - y1);
12722
12992
  const x = Math.min(x1, x2);