@tscircuit/schematic-viewer 2.0.90 → 2.0.92

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,3 +1,179 @@
1
+ // lib/components/StyleAnalysisDialog.tsx
2
+ import * as Dialog from "@radix-ui/react-dialog";
3
+
4
+ // lib/utils/load-style-analyzer.ts
5
+ var STYLE_ANALYZER_URL = "https://jscdn.tscircuit.com/@tscircuit/circuit-json-schematic-placement-analysis/latest/dist/browser.js";
6
+ var styleAnalyzerLoader = {
7
+ async load() {
8
+ const analyzer = await import(
9
+ /* @vite-ignore */
10
+ /* webpackIgnore: true */
11
+ STYLE_ANALYZER_URL
12
+ );
13
+ if (typeof analyzer.createSchematicPlacementIssueArtifacts !== "function") {
14
+ throw new Error(
15
+ "The style analyzer module does not export its analysis function."
16
+ );
17
+ }
18
+ return analyzer;
19
+ }
20
+ };
21
+
22
+ // lib/components/StyleAnalysisDialog.tsx
23
+ import { useEffect, useState } from "react";
24
+
25
+ // lib/utils/z-index-map.ts
26
+ var zIndexMap = {
27
+ contextMenu: 110,
28
+ styleAnalysis: 120,
29
+ viewMenu: 55,
30
+ viewMenuIcon: 48,
31
+ clickToInteractOverlay: 100,
32
+ schematicComponentDetailsTooltip: 105,
33
+ schematicComponentHoverOutline: 47,
34
+ schematicPortHoverOutline: 48,
35
+ schematicSearch: 101
36
+ };
37
+
38
+ // lib/components/StyleAnalysisDialog.tsx
39
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
40
+ var StyleAnalysisDialog = ({
41
+ circuitJson,
42
+ onClose
43
+ }) => {
44
+ const [state, setState] = useState({ status: "loading" });
45
+ useEffect(() => {
46
+ let cancelled = false;
47
+ const timer = window.setTimeout(async () => {
48
+ try {
49
+ const { createSchematicPlacementIssueArtifacts } = await styleAnalyzerLoader.load();
50
+ if (cancelled) return;
51
+ const artifacts = createSchematicPlacementIssueArtifacts(circuitJson);
52
+ if (!cancelled) setState({ status: "complete", artifacts });
53
+ } catch (error) {
54
+ if (!cancelled) {
55
+ setState({
56
+ status: "error",
57
+ message: error instanceof Error ? error.message : String(error)
58
+ });
59
+ }
60
+ }
61
+ }, 0);
62
+ return () => {
63
+ cancelled = true;
64
+ window.clearTimeout(timer);
65
+ };
66
+ }, [circuitJson]);
67
+ return /* @__PURE__ */ jsx(Dialog.Root, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [
68
+ /* @__PURE__ */ jsx(
69
+ Dialog.Overlay,
70
+ {
71
+ style: {
72
+ position: "fixed",
73
+ inset: 0,
74
+ background: "#0008",
75
+ zIndex: zIndexMap.styleAnalysis
76
+ }
77
+ }
78
+ ),
79
+ /* @__PURE__ */ jsxs(
80
+ Dialog.Content,
81
+ {
82
+ style: {
83
+ position: "fixed",
84
+ top: "5vh",
85
+ left: "50%",
86
+ transform: "translateX(-50%)",
87
+ width: "min(1000px, 94vw)",
88
+ maxHeight: "90vh",
89
+ overflowY: "auto",
90
+ boxSizing: "border-box",
91
+ padding: 24,
92
+ borderRadius: 12,
93
+ background: "#fafafa",
94
+ color: "#171717",
95
+ fontFamily: "system-ui, sans-serif",
96
+ boxShadow: "0 20px 60px #0005",
97
+ zIndex: zIndexMap.styleAnalysis
98
+ },
99
+ children: [
100
+ /* @__PURE__ */ jsxs(
101
+ "div",
102
+ {
103
+ style: {
104
+ display: "flex",
105
+ alignItems: "center",
106
+ justifyContent: "space-between",
107
+ gap: 16
108
+ },
109
+ children: [
110
+ /* @__PURE__ */ jsx(Dialog.Title, { style: { margin: 0, fontSize: 22 }, children: "Style Analysis" }),
111
+ /* @__PURE__ */ jsx(Dialog.Close, { style: { cursor: "pointer", padding: "6px 12px" }, children: "Close" })
112
+ ]
113
+ }
114
+ ),
115
+ /* @__PURE__ */ jsx(Dialog.Description, { style: { color: "#525252" }, children: "Placement and style issues across all schematic sheets. Each image highlights one issue with its description below." }),
116
+ state.status === "loading" && /* @__PURE__ */ jsx("p", { role: "status", children: "Running style analysis\u2026" }),
117
+ state.status === "error" && /* @__PURE__ */ jsxs("p", { role: "alert", children: [
118
+ "Style analysis failed: ",
119
+ state.message
120
+ ] }),
121
+ state.status === "complete" && /* @__PURE__ */ jsxs(Fragment, { children: [
122
+ /* @__PURE__ */ jsx("p", { role: "status", children: state.artifacts.length === 0 ? "No style issues found." : `${state.artifacts.length} style ${state.artifacts.length === 1 ? "issue" : "issues"} found.` }),
123
+ state.artifacts.map((artifact) => /* @__PURE__ */ jsxs(
124
+ "section",
125
+ {
126
+ style: {
127
+ marginTop: 24,
128
+ border: "1px solid #ddd",
129
+ borderRadius: 8,
130
+ overflow: "hidden",
131
+ background: "white"
132
+ },
133
+ children: [
134
+ /* @__PURE__ */ jsxs("h3", { style: { margin: 16, fontSize: 16 }, children: [
135
+ artifact.issueIndex + 1,
136
+ ".",
137
+ " ",
138
+ artifact.issue.lineItemType.replace(
139
+ /([a-z])([A-Z])/g,
140
+ "$1 $2"
141
+ ),
142
+ artifact.schematicSheetId && /* @__PURE__ */ jsxs(
143
+ "small",
144
+ {
145
+ style: {
146
+ display: "block",
147
+ marginTop: 4,
148
+ color: "#525252"
149
+ },
150
+ children: [
151
+ "Sheet: ",
152
+ artifact.schematicSheetId
153
+ ]
154
+ }
155
+ )
156
+ ] }),
157
+ /* @__PURE__ */ jsx(
158
+ "img",
159
+ {
160
+ src: `data:image/svg+xml;charset=utf-8,${encodeURIComponent(artifact.content)}`,
161
+ alt: artifact.descriptionXml,
162
+ loading: "lazy",
163
+ style: { display: "block", width: "100%", height: "auto" }
164
+ }
165
+ )
166
+ ]
167
+ },
168
+ artifact.issueIndex
169
+ ))
170
+ ] })
171
+ ]
172
+ }
173
+ )
174
+ ] }) });
175
+ };
176
+
1
177
  // lib/components/SchematicViewer.tsx
2
178
  import { su as su4 } from "@tscircuit/soup-util";
