@tscircuit/schematic-viewer 2.0.109 → 2.0.111

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
@@ -201,6 +201,7 @@ var zIndexMap = {
201
201
  viewMenuIcon: 48,
202
202
  clickToInteractOverlay: 100,
203
203
  schematicComponentDetailsTooltip: 105,
204
+ schematicElementHighlight: 46,
204
205
  schematicComponentHoverOutline: 47,
205
206
  schematicPortHoverOutline: 48,
206
207
  schematicSearch: 101
@@ -1283,7 +1284,7 @@ var enableDebug = () => {
1283
1284
  };
1284
1285
 
1285
1286
  // lib/components/SchematicViewer.tsx
1286
- import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo6, useRef as useRef9, useState as useState10 } from "react";
1287
+ import { useCallback as useCallback8, useEffect as useEffect15, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
1287
1288
  import { toString as transformToString } from "transformation-matrix";
1288
1289
  import { useMouseMatrixTransform } from "use-mouse-matrix-transform";
1289
1290
 
@@ -1514,6 +1515,11 @@ var getSourceComponentInfoEntries = (sourceComponent) => Object.entries(sourceCo
1514
1515
  label: key,
1515
1516
  value: formatComponentValue(sourceComponent, key, value)
1516
1517
  }));
1518
+ var getDatasheetChipName = (sourceComponent) => {
1519
+ if (sourceComponent.ftype !== "simple_chip") return null;
1520
+ const partNumber = sourceComponent.manufacturer_part_number;
1521
+ return typeof partNumber === "string" && partNumber.trim() ? partNumber.trim() : null;
1522
+ };
1517
1523
  var getSupplierPartNumberEntries = (sourceComponent) => {
1518
1524
  const supplierPartNumbers = sourceComponent.supplier_part_numbers;
1519
1525
  if (!supplierPartNumbers) return [];
@@ -1822,9 +1828,89 @@ var MouseTrackerProvider = ({ children }) => {
1822
1828
  // lib/components/SchematicComponentDetailsTooltip.tsx
1823
1829
  import { useMemo as useMemo3 } from "react";
1824
1830
 
1825
- // lib/components/JlcPartAvailability.tsx
1831
+ // lib/components/DatasheetDescription.tsx
1826
1832
  import { useEffect as useEffect8, useState as useState5 } from "react";
1827
1833
 
1834
+ // lib/utils/datasheet-description.ts
1835
+ var fetchDatasheetDescription = async (chipName, signal, platformFetch = fetch) => {
1836
+ const response = await platformFetch(
1837
+ `https://api.tscircuit.com/datasheets/get?chip_name=${encodeURIComponent(chipName)}`,
1838
+ { signal }
1839
+ );
1840
+ if (!response.ok) throw new Error("Datasheet lookup failed");
1841
+ const data = await response.json();
1842
+ const description = data?.datasheet?.ai_description;
1843
+ return typeof description === "string" && description.trim() ? description.trim() : null;
1844
+ };
1845
+
1846
+ // lib/components/DatasheetDescription.tsx
1847
+ import { jsx as jsx3 } from "react/jsx-runtime";
1848
+ var COLLAPSED_DESCRIPTION_LENGTH = 100;
1849
+ var DatasheetDescription = ({
1850
+ chipName,
1851
+ platformConfig
1852
+ }) => {
1853
+ const [description, setDescription] = useState5(null);
1854
+ const [loading, setLoading] = useState5(true);
1855
+ const [expanded, setExpanded] = useState5(false);
1856
+ const platformFetch = platformConfig?.platformFetch;
1857
+ useEffect8(() => {
1858
+ const controller = new AbortController();
1859
+ let active = true;
1860
+ setLoading(true);
1861
+ setDescription(null);
1862
+ setExpanded(false);
1863
+ const timeout = setTimeout(() => {
1864
+ controller.abort();
1865
+ if (active) setLoading(false);
1866
+ }, 1e4);
1867
+ Promise.resolve().then(
1868
+ () => fetchDatasheetDescription(chipName, controller.signal, platformFetch)
1869
+ ).then((result) => {
1870
+ if (active) setDescription(result);
1871
+ }).catch(() => {
1872
+ }).finally(() => {
1873
+ clearTimeout(timeout);
1874
+ if (active) setLoading(false);
1875
+ });
1876
+ return () => {
1877
+ active = false;
1878
+ clearTimeout(timeout);
1879
+ controller.abort();
1880
+ };
1881
+ }, [chipName, platformFetch]);
1882
+ const isCollapsed = !expanded && description !== null && description.length > COLLAPSED_DESCRIPTION_LENGTH;
1883
+ return /* @__PURE__ */ jsx3(
1884
+ "span",
1885
+ {
1886
+ role: "status",
1887
+ "aria-label": `${chipName} description`,
1888
+ "aria-busy": loading,
1889
+ style: loading ? { color: "#64748b" } : void 0,
1890
+ children: loading ? "Loading\u2026" : description && isCollapsed ? /* @__PURE__ */ jsx3(
1891
+ "span",
1892
+ {
1893
+ role: "button",
1894
+ tabIndex: 0,
1895
+ "aria-expanded": false,
1896
+ title: "Show full description",
1897
+ style: { cursor: "pointer" },
1898
+ onClick: () => setExpanded(true),
1899
+ onKeyDown: (event) => {
1900
+ if (event.key !== "Enter" && event.key !== " ") return;
1901
+ event.preventDefault();
1902
+ setExpanded(true);
1903
+ },
1904
+ children: `${description.slice(0, COLLAPSED_DESCRIPTION_LENGTH).trimEnd()}...`
1905
+ }
1906
+ ) : description ?? "-"
1907
+ }
1908
+ );
1909
+ };
1910
+
1911
+ // lib/components/JlcPartAvailability.tsx
1912
+ import { useEffect as useEffect9, useState as useState6 } from "react";
1913
+
1828
1914
  // lib/utils/jlc-part-availability.ts
1829
1915
  var nonNegativeNumber = (value) => {
1830
1916
  if (typeof value !== "number" && typeof value !== "string") return null;
@@ -1872,7 +1958,7 @@ var fetchJlcPartAvailability = async (partNumber, signal, platformFetch = fetch)
1872
1958
  };
1873
1959
 
1874
1960
  // lib/components/JlcPartAvailability.tsx
1875
- import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
1961
+ import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
1876
1962
  var formatPrice = (availability) => {
1877
1963
  if (availability?.price == null) return "Price unavailable";
1878
1964
  const options = { minimumFractionDigits: 2, maximumFractionDigits: 6 };
@@ -1889,11 +1975,11 @@ var JlcPartAvailability = ({
1889
1975
  partNumber,
1890
1976
  platformConfig
1891
1977
  }) => {
1892
- const [result, setResult] = useState5(null);
1893
- const [loading, setLoading] = useState5(true);
1978
+ const [result, setResult] = useState6(null);
1979
+ const [loading, setLoading] = useState6(true);
1894
1980
  const partsEngine = platformConfig?.partsEngine;
1895
1981
  const platformFetch = platformConfig?.platformFetch;
1896
- useEffect8(() => {
1982
+ useEffect9(() => {
1897
1983
  const controller = new AbortController();
1898
1984
  let active = true;
1899
1985
  setLoading(true);
@@ -1929,7 +2015,7 @@ var JlcPartAvailability = ({
1929
2015
  controller.abort();
1930
2016
  };
1931
2017
  }, [partNumber, partsEngine, platformFetch]);
1932
- return /* @__PURE__ */ jsx3(
2018
+ return /* @__PURE__ */ jsx4(
1933
2019
  "span",
1934
2020
  {
1935
2021
  role: "status",
@@ -1937,7 +2023,7 @@ var JlcPartAvailability = ({
1937
2023
  "aria-busy": loading,
1938
2024
  style: { display: "block", color: "#64748b", marginTop: "2px" },
1939
2025
  children: loading ? /* @__PURE__ */ jsxs2("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
1940
- /* @__PURE__ */ jsx3("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx3(
2026
+ /* @__PURE__ */ jsx4("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(
1941
2027
  "circle",
1942
2028
  {
1943
2029
  cx: "6",
@@ -1947,7 +2033,7 @@ var JlcPartAvailability = ({
1947
2033
  stroke: "currentColor",
1948
2034
  strokeWidth: "2",
1949
2035
  strokeDasharray: "18 8",
1950
- children: /* @__PURE__ */ jsx3(
2036
+ children: /* @__PURE__ */ jsx4(
1951
2037
  "animateTransform",
1952
2038
  {
1953
2039
  attributeName: "transform",
@@ -1962,15 +2048,15 @@ var JlcPartAvailability = ({
1962
2048
  ) }),
1963
2049
  "Loading price and stock\u2026"
1964
2050
  ] }) : /* @__PURE__ */ jsxs2(Fragment3, { children: [
1965
- /* @__PURE__ */ jsx3("span", { style: { display: "block" }, children: formatPrice(result) }),
1966
- /* @__PURE__ */ jsx3("span", { style: { display: "block" }, children: result?.stock != null ? `${result.stock.toLocaleString("en-US")} in stock` : "Stock unavailable" })
2051
+ /* @__PURE__ */ jsx4("span", { style: { display: "block" }, children: formatPrice(result) }),
2052
+ /* @__PURE__ */ jsx4("span", { style: { display: "block" }, children: result?.stock != null ? `${result.stock.toLocaleString("en-US")} in stock` : "Stock unavailable" })
1967
2053
  ] })
1968
2054
  }
1969
2055
  );
1970
2056
  };
1971
2057
 
1972
2058
  // lib/components/SchematicComponentDetailsTooltip.tsx
1973
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
2059
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1974
2060
  var detailLabelStyle = {
1975
2061
  color: "#64748b",
1976
2062
  fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',
@@ -1994,6 +2080,10 @@ var SchematicComponentDetailsTooltip = ({
1994
2080
  () => getSourceComponentInfoEntries(sourceComponent),
1995
2081
  [sourceComponent]
1996
2082
  );
2083
+ const datasheetChipName = useMemo3(
2084
+ () => getDatasheetChipName(sourceComponent),
2085
+ [sourceComponent]
2086
+ );
1997
2087
  const supplierPartNumberEntries = useMemo3(
1998
2088
  () => getSupplierPartNumberEntries(sourceComponent),
1999
2089
  [sourceComponent]
@@ -2052,8 +2142,8 @@ var SchematicComponentDetailsTooltip = ({
2052
2142
  },
2053
2143
  children: [
2054
2144
  infoEntries.map((entry) => /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
2055
- /* @__PURE__ */ jsx4("dt", { style: detailLabelStyle, children: entry.label }),
2056
- /* @__PURE__ */ jsx4(
2145
+ /* @__PURE__ */ jsx5("dt", { style: detailLabelStyle, children: entry.label }),
2146
+ /* @__PURE__ */ jsx5(
2057
2147
  "dd",
2058
2148
  {
2059
2149
  style: {
@@ -2069,9 +2159,34 @@ var SchematicComponentDetailsTooltip = ({
2069
2159
  }
2070
2160
  )
2071
2161
  ] }, entry.key)),
2162
+ datasheetChipName && /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
2163
+ /* @__PURE__ */ jsx5("dt", { style: detailLabelStyle, children: "description" }),
2164
+ /* @__PURE__ */ jsx5(
2165
+ "dd",
2166
+ {
2167
+ style: {
2168
+ minWidth: 0,
2169
+ margin: 0,
2170
+ color: "#1e293b",
2171
+ fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',
2172
+ fontSize: "12px",
2173
+ lineHeight: 1.45,
2174
+ overflowWrap: "anywhere"
2175
+ },
2176
+ children: /* @__PURE__ */ jsx5(
2177
+ DatasheetDescription,
2178
+ {
2179
+ chipName: datasheetChipName,
2180
+ platformConfig
2181
+ },
2182
+ datasheetChipName
2183
+ )
2184
+ }
2185
+ )
2186
+ ] }),
2072
2187
  supplierPartNumberEntries.map((entry) => /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
2073
- /* @__PURE__ */ jsx4("dt", { style: detailLabelStyle, children: entry.label }),
2074
- /* @__PURE__ */ jsx4(
2188
+ /* @__PURE__ */ jsx5("dt", { style: detailLabelStyle, children: entry.label }),
2189
+ /* @__PURE__ */ jsx5(
2075
2190
  "dd",
2076
2191
  {
2077
2192
  style: {
@@ -2088,7 +2203,7 @@ var SchematicComponentDetailsTooltip = ({
2088
2203
  style: entry.label === "jlcpcb" ? { display: "block", marginTop: index > 0 ? 6 : 0 } : void 0,
2089
2204
  children: [
2090
2205
  entry.label !== "jlcpcb" && index > 0 && ", ",
2091
- /* @__PURE__ */ jsx4(
2206
+ /* @__PURE__ */ jsx5(
2092
2207
  "a",
2093
2208
  {
2094
2209
  href: link.href,
@@ -2098,7 +2213,7 @@ var SchematicComponentDetailsTooltip = ({
2098
2213
  children: link.partNumber
2099
2214
  }
2100
2215
  ),
2101
- entry.label === "jlcpcb" && /* @__PURE__ */ jsx4(
2216
+ entry.label === "jlcpcb" && /* @__PURE__ */ jsx5(
2102
2217
  JlcPartAvailability,
2103
2218
  {
2104
2219
  partNumber: link.partNumber,
@@ -2114,8 +2229,8 @@ var SchematicComponentDetailsTooltip = ({
2114
2229
  )
2115
2230
  ] }, entry.key)),
2116
2231
  footprinterString && /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
2117
- /* @__PURE__ */ jsx4("dt", { style: detailLabelStyle, children: "footprint" }),
2118
- /* @__PURE__ */ jsx4(
2232
+ /* @__PURE__ */ jsx5("dt", { style: detailLabelStyle, children: "footprint" }),
2233
+ /* @__PURE__ */ jsx5(
2119
2234
  "dd",
2120
2235
  {
2121
2236
  style: {
@@ -2155,11 +2270,11 @@ var SchematicComponentDetailsTooltip = ({
2155
2270
  warnings.length,
2156
2271
  ")"
2157
2272
  ] }),
2158
- /* @__PURE__ */ jsx4("ul", { style: { margin: "4px 0 0", paddingLeft: "18px" }, children: warnings.map((warning, index) => /* @__PURE__ */ jsx4("li", { children: warning.message }, `${warning.type}-${index}`)) })
2273
+ /* @__PURE__ */ jsx5("ul", { style: { margin: "4px 0 0", paddingLeft: "18px" }, children: warnings.map((warning, index) => /* @__PURE__ */ jsx5("li", { children: warning.message }, `${warning.type}-${index}`)) })
2159
2274
  ]
2160
2275
  }
2161
2276
  ),
2162
- footprintPreviewUrl && /* @__PURE__ */ jsx4("div", { style: { padding: "0 4px 4px" }, children: /* @__PURE__ */ jsx4(
2277
+ footprintPreviewUrl && /* @__PURE__ */ jsx5("div", { style: { padding: "0 4px 4px" }, children: /* @__PURE__ */ jsx5(
2163
2278
  "div",
2164
2279
  {
2165
2280
  style: {
@@ -2169,7 +2284,7 @@ var SchematicComponentDetailsTooltip = ({
2169
2284
  borderRadius: "2px",
2170
2285
  background: "#f8fafc"
2171
2286
  },
2172
- children: /* @__PURE__ */ jsx4(
2287
+ children: /* @__PURE__ */ jsx5(
2173
2288
  "img",
2174
2289
  {
2175
2290
  src: footprintPreviewUrl,
@@ -2192,12 +2307,12 @@ var SchematicComponentDetailsTooltip = ({
2192
2307
  };
2193
2308
 
2194
2309
  // lib/components/SchematicComponentMouseTarget.tsx
2195
- import { useCallback as useCallback5, useEffect as useEffect10, useRef as useRef6, useState as useState6 } from "react";
2310
+ import { useCallback as useCallback6, useEffect as useEffect12 } from "react";
2196
2311
 
2197
2312
  // lib/hooks/useMouseEventsOverBoundingBox.ts
2198
2313
  import {
2199
2314
  useContext as useContext2,
2200
- useEffect as useEffect9,
2315
+ useEffect as useEffect10,
2201
2316
  useId,
2202
2317
  useMemo as useMemo4,
2203
2318
  useRef as useRef5,
@@ -2219,7 +2334,7 @@ var useMouseEventsOverBoundingBox = (options) => {
2219
2334
  },
2220
2335
  []
2221
2336
  );
2222
- useEffect9(() => {
2337
+ useEffect10(() => {
2223
2338
  context.registerBoundingBox(id, {
2224
2339
  bounds: latestOptionsRef.current.bounds,
2225
2340
  onClick: latestOptionsRef.current.onClick ? handleClick : void 0
@@ -2228,7 +2343,7 @@ var useMouseEventsOverBoundingBox = (options) => {
2228
2343
  context.unregisterBoundingBox(id);
2229
2344
  };
2230
2345
  }, [context, handleClick, id]);
2231
- useEffect9(() => {
2346
+ useEffect10(() => {
2232
2347
  context.updateBoundingBox(id, {
2233
2348
  bounds: latestOptionsRef.current.bounds,
2234
2349
  onClick: latestOptionsRef.current.onClick ? handleClick : void 0
@@ -2251,23 +2366,23 @@ var useMouseEventsOverBoundingBox = (options) => {
2251
2366
  return { hovering };
2252
2367
  };
2253
2368
 
2254
- // lib/components/SchematicComponentMouseTarget.tsx
2255
- import { jsx as jsx5 } from "react/jsx-runtime";
2369
+ // lib/hooks/useSvgElementMeasurement.ts
2370
+ import { useCallback as useCallback5, useEffect as useEffect11, useRef as useRef6, useState as useState7 } from "react";
2256
2371
  var areMeasurementsEqual = (a, b) => {
2257
2372
  if (!a && !b) return true;
2258
2373
  if (!a || !b) return false;
2259
2374
  return Math.abs(a.bounds.minX - b.bounds.minX) < 0.5 && Math.abs(a.bounds.maxX - b.bounds.maxX) < 0.5 && Math.abs(a.bounds.minY - b.bounds.minY) < 0.5 && Math.abs(a.bounds.maxY - b.bounds.maxY) < 0.5 && Math.abs(a.rect.left - b.rect.left) < 0.5 && Math.abs(a.rect.top - b.rect.top) < 0.5 && Math.abs(a.rect.width - b.rect.width) < 0.5 && Math.abs(a.rect.height - b.rect.height) < 0.5;
2260
2375
  };
2261
- var SchematicComponentMouseTarget = ({
2262
- componentId,
2376
+ var useSvgElementMeasurement = ({
2377
+ selector,
2263
2378
  svgDivRef,
2264
2379
  containerRef,
2265
- onComponentClick,
2266
- onHoverChange,
2267
- showOutline,
2268
- circuitJsonKey
2380
+ circuitJsonKey,
2381
+ padding = 0
2269
2382
  }) => {
2270
- const [measurement, setMeasurement] = useState6(null);
2383
+ const [measurement, setMeasurement] = useState7(
2384
+ null
2385
+ );
2271
2386
  const frameRef = useRef6(null);
2272
2387
  const measure = useCallback5(() => {
2273
2388
  frameRef.current = null;
@@ -2278,7 +2393,7 @@ var SchematicComponentMouseTarget = ({
2278
2393
  return;
2279
2394
  }
2280
2395
  const element = svgDiv.querySelector(
2281
- `[data-schematic-component-id="${componentId}"]`
2396
+ selector
2282
2397
  );
2283
2398
  if (!element) {
2284
2399
  setMeasurement((prev) => prev ? null : prev);
@@ -2288,30 +2403,30 @@ var SchematicComponentMouseTarget = ({
2288
2403
  const containerRect = container.getBoundingClientRect();
2289
2404
  const nextMeasurement = {
2290
2405
  bounds: {
2291
- minX: elementRect.left,
2292
- maxX: elementRect.right,
2293
- minY: elementRect.top,
2294
- maxY: elementRect.bottom
2406
+ minX: elementRect.left - padding,
2407
+ maxX: elementRect.right + padding,
2408
+ minY: elementRect.top - padding,
2409
+ maxY: elementRect.bottom + padding
2295
2410
  },
2296
2411
  rect: {
2297
- left: elementRect.left - containerRect.left,
2298
- top: elementRect.top - containerRect.top,
2299
- width: elementRect.width,
2300
- height: elementRect.height
2412
+ left: elementRect.left - containerRect.left - padding,
2413
+ top: elementRect.top - containerRect.top - padding,
2414
+ width: elementRect.width + padding * 2,
2415
+ height: elementRect.height + padding * 2
2301
2416
  }
2302
2417
  };
2303
2418
  setMeasurement(
2304
2419
  (prev) => areMeasurementsEqual(prev, nextMeasurement) ? prev : nextMeasurement
2305
2420
  );
2306
- }, [componentId, containerRef, svgDivRef]);
2421
+ }, [selector, padding, containerRef, svgDivRef]);
2307
2422
  const scheduleMeasure = useCallback5(() => {
2308
2423
  if (frameRef.current !== null) return;
2309
2424
  frameRef.current = window.requestAnimationFrame(measure);
2310
2425
  }, [measure]);
2311
- useEffect10(() => {
2426
+ useEffect11(() => {
2312
2427
  scheduleMeasure();
2313
2428
  }, [scheduleMeasure, circuitJsonKey]);
2314
- useEffect10(() => {
2429
+ useEffect11(() => {
2315
2430
  scheduleMeasure();
2316
2431
  const svgDiv = svgDivRef.current;
2317
2432
  const container = containerRef.current;
@@ -2343,7 +2458,27 @@ var SchematicComponentMouseTarget = ({
2343
2458
  }
2344
2459
  };
2345
2460
  }, [scheduleMeasure, svgDivRef, containerRef]);
2346
- const handleClick = useCallback5(
2461
+ return measurement;
2462
+ };
2463
+
2464
+ // lib/components/SchematicComponentMouseTarget.tsx
2465
+ import { jsx as jsx6 } from "react/jsx-runtime";
2466
+ var SchematicComponentMouseTarget = ({
2467
+ componentId,
2468
+ svgDivRef,
2469
+ containerRef,
2470
+ onComponentClick,
2471
+ onHoverChange,
2472
+ showOutline,
2473
+ circuitJsonKey
2474
+ }) => {
2475
+ const measurement = useSvgElementMeasurement({
2476
+ selector: `[data-schematic-component-id="${componentId}"]`,
2477
+ svgDivRef,
2478
+ containerRef,
2479
+ circuitJsonKey
2480
+ });
2481
+ const handleClick = useCallback6(
2347
2482
  (event) => {
2348
2483
  if (onComponentClick) {
2349
2484
  onComponentClick(componentId, event);
@@ -2356,7 +2491,7 @@ var SchematicComponentMouseTarget = ({
2356
2491
  bounds,
2357
2492
  onClick: onComponentClick ? handleClick : void 0
2358
2493
  });
2359
- useEffect10(() => {
2494
+ useEffect12(() => {
2360
2495
  if (onHoverChange) {
2361
2496
  onHoverChange(componentId, hovering);
2362
2497
  }
@@ -2365,7 +2500,7 @@ var SchematicComponentMouseTarget = ({
2365
2500
  return null;
2366
2501
  }
2367
2502
  const rect = measurement.rect;
2368
- return /* @__PURE__ */ jsx5(
2503
+ return /* @__PURE__ */ jsx6(
2369
2504
  "div",
2370
2505
  {
2371
2506
  style: {
@@ -2382,14 +2517,44 @@ var SchematicComponentMouseTarget = ({
2382
2517
  );
2383
2518
  };
2384
2519
 
2385
- // lib/components/SchematicPortMouseTarget.tsx
2386
- import { useCallback as useCallback6, useEffect as useEffect11, useRef as useRef7, useState as useState7 } from "react";
2387
- import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
2388
- var areMeasurementsEqual2 = (a, b) => {
2389
- if (!a && !b) return true;
2390
- if (!a || !b) return false;
2391
- return Math.abs(a.bounds.minX - b.bounds.minX) < 0.5 && Math.abs(a.bounds.maxX - b.bounds.maxX) < 0.5 && Math.abs(a.bounds.minY - b.bounds.minY) < 0.5 && Math.abs(a.bounds.maxY - b.bounds.maxY) < 0.5 && Math.abs(a.rect.left - b.rect.left) < 0.5 && Math.abs(a.rect.top - b.rect.top) < 0.5 && Math.abs(a.rect.width - b.rect.width) < 0.5 && Math.abs(a.rect.height - b.rect.height) < 0.5;
2520
+ // lib/components/SchematicElementHighlight.tsx
2521
+ import { jsx as jsx7 } from "react/jsx-runtime";
2522
+ var SchematicElementHighlight = ({
2523
+ selector,
2524
+ svgDivRef,
2525
+ containerRef,
2526
+ circuitJsonKey
2527
+ }) => {
2528
+ const measurement = useSvgElementMeasurement({
2529
+ selector,
2530
+ svgDivRef,
2531
+ containerRef,
2532
+ circuitJsonKey,
2533
+ padding: 4
2534
+ });
2535
+ if (!measurement) return null;
2536
+ return /* @__PURE__ */ jsx7(
2537
+ "div",
2538
+ {
2539
+ "data-schematic-element-highlight": true,
2540
+ style: {
2541
+ position: "absolute",
2542
+ left: measurement.rect.left,
2543
+ top: measurement.rect.top,
2544
+ width: measurement.rect.width,
2545
+ height: measurement.rect.height,
2546
+ border: "1.5px dashed #3b82f6",
2547
+ boxSizing: "border-box",
2548
+ pointerEvents: "none",
2549
+ zIndex: zIndexMap.schematicElementHighlight
2550
+ }
2551
+ }
2552
+ );
2392
2553
  };
2554
+
2555
+ // lib/components/SchematicPortMouseTarget.tsx
2556
+ import { useCallback as useCallback7, useEffect as useEffect13 } from "react";
2557
+ import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
2393
2558
  var SchematicPortMouseTarget = ({
2394
2559
  portId,
2395
2560
  portLabel,
@@ -2400,84 +2565,15 @@ var SchematicPortMouseTarget = ({
2400
2565
  showOutline,
2401
2566
  circuitJsonKey
2402
2567
  }) => {
2403
- const [measurement, setMeasurement] = useState7(null);
2404
- const frameRef = useRef7(null);
2405
- const measure = useCallback6(() => {
2406
- frameRef.current = null;
2407
- const svgDiv = svgDivRef.current;
2408
- const container = containerRef.current;
2409
- if (!svgDiv || !container) {
2410
- setMeasurement((prev) => prev ? null : prev);
2411
- return;
2412
- }
2413
- const element = svgDiv.querySelector(
2414
- `[data-schematic-port-id="${portId}"]`
2415
- );
2416
- if (!element) {
2417
- setMeasurement((prev) => prev ? null : prev);
2418
- return;
2419
- }
2420
- const elementRect = element.getBoundingClientRect();
2421
- const containerRect = container.getBoundingClientRect();
2422
- const padding = 4;
2423
- const nextMeasurement = {
2424
- bounds: {
2425
- minX: elementRect.left - padding,
2426
- maxX: elementRect.right + padding,
2427
- minY: elementRect.top - padding,
2428
- maxY: elementRect.bottom + padding
2429
- },
2430
- rect: {
2431
- left: elementRect.left - containerRect.left - padding,
2432
- top: elementRect.top - containerRect.top - padding,
2433
- width: elementRect.width + padding * 2,
2434
- height: elementRect.height + padding * 2
2435
- }
2436
- };
2437
- setMeasurement(
2438
- (prev) => areMeasurementsEqual2(prev, nextMeasurement) ? prev : nextMeasurement
2439
- );
2440
- }, [portId, containerRef, svgDivRef]);
2441
- const scheduleMeasure = useCallback6(() => {
2442
- if (frameRef.current !== null) return;
2443
- frameRef.current = window.requestAnimationFrame(measure);
2444
- }, [measure]);
2445
- useEffect11(() => {
2446
- scheduleMeasure();
2447
- }, [scheduleMeasure, circuitJsonKey]);
2448
- useEffect11(() => {
2449
- scheduleMeasure();
2450
- const svgDiv = svgDivRef.current;
2451
- const container = containerRef.current;
2452
- if (!svgDiv || !container) return;
2453
- const resizeObserver = typeof ResizeObserver !== "undefined" ? new ResizeObserver(() => {
2454
- scheduleMeasure();
2455
- }) : null;
2456
- resizeObserver?.observe(container);
2457
- resizeObserver?.observe(svgDiv);
2458
- const mutationObserver = typeof MutationObserver !== "undefined" ? new MutationObserver(() => {
2459
- scheduleMeasure();
2460
- }) : null;
2461
- mutationObserver?.observe(svgDiv, {
2462
- attributes: true,
2463
- attributeFilter: ["style", "transform"],
2464
- subtree: true,
2465
- childList: true
2466
- });
2467
- window.addEventListener("scroll", scheduleMeasure, true);
2468
- window.addEventListener("resize", scheduleMeasure);
2469
- return () => {
2470
- resizeObserver?.disconnect();
2471
- mutationObserver?.disconnect();
2472
- window.removeEventListener("scroll", scheduleMeasure, true);
2473
- window.removeEventListener("resize", scheduleMeasure);
2474
- if (frameRef.current !== null) {
2475
- cancelAnimationFrame(frameRef.current);
2476
- frameRef.current = null;
2477
- }
2478
- };
2479
- }, [scheduleMeasure, svgDivRef, containerRef]);
2480
- const handleClick = useCallback6(
2568
+ const measurement = useSvgElementMeasurement({
2569
+ selector: `[data-schematic-port-id="${portId}"]`,
2570
+ svgDivRef,
2571
+ containerRef,
2572
+ circuitJsonKey,
2573
+ // Add some padding around the port for easier interaction
2574
+ padding: 4
2575
+ });
2576
+ const handleClick = useCallback7(
2481
2577
  (event) => {
2482
2578
  if (onPortClick) {
2483
2579
  onPortClick(portId, event);
@@ -2490,7 +2586,7 @@ var SchematicPortMouseTarget = ({
2490
2586
  bounds,
2491
2587
  onClick: onPortClick ? handleClick : void 0
2492
2588
  });
2493
- useEffect11(() => {
2589
+ useEffect13(() => {
2494
2590
  if (onHoverChange) {
2495
2591
  onHoverChange(portId, hovering);
2496
2592
  }
@@ -2500,7 +2596,7 @@ var SchematicPortMouseTarget = ({
2500
2596
  }
2501
2597
  const rect = measurement.rect;
2502
2598
  return /* @__PURE__ */ jsxs4(Fragment4, { children: [
2503
- /* @__PURE__ */ jsx6(
2599
+ /* @__PURE__ */ jsx8(
2504
2600
  "div",
2505
2601
  {
2506
2602
  style: {
@@ -2518,7 +2614,7 @@ var SchematicPortMouseTarget = ({
2518
2614
  }
2519
2615
  }
2520
2616
  ),
2521
- hovering && portLabel && /* @__PURE__ */ jsx6(
2617
+ hovering && portLabel && /* @__PURE__ */ jsx8(
2522
2618
  "div",
2523
2619
  {
2524
2620
  style: {
@@ -2543,15 +2639,15 @@ var SchematicPortMouseTarget = ({
2543
2639
  };
2544
2640
 
2545
2641
  // lib/components/SchematicSearch.tsx
2546
- import { useEffect as useEffect12, useRef as useRef8, useState as useState8 } from "react";
2642
+ import { useEffect as useEffect14, useRef as useRef7, useState as useState8 } from "react";
2547
2643
 
2548
2644
  // lib/components/SchematicSearchIcons.tsx
2549
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
2645
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
2550
2646
  var Icon = ({
2551
2647
  children,
2552
2648
  size,
2553
2649
  strokeWidth
2554
- }) => /* @__PURE__ */ jsx7(
2650
+ }) => /* @__PURE__ */ jsx9(
2555
2651
  "svg",
2556
2652
  {
2557
2653
  width: size,
@@ -2567,30 +2663,30 @@ var Icon = ({
2567
2663
  }
2568
2664
  );
2569
2665
  var SearchIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
2570
- /* @__PURE__ */ jsx7("circle", { cx: "11", cy: "11", r: "8" }),
2571
- /* @__PURE__ */ jsx7("path", { d: "m21 21-4.34-4.34" })
2666
+ /* @__PURE__ */ jsx9("circle", { cx: "11", cy: "11", r: "8" }),
2667
+ /* @__PURE__ */ jsx9("path", { d: "m21 21-4.34-4.34" })
2572
2668
  ] });
2573
2669
  var CloseIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
2574
- /* @__PURE__ */ jsx7("path", { d: "M18 6 6 18" }),
2575
- /* @__PURE__ */ jsx7("path", { d: "m6 6 12 12" })
2670
+ /* @__PURE__ */ jsx9("path", { d: "M18 6 6 18" }),
2671
+ /* @__PURE__ */ jsx9("path", { d: "m6 6 12 12" })
2576
2672
  ] });
2577
2673
  var ComponentIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
2578
- /* @__PURE__ */ jsx7("rect", { x: "4", y: "4", width: "16", height: "16", rx: "2" }),
2579
- /* @__PURE__ */ jsx7("rect", { x: "8", y: "8", width: "8", height: "8", rx: "1" }),
2580
- /* @__PURE__ */ jsx7("path", { d: "M7 2v2M12 2v2M17 2v2M7 20v2M12 20v2M17 20v2M2 7h2M2 12h2M2 17h2M20 7h2M20 12h2M20 17h2" })
2674
+ /* @__PURE__ */ jsx9("rect", { x: "4", y: "4", width: "16", height: "16", rx: "2" }),
2675
+ /* @__PURE__ */ jsx9("rect", { x: "8", y: "8", width: "8", height: "8", rx: "1" }),
2676
+ /* @__PURE__ */ jsx9("path", { d: "M7 2v2M12 2v2M17 2v2M7 20v2M12 20v2M17 20v2M2 7h2M2 12h2M2 17h2M20 7h2M20 12h2M20 17h2" })
2581
2677
  ] });
2582
2678
  var NetIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
2583
- /* @__PURE__ */ jsx7("path", { d: "M15 6a9 9 0 0 0-9 9V3" }),
2584
- /* @__PURE__ */ jsx7("circle", { cx: "18", cy: "6", r: "3" }),
2585
- /* @__PURE__ */ jsx7("circle", { cx: "6", cy: "18", r: "3" })
2679
+ /* @__PURE__ */ jsx9("path", { d: "M15 6a9 9 0 0 0-9 9V3" }),
2680
+ /* @__PURE__ */ jsx9("circle", { cx: "18", cy: "6", r: "3" }),
2681
+ /* @__PURE__ */ jsx9("circle", { cx: "6", cy: "18", r: "3" })
2586
2682
  ] });
2587
2683
  var EnterIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
2588
- /* @__PURE__ */ jsx7("path", { d: "M20 4v7a4 4 0 0 1-4 4H4" }),
2589
- /* @__PURE__ */ jsx7("path", { d: "m9 10-5 5 5 5" })
2684
+ /* @__PURE__ */ jsx9("path", { d: "M20 4v7a4 4 0 0 1-4 4H4" }),
2685
+ /* @__PURE__ */ jsx9("path", { d: "m9 10-5 5 5 5" })
2590
2686
  ] });
2591
2687
 
2592
2688
  // lib/components/SchematicSearch.tsx
2593
- import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
2689
+ import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
2594
2690
  var HighlightedSearchText = ({
2595
2691
  text,
2596
2692
  query
@@ -2606,7 +2702,7 @@ var HighlightedSearchText = ({
2606
2702
  parts.push(text.slice(cursor, matchIndex));
2607
2703
  }
2608
2704
  parts.push(
2609
- /* @__PURE__ */ jsx8("strong", { style: { fontWeight: 700 }, children: text.slice(matchIndex, matchIndex + normalizedQuery.length) }, `${matchIndex}-${cursor}`)
2705
+ /* @__PURE__ */ jsx10("strong", { style: { fontWeight: 700 }, children: text.slice(matchIndex, matchIndex + normalizedQuery.length) }, `${matchIndex}-${cursor}`)
2610
2706
  );
2611
2707
  cursor = matchIndex + normalizedQuery.length;
2612
2708
  matchIndex = normalizedText.indexOf(normalizedQuery, cursor);
@@ -2631,10 +2727,10 @@ var SchematicSearch = ({
2631
2727
  const [isOpen, setIsOpen] = useState8(false);
2632
2728
  const [activeResultId, setActiveResultId] = useState8(null);
2633
2729
  const [hoveredResultId, setHoveredResultId] = useState8(null);
2634
- const inputRef = useRef8(null);
2635
- const resultsListRef = useRef8(null);
2730
+ const inputRef = useRef7(null);
2731
+ const resultsListRef = useRef7(null);
2636
2732
  const shortcutLabel = getShortcutLabel();
2637
- useEffect12(() => {
2733
+ useEffect14(() => {
2638
2734
  setActiveResultId((currentId) => {
2639
2735
  if (results.some((result) => result.target.id === currentId)) {
2640
2736
  return currentId;
@@ -2642,11 +2738,11 @@ var SchematicSearch = ({
2642
2738
  return results.find((result) => result.kind === "component")?.target.id ?? results[0]?.target.id ?? null;
2643
2739
  });
2644
2740
  }, [results]);
2645
- useEffect12(() => {
2741
+ useEffect14(() => {
2646
2742
  if (!activeResultId) return;
2647
2743
  resultsListRef.current?.querySelector(`[data-search-result-id="${activeResultId}"]`)?.scrollIntoView({ behavior: "smooth", block: "nearest" });
2648
2744
  }, [activeResultId]);
2649
- useEffect12(() => {
2745
+ useEffect14(() => {
2650
2746
  const handleSearchShortcut = (event) => {
2651
2747
  if (event.key === "Escape" && isOpen) {
2652
2748
  event.preventDefault();
@@ -2748,7 +2844,7 @@ var SchematicSearch = ({
2748
2844
  const renderResultSection = (title, sectionResults) => {
2749
2845
  if (sectionResults.length === 0) return null;
2750
2846
  return /* @__PURE__ */ jsxs6("section", { children: [
2751
- /* @__PURE__ */ jsx8(
2847
+ /* @__PURE__ */ jsx10(
2752
2848
  "div",
2753
2849
  {
2754
2850
  style: {
@@ -2768,9 +2864,9 @@ var SchematicSearch = ({
2768
2864
  const hovering = result.target.id === hoveredResultId;
2769
2865
  let resultBackground = "#ffffff";
2770
2866
  if (hovering || active) resultBackground = "#f1f3f5";
2771
- let resultIcon = /* @__PURE__ */ jsx8(NetIcon, { size: 15, strokeWidth: 1.8 });
2867
+ let resultIcon = /* @__PURE__ */ jsx10(NetIcon, { size: 15, strokeWidth: 1.8 });
2772
2868
  if (result.kind === "component") {
2773
- resultIcon = /* @__PURE__ */ jsx8(ComponentIcon, { size: 15, strokeWidth: 1.8 });
2869
+ resultIcon = /* @__PURE__ */ jsx10(ComponentIcon, { size: 15, strokeWidth: 1.8 });
2774
2870
  }
2775
2871
  const selectResult = () => {
2776
2872
  inputRef.current?.blur();
@@ -2803,7 +2899,7 @@ var SchematicSearch = ({
2803
2899
  textAlign: "left"
2804
2900
  },
2805
2901
  children: [
2806
- /* @__PURE__ */ jsx8(
2902
+ /* @__PURE__ */ jsx10(
2807
2903
  "span",
2808
2904
  {
2809
2905
  style: {
@@ -2821,7 +2917,7 @@ var SchematicSearch = ({
2821
2917
  }
2822
2918
  ),
2823
2919
  /* @__PURE__ */ jsxs6("span", { style: { minWidth: 0, flex: 1 }, children: [
2824
- /* @__PURE__ */ jsx8(
2920
+ /* @__PURE__ */ jsx10(
2825
2921
  "span",
2826
2922
  {
2827
2923
  style: {
@@ -2833,10 +2929,10 @@ var SchematicSearch = ({
2833
2929
  textOverflow: "ellipsis",
2834
2930
  whiteSpace: "nowrap"
2835
2931
  },
2836
- children: /* @__PURE__ */ jsx8(HighlightedSearchText, { text: result.label, query })
2932
+ children: /* @__PURE__ */ jsx10(HighlightedSearchText, { text: result.label, query })
2837
2933
  }
2838
2934
  ),
2839
- result.detail && /* @__PURE__ */ jsx8(
2935
+ result.detail && /* @__PURE__ */ jsx10(
2840
2936
  "span",
2841
2937
  {
2842
2938
  style: {
@@ -2872,7 +2968,7 @@ var SchematicSearch = ({
2872
2968
  }
2873
2969
  )
2874
2970
  ] }),
2875
- active && /* @__PURE__ */ jsx8(
2971
+ active && /* @__PURE__ */ jsx10(
2876
2972
  "span",
2877
2973
  {
2878
2974
  title: "Press Enter to open",
@@ -2882,7 +2978,7 @@ var SchematicSearch = ({
2882
2978
  fontSize: "17px",
2883
2979
  lineHeight: 1
2884
2980
  },
2885
- children: /* @__PURE__ */ jsx8(EnterIcon, { size: 14, strokeWidth: 1.8 })
2981
+ children: /* @__PURE__ */ jsx10(EnterIcon, { size: 14, strokeWidth: 1.8 })
2886
2982
  }
2887
2983
  )
2888
2984
  ]
@@ -2892,7 +2988,7 @@ var SchematicSearch = ({
2892
2988
  })
2893
2989
  ] });
2894
2990
  };
2895
- return /* @__PURE__ */ jsx8(
2991
+ return /* @__PURE__ */ jsx10(
2896
2992
  "div",
2897
2993
  {
2898
2994
  "data-schematic-search": true,
@@ -2905,7 +3001,7 @@ var SchematicSearch = ({
2905
3001
  zIndex: zIndexMap.schematicSearch,
2906
3002
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
2907
3003
  },
2908
- children: !isOpen ? /* @__PURE__ */ jsx8(
3004
+ children: !isOpen ? /* @__PURE__ */ jsx10(
2909
3005
  "button",
2910
3006
  {
2911
3007
  type: "button",
@@ -2936,7 +3032,7 @@ var SchematicSearch = ({
2936
3032
  cursor: "pointer",
2937
3033
  boxShadow: "0 2px 4px rgba(0,0,0,0.1)"
2938
3034
  },
2939
- children: /* @__PURE__ */ jsx8(SearchIcon, { size: 16, strokeWidth: 2 })
3035
+ children: /* @__PURE__ */ jsx10(SearchIcon, { size: 16, strokeWidth: 2 })
2940
3036
  }
2941
3037
  ) : /* @__PURE__ */ jsxs6(
2942
3038
  "div",
@@ -2964,8 +3060,8 @@ var SchematicSearch = ({
2964
3060
  borderBottom: searchHeaderBorder
2965
3061
  },
2966
3062
  children: [
2967
- /* @__PURE__ */ jsx8(SearchIcon, { size: 15, strokeWidth: 2 }),
2968
- /* @__PURE__ */ jsx8(
3063
+ /* @__PURE__ */ jsx10(SearchIcon, { size: 15, strokeWidth: 2 }),
3064
+ /* @__PURE__ */ jsx10(
2969
3065
  "input",
2970
3066
  {
2971
3067
  ref: inputRef,
@@ -2985,7 +3081,7 @@ var SchematicSearch = ({
2985
3081
  }
2986
3082
  }
2987
3083
  ),
2988
- query && results.length > 0 ? /* @__PURE__ */ jsx8(
3084
+ query && results.length > 0 ? /* @__PURE__ */ jsx10(
2989
3085
  "span",
2990
3086
  {
2991
3087
  style: {
@@ -2996,7 +3092,7 @@ var SchematicSearch = ({
2996
3092
  },
2997
3093
  children: resultCountLabel
2998
3094
  }
2999
- ) : /* @__PURE__ */ jsx8(
3095
+ ) : /* @__PURE__ */ jsx10(
3000
3096
  "kbd",
3001
3097
  {
3002
3098
  style: {
@@ -3013,7 +3109,7 @@ var SchematicSearch = ({
3013
3109
  children: shortcutLabel
3014
3110
  }
3015
3111
  ),
3016
- isOpen && /* @__PURE__ */ jsx8(
3112
+ isOpen && /* @__PURE__ */ jsx10(
3017
3113
  "button",
3018
3114
  {
3019
3115
  type: "button",
@@ -3036,13 +3132,13 @@ var SchematicSearch = ({
3036
3132
  padding: 0,
3037
3133
  lineHeight: 1
3038
3134
  },
3039
- children: /* @__PURE__ */ jsx8(CloseIcon, { size: 16, strokeWidth: 2 })
3135
+ children: /* @__PURE__ */ jsx10(CloseIcon, { size: 16, strokeWidth: 2 })
3040
3136
  }
3041
3137
  )
3042
3138
  ]
3043
3139
  }
3044
3140
  ),
3045
- query && /* @__PURE__ */ jsx8(
3141
+ query && /* @__PURE__ */ jsx10(
3046
3142
  "div",
3047
3143
  {
3048
3144
  ref: resultsListRef,
@@ -3057,7 +3153,7 @@ var SchematicSearch = ({
3057
3153
  },
3058
3154
  onWheel: (event) => event.stopPropagation(),
3059
3155
  onTouchMove: (event) => event.stopPropagation(),
3060
- children: results.length === 0 ? /* @__PURE__ */ jsx8(
3156
+ children: results.length === 0 ? /* @__PURE__ */ jsx10(
3061
3157
  "div",
3062
3158
  {
3063
3159
  style: {
@@ -3083,7 +3179,7 @@ var SchematicSearch = ({
3083
3179
  // lib/components/SchematicSheetSelector.tsx
3084
3180
  import { useState as useState9 } from "react";
3085
3181
  import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
3086
- import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
3182
+ import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
3087
3183
  var FONT_FAMILY = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
3088
3184
  var contentStyles = {
3089
3185
  backgroundColor: "#ffffff",
@@ -3133,7 +3229,7 @@ var MENU_CSS = `
3133
3229
  .sv-sheet-chevron { transition: transform 0.2s ease; }
3134
3230
  [data-state="open"] > .sv-sheet-chevron { transform: rotate(180deg); }
3135
3231
  `;
3136
- var CheckIcon = () => /* @__PURE__ */ jsx9(
3232
+ var CheckIcon = () => /* @__PURE__ */ jsx11(
3137
3233
  "svg",
3138
3234
  {
3139
3235
  width: "14",
@@ -3145,10 +3241,10 @@ var CheckIcon = () => /* @__PURE__ */ jsx9(
3145
3241
  strokeLinecap: "round",
3146
3242
  strokeLinejoin: "round",
3147
3243
  "aria-hidden": "true",
3148
- children: /* @__PURE__ */ jsx9("path", { d: "M20 6 9 17l-5-5" })
3244
+ children: /* @__PURE__ */ jsx11("path", { d: "M20 6 9 17l-5-5" })
3149
3245
  }
3150
3246
  );
3151
- var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx9(
3247
+ var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx11(
3152
3248
  "svg",
3153
3249
  {
3154
3250
  className,
@@ -3162,7 +3258,7 @@ var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx9(
3162
3258
  strokeLinejoin: "round",
3163
3259
  style: { opacity: 0.6, flexShrink: 0 },
3164
3260
  "aria-hidden": "true",
3165
- children: /* @__PURE__ */ jsx9("path", { d: "m6 9 6 6 6-6" })
3261
+ children: /* @__PURE__ */ jsx11("path", { d: "m6 9 6 6 6-6" })
3166
3262
  }
3167
3263
  );
3168
3264
  var SchematicSheetSelector = ({
@@ -3177,9 +3273,9 @@ var SchematicSheetSelector = ({
3177
3273
  );
3178
3274
  const selectedLabel = selectedSheet?.name ?? "Select sheet";
3179
3275
  return /* @__PURE__ */ jsxs7(Fragment6, { children: [
3180
- /* @__PURE__ */ jsx9("style", { children: MENU_CSS }),
3276
+ /* @__PURE__ */ jsx11("style", { children: MENU_CSS }),
3181
3277
  /* @__PURE__ */ jsxs7(DropdownMenu.Root, { open, onOpenChange: setOpen, modal: false, children: [
3182
- /* @__PURE__ */ jsx9(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs7(
3278
+ /* @__PURE__ */ jsx11(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs7(
3183
3279
  "button",
3184
3280
  {
3185
3281
  type: "button",
@@ -3204,13 +3300,13 @@ var SchematicSheetSelector = ({
3204
3300
  fontFamily: FONT_FAMILY
3205
3301
  },
3206
3302
  children: [
3207
- /* @__PURE__ */ jsx9("span", { style: { color: "#888888", flexShrink: 0 }, children: "Sheet:" }),
3208
- /* @__PURE__ */ jsx9("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: selectedLabel }),
3209
- /* @__PURE__ */ jsx9(ChevronDownIcon, { className: "sv-sheet-chevron" })
3303
+ /* @__PURE__ */ jsx11("span", { style: { color: "#888888", flexShrink: 0 }, children: "Sheet:" }),
3304
+ /* @__PURE__ */ jsx11("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: selectedLabel }),
3305
+ /* @__PURE__ */ jsx11(ChevronDownIcon, { className: "sv-sheet-chevron" })
3210
3306
  ]
3211
3307
  }
3212
3308
  ) }),
3213
- /* @__PURE__ */ jsx9(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx9(
3309
+ /* @__PURE__ */ jsx11(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx11(
3214
3310
  DropdownMenu.Content,
3215
3311
  {
3216
3312
  style: contentStyles,
@@ -3232,8 +3328,8 @@ var SchematicSheetSelector = ({
3232
3328
  setOpen(false);
3233
3329
  },
3234
3330
  children: [
3235
- /* @__PURE__ */ jsx9("span", { style: iconSlotStyles, children: selected && /* @__PURE__ */ jsx9(CheckIcon, {}) }),
3236
- /* @__PURE__ */ jsx9("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: sheet.name })
3331
+ /* @__PURE__ */ jsx11("span", { style: iconSlotStyles, children: selected && /* @__PURE__ */ jsx11(CheckIcon, {}) }),
3332
+ /* @__PURE__ */ jsx11("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: sheet.name })
3237
3333
  ]
3238
3334
  },
3239
3335
  sheet.schematic_sheet_id
@@ -3246,7 +3342,7 @@ var SchematicSheetSelector = ({
3246
3342
  };
3247
3343
 
3248
3344
  // lib/components/SchematicWarningsButton.tsx
3249
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
3345
+ import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
3250
3346
  var SchematicWarningsButton = ({
3251
3347
  count,
3252
3348
  showWarnings,
@@ -3296,12 +3392,12 @@ var SchematicWarningsButton = ({
3296
3392
  strokeLinejoin: "round",
3297
3393
  "aria-hidden": "true",
3298
3394
  children: [
3299
- /* @__PURE__ */ jsx10("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" }),
3300
- /* @__PURE__ */ jsx10("path", { d: "M12 9v4m0 4h.01" })
3395
+ /* @__PURE__ */ jsx12("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" }),
3396
+ /* @__PURE__ */ jsx12("path", { d: "M12 9v4m0 4h.01" })
3301
3397
  ]
3302
3398
  }
3303
3399
  ),
3304
- /* @__PURE__ */ jsx10("span", { children: count })
3400
+ /* @__PURE__ */ jsx12("span", { children: count })
3305
3401
  ]
3306
3402
  }
3307
3403
  );
@@ -3315,7 +3411,7 @@ import { useMemo as useMemo5 } from "react";
3315
3411
  // package.json
3316
3412
  var package_default = {
3317
3413
  name: "@tscircuit/schematic-viewer",
3318
- version: "2.0.108",
3414
+ version: "2.0.110",
3319
3415
  repository: {
3320
3416
  type: "git",
3321
3417
  url: "https://github.com/tscircuit/schematic-viewer"
@@ -3381,7 +3477,7 @@ var package_default = {
3381
3477
  };
3382
3478
 
3383
3479
  // lib/components/ViewMenu.tsx
3384
- import { Fragment as Fragment7, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
3480
+ import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
3385
3481
  var FONT_FAMILY2 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
3386
3482
  var contentStyles2 = {
3387
3483
  backgroundColor: "#262626",
@@ -3430,7 +3526,7 @@ var HIGHLIGHT_CSS = `
3430
3526
  .sv-vm-item:hover:not([data-disabled]) { background-color: #404040; }
3431
3527
  .sv-vm-item[data-disabled] { opacity: 0.45; cursor: not-allowed; }
3432
3528
  `;
3433
- var CheckIcon2 = () => /* @__PURE__ */ jsx11(
3529
+ var CheckIcon2 = () => /* @__PURE__ */ jsx13(
3434
3530
  "svg",
3435
3531
  {
3436
3532
  width: "14",
@@ -3442,7 +3538,7 @@ var CheckIcon2 = () => /* @__PURE__ */ jsx11(
3442
3538
  strokeLinecap: "round",
3443
3539
  strokeLinejoin: "round",
3444
3540
  "aria-hidden": "true",
3445
- children: /* @__PURE__ */ jsx11("path", { d: "M20 6 9 17l-5-5" })
3541
+ children: /* @__PURE__ */ jsx13("path", { d: "M20 6 9 17l-5-5" })
3446
3542
  }
3447
3543
  );
3448
3544
  var ViewMenu = ({
@@ -3500,7 +3596,7 @@ var ViewMenu = ({
3500
3596
  }
3501
3597
  }, [circuitJsonKey]);
3502
3598
  if (isComponentMenu && (!pcbComponent || !onViewPcbComponent)) return null;
3503
- return /* @__PURE__ */ jsx11(
3599
+ return /* @__PURE__ */ jsx13(
3504
3600
  "div",
3505
3601
  {
3506
3602
  ref: menuRef,
@@ -3512,8 +3608,8 @@ var ViewMenu = ({
3512
3608
  height: 0
3513
3609
  },
3514
3610
  children: /* @__PURE__ */ jsxs9(DropdownMenu2.Root, { open: true, onOpenChange, modal: false, children: [
3515
- /* @__PURE__ */ jsx11(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx11("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
3516
- /* @__PURE__ */ jsx11(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs9(
3611
+ /* @__PURE__ */ jsx13(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx13("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
3612
+ /* @__PURE__ */ jsx13(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs9(
3517
3613
  DropdownMenu2.Content,
3518
3614
  {
3519
3615
  style: contentStyles2,
@@ -3522,8 +3618,8 @@ var ViewMenu = ({
3522
3618
  collisionPadding: 10,
3523
3619
  avoidCollisions: true,
3524
3620
  children: [
3525
- /* @__PURE__ */ jsx11("style", { children: HIGHLIGHT_CSS }),
3526
- pcbComponent && onViewPcbComponent && /* @__PURE__ */ jsx11(Fragment7, { children: /* @__PURE__ */ jsxs9(
3621
+ /* @__PURE__ */ jsx13("style", { children: HIGHLIGHT_CSS }),
3622
+ pcbComponent && onViewPcbComponent && /* @__PURE__ */ jsx13(Fragment7, { children: /* @__PURE__ */ jsxs9(
3527
3623
  DropdownMenu2.Item,
3528
3624
  {
3529
3625
  className: "sv-vm-item",
@@ -3533,8 +3629,8 @@ var ViewMenu = ({
3533
3629
  onViewPcbComponent(pcbComponent);
3534
3630
  },
3535
3631
  children: [
3536
- /* @__PURE__ */ jsx11("span", { style: iconSlotStyles2, children: "\u2197" }),
3537
- /* @__PURE__ */ jsx11("span", { children: "Show on PCB" })
3632
+ /* @__PURE__ */ jsx13("span", { style: iconSlotStyles2, children: "\u2197" }),
3633
+ /* @__PURE__ */ jsx13("span", { children: "Show on PCB" })
3538
3634
  ]
3539
3635
  }
3540
3636
  ) }),
@@ -3546,11 +3642,11 @@ var ViewMenu = ({
3546
3642
  style: itemStyles2,
3547
3643
  children: [
3548
3644
  "Net Locations ",
3549
- /* @__PURE__ */ jsx11("span", { style: { marginLeft: "auto" }, children: "\u203A" })
3645
+ /* @__PURE__ */ jsx13("span", { style: { marginLeft: "auto" }, children: "\u203A" })
3550
3646
  ]
3551
3647
  }
3552
3648
  ),
3553
- /* @__PURE__ */ jsx11(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsx11(
3649
+ /* @__PURE__ */ jsx13(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsx13(
3554
3650
  DropdownMenu2.SubContent,
3555
3651
  {
3556
3652
  style: {
@@ -3559,7 +3655,7 @@ var ViewMenu = ({
3559
3655
  overflowY: "auto"
3560
3656
  },
3561
3657
  collisionPadding: 10,
3562
- children: netLocations.map((location, index) => /* @__PURE__ */ jsx11(
3658
+ children: netLocations.map((location, index) => /* @__PURE__ */ jsx13(
3563
3659
  DropdownMenu2.Item,
3564
3660
  {
3565
3661
  className: "sv-vm-item",
@@ -3586,8 +3682,8 @@ var ViewMenu = ({
3586
3682
  if (hasPorts) onTogglePorts(!showPorts);
3587
3683
  },
3588
3684
  children: [
3589
- /* @__PURE__ */ jsx11("span", { style: iconSlotStyles2, children: showPorts && /* @__PURE__ */ jsx11(CheckIcon2, {}) }),
3590
- /* @__PURE__ */ jsx11("span", { children: "Show Schematic Ports" })
3685
+ /* @__PURE__ */ jsx13("span", { style: iconSlotStyles2, children: showPorts && /* @__PURE__ */ jsx13(CheckIcon2, {}) }),
3686
+ /* @__PURE__ */ jsx13("span", { children: "Show Schematic Ports" })
3591
3687
  ]
3592
3688
  }
3593
3689
  ),
@@ -3604,8 +3700,8 @@ var ViewMenu = ({
3604
3700
  if (hasGroups) onToggleGroups(!showGroups);
3605
3701
  },
3606
3702
  children: [
3607
- /* @__PURE__ */ jsx11("span", { style: iconSlotStyles2, children: showGroups && /* @__PURE__ */ jsx11(CheckIcon2, {}) }),
3608
- /* @__PURE__ */ jsx11("span", { children: "View Schematic Groups" })
3703
+ /* @__PURE__ */ jsx13("span", { style: iconSlotStyles2, children: showGroups && /* @__PURE__ */ jsx13(CheckIcon2, {}) }),
3704
+ /* @__PURE__ */ jsx13("span", { children: "View Schematic Groups" })
3609
3705
  ]
3610
3706
  }
3611
3707
  ),
@@ -3620,8 +3716,8 @@ var ViewMenu = ({
3620
3716
  onToggleGrid(!showGrid);
3621
3717
  },
3622
3718
  children: [
3623
- /* @__PURE__ */ jsx11("span", { style: iconSlotStyles2, children: showGrid && /* @__PURE__ */ jsx11(CheckIcon2, {}) }),
3624
- /* @__PURE__ */ jsx11("span", { children: "Show Grid" })
3719
+ /* @__PURE__ */ jsx13("span", { style: iconSlotStyles2, children: showGrid && /* @__PURE__ */ jsx13(CheckIcon2, {}) }),
3720
+ /* @__PURE__ */ jsx13("span", { children: "Show Grid" })
3625
3721
  ]
3626
3722
  }
3627
3723
  ),
@@ -3634,12 +3730,12 @@ var ViewMenu = ({
3634
3730
  onCheckedChange: onToggleWarnings,
3635
3731
  onSelect: (event) => event.preventDefault(),
3636
3732
  children: [
3637
- /* @__PURE__ */ jsx11("span", { style: iconSlotStyles2, children: /* @__PURE__ */ jsx11(DropdownMenu2.ItemIndicator, { children: /* @__PURE__ */ jsx11(CheckIcon2, {}) }) }),
3638
- /* @__PURE__ */ jsx11("span", { children: "Show Warnings" })
3733
+ /* @__PURE__ */ jsx13("span", { style: iconSlotStyles2, children: /* @__PURE__ */ jsx13(DropdownMenu2.ItemIndicator, { children: /* @__PURE__ */ jsx13(CheckIcon2, {}) }) }),
3734
+ /* @__PURE__ */ jsx13("span", { children: "Show Warnings" })
3639
3735
  ]
3640
3736
  }
3641
3737
  ),
3642
- /* @__PURE__ */ jsx11(DropdownMenu2.Separator, { style: separatorStyles }),
3738
+ /* @__PURE__ */ jsx13(DropdownMenu2.Separator, { style: separatorStyles }),
3643
3739
  /* @__PURE__ */ jsxs9(
3644
3740
  DropdownMenu2.Item,
3645
3741
  {
@@ -3647,12 +3743,12 @@ var ViewMenu = ({
3647
3743
  style: itemStyles2,
3648
3744
  onSelect: onRunStyleAnalysis,
3649
3745
  children: [
3650
- /* @__PURE__ */ jsx11("span", { style: iconSlotStyles2 }),
3651
- /* @__PURE__ */ jsx11("span", { children: "Run Style Analysis" })
3746
+ /* @__PURE__ */ jsx13("span", { style: iconSlotStyles2 }),
3747
+ /* @__PURE__ */ jsx13("span", { children: "Run Style Analysis" })
3652
3748
  ]
3653
3749
  }
3654
3750
  ),
3655
- /* @__PURE__ */ jsx11(DropdownMenu2.Separator, { style: separatorStyles }),
3751
+ /* @__PURE__ */ jsx13(DropdownMenu2.Separator, { style: separatorStyles }),
3656
3752
  /* @__PURE__ */ jsxs9(
3657
3753
  "div",
3658
3754
  {
@@ -3680,7 +3776,7 @@ var ViewMenu = ({
3680
3776
  };
3681
3777
 
3682
3778
  // lib/components/SchematicViewer.tsx
3683
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
3779
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
3684
3780
  var SchematicViewer = ({
3685
3781
  circuitJson,
3686
3782
  platformConfig,
@@ -3698,6 +3794,8 @@ var SchematicViewer = ({
3698
3794
  searchEnabled = true,
3699
3795
  controller,
3700
3796
  onViewPcbComponent,
3797
+ highlightedSchematicComponentIds,
3798
+ highlightedSchematicTextIds,
3701
3799
  css,
3702
3800
  className
3703
3801
  }) => {
@@ -3730,14 +3828,14 @@ var SchematicViewer = ({
3730
3828
  return defaultSheetId;
3731
3829
  }
3732
3830
  );
3733
- useEffect13(() => {
3831
+ useEffect15(() => {
3734
3832
  const stillExists = selectedSheetId !== void 0 && schematicSheets.some((s) => s.schematic_sheet_id === selectedSheetId);
3735
3833
  if (!stillExists) {
3736
3834
  setSelectedSheetId(defaultSheetId);
3737
3835
  }
3738
3836
  }, [circuitJsonKey]);
3739
3837
  const activeSheetId = hasMultipleSheets ? selectedSheetId ?? defaultSheetId : void 0;
3740
- const handleSelectSheet = useCallback7(
3838
+ const handleSelectSheet = useCallback8(
3741
3839
  (sheetId) => {
3742
3840
  setSelectedSheetId(sheetId);
3743
3841
  setStoredString(STORAGE_KEYS.SELECTED_SCHEMATIC_SHEET, sheetId);
@@ -3762,15 +3860,15 @@ var SchematicViewer = ({
3762
3860
  const [showSchematicPortsInternal, setShowSchematicPortsInternal] = useState10(
3763
3861
  () => showSchematicPorts ?? getStoredBoolean(STORAGE_KEYS.IS_SHOWING_SCHEMATIC_PORTS, false)
3764
3862
  );
3765
- useEffect13(() => {
3863
+ useEffect15(() => {
3766
3864
  if (showSchematicPorts !== void 0) {
3767
3865
  setShowSchematicPortsInternal(showSchematicPorts);
3768
3866
  }
3769
3867
  }, [showSchematicPorts]);
3770
3868
  const [isHoveringClickableComponent, setIsHoveringClickableComponent] = useState10(false);
3771
- const hoveringComponentsRef = useRef9(/* @__PURE__ */ new Set());
3869
+ const hoveringComponentsRef = useRef8(/* @__PURE__ */ new Set());
3772
3870
  const [selectedSchematicComponent, setSelectedSchematicComponent] = useState10(null);
3773
- const handleComponentHoverChange = useCallback7(
3871
+ const handleComponentHoverChange = useCallback8(
3774
3872
  (componentId, isHovering) => {
3775
3873
  if (isHovering) {
3776
3874
  hoveringComponentsRef.current.add(componentId);
@@ -3782,8 +3880,8 @@ var SchematicViewer = ({
3782
3880
  []
3783
3881
  );
3784
3882
  const [isHoveringClickablePort, setIsHoveringClickablePort] = useState10(false);
3785
- const hoveringPortsRef = useRef9(/* @__PURE__ */ new Set());
3786
- const handlePortHoverChange = useCallback7(
3883
+ const hoveringPortsRef = useRef8(/* @__PURE__ */ new Set());
3884
+ const handlePortHoverChange = useCallback8(
3787
3885
  (portId, isHovering) => {
3788
3886
  if (isHovering) {
3789
3887
  hoveringPortsRef.current.add(portId);
@@ -3794,9 +3892,9 @@ var SchematicViewer = ({
3794
3892
  },
3795
3893
  []
3796
3894
  );
3797
- const svgDivRef = useRef9(null);
3798
- const touchStartRef = useRef9(null);
3799
- const zoomScaleRef = useRef9({ x: 1, y: 1 });
3895
+ const svgDivRef = useRef8(null);
3896
+ const touchStartRef = useRef8(null);
3897
+ const zoomScaleRef = useRef8({ x: 1, y: 1 });
3800
3898
  const schematicComponentIds = useMemo6(() => {
3801
3899
  try {
3802
3900
  const components = su4(circuitJson).schematic_component?.list() ?? [];
@@ -3848,7 +3946,7 @@ var SchematicViewer = ({
3848
3946
  }
3849
3947
  touchStartRef.current = null;
3850
3948
  };
3851
- const shouldPanSchematic = useCallback7(
3949
+ const shouldPanSchematic = useCallback8(
3852
3950
  (event) => {
3853
3951
  if (event.target instanceof Element && event.target.closest(
3854
3952
  "[data-schematic-search], [data-schematic-warnings], .schematic-warning, [data-schematic-component-details-tooltip]"
@@ -3915,7 +4013,7 @@ var SchematicViewer = ({
3915
4013
  );
3916
4014
  return { left, top, width, maxHeight };
3917
4015
  }, [selectedSchematicComponent, containerWidth, containerHeight]);
3918
- const handleSchematicComponentClick = useCallback7(
4016
+ const handleSchematicComponentClick = useCallback8(
3919
4017
  (schematicComponentId, event) => {
3920
4018
  if (event.target instanceof Element && event.target.closest("[data-schematic-component-details-tooltip]")) {
3921
4019
  return;
@@ -3934,10 +4032,10 @@ var SchematicViewer = ({
3934
4032
  },
3935
4033
  [containerRef, onSchematicComponentClicked]
3936
4034
  );
3937
- useEffect13(() => {
4035
+ useEffect15(() => {
3938
4036
  setSelectedSchematicComponent(null);
3939
4037
  }, [circuitJsonKey, activeSheetId]);
3940
- useEffect13(() => {
4038
+ useEffect15(() => {
3941
4039
  if (!selectedSchematicComponent) return;
3942
4040
  const handleKeyDown = (event) => {
3943
4041
  if (event.key === "Escape") {
@@ -4021,7 +4119,7 @@ var SchematicViewer = ({
4021
4119
  enabled: netHoverHighlightEnabled
4022
4120
  });
4023
4121
  const svgDiv = useMemo6(
4024
- () => /* @__PURE__ */ jsx12(
4122
+ () => /* @__PURE__ */ jsx14(
4025
4123
  "div",
4026
4124
  {
4027
4125
  ref: svgDivRef,
@@ -4037,9 +4135,9 @@ var SchematicViewer = ({
4037
4135
  );
4038
4136
  useSchematicWarnings({ svgDivRef, svgContent: svgDiv, circuitJsonKey });
4039
4137
  return /* @__PURE__ */ jsxs10(MouseTracker, { children: [
4040
- netHoverHighlightEnabled && /* @__PURE__ */ jsx12("style", { children: `.sch-net-faded { opacity: 0.35; }
4138
+ netHoverHighlightEnabled && /* @__PURE__ */ jsx14("style", { children: `.sch-net-faded { opacity: 0.35; }
4041
4139
  svg :is(g.trace, g.trace-overlays, g[data-schematic-component-id], [data-schematic-net-label-id]) { transition: opacity 0.12s ease-in-out; }` }),
4042
- searchEnabled && /* @__PURE__ */ jsx12("style", { children: `.schematic-search-match text,
4140
+ searchEnabled && /* @__PURE__ */ jsx14("style", { children: `.schematic-search-match text,
4043
4141
  text.schematic-search-match {
4044
4142
  fill: #ff00d4 !important;
4045
4143
  }
@@ -4055,11 +4153,11 @@ var SchematicViewer = ({
4055
4153
  flex-direction: column;
4056
4154
  }
4057
4155
  }` }),
4058
- /* @__PURE__ */ jsx12("style", { children: `
4156
+ /* @__PURE__ */ jsx14("style", { children: `
4059
4157
  .schematic-component-clickable > svg { overflow: visible; }
4060
4158
  .schematic-component-clickable [data-schematic-component-id]:hover { cursor: pointer !important; }
4061
4159
  ` }),
4062
- onSchematicPortClicked && /* @__PURE__ */ jsx12("style", { children: "[data-schematic-port-id]:hover { cursor: pointer !important; }" }),
4160
+ onSchematicPortClicked && /* @__PURE__ */ jsx14("style", { children: "[data-schematic-port-id]:hover { cursor: pointer !important; }" }),
4063
4161
  /* @__PURE__ */ jsxs10(
4064
4162
  "div",
4065
4163
  {
@@ -4095,7 +4193,7 @@ var SchematicViewer = ({
4095
4193
  },
4096
4194
  onTouchCancel: contextMenuEventHandlers.onTouchCancel,
4097
4195
  children: [
4098
- !isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */ jsx12(
4196
+ !isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */ jsx14(
4099
4197
  "div",
4100
4198
  {
4101
4199
  onClick: (e) => {
@@ -4114,7 +4212,7 @@ var SchematicViewer = ({
4114
4212
  pointerEvents: "all",
4115
4213
  touchAction: "pan-x pan-y pinch-zoom"
4116
4214
  },
4117
- children: /* @__PURE__ */ jsx12(
4215
+ children: /* @__PURE__ */ jsx14(
4118
4216
  "div",
4119
4217
  {
4120
4218
  style: {
@@ -4131,14 +4229,14 @@ var SchematicViewer = ({
4131
4229
  )
4132
4230
  }
4133
4231
  ),
4134
- analysisCircuitJson && /* @__PURE__ */ jsx12(
4232
+ analysisCircuitJson && /* @__PURE__ */ jsx14(
4135
4233
  StyleAnalysisDialog,
4136
4234
  {
4137
4235
  circuitJson: analysisCircuitJson,
4138
4236
  onClose: () => setAnalysisCircuitJson(null)
4139
4237
  }
4140
4238
  ),
4141
- menuVisible && /* @__PURE__ */ jsx12(
4239
+ menuVisible && /* @__PURE__ */ jsx14(
4142
4240
  ViewMenu,
4143
4241
  {
4144
4242
  isComponentMenu: !!getSchematicComponentAtElement(menuTarget, circuitJson),
@@ -4196,7 +4294,7 @@ var SchematicViewer = ({
4196
4294
  zIndex: zIndexMap.schematicSearch
4197
4295
  },
4198
4296
  children: [
4199
- /* @__PURE__ */ jsx12(
4297
+ /* @__PURE__ */ jsx14(
4200
4298
  SchematicSheetSelector,
4201
4299
  {
4202
4300
  sheets: schematicSheets,
@@ -4204,7 +4302,7 @@ var SchematicViewer = ({
4204
4302
  onSelectSheet: handleSelectSheet
4205
4303
  }
4206
4304
  ),
4207
- searchEnabled && /* @__PURE__ */ jsx12(
4305
+ searchEnabled && /* @__PURE__ */ jsx14(
4208
4306
  SchematicSearch,
4209
4307
  {
4210
4308
  query: searchQuery,
@@ -4215,7 +4313,7 @@ var SchematicViewer = ({
4215
4313
  viewerContainerRef: containerRef
4216
4314
  }
4217
4315
  ),
4218
- warningCount > 0 && /* @__PURE__ */ jsx12(
4316
+ warningCount > 0 && /* @__PURE__ */ jsx14(
4219
4317
  SchematicWarningsButton,
4220
4318
  {
4221
4319
  count: warningCount,
@@ -4226,7 +4324,7 @@ var SchematicViewer = ({
4226
4324
  ]
4227
4325
  }
4228
4326
  ),
4229
- schematicComponentIds.map((componentId) => /* @__PURE__ */ jsx12(
4327
+ schematicComponentIds.map((componentId) => /* @__PURE__ */ jsx14(
4230
4328
  SchematicComponentMouseTarget,
4231
4329
  {
4232
4330
  componentId,
@@ -4239,8 +4337,28 @@ var SchematicViewer = ({
4239
4337
  },
4240
4338
  componentId
4241
4339
  )),
4340
+ highlightedSchematicComponentIds?.map((componentId) => /* @__PURE__ */ jsx14(
4341
+ SchematicElementHighlight,
4342
+ {
4343
+ selector: `[data-schematic-component-id="${componentId}"]`,
4344
+ svgDivRef,
4345
+ containerRef,
4346
+ circuitJsonKey
4347
+ },
4348
+ `component-${componentId}`
4349
+ )),
4350
+ highlightedSchematicTextIds?.map((textId) => /* @__PURE__ */ jsx14(
4351
+ SchematicElementHighlight,
4352
+ {
4353
+ selector: `[data-schematic-text-id="${textId}"]`,
4354
+ svgDivRef,
4355
+ containerRef,
4356
+ circuitJsonKey
4357
+ },
4358
+ `text-${textId}`
4359
+ )),
4242
4360
  svgDiv,
4243
- selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */ jsx12(
4361
+ selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */ jsx14(
4244
4362
  SchematicComponentDetailsTooltip,
4245
4363
  {
4246
4364
  platformConfig,
@@ -4252,7 +4370,7 @@ var SchematicViewer = ({
4252
4370
  ...componentTooltipLayout
4253
4371
  }
4254
4372
  ),
4255
- showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */ jsx12(
4373
+ showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */ jsx14(
4256
4374
  SchematicPortMouseTarget,
4257
4375
  {
4258
4376
  portId,
@@ -4282,7 +4400,7 @@ import {
4282
4400
  convertCircuitJsonToSchematicSimulationSvg,
4283
4401
  convertCircuitJsonToSimulationGraphSvg
4284
4402
  } from "circuit-to-svg";
4285
- import { useEffect as useEffect14, useMemo as useMemo7, useRef as useRef10, useState as useState12 } from "react";
4403
+ import { useEffect as useEffect16, useMemo as useMemo7, useRef as useRef9, useState as useState12 } from "react";
4286
4404
  import { toString as transformToString2 } from "transformation-matrix";
4287
4405
  import { useMouseMatrixTransform as useMouseMatrixTransform2 } from "use-mouse-matrix-transform";
4288
4406
 
@@ -4301,7 +4419,7 @@ var getAnalogSimulationBackgroundColor = (simulationSvg, colorOverrides) => getR
4301
4419
  // lib/components/AnalogSimulationSelector.tsx
4302
4420
  import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
4303
4421
  import { useState as useState11 } from "react";
4304
- import { Fragment as Fragment8, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
4422
+ import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
4305
4423
  var FONT_FAMILY3 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
4306
4424
  var contentStyles3 = {
4307
4425
  backgroundColor: "#ffffff",
@@ -4351,7 +4469,7 @@ var MENU_CSS2 = `
4351
4469
  .sv-simulation-chevron { transition: transform 0.2s ease; }
4352
4470
  [data-state="open"] > .sv-simulation-chevron { transform: rotate(180deg); }
4353
4471
  `;
4354
- var CheckIcon3 = () => /* @__PURE__ */ jsx13(
4472
+ var CheckIcon3 = () => /* @__PURE__ */ jsx15(
4355
4473
  "svg",
4356
4474
  {
4357
4475
  width: "14",
@@ -4363,10 +4481,10 @@ var CheckIcon3 = () => /* @__PURE__ */ jsx13(
4363
4481
  strokeLinecap: "round",
4364
4482
  strokeLinejoin: "round",
4365
4483
  "aria-hidden": "true",
4366
- children: /* @__PURE__ */ jsx13("path", { d: "M20 6 9 17l-5-5" })
4484
+ children: /* @__PURE__ */ jsx15("path", { d: "M20 6 9 17l-5-5" })
4367
4485
  }
4368
4486
  );
4369
- var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx13(
4487
+ var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx15(
4370
4488
  "svg",
4371
4489
  {
4372
4490
  className,
@@ -4380,7 +4498,7 @@ var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx13(
4380
4498
  strokeLinejoin: "round",
4381
4499
  style: { opacity: 0.6, flexShrink: 0 },
4382
4500
  "aria-hidden": "true",
4383
- children: /* @__PURE__ */ jsx13("path", { d: "m6 9 6 6 6-6" })
4501
+ children: /* @__PURE__ */ jsx15("path", { d: "m6 9 6 6 6-6" })
4384
4502
  }
4385
4503
  );
4386
4504
  var getSimulationLabels = (simulations) => {
@@ -4407,9 +4525,9 @@ var AnalogSimulationSelector = ({
4407
4525
  );
4408
4526
  const selectedLabel = selectedSimulation?.label ?? "Select simulation";
4409
4527
  return /* @__PURE__ */ jsxs11(Fragment8, { children: [
4410
- /* @__PURE__ */ jsx13("style", { children: MENU_CSS2 }),
4528
+ /* @__PURE__ */ jsx15("style", { children: MENU_CSS2 }),
4411
4529
  /* @__PURE__ */ jsxs11(DropdownMenu3.Root, { open, onOpenChange: setOpen, modal: false, children: [
4412
- /* @__PURE__ */ jsx13(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
4530
+ /* @__PURE__ */ jsx15(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
4413
4531
  "button",
4414
4532
  {
4415
4533
  type: "button",
@@ -4436,13 +4554,13 @@ var AnalogSimulationSelector = ({
4436
4554
  zIndex: zIndexMap.viewMenuIcon
4437
4555
  },
4438
4556
  children: [
4439
- /* @__PURE__ */ jsx13("span", { style: { color: "#888888", flexShrink: 0 }, children: "Simulation:" }),
4440
- /* @__PURE__ */ jsx13("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: selectedLabel }),
4441
- /* @__PURE__ */ jsx13(ChevronDownIcon2, { className: "sv-simulation-chevron" })
4557
+ /* @__PURE__ */ jsx15("span", { style: { color: "#888888", flexShrink: 0 }, children: "Simulation:" }),
4558
+ /* @__PURE__ */ jsx15("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: selectedLabel }),
4559
+ /* @__PURE__ */ jsx15(ChevronDownIcon2, { className: "sv-simulation-chevron" })
4442
4560
  ]
4443
4561
  }
4444
4562
  ) }),
4445
- /* @__PURE__ */ jsx13(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx13(
4563
+ /* @__PURE__ */ jsx15(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx15(
4446
4564
  DropdownMenu3.Content,
4447
4565
  {
4448
4566
  style: contentStyles3,
@@ -4464,8 +4582,8 @@ var AnalogSimulationSelector = ({
4464
4582
  setOpen(false);
4465
4583
  },
4466
4584
  children: [
4467
- /* @__PURE__ */ jsx13("span", { style: iconSlotStyles3, children: selected && /* @__PURE__ */ jsx13(CheckIcon3, {}) }),
4468
- /* @__PURE__ */ jsx13("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: label })
4585
+ /* @__PURE__ */ jsx15("span", { style: iconSlotStyles3, children: selected && /* @__PURE__ */ jsx15(CheckIcon3, {}) }),
4586
+ /* @__PURE__ */ jsx15("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: label })
4469
4587
  ]
4470
4588
  },
4471
4589
  simulation.simulation_experiment_id
@@ -4478,7 +4596,7 @@ var AnalogSimulationSelector = ({
4478
4596
  };
4479
4597
 
4480
4598
  // lib/components/AnalogSimulationViewer.tsx
4481
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
4599
+ import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
4482
4600
  var DEFAULT_RENDER_WIDTH = 1200;
4483
4601
  var DEFAULT_COMBINED_RENDER_ASPECT_RATIO = 1;
4484
4602
  var DEFAULT_GRAPH_ONLY_RENDER_ASPECT_RATIO = 2;
@@ -4497,8 +4615,8 @@ var AnalogSimulationViewer = ({
4497
4615
  const [isLoading, setIsLoading] = useState12(true);
4498
4616
  const [error, setError] = useState12(null);
4499
4617
  const [svgObjectUrl, setSvgObjectUrl] = useState12(null);
4500
- const containerRef = useRef10(null);
4501
- const imgRef = useRef10(null);
4618
+ const containerRef = useRef9(null);
4619
+ const imgRef = useRef9(null);
4502
4620
  const { containerWidth } = useResizeHandling(
4503
4621
  containerRef
4504
4622
  );
@@ -4518,7 +4636,7 @@ var AnalogSimulationViewer = ({
4518
4636
  const renderAspectRatio = width && height ? width / height : defaultRenderAspectRatio;
4519
4637
  const effectiveWidth = width || (height ? height * renderAspectRatio : containerWidth) || DEFAULT_RENDER_WIDTH;
4520
4638
  const effectiveHeight = height || effectiveWidth / renderAspectRatio;
4521
- useEffect14(() => {
4639
+ useEffect16(() => {
4522
4640
  setIsLoading(true);
4523
4641
  setError(null);
4524
4642
  setCircuitJson(inputCircuitJson);
@@ -4534,7 +4652,7 @@ var AnalogSimulationViewer = ({
4534
4652
  const simulationExperimentId = (selectedSimulationExperimentId && simulationExperiments.some(
4535
4653
  (simulation) => simulation.simulation_experiment_id === selectedSimulationExperimentId
4536
4654
  ) ? selectedSimulationExperimentId : simulationExperiments[0]?.simulation_experiment_id) ?? null;
4537
- useEffect14(() => {
4655
+ useEffect16(() => {
4538
4656
  if (simulationExperimentId !== selectedSimulationExperimentId) {
4539
4657
  setSelectedSimulationExperimentId(simulationExperimentId);
4540
4658
  }
@@ -4571,7 +4689,7 @@ var AnalogSimulationViewer = ({
4571
4689
  simulationExperimentId,
4572
4690
  acSweepView
4573
4691
  ]);
4574
- useEffect14(() => {
4692
+ useEffect16(() => {
4575
4693
  if (!simulationSvg) {
4576
4694
  setSvgObjectUrl(null);
4577
4695
  return;
@@ -4597,7 +4715,7 @@ var AnalogSimulationViewer = ({
4597
4715
  const handleTouchStart = (_e) => {
4598
4716
  setIsDragging(true);
4599
4717
  };
4600
- useEffect14(() => {
4718
+ useEffect16(() => {
4601
4719
  const handleMouseUp = () => {
4602
4720
  setIsDragging(false);
4603
4721
  };
@@ -4612,7 +4730,7 @@ var AnalogSimulationViewer = ({
4612
4730
  };
4613
4731
  }, []);
4614
4732
  if (isLoading) {
4615
- return /* @__PURE__ */ jsx14(
4733
+ return /* @__PURE__ */ jsx16(
4616
4734
  "div",
4617
4735
  {
4618
4736
  style: {
@@ -4632,7 +4750,7 @@ var AnalogSimulationViewer = ({
4632
4750
  );
4633
4751
  }
4634
4752
  if (error) {
4635
- return /* @__PURE__ */ jsx14(
4753
+ return /* @__PURE__ */ jsx16(
4636
4754
  "div",
4637
4755
  {
4638
4756
  style: {
@@ -4648,8 +4766,8 @@ var AnalogSimulationViewer = ({
4648
4766
  },
4649
4767
  className,
4650
4768
  children: /* @__PURE__ */ jsxs12("div", { style: { textAlign: "center", padding: "20px" }, children: [
4651
- /* @__PURE__ */ jsx14("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "Circuit Conversion Error" }),
4652
- /* @__PURE__ */ jsx14("div", { style: { fontSize: "14px" }, children: error })
4769
+ /* @__PURE__ */ jsx16("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "Circuit Conversion Error" }),
4770
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: "14px" }, children: error })
4653
4771
  ] })
4654
4772
  }
4655
4773
  );
@@ -4671,11 +4789,11 @@ var AnalogSimulationViewer = ({
4671
4789
  },
4672
4790
  className,
4673
4791
  children: [
4674
- /* @__PURE__ */ jsx14("div", { style: { fontSize: "16px", color: "#475569", fontWeight: 500 }, children: "No Simulation Found" }),
4792
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: "16px", color: "#475569", fontWeight: 500 }, children: "No Simulation Found" }),
4675
4793
  /* @__PURE__ */ jsxs12("div", { style: { fontSize: "14px", color: "#64748b" }, children: [
4676
4794
  "Use",
4677
4795
  " ",
4678
- /* @__PURE__ */ jsx14(
4796
+ /* @__PURE__ */ jsx16(
4679
4797
  "code",
4680
4798
  {
4681
4799
  style: {
@@ -4714,7 +4832,7 @@ var AnalogSimulationViewer = ({
4714
4832
  onMouseDown: handleMouseDown,
4715
4833
  onTouchStart: handleTouchStart,
4716
4834
  children: [
4717
- /* @__PURE__ */ jsx14(
4835
+ /* @__PURE__ */ jsx16(
4718
4836
  AnalogSimulationSelector,
4719
4837
  {
4720
4838
  simulations: simulationExperiments,
@@ -4722,7 +4840,7 @@ var AnalogSimulationViewer = ({
4722
4840
  onSelectSimulation: handleSelectSimulation
4723
4841
  }
4724
4842
  ),
4725
- svgObjectUrl ? /* @__PURE__ */ jsx14(
4843
+ svgObjectUrl ? /* @__PURE__ */ jsx16(
4726
4844
  "img",
4727
4845
  {
4728
4846
  ref: imgRef,
@@ -4736,7 +4854,7 @@ var AnalogSimulationViewer = ({
4736
4854
  objectFit: "contain"
4737
4855
  }
4738
4856
  }
4739
- ) : /* @__PURE__ */ jsx14(
4857
+ ) : /* @__PURE__ */ jsx16(
4740
4858
  "div",
4741
4859
  {
4742
4860
  style: {
@@ -4757,16 +4875,16 @@ var AnalogSimulationViewer = ({
4757
4875
  };
4758
4876
 
4759
4877
  // lib/hooks/useSchematicViewerController.ts
4760
- import { useCallback as useCallback8, useMemo as useMemo8, useState as useState13 } from "react";
4878
+ import { useCallback as useCallback9, useMemo as useMemo8, useState as useState13 } from "react";
4761
4879
  var useSchematicViewerController = () => {
4762
4880
  const [focusRequest, setFocusRequest] = useState13(null);
4763
- const focusSchematicComponent = useCallback8(
4881
+ const focusSchematicComponent = useCallback9(
4764
4882
  (schematicComponentId) => {
4765
4883
  setFocusRequest({ schematicComponentId });
4766
4884
  },
4767
4885
  []
4768
4886
  );
4769
- const onFocusRequestHandled = useCallback8(
4887
+ const onFocusRequestHandled = useCallback9(
4770
4888
  (request) => {
4771
4889
  setFocusRequest((current) => current === request ? null : current);
4772
4890
  },