@tscircuit/pcb-viewer 1.11.108 → 1.11.110

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
@@ -35,7 +35,7 @@ __export(dist_exports, {
35
35
  pcb_hole_circle_or_square_shape: () => pcb_hole_circle_or_square_shape,
36
36
  pcb_hole_oval_shape: () => pcb_hole_oval_shape,
37
37
  pcb_keepout: () => pcb_keepout,
38
- pcb_manual_edit_conflict_error: () => pcb_manual_edit_conflict_error,
38
+ pcb_manual_edit_conflict_warning: () => pcb_manual_edit_conflict_warning,
39
39
  pcb_missing_footprint_error: () => pcb_missing_footprint_error,
40
40
  pcb_placement_error: () => pcb_placement_error,
41
41
  pcb_plated_hole: () => pcb_plated_hole,
@@ -79,6 +79,7 @@ __export(dist_exports, {
79
79
  schematic_debug_rect: () => schematic_debug_rect,
80
80
  schematic_error: () => schematic_error,
81
81
  schematic_line: () => schematic_line,
82
+ schematic_manual_edit_conflict_warning: () => schematic_manual_edit_conflict_warning,
82
83
  schematic_net_label: () => schematic_net_label,
83
84
  schematic_path: () => schematic_path,
84
85
  schematic_pin_styles: () => schematic_pin_styles,
@@ -92,6 +93,7 @@ __export(dist_exports, {
92
93
  source_led: () => source_led,
93
94
  source_net: () => source_net,
94
95
  source_port: () => source_port,
96
+ source_project_metadata: () => source_project_metadata,
95
97
  source_simple_battery: () => source_simple_battery,
96
98
  source_simple_bug: () => source_simple_bug,
97
99
  source_simple_capacitor: () => source_simple_capacitor,
@@ -4447,6 +4449,18 @@ expectTypesMatch("extra props b");
4447
4449
  expectTypesMatch("missing props b");
4448
4450
  expectTypesMatch(true);
4449
4451
  expectTypesMatch("mismatched prop types: a");
4452
+ var expectStringUnionsMatch = (shouldBe) => {
4453
+ };
4454
+ expectStringUnionsMatch(true);
4455
+ expectStringUnionsMatch(
4456
+ 'T1 has extra: "c", T2 has extra: "d"'
4457
+ );
4458
+ expectStringUnionsMatch('T1 has extra: "c"');
4459
+ expectStringUnionsMatch('T2 has extra: "c"');
4460
+ expectStringUnionsMatch(
4461
+ 'T1 has extra: "d", T2 has extra: "c"'
4462
+ );
4463
+ expectStringUnionsMatch(true);
4450
4464
  var source_component_base = z.object({
4451
4465
  type: z.literal("source_component"),
4452
4466
  ftype: z.string().optional(),
@@ -4546,6 +4560,13 @@ var source_simple_switch = source_component_base.extend({
4546
4560
  ftype: z.literal("simple_switch")
4547
4561
  });
4548
4562
  expectTypesMatch(true);
4563
+ var source_project_metadata = z.object({
4564
+ type: z.literal("source_project_metadata"),
4565
+ name: z.string().optional(),
4566
+ software_used_string: z.string().optional(),
4567
+ created_at: z.string().datetime().optional()
4568
+ });
4569
+ expectTypesMatch(true);
4549
4570
  var any_source_component = z.union([
4550
4571
  source_simple_resistor,
4551
4572
  source_simple_capacitor,
@@ -4564,7 +4585,8 @@ var any_source_component = z.union([
4564
4585
  source_simple_resonator,
4565
4586
  source_simple_switch,
4566
4587
  source_simple_transistor,
4567
- source_simple_mosfet
4588
+ source_simple_mosfet,
4589
+ source_project_metadata
4568
4590
  ]);
4569
4591
  var source_port = z.object({
4570
4592
  type: z.literal("source_port"),
@@ -4584,6 +4606,7 @@ var source_trace = z.object({
4584
4606
  subcircuit_id: z.string().optional(),
4585
4607
  subcircuit_connectivity_map_key: z.string().optional(),
4586
4608
  max_length: z.number().optional(),
4609
+ min_trace_thickness: z.number().optional(),
4587
4610
  display_name: z.string().optional()
4588
4611
  });
4589
4612
  expectTypesMatch(true);
@@ -4794,6 +4817,20 @@ var schematic_voltage_probe = z.object({
4794
4817
  voltage: voltage.optional()
4795
4818
  }).describe("Defines a voltage probe measurement point on a schematic trace");
4796
4819
  expectTypesMatch(true);
4820
+ var schematic_manual_edit_conflict_warning = z.object({
4821
+ type: z.literal("schematic_manual_edit_conflict_warning"),
4822
+ schematic_manual_edit_conflict_warning_id: getZodPrefixedIdWithDefault(
4823
+ "schematic_manual_edit_conflict_warning"
4824
+ ),
4825
+ message: z.string(),
4826
+ schematic_component_id: z.string(),
4827
+ schematic_group_id: z.string().optional(),
4828
+ subcircuit_id: z.string().optional(),
4829
+ source_component_id: z.string()
4830
+ }).describe(
4831
+ "Warning emitted when a component has both manual placement and explicit schX/schY coordinates"
4832
+ );
4833
+ expectTypesMatch(true);
4797
4834
  var all_layers = [
4798
4835
  "top",
4799
4836
  "bottom",
@@ -4922,6 +4959,25 @@ var pcb_circular_hole_with_rect_pad = z.object({
4922
4959
  pcb_port_id: z.string().optional(),
4923
4960
  pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
4924
4961
  });
4962
+ var pcb_pill_hole_with_rect_pad = z.object({
4963
+ type: z.literal("pcb_plated_hole"),
4964
+ shape: z.literal("pill_hole_with_rect_pad"),
4965
+ pcb_group_id: z.string().optional(),
4966
+ subcircuit_id: z.string().optional(),
4967
+ hole_shape: z.literal("pill"),
4968
+ pad_shape: z.literal("rect"),
4969
+ hole_width: z.number(),
4970
+ hole_height: z.number(),
4971
+ rect_pad_width: z.number(),
4972
+ rect_pad_height: z.number(),
4973
+ x: distance,
4974
+ y: distance,
4975
+ layers: z.array(layer_ref),
4976
+ port_hints: z.array(z.string()).optional(),
4977
+ pcb_component_id: z.string().optional(),
4978
+ pcb_port_id: z.string().optional(),
4979
+ pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
4980
+ });
4925
4981
  var pcb_plated_hole = z.union([
4926
4982
  pcb_plated_hole_circle,
4927
4983
  pcb_plated_hole_oval,
@@ -5160,7 +5216,8 @@ var pcb_board = z.object({
5160
5216
  center: point,
5161
5217
  thickness: length.optional().default(1.4),
5162
5218
  num_layers: z.number().optional().default(4),
5163
- outline: z.array(point).optional()
5219
+ outline: z.array(point).optional(),
5220
+ material: z.enum(["fr4", "fr1"]).default("fr4")
5164
5221
  }).describe("Defines the board outline of the PCB");
5165
5222
  expectTypesMatch(true);
5166
5223
  var pcb_placement_error = z.object({
@@ -5209,7 +5266,6 @@ var pcb_silkscreen_text = z.object({
5209
5266
  subcircuit_id: z.string().optional(),
5210
5267
  font: z.literal("tscircuit2024").default("tscircuit2024"),
5211
5268
  font_size: distance.default("0.2mm"),
5212
- stroke_width: length.optional().default("1mm"),
5213
5269
  pcb_component_id: z.string(),
5214
5270
  text: z.string(),
5215
5271
  ccw_rotation: z.number().optional(),
@@ -5334,18 +5390,6 @@ var pcb_missing_footprint_error = z.object({
5334
5390
  expectTypesMatch(
5335
5391
  true
5336
5392
  );
5337
- var pcb_manual_edit_conflict_error = z.object({
5338
- type: z.literal("pcb_manual_edit_conflict_error"),
5339
- pcb_error_id: getZodPrefixedIdWithDefault("pcb_manual_edit_conflict_error"),
5340
- message: z.string(),
5341
- pcb_component_id: z.string(),
5342
- pcb_group_id: z.string().optional(),
5343
- subcircuit_id: z.string().optional(),
5344
- source_component_id: z.string()
5345
- }).describe(
5346
- "Error emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"
5347
- );
5348
- expectTypesMatch(true);
5349
5393
  var pcb_group = z.object({
5350
5394
  type: z.literal("pcb_group"),
5351
5395
  pcb_group_id: getZodPrefixedIdWithDefault("pcb_group"),
@@ -5366,6 +5410,20 @@ var pcb_autorouting_error = z.object({
5366
5410
  message: z.string()
5367
5411
  }).describe("The autorouting has failed to route a portion of the board");
5368
5412
  expectTypesMatch(true);
5413
+ var pcb_manual_edit_conflict_warning = z.object({
5414
+ type: z.literal("pcb_manual_edit_conflict_warning"),
5415
+ pcb_manual_edit_conflict_warning_id: getZodPrefixedIdWithDefault(
5416
+ "pcb_manual_edit_conflict_warning"
5417
+ ),
5418
+ message: z.string(),
5419
+ pcb_component_id: z.string(),
5420
+ pcb_group_id: z.string().optional(),
5421
+ subcircuit_id: z.string().optional(),
5422
+ source_component_id: z.string()
5423
+ }).describe(
5424
+ "Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"
5425
+ );
5426
+ expectTypesMatch(true);
5369
5427
  var cad_component = z.object({
5370
5428
  type: z.literal("cad_component"),
5371
5429
  cad_component_id: z.string(),
@@ -5404,10 +5462,11 @@ var any_circuit_element = z.union([
5404
5462
  source_simple_mosfet,
5405
5463
  source_simple_potentiometer,
5406
5464
  source_simple_push_button,
5465
+ source_project_metadata,
5407
5466
  pcb_component,
5408
5467
  pcb_hole,
5409
5468
  pcb_missing_footprint_error,
5410
- pcb_manual_edit_conflict_error,
5469
+ pcb_manual_edit_conflict_warning,
5411
5470
  pcb_plated_hole,
5412
5471
  pcb_keepout,
5413
5472
  pcb_port,
@@ -5442,9 +5501,12 @@ var any_circuit_element = z.union([
5442
5501
  schematic_net_label,
5443
5502
  schematic_debug_object,
5444
5503
  schematic_voltage_probe,
5504
+ schematic_manual_edit_conflict_warning,
5445
5505
  cad_component
5446
5506
  ]);
5447
5507
  var any_soup_element = any_circuit_element;
5508
+ expectTypesMatch(true);
5509
+ expectStringUnionsMatch(true);
5448
5510
 
5449
5511
  // node_modules/@tscircuit/soup-util/dist/index.js
5450
5512
  import { applyToPoint, decomposeTSR } from "transformation-matrix";
@@ -5845,7 +5907,7 @@ var ToastContainer = () => {
5845
5907
  };
5846
5908
 
5847
5909
  // src/PCBViewer.tsx
5848
- import { useEffect as useEffect13, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
5910
+ import { useEffect as useEffect14, useMemo as useMemo6, useRef as useRef9, useState as useState10 } from "react";
5849
5911
 
5850
5912
  // node_modules/react-use/esm/misc/util.js
5851
5913
  var noop = function() {
@@ -7072,6 +7134,7 @@ var zIndexMap = {
7072
7134
  errorOverlay: 30,
7073
7135
  ratsNestOverlay: 20,
7074
7136
  toolbarOverlay: 20,
7137
+ warnings: 20,
7075
7138
  topLayer: 10
7076
7139
  // each layer after this is 1 less than the previous
7077
7140
  };
@@ -7106,6 +7169,7 @@ var LAYER_NAME_TO_COLOR = {
7106
7169
  ...colors_default.board
7107
7170
  };
7108
7171
  var DEFAULT_DRAW_ORDER = [
7172
+ "board",
7109
7173
  "top",
7110
7174
  "top_silkscreen",
7111
7175
  "bottom_silkscreen",
@@ -7655,6 +7719,7 @@ var drawPrimitives = (drawer, primitives) => {
7655
7719
  // src/components/CanvasPrimitiveRenderer.tsx
7656
7720
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
7657
7721
  var orderedLayers = [
7722
+ "board",
7658
7723
  "bottom_silkscreen",
7659
7724
  "bottom",
7660
7725
  "top",
@@ -7787,25 +7852,113 @@ var DebugGraphicsOverlay = ({
7787
7852
  );
7788
7853
  };
7789
7854
 
7855
+ // src/components/WarningGraphicsOverlay.tsx
7856
+ import { useEffect as useEffect6, useRef as useRef4 } from "react";
7857
+ import { applyToPoint as applyToPoint5, identity as identity3 } from "transformation-matrix";
7858
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
7859
+ var WarningGraphicsOverlay = ({
7860
+ children,
7861
+ transform = identity3(),
7862
+ elements = []
7863
+ }) => {
7864
+ const [containerRef, { width, height }] = useMeasure_default();
7865
+ const canvasRef = useRef4(null);
7866
+ useEffect6(() => {
7867
+ const canvas = canvasRef.current;
7868
+ if (!canvas || !width || !height) return;
7869
+ canvas.width = width;
7870
+ canvas.height = height;
7871
+ const ctx = canvas.getContext("2d");
7872
+ if (!ctx) return;
7873
+ ctx.clearRect(0, 0, width, height);
7874
+ const pcbComponents = elements.filter(
7875
+ (el) => el.type === "pcb_component"
7876
+ );
7877
+ const warnings = elements.filter(
7878
+ (el) => el.type === "pcb_manual_edit_conflict_warning"
7879
+ );
7880
+ ctx.strokeStyle = colors_default.board.drc_warning;
7881
+ ctx.lineWidth = 2;
7882
+ warnings.forEach((warning) => {
7883
+ const component = pcbComponents.find(
7884
+ (comp) => comp.pcb_component_id === warning.pcb_component_id
7885
+ );
7886
+ if (!component) return;
7887
+ const { width: width2, height: height2, center } = component;
7888
+ const transformedCenter = applyToPoint5(transform, center);
7889
+ const scaledWidth = width2 * Math.abs(transform.a);
7890
+ const scaledHeight = height2 * Math.abs(transform.d);
7891
+ const boxPadding = 0.1 * Math.abs(transform.a);
7892
+ const boxWidth = scaledWidth + boxPadding * 2;
7893
+ const boxHeight = scaledHeight + boxPadding * 2;
7894
+ const x = transformedCenter.x - boxWidth / 2;
7895
+ const y = transformedCenter.y - boxHeight / 2;
7896
+ ctx.beginPath();
7897
+ ctx.rect(x, y, boxWidth, boxHeight);
7898
+ ctx.stroke();
7899
+ const labelText = "Manual Edit Conflict";
7900
+ const labelPadding = 4;
7901
+ const fontSize = Math.max(8, Math.min(12, 10 * Math.abs(transform.a)));
7902
+ ctx.font = `${fontSize}px sans-serif`;
7903
+ const labelMetrics = ctx.measureText(labelText);
7904
+ const labelWidth = labelMetrics.width + labelPadding * 2;
7905
+ const labelHeight = fontSize + labelPadding * 2;
7906
+ const labelX = x + (boxWidth - labelWidth) / 2;
7907
+ const labelY = y + boxHeight + 5;
7908
+ ctx.fillStyle = "rgba(0, 0, 0, 0.7)";
7909
+ ctx.beginPath();
7910
+ ctx.roundRect(labelX, labelY, labelWidth, labelHeight, 3);
7911
+ ctx.fill();
7912
+ ctx.fillStyle = colors_default.board.drc_warning;
7913
+ ctx.textAlign = "center";
7914
+ ctx.textBaseline = "middle";
7915
+ ctx.fillText(labelText, labelX + labelWidth / 2, labelY + labelHeight / 2);
7916
+ });
7917
+ }, [elements, transform, width, height]);
7918
+ return /* @__PURE__ */ jsxs3(
7919
+ "div",
7920
+ {
7921
+ ref: containerRef,
7922
+ style: { position: "relative", width: "100%", height: "100%" },
7923
+ children: [
7924
+ children,
7925
+ /* @__PURE__ */ jsx5(
7926
+ "canvas",
7927
+ {
7928
+ ref: canvasRef,
7929
+ style: {
7930
+ position: "absolute",
7931
+ top: 0,
7932
+ left: 0,
7933
+ pointerEvents: "none",
7934
+ zIndex: zIndexMap.warnings
7935
+ }
7936
+ }
7937
+ )
7938
+ ]
7939
+ }
7940
+ );
7941
+ };
7942
+
7790
7943
  // src/components/DimensionOverlay.tsx
7791
- import { useEffect as useEffect6, useRef as useRef4, useState as useState3 } from "react";
7792
- import { applyToPoint as applyToPoint5, identity as identity3, inverse as inverse2 } from "transformation-matrix";
7793
- import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
7944
+ import { useEffect as useEffect7, useRef as useRef5, useState as useState3 } from "react";
7945
+ import { applyToPoint as applyToPoint6, identity as identity4, inverse as inverse2 } from "transformation-matrix";
7946
+ import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
7794
7947
  var DimensionOverlay = ({
7795
7948
  children,
7796
7949
  transform,
7797
7950
  focusOnHover = false
7798
7951
  }) => {
7799
- if (!transform) transform = identity3();
7952
+ if (!transform) transform = identity4();
7800
7953
  const [dimensionToolVisible, setDimensionToolVisible] = useState3(false);
7801
7954
  const [dimensionToolStretching, setDimensionToolStretching] = useState3(false);
7802
7955
  const [dStart, setDStart] = useState3({ x: 0, y: 0 });
7803
7956
  const [dEnd, setDEnd] = useState3({ x: 0, y: 0 });
7804
- const mousePosRef = useRef4({ x: 0, y: 0 });
7805
- const containerRef = useRef4(null);
7957
+ const mousePosRef = useRef5({ x: 0, y: 0 });
7958
+ const containerRef = useRef5(null);
7806
7959
  const container = containerRef.current;
7807
7960
  const containerBounds = container?.getBoundingClientRect();
7808
- useEffect6(() => {
7961
+ useEffect7(() => {
7809
7962
  const container2 = containerRef.current;
7810
7963
  const down = (e) => {
7811
7964
  if (e.key === "d") {
@@ -7844,8 +7997,8 @@ var DimensionOverlay = ({
7844
7997
  }
7845
7998
  };
7846
7999
  }, [containerRef]);
7847
- const screenDStart = applyToPoint5(transform, dStart);
7848
- const screenDEnd = applyToPoint5(transform, dEnd);
8000
+ const screenDStart = applyToPoint6(transform, dStart);
8001
+ const screenDEnd = applyToPoint6(transform, dEnd);
7849
8002
  const arrowScreenBounds = {
7850
8003
  left: Math.min(screenDStart.x, screenDEnd.x),
7851
8004
  right: Math.max(screenDStart.x, screenDEnd.x),
@@ -7858,7 +8011,7 @@ var DimensionOverlay = ({
7858
8011
  };
7859
8012
  arrowScreenBounds.width = arrowScreenBounds.right - arrowScreenBounds.left;
7860
8013
  arrowScreenBounds.height = arrowScreenBounds.bottom - arrowScreenBounds.top;
7861
- return /* @__PURE__ */ jsxs3(
8014
+ return /* @__PURE__ */ jsxs4(
7862
8015
  "div",
7863
8016
  {
7864
8017
  ref: containerRef,
@@ -7878,7 +8031,7 @@ var DimensionOverlay = ({
7878
8031
  const rect = e.currentTarget.getBoundingClientRect();
7879
8032
  const x = e.clientX - rect.left;
7880
8033
  const y = e.clientY - rect.top;
7881
- const rwPoint = applyToPoint5(inverse2(transform), { x, y });
8034
+ const rwPoint = applyToPoint6(inverse2(transform), { x, y });
7882
8035
  mousePosRef.current.x = rwPoint.x;
7883
8036
  mousePosRef.current.y = rwPoint.y;
7884
8037
  if (dimensionToolStretching) {
@@ -7894,8 +8047,8 @@ var DimensionOverlay = ({
7894
8047
  },
7895
8048
  children: [
7896
8049
  children,
7897
- dimensionToolVisible && /* @__PURE__ */ jsxs3(Fragment, { children: [
7898
- /* @__PURE__ */ jsx5(
8050
+ dimensionToolVisible && /* @__PURE__ */ jsxs4(Fragment, { children: [
8051
+ /* @__PURE__ */ jsx6(
7899
8052
  "div",
7900
8053
  {
7901
8054
  style: {
@@ -7915,7 +8068,7 @@ var DimensionOverlay = ({
7915
8068
  children: Math.abs(dStart.x - dEnd.x).toFixed(2)
7916
8069
  }
7917
8070
  ),
7918
- /* @__PURE__ */ jsx5(
8071
+ /* @__PURE__ */ jsx6(
7919
8072
  "div",
7920
8073
  {
7921
8074
  style: {
@@ -7933,7 +8086,7 @@ var DimensionOverlay = ({
7933
8086
  fontFamily: "sans-serif",
7934
8087
  zIndex: zIndexMap.dimensionOverlay
7935
8088
  },
7936
- children: /* @__PURE__ */ jsx5(
8089
+ children: /* @__PURE__ */ jsx6(
7937
8090
  "div",
7938
8091
  {
7939
8092
  style: {
@@ -7945,7 +8098,7 @@ var DimensionOverlay = ({
7945
8098
  )
7946
8099
  }
7947
8100
  ),
7948
- /* @__PURE__ */ jsxs3(
8101
+ /* @__PURE__ */ jsxs4(
7949
8102
  "svg",
7950
8103
  {
7951
8104
  style: {
@@ -7959,7 +8112,7 @@ var DimensionOverlay = ({
7959
8112
  width: containerBounds.width,
7960
8113
  height: containerBounds.height,
7961
8114
  children: [
7962
- /* @__PURE__ */ jsx5("defs", { children: /* @__PURE__ */ jsx5(
8115
+ /* @__PURE__ */ jsx6("defs", { children: /* @__PURE__ */ jsx6(
7963
8116
  "marker",
7964
8117
  {
7965
8118
  id: "head",
@@ -7968,10 +8121,10 @@ var DimensionOverlay = ({
7968
8121
  markerHeight: "4",
7969
8122
  refX: "2",
7970
8123
  refY: "2",
7971
- children: /* @__PURE__ */ jsx5("path", { d: "M0,0 V4 L2,2 Z", fill: "red" })
8124
+ children: /* @__PURE__ */ jsx6("path", { d: "M0,0 V4 L2,2 Z", fill: "red" })
7972
8125
  }
7973
8126
  ) }),
7974
- /* @__PURE__ */ jsx5(
8127
+ /* @__PURE__ */ jsx6(
7975
8128
  "line",
7976
8129
  {
7977
8130
  x1: screenDStart.x,
@@ -7984,7 +8137,7 @@ var DimensionOverlay = ({
7984
8137
  stroke: "red"
7985
8138
  }
7986
8139
  ),
7987
- /* @__PURE__ */ jsx5(
8140
+ /* @__PURE__ */ jsx6(
7988
8141
  "line",
7989
8142
  {
7990
8143
  x1: screenDStart.x,
@@ -7997,7 +8150,7 @@ var DimensionOverlay = ({
7997
8150
  stroke: "red"
7998
8151
  }
7999
8152
  ),
8000
- /* @__PURE__ */ jsx5(
8153
+ /* @__PURE__ */ jsx6(
8001
8154
  "line",
8002
8155
  {
8003
8156
  x1: screenDEnd.x,
@@ -8013,7 +8166,7 @@ var DimensionOverlay = ({
8013
8166
  ]
8014
8167
  }
8015
8168
  ),
8016
- /* @__PURE__ */ jsxs3(
8169
+ /* @__PURE__ */ jsxs4(
8017
8170
  "div",
8018
8171
  {
8019
8172
  style: {
@@ -8031,13 +8184,13 @@ var DimensionOverlay = ({
8031
8184
  ",",
8032
8185
  dStart.y.toFixed(2),
8033
8186
  ")",
8034
- /* @__PURE__ */ jsx5("br", {}),
8187
+ /* @__PURE__ */ jsx6("br", {}),
8035
8188
  "(",
8036
8189
  dEnd.x.toFixed(2),
8037
8190
  ",",
8038
8191
  dEnd.y.toFixed(2),
8039
8192
  ")",
8040
- /* @__PURE__ */ jsx5("br", {}),
8193
+ /* @__PURE__ */ jsx6("br", {}),
8041
8194
  "dist:",
8042
8195
  " ",
8043
8196
  Math.sqrt(
@@ -8053,9 +8206,9 @@ var DimensionOverlay = ({
8053
8206
  };
8054
8207
 
8055
8208
  // src/components/EditPlacementOverlay.tsx
8056
- import { useRef as useRef5, useState as useState4 } from "react";
8057
- import { applyToPoint as applyToPoint6, identity as identity4, inverse as inverse3 } from "transformation-matrix";
8058
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
8209
+ import { useRef as useRef6, useState as useState4 } from "react";
8210
+ import { applyToPoint as applyToPoint7, identity as identity5, inverse as inverse3 } from "transformation-matrix";
8211
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
8059
8212
  var isInsideOf = (pcb_component2, point2, padding = 0) => {
8060
8213
  const halfWidth = pcb_component2.width / 2;
8061
8214
  const halfHeight = pcb_component2.height / 2;
@@ -8074,8 +8227,8 @@ var EditPlacementOverlay = ({
8074
8227
  onCreateEditEvent,
8075
8228
  onModifyEditEvent
8076
8229
  }) => {
8077
- if (!transform) transform = identity4();
8078
- const containerRef = useRef5(null);
8230
+ if (!transform) transform = identity5();
8231
+ const containerRef = useRef6(null);
8079
8232
  const [activePcbComponentId, setActivePcbComponent] = useState4(
8080
8233
  null
8081
8234
  );
@@ -8085,7 +8238,7 @@ var EditPlacementOverlay = ({
8085
8238
  const in_move_footprint_mode = useGlobalStore((s) => s.in_move_footprint_mode);
8086
8239
  const setIsMovingComponent = useGlobalStore((s) => s.setIsMovingComponent);
8087
8240
  const disabled = disabledProp || !in_move_footprint_mode;
8088
- return /* @__PURE__ */ jsxs4(
8241
+ return /* @__PURE__ */ jsxs5(
8089
8242
  "div",
8090
8243
  {
8091
8244
  ref: containerRef,
@@ -8099,7 +8252,7 @@ var EditPlacementOverlay = ({
8099
8252
  const x = e.clientX - rect.left;
8100
8253
  const y = e.clientY - rect.top;
8101
8254
  if (Number.isNaN(x) || Number.isNaN(y)) return;
8102
- const rwMousePoint = applyToPoint6(inverse3(transform), { x, y });
8255
+ const rwMousePoint = applyToPoint7(inverse3(transform), { x, y });
8103
8256
  let foundActiveComponent = false;
8104
8257
  for (const e2 of soup) {
8105
8258
  if (e2.type === "pcb_component" && isInsideOf(e2, rwMousePoint, 10 / transform.a)) {
@@ -8141,7 +8294,7 @@ var EditPlacementOverlay = ({
8141
8294
  const x = e.clientX - rect.left;
8142
8295
  const y = e.clientY - rect.top;
8143
8296
  if (Number.isNaN(x) || Number.isNaN(y)) return;
8144
- const rwMousePoint = applyToPoint6(inverse3(transform), { x, y });
8297
+ const rwMousePoint = applyToPoint7(inverse3(transform), { x, y });
8145
8298
  setDragState({
8146
8299
  ...dragState,
8147
8300
  dragEnd: rwMousePoint
@@ -8170,8 +8323,8 @@ var EditPlacementOverlay = ({
8170
8323
  children,
8171
8324
  !disabled && soup.filter((e) => e.type === "pcb_component").map((e) => {
8172
8325
  if (!e?.center) return null;
8173
- const projectedCenter = applyToPoint6(transform, e.center);
8174
- return /* @__PURE__ */ jsx6(
8326
+ const projectedCenter = applyToPoint7(transform, e.center);
8327
+ return /* @__PURE__ */ jsx7(
8175
8328
  "div",
8176
8329
  {
8177
8330
  style: {
@@ -8195,21 +8348,21 @@ var EditPlacementOverlay = ({
8195
8348
  };
8196
8349
 
8197
8350
  // src/components/EditTraceHintOverlay.tsx
8198
- import { Fragment as Fragment2, useEffect as useEffect9, useRef as useRef6, useState as useState5 } from "react";
8351
+ import { Fragment as Fragment2, useEffect as useEffect10, useRef as useRef7, useState as useState5 } from "react";
8199
8352
  import {
8200
- applyToPoint as applyToPoint7,
8201
- identity as identity5,
8353
+ applyToPoint as applyToPoint8,
8354
+ identity as identity6,
8202
8355
  inverse as inverse4
8203
8356
  } from "transformation-matrix";
8204
8357
 
8205
8358
  // src/components/HotkeyActionMenu.tsx
8206
8359
  import { css } from "@emotion/css";
8207
- import { useEffect as useEffect8 } from "react";
8208
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
8360
+ import { useEffect as useEffect9 } from "react";
8361
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
8209
8362
  var HotkeyActionMenu = ({
8210
8363
  hotkeys
8211
8364
  }) => {
8212
- useEffect8(() => {
8365
+ useEffect9(() => {
8213
8366
  const handleKeyDown = (event) => {
8214
8367
  hotkeys.forEach((hotkey) => {
8215
8368
  if (event.key === hotkey.key) {
@@ -8222,7 +8375,7 @@ var HotkeyActionMenu = ({
8222
8375
  window.removeEventListener("keydown", handleKeyDown);
8223
8376
  };
8224
8377
  }, [hotkeys]);
8225
- return /* @__PURE__ */ jsx7(
8378
+ return /* @__PURE__ */ jsx8(
8226
8379
  "div",
8227
8380
  {
8228
8381
  className: css`
@@ -8233,7 +8386,7 @@ var HotkeyActionMenu = ({
8233
8386
  margin: 8px;
8234
8387
  `,
8235
8388
  children: hotkeys.map((hotkey) => {
8236
- return /* @__PURE__ */ jsxs5(
8389
+ return /* @__PURE__ */ jsxs6(
8237
8390
  "div",
8238
8391
  {
8239
8392
  className: css`
@@ -8258,9 +8411,9 @@ var HotkeyActionMenu = ({
8258
8411
  }
8259
8412
  `,
8260
8413
  children: [
8261
- /* @__PURE__ */ jsx7("div", { className: "key", children: hotkey.key }),
8414
+ /* @__PURE__ */ jsx8("div", { className: "key", children: hotkey.key }),
8262
8415
  " ",
8263
- /* @__PURE__ */ jsx7("div", { className: "name", children: hotkey.name })
8416
+ /* @__PURE__ */ jsx8("div", { className: "name", children: hotkey.name })
8264
8417
  ]
8265
8418
  },
8266
8419
  hotkey.name
@@ -8271,7 +8424,7 @@ var HotkeyActionMenu = ({
8271
8424
  };
8272
8425
 
8273
8426
  // src/components/EditTraceHintOverlay.tsx
8274
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
8427
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
8275
8428
  var isInsideOfSmtpad = (elm, point2, padding = 0) => {
8276
8429
  if (elm.shape === "circle") {
8277
8430
  return false;
@@ -8316,8 +8469,8 @@ var EditTraceHintOverlay = ({
8316
8469
  onCreateEditEvent,
8317
8470
  onModifyEditEvent
8318
8471
  }) => {
8319
- if (!transform) transform = identity5();
8320
- const containerRef = useRef6(null);
8472
+ if (!transform) transform = identity6();
8473
+ const containerRef = useRef7(null);
8321
8474
  const containerBounds = containerRef.current?.getBoundingClientRect();
8322
8475
  const [selectedElement, setSelectedElement] = useState5(null);
8323
8476
  const toast = useToast();
@@ -8328,10 +8481,10 @@ var EditTraceHintOverlay = ({
8328
8481
  const disabled = disabledProp || !in_edit_trace_mode;
8329
8482
  let ogCenterScreen, dragEndScreen;
8330
8483
  if (dragState?.originalCenter && dragState?.dragEnd) {
8331
- ogCenterScreen = applyToPoint7(transform, dragState?.originalCenter);
8332
- dragEndScreen = applyToPoint7(transform, dragState?.dragEnd);
8484
+ ogCenterScreen = applyToPoint8(transform, dragState?.originalCenter);
8485
+ dragEndScreen = applyToPoint8(transform, dragState?.dragEnd);
8333
8486
  }
8334
- useEffect9(() => {
8487
+ useEffect10(() => {
8335
8488
  if (!isElementSelected) return;
8336
8489
  function keyDown(e) {
8337
8490
  if (e.key === "Escape") {
@@ -8342,7 +8495,7 @@ var EditTraceHintOverlay = ({
8342
8495
  window.addEventListener("keydown", keyDown);
8343
8496
  return () => window.removeEventListener("keydown", keyDown);
8344
8497
  }, [isElementSelected]);
8345
- return /* @__PURE__ */ jsxs6(
8498
+ return /* @__PURE__ */ jsxs7(
8346
8499
  "div",
8347
8500
  {
8348
8501
  ref: containerRef,
@@ -8356,7 +8509,7 @@ var EditTraceHintOverlay = ({
8356
8509
  const x = e.clientX - rect.left;
8357
8510
  const y = e.clientY - rect.top;
8358
8511
  if (isNaN(x) || isNaN(y)) return;
8359
- const rwMousePoint = applyToPoint7(inverse4(transform), { x, y });
8512
+ const rwMousePoint = applyToPoint8(inverse4(transform), { x, y });
8360
8513
  if (!isElementSelected) {
8361
8514
  for (const e2 of soup) {
8362
8515
  if (e2.type === "pcb_smtpad" && isInsideOfSmtpad(e2, rwMousePoint, 10 / transform.a) || e2.type === "pcb_plated_hole" && isInsideOfPlatedHole(e2, rwMousePoint, 10 / transform.a)) {
@@ -8399,7 +8552,7 @@ var EditTraceHintOverlay = ({
8399
8552
  const x = e.clientX - rect.left;
8400
8553
  const y = e.clientY - rect.top;
8401
8554
  if (isNaN(x) || isNaN(y)) return;
8402
- const rwMousePoint = applyToPoint7(inverse4(transform), { x, y });
8555
+ const rwMousePoint = applyToPoint8(inverse4(transform), { x, y });
8403
8556
  setDragState({
8404
8557
  ...dragState,
8405
8558
  dragEnd: rwMousePoint
@@ -8418,10 +8571,10 @@ var EditTraceHintOverlay = ({
8418
8571
  const x = e.clientX - rect.left;
8419
8572
  const y = e.clientY - rect.top;
8420
8573
  if (isNaN(x) || isNaN(y)) return;
8421
- const rwMousePoint = applyToPoint7(inverse4(transform), { x, y });
8574
+ const rwMousePoint = applyToPoint8(inverse4(transform), { x, y });
8422
8575
  if (dragState) {
8423
8576
  cancelPanDrag();
8424
- const lastPointScreen = applyToPoint7(
8577
+ const lastPointScreen = applyToPoint8(
8425
8578
  transform,
8426
8579
  dragState.editEvent.route.slice(-1)[0] ?? dragState.originalCenter
8427
8580
  );
@@ -8451,7 +8604,7 @@ var EditTraceHintOverlay = ({
8451
8604
  },
8452
8605
  children: [
8453
8606
  children,
8454
- in_edit_trace_mode && dragState?.editEvent && ogCenterScreen && dragEndScreen && /* @__PURE__ */ jsxs6(
8607
+ in_edit_trace_mode && dragState?.editEvent && ogCenterScreen && dragEndScreen && /* @__PURE__ */ jsxs7(
8455
8608
  "svg",
8456
8609
  {
8457
8610
  style: {
@@ -8465,21 +8618,21 @@ var EditTraceHintOverlay = ({
8465
8618
  width: containerBounds?.width,
8466
8619
  height: containerBounds?.height,
8467
8620
  children: [
8468
- /* @__PURE__ */ jsx8(
8621
+ /* @__PURE__ */ jsx9(
8469
8622
  "path",
8470
8623
  {
8471
8624
  stroke: "red",
8472
- d: `M ${ogCenterScreen.x} ${ogCenterScreen.y} ${dragState?.editEvent.route.map((p) => applyToPoint7(transform, p)).map((p) => `L ${p.x} ${p.y}`).join(" ")} L ${dragEndScreen.x} ${dragEndScreen.y}`
8625
+ d: `M ${ogCenterScreen.x} ${ogCenterScreen.y} ${dragState?.editEvent.route.map((p) => applyToPoint8(transform, p)).map((p) => `L ${p.x} ${p.y}`).join(" ")} L ${dragEndScreen.x} ${dragEndScreen.y}`
8473
8626
  }
8474
8627
  ),
8475
8628
  dragState?.editEvent.route.map((r, i) => {
8476
- const rScreen = applyToPoint7(transform, r);
8477
- return /* @__PURE__ */ jsxs6(Fragment2, { children: [
8478
- r.via && /* @__PURE__ */ jsx8("circle", { cx: rScreen.x, cy: rScreen.y, r: 16, stroke: "red" }),
8479
- /* @__PURE__ */ jsx8("circle", { cx: rScreen.x, cy: rScreen.y, r: 8, stroke: "red" })
8629
+ const rScreen = applyToPoint8(transform, r);
8630
+ return /* @__PURE__ */ jsxs7(Fragment2, { children: [
8631
+ r.via && /* @__PURE__ */ jsx9("circle", { cx: rScreen.x, cy: rScreen.y, r: 16, stroke: "red" }),
8632
+ /* @__PURE__ */ jsx9("circle", { cx: rScreen.x, cy: rScreen.y, r: 8, stroke: "red" })
8480
8633
  ] }, `r-${i}`);
8481
8634
  }),
8482
- shouldCreateAsVia && /* @__PURE__ */ jsx8(
8635
+ shouldCreateAsVia && /* @__PURE__ */ jsx9(
8483
8636
  "circle",
8484
8637
  {
8485
8638
  cx: dragEndScreen.x,
@@ -8489,7 +8642,7 @@ var EditTraceHintOverlay = ({
8489
8642
  },
8490
8643
  "via-outer-circle"
8491
8644
  ),
8492
- /* @__PURE__ */ jsx8(
8645
+ /* @__PURE__ */ jsx9(
8493
8646
  "circle",
8494
8647
  {
8495
8648
  cx: dragEndScreen.x,
@@ -8501,7 +8654,7 @@ var EditTraceHintOverlay = ({
8501
8654
  ]
8502
8655
  }
8503
8656
  ),
8504
- !disabled && /* @__PURE__ */ jsx8(
8657
+ !disabled && /* @__PURE__ */ jsx9(
8505
8658
  "svg",
8506
8659
  {
8507
8660
  style: {
@@ -8517,9 +8670,9 @@ var EditTraceHintOverlay = ({
8517
8670
  children: soup.filter((e) => e.type === "pcb_trace_hint").map((e) => {
8518
8671
  const { route } = e;
8519
8672
  const pcb_port2 = su_default(soup).pcb_port.get(e.pcb_port_id);
8520
- const pcb_port_screen = applyToPoint7(transform, pcb_port2);
8521
- return /* @__PURE__ */ jsxs6(Fragment2, { children: [
8522
- /* @__PURE__ */ jsx8(
8673
+ const pcb_port_screen = applyToPoint8(transform, pcb_port2);
8674
+ return /* @__PURE__ */ jsxs7(Fragment2, { children: [
8675
+ /* @__PURE__ */ jsx9(
8523
8676
  "rect",
8524
8677
  {
8525
8678
  x: pcb_port_screen.x - 10,
@@ -8530,17 +8683,17 @@ var EditTraceHintOverlay = ({
8530
8683
  },
8531
8684
  `rect-${e.pcb_port_id}`
8532
8685
  ),
8533
- /* @__PURE__ */ jsx8(
8686
+ /* @__PURE__ */ jsx9(
8534
8687
  "path",
8535
8688
  {
8536
8689
  stroke: "red",
8537
- d: `M ${pcb_port_screen.x} ${pcb_port_screen.y} ${route.map((r) => applyToPoint7(transform, r)).map((r) => `L ${r.x} ${r.y}`).join(" ")}`
8690
+ d: `M ${pcb_port_screen.x} ${pcb_port_screen.y} ${route.map((r) => applyToPoint8(transform, r)).map((r) => `L ${r.x} ${r.y}`).join(" ")}`
8538
8691
  },
8539
8692
  `path-${e.pcb_port_id}`
8540
8693
  ),
8541
- route.map((r) => ({ ...r, ...applyToPoint7(transform, r) })).map((r, i) => /* @__PURE__ */ jsxs6(Fragment2, { children: [
8542
- /* @__PURE__ */ jsx8("circle", { cx: r.x, cy: r.y, r: 8, stroke: "red" }),
8543
- r.via && /* @__PURE__ */ jsx8(
8694
+ route.map((r) => ({ ...r, ...applyToPoint8(transform, r) })).map((r, i) => /* @__PURE__ */ jsxs7(Fragment2, { children: [
8695
+ /* @__PURE__ */ jsx9("circle", { cx: r.x, cy: r.y, r: 8, stroke: "red" }),
8696
+ r.via && /* @__PURE__ */ jsx9(
8544
8697
  "circle",
8545
8698
  {
8546
8699
  cx: r.x,
@@ -8556,7 +8709,7 @@ var EditTraceHintOverlay = ({
8556
8709
  },
8557
8710
  "pcb-trace-hints"
8558
8711
  ),
8559
- /* @__PURE__ */ jsx8(
8712
+ /* @__PURE__ */ jsx9(
8560
8713
  "div",
8561
8714
  {
8562
8715
  style: {
@@ -8564,7 +8717,7 @@ var EditTraceHintOverlay = ({
8564
8717
  right: 0,
8565
8718
  bottom: 0
8566
8719
  },
8567
- children: isElementSelected && /* @__PURE__ */ jsx8(
8720
+ children: isElementSelected && /* @__PURE__ */ jsx9(
8568
8721
  HotkeyActionMenu,
8569
8722
  {
8570
8723
  hotkeys: [
@@ -8597,15 +8750,15 @@ var EditTraceHintOverlay = ({
8597
8750
 
8598
8751
  // src/components/ErrorOverlay.tsx
8599
8752
  import { css as css2 } from "@emotion/css";
8600
- import { useRef as useRef7 } from "react";
8601
- import { applyToPoint as applyToPoint8, identity as identity6 } from "transformation-matrix";
8602
- import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
8753
+ import { useRef as useRef8 } from "react";
8754
+ import { applyToPoint as applyToPoint9, identity as identity7 } from "transformation-matrix";
8755
+ import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
8603
8756
  var ErrorSVG = ({
8604
8757
  screenPort1,
8605
8758
  screenPort2,
8606
8759
  errorCenter,
8607
8760
  canLineBeDrawn
8608
- }) => /* @__PURE__ */ jsx9(
8761
+ }) => /* @__PURE__ */ jsx10(
8609
8762
  "svg",
8610
8763
  {
8611
8764
  style: {
@@ -8618,8 +8771,8 @@ var ErrorSVG = ({
8618
8771
  },
8619
8772
  width: "100%",
8620
8773
  height: "100%",
8621
- children: canLineBeDrawn && /* @__PURE__ */ jsxs7(Fragment3, { children: [
8622
- /* @__PURE__ */ jsx9(
8774
+ children: canLineBeDrawn && /* @__PURE__ */ jsxs8(Fragment3, { children: [
8775
+ /* @__PURE__ */ jsx10(
8623
8776
  "line",
8624
8777
  {
8625
8778
  x1: screenPort1.x,
@@ -8631,7 +8784,7 @@ var ErrorSVG = ({
8631
8784
  stroke: "red"
8632
8785
  }
8633
8786
  ),
8634
- /* @__PURE__ */ jsx9(
8787
+ /* @__PURE__ */ jsx10(
8635
8788
  "line",
8636
8789
  {
8637
8790
  x1: errorCenter.x,
@@ -8643,7 +8796,7 @@ var ErrorSVG = ({
8643
8796
  stroke: "red"
8644
8797
  }
8645
8798
  ),
8646
- /* @__PURE__ */ jsx9(
8799
+ /* @__PURE__ */ jsx10(
8647
8800
  "rect",
8648
8801
  {
8649
8802
  x: errorCenter.x - 5,
@@ -8658,9 +8811,9 @@ var ErrorSVG = ({
8658
8811
  }
8659
8812
  );
8660
8813
  var ErrorOverlay = ({ children, transform, elements }) => {
8661
- if (!transform) transform = identity6();
8662
- const containerRef = useRef7(null);
8663
- return /* @__PURE__ */ jsxs7("div", { style: { position: "relative" }, ref: containerRef, children: [
8814
+ if (!transform) transform = identity7();
8815
+ const containerRef = useRef8(null);
8816
+ return /* @__PURE__ */ jsxs8("div", { style: { position: "relative" }, ref: containerRef, children: [
8664
8817
  children,
8665
8818
  elements?.filter((el) => el.type === "pcb_trace_error").map((el) => {
8666
8819
  const { pcb_port_ids } = el;
@@ -8671,11 +8824,11 @@ var ErrorOverlay = ({ children, transform, elements }) => {
8671
8824
  (el2) => el2.type === "pcb_port" && el2.pcb_port_id === pcb_port_ids?.[1]
8672
8825
  );
8673
8826
  if (!port1 || !port2) return null;
8674
- const screenPort1 = applyToPoint8(transform, {
8827
+ const screenPort1 = applyToPoint9(transform, {
8675
8828
  x: port1.x,
8676
8829
  y: port1.y
8677
8830
  });
8678
- const screenPort2 = applyToPoint8(transform, {
8831
+ const screenPort2 = applyToPoint9(transform, {
8679
8832
  x: port2.x,
8680
8833
  y: port2.y
8681
8834
  });
@@ -8687,8 +8840,8 @@ var ErrorOverlay = ({ children, transform, elements }) => {
8687
8840
  if (isNaN(errorCenter.x) || isNaN(errorCenter.y)) {
8688
8841
  return null;
8689
8842
  }
8690
- return /* @__PURE__ */ jsxs7(Fragment3, { children: [
8691
- /* @__PURE__ */ jsx9(
8843
+ return /* @__PURE__ */ jsxs8(Fragment3, { children: [
8844
+ /* @__PURE__ */ jsx10(
8692
8845
  ErrorSVG,
8693
8846
  {
8694
8847
  screenPort1,
@@ -8697,7 +8850,7 @@ var ErrorOverlay = ({ children, transform, elements }) => {
8697
8850
  canLineBeDrawn
8698
8851
  }
8699
8852
  ),
8700
- /* @__PURE__ */ jsxs7(
8853
+ /* @__PURE__ */ jsxs8(
8701
8854
  "div",
8702
8855
  {
8703
8856
  className: css2`
@@ -8730,8 +8883,8 @@ var ErrorOverlay = ({ children, transform, elements }) => {
8730
8883
  }
8731
8884
  `,
8732
8885
  children: [
8733
- /* @__PURE__ */ jsx9("div", { className: "error-message", children: el.message }),
8734
- /* @__PURE__ */ jsx9(
8886
+ /* @__PURE__ */ jsx10("div", { className: "error-message", children: el.message }),
8887
+ /* @__PURE__ */ jsx10(
8735
8888
  "div",
8736
8889
  {
8737
8890
  className: css2`
@@ -8752,10 +8905,10 @@ var ErrorOverlay = ({ children, transform, elements }) => {
8752
8905
 
8753
8906
  // src/components/MouseElementTracker.tsx
8754
8907
  import { useState as useState7, useMemo as useMemo3 } from "react";
8755
- import { applyToPoint as applyToPoint9, inverse as inverse5 } from "transformation-matrix";
8908
+ import { applyToPoint as applyToPoint10, inverse as inverse5 } from "transformation-matrix";
8756
8909
 
8757
8910
  // src/components/ElementOverlayBox.tsx
8758
- import { useEffect as useEffect10, useState as useState6 } from "react";
8911
+ import { useEffect as useEffect11, useState as useState6 } from "react";
8759
8912
 
8760
8913
  // src/lib/get-trace-overlay-text.ts
8761
8914
  function getTraceOverlayInfo({
@@ -8810,7 +8963,7 @@ function filterTracesIfMultiple(filterTraces) {
8810
8963
  }
8811
8964
 
8812
8965
  // src/components/ElementOverlayBox.tsx
8813
- import { jsx as jsx10 } from "react/jsx-runtime";
8966
+ import { jsx as jsx11 } from "react/jsx-runtime";
8814
8967
  var containerStyle = {
8815
8968
  position: "absolute",
8816
8969
  left: 0,
@@ -8867,7 +9020,7 @@ var HighlightedPrimitiveBoxWithText = ({
8867
9020
  }) => {
8868
9021
  const [finalState, setFinalState] = useState6(false);
8869
9022
  const primitiveElement = primitive._element;
8870
- useEffect10(() => {
9023
+ useEffect11(() => {
8871
9024
  setTimeout(() => {
8872
9025
  setFinalState(true);
8873
9026
  }, 100);
@@ -8890,7 +9043,7 @@ var HighlightedPrimitiveBoxWithText = ({
8890
9043
  const overlayInfo = getTraceOverlayInfo(traceTextContext);
8891
9044
  if (!overlayInfo) return null;
8892
9045
  const yOffset = mousePos.y - 35;
8893
- return /* @__PURE__ */ jsx10(
9046
+ return /* @__PURE__ */ jsx11(
8894
9047
  "div",
8895
9048
  {
8896
9049
  style: {
@@ -8902,7 +9055,7 @@ var HighlightedPrimitiveBoxWithText = ({
8902
9055
  pointerEvents: "none",
8903
9056
  transform: "translateX(-50%)"
8904
9057
  },
8905
- children: /* @__PURE__ */ jsx10(
9058
+ children: /* @__PURE__ */ jsx11(
8906
9059
  "div",
8907
9060
  {
8908
9061
  style: {
@@ -8924,7 +9077,7 @@ var HighlightedPrimitiveBoxWithText = ({
8924
9077
  }
8925
9078
  );
8926
9079
  }
8927
- return /* @__PURE__ */ jsx10(
9080
+ return /* @__PURE__ */ jsx11(
8928
9081
  "div",
8929
9082
  {
8930
9083
  style: {
@@ -8938,7 +9091,7 @@ var HighlightedPrimitiveBoxWithText = ({
8938
9091
  transform: `rotate(${-rotation2}deg)`,
8939
9092
  transformOrigin: "center center"
8940
9093
  },
8941
- children: /* @__PURE__ */ jsx10(
9094
+ children: /* @__PURE__ */ jsx11(
8942
9095
  "div",
8943
9096
  {
8944
9097
  style: {
@@ -8954,7 +9107,7 @@ var HighlightedPrimitiveBoxWithText = ({
8954
9107
  opacity: finalState ? 1 : si === 0 ? 1 : 0,
8955
9108
  transition: "width 0.2s, height 0.2s, margin-left 0.2s, margin-top 0.2s, opacity 0.2s"
8956
9109
  },
8957
- children: /* @__PURE__ */ jsx10(
9110
+ children: /* @__PURE__ */ jsx11(
8958
9111
  "div",
8959
9112
  {
8960
9113
  style: {
@@ -9002,7 +9155,7 @@ var ElementOverlayBox = ({
9002
9155
  is_showing_multiple_traces_length,
9003
9156
  elements
9004
9157
  });
9005
- return /* @__PURE__ */ jsx10("div", { style: containerStyle, children: !is_moving_component && primitives.map((primitive, i) => /* @__PURE__ */ jsx10(
9158
+ return /* @__PURE__ */ jsx11("div", { style: containerStyle, children: !is_moving_component && primitives.map((primitive, i) => /* @__PURE__ */ jsx11(
9006
9159
  HighlightedPrimitiveBoxWithText,
9007
9160
  {
9008
9161
  primitive,
@@ -9021,7 +9174,7 @@ function ifSetsMatchExactly(set1, set2) {
9021
9174
 
9022
9175
  // src/components/MouseElementTracker.tsx
9023
9176
  import { pointToSegmentDistance } from "@tscircuit/math-utils";
9024
- import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
9177
+ import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
9025
9178
  var getPrimitivesUnderPoint = (primitives, rwPoint, transform) => {
9026
9179
  const newMousedPrimitives = [];
9027
9180
  for (const primitive of primitives) {
@@ -9072,7 +9225,7 @@ var MouseElementTracker = ({
9072
9225
  if (primitive._element?.type === "pcb_via") continue;
9073
9226
  if (primitive._element?.type === "pcb_component") continue;
9074
9227
  if (primitive?.layer === "drill") continue;
9075
- const screenPos = applyToPoint9(
9228
+ const screenPos = applyToPoint10(
9076
9229
  transform,
9077
9230
  primitive
9078
9231
  );
@@ -9098,7 +9251,7 @@ var MouseElementTracker = ({
9098
9251
  }, [mousedPrimitives, transform]);
9099
9252
  const handleInteraction = (x, y, transform2, primitives2) => {
9100
9253
  setMousePos({ x, y });
9101
- const rwPoint = applyToPoint9(inverse5(transform2), { x, y });
9254
+ const rwPoint = applyToPoint10(inverse5(transform2), { x, y });
9102
9255
  const newMousedPrimitives = getPrimitivesUnderPoint(
9103
9256
  primitives2,
9104
9257
  rwPoint,
@@ -9113,7 +9266,7 @@ var MouseElementTracker = ({
9113
9266
  setMousedPrimitives(newMousedPrimitives);
9114
9267
  onMouseHoverOverPrimitives(newMousedPrimitives);
9115
9268
  };
9116
- return /* @__PURE__ */ jsxs8(
9269
+ return /* @__PURE__ */ jsxs9(
9117
9270
  "div",
9118
9271
  {
9119
9272
  style: { position: "relative" },
@@ -9136,7 +9289,7 @@ var MouseElementTracker = ({
9136
9289
  },
9137
9290
  children: [
9138
9291
  children,
9139
- /* @__PURE__ */ jsx11(
9292
+ /* @__PURE__ */ jsx12(
9140
9293
  ElementOverlayBox,
9141
9294
  {
9142
9295
  elements,
@@ -9150,10 +9303,10 @@ var MouseElementTracker = ({
9150
9303
  };
9151
9304
 
9152
9305
  // src/components/RatsNestOverlay.tsx
9153
- import { applyToPoint as applyToPoint10, identity as identity7 } from "transformation-matrix";
9306
+ import { applyToPoint as applyToPoint11, identity as identity8 } from "transformation-matrix";
9154
9307
  import { getFullConnectivityMapFromCircuitJson } from "circuit-json-to-connectivity-map";
9155
9308
  import { useMemo as useMemo4 } from "react";
9156
- import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
9309
+ import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
9157
9310
  var RatsNestOverlay = ({ transform, soup, children }) => {
9158
9311
  const isShowingRatsNest = useGlobalStore((s) => s.is_showing_rats_nest);
9159
9312
  const { netMap, idToNetMap } = useMemo4(
@@ -9215,10 +9368,10 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
9215
9368
  return lines;
9216
9369
  }, [soup, netMap, idToNetMap, isShowingRatsNest]);
9217
9370
  if (!soup || !isShowingRatsNest) return children;
9218
- if (!transform) transform = identity7();
9219
- return /* @__PURE__ */ jsxs9("div", { style: { position: "relative" }, children: [
9371
+ if (!transform) transform = identity8();
9372
+ return /* @__PURE__ */ jsxs10("div", { style: { position: "relative" }, children: [
9220
9373
  children,
9221
- /* @__PURE__ */ jsx12(
9374
+ /* @__PURE__ */ jsx13(
9222
9375
  "svg",
9223
9376
  {
9224
9377
  style: {
@@ -9232,9 +9385,9 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
9232
9385
  zIndex: zIndexMap.ratsNestOverlay
9233
9386
  },
9234
9387
  children: ratsNestLines.map(({ key, startPoint, endPoint, isInNet }) => {
9235
- const transformedStart = applyToPoint10(transform, startPoint);
9236
- const transformedEnd = applyToPoint10(transform, endPoint);
9237
- return /* @__PURE__ */ jsx12(
9388
+ const transformedStart = applyToPoint11(transform, startPoint);
9389
+ const transformedEnd = applyToPoint11(transform, endPoint);
9390
+ return /* @__PURE__ */ jsx13(
9238
9391
  "line",
9239
9392
  {
9240
9393
  x1: transformedStart.x,
@@ -9260,7 +9413,7 @@ import { css as css3 } from "@emotion/css";
9260
9413
  // package.json
9261
9414
  var package_default = {
9262
9415
  name: "@tscircuit/pcb-viewer",
9263
- version: "1.11.107",
9416
+ version: "1.11.109",
9264
9417
  main: "dist/index.js",
9265
9418
  type: "module",
9266
9419
  repository: "tscircuit/pcb-viewer",
@@ -9286,14 +9439,13 @@ var package_default = {
9286
9439
  "@storybook/nextjs": "^8.0.6",
9287
9440
  "@storybook/react": "^8.0.6",
9288
9441
  "@swc/core": "^1.4.12",
9289
- "@tscircuit/core": "0.0.372",
9290
9442
  "@tscircuit/eagle-xml-converter": "^1.0.0",
9291
9443
  "@tscircuit/props": "^0.0.172",
9292
9444
  "@tscircuit/soup-util": "^0.0.41",
9293
9445
  "@types/color": "^3.0.6",
9294
9446
  "@types/node": "18.7.23",
9295
9447
  "@types/react": "^18.3.3",
9296
- "circuit-json": "^0.0.148",
9448
+ "circuit-json": "^0.0.158",
9297
9449
  next: "^14.1.4",
9298
9450
  "pixi.js": "^8.6.6",
9299
9451
  react: "^18.2.0",
@@ -9307,11 +9459,11 @@ var package_default = {
9307
9459
  zod: "^3.23.5"
9308
9460
  },
9309
9461
  peerDependencies: {
9310
- react: "*",
9311
- "@tscircuit/core": "*"
9462
+ react: "*"
9312
9463
  },
9313
9464
  dependencies: {
9314
9465
  "@emotion/css": "^11.11.2",
9466
+ "@tscircuit/core": "^0.0.380",
9315
9467
  "@tscircuit/math-utils": "^0.0.16",
9316
9468
  "circuit-json-to-connectivity-map": "^0.0.20",
9317
9469
  "circuit-to-svg": "^0.0.36",
@@ -9325,12 +9477,12 @@ var package_default = {
9325
9477
  };
9326
9478
 
9327
9479
  // src/hooks/useHotKey.ts
9328
- import { useEffect as useEffect11 } from "react";
9480
+ import { useEffect as useEffect12 } from "react";
9329
9481
  var useHotKey = (key, onUse) => {
9330
9482
  const isMouseOverContainer = useGlobalStore(
9331
9483
  (s) => s.is_mouse_over_container
9332
9484
  );
9333
- useEffect11(() => {
9485
+ useEffect12(() => {
9334
9486
  if (!key || typeof onUse !== "function") return;
9335
9487
  const handleKeyDown = (event) => {
9336
9488
  const keyParts = key.split("+");
@@ -9352,13 +9504,13 @@ var useHotKey = (key, onUse) => {
9352
9504
  };
9353
9505
 
9354
9506
  // src/components/ToolbarOverlay.tsx
9355
- import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
9507
+ import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
9356
9508
  var LayerButton = ({
9357
9509
  name,
9358
9510
  selected,
9359
9511
  onClick
9360
9512
  }) => {
9361
- return /* @__PURE__ */ jsxs10(
9513
+ return /* @__PURE__ */ jsxs11(
9362
9514
  "div",
9363
9515
  {
9364
9516
  className: css3`
@@ -9374,8 +9526,8 @@ var LayerButton = ({
9374
9526
  `,
9375
9527
  onClick,
9376
9528
  children: [
9377
- /* @__PURE__ */ jsx13("span", { style: { marginRight: 2, opacity: selected ? 1 : 0 }, children: "\u2022" }),
9378
- /* @__PURE__ */ jsx13(
9529
+ /* @__PURE__ */ jsx14("span", { style: { marginRight: 2, opacity: selected ? 1 : 0 }, children: "\u2022" }),
9530
+ /* @__PURE__ */ jsx14(
9379
9531
  "span",
9380
9532
  {
9381
9533
  style: {
@@ -9390,7 +9542,7 @@ var LayerButton = ({
9390
9542
  }
9391
9543
  );
9392
9544
  };
9393
- var ToolbarButton = ({ children, ...props }) => /* @__PURE__ */ jsx13(
9545
+ var ToolbarButton = ({ children, ...props }) => /* @__PURE__ */ jsx14(
9394
9546
  "div",
9395
9547
  {
9396
9548
  ...props,
@@ -9415,7 +9567,7 @@ var CheckboxMenuItem = ({
9415
9567
  checked,
9416
9568
  onClick
9417
9569
  }) => {
9418
- return /* @__PURE__ */ jsxs10(
9570
+ return /* @__PURE__ */ jsxs11(
9419
9571
  "div",
9420
9572
  {
9421
9573
  className: css3`
@@ -9437,8 +9589,8 @@ var CheckboxMenuItem = ({
9437
9589
  onClick();
9438
9590
  },
9439
9591
  children: [
9440
- /* @__PURE__ */ jsx13("input", { type: "checkbox", checked }),
9441
- /* @__PURE__ */ jsx13("span", { style: { color: "#eee" }, children: label })
9592
+ /* @__PURE__ */ jsx14("input", { type: "checkbox", checked }),
9593
+ /* @__PURE__ */ jsx14("span", { style: { color: "#eee" }, children: label })
9442
9594
  ]
9443
9595
  }
9444
9596
  );
@@ -9483,7 +9635,7 @@ var ToolbarOverlay = ({ children, elements }) => {
9483
9635
  useHotKey("7", () => selectLayer("inner5"));
9484
9636
  useHotKey("8", () => selectLayer("inner6"));
9485
9637
  const errorCount = elements?.filter((e) => e.type.includes("error")).length ?? 0;
9486
- return /* @__PURE__ */ jsxs10(
9638
+ return /* @__PURE__ */ jsxs11(
9487
9639
  "div",
9488
9640
  {
9489
9641
  style: { position: "relative" },
@@ -9496,7 +9648,7 @@ var ToolbarOverlay = ({ children, elements }) => {
9496
9648
  },
9497
9649
  children: [
9498
9650
  children,
9499
- /* @__PURE__ */ jsxs10(
9651
+ /* @__PURE__ */ jsxs11(
9500
9652
  "div",
9501
9653
  {
9502
9654
  style: {
@@ -9517,7 +9669,7 @@ var ToolbarOverlay = ({ children, elements }) => {
9517
9669
  ]
9518
9670
  }
9519
9671
  ),
9520
- /* @__PURE__ */ jsxs10(
9672
+ /* @__PURE__ */ jsxs11(
9521
9673
  "div",
9522
9674
  {
9523
9675
  style: {
@@ -9534,7 +9686,7 @@ var ToolbarOverlay = ({ children, elements }) => {
9534
9686
  fontFamily: "sans-serif"
9535
9687
  },
9536
9688
  children: [
9537
- /* @__PURE__ */ jsxs10(
9689
+ /* @__PURE__ */ jsxs11(
9538
9690
  ToolbarButton,
9539
9691
  {
9540
9692
  onClick: () => {
@@ -9546,10 +9698,10 @@ var ToolbarOverlay = ({ children, elements }) => {
9546
9698
  }
9547
9699
  },
9548
9700
  children: [
9549
- /* @__PURE__ */ jsxs10("div", { children: [
9701
+ /* @__PURE__ */ jsxs11("div", { children: [
9550
9702
  "layer:",
9551
9703
  " ",
9552
- /* @__PURE__ */ jsx13(
9704
+ /* @__PURE__ */ jsx14(
9553
9705
  "span",
9554
9706
  {
9555
9707
  style: {
@@ -9561,7 +9713,7 @@ var ToolbarOverlay = ({ children, elements }) => {
9561
9713
  }
9562
9714
  )
9563
9715
  ] }),
9564
- isLayerMenuOpen && /* @__PURE__ */ jsx13("div", { style: { marginTop: 4, minWidth: 120 }, children: all_layers.map((l) => l.replace(/-/g, "")).map((layer) => /* @__PURE__ */ jsx13(
9716
+ isLayerMenuOpen && /* @__PURE__ */ jsx14("div", { style: { marginTop: 4, minWidth: 120 }, children: all_layers.map((l) => l.replace(/-/g, "")).map((layer) => /* @__PURE__ */ jsx14(
9565
9717
  LayerButton,
9566
9718
  {
9567
9719
  name: layer,
@@ -9575,77 +9727,77 @@ var ToolbarOverlay = ({ children, elements }) => {
9575
9727
  ]
9576
9728
  }
9577
9729
  ),
9578
- /* @__PURE__ */ jsxs10(
9730
+ /* @__PURE__ */ jsxs11(
9579
9731
  ToolbarButton,
9580
9732
  {
9581
9733
  style: errorCount > 0 ? { color: "red" } : {},
9582
9734
  onClick: () => setErrorsOpen(!isErrorsOpen),
9583
9735
  onMouseLeave: () => setErrorsOpen(false),
9584
9736
  children: [
9585
- /* @__PURE__ */ jsxs10("div", { children: [
9737
+ /* @__PURE__ */ jsxs11("div", { children: [
9586
9738
  errorCount,
9587
9739
  " errors"
9588
9740
  ] }),
9589
- isErrorsOpen && /* @__PURE__ */ jsx13(
9741
+ isErrorsOpen && /* @__PURE__ */ jsx14(
9590
9742
  "div",
9591
9743
  {
9592
9744
  style: { display: "grid", gridTemplateColumns: "100px 300px" },
9593
- children: elements?.filter((e) => e.type.includes("error")).map((e, i) => /* @__PURE__ */ jsxs10(Fragment4, { children: [
9594
- /* @__PURE__ */ jsx13("div", { children: e.error_type }),
9595
- /* @__PURE__ */ jsx13("div", { children: e.message })
9745
+ children: elements?.filter((e) => e.type.includes("error")).map((e, i) => /* @__PURE__ */ jsxs11(Fragment4, { children: [
9746
+ /* @__PURE__ */ jsx14("div", { children: e.error_type }),
9747
+ /* @__PURE__ */ jsx14("div", { children: e.message })
9596
9748
  ] }, i))
9597
9749
  }
9598
9750
  )
9599
9751
  ]
9600
9752
  }
9601
9753
  ),
9602
- /* @__PURE__ */ jsx13(
9754
+ /* @__PURE__ */ jsx14(
9603
9755
  ToolbarButton,
9604
9756
  {
9605
9757
  style: {},
9606
9758
  onClick: () => {
9607
9759
  setEditMode(in_draw_trace_mode ? "off" : "draw_trace");
9608
9760
  },
9609
- children: /* @__PURE__ */ jsxs10("div", { children: [
9761
+ children: /* @__PURE__ */ jsxs11("div", { children: [
9610
9762
  in_draw_trace_mode ? "\u2716 " : "",
9611
9763
  "Edit Traces"
9612
9764
  ] })
9613
9765
  }
9614
9766
  ),
9615
- /* @__PURE__ */ jsx13(
9767
+ /* @__PURE__ */ jsx14(
9616
9768
  ToolbarButton,
9617
9769
  {
9618
9770
  style: {},
9619
9771
  onClick: () => {
9620
9772
  setEditMode(in_move_footprint_mode ? "off" : "move_footprint");
9621
9773
  },
9622
- children: /* @__PURE__ */ jsxs10("div", { children: [
9774
+ children: /* @__PURE__ */ jsxs11("div", { children: [
9623
9775
  in_move_footprint_mode ? "\u2716 " : "",
9624
9776
  "Move Components"
9625
9777
  ] })
9626
9778
  }
9627
9779
  ),
9628
- /* @__PURE__ */ jsx13(
9780
+ /* @__PURE__ */ jsx14(
9629
9781
  ToolbarButton,
9630
9782
  {
9631
9783
  style: {},
9632
9784
  onClick: () => {
9633
9785
  setIsShowingRatsNest(!is_showing_rats_nest);
9634
9786
  },
9635
- children: /* @__PURE__ */ jsxs10("div", { children: [
9787
+ children: /* @__PURE__ */ jsxs11("div", { children: [
9636
9788
  is_showing_rats_nest ? "\u2716 " : "",
9637
9789
  "Rats Nest"
9638
9790
  ] })
9639
9791
  }
9640
9792
  ),
9641
- /* @__PURE__ */ jsx13(
9793
+ /* @__PURE__ */ jsx14(
9642
9794
  ToolbarButton,
9643
9795
  {
9644
9796
  onClick: () => {
9645
9797
  setViewMenuOpen(!isViewMenuOpen);
9646
9798
  },
9647
- children: /* @__PURE__ */ jsxs10("div", { children: [
9648
- /* @__PURE__ */ jsxs10(
9799
+ children: /* @__PURE__ */ jsxs11("div", { children: [
9800
+ /* @__PURE__ */ jsxs11(
9649
9801
  "div",
9650
9802
  {
9651
9803
  style: {
@@ -9656,7 +9808,7 @@ var ToolbarOverlay = ({ children, elements }) => {
9656
9808
  children: [
9657
9809
  "View",
9658
9810
  " ",
9659
- /* @__PURE__ */ jsx13(
9811
+ /* @__PURE__ */ jsx14(
9660
9812
  "span",
9661
9813
  {
9662
9814
  style: {
@@ -9671,8 +9823,8 @@ var ToolbarOverlay = ({ children, elements }) => {
9671
9823
  ]
9672
9824
  }
9673
9825
  ),
9674
- isViewMenuOpen && /* @__PURE__ */ jsxs10("div", { style: { marginTop: 4, minWidth: 120 }, children: [
9675
- /* @__PURE__ */ jsx13(
9826
+ isViewMenuOpen && /* @__PURE__ */ jsxs11("div", { style: { marginTop: 4, minWidth: 120 }, children: [
9827
+ /* @__PURE__ */ jsx14(
9676
9828
  CheckboxMenuItem,
9677
9829
  {
9678
9830
  label: "Show All Trace Lengths",
@@ -9684,7 +9836,7 @@ var ToolbarOverlay = ({ children, elements }) => {
9684
9836
  }
9685
9837
  }
9686
9838
  ),
9687
- /* @__PURE__ */ jsx13(
9839
+ /* @__PURE__ */ jsx14(
9688
9840
  CheckboxMenuItem,
9689
9841
  {
9690
9842
  label: "Show Autorouting Animation",
@@ -9707,7 +9859,7 @@ var ToolbarOverlay = ({ children, elements }) => {
9707
9859
  };
9708
9860
 
9709
9861
  // src/components/CanvasElementsRenderer.tsx
9710
- import { jsx as jsx14 } from "react/jsx-runtime";
9862
+ import { jsx as jsx15 } from "react/jsx-runtime";
9711
9863
  var CanvasElementsRenderer = (props) => {
9712
9864
  const { transform, elements } = props;
9713
9865
  const [primitivesWithoutInteractionMetadata, connectivityMap] = useMemo5(() => {
@@ -9730,34 +9882,37 @@ var CanvasElementsRenderer = (props) => {
9730
9882
  primitiveIdsInMousedOverNet: hoverState.primitiveIdsInMousedOverNet
9731
9883
  });
9732
9884
  }, [primitivesWithoutInteractionMetadata, hoverState]);
9733
- const onMouseOverPrimitives = useCallback2((primitivesHoveredOver) => {
9734
- const primitiveIdsInMousedOverNet = [];
9735
- for (const primitive of primitivesHoveredOver) {
9736
- if (primitive._element) {
9737
- const connectedPrimitivesList = connectivityMap.getNetConnectedToId(
9738
- "pcb_port_id" in primitive._element ? primitive._element?.pcb_port_id : "pcb_trace_id" in primitive._element ? primitive._element?.pcb_trace_id : ""
9739
- );
9740
- primitiveIdsInMousedOverNet.push(
9741
- ...connectivityMap.getIdsConnectedToNet(connectedPrimitivesList)
9742
- );
9885
+ const onMouseOverPrimitives = useCallback2(
9886
+ (primitivesHoveredOver) => {
9887
+ const primitiveIdsInMousedOverNet = [];
9888
+ for (const primitive of primitivesHoveredOver) {
9889
+ if (primitive._element) {
9890
+ const connectedPrimitivesList = connectivityMap.getNetConnectedToId(
9891
+ "pcb_port_id" in primitive._element ? primitive._element?.pcb_port_id : "pcb_trace_id" in primitive._element ? primitive._element?.pcb_trace_id : ""
9892
+ );
9893
+ primitiveIdsInMousedOverNet.push(
9894
+ ...connectivityMap.getIdsConnectedToNet(connectedPrimitivesList)
9895
+ );
9896
+ }
9743
9897
  }
9744
- }
9745
- const drawingObjectIdsWithMouseOver = new Set(
9746
- primitivesHoveredOver.map((p) => p._pcb_drawing_object_id)
9747
- );
9748
- setHoverState({
9749
- drawingObjectIdsWithMouseOver,
9750
- primitiveIdsInMousedOverNet
9751
- });
9752
- }, [connectivityMap]);
9753
- return /* @__PURE__ */ jsx14(
9898
+ const drawingObjectIdsWithMouseOver = new Set(
9899
+ primitivesHoveredOver.map((p) => p._pcb_drawing_object_id)
9900
+ );
9901
+ setHoverState({
9902
+ drawingObjectIdsWithMouseOver,
9903
+ primitiveIdsInMousedOverNet
9904
+ });
9905
+ },
9906
+ [connectivityMap]
9907
+ );
9908
+ return /* @__PURE__ */ jsx15(
9754
9909
  MouseElementTracker,
9755
9910
  {
9756
9911
  elements,
9757
9912
  transform,
9758
9913
  primitives: primitivesWithoutInteractionMetadata,
9759
9914
  onMouseHoverOverPrimitives: onMouseOverPrimitives,
9760
- children: /* @__PURE__ */ jsx14(
9915
+ children: /* @__PURE__ */ jsx15(
9761
9916
  EditPlacementOverlay,
9762
9917
  {
9763
9918
  disabled: !props.allowEditing,
@@ -9766,7 +9921,7 @@ var CanvasElementsRenderer = (props) => {
9766
9921
  cancelPanDrag: props.cancelPanDrag,
9767
9922
  onCreateEditEvent: props.onCreateEditEvent,
9768
9923
  onModifyEditEvent: props.onModifyEditEvent,
9769
- children: /* @__PURE__ */ jsx14(
9924
+ children: /* @__PURE__ */ jsx15(
9770
9925
  EditTraceHintOverlay,
9771
9926
  {
9772
9927
  disabled: !props.allowEditing,
@@ -9775,24 +9930,31 @@ var CanvasElementsRenderer = (props) => {
9775
9930
  cancelPanDrag: props.cancelPanDrag,
9776
9931
  onCreateEditEvent: props.onCreateEditEvent,
9777
9932
  onModifyEditEvent: props.onModifyEditEvent,
9778
- children: /* @__PURE__ */ jsx14(
9933
+ children: /* @__PURE__ */ jsx15(
9779
9934
  DimensionOverlay,
9780
9935
  {
9781
9936
  transform,
9782
9937
  focusOnHover: props.focusOnHover,
9783
- children: /* @__PURE__ */ jsx14(ToolbarOverlay, { elements, children: /* @__PURE__ */ jsx14(ErrorOverlay, { transform, elements, children: /* @__PURE__ */ jsx14(RatsNestOverlay, { transform, soup: elements, children: /* @__PURE__ */ jsx14(
9938
+ children: /* @__PURE__ */ jsx15(ToolbarOverlay, { elements, children: /* @__PURE__ */ jsx15(ErrorOverlay, { transform, elements, children: /* @__PURE__ */ jsx15(RatsNestOverlay, { transform, soup: elements, children: /* @__PURE__ */ jsx15(
9784
9939
  DebugGraphicsOverlay,
9785
9940
  {
9786
9941
  transform,
9787
9942
  debugGraphics: props.debugGraphics,
9788
- children: /* @__PURE__ */ jsx14(
9789
- CanvasPrimitiveRenderer,
9943
+ children: /* @__PURE__ */ jsx15(
9944
+ WarningGraphicsOverlay,
9790
9945
  {
9791
9946
  transform,
9792
- primitives,
9793
- width: props.width,
9794
- height: props.height,
9795
- grid: props.grid
9947
+ elements,
9948
+ children: /* @__PURE__ */ jsx15(
9949
+ CanvasPrimitiveRenderer,
9950
+ {
9951
+ transform,
9952
+ primitives,
9953
+ width: props.width,
9954
+ height: props.height,
9955
+ grid: props.grid
9956
+ }
9957
+ )
9796
9958
  }
9797
9959
  )
9798
9960
  }
@@ -9808,7 +9970,7 @@ var CanvasElementsRenderer = (props) => {
9808
9970
  };
9809
9971
 
9810
9972
  // src/PCBViewer.tsx
9811
- import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
9973
+ import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
9812
9974
  var defaultTransform = compose5(translate5(400, 300), scale3(40, -40));
9813
9975
  var PCBViewer = ({
9814
9976
  circuitJson,
@@ -9837,7 +9999,7 @@ var PCBViewer = ({
9837
9999
  });
9838
10000
  let [editEvents, setEditEvents] = useState10([]);
9839
10001
  editEvents = editEventsProp ?? editEvents;
9840
- const initialRenderCompleted = useRef8(false);
10002
+ const initialRenderCompleted = useRef9(false);
9841
10003
  const circuitJsonKey = `${circuitJson?.length || 0}_${circuitJson?.editCount || 0}`;
9842
10004
  const resetTransform = () => {
9843
10005
  const elmBounds = refDimensions?.width > 0 ? refDimensions : { width: 500, height: 500 };
@@ -9859,7 +10021,7 @@ var PCBViewer = ({
9859
10021
  setTransform(targetTransform);
9860
10022
  return;
9861
10023
  };
9862
- useEffect13(() => {
10024
+ useEffect14(() => {
9863
10025
  if (!refDimensions?.width) return;
9864
10026
  if (!circuitJson) return;
9865
10027
  if (circuitJson.length === 0) return;
@@ -9890,9 +10052,9 @@ var PCBViewer = ({
9890
10052
  setEditEvents(newEditEvents);
9891
10053
  onEditEventsChanged?.(newEditEvents);
9892
10054
  };
9893
- return /* @__PURE__ */ jsxs11("div", { ref: transformRef, style: { position: "relative" }, children: [
9894
- /* @__PURE__ */ jsx15("div", { ref, children: /* @__PURE__ */ jsxs11(ContextProviders, { initialState, children: [
9895
- /* @__PURE__ */ jsx15(
10055
+ return /* @__PURE__ */ jsxs12("div", { ref: transformRef, style: { position: "relative" }, children: [
10056
+ /* @__PURE__ */ jsx16("div", { ref, children: /* @__PURE__ */ jsxs12(ContextProviders, { initialState, children: [
10057
+ /* @__PURE__ */ jsx16(
9896
10058
  CanvasElementsRenderer,
9897
10059
  {
9898
10060
  transform,
@@ -9917,9 +10079,9 @@ var PCBViewer = ({
9917
10079
  },
9918
10080
  refDimensions.width
9919
10081
  ),
9920
- /* @__PURE__ */ jsx15(ToastContainer, {})
10082
+ /* @__PURE__ */ jsx16(ToastContainer, {})
9921
10083
  ] }) }),
9922
- clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */ jsx15(
10084
+ clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */ jsx16(
9923
10085
  "div",
9924
10086
  {
9925
10087
  onClick: () => {
@@ -9935,7 +10097,7 @@ var PCBViewer = ({
9935
10097
  alignItems: "center",
9936
10098
  justifyContent: "center"
9937
10099
  },
9938
- children: /* @__PURE__ */ jsx15(
10100
+ children: /* @__PURE__ */ jsx16(
9939
10101
  "div",
9940
10102
  {
9941
10103
  style: {