3
179
  import {
@@ -44,7 +220,7 @@ var setStoredString = (key, value) => {
44
220
  };
45
221
 
46
222
  // lib/hooks/useSchematicGroupsOverlay.ts
47
- import { useEffect } from "react";
223
+ import { useEffect as useEffect2 } from "react";
48
224
  import { su } from "@tscircuit/soup-util";
49
225
  var GROUP_COLORS = [
50
226
  "#8B0000",
@@ -70,7 +246,7 @@ var GROUP_COLORS = [
70
246
  ];
71
247
  var useSchematicGroupsOverlay = (options) => {
72
248
  const { svgDivRef, circuitJson, circuitJsonKey, showGroups } = options;
73
- useEffect(() => {
249
+ useEffect2(() => {
74
250
  if (svgDivRef.current) {
75
251
  const existingOverlays = svgDivRef.current.querySelectorAll(
76
252
  ".schematic-group-overlay"
@@ -313,7 +489,7 @@ function calculateGroupBounds(components, svg) {
313
489
 
314
490
  // lib/hooks/useSchematicNetHover.ts
315
491
  import { su as su2 } from "@tscircuit/soup-util";
316
- import { useEffect as useEffect2 } from "react";
492
+ import { useEffect as useEffect3 } from "react";
317
493
  var FADED_CLASS = "sch-net-faded";
318
494
  var TRACE_SELECTOR = "g.trace[data-subcircuit-connectivity-map-key], g.trace-overlays[data-subcircuit-connectivity-map-key]";
319
495
  var NET_LABEL_SELECTOR = "[data-schematic-net-label-id]";
@@ -323,7 +499,7 @@ var useSchematicNetHover = ({
323
499
  circuitJsonKey,
324
500
  enabled
325
501
  }) => {
326
- useEffect2(() => {
502
+ useEffect3(() => {
327
503
  const svgDiv = svgDivRef.current;
328
504
  if (!enabled || !svgDiv) return;
329
505
  const { componentIdToKeys, netLabelIdToKey } = buildNetRegistry(circuitJson);
@@ -431,7 +607,7 @@ function buildNetRegistry(circuitJson) {
431
607
  }
432
608
 
433
609
  // lib/hooks/useSchematicSearch.ts
434
- import { useCallback as useCallback2, useEffect as useEffect3, useMemo, useRef, useState } from "react";
610
+ import { useCallback as useCallback2, useEffect as useEffect4, useMemo, useRef, useState as useState2 } from "react";
435
611
  import { fromString } from "transformation-matrix";
436
612
 
437
613
  // lib/utils/get-schematic-search-results.ts
@@ -637,8 +813,8 @@ var useSchematicSearch = ({
637
813
  setSvgToScreenProjection,
638
814
  setIsInteractionEnabled
639
815
  }) => {
640
- const [searchQuery, setSearchQuery] = useState("");
641
- const [pendingSearchResult, setPendingSearchResult] = useState(null);
816
+ const [searchQuery, setSearchQuery] = useState2("");
817
+ const [pendingSearchResult, setPendingSearchResult] = useState2(null);
642
818
  const searchAnimationTimerRef = useRef(
643
819
  null
644
820
  );
@@ -733,7 +909,7 @@ var useSchematicSearch = ({
733
909
  );
734
910
  }
735
911
  }, [svgDivRef]);
736
- useEffect3(() => {
912
+ useEffect4(() => {
737
913
  if (!pendingSearchResult || !svgString) return;
738
914
  const frame = requestAnimationFrame(() => {
739
915
  if (focusSearchResult(pendingSearchResult)) {
@@ -742,11 +918,11 @@ var useSchematicSearch = ({
742
918
  });
743
919
  return () => cancelAnimationFrame(frame);
744
920
  }, [focusSearchResult, pendingSearchResult, svgString]);
745
- useEffect3(() => {
921
+ useEffect4(() => {
746
922
  if (searchQuery) return;
747
923
  svgDivRef.current?.querySelectorAll(".schematic-search-match").forEach((element) => element.classList.remove("schematic-search-match"));
748
924
  }, [searchQuery, svgDivRef]);
749
- useEffect3(
925
+ useEffect4(
750
926
  () => () => {
751
927
  if (searchAnimationTimerRef.current) {
752
928
  clearTimeout(searchAnimationTimerRef.current);
@@ -771,16 +947,16 @@ var enableDebug = () => {
771
947
  };
772
948
 
773
949
  // lib/components/SchematicViewer.tsx
774
- import { useCallback as useCallback7, useEffect as useEffect11, useMemo as useMemo6, useRef as useRef8, useState as useState8 } from "react";
950
+ import { useCallback as useCallback7, useEffect as useEffect12, useMemo as useMemo6, useRef as useRef8, useState as useState9 } from "react";
775
951
  import { toString as transformToString } from "transformation-matrix";
776
952
  import { useMouseMatrixTransform } from "use-mouse-matrix-transform";
777
953
 
778
954
  // lib/hooks/use-resize-handling.ts
779
- import { useEffect as useEffect4, useState as useState2 } from "react";
955
+ import { useEffect as useEffect5, useState as useState3 } from "react";
780
956
  var useResizeHandling = (containerRef) => {
781
- const [containerWidth, setContainerWidth] = useState2(0);
782
- const [containerHeight, setContainerHeight] = useState2(0);
783
- useEffect4(() => {
957
+ const [containerWidth, setContainerWidth] = useState3(0);
958
+ const [containerHeight, setContainerHeight] = useState3(0);
959
+ useEffect5(() => {
784
960
  if (!containerRef.current) return;
785
961
  const updateDimensions = () => {
786
962
  const rect = containerRef.current?.getBoundingClientRect();
@@ -800,12 +976,12 @@ var useResizeHandling = (containerRef) => {
800
976
  };
801
977
 
802
978
  // lib/hooks/useContextMenu.ts
803
- import { useCallback as useCallback3, useEffect as useEffect5, useRef as useRef2, useState as useState3 } from "react";
979
+ import { useCallback as useCallback3, useEffect as useEffect6, useRef as useRef2, useState as useState4 } from "react";
804
980
  var LONG_PRESS_DURATION_MS = 600;
805
981
  var MOVEMENT_THRESHOLD_PX = 10;
806
982
  var useContextMenu = ({ containerRef }) => {
807
- const [menuVisible, setMenuVisible] = useState3(false);
808
- const [menuPos, setMenuPos] = useState3({ x: 0, y: 0 });
983
+ const [menuVisible, setMenuVisible] = useState4(false);
984
+ const [menuPos, setMenuPos] = useState4({ x: 0, y: 0 });
809
985
  const menuRef = useRef2(null);
810
986
  const interactionOriginRef = useRef2(null);
811
987
  const longPressTimeoutRef = useRef2(null);
@@ -880,7 +1056,7 @@ var useContextMenu = ({ containerRef }) => {
880
1056
  if (isInRadixPortal) return;
881
1057
  setMenuVisible(false);
882
1058
  }, []);
883
- useEffect5(() => {
1059
+ useEffect6(() => {
884
1060
  if (!menuVisible) return;
885
1061
  document.addEventListener("mousedown", handleClickAway);
886
1062
  document.addEventListener("touchstart", handleClickAway);
@@ -889,7 +1065,7 @@ var useContextMenu = ({ containerRef }) => {
889
1065
  document.removeEventListener("touchstart", handleClickAway);
890
1066
  };
891
1067
  }, [handleClickAway, menuVisible]);
892
- useEffect5(() => clearLongPressTimeout, [clearLongPressTimeout]);
1068
+ useEffect6(() => clearLongPressTimeout, [clearLongPressTimeout]);
893
1069
  return {
894
1070
  menuVisible,
895
1071
  menuPos,
@@ -1067,28 +1243,16 @@ var getFootprintPreviewUrl = (footprintPreviewCircuitJson, viewBox) => {
1067
1243
  return url.toString();
1068
1244
  };
1069
1245
 
1070
- // lib/utils/z-index-map.ts
1071
- var zIndexMap = {
1072
- contextMenu: 110,
1073
- viewMenu: 55,
1074
- viewMenuIcon: 48,
1075
- clickToInteractOverlay: 100,
1076
- schematicComponentDetailsTooltip: 105,
1077
- schematicComponentHoverOutline: 47,
1078
- schematicPortHoverOutline: 48,
1079
- schematicSearch: 101
1080
- };
1081
-
1082
1246
  // lib/components/MouseTracker.tsx
1083
1247
  import {
1084
1248
  createContext,
1085
1249
  useCallback as useCallback4,
1086
1250
  useContext,
1087
- useEffect as useEffect6,
1251
+ useEffect as useEffect7,
1088
1252
  useMemo as useMemo2,
1089
1253
  useRef as useRef3
1090
1254
  } from "react";
1091
- import { Fragment, jsx } from "react/jsx-runtime";
1255
+ import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
1092
1256
  var MouseTrackerContext = createContext(null);
1093
1257
  var DRAG_THRESHOLD_PX = 5;
1094
1258
  var boundsAreEqual = (a, b) => {
@@ -1099,9 +1263,9 @@ var boundsAreEqual = (a, b) => {
1099
1263
  var MouseTracker = ({ children }) => {
1100
1264
  const existingContext = useContext(MouseTrackerContext);
1101
1265
  if (existingContext) {
1102
- return /* @__PURE__ */ jsx(Fragment, { children });
1266
+ return /* @__PURE__ */ jsx2(Fragment2, { children });
1103
1267
  }
1104
- return /* @__PURE__ */ jsx(MouseTrackerProvider, { children });
1268
+ return /* @__PURE__ */ jsx2(MouseTrackerProvider, { children });
1105
1269
  };
1106
1270
  var MouseTrackerProvider = ({ children }) => {
1107
1271
  const storeRef = useRef3({
@@ -1171,7 +1335,7 @@ var MouseTrackerProvider = ({ children }) => {
1171
1335
  const isHovering = useCallback4((id) => {
1172
1336
  return storeRef.current.hoveringIds.has(id);
1173
1337
  }, []);
1174
- useEffect6(() => {
1338
+ useEffect7(() => {
1175
1339
  const handlePointerPosition = (event) => {
1176
1340
  const { clientX, clientY } = event;
1177
1341
  const pointer = storeRef.current.pointer;
@@ -1255,12 +1419,12 @@ var MouseTrackerProvider = ({ children }) => {
1255
1419
  isHovering
1256
1420
  ]
1257
1421
  );
1258
- return /* @__PURE__ */ jsx(MouseTrackerContext.Provider, { value, children });
1422
+ return /* @__PURE__ */ jsx2(MouseTrackerContext.Provider, { value, children });
1259
1423
  };
1260
1424
 
1261
1425
  // lib/components/SchematicComponentDetailsTooltip.tsx
1262
1426
  import { useMemo as useMemo3 } from "react";
1263
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
1427
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
1264
1428
  var detailLabelStyle = {
1265
1429
  color: "#64748b",
1266
1430
  fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',
@@ -1292,7 +1456,7 @@ var SchematicComponentDetailsTooltip = ({
1292
1456
  ) : void 0,
1293
1457
  [footprintPreviewCircuitJson, footprintPreviewViewBox]
1294
1458
  );
1295
- return /* @__PURE__ */ jsxs(
1459
+ return /* @__PURE__ */ jsxs2(
1296
1460
  "dialog",
1297
1461
  {
1298
1462
  open: true,
@@ -1324,7 +1488,7 @@ var SchematicComponentDetailsTooltip = ({
1324
1488
  onMouseDown: (event) => event.stopPropagation(),
1325
1489
  onClick: (event) => event.stopPropagation(),
1326
1490
  children: [
1327
- /* @__PURE__ */ jsxs(
1491
+ /* @__PURE__ */ jsxs2(
1328
1492
  "dl",
1329
1493
  {
1330
1494
  style: {
@@ -1335,9 +1499,9 @@ var SchematicComponentDetailsTooltip = ({
1335
1499
  padding: "8px"
1336
1500
  },
1337
1501
  children: [
1338
- infoEntries.map((entry) => /* @__PURE__ */ jsxs("div", { style: { display: "contents" }, children: [
1339
- /* @__PURE__ */ jsx2("dt", { style: detailLabelStyle, children: entry.label }),
1340
- /* @__PURE__ */ jsx2(
1502
+ infoEntries.map((entry) => /* @__PURE__ */ jsxs2("div", { style: { display: "contents" }, children: [
1503
+ /* @__PURE__ */ jsx3("dt", { style: detailLabelStyle, children: entry.label }),
1504
+ /* @__PURE__ */ jsx3(
1341
1505
  "dd",
1342
1506
  {
1343
1507
  style: {
@@ -1353,9 +1517,9 @@ var SchematicComponentDetailsTooltip = ({
1353
1517
  }
1354
1518
  )
1355
1519
  ] }, entry.key)),
1356
- supplierPartNumberEntries.map((entry) => /* @__PURE__ */ jsxs("div", { style: { display: "contents" }, children: [
1357
- /* @__PURE__ */ jsx2("dt", { style: detailLabelStyle, children: entry.label }),
1358
- /* @__PURE__ */ jsx2(
1520
+ supplierPartNumberEntries.map((entry) => /* @__PURE__ */ jsxs2("div", { style: { display: "contents" }, children: [
1521
+ /* @__PURE__ */ jsx3("dt", { style: detailLabelStyle, children: entry.label }),
1522
+ /* @__PURE__ */ jsx3(
1359
1523
  "dd",
1360
1524
  {
1361
1525
  style: {
@@ -1366,9 +1530,9 @@ var SchematicComponentDetailsTooltip = ({
1366
1530
  lineHeight: 1.45,
1367
1531
  overflowWrap: "anywhere"
1368
1532
  },
1369
- children: entry.links.map((link, index) => /* @__PURE__ */ jsxs("span", { children: [
1533
+ children: entry.links.map((link, index) => /* @__PURE__ */ jsxs2("span", { children: [
1370
1534
  index > 0 && ", ",
1371
- /* @__PURE__ */ jsx2(
1535
+ /* @__PURE__ */ jsx3(
1372
1536
  "a",
1373
1537
  {
1374
1538
  href: link.href,
@@ -1382,9 +1546,9 @@ var SchematicComponentDetailsTooltip = ({
1382
1546
  }
1383
1547
  )
1384
1548
  ] }, entry.key)),
1385
- footprinterString && /* @__PURE__ */ jsxs("div", { style: { display: "contents" }, children: [
1386
- /* @__PURE__ */ jsx2("dt", { style: detailLabelStyle, children: "footprint" }),
1387
- /* @__PURE__ */ jsx2(
1549
+ footprinterString && /* @__PURE__ */ jsxs2("div", { style: { display: "contents" }, children: [
1550
+ /* @__PURE__ */ jsx3("dt", { style: detailLabelStyle, children: "footprint" }),
1551
+ /* @__PURE__ */ jsx3(
1388
1552
  "dd",
1389
1553
  {
1390
1554
  style: {
@@ -1403,7 +1567,7 @@ var SchematicComponentDetailsTooltip = ({
1403
1567
  ]
1404
1568
  }
1405
1569
  ),
1406
- footprintPreviewUrl && /* @__PURE__ */ jsx2("div", { style: { padding: "0 4px 4px" }, children: /* @__PURE__ */ jsx2(
1570
+ footprintPreviewUrl && /* @__PURE__ */ jsx3("div", { style: { padding: "0 4px 4px" }, children: /* @__PURE__ */ jsx3(
1407
1571
  "div",
1408
1572
  {
1409
1573
  style: {
@@ -1413,7 +1577,7 @@ var SchematicComponentDetailsTooltip = ({
1413
1577
  borderRadius: "2px",
1414
1578
  background: "#f8fafc"
1415
1579
  },
1416
- children: /* @__PURE__ */ jsx2(
1580
+ children: /* @__PURE__ */ jsx3(
1417
1581
  "img",
1418
1582
  {
1419
1583
  src: footprintPreviewUrl,
@@ -1436,12 +1600,12 @@ var SchematicComponentDetailsTooltip = ({
1436
1600
  };
1437
1601
 
1438
1602
  // lib/components/SchematicComponentMouseTarget.tsx
1439
- import { useCallback as useCallback5, useEffect as useEffect8, useRef as useRef5, useState as useState4 } from "react";
1603
+ import { useCallback as useCallback5, useEffect as useEffect9, useRef as useRef5, useState as useState5 } from "react";
1440
1604
 
1441
1605
  // lib/hooks/useMouseEventsOverBoundingBox.ts
1442
1606
  import {
1443
1607
  useContext as useContext2,
1444
- useEffect as useEffect7,
1608
+ useEffect as useEffect8,
1445
1609
  useId,
1446
1610
  useMemo as useMemo4,
1447
1611
  useRef as useRef4,
@@ -1463,7 +1627,7 @@ var useMouseEventsOverBoundingBox = (options) => {
1463
1627
  },
1464
1628
  []
1465
1629
  );
1466
- useEffect7(() => {
1630
+ useEffect8(() => {
1467
1631
  context.registerBoundingBox(id, {
1468
1632
  bounds: latestOptionsRef.current.bounds,
1469
1633
  onClick: latestOptionsRef.current.onClick ? handleClick : void 0
@@ -1472,7 +1636,7 @@ var useMouseEventsOverBoundingBox = (options) => {
1472
1636
  context.unregisterBoundingBox(id);
1473
1637
  };
1474
1638
  }, [context, handleClick, id]);
1475
- useEffect7(() => {
1639
+ useEffect8(() => {
1476
1640
  context.updateBoundingBox(id, {
1477
1641
  bounds: latestOptionsRef.current.bounds,
1478
1642
  onClick: latestOptionsRef.current.onClick ? handleClick : void 0
@@ -1496,7 +1660,7 @@ var useMouseEventsOverBoundingBox = (options) => {
1496
1660
  };
1497
1661
 
1498
1662
  // lib/components/SchematicComponentMouseTarget.tsx
1499
- import { jsx as jsx3 } from "react/jsx-runtime";
1663
+ import { jsx as jsx4 } from "react/jsx-runtime";
1500
1664
  var areMeasurementsEqual = (a, b) => {
1501
1665
  if (!a && !b) return true;
1502
1666
  if (!a || !b) return false;
@@ -1511,7 +1675,7 @@ var SchematicComponentMouseTarget = ({
1511
1675
  showOutline,
1512
1676
  circuitJsonKey
1513
1677
  }) => {
1514
- const [measurement, setMeasurement] = useState4(null);
1678
+ const [measurement, setMeasurement] = useState5(null);
1515
1679
  const frameRef = useRef5(null);
1516
1680
  const measure = useCallback5(() => {
1517
1681
  frameRef.current = null;
@@ -1552,10 +1716,10 @@ var SchematicComponentMouseTarget = ({
1552
1716
  if (frameRef.current !== null) return;
1553
1717
  frameRef.current = window.requestAnimationFrame(measure);
1554
1718
  }, [measure]);
1555
- useEffect8(() => {
1719
+ useEffect9(() => {
1556
1720
  scheduleMeasure();
1557
1721
  }, [scheduleMeasure, circuitJsonKey]);
1558
- useEffect8(() => {
1722
+ useEffect9(() => {
1559
1723
  scheduleMeasure();
1560
1724
  const svgDiv = svgDivRef.current;
1561
1725
  const container = containerRef.current;
@@ -1600,7 +1764,7 @@ var SchematicComponentMouseTarget = ({
1600
1764
  bounds,
1601
1765
  onClick: onComponentClick ? handleClick : void 0
1602
1766
  });
1603
- useEffect8(() => {
1767
+ useEffect9(() => {
1604
1768
  if (onHoverChange) {
1605
1769
  onHoverChange(componentId, hovering);
1606
1770
  }
@@ -1609,7 +1773,7 @@ var SchematicComponentMouseTarget = ({
1609
1773
  return null;
1610
1774
  }
1611
1775
  const rect = measurement.rect;
1612
- return /* @__PURE__ */ jsx3(
1776
+ return /* @__PURE__ */ jsx4(
1613
1777
  "div",
1614
1778
  {
1615
1779
  style: {
@@ -1627,8 +1791,8 @@ var SchematicComponentMouseTarget = ({
1627
1791
  };
1628
1792
 
1629
1793
  // lib/components/SchematicPortMouseTarget.tsx
1630
- import { useCallback as useCallback6, useEffect as useEffect9, useRef as useRef6, useState as useState5 } from "react";
1631
- import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
1794
+ import { useCallback as useCallback6, useEffect as useEffect10, useRef as useRef6, useState as useState6 } from "react";
1795
+ import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1632
1796
  var areMeasurementsEqual2 = (a, b) => {
1633
1797
  if (!a && !b) return true;
1634
1798
  if (!a || !b) return false;
@@ -1644,7 +1808,7 @@ var SchematicPortMouseTarget = ({
1644
1808
  showOutline,
1645
1809
  circuitJsonKey
1646
1810
  }) => {
1647
- const [measurement, setMeasurement] = useState5(null);
1811
+ const [measurement, setMeasurement] = useState6(null);
1648
1812
  const frameRef = useRef6(null);
1649
1813
  const measure = useCallback6(() => {
1650
1814
  frameRef.current = null;
@@ -1686,10 +1850,10 @@ var SchematicPortMouseTarget = ({
1686
1850
  if (frameRef.current !== null) return;
1687
1851
  frameRef.current = window.requestAnimationFrame(measure);
1688
1852
  }, [measure]);
1689
- useEffect9(() => {
1853
+ useEffect10(() => {
1690
1854
  scheduleMeasure();
1691
1855
  }, [scheduleMeasure, circuitJsonKey]);
1692
- useEffect9(() => {
1856
+ useEffect10(() => {
1693
1857
  scheduleMeasure();
1694
1858
  const svgDiv = svgDivRef.current;
1695
1859
  const container = containerRef.current;
@@ -1734,7 +1898,7 @@ var SchematicPortMouseTarget = ({
1734
1898
  bounds,
1735
1899
  onClick: onPortClick ? handleClick : void 0
1736
1900
  });
1737
- useEffect9(() => {
1901
+ useEffect10(() => {
1738
1902
  if (onHoverChange) {
1739
1903
  onHoverChange(portId, hovering);
1740
1904
  }
@@ -1743,8 +1907,8 @@ var SchematicPortMouseTarget = ({
1743
1907
  return null;
1744
1908
  }
1745
1909
  const rect = measurement.rect;
1746
- return /* @__PURE__ */ jsxs2(Fragment2, { children: [
1747
- /* @__PURE__ */ jsx4(
1910
+ return /* @__PURE__ */ jsxs3(Fragment3, { children: [
1911
+ /* @__PURE__ */ jsx5(
1748
1912
  "div",
1749
1913
  {
1750
1914
  style: {
@@ -1762,7 +1926,7 @@ var SchematicPortMouseTarget = ({
1762
1926
  }
1763
1927
  }
1764
1928
  ),
1765
- hovering && portLabel && /* @__PURE__ */ jsx4(
1929
+ hovering && portLabel && /* @__PURE__ */ jsx5(
1766
1930
  "div",
1767
1931
  {
1768
1932
  style: {
@@ -1787,15 +1951,15 @@ var SchematicPortMouseTarget = ({
1787
1951
  };
1788
1952
 
1789
1953
  // lib/components/SchematicSearch.tsx
1790
- import { useEffect as useEffect10, useRef as useRef7, useState as useState6 } from "react";
1954
+ import { useEffect as useEffect11, useRef as useRef7, useState as useState7 } from "react";
1791
1955
 
1792
1956
  // lib/components/SchematicSearchIcons.tsx
1793
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1957
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1794
1958
  var Icon = ({
1795
1959
  children,
1796
1960
  size,
1797
1961
  strokeWidth
1798
- }) => /* @__PURE__ */ jsx5(
1962
+ }) => /* @__PURE__ */ jsx6(
1799
1963
  "svg",
1800
1964
  {
1801
1965
  width: size,
@@ -1810,31 +1974,31 @@ var Icon = ({
1810
1974
  children
1811
1975
  }
1812
1976
  );
1813
- var SearchIcon = (props) => /* @__PURE__ */ jsxs3(Icon, { ...props, children: [
1814
- /* @__PURE__ */ jsx5("circle", { cx: "11", cy: "11", r: "8" }),
1815
- /* @__PURE__ */ jsx5("path", { d: "m21 21-4.34-4.34" })
1977
+ var SearchIcon = (props) => /* @__PURE__ */ jsxs4(Icon, { ...props, children: [
1978
+ /* @__PURE__ */ jsx6("circle", { cx: "11", cy: "11", r: "8" }),
1979
+ /* @__PURE__ */ jsx6("path", { d: "m21 21-4.34-4.34" })
1816
1980
  ] });
1817
- var CloseIcon = (props) => /* @__PURE__ */ jsxs3(Icon, { ...props, children: [
1818
- /* @__PURE__ */ jsx5("path", { d: "M18 6 6 18" }),
1819
- /* @__PURE__ */ jsx5("path", { d: "m6 6 12 12" })
1981
+ var CloseIcon = (props) => /* @__PURE__ */ jsxs4(Icon, { ...props, children: [
1982
+ /* @__PURE__ */ jsx6("path", { d: "M18 6 6 18" }),
1983
+ /* @__PURE__ */ jsx6("path", { d: "m6 6 12 12" })
1820
1984
  ] });
1821
- var ComponentIcon = (props) => /* @__PURE__ */ jsxs3(Icon, { ...props, children: [
1822
- /* @__PURE__ */ jsx5("rect", { x: "4", y: "4", width: "16", height: "16", rx: "2" }),
1823
- /* @__PURE__ */ jsx5("rect", { x: "8", y: "8", width: "8", height: "8", rx: "1" }),
1824
- /* @__PURE__ */ jsx5("path", { d: "M7 2v2M12 2v2M17 2v2M7 20v2M12 20v2M17 20v2M2 7h2M2 12h2M2 17h2M20 7h2M20 12h2M20 17h2" })
1985
+ var ComponentIcon = (props) => /* @__PURE__ */ jsxs4(Icon, { ...props, children: [
1986
+ /* @__PURE__ */ jsx6("rect", { x: "4", y: "4", width: "16", height: "16", rx: "2" }),
1987
+ /* @__PURE__ */ jsx6("rect", { x: "8", y: "8", width: "8", height: "8", rx: "1" }),
1988
+ /* @__PURE__ */ jsx6("path", { d: "M7 2v2M12 2v2M17 2v2M7 20v2M12 20v2M17 20v2M2 7h2M2 12h2M2 17h2M20 7h2M20 12h2M20 17h2" })
1825
1989
  ] });
1826
- var NetIcon = (props) => /* @__PURE__ */ jsxs3(Icon, { ...props, children: [
1827
- /* @__PURE__ */ jsx5("path", { d: "M15 6a9 9 0 0 0-9 9V3" }),
1828
- /* @__PURE__ */ jsx5("circle", { cx: "18", cy: "6", r: "3" }),
1829
- /* @__PURE__ */ jsx5("circle", { cx: "6", cy: "18", r: "3" })
1990
+ var NetIcon = (props) => /* @__PURE__ */ jsxs4(Icon, { ...props, children: [
1991
+ /* @__PURE__ */ jsx6("path", { d: "M15 6a9 9 0 0 0-9 9V3" }),
1992
+ /* @__PURE__ */ jsx6("circle", { cx: "18", cy: "6", r: "3" }),
1993
+ /* @__PURE__ */ jsx6("circle", { cx: "6", cy: "18", r: "3" })
1830
1994
  ] });
1831
- var EnterIcon = (props) => /* @__PURE__ */ jsxs3(Icon, { ...props, children: [
1832
- /* @__PURE__ */ jsx5("path", { d: "M20 4v7a4 4 0 0 1-4 4H4" }),
1833
- /* @__PURE__ */ jsx5("path", { d: "m9 10-5 5 5 5" })
1995
+ var EnterIcon = (props) => /* @__PURE__ */ jsxs4(Icon, { ...props, children: [
1996
+ /* @__PURE__ */ jsx6("path", { d: "M20 4v7a4 4 0 0 1-4 4H4" }),
1997
+ /* @__PURE__ */ jsx6("path", { d: "m9 10-5 5 5 5" })
1834
1998
  ] });
1835
1999
 
1836
2000
  // lib/components/SchematicSearch.tsx
1837
- import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
2001
+ import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1838
2002
  var HighlightedSearchText = ({
1839
2003
  text,
1840
2004
  query
@@ -1850,7 +2014,7 @@ var HighlightedSearchText = ({
1850
2014
  parts.push(text.slice(cursor, matchIndex));
1851
2015
  }
1852
2016
  parts.push(
1853
- /* @__PURE__ */ jsx6("strong", { style: { fontWeight: 700 }, children: text.slice(matchIndex, matchIndex + normalizedQuery.length) }, `${matchIndex}-${cursor}`)
2017
+ /* @__PURE__ */ jsx7("strong", { style: { fontWeight: 700 }, children: text.slice(matchIndex, matchIndex + normalizedQuery.length) }, `${matchIndex}-${cursor}`)
1854
2018
  );
1855
2019
  cursor = matchIndex + normalizedQuery.length;
1856
2020
  matchIndex = normalizedText.indexOf(normalizedQuery, cursor);
@@ -1872,13 +2036,13 @@ var SchematicSearch = ({
1872
2036
  onSelect,
1873
2037
  viewerContainerRef
1874
2038
  }) => {
1875
- const [isOpen, setIsOpen] = useState6(false);
1876
- const [activeResultId, setActiveResultId] = useState6(null);
1877
- const [hoveredResultId, setHoveredResultId] = useState6(null);
2039
+ const [isOpen, setIsOpen] = useState7(false);
2040
+ const [activeResultId, setActiveResultId] = useState7(null);
2041
+ const [hoveredResultId, setHoveredResultId] = useState7(null);
1878
2042
  const inputRef = useRef7(null);
1879
2043
  const resultsListRef = useRef7(null);
1880
2044
  const shortcutLabel = getShortcutLabel();
1881
- useEffect10(() => {
2045
+ useEffect11(() => {
1882
2046
  setActiveResultId((currentId) => {
1883
2047
  if (results.some((result) => result.target.id === currentId)) {
1884
2048
  return currentId;
@@ -1886,11 +2050,11 @@ var SchematicSearch = ({
1886
2050
  return results.find((result) => result.kind === "component")?.target.id ?? results[0]?.target.id ?? null;
1887
2051
  });
1888
2052
  }, [results]);
1889
- useEffect10(() => {
2053
+ useEffect11(() => {
1890
2054
  if (!activeResultId) return;
1891
2055
  resultsListRef.current?.querySelector(`[data-search-result-id="${activeResultId}"]`)?.scrollIntoView({ behavior: "smooth", block: "nearest" });
1892
2056
  }, [activeResultId]);
1893
- useEffect10(() => {
2057
+ useEffect11(() => {
1894
2058
  const handleSearchShortcut = (event) => {
1895
2059
  if (event.key === "Escape" && isOpen) {
1896
2060
  event.preventDefault();
@@ -1991,8 +2155,8 @@ var SchematicSearch = ({
1991
2155
  };
1992
2156
  const renderResultSection = (title, sectionResults) => {
1993
2157
  if (sectionResults.length === 0) return null;
1994
- return /* @__PURE__ */ jsxs4("section", { children: [
1995
- /* @__PURE__ */ jsx6(
2158
+ return /* @__PURE__ */ jsxs5("section", { children: [
2159
+ /* @__PURE__ */ jsx7(
1996
2160
  "div",
1997
2161
  {
1998
2162
  style: {
@@ -2012,16 +2176,16 @@ var SchematicSearch = ({
2012
2176
  const hovering = result.target.id === hoveredResultId;
2013
2177
  let resultBackground = "#ffffff";
2014
2178
  if (hovering || active) resultBackground = "#f1f3f5";
2015
- let resultIcon = /* @__PURE__ */ jsx6(NetIcon, { size: 15, strokeWidth: 1.8 });
2179
+ let resultIcon = /* @__PURE__ */ jsx7(NetIcon, { size: 15, strokeWidth: 1.8 });
2016
2180
  if (result.kind === "component") {
2017
- resultIcon = /* @__PURE__ */ jsx6(ComponentIcon, { size: 15, strokeWidth: 1.8 });
2181
+ resultIcon = /* @__PURE__ */ jsx7(ComponentIcon, { size: 15, strokeWidth: 1.8 });
2018
2182
  }
2019
2183
  const selectResult = () => {
2020
2184
  inputRef.current?.blur();
2021
2185
  setActiveResultId(result.target.id);
2022
2186
  onSelect(result);
2023
2187
  };
2024
- return /* @__PURE__ */ jsxs4(
2188
+ return /* @__PURE__ */ jsxs5(
2025
2189
  "button",
2026
2190
  {
2027
2191
  type: "button",
@@ -2047,7 +2211,7 @@ var SchematicSearch = ({
2047
2211
  textAlign: "left"
2048
2212
  },
2049
2213
  children: [
2050
- /* @__PURE__ */ jsx6(
2214
+ /* @__PURE__ */ jsx7(
2051
2215
  "span",
2052
2216
  {
2053
2217
  style: {
@@ -2064,8 +2228,8 @@ var SchematicSearch = ({
2064
2228
  children: resultIcon
2065
2229
  }
2066
2230
  ),
2067
- /* @__PURE__ */ jsxs4("span", { style: { minWidth: 0, flex: 1 }, children: [
2068
- /* @__PURE__ */ jsx6(
2231
+ /* @__PURE__ */ jsxs5("span", { style: { minWidth: 0, flex: 1 }, children: [
2232
+ /* @__PURE__ */ jsx7(
2069
2233
  "span",
2070
2234
  {
2071
2235
  style: {
@@ -2077,10 +2241,10 @@ var SchematicSearch = ({
2077
2241
  textOverflow: "ellipsis",
2078
2242
  whiteSpace: "nowrap"
2079
2243
  },
2080
- children: /* @__PURE__ */ jsx6(HighlightedSearchText, { text: result.label, query })
2244
+ children: /* @__PURE__ */ jsx7(HighlightedSearchText, { text: result.label, query })
2081
2245
  }
2082
2246
  ),
2083
- result.detail && /* @__PURE__ */ jsx6(
2247
+ result.detail && /* @__PURE__ */ jsx7(
2084
2248
  "span",
2085
2249
  {
2086
2250
  style: {
@@ -2096,7 +2260,7 @@ var SchematicSearch = ({
2096
2260
  children: result.detail
2097
2261
  }
2098
2262
  ),
2099
- result.schematicSheetName && /* @__PURE__ */ jsxs4(
2263
+ result.schematicSheetName && /* @__PURE__ */ jsxs5(
2100
2264
  "span",
2101
2265
  {
2102
2266
  style: {
@@ -2116,7 +2280,7 @@ var SchematicSearch = ({
2116
2280
  }
2117
2281
  )
2118
2282
  ] }),
2119
- active && /* @__PURE__ */ jsx6(
2283
+ active && /* @__PURE__ */ jsx7(
2120
2284
  "span",
2121
2285
  {
2122
2286
  title: "Press Enter to open",
@@ -2126,7 +2290,7 @@ var SchematicSearch = ({
2126
2290
  fontSize: "17px",
2127
2291
  lineHeight: 1
2128
2292
  },
2129
- children: /* @__PURE__ */ jsx6(EnterIcon, { size: 14, strokeWidth: 1.8 })
2293
+ children: /* @__PURE__ */ jsx7(EnterIcon, { size: 14, strokeWidth: 1.8 })
2130
2294
  }
2131
2295
  )
2132
2296
  ]
@@ -2136,7 +2300,7 @@ var SchematicSearch = ({
2136
2300
  })
2137
2301
  ] });
2138
2302
  };
2139
- return /* @__PURE__ */ jsx6(
2303
+ return /* @__PURE__ */ jsx7(
2140
2304
  "div",
2141
2305
  {
2142
2306
  "data-schematic-search": true,
@@ -2149,7 +2313,7 @@ var SchematicSearch = ({
2149
2313
  zIndex: zIndexMap.schematicSearch,
2150
2314
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
2151
2315
  },
2152
- children: !isOpen ? /* @__PURE__ */ jsx6(
2316
+ children: !isOpen ? /* @__PURE__ */ jsx7(
2153
2317
  "button",
2154
2318
  {
2155
2319
  type: "button",
@@ -2180,9 +2344,9 @@ var SchematicSearch = ({
2180
2344
  cursor: "pointer",
2181
2345
  boxShadow: "0 2px 4px rgba(0,0,0,0.1)"
2182
2346
  },
2183
- children: /* @__PURE__ */ jsx6(SearchIcon, { size: 16, strokeWidth: 2 })
2347
+ children: /* @__PURE__ */ jsx7(SearchIcon, { size: 16, strokeWidth: 2 })
2184
2348
  }
2185
- ) : /* @__PURE__ */ jsxs4(
2349
+ ) : /* @__PURE__ */ jsxs5(
2186
2350
  "div",
2187
2351
  {
2188
2352
  onKeyDown: handleSearchKeyDown,
@@ -2195,7 +2359,7 @@ var SchematicSearch = ({
2195
2359
  boxShadow: "0 2px 4px rgba(0,0,0,0.1)"
2196
2360
  },
2197
2361
  children: [
2198
- /* @__PURE__ */ jsxs4(
2362
+ /* @__PURE__ */ jsxs5(
2199
2363
  "div",
2200
2364
  {
2201
2365
  style: {
@@ -2208,8 +2372,8 @@ var SchematicSearch = ({
2208
2372
  borderBottom: searchHeaderBorder
2209
2373
  },
2210
2374
  children: [
2211
- /* @__PURE__ */ jsx6(SearchIcon, { size: 15, strokeWidth: 2 }),
2212
- /* @__PURE__ */ jsx6(
2375
+ /* @__PURE__ */ jsx7(SearchIcon, { size: 15, strokeWidth: 2 }),
2376
+ /* @__PURE__ */ jsx7(
2213
2377
  "input",
2214
2378
  {
2215
2379
  ref: inputRef,
@@ -2229,7 +2393,7 @@ var SchematicSearch = ({
2229
2393
  }
2230
2394
  }
2231
2395
  ),
2232
- query && results.length > 0 ? /* @__PURE__ */ jsx6(
2396
+ query && results.length > 0 ? /* @__PURE__ */ jsx7(
2233
2397
  "span",
2234
2398
  {
2235
2399
  style: {
@@ -2240,7 +2404,7 @@ var SchematicSearch = ({
2240
2404
  },
2241
2405
  children: resultCountLabel
2242
2406
  }
2243
- ) : /* @__PURE__ */ jsx6(
2407
+ ) : /* @__PURE__ */ jsx7(
2244
2408
  "kbd",
2245
2409
  {
2246
2410
  style: {
@@ -2257,7 +2421,7 @@ var SchematicSearch = ({
2257
2421
  children: shortcutLabel
2258
2422
  }
2259
2423
  ),
2260
- isOpen && /* @__PURE__ */ jsx6(
2424
+ isOpen && /* @__PURE__ */ jsx7(
2261
2425
  "button",
2262
2426
  {
2263
2427
  type: "button",
@@ -2280,13 +2444,13 @@ var SchematicSearch = ({
2280
2444
  padding: 0,
2281
2445
  lineHeight: 1
2282
2446
  },
2283
- children: /* @__PURE__ */ jsx6(CloseIcon, { size: 16, strokeWidth: 2 })
2447
+ children: /* @__PURE__ */ jsx7(CloseIcon, { size: 16, strokeWidth: 2 })
2284
2448
  }
2285
2449
  )
2286
2450
  ]
2287
2451
  }
2288
2452
  ),
2289
- query && /* @__PURE__ */ jsx6(
2453
+ query && /* @__PURE__ */ jsx7(
2290
2454
  "div",
2291
2455
  {
2292
2456
  ref: resultsListRef,
@@ -2301,7 +2465,7 @@ var SchematicSearch = ({
2301
2465
  },
2302
2466
  onWheel: (event) => event.stopPropagation(),
2303
2467
  onTouchMove: (event) => event.stopPropagation(),
2304
- children: results.length === 0 ? /* @__PURE__ */ jsx6(
2468
+ children: results.length === 0 ? /* @__PURE__ */ jsx7(
2305
2469
  "div",
2306
2470
  {
2307
2471
  style: {
@@ -2311,7 +2475,7 @@ var SchematicSearch = ({
2311
2475
  },
2312
2476
  children: "No matching components or nets"
2313
2477
  }
2314
- ) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
2478
+ ) : /* @__PURE__ */ jsxs5(Fragment4, { children: [
2315
2479
  renderResultSection("components", componentResults),
2316
2480
  renderResultSection("nets", netResults)
2317
2481
  ] })
@@ -2325,9 +2489,9 @@ var SchematicSearch = ({
2325
2489
  };
2326
2490
 
2327
2491
  // lib/components/SchematicSheetSelector.tsx
2328
- import { useState as useState7 } from "react";
2492
+ import { useState as useState8 } from "react";
2329
2493
  import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
2330
- import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
2494
+ import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
2331
2495
  var FONT_FAMILY = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
2332
2496
  var contentStyles = {
2333
2497
  backgroundColor: "#ffffff",
@@ -2377,7 +2541,7 @@ var MENU_CSS = `
2377
2541
  .sv-sheet-chevron { transition: transform 0.2s ease; }
2378
2542
  [data-state="open"] > .sv-sheet-chevron { transform: rotate(180deg); }
2379
2543
  `;
2380
- var CheckIcon = () => /* @__PURE__ */ jsx7(
2544
+ var CheckIcon = () => /* @__PURE__ */ jsx8(
2381
2545
  "svg",
2382
2546
  {
2383
2547
  width: "14",
@@ -2389,10 +2553,10 @@ var CheckIcon = () => /* @__PURE__ */ jsx7(
2389
2553
  strokeLinecap: "round",
2390
2554
  strokeLinejoin: "round",
2391
2555
  "aria-hidden": "true",
2392
- children: /* @__PURE__ */ jsx7("path", { d: "M20 6 9 17l-5-5" })
2556
+ children: /* @__PURE__ */ jsx8("path", { d: "M20 6 9 17l-5-5" })
2393
2557
  }
2394
2558
  );
2395
- var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx7(
2559
+ var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx8(
2396
2560
  "svg",
2397
2561
  {
2398
2562
  className,
@@ -2406,7 +2570,7 @@ var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx7(
2406
2570
  strokeLinejoin: "round",
2407
2571
  style: { opacity: 0.6, flexShrink: 0 },
2408
2572
  "aria-hidden": "true",
2409
- children: /* @__PURE__ */ jsx7("path", { d: "m6 9 6 6 6-6" })
2573
+ children: /* @__PURE__ */ jsx8("path", { d: "m6 9 6 6 6-6" })
2410
2574
  }
2411
2575
  );
2412
2576
  var SchematicSheetSelector = ({
@@ -2414,16 +2578,16 @@ var SchematicSheetSelector = ({
2414
2578
  selectedSheetId,
2415
2579
  onSelectSheet
2416
2580
  }) => {
2417
- const [open, setOpen] = useState7(false);
2581
+ const [open, setOpen] = useState8(false);
2418
2582
  if (sheets.length <= 1) return null;
2419
2583
  const selectedSheet = sheets.find(
2420
2584
  (s) => s.schematic_sheet_id === selectedSheetId
2421
2585
  );
2422
2586
  const selectedLabel = selectedSheet?.name ?? "Select sheet";
2423
- return /* @__PURE__ */ jsxs5(Fragment4, { children: [
2424
- /* @__PURE__ */ jsx7("style", { children: MENU_CSS }),
2425
- /* @__PURE__ */ jsxs5(DropdownMenu.Root, { open, onOpenChange: setOpen, modal: false, children: [
2426
- /* @__PURE__ */ jsx7(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs5(
2587
+ return /* @__PURE__ */ jsxs6(Fragment5, { children: [
2588
+ /* @__PURE__ */ jsx8("style", { children: MENU_CSS }),
2589
+ /* @__PURE__ */ jsxs6(DropdownMenu.Root, { open, onOpenChange: setOpen, modal: false, children: [
2590
+ /* @__PURE__ */ jsx8(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs6(
2427
2591
  "button",
2428
2592
  {
2429
2593
  type: "button",
@@ -2448,13 +2612,13 @@ var SchematicSheetSelector = ({
2448
2612
  fontFamily: FONT_FAMILY
2449
2613
  },
2450
2614
  children: [
2451
- /* @__PURE__ */ jsx7("span", { style: { color: "#888888", flexShrink: 0 }, children: "Sheet:" }),
2452
- /* @__PURE__ */ jsx7("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: selectedLabel }),
2453
- /* @__PURE__ */ jsx7(ChevronDownIcon, { className: "sv-sheet-chevron" })
2615
+ /* @__PURE__ */ jsx8("span", { style: { color: "#888888", flexShrink: 0 }, children: "Sheet:" }),
2616
+ /* @__PURE__ */ jsx8("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: selectedLabel }),
2617
+ /* @__PURE__ */ jsx8(ChevronDownIcon, { className: "sv-sheet-chevron" })
2454
2618
  ]
2455
2619
  }
2456
2620
  ) }),
2457
- /* @__PURE__ */ jsx7(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx7(
2621
+ /* @__PURE__ */ jsx8(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx8(
2458
2622
  DropdownMenu.Content,
2459
2623
  {
2460
2624
  style: contentStyles,
@@ -2464,7 +2628,7 @@ var SchematicSheetSelector = ({
2464
2628
  collisionPadding: 10,
2465
2629
  children: sheets.map((sheet) => {
2466
2630
  const selected = sheet.schematic_sheet_id === selectedSheetId;
2467
- return /* @__PURE__ */ jsxs5(
2631
+ return /* @__PURE__ */ jsxs6(
2468
2632
  DropdownMenu.Item,
2469
2633
  {
2470
2634
  className: "sv-sheet-item",
@@ -2476,8 +2640,8 @@ var SchematicSheetSelector = ({
2476
2640
  setOpen(false);
2477
2641
  },
2478
2642
  children: [
2479
- /* @__PURE__ */ jsx7("span", { style: iconSlotStyles, children: selected && /* @__PURE__ */ jsx7(CheckIcon, {}) }),
2480
- /* @__PURE__ */ jsx7("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: sheet.name })
2643
+ /* @__PURE__ */ jsx8("span", { style: iconSlotStyles, children: selected && /* @__PURE__ */ jsx8(CheckIcon, {}) }),
2644
+ /* @__PURE__ */ jsx8("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: sheet.name })
2481
2645
  ]
2482
2646
  },
2483
2647
  sheet.schematic_sheet_id
@@ -2497,7 +2661,7 @@ import { useMemo as useMemo5 } from "react";
2497
2661
  // package.json
2498
2662
  var package_default = {
2499
2663
  name: "@tscircuit/schematic-viewer",
2500
- version: "2.0.89",
2664
+ version: "2.0.91",
2501
2665
  repository: {
2502
2666
  type: "git",
2503
2667
  url: "https://github.com/tscircuit/schematic-viewer"
@@ -2532,17 +2696,19 @@ var package_default = {
2532
2696
  semver: "^7.7.2",
2533
2697
  tscircuit: "^0.0.2460",
2534
2698
  tsup: "^8.3.5",
2535
- vite: "^6.0.3"
2699
+ vite: "^6.0.3",
2700
+ "@tscircuit/circuit-json-schematic-placement-analysis": "https://codeload.github.com/tscircuit/circuit-json-schematic-placement-analysis/tar.gz/refs/heads/main"
2536
2701
  },
2537
2702
  peerDependencies: {
2538
2703
  typescript: "^5.0.0",
2539
2704
  tscircuit: "*"
2540
2705
  },
2541
2706
  dependencies: {
2707
+ "@radix-ui/react-dialog": "^1.1.23",
2542
2708
  "@radix-ui/react-dropdown-menu": "^2.1.16",
2543
2709
  "@tscircuit/circuit-json-util": "^0.0.108",
2544
2710
  "circuit-json": "^0.0.479",
2545
- "circuit-to-svg": "^0.0.410",
2711
+ "circuit-to-svg": "^0.0.416",
2546
2712
  debug: "^4.4.0",
2547
2713
  fflate: "^0.8.3",
2548
2714
  "performance-now": "^2.1.0",
@@ -2551,7 +2717,7 @@ var package_default = {
2551
2717
  };
2552
2718
 
2553
2719
  // lib/components/ViewMenu.tsx
2554
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
2720
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
2555
2721
  var FONT_FAMILY2 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
2556
2722
  var contentStyles2 = {
2557
2723
  backgroundColor: "#262626",
@@ -2600,7 +2766,7 @@ var HIGHLIGHT_CSS = `
2600
2766
  .sv-vm-item:hover:not([data-disabled]) { background-color: #404040; }
2601
2767
  .sv-vm-item[data-disabled] { opacity: 0.45; cursor: not-allowed; }
2602
2768
  `;
2603
- var CheckIcon2 = () => /* @__PURE__ */ jsx8(
2769
+ var CheckIcon2 = () => /* @__PURE__ */ jsx9(
2604
2770
  "svg",
2605
2771
  {
2606
2772
  width: "14",
@@ -2612,7 +2778,7 @@ var CheckIcon2 = () => /* @__PURE__ */ jsx8(
2612
2778
  strokeLinecap: "round",
2613
2779
  strokeLinejoin: "round",
2614
2780
  "aria-hidden": "true",
2615
- children: /* @__PURE__ */ jsx8("path", { d: "M20 6 9 17l-5-5" })
2781
+ children: /* @__PURE__ */ jsx9("path", { d: "M20 6 9 17l-5-5" })
2616
2782
  }
2617
2783
  );
2618
2784
  var ViewMenu = ({
@@ -2621,12 +2787,15 @@ var ViewMenu = ({
2621
2787
  menuRef,
2622
2788
  menuPos,
2623
2789
  onOpenChange,
2790
+ onRunStyleAnalysis,
2624
2791
  showGroups,
2625
2792
  onToggleGroups,
2626
2793
  showGrid,
2627
2794
  onToggleGrid,
2628
2795
  showPorts,
2629
- onTogglePorts
2796
+ onTogglePorts,
2797
+ showWarnings,
2798
+ onToggleWarnings
2630
2799
  }) => {
2631
2800
  const hasGroups = useMemo5(() => {
2632
2801
  if (!circuitJson || circuitJson.length === 0) return false;
@@ -2661,7 +2830,7 @@ var ViewMenu = ({
2661
2830
  return false;
2662
2831
  }
2663
2832
  }, [circuitJsonKey]);
2664
- return /* @__PURE__ */ jsx8(
2833
+ return /* @__PURE__ */ jsx9(
2665
2834
  "div",
2666
2835
  {
2667
2836
  ref: menuRef,
@@ -2672,9 +2841,9 @@ var ViewMenu = ({
2672
2841
  width: 0,
2673
2842
  height: 0
2674
2843
  },
2675
- children: /* @__PURE__ */ jsxs6(DropdownMenu2.Root, { open: true, onOpenChange, modal: false, children: [
2676
- /* @__PURE__ */ jsx8(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx8("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
2677
- /* @__PURE__ */ jsx8(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs6(
2844
+ children: /* @__PURE__ */ jsxs7(DropdownMenu2.Root, { open: true, onOpenChange, modal: false, children: [
2845
+ /* @__PURE__ */ jsx9(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx9("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
2846
+ /* @__PURE__ */ jsx9(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs7(
2678
2847
  DropdownMenu2.Content,
2679
2848
  {
2680
2849
  style: contentStyles2,
@@ -2683,8 +2852,8 @@ var ViewMenu = ({
2683
2852
  collisionPadding: 10,
2684
2853
  avoidCollisions: true,
2685
2854
  children: [
2686
- /* @__PURE__ */ jsx8("style", { children: HIGHLIGHT_CSS }),
2687
- /* @__PURE__ */ jsxs6(
2855
+ /* @__PURE__ */ jsx9("style", { children: HIGHLIGHT_CSS }),
2856
+ /* @__PURE__ */ jsxs7(
2688
2857
  DropdownMenu2.Item,
2689
2858
  {
2690
2859
  className: "sv-vm-item",
@@ -2697,12 +2866,12 @@ var ViewMenu = ({
2697
2866
  if (hasPorts) onTogglePorts(!showPorts);
2698
2867
  },
2699
2868
  children: [
2700
- /* @__PURE__ */ jsx8("span", { style: iconSlotStyles2, children: showPorts && /* @__PURE__ */ jsx8(CheckIcon2, {}) }),
2701
- /* @__PURE__ */ jsx8("span", { children: "Show Schematic Ports" })
2869
+ /* @__PURE__ */ jsx9("span", { style: iconSlotStyles2, children: showPorts && /* @__PURE__ */ jsx9(CheckIcon2, {}) }),
2870
+ /* @__PURE__ */ jsx9("span", { children: "Show Schematic Ports" })
2702
2871
  ]
2703
2872
  }
2704
2873
  ),
2705
- /* @__PURE__ */ jsxs6(
2874
+ /* @__PURE__ */ jsxs7(
2706
2875
  DropdownMenu2.Item,
2707
2876
  {
2708
2877
  className: "sv-vm-item",
@@ -2715,12 +2884,12 @@ var ViewMenu = ({
2715
2884
  if (hasGroups) onToggleGroups(!showGroups);
2716
2885
  },
2717
2886
  children: [
2718
- /* @__PURE__ */ jsx8("span", { style: iconSlotStyles2, children: showGroups && /* @__PURE__ */ jsx8(CheckIcon2, {}) }),
2719
- /* @__PURE__ */ jsx8("span", { children: "View Schematic Groups" })
2887
+ /* @__PURE__ */ jsx9("span", { style: iconSlotStyles2, children: showGroups && /* @__PURE__ */ jsx9(CheckIcon2, {}) }),
2888
+ /* @__PURE__ */ jsx9("span", { children: "View Schematic Groups" })
2720
2889
  ]
2721
2890
  }
2722
2891
  ),
2723
- /* @__PURE__ */ jsxs6(
2892
+ /* @__PURE__ */ jsxs7(
2724
2893
  DropdownMenu2.Item,
2725
2894
  {
2726
2895
  className: "sv-vm-item",
@@ -2731,13 +2900,40 @@ var ViewMenu = ({
2731
2900
  onToggleGrid(!showGrid);
2732
2901
  },
2733
2902
  children: [
2734
- /* @__PURE__ */ jsx8("span", { style: iconSlotStyles2, children: showGrid && /* @__PURE__ */ jsx8(CheckIcon2, {}) }),
2735
- /* @__PURE__ */ jsx8("span", { children: "Show Grid" })
2903
+ /* @__PURE__ */ jsx9("span", { style: iconSlotStyles2, children: showGrid && /* @__PURE__ */ jsx9(CheckIcon2, {}) }),
2904
+ /* @__PURE__ */ jsx9("span", { children: "Show Grid" })
2905
+ ]
2906
+ }
2907
+ ),
2908
+ /* @__PURE__ */ jsxs7(
2909
+ DropdownMenu2.CheckboxItem,
2910
+ {
2911
+ className: "sv-vm-item",
2912
+ style: itemStyles2,
2913
+ checked: showWarnings,
2914
+ onCheckedChange: onToggleWarnings,
2915
+ onSelect: (event) => event.preventDefault(),
2916
+ children: [
2917
+ /* @__PURE__ */ jsx9("span", { style: iconSlotStyles2, children: /* @__PURE__ */ jsx9(DropdownMenu2.ItemIndicator, { children: /* @__PURE__ */ jsx9(CheckIcon2, {}) }) }),
2918
+ /* @__PURE__ */ jsx9("span", { children: "Show Warnings" })
2736
2919
  ]
2737
2920
  }
2738
2921
  ),
2739
- /* @__PURE__ */ jsx8(DropdownMenu2.Separator, { style: separatorStyles }),
2740
- /* @__PURE__ */ jsxs6(
2922
+ /* @__PURE__ */ jsx9(DropdownMenu2.Separator, { style: separatorStyles }),
2923
+ /* @__PURE__ */ jsxs7(
2924
+ DropdownMenu2.Item,
2925
+ {
2926
+ className: "sv-vm-item",
2927
+ style: itemStyles2,
2928
+ onSelect: onRunStyleAnalysis,
2929
+ children: [
2930
+ /* @__PURE__ */ jsx9("span", { style: iconSlotStyles2 }),
2931
+ /* @__PURE__ */ jsx9("span", { children: "Run Style Analysis" })
2932
+ ]
2933
+ }
2934
+ ),
2935
+ /* @__PURE__ */ jsx9(DropdownMenu2.Separator, { style: separatorStyles }),
2936
+ /* @__PURE__ */ jsxs7(
2741
2937
  "div",
2742
2938
  {
2743
2939
  style: {
@@ -2763,7 +2959,7 @@ var ViewMenu = ({
2763
2959
  };
2764
2960
 
2765
2961
  // lib/components/SchematicViewer.tsx
2766
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
2962
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
2767
2963
  var SchematicViewer = ({
2768
2964
  circuitJson,
2769
2965
  containerStyle,
@@ -2801,7 +2997,7 @@ var SchematicViewer = ({
2801
2997
  }, [circuitJsonKey]);
2802
2998
  const hasMultipleSheets = schematicSheets.length > 1;
2803
2999
  const defaultSheetId = schematicSheets[0]?.schematic_sheet_id;
2804
- const [selectedSheetId, setSelectedSheetId] = useState8(
3000
+ const [selectedSheetId, setSelectedSheetId] = useState9(
2805
3001
  () => {
2806
3002
  const stored = getStoredString(STORAGE_KEYS.SELECTED_SCHEMATIC_SHEET);
2807
3003
  if (stored && schematicSheets.some((s) => s.schematic_sheet_id === stored)) {
@@ -2810,7 +3006,7 @@ var SchematicViewer = ({
2810
3006
  return defaultSheetId;
2811
3007
  }
2812
3008
  );
2813
- useEffect11(() => {
3009
+ useEffect12(() => {
2814
3010
  const stillExists = selectedSheetId !== void 0 && schematicSheets.some((s) => s.schematic_sheet_id === selectedSheetId);
2815
3011
  if (!stillExists) {
2816
3012
  setSelectedSheetId(defaultSheetId);
@@ -2825,26 +3021,28 @@ var SchematicViewer = ({
2825
3021
  },
2826
3022
  [onSchematicSheetChange]
2827
3023
  );
2828
- const [showGridInternal, setShowGridInternal] = useState8(false);
3024
+ const [showGridInternal, setShowGridInternal] = useState9(false);
3025
+ const [analysisCircuitJson, setAnalysisCircuitJson] = useState9(null);
3026
+ const [showWarnings, setShowWarnings] = useState9(false);
2829
3027
  const showGrid = debugGrid || showGridInternal;
2830
- const [isInteractionEnabled, setIsInteractionEnabled] = useState8(
3028
+ const [isInteractionEnabled, setIsInteractionEnabled] = useState9(
2831
3029
  !clickToInteractEnabled
2832
3030
  );
2833
- const [showSchematicGroups, setShowSchematicGroups] = useState8(() => {
3031
+ const [showSchematicGroups, setShowSchematicGroups] = useState9(() => {
2834
3032
  if (disableGroups) return false;
2835
3033
  return getStoredBoolean(STORAGE_KEYS.IS_SHOWING_SCHEMATIC_GROUPS, false);
2836
3034
  });
2837
- const [showSchematicPortsInternal, setShowSchematicPortsInternal] = useState8(
3035
+ const [showSchematicPortsInternal, setShowSchematicPortsInternal] = useState9(
2838
3036
  () => showSchematicPorts ?? getStoredBoolean(STORAGE_KEYS.IS_SHOWING_SCHEMATIC_PORTS, false)
2839
3037
  );
2840
- useEffect11(() => {
3038
+ useEffect12(() => {
2841
3039
  if (showSchematicPorts !== void 0) {
2842
3040
  setShowSchematicPortsInternal(showSchematicPorts);
2843
3041
  }
2844
3042
  }, [showSchematicPorts]);
2845
- const [isHoveringClickableComponent, setIsHoveringClickableComponent] = useState8(false);
3043
+ const [isHoveringClickableComponent, setIsHoveringClickableComponent] = useState9(false);
2846
3044
  const hoveringComponentsRef = useRef8(/* @__PURE__ */ new Set());
2847
- const [selectedSchematicComponent, setSelectedSchematicComponent] = useState8(null);
3045
+ const [selectedSchematicComponent, setSelectedSchematicComponent] = useState9(null);
2848
3046
  const handleComponentHoverChange = useCallback7(
2849
3047
  (componentId, isHovering) => {
2850
3048
  if (isHovering) {
@@ -2856,7 +3054,7 @@ var SchematicViewer = ({
2856
3054
  },
2857
3055
  []
2858
3056
  );
2859
- const [isHoveringClickablePort, setIsHoveringClickablePort] = useState8(false);
3057
+ const [isHoveringClickablePort, setIsHoveringClickablePort] = useState9(false);
2860
3058
  const hoveringPortsRef = useRef8(/* @__PURE__ */ new Set());
2861
3059
  const handlePortHoverChange = useCallback7(
2862
3060
  (portId, isHovering) => {
@@ -3006,10 +3204,10 @@ var SchematicViewer = ({
3006
3204
  },
3007
3205
  [containerRef, onSchematicComponentClicked]
3008
3206
  );
3009
- useEffect11(() => {
3207
+ useEffect12(() => {
3010
3208
  setSelectedSchematicComponent(null);
3011
3209
  }, [circuitJsonKey, activeSheetId]);
3012
- useEffect11(() => {
3210
+ useEffect12(() => {
3013
3211
  if (!selectedSchematicComponent) return;
3014
3212
  const handleKeyDown = (event) => {
3015
3213
  if (event.key === "Escape") {
@@ -3035,6 +3233,7 @@ var SchematicViewer = ({
3035
3233
  width: containerWidth,
3036
3234
  height: containerHeight || 720,
3037
3235
  drawPorts: showSchematicPortsInternal,
3236
+ shouldDrawWarnings: showWarnings,
3038
3237
  schematicSheetId: activeSheetId,
3039
3238
  grid: !showGrid ? void 0 : {
3040
3239
  cellSize: 1,
@@ -3049,6 +3248,7 @@ var SchematicViewer = ({
3049
3248
  containerWidth,
3050
3249
  containerHeight,
3051
3250
  showGrid,
3251
+ showWarnings,
3052
3252
  showSchematicPortsInternal,
3053
3253
  activeSheetId
3054
3254
  ]);
@@ -3090,7 +3290,7 @@ var SchematicViewer = ({
3090
3290
  enabled: netHoverHighlightEnabled
3091
3291
  });
3092
3292
  const svgDiv = useMemo6(
3093
- () => /* @__PURE__ */ jsx9(
3293
+ () => /* @__PURE__ */ jsx10(
3094
3294
  "div",
3095
3295
  {
3096
3296
  ref: svgDivRef,
@@ -3104,10 +3304,10 @@ var SchematicViewer = ({
3104
3304
  ),
3105
3305
  [svgString, isInteractionEnabled, clickToInteractEnabled]
3106
3306
  );
3107
- return /* @__PURE__ */ jsxs7(MouseTracker, { children: [
3108
- netHoverHighlightEnabled && /* @__PURE__ */ jsx9("style", { children: `.sch-net-faded { opacity: 0.35; }
3307
+ return /* @__PURE__ */ jsxs8(MouseTracker, { children: [
3308
+ netHoverHighlightEnabled && /* @__PURE__ */ jsx10("style", { children: `.sch-net-faded { opacity: 0.35; }
3109
3309
  svg :is(g.trace, g.trace-overlays, g[data-schematic-component-id], [data-schematic-net-label-id]) { transition: opacity 0.12s ease-in-out; }` }),
3110
- searchEnabled && /* @__PURE__ */ jsx9("style", { children: `.schematic-search-match text,
3310
+ searchEnabled && /* @__PURE__ */ jsx10("style", { children: `.schematic-search-match text,
3111
3311
  text.schematic-search-match {
3112
3312
  fill: #ff00d4 !important;
3113
3313
  }
@@ -3123,9 +3323,9 @@ var SchematicViewer = ({
3123
3323
  flex-direction: column;
3124
3324
  }
3125
3325
  }` }),
3126
- /* @__PURE__ */ jsx9("style", { children: ".schematic-component-clickable [data-schematic-component-id]:hover { cursor: pointer !important; }" }),
3127
- onSchematicPortClicked && /* @__PURE__ */ jsx9("style", { children: "[data-schematic-port-id]:hover { cursor: pointer !important; }" }),
3128
- /* @__PURE__ */ jsxs7(
3326
+ /* @__PURE__ */ jsx10("style", { children: ".schematic-component-clickable [data-schematic-component-id]:hover { cursor: pointer !important; }" }),
3327
+ onSchematicPortClicked && /* @__PURE__ */ jsx10("style", { children: "[data-schematic-port-id]:hover { cursor: pointer !important; }" }),
3328
+ /* @__PURE__ */ jsxs8(
3129
3329
  "div",
3130
3330
  {
3131
3331
  ref: containerRef,
@@ -3160,7 +3360,7 @@ var SchematicViewer = ({
3160
3360
  },
3161
3361
  onTouchCancel: contextMenuEventHandlers.onTouchCancel,
3162
3362
  children: [
3163
- !isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */ jsx9(
3363
+ !isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */ jsx10(
3164
3364
  "div",
3165
3365
  {
3166
3366
  onClick: (e) => {
@@ -3179,7 +3379,7 @@ var SchematicViewer = ({
3179
3379
  pointerEvents: "all",
3180
3380
  touchAction: "pan-x pan-y pinch-zoom"
3181
3381
  },
3182
- children: /* @__PURE__ */ jsx9(
3382
+ children: /* @__PURE__ */ jsx10(
3183
3383
  "div",
3184
3384
  {
3185
3385
  style: {
@@ -3196,7 +3396,14 @@ var SchematicViewer = ({
3196
3396
  )
3197
3397
  }
3198
3398
  ),
3199
- menuVisible && /* @__PURE__ */ jsx9(
3399
+ analysisCircuitJson && /* @__PURE__ */ jsx10(
3400
+ StyleAnalysisDialog,
3401
+ {
3402
+ circuitJson: analysisCircuitJson,
3403
+ onClose: () => setAnalysisCircuitJson(null)
3404
+ }
3405
+ ),
3406
+ menuVisible && /* @__PURE__ */ jsx10(
3200
3407
  ViewMenu,
3201
3408
  {
3202
3409
  circuitJson,
@@ -3204,6 +3411,10 @@ var SchematicViewer = ({
3204
3411
  menuRef,
3205
3412
  menuPos,
3206
3413
  onOpenChange: setMenuVisible,
3414
+ onRunStyleAnalysis: () => {
3415
+ setMenuVisible(false);
3416
+ setAnalysisCircuitJson(structuredClone(circuitJson));
3417
+ },
3207
3418
  showPorts: showSchematicPortsInternal,
3208
3419
  onTogglePorts: (value) => {
3209
3420
  setShowSchematicPortsInternal(value);
@@ -3219,11 +3430,13 @@ var SchematicViewer = ({
3219
3430
  );
3220
3431
  }
3221
3432
  },
3433
+ showWarnings,
3434
+ onToggleWarnings: setShowWarnings,
3222
3435
  showGrid,
3223
3436
  onToggleGrid: setShowGridInternal
3224
3437
  }
3225
3438
  ),
3226
- /* @__PURE__ */ jsxs7(
3439
+ /* @__PURE__ */ jsxs8(
3227
3440
  "div",
3228
3441
  {
3229
3442
  className: "schematic-viewer-toolbar",
@@ -3237,7 +3450,7 @@ var SchematicViewer = ({
3237
3450
  zIndex: zIndexMap.schematicSearch
3238
3451
  },
3239
3452
  children: [
3240
- /* @__PURE__ */ jsx9(
3453
+ /* @__PURE__ */ jsx10(
3241
3454
  SchematicSheetSelector,
3242
3455
  {
3243
3456
  sheets: schematicSheets,
@@ -3245,7 +3458,7 @@ var SchematicViewer = ({
3245
3458
  onSelectSheet: handleSelectSheet
3246
3459
  }
3247
3460
  ),
3248
- searchEnabled && /* @__PURE__ */ jsx9(
3461
+ searchEnabled && /* @__PURE__ */ jsx10(
3249
3462
  SchematicSearch,
3250
3463
  {
3251
3464
  query: searchQuery,
@@ -3259,7 +3472,7 @@ var SchematicViewer = ({
3259
3472
  ]
3260
3473
  }
3261
3474
  ),
3262
- schematicComponentIds.map((componentId) => /* @__PURE__ */ jsx9(
3475
+ schematicComponentIds.map((componentId) => /* @__PURE__ */ jsx10(
3263
3476
  SchematicComponentMouseTarget,
3264
3477
  {
3265
3478
  componentId,
@@ -3273,7 +3486,7 @@ var SchematicViewer = ({
3273
3486
  componentId
3274
3487
  )),
3275
3488
  svgDiv,
3276
- selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */ jsx9(
3489
+ selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */ jsx10(
3277
3490
  SchematicComponentDetailsTooltip,
3278
3491
  {
3279
3492
  sourceComponent: selectedComponentDetails.sourceComponent,
@@ -3283,7 +3496,7 @@ var SchematicViewer = ({
3283
3496
  ...componentTooltipLayout
3284
3497
  }
3285
3498
  ),
3286
- showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */ jsx9(
3499
+ showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */ jsx10(
3287
3500
  SchematicPortMouseTarget,
3288
3501
  {
3289
3502
  portId,
@@ -3313,7 +3526,7 @@ import {
3313
3526
  convertCircuitJsonToSchematicSimulationSvg,
3314
3527
  convertCircuitJsonToSimulationGraphSvg
3315
3528
  } from "circuit-to-svg";
3316
- import { useEffect as useEffect12, useMemo as useMemo7, useRef as useRef9, useState as useState10 } from "react";
3529
+ import { useEffect as useEffect13, useMemo as useMemo7, useRef as useRef9, useState as useState11 } from "react";
3317
3530
  import { toString as transformToString2 } from "transformation-matrix";
3318
3531
  import { useMouseMatrixTransform as useMouseMatrixTransform2 } from "use-mouse-matrix-transform";
3319
3532
 
@@ -3331,8 +3544,8 @@ var getAnalogSimulationBackgroundColor = (simulationSvg, colorOverrides) => getR
3331
3544
 
3332
3545
  // lib/components/AnalogSimulationSelector.tsx
3333
3546
  import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
3334
- import { useState as useState9 } from "react";
3335
- import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
3547
+ import { useState as useState10 } from "react";
3548
+ import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
3336
3549
  var FONT_FAMILY3 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
3337
3550
  var contentStyles3 = {
3338
3551
  backgroundColor: "#ffffff",
@@ -3382,7 +3595,7 @@ var MENU_CSS2 = `
3382
3595
  .sv-simulation-chevron { transition: transform 0.2s ease; }
3383
3596
  [data-state="open"] > .sv-simulation-chevron { transform: rotate(180deg); }
3384
3597
  `;
3385
- var CheckIcon3 = () => /* @__PURE__ */ jsx10(
3598
+ var CheckIcon3 = () => /* @__PURE__ */ jsx11(
3386
3599
  "svg",
3387
3600
  {
3388
3601
  width: "14",
@@ -3394,10 +3607,10 @@ var CheckIcon3 = () => /* @__PURE__ */ jsx10(
3394
3607
  strokeLinecap: "round",
3395
3608
  strokeLinejoin: "round",
3396
3609
  "aria-hidden": "true",
3397
- children: /* @__PURE__ */ jsx10("path", { d: "M20 6 9 17l-5-5" })
3610
+ children: /* @__PURE__ */ jsx11("path", { d: "M20 6 9 17l-5-5" })
3398
3611
  }
3399
3612
  );
3400
- var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx10(
3613
+ var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx11(
3401
3614
  "svg",
3402
3615
  {
3403
3616
  className,
@@ -3411,7 +3624,7 @@ var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx10(
3411
3624
  strokeLinejoin: "round",
3412
3625
  style: { opacity: 0.6, flexShrink: 0 },
3413
3626
  "aria-hidden": "true",
3414
- children: /* @__PURE__ */ jsx10("path", { d: "m6 9 6 6 6-6" })
3627
+ children: /* @__PURE__ */ jsx11("path", { d: "m6 9 6 6 6-6" })
3415
3628
  }
3416
3629
  );
3417
3630
  var getSimulationLabels = (simulations) => {
@@ -3430,17 +3643,17 @@ var AnalogSimulationSelector = ({
3430
3643
  selectedSimulationExperimentId,
3431
3644
  onSelectSimulation
3432
3645
  }) => {
3433
- const [open, setOpen] = useState9(false);
3646
+ const [open, setOpen] = useState10(false);
3434
3647
  if (simulations.length <= 1) return null;
3435
3648
  const simulationLabels = getSimulationLabels(simulations);
3436
3649
  const selectedSimulation = simulationLabels.find(
3437
3650
  ({ simulation }) => simulation.simulation_experiment_id === selectedSimulationExperimentId
3438
3651
  );
3439
3652
  const selectedLabel = selectedSimulation?.label ?? "Select simulation";
3440
- return /* @__PURE__ */ jsxs8(Fragment5, { children: [
3441
- /* @__PURE__ */ jsx10("style", { children: MENU_CSS2 }),
3442
- /* @__PURE__ */ jsxs8(DropdownMenu3.Root, { open, onOpenChange: setOpen, modal: false, children: [
3443
- /* @__PURE__ */ jsx10(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs8(
3653
+ return /* @__PURE__ */ jsxs9(Fragment6, { children: [
3654
+ /* @__PURE__ */ jsx11("style", { children: MENU_CSS2 }),
3655
+ /* @__PURE__ */ jsxs9(DropdownMenu3.Root, { open, onOpenChange: setOpen, modal: false, children: [
3656
+ /* @__PURE__ */ jsx11(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs9(
3444
3657
  "button",
3445
3658
  {
3446
3659
  type: "button",
@@ -3467,13 +3680,13 @@ var AnalogSimulationSelector = ({
3467
3680
  zIndex: zIndexMap.viewMenuIcon
3468
3681
  },
3469
3682
  children: [
3470
- /* @__PURE__ */ jsx10("span", { style: { color: "#888888", flexShrink: 0 }, children: "Simulation:" }),
3471
- /* @__PURE__ */ jsx10("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: selectedLabel }),
3472
- /* @__PURE__ */ jsx10(ChevronDownIcon2, { className: "sv-simulation-chevron" })
3683
+ /* @__PURE__ */ jsx11("span", { style: { color: "#888888", flexShrink: 0 }, children: "Simulation:" }),
3684
+ /* @__PURE__ */ jsx11("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: selectedLabel }),
3685
+ /* @__PURE__ */ jsx11(ChevronDownIcon2, { className: "sv-simulation-chevron" })
3473
3686
  ]
3474
3687
  }
3475
3688
  ) }),
3476
- /* @__PURE__ */ jsx10(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx10(
3689
+ /* @__PURE__ */ jsx11(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx11(
3477
3690
  DropdownMenu3.Content,
3478
3691
  {
3479
3692
  style: contentStyles3,
@@ -3483,7 +3696,7 @@ var AnalogSimulationSelector = ({
3483
3696
  collisionPadding: 10,
3484
3697
  children: simulationLabels.map(({ simulation, label }) => {
3485
3698
  const selected = simulation.simulation_experiment_id === selectedSimulationExperimentId;
3486
- return /* @__PURE__ */ jsxs8(
3699
+ return /* @__PURE__ */ jsxs9(
3487
3700
  DropdownMenu3.Item,
3488
3701
  {
3489
3702
  className: "sv-simulation-item",
@@ -3495,8 +3708,8 @@ var AnalogSimulationSelector = ({
3495
3708
  setOpen(false);
3496
3709
  },
3497
3710
  children: [
3498
- /* @__PURE__ */ jsx10("span", { style: iconSlotStyles3, children: selected && /* @__PURE__ */ jsx10(CheckIcon3, {}) }),
3499
- /* @__PURE__ */ jsx10("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: label })
3711
+ /* @__PURE__ */ jsx11("span", { style: iconSlotStyles3, children: selected && /* @__PURE__ */ jsx11(CheckIcon3, {}) }),
3712
+ /* @__PURE__ */ jsx11("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: label })
3500
3713
  ]
3501
3714
  },
3502
3715
  simulation.simulation_experiment_id
@@ -3509,7 +3722,7 @@ var AnalogSimulationSelector = ({
3509
3722
  };
3510
3723
 
3511
3724
  // lib/components/AnalogSimulationViewer.tsx
3512
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
3725
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
3513
3726
  var DEFAULT_RENDER_WIDTH = 1200;
3514
3727
  var DEFAULT_COMBINED_RENDER_ASPECT_RATIO = 1;
3515
3728
  var DEFAULT_GRAPH_ONLY_RENDER_ASPECT_RATIO = 2;
@@ -3524,16 +3737,16 @@ var AnalogSimulationViewer = ({
3524
3737
  onSimulationChange,
3525
3738
  acSweepView = "magnitude"
3526
3739
  }) => {
3527
- const [circuitJson, setCircuitJson] = useState10(null);
3528
- const [isLoading, setIsLoading] = useState10(true);
3529
- const [error, setError] = useState10(null);
3530
- const [svgObjectUrl, setSvgObjectUrl] = useState10(null);
3740
+ const [circuitJson, setCircuitJson] = useState11(null);
3741
+ const [isLoading, setIsLoading] = useState11(true);
3742
+ const [error, setError] = useState11(null);
3743
+ const [svgObjectUrl, setSvgObjectUrl] = useState11(null);
3531
3744
  const containerRef = useRef9(null);
3532
3745
  const imgRef = useRef9(null);
3533
3746
  const { containerWidth } = useResizeHandling(
3534
3747
  containerRef
3535
3748
  );
3536
- const [isDragging, setIsDragging] = useState10(false);
3749
+ const [isDragging, setIsDragging] = useState11(false);
3537
3750
  const {
3538
3751
  ref: transformRef,
3539
3752
  cancelDrag: _cancelDrag,
@@ -3549,7 +3762,7 @@ var AnalogSimulationViewer = ({
3549
3762
  const renderAspectRatio = width && height ? width / height : defaultRenderAspectRatio;
3550
3763
  const effectiveWidth = width || (height ? height * renderAspectRatio : containerWidth) || DEFAULT_RENDER_WIDTH;
3551
3764
  const effectiveHeight = height || effectiveWidth / renderAspectRatio;
3552
- useEffect12(() => {
3765
+ useEffect13(() => {
3553
3766
  setIsLoading(true);
3554
3767
  setError(null);
3555
3768
  setCircuitJson(inputCircuitJson);
@@ -3561,11 +3774,11 @@ var AnalogSimulationViewer = ({
3561
3774
  (element) => element.type === "simulation_experiment"
3562
3775
  );
3563
3776
  }, [circuitJson]);
3564
- const [selectedSimulationExperimentId, setSelectedSimulationExperimentId] = useState10(null);
3777
+ const [selectedSimulationExperimentId, setSelectedSimulationExperimentId] = useState11(null);
3565
3778
  const simulationExperimentId = (selectedSimulationExperimentId && simulationExperiments.some(
3566
3779
  (simulation) => simulation.simulation_experiment_id === selectedSimulationExperimentId
3567
3780
  ) ? selectedSimulationExperimentId : simulationExperiments[0]?.simulation_experiment_id) ?? null;
3568
- useEffect12(() => {
3781
+ useEffect13(() => {
3569
3782
  if (simulationExperimentId !== selectedSimulationExperimentId) {
3570
3783
  setSelectedSimulationExperimentId(simulationExperimentId);
3571
3784
  }
@@ -3602,7 +3815,7 @@ var AnalogSimulationViewer = ({
3602
3815
  simulationExperimentId,
3603
3816
  acSweepView
3604
3817
  ]);
3605
- useEffect12(() => {
3818
+ useEffect13(() => {
3606
3819
  if (!simulationSvg) {
3607
3820
  setSvgObjectUrl(null);
3608
3821
  return;
@@ -3628,7 +3841,7 @@ var AnalogSimulationViewer = ({
3628
3841
  const handleTouchStart = (_e) => {
3629
3842
  setIsDragging(true);
3630
3843
  };
3631
- useEffect12(() => {
3844
+ useEffect13(() => {
3632
3845
  const handleMouseUp = () => {
3633
3846
  setIsDragging(false);
3634
3847
  };
@@ -3643,7 +3856,7 @@ var AnalogSimulationViewer = ({
3643
3856
  };
3644
3857
  }, []);
3645
3858
  if (isLoading) {
3646
- return /* @__PURE__ */ jsx11(
3859
+ return /* @__PURE__ */ jsx12(
3647
3860
  "div",
3648
3861
  {
3649
3862
  style: {
@@ -3663,7 +3876,7 @@ var AnalogSimulationViewer = ({
3663
3876
  );
3664
3877
  }
3665
3878
  if (error) {
3666
- return /* @__PURE__ */ jsx11(
3879
+ return /* @__PURE__ */ jsx12(
3667
3880
  "div",
3668
3881
  {
3669
3882
  style: {
@@ -3678,15 +3891,15 @@ var AnalogSimulationViewer = ({
3678
3891
  ...containerStyle
3679
3892
  },
3680
3893
  className,
3681
- children: /* @__PURE__ */ jsxs9("div", { style: { textAlign: "center", padding: "20px" }, children: [
3682
- /* @__PURE__ */ jsx11("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "Circuit Conversion Error" }),
3683
- /* @__PURE__ */ jsx11("div", { style: { fontSize: "14px" }, children: error })
3894
+ children: /* @__PURE__ */ jsxs10("div", { style: { textAlign: "center", padding: "20px" }, children: [
3895
+ /* @__PURE__ */ jsx12("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "Circuit Conversion Error" }),
3896
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: "14px" }, children: error })
3684
3897
  ] })
3685
3898
  }
3686
3899
  );
3687
3900
  }
3688
3901
  if (!simulationSvg) {
3689
- return /* @__PURE__ */ jsxs9(
3902
+ return /* @__PURE__ */ jsxs10(
3690
3903
  "div",
3691
3904
  {
3692
3905
  style: {
@@ -3702,11 +3915,11 @@ var AnalogSimulationViewer = ({
3702
3915
  },
3703
3916
  className,
3704
3917
  children: [
3705
- /* @__PURE__ */ jsx11("div", { style: { fontSize: "16px", color: "#475569", fontWeight: 500 }, children: "No Simulation Found" }),
3706
- /* @__PURE__ */ jsxs9("div", { style: { fontSize: "14px", color: "#64748b" }, children: [
3918
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: "16px", color: "#475569", fontWeight: 500 }, children: "No Simulation Found" }),
3919
+ /* @__PURE__ */ jsxs10("div", { style: { fontSize: "14px", color: "#64748b" }, children: [
3707
3920
  "Use",
3708
3921
  " ",
3709
- /* @__PURE__ */ jsx11(
3922
+ /* @__PURE__ */ jsx12(
3710
3923
  "code",
3711
3924
  {
3712
3925
  style: {
@@ -3726,7 +3939,7 @@ var AnalogSimulationViewer = ({
3726
3939
  }
3727
3940
  );
3728
3941
  }
3729
- return /* @__PURE__ */ jsxs9(
3942
+ return /* @__PURE__ */ jsxs10(
3730
3943
  "div",
3731
3944
  {
3732
3945
  ref: (node) => {
@@ -3745,7 +3958,7 @@ var AnalogSimulationViewer = ({
3745
3958
  onMouseDown: handleMouseDown,
3746
3959
  onTouchStart: handleTouchStart,
3747
3960
  children: [
3748
- /* @__PURE__ */ jsx11(
3961
+ /* @__PURE__ */ jsx12(
3749
3962
  AnalogSimulationSelector,
3750
3963
  {
3751
3964
  simulations: simulationExperiments,
@@ -3753,7 +3966,7 @@ var AnalogSimulationViewer = ({
3753
3966
  onSelectSimulation: handleSelectSimulation
3754
3967
  }
3755
3968
  ),
3756
- svgObjectUrl ? /* @__PURE__ */ jsx11(
3969
+ svgObjectUrl ? /* @__PURE__ */ jsx12(
3757
3970
  "img",
3758
3971
  {
3759
3972
  ref: imgRef,
@@ -3767,7 +3980,7 @@ var AnalogSimulationViewer = ({
3767
3980
  objectFit: "contain"
3768
3981
  }
3769
3982
  }
3770
- ) : /* @__PURE__ */ jsx11(
3983
+ ) : /* @__PURE__ */ jsx12(
3771
3984
  "div",
3772
3985
  {
3773
3986
  style: {