@tscircuit/schematic-viewer 2.0.91 → 2.0.93
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/README.md +14 -0
- package/dist/index.js +511 -244
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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] =
|
|
641
|
-
const [pendingSearchResult, setPendingSearchResult] =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
955
|
+
import { useEffect as useEffect5, useState as useState3 } from "react";
|
|
780
956
|
var useResizeHandling = (containerRef) => {
|
|
781
|
-
const [containerWidth, setContainerWidth] =
|
|
782
|
-
const [containerHeight, setContainerHeight] =
|
|
783
|
-
|
|
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
|
|
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] =
|
|
808
|
-
const [menuPos, setMenuPos] =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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__ */
|
|
1266
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children });
|
|
1103
1267
|
}
|
|
1104
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
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__ */
|
|
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
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
1339
|
-
/* @__PURE__ */
|
|
1340
|
-
/* @__PURE__ */
|
|
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__ */
|
|
1357
|
-
/* @__PURE__ */
|
|
1358
|
-
/* @__PURE__ */
|
|
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__ */
|
|
1533
|
+
children: entry.links.map((link, index) => /* @__PURE__ */ jsxs2("span", { children: [
|
|
1370
1534
|
index > 0 && ", ",
|
|
1371
|
-
/* @__PURE__ */
|
|
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__ */
|
|
1386
|
-
/* @__PURE__ */
|
|
1387
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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] =
|
|
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
|
-
|
|
1719
|
+
useEffect9(() => {
|
|
1556
1720
|
scheduleMeasure();
|
|
1557
1721
|
}, [scheduleMeasure, circuitJsonKey]);
|
|
1558
|
-
|
|
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
|
-
|
|
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__ */
|
|
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
|
|
1631
|
-
import { Fragment as
|
|
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] =
|
|
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
|
-
|
|
1853
|
+
useEffect10(() => {
|
|
1690
1854
|
scheduleMeasure();
|
|
1691
1855
|
}, [scheduleMeasure, circuitJsonKey]);
|
|
1692
|
-
|
|
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
|
-
|
|
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__ */
|
|
1747
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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
|
|
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
|
|
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__ */
|
|
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__ */
|
|
1814
|
-
/* @__PURE__ */
|
|
1815
|
-
/* @__PURE__ */
|
|
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__ */
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
/* @__PURE__ */
|
|
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__ */
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
/* @__PURE__ */
|
|
1824
|
-
/* @__PURE__ */
|
|
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__ */
|
|
1827
|
-
/* @__PURE__ */
|
|
1828
|
-
/* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
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__ */
|
|
1832
|
-
/* @__PURE__ */
|
|
1833
|
-
/* @__PURE__ */
|
|
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
|
|
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__ */
|
|
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] =
|
|
1876
|
-
const [activeResultId, setActiveResultId] =
|
|
1877
|
-
const [hoveredResultId, setHoveredResultId] =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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__ */
|
|
1995
|
-
/* @__PURE__ */
|
|
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__ */
|
|
2179
|
+
let resultIcon = /* @__PURE__ */ jsx7(NetIcon, { size: 15, strokeWidth: 1.8 });
|
|
2016
2180
|
if (result.kind === "component") {
|
|
2017
|
-
resultIcon = /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
2068
|
-
/* @__PURE__ */
|
|
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__ */
|
|
2244
|
+
children: /* @__PURE__ */ jsx7(HighlightedSearchText, { text: result.label, query })
|
|
2081
2245
|
}
|
|
2082
2246
|
),
|
|
2083
|
-
result.detail && /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
2347
|
+
children: /* @__PURE__ */ jsx7(SearchIcon, { size: 16, strokeWidth: 2 })
|
|
2184
2348
|
}
|
|
2185
|
-
) : /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
2212
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
2447
|
+
children: /* @__PURE__ */ jsx7(CloseIcon, { size: 16, strokeWidth: 2 })
|
|
2284
2448
|
}
|
|
2285
2449
|
)
|
|
2286
2450
|
]
|
|
2287
2451
|
}
|
|
2288
2452
|
),
|
|
2289
|
-
query && /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
|
2492
|
+
import { useState as useState8 } from "react";
|
|
2329
2493
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
2330
|
-
import { Fragment as
|
|
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__ */
|
|
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__ */
|
|
2556
|
+
children: /* @__PURE__ */ jsx8("path", { d: "M20 6 9 17l-5-5" })
|
|
2393
2557
|
}
|
|
2394
2558
|
);
|
|
2395
|
-
var ChevronDownIcon = ({ className }) => /* @__PURE__ */
|
|
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__ */
|
|
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] =
|
|
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__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
/* @__PURE__ */
|
|
2426
|
-
/* @__PURE__ */
|
|
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__ */
|
|
2452
|
-
/* @__PURE__ */
|
|
2453
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
2480
|
-
/* @__PURE__ */
|
|
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
|
|
@@ -2489,6 +2653,68 @@ var SchematicSheetSelector = ({
|
|
|
2489
2653
|
] });
|
|
2490
2654
|
};
|
|
2491
2655
|
|
|
2656
|
+
// lib/components/SchematicWarningsButton.tsx
|
|
2657
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2658
|
+
var SchematicWarningsButton = ({
|
|
2659
|
+
count,
|
|
2660
|
+
showWarnings,
|
|
2661
|
+
onToggle
|
|
2662
|
+
}) => {
|
|
2663
|
+
const label = `${showWarnings ? "Hide" : "Show"} ${count} ${count === 1 ? "warning" : "warnings"}`;
|
|
2664
|
+
return /* @__PURE__ */ jsxs7(
|
|
2665
|
+
"button",
|
|
2666
|
+
{
|
|
2667
|
+
type: "button",
|
|
2668
|
+
"data-schematic-warnings": true,
|
|
2669
|
+
title: label,
|
|
2670
|
+
"aria-label": label,
|
|
2671
|
+
"aria-pressed": showWarnings,
|
|
2672
|
+
onClick: onToggle,
|
|
2673
|
+
onPointerDown: (event) => event.stopPropagation(),
|
|
2674
|
+
onMouseDown: (event) => event.stopPropagation(),
|
|
2675
|
+
onTouchStart: (event) => event.stopPropagation(),
|
|
2676
|
+
onTouchEnd: (event) => event.stopPropagation(),
|
|
2677
|
+
style: {
|
|
2678
|
+
height: "32px",
|
|
2679
|
+
display: "flex",
|
|
2680
|
+
alignItems: "center",
|
|
2681
|
+
gap: "4px",
|
|
2682
|
+
padding: "0 8px",
|
|
2683
|
+
border: "none",
|
|
2684
|
+
borderRadius: "4px",
|
|
2685
|
+
backgroundColor: showWarnings ? "#fff3cd" : "#ffffff",
|
|
2686
|
+
color: "#946200",
|
|
2687
|
+
cursor: "pointer",
|
|
2688
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
2689
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
|
|
2690
|
+
fontSize: "12px",
|
|
2691
|
+
fontWeight: 600
|
|
2692
|
+
},
|
|
2693
|
+
children: [
|
|
2694
|
+
/* @__PURE__ */ jsxs7(
|
|
2695
|
+
"svg",
|
|
2696
|
+
{
|
|
2697
|
+
width: "16",
|
|
2698
|
+
height: "16",
|
|
2699
|
+
viewBox: "0 0 24 24",
|
|
2700
|
+
fill: "none",
|
|
2701
|
+
stroke: "currentColor",
|
|
2702
|
+
strokeWidth: "2",
|
|
2703
|
+
strokeLinecap: "round",
|
|
2704
|
+
strokeLinejoin: "round",
|
|
2705
|
+
"aria-hidden": "true",
|
|
2706
|
+
children: [
|
|
2707
|
+
/* @__PURE__ */ jsx9("path", { d: "M10.3 3.9 1.8 18.1A2 2 0 0 0 3.5 21h17a2 2 0 0 0 1.7-2.9L13.7 3.9a2 2 0 0 0-3.4 0Z" }),
|
|
2708
|
+
/* @__PURE__ */ jsx9("path", { d: "M12 9v4m0 4h.01" })
|
|
2709
|
+
]
|
|
2710
|
+
}
|
|
2711
|
+
),
|
|
2712
|
+
/* @__PURE__ */ jsx9("span", { children: count })
|
|
2713
|
+
]
|
|
2714
|
+
}
|
|
2715
|
+
);
|
|
2716
|
+
};
|
|
2717
|
+
|
|
2492
2718
|
// lib/components/ViewMenu.tsx
|
|
2493
2719
|
import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
|
|
2494
2720
|
import { su as su3 } from "@tscircuit/soup-util";
|
|
@@ -2497,7 +2723,7 @@ import { useMemo as useMemo5 } from "react";
|
|
|
2497
2723
|
// package.json
|
|
2498
2724
|
var package_default = {
|
|
2499
2725
|
name: "@tscircuit/schematic-viewer",
|
|
2500
|
-
version: "2.0.
|
|
2726
|
+
version: "2.0.92",
|
|
2501
2727
|
repository: {
|
|
2502
2728
|
type: "git",
|
|
2503
2729
|
url: "https://github.com/tscircuit/schematic-viewer"
|
|
@@ -2532,13 +2758,15 @@ var package_default = {
|
|
|
2532
2758
|
semver: "^7.7.2",
|
|
2533
2759
|
tscircuit: "^0.0.2460",
|
|
2534
2760
|
tsup: "^8.3.5",
|
|
2535
|
-
vite: "^6.0.3"
|
|
2761
|
+
vite: "^6.0.3",
|
|
2762
|
+
"@tscircuit/circuit-json-schematic-placement-analysis": "https://codeload.github.com/tscircuit/circuit-json-schematic-placement-analysis/tar.gz/refs/heads/main"
|
|
2536
2763
|
},
|
|
2537
2764
|
peerDependencies: {
|
|
2538
2765
|
typescript: "^5.0.0",
|
|
2539
2766
|
tscircuit: "*"
|
|
2540
2767
|
},
|
|
2541
2768
|
dependencies: {
|
|
2769
|
+
"@radix-ui/react-dialog": "^1.1.23",
|
|
2542
2770
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
2543
2771
|
"@tscircuit/circuit-json-util": "^0.0.108",
|
|
2544
2772
|
"circuit-json": "^0.0.479",
|
|
@@ -2551,7 +2779,7 @@ var package_default = {
|
|
|
2551
2779
|
};
|
|
2552
2780
|
|
|
2553
2781
|
// lib/components/ViewMenu.tsx
|
|
2554
|
-
import { jsx as
|
|
2782
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2555
2783
|
var FONT_FAMILY2 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
2556
2784
|
var contentStyles2 = {
|
|
2557
2785
|
backgroundColor: "#262626",
|
|
@@ -2600,7 +2828,7 @@ var HIGHLIGHT_CSS = `
|
|
|
2600
2828
|
.sv-vm-item:hover:not([data-disabled]) { background-color: #404040; }
|
|
2601
2829
|
.sv-vm-item[data-disabled] { opacity: 0.45; cursor: not-allowed; }
|
|
2602
2830
|
`;
|
|
2603
|
-
var CheckIcon2 = () => /* @__PURE__ */
|
|
2831
|
+
var CheckIcon2 = () => /* @__PURE__ */ jsx10(
|
|
2604
2832
|
"svg",
|
|
2605
2833
|
{
|
|
2606
2834
|
width: "14",
|
|
@@ -2612,7 +2840,7 @@ var CheckIcon2 = () => /* @__PURE__ */ jsx8(
|
|
|
2612
2840
|
strokeLinecap: "round",
|
|
2613
2841
|
strokeLinejoin: "round",
|
|
2614
2842
|
"aria-hidden": "true",
|
|
2615
|
-
children: /* @__PURE__ */
|
|
2843
|
+
children: /* @__PURE__ */ jsx10("path", { d: "M20 6 9 17l-5-5" })
|
|
2616
2844
|
}
|
|
2617
2845
|
);
|
|
2618
2846
|
var ViewMenu = ({
|
|
@@ -2621,6 +2849,7 @@ var ViewMenu = ({
|
|
|
2621
2849
|
menuRef,
|
|
2622
2850
|
menuPos,
|
|
2623
2851
|
onOpenChange,
|
|
2852
|
+
onRunStyleAnalysis,
|
|
2624
2853
|
showGroups,
|
|
2625
2854
|
onToggleGroups,
|
|
2626
2855
|
showGrid,
|
|
@@ -2663,7 +2892,7 @@ var ViewMenu = ({
|
|
|
2663
2892
|
return false;
|
|
2664
2893
|
}
|
|
2665
2894
|
}, [circuitJsonKey]);
|
|
2666
|
-
return /* @__PURE__ */
|
|
2895
|
+
return /* @__PURE__ */ jsx10(
|
|
2667
2896
|
"div",
|
|
2668
2897
|
{
|
|
2669
2898
|
ref: menuRef,
|
|
@@ -2674,9 +2903,9 @@ var ViewMenu = ({
|
|
|
2674
2903
|
width: 0,
|
|
2675
2904
|
height: 0
|
|
2676
2905
|
},
|
|
2677
|
-
children: /* @__PURE__ */
|
|
2678
|
-
/* @__PURE__ */
|
|
2679
|
-
/* @__PURE__ */
|
|
2906
|
+
children: /* @__PURE__ */ jsxs8(DropdownMenu2.Root, { open: true, onOpenChange, modal: false, children: [
|
|
2907
|
+
/* @__PURE__ */ jsx10(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx10("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
|
|
2908
|
+
/* @__PURE__ */ jsx10(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs8(
|
|
2680
2909
|
DropdownMenu2.Content,
|
|
2681
2910
|
{
|
|
2682
2911
|
style: contentStyles2,
|
|
@@ -2685,8 +2914,8 @@ var ViewMenu = ({
|
|
|
2685
2914
|
collisionPadding: 10,
|
|
2686
2915
|
avoidCollisions: true,
|
|
2687
2916
|
children: [
|
|
2688
|
-
/* @__PURE__ */
|
|
2689
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ jsx10("style", { children: HIGHLIGHT_CSS }),
|
|
2918
|
+
/* @__PURE__ */ jsxs8(
|
|
2690
2919
|
DropdownMenu2.Item,
|
|
2691
2920
|
{
|
|
2692
2921
|
className: "sv-vm-item",
|
|
@@ -2699,12 +2928,12 @@ var ViewMenu = ({
|
|
|
2699
2928
|
if (hasPorts) onTogglePorts(!showPorts);
|
|
2700
2929
|
},
|
|
2701
2930
|
children: [
|
|
2702
|
-
/* @__PURE__ */
|
|
2703
|
-
/* @__PURE__ */
|
|
2931
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: showPorts && /* @__PURE__ */ jsx10(CheckIcon2, {}) }),
|
|
2932
|
+
/* @__PURE__ */ jsx10("span", { children: "Show Schematic Ports" })
|
|
2704
2933
|
]
|
|
2705
2934
|
}
|
|
2706
2935
|
),
|
|
2707
|
-
/* @__PURE__ */
|
|
2936
|
+
/* @__PURE__ */ jsxs8(
|
|
2708
2937
|
DropdownMenu2.Item,
|
|
2709
2938
|
{
|
|
2710
2939
|
className: "sv-vm-item",
|
|
@@ -2717,12 +2946,12 @@ var ViewMenu = ({
|
|
|
2717
2946
|
if (hasGroups) onToggleGroups(!showGroups);
|
|
2718
2947
|
},
|
|
2719
2948
|
children: [
|
|
2720
|
-
/* @__PURE__ */
|
|
2721
|
-
/* @__PURE__ */
|
|
2949
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: showGroups && /* @__PURE__ */ jsx10(CheckIcon2, {}) }),
|
|
2950
|
+
/* @__PURE__ */ jsx10("span", { children: "View Schematic Groups" })
|
|
2722
2951
|
]
|
|
2723
2952
|
}
|
|
2724
2953
|
),
|
|
2725
|
-
/* @__PURE__ */
|
|
2954
|
+
/* @__PURE__ */ jsxs8(
|
|
2726
2955
|
DropdownMenu2.Item,
|
|
2727
2956
|
{
|
|
2728
2957
|
className: "sv-vm-item",
|
|
@@ -2733,12 +2962,12 @@ var ViewMenu = ({
|
|
|
2733
2962
|
onToggleGrid(!showGrid);
|
|
2734
2963
|
},
|
|
2735
2964
|
children: [
|
|
2736
|
-
/* @__PURE__ */
|
|
2737
|
-
/* @__PURE__ */
|
|
2965
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: showGrid && /* @__PURE__ */ jsx10(CheckIcon2, {}) }),
|
|
2966
|
+
/* @__PURE__ */ jsx10("span", { children: "Show Grid" })
|
|
2738
2967
|
]
|
|
2739
2968
|
}
|
|
2740
2969
|
),
|
|
2741
|
-
/* @__PURE__ */
|
|
2970
|
+
/* @__PURE__ */ jsxs8(
|
|
2742
2971
|
DropdownMenu2.CheckboxItem,
|
|
2743
2972
|
{
|
|
2744
2973
|
className: "sv-vm-item",
|
|
@@ -2747,13 +2976,26 @@ var ViewMenu = ({
|
|
|
2747
2976
|
onCheckedChange: onToggleWarnings,
|
|
2748
2977
|
onSelect: (event) => event.preventDefault(),
|
|
2749
2978
|
children: [
|
|
2750
|
-
/* @__PURE__ */
|
|
2751
|
-
/* @__PURE__ */
|
|
2979
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: /* @__PURE__ */ jsx10(DropdownMenu2.ItemIndicator, { children: /* @__PURE__ */ jsx10(CheckIcon2, {}) }) }),
|
|
2980
|
+
/* @__PURE__ */ jsx10("span", { children: "Show Warnings" })
|
|
2752
2981
|
]
|
|
2753
2982
|
}
|
|
2754
2983
|
),
|
|
2755
|
-
/* @__PURE__ */
|
|
2756
|
-
/* @__PURE__ */
|
|
2984
|
+
/* @__PURE__ */ jsx10(DropdownMenu2.Separator, { style: separatorStyles }),
|
|
2985
|
+
/* @__PURE__ */ jsxs8(
|
|
2986
|
+
DropdownMenu2.Item,
|
|
2987
|
+
{
|
|
2988
|
+
className: "sv-vm-item",
|
|
2989
|
+
style: itemStyles2,
|
|
2990
|
+
onSelect: onRunStyleAnalysis,
|
|
2991
|
+
children: [
|
|
2992
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2 }),
|
|
2993
|
+
/* @__PURE__ */ jsx10("span", { children: "Run Style Analysis" })
|
|
2994
|
+
]
|
|
2995
|
+
}
|
|
2996
|
+
),
|
|
2997
|
+
/* @__PURE__ */ jsx10(DropdownMenu2.Separator, { style: separatorStyles }),
|
|
2998
|
+
/* @__PURE__ */ jsxs8(
|
|
2757
2999
|
"div",
|
|
2758
3000
|
{
|
|
2759
3001
|
style: {
|
|
@@ -2779,7 +3021,7 @@ var ViewMenu = ({
|
|
|
2779
3021
|
};
|
|
2780
3022
|
|
|
2781
3023
|
// lib/components/SchematicViewer.tsx
|
|
2782
|
-
import { jsx as
|
|
3024
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2783
3025
|
var SchematicViewer = ({
|
|
2784
3026
|
circuitJson,
|
|
2785
3027
|
containerStyle,
|
|
@@ -2817,7 +3059,7 @@ var SchematicViewer = ({
|
|
|
2817
3059
|
}, [circuitJsonKey]);
|
|
2818
3060
|
const hasMultipleSheets = schematicSheets.length > 1;
|
|
2819
3061
|
const defaultSheetId = schematicSheets[0]?.schematic_sheet_id;
|
|
2820
|
-
const [selectedSheetId, setSelectedSheetId] =
|
|
3062
|
+
const [selectedSheetId, setSelectedSheetId] = useState9(
|
|
2821
3063
|
() => {
|
|
2822
3064
|
const stored = getStoredString(STORAGE_KEYS.SELECTED_SCHEMATIC_SHEET);
|
|
2823
3065
|
if (stored && schematicSheets.some((s) => s.schematic_sheet_id === stored)) {
|
|
@@ -2826,7 +3068,7 @@ var SchematicViewer = ({
|
|
|
2826
3068
|
return defaultSheetId;
|
|
2827
3069
|
}
|
|
2828
3070
|
);
|
|
2829
|
-
|
|
3071
|
+
useEffect12(() => {
|
|
2830
3072
|
const stillExists = selectedSheetId !== void 0 && schematicSheets.some((s) => s.schematic_sheet_id === selectedSheetId);
|
|
2831
3073
|
if (!stillExists) {
|
|
2832
3074
|
setSelectedSheetId(defaultSheetId);
|
|
@@ -2841,27 +3083,31 @@ var SchematicViewer = ({
|
|
|
2841
3083
|
},
|
|
2842
3084
|
[onSchematicSheetChange]
|
|
2843
3085
|
);
|
|
2844
|
-
const [showGridInternal, setShowGridInternal] =
|
|
2845
|
-
const [
|
|
3086
|
+
const [showGridInternal, setShowGridInternal] = useState9(false);
|
|
3087
|
+
const [analysisCircuitJson, setAnalysisCircuitJson] = useState9(null);
|
|
3088
|
+
const [showWarnings, setShowWarnings] = useState9(false);
|
|
3089
|
+
const warningCount = circuitJson.filter(
|
|
3090
|
+
(element) => element.type.startsWith("schematic_") && element.type.endsWith("_warning")
|
|
3091
|
+
).length;
|
|
2846
3092
|
const showGrid = debugGrid || showGridInternal;
|
|
2847
|
-
const [isInteractionEnabled, setIsInteractionEnabled] =
|
|
3093
|
+
const [isInteractionEnabled, setIsInteractionEnabled] = useState9(
|
|
2848
3094
|
!clickToInteractEnabled
|
|
2849
3095
|
);
|
|
2850
|
-
const [showSchematicGroups, setShowSchematicGroups] =
|
|
3096
|
+
const [showSchematicGroups, setShowSchematicGroups] = useState9(() => {
|
|
2851
3097
|
if (disableGroups) return false;
|
|
2852
3098
|
return getStoredBoolean(STORAGE_KEYS.IS_SHOWING_SCHEMATIC_GROUPS, false);
|
|
2853
3099
|
});
|
|
2854
|
-
const [showSchematicPortsInternal, setShowSchematicPortsInternal] =
|
|
3100
|
+
const [showSchematicPortsInternal, setShowSchematicPortsInternal] = useState9(
|
|
2855
3101
|
() => showSchematicPorts ?? getStoredBoolean(STORAGE_KEYS.IS_SHOWING_SCHEMATIC_PORTS, false)
|
|
2856
3102
|
);
|
|
2857
|
-
|
|
3103
|
+
useEffect12(() => {
|
|
2858
3104
|
if (showSchematicPorts !== void 0) {
|
|
2859
3105
|
setShowSchematicPortsInternal(showSchematicPorts);
|
|
2860
3106
|
}
|
|
2861
3107
|
}, [showSchematicPorts]);
|
|
2862
|
-
const [isHoveringClickableComponent, setIsHoveringClickableComponent] =
|
|
3108
|
+
const [isHoveringClickableComponent, setIsHoveringClickableComponent] = useState9(false);
|
|
2863
3109
|
const hoveringComponentsRef = useRef8(/* @__PURE__ */ new Set());
|
|
2864
|
-
const [selectedSchematicComponent, setSelectedSchematicComponent] =
|
|
3110
|
+
const [selectedSchematicComponent, setSelectedSchematicComponent] = useState9(null);
|
|
2865
3111
|
const handleComponentHoverChange = useCallback7(
|
|
2866
3112
|
(componentId, isHovering) => {
|
|
2867
3113
|
if (isHovering) {
|
|
@@ -2873,7 +3119,7 @@ var SchematicViewer = ({
|
|
|
2873
3119
|
},
|
|
2874
3120
|
[]
|
|
2875
3121
|
);
|
|
2876
|
-
const [isHoveringClickablePort, setIsHoveringClickablePort] =
|
|
3122
|
+
const [isHoveringClickablePort, setIsHoveringClickablePort] = useState9(false);
|
|
2877
3123
|
const hoveringPortsRef = useRef8(/* @__PURE__ */ new Set());
|
|
2878
3124
|
const handlePortHoverChange = useCallback7(
|
|
2879
3125
|
(portId, isHovering) => {
|
|
@@ -2942,7 +3188,9 @@ var SchematicViewer = ({
|
|
|
2942
3188
|
};
|
|
2943
3189
|
const shouldPanSchematic = useCallback7(
|
|
2944
3190
|
(event) => {
|
|
2945
|
-
if (event.target instanceof Element && event.target.closest(
|
|
3191
|
+
if (event.target instanceof Element && event.target.closest(
|
|
3192
|
+
"[data-schematic-search], [data-schematic-warnings]"
|
|
3193
|
+
)) {
|
|
2946
3194
|
return false;
|
|
2947
3195
|
}
|
|
2948
3196
|
if (event.type !== "mousedown" || !("button" in event)) return true;
|
|
@@ -3023,10 +3271,10 @@ var SchematicViewer = ({
|
|
|
3023
3271
|
},
|
|
3024
3272
|
[containerRef, onSchematicComponentClicked]
|
|
3025
3273
|
);
|
|
3026
|
-
|
|
3274
|
+
useEffect12(() => {
|
|
3027
3275
|
setSelectedSchematicComponent(null);
|
|
3028
3276
|
}, [circuitJsonKey, activeSheetId]);
|
|
3029
|
-
|
|
3277
|
+
useEffect12(() => {
|
|
3030
3278
|
if (!selectedSchematicComponent) return;
|
|
3031
3279
|
const handleKeyDown = (event) => {
|
|
3032
3280
|
if (event.key === "Escape") {
|
|
@@ -3109,7 +3357,7 @@ var SchematicViewer = ({
|
|
|
3109
3357
|
enabled: netHoverHighlightEnabled
|
|
3110
3358
|
});
|
|
3111
3359
|
const svgDiv = useMemo6(
|
|
3112
|
-
() => /* @__PURE__ */
|
|
3360
|
+
() => /* @__PURE__ */ jsx11(
|
|
3113
3361
|
"div",
|
|
3114
3362
|
{
|
|
3115
3363
|
ref: svgDivRef,
|
|
@@ -3123,10 +3371,10 @@ var SchematicViewer = ({
|
|
|
3123
3371
|
),
|
|
3124
3372
|
[svgString, isInteractionEnabled, clickToInteractEnabled]
|
|
3125
3373
|
);
|
|
3126
|
-
return /* @__PURE__ */
|
|
3127
|
-
netHoverHighlightEnabled && /* @__PURE__ */
|
|
3374
|
+
return /* @__PURE__ */ jsxs9(MouseTracker, { children: [
|
|
3375
|
+
netHoverHighlightEnabled && /* @__PURE__ */ jsx11("style", { children: `.sch-net-faded { opacity: 0.35; }
|
|
3128
3376
|
svg :is(g.trace, g.trace-overlays, g[data-schematic-component-id], [data-schematic-net-label-id]) { transition: opacity 0.12s ease-in-out; }` }),
|
|
3129
|
-
searchEnabled && /* @__PURE__ */
|
|
3377
|
+
searchEnabled && /* @__PURE__ */ jsx11("style", { children: `.schematic-search-match text,
|
|
3130
3378
|
text.schematic-search-match {
|
|
3131
3379
|
fill: #ff00d4 !important;
|
|
3132
3380
|
}
|
|
@@ -3142,9 +3390,9 @@ var SchematicViewer = ({
|
|
|
3142
3390
|
flex-direction: column;
|
|
3143
3391
|
}
|
|
3144
3392
|
}` }),
|
|
3145
|
-
/* @__PURE__ */
|
|
3146
|
-
onSchematicPortClicked && /* @__PURE__ */
|
|
3147
|
-
/* @__PURE__ */
|
|
3393
|
+
/* @__PURE__ */ jsx11("style", { children: ".schematic-component-clickable [data-schematic-component-id]:hover { cursor: pointer !important; }" }),
|
|
3394
|
+
onSchematicPortClicked && /* @__PURE__ */ jsx11("style", { children: "[data-schematic-port-id]:hover { cursor: pointer !important; }" }),
|
|
3395
|
+
/* @__PURE__ */ jsxs9(
|
|
3148
3396
|
"div",
|
|
3149
3397
|
{
|
|
3150
3398
|
ref: containerRef,
|
|
@@ -3179,7 +3427,7 @@ var SchematicViewer = ({
|
|
|
3179
3427
|
},
|
|
3180
3428
|
onTouchCancel: contextMenuEventHandlers.onTouchCancel,
|
|
3181
3429
|
children: [
|
|
3182
|
-
!isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */
|
|
3430
|
+
!isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */ jsx11(
|
|
3183
3431
|
"div",
|
|
3184
3432
|
{
|
|
3185
3433
|
onClick: (e) => {
|
|
@@ -3198,7 +3446,7 @@ var SchematicViewer = ({
|
|
|
3198
3446
|
pointerEvents: "all",
|
|
3199
3447
|
touchAction: "pan-x pan-y pinch-zoom"
|
|
3200
3448
|
},
|
|
3201
|
-
children: /* @__PURE__ */
|
|
3449
|
+
children: /* @__PURE__ */ jsx11(
|
|
3202
3450
|
"div",
|
|
3203
3451
|
{
|
|
3204
3452
|
style: {
|
|
@@ -3215,7 +3463,14 @@ var SchematicViewer = ({
|
|
|
3215
3463
|
)
|
|
3216
3464
|
}
|
|
3217
3465
|
),
|
|
3218
|
-
|
|
3466
|
+
analysisCircuitJson && /* @__PURE__ */ jsx11(
|
|
3467
|
+
StyleAnalysisDialog,
|
|
3468
|
+
{
|
|
3469
|
+
circuitJson: analysisCircuitJson,
|
|
3470
|
+
onClose: () => setAnalysisCircuitJson(null)
|
|
3471
|
+
}
|
|
3472
|
+
),
|
|
3473
|
+
menuVisible && /* @__PURE__ */ jsx11(
|
|
3219
3474
|
ViewMenu,
|
|
3220
3475
|
{
|
|
3221
3476
|
circuitJson,
|
|
@@ -3223,6 +3478,10 @@ var SchematicViewer = ({
|
|
|
3223
3478
|
menuRef,
|
|
3224
3479
|
menuPos,
|
|
3225
3480
|
onOpenChange: setMenuVisible,
|
|
3481
|
+
onRunStyleAnalysis: () => {
|
|
3482
|
+
setMenuVisible(false);
|
|
3483
|
+
setAnalysisCircuitJson(structuredClone(circuitJson));
|
|
3484
|
+
},
|
|
3226
3485
|
showPorts: showSchematicPortsInternal,
|
|
3227
3486
|
onTogglePorts: (value) => {
|
|
3228
3487
|
setShowSchematicPortsInternal(value);
|
|
@@ -3244,7 +3503,7 @@ var SchematicViewer = ({
|
|
|
3244
3503
|
onToggleGrid: setShowGridInternal
|
|
3245
3504
|
}
|
|
3246
3505
|
),
|
|
3247
|
-
/* @__PURE__ */
|
|
3506
|
+
/* @__PURE__ */ jsxs9(
|
|
3248
3507
|
"div",
|
|
3249
3508
|
{
|
|
3250
3509
|
className: "schematic-viewer-toolbar",
|
|
@@ -3258,7 +3517,7 @@ var SchematicViewer = ({
|
|
|
3258
3517
|
zIndex: zIndexMap.schematicSearch
|
|
3259
3518
|
},
|
|
3260
3519
|
children: [
|
|
3261
|
-
/* @__PURE__ */
|
|
3520
|
+
/* @__PURE__ */ jsx11(
|
|
3262
3521
|
SchematicSheetSelector,
|
|
3263
3522
|
{
|
|
3264
3523
|
sheets: schematicSheets,
|
|
@@ -3266,7 +3525,7 @@ var SchematicViewer = ({
|
|
|
3266
3525
|
onSelectSheet: handleSelectSheet
|
|
3267
3526
|
}
|
|
3268
3527
|
),
|
|
3269
|
-
searchEnabled && /* @__PURE__ */
|
|
3528
|
+
searchEnabled && /* @__PURE__ */ jsx11(
|
|
3270
3529
|
SchematicSearch,
|
|
3271
3530
|
{
|
|
3272
3531
|
query: searchQuery,
|
|
@@ -3276,11 +3535,19 @@ var SchematicViewer = ({
|
|
|
3276
3535
|
onSelect: handleSearchResultSelect,
|
|
3277
3536
|
viewerContainerRef: containerRef
|
|
3278
3537
|
}
|
|
3538
|
+
),
|
|
3539
|
+
warningCount > 0 && /* @__PURE__ */ jsx11(
|
|
3540
|
+
SchematicWarningsButton,
|
|
3541
|
+
{
|
|
3542
|
+
count: warningCount,
|
|
3543
|
+
showWarnings,
|
|
3544
|
+
onToggle: () => setShowWarnings((show) => !show)
|
|
3545
|
+
}
|
|
3279
3546
|
)
|
|
3280
3547
|
]
|
|
3281
3548
|
}
|
|
3282
3549
|
),
|
|
3283
|
-
schematicComponentIds.map((componentId) => /* @__PURE__ */
|
|
3550
|
+
schematicComponentIds.map((componentId) => /* @__PURE__ */ jsx11(
|
|
3284
3551
|
SchematicComponentMouseTarget,
|
|
3285
3552
|
{
|
|
3286
3553
|
componentId,
|
|
@@ -3294,7 +3561,7 @@ var SchematicViewer = ({
|
|
|
3294
3561
|
componentId
|
|
3295
3562
|
)),
|
|
3296
3563
|
svgDiv,
|
|
3297
|
-
selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */
|
|
3564
|
+
selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */ jsx11(
|
|
3298
3565
|
SchematicComponentDetailsTooltip,
|
|
3299
3566
|
{
|
|
3300
3567
|
sourceComponent: selectedComponentDetails.sourceComponent,
|
|
@@ -3304,7 +3571,7 @@ var SchematicViewer = ({
|
|
|
3304
3571
|
...componentTooltipLayout
|
|
3305
3572
|
}
|
|
3306
3573
|
),
|
|
3307
|
-
showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */
|
|
3574
|
+
showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */ jsx11(
|
|
3308
3575
|
SchematicPortMouseTarget,
|
|
3309
3576
|
{
|
|
3310
3577
|
portId,
|
|
@@ -3334,7 +3601,7 @@ import {
|
|
|
3334
3601
|
convertCircuitJsonToSchematicSimulationSvg,
|
|
3335
3602
|
convertCircuitJsonToSimulationGraphSvg
|
|
3336
3603
|
} from "circuit-to-svg";
|
|
3337
|
-
import { useEffect as
|
|
3604
|
+
import { useEffect as useEffect13, useMemo as useMemo7, useRef as useRef9, useState as useState11 } from "react";
|
|
3338
3605
|
import { toString as transformToString2 } from "transformation-matrix";
|
|
3339
3606
|
import { useMouseMatrixTransform as useMouseMatrixTransform2 } from "use-mouse-matrix-transform";
|
|
3340
3607
|
|
|
@@ -3352,8 +3619,8 @@ var getAnalogSimulationBackgroundColor = (simulationSvg, colorOverrides) => getR
|
|
|
3352
3619
|
|
|
3353
3620
|
// lib/components/AnalogSimulationSelector.tsx
|
|
3354
3621
|
import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
|
|
3355
|
-
import { useState as
|
|
3356
|
-
import { Fragment as
|
|
3622
|
+
import { useState as useState10 } from "react";
|
|
3623
|
+
import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3357
3624
|
var FONT_FAMILY3 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
3358
3625
|
var contentStyles3 = {
|
|
3359
3626
|
backgroundColor: "#ffffff",
|
|
@@ -3403,7 +3670,7 @@ var MENU_CSS2 = `
|
|
|
3403
3670
|
.sv-simulation-chevron { transition: transform 0.2s ease; }
|
|
3404
3671
|
[data-state="open"] > .sv-simulation-chevron { transform: rotate(180deg); }
|
|
3405
3672
|
`;
|
|
3406
|
-
var CheckIcon3 = () => /* @__PURE__ */
|
|
3673
|
+
var CheckIcon3 = () => /* @__PURE__ */ jsx12(
|
|
3407
3674
|
"svg",
|
|
3408
3675
|
{
|
|
3409
3676
|
width: "14",
|
|
@@ -3415,10 +3682,10 @@ var CheckIcon3 = () => /* @__PURE__ */ jsx10(
|
|
|
3415
3682
|
strokeLinecap: "round",
|
|
3416
3683
|
strokeLinejoin: "round",
|
|
3417
3684
|
"aria-hidden": "true",
|
|
3418
|
-
children: /* @__PURE__ */
|
|
3685
|
+
children: /* @__PURE__ */ jsx12("path", { d: "M20 6 9 17l-5-5" })
|
|
3419
3686
|
}
|
|
3420
3687
|
);
|
|
3421
|
-
var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */
|
|
3688
|
+
var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx12(
|
|
3422
3689
|
"svg",
|
|
3423
3690
|
{
|
|
3424
3691
|
className,
|
|
@@ -3432,7 +3699,7 @@ var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx10(
|
|
|
3432
3699
|
strokeLinejoin: "round",
|
|
3433
3700
|
style: { opacity: 0.6, flexShrink: 0 },
|
|
3434
3701
|
"aria-hidden": "true",
|
|
3435
|
-
children: /* @__PURE__ */
|
|
3702
|
+
children: /* @__PURE__ */ jsx12("path", { d: "m6 9 6 6 6-6" })
|
|
3436
3703
|
}
|
|
3437
3704
|
);
|
|
3438
3705
|
var getSimulationLabels = (simulations) => {
|
|
@@ -3451,17 +3718,17 @@ var AnalogSimulationSelector = ({
|
|
|
3451
3718
|
selectedSimulationExperimentId,
|
|
3452
3719
|
onSelectSimulation
|
|
3453
3720
|
}) => {
|
|
3454
|
-
const [open, setOpen] =
|
|
3721
|
+
const [open, setOpen] = useState10(false);
|
|
3455
3722
|
if (simulations.length <= 1) return null;
|
|
3456
3723
|
const simulationLabels = getSimulationLabels(simulations);
|
|
3457
3724
|
const selectedSimulation = simulationLabels.find(
|
|
3458
3725
|
({ simulation }) => simulation.simulation_experiment_id === selectedSimulationExperimentId
|
|
3459
3726
|
);
|
|
3460
3727
|
const selectedLabel = selectedSimulation?.label ?? "Select simulation";
|
|
3461
|
-
return /* @__PURE__ */
|
|
3462
|
-
/* @__PURE__ */
|
|
3463
|
-
/* @__PURE__ */
|
|
3464
|
-
/* @__PURE__ */
|
|
3728
|
+
return /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
3729
|
+
/* @__PURE__ */ jsx12("style", { children: MENU_CSS2 }),
|
|
3730
|
+
/* @__PURE__ */ jsxs10(DropdownMenu3.Root, { open, onOpenChange: setOpen, modal: false, children: [
|
|
3731
|
+
/* @__PURE__ */ jsx12(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
|
|
3465
3732
|
"button",
|
|
3466
3733
|
{
|
|
3467
3734
|
type: "button",
|
|
@@ -3488,13 +3755,13 @@ var AnalogSimulationSelector = ({
|
|
|
3488
3755
|
zIndex: zIndexMap.viewMenuIcon
|
|
3489
3756
|
},
|
|
3490
3757
|
children: [
|
|
3491
|
-
/* @__PURE__ */
|
|
3492
|
-
/* @__PURE__ */
|
|
3493
|
-
/* @__PURE__ */
|
|
3758
|
+
/* @__PURE__ */ jsx12("span", { style: { color: "#888888", flexShrink: 0 }, children: "Simulation:" }),
|
|
3759
|
+
/* @__PURE__ */ jsx12("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: selectedLabel }),
|
|
3760
|
+
/* @__PURE__ */ jsx12(ChevronDownIcon2, { className: "sv-simulation-chevron" })
|
|
3494
3761
|
]
|
|
3495
3762
|
}
|
|
3496
3763
|
) }),
|
|
3497
|
-
/* @__PURE__ */
|
|
3764
|
+
/* @__PURE__ */ jsx12(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx12(
|
|
3498
3765
|
DropdownMenu3.Content,
|
|
3499
3766
|
{
|
|
3500
3767
|
style: contentStyles3,
|
|
@@ -3504,7 +3771,7 @@ var AnalogSimulationSelector = ({
|
|
|
3504
3771
|
collisionPadding: 10,
|
|
3505
3772
|
children: simulationLabels.map(({ simulation, label }) => {
|
|
3506
3773
|
const selected = simulation.simulation_experiment_id === selectedSimulationExperimentId;
|
|
3507
|
-
return /* @__PURE__ */
|
|
3774
|
+
return /* @__PURE__ */ jsxs10(
|
|
3508
3775
|
DropdownMenu3.Item,
|
|
3509
3776
|
{
|
|
3510
3777
|
className: "sv-simulation-item",
|
|
@@ -3516,8 +3783,8 @@ var AnalogSimulationSelector = ({
|
|
|
3516
3783
|
setOpen(false);
|
|
3517
3784
|
},
|
|
3518
3785
|
children: [
|
|
3519
|
-
/* @__PURE__ */
|
|
3520
|
-
/* @__PURE__ */
|
|
3786
|
+
/* @__PURE__ */ jsx12("span", { style: iconSlotStyles3, children: selected && /* @__PURE__ */ jsx12(CheckIcon3, {}) }),
|
|
3787
|
+
/* @__PURE__ */ jsx12("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: label })
|
|
3521
3788
|
]
|
|
3522
3789
|
},
|
|
3523
3790
|
simulation.simulation_experiment_id
|
|
@@ -3530,7 +3797,7 @@ var AnalogSimulationSelector = ({
|
|
|
3530
3797
|
};
|
|
3531
3798
|
|
|
3532
3799
|
// lib/components/AnalogSimulationViewer.tsx
|
|
3533
|
-
import { jsx as
|
|
3800
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3534
3801
|
var DEFAULT_RENDER_WIDTH = 1200;
|
|
3535
3802
|
var DEFAULT_COMBINED_RENDER_ASPECT_RATIO = 1;
|
|
3536
3803
|
var DEFAULT_GRAPH_ONLY_RENDER_ASPECT_RATIO = 2;
|
|
@@ -3545,16 +3812,16 @@ var AnalogSimulationViewer = ({
|
|
|
3545
3812
|
onSimulationChange,
|
|
3546
3813
|
acSweepView = "magnitude"
|
|
3547
3814
|
}) => {
|
|
3548
|
-
const [circuitJson, setCircuitJson] =
|
|
3549
|
-
const [isLoading, setIsLoading] =
|
|
3550
|
-
const [error, setError] =
|
|
3551
|
-
const [svgObjectUrl, setSvgObjectUrl] =
|
|
3815
|
+
const [circuitJson, setCircuitJson] = useState11(null);
|
|
3816
|
+
const [isLoading, setIsLoading] = useState11(true);
|
|
3817
|
+
const [error, setError] = useState11(null);
|
|
3818
|
+
const [svgObjectUrl, setSvgObjectUrl] = useState11(null);
|
|
3552
3819
|
const containerRef = useRef9(null);
|
|
3553
3820
|
const imgRef = useRef9(null);
|
|
3554
3821
|
const { containerWidth } = useResizeHandling(
|
|
3555
3822
|
containerRef
|
|
3556
3823
|
);
|
|
3557
|
-
const [isDragging, setIsDragging] =
|
|
3824
|
+
const [isDragging, setIsDragging] = useState11(false);
|
|
3558
3825
|
const {
|
|
3559
3826
|
ref: transformRef,
|
|
3560
3827
|
cancelDrag: _cancelDrag,
|
|
@@ -3570,7 +3837,7 @@ var AnalogSimulationViewer = ({
|
|
|
3570
3837
|
const renderAspectRatio = width && height ? width / height : defaultRenderAspectRatio;
|
|
3571
3838
|
const effectiveWidth = width || (height ? height * renderAspectRatio : containerWidth) || DEFAULT_RENDER_WIDTH;
|
|
3572
3839
|
const effectiveHeight = height || effectiveWidth / renderAspectRatio;
|
|
3573
|
-
|
|
3840
|
+
useEffect13(() => {
|
|
3574
3841
|
setIsLoading(true);
|
|
3575
3842
|
setError(null);
|
|
3576
3843
|
setCircuitJson(inputCircuitJson);
|
|
@@ -3582,11 +3849,11 @@ var AnalogSimulationViewer = ({
|
|
|
3582
3849
|
(element) => element.type === "simulation_experiment"
|
|
3583
3850
|
);
|
|
3584
3851
|
}, [circuitJson]);
|
|
3585
|
-
const [selectedSimulationExperimentId, setSelectedSimulationExperimentId] =
|
|
3852
|
+
const [selectedSimulationExperimentId, setSelectedSimulationExperimentId] = useState11(null);
|
|
3586
3853
|
const simulationExperimentId = (selectedSimulationExperimentId && simulationExperiments.some(
|
|
3587
3854
|
(simulation) => simulation.simulation_experiment_id === selectedSimulationExperimentId
|
|
3588
3855
|
) ? selectedSimulationExperimentId : simulationExperiments[0]?.simulation_experiment_id) ?? null;
|
|
3589
|
-
|
|
3856
|
+
useEffect13(() => {
|
|
3590
3857
|
if (simulationExperimentId !== selectedSimulationExperimentId) {
|
|
3591
3858
|
setSelectedSimulationExperimentId(simulationExperimentId);
|
|
3592
3859
|
}
|
|
@@ -3623,7 +3890,7 @@ var AnalogSimulationViewer = ({
|
|
|
3623
3890
|
simulationExperimentId,
|
|
3624
3891
|
acSweepView
|
|
3625
3892
|
]);
|
|
3626
|
-
|
|
3893
|
+
useEffect13(() => {
|
|
3627
3894
|
if (!simulationSvg) {
|
|
3628
3895
|
setSvgObjectUrl(null);
|
|
3629
3896
|
return;
|
|
@@ -3649,7 +3916,7 @@ var AnalogSimulationViewer = ({
|
|
|
3649
3916
|
const handleTouchStart = (_e) => {
|
|
3650
3917
|
setIsDragging(true);
|
|
3651
3918
|
};
|
|
3652
|
-
|
|
3919
|
+
useEffect13(() => {
|
|
3653
3920
|
const handleMouseUp = () => {
|
|
3654
3921
|
setIsDragging(false);
|
|
3655
3922
|
};
|
|
@@ -3664,7 +3931,7 @@ var AnalogSimulationViewer = ({
|
|
|
3664
3931
|
};
|
|
3665
3932
|
}, []);
|
|
3666
3933
|
if (isLoading) {
|
|
3667
|
-
return /* @__PURE__ */
|
|
3934
|
+
return /* @__PURE__ */ jsx13(
|
|
3668
3935
|
"div",
|
|
3669
3936
|
{
|
|
3670
3937
|
style: {
|
|
@@ -3684,7 +3951,7 @@ var AnalogSimulationViewer = ({
|
|
|
3684
3951
|
);
|
|
3685
3952
|
}
|
|
3686
3953
|
if (error) {
|
|
3687
|
-
return /* @__PURE__ */
|
|
3954
|
+
return /* @__PURE__ */ jsx13(
|
|
3688
3955
|
"div",
|
|
3689
3956
|
{
|
|
3690
3957
|
style: {
|
|
@@ -3699,15 +3966,15 @@ var AnalogSimulationViewer = ({
|
|
|
3699
3966
|
...containerStyle
|
|
3700
3967
|
},
|
|
3701
3968
|
className,
|
|
3702
|
-
children: /* @__PURE__ */
|
|
3703
|
-
/* @__PURE__ */
|
|
3704
|
-
/* @__PURE__ */
|
|
3969
|
+
children: /* @__PURE__ */ jsxs11("div", { style: { textAlign: "center", padding: "20px" }, children: [
|
|
3970
|
+
/* @__PURE__ */ jsx13("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "Circuit Conversion Error" }),
|
|
3971
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: "14px" }, children: error })
|
|
3705
3972
|
] })
|
|
3706
3973
|
}
|
|
3707
3974
|
);
|
|
3708
3975
|
}
|
|
3709
3976
|
if (!simulationSvg) {
|
|
3710
|
-
return /* @__PURE__ */
|
|
3977
|
+
return /* @__PURE__ */ jsxs11(
|
|
3711
3978
|
"div",
|
|
3712
3979
|
{
|
|
3713
3980
|
style: {
|
|
@@ -3723,11 +3990,11 @@ var AnalogSimulationViewer = ({
|
|
|
3723
3990
|
},
|
|
3724
3991
|
className,
|
|
3725
3992
|
children: [
|
|
3726
|
-
/* @__PURE__ */
|
|
3727
|
-
/* @__PURE__ */
|
|
3993
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: "16px", color: "#475569", fontWeight: 500 }, children: "No Simulation Found" }),
|
|
3994
|
+
/* @__PURE__ */ jsxs11("div", { style: { fontSize: "14px", color: "#64748b" }, children: [
|
|
3728
3995
|
"Use",
|
|
3729
3996
|
" ",
|
|
3730
|
-
/* @__PURE__ */
|
|
3997
|
+
/* @__PURE__ */ jsx13(
|
|
3731
3998
|
"code",
|
|
3732
3999
|
{
|
|
3733
4000
|
style: {
|
|
@@ -3747,7 +4014,7 @@ var AnalogSimulationViewer = ({
|
|
|
3747
4014
|
}
|
|
3748
4015
|
);
|
|
3749
4016
|
}
|
|
3750
|
-
return /* @__PURE__ */
|
|
4017
|
+
return /* @__PURE__ */ jsxs11(
|
|
3751
4018
|
"div",
|
|
3752
4019
|
{
|
|
3753
4020
|
ref: (node) => {
|
|
@@ -3766,7 +4033,7 @@ var AnalogSimulationViewer = ({
|
|
|
3766
4033
|
onMouseDown: handleMouseDown,
|
|
3767
4034
|
onTouchStart: handleTouchStart,
|
|
3768
4035
|
children: [
|
|
3769
|
-
/* @__PURE__ */
|
|
4036
|
+
/* @__PURE__ */ jsx13(
|
|
3770
4037
|
AnalogSimulationSelector,
|
|
3771
4038
|
{
|
|
3772
4039
|
simulations: simulationExperiments,
|
|
@@ -3774,7 +4041,7 @@ var AnalogSimulationViewer = ({
|
|
|
3774
4041
|
onSelectSimulation: handleSelectSimulation
|
|
3775
4042
|
}
|
|
3776
4043
|
),
|
|
3777
|
-
svgObjectUrl ? /* @__PURE__ */
|
|
4044
|
+
svgObjectUrl ? /* @__PURE__ */ jsx13(
|
|
3778
4045
|
"img",
|
|
3779
4046
|
{
|
|
3780
4047
|
ref: imgRef,
|
|
@@ -3788,7 +4055,7 @@ var AnalogSimulationViewer = ({
|
|
|
3788
4055
|
objectFit: "contain"
|
|
3789
4056
|
}
|
|
3790
4057
|
}
|
|
3791
|
-
) : /* @__PURE__ */
|
|
4058
|
+
) : /* @__PURE__ */ jsx13(
|
|
3792
4059
|
"div",
|
|
3793
4060
|
{
|
|
3794
4061
|
style: {
|