@tscircuit/schematic-viewer 2.0.100 → 2.0.101

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
@@ -1284,7 +1284,7 @@ var enableDebug = () => {
1284
1284
  };
1285
1285
 
1286
1286
  // lib/components/SchematicViewer.tsx
1287
- import { useCallback as useCallback7, useEffect as useEffect12, useMemo as useMemo6, useRef as useRef9, useState as useState9 } from "react";
1287
+ import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo6, useRef as useRef9, useState as useState10 } from "react";
1288
1288
  import { toString as transformToString } from "transformation-matrix";
1289
1289
  import { useMouseMatrixTransform } from "use-mouse-matrix-transform";
1290
1290
 
@@ -1785,7 +1785,125 @@ var MouseTrackerProvider = ({ children }) => {
1785
1785
 
1786
1786
  // lib/components/SchematicComponentDetailsTooltip.tsx
1787
1787
  import { useMemo as useMemo3 } from "react";
1788
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
1788
+
1789
+ // lib/components/JlcPartAvailability.tsx
1790
+ import { useEffect as useEffect8, useState as useState5 } from "react";
1791
+
1792
+ // lib/utils/jlc-part-availability.ts
1793
+ var nonNegativeNumber = (value) => {
1794
+ if (typeof value !== "number" && typeof value !== "string") return null;
1795
+ if (typeof value === "string" && !value.trim()) return null;
1796
+ const number = Number(value);
1797
+ return Number.isFinite(number) && number >= 0 ? number : null;
1798
+ };
1799
+ var getPrice = (value) => {
1800
+ const number = nonNegativeNumber(value);
1801
+ if (number !== null) return number;
1802
+ if (typeof value !== "string") return null;
1803
+ try {
1804
+ const tiers = JSON.parse(value);
1805
+ if (Array.isArray(tiers)) {
1806
+ return nonNegativeNumber(tiers[0]?.price);
1807
+ }
1808
+ } catch {
1809
+ const tiers = value.split(",").map((tier) => {
1810
+ const [quantity, price] = tier.split(":");
1811
+ return {
1812
+ quantity: nonNegativeNumber(quantity?.split("-")[0]),
1813
+ price: nonNegativeNumber(price)
1814
+ };
1815
+ }).filter((tier) => tier.quantity !== null && tier.price !== null).sort((a, b) => a.quantity - b.quantity);
1816
+ return tiers[0]?.price ?? null;
1817
+ }
1818
+ return null;
1819
+ };
1820
+ var fetchJlcPartAvailability = async (partNumber, signal) => {
1821
+ const response = await fetch(
1822
+ `https://jlcsearch.tscircuit.com/api/search?q=${encodeURIComponent(partNumber)}&limit=1`,
1823
+ { signal, cache: "no-store" }
1824
+ );
1825
+ if (!response.ok) throw new Error("JLC part lookup failed");
1826
+ const data = await response.json();
1827
+ if (!Array.isArray(data?.components)) return null;
1828
+ const part = data.components.find(
1829
+ (component) => component && String(component.lcsc).replace(/^c/i, "") === partNumber.replace(/^c/i, "")
1830
+ );
1831
+ if (!part) return null;
1832
+ return {
1833
+ price: nonNegativeNumber(part.price1) ?? getPrice(part.price),
1834
+ stock: nonNegativeNumber(part.stock)
1835
+ };
1836
+ };
1837
+
1838
+ // lib/components/JlcPartAvailability.tsx
1839
+ import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
1840
+ var JlcPartAvailability = ({ partNumber }) => {
1841
+ const [result, setResult] = useState5(null);
1842
+ const [loading, setLoading] = useState5(true);
1843
+ useEffect8(() => {
1844
+ const controller = new AbortController();
1845
+ let active = true;
1846
+ setLoading(true);
1847
+ setResult(null);
1848
+ const timeout = setTimeout(() => {
1849
+ controller.abort();
1850
+ if (active) setLoading(false);
1851
+ }, 1e4);
1852
+ fetchJlcPartAvailability(partNumber, controller.signal).then((availability) => {
1853
+ if (active) setResult(availability);
1854
+ }).catch(() => {
1855
+ }).finally(() => {
1856
+ clearTimeout(timeout);
1857
+ if (active) setLoading(false);
1858
+ });
1859
+ return () => {
1860
+ active = false;
1861
+ clearTimeout(timeout);
1862
+ controller.abort();
1863
+ };
1864
+ }, [partNumber]);
1865
+ return /* @__PURE__ */ jsx3(
1866
+ "span",
1867
+ {
1868
+ role: "status",
1869
+ "aria-label": `${partNumber} price and stock`,
1870
+ "aria-busy": loading,
1871
+ style: { display: "block", color: "#64748b", marginTop: "2px" },
1872
+ children: loading ? /* @__PURE__ */ jsxs2("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
1873
+ /* @__PURE__ */ jsx3("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx3(
1874
+ "circle",
1875
+ {
1876
+ cx: "6",
1877
+ cy: "6",
1878
+ r: "4",
1879
+ fill: "none",
1880
+ stroke: "currentColor",
1881
+ strokeWidth: "2",
1882
+ strokeDasharray: "18 8",
1883
+ children: /* @__PURE__ */ jsx3(
1884
+ "animateTransform",
1885
+ {
1886
+ attributeName: "transform",
1887
+ type: "rotate",
1888
+ from: "0 6 6",
1889
+ to: "360 6 6",
1890
+ dur: "1s",
1891
+ repeatCount: "indefinite"
1892
+ }
1893
+ )
1894
+ }
1895
+ ) }),
1896
+ "Loading price and stock\u2026"
1897
+ ] }) : /* @__PURE__ */ jsxs2(Fragment3, { children: [
1898
+ /* @__PURE__ */ jsx3("span", { style: { display: "block" }, children: result?.price != null ? `$${result.price.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 6 })}` : "Price unavailable" }),
1899
+ /* @__PURE__ */ jsx3("span", { style: { display: "block" }, children: result?.stock != null ? `${result.stock.toLocaleString("en-US")} in stock` : "Stock unavailable" })
1900
+ ] })
1901
+ }
1902
+ );
1903
+ };
1904
+
1905
+ // lib/components/SchematicComponentDetailsTooltip.tsx
1906
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1789
1907
  var detailLabelStyle = {
1790
1908
  color: "#64748b",
1791
1909
  fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',
@@ -1818,7 +1936,7 @@ var SchematicComponentDetailsTooltip = ({
1818
1936
  ) : void 0,
1819
1937
  [footprintPreviewCircuitJson, footprintPreviewViewBox]
1820
1938
  );
1821
- return /* @__PURE__ */ jsxs2(
1939
+ return /* @__PURE__ */ jsxs3(
1822
1940
  "dialog",
1823
1941
  {
1824
1942
  open: true,
@@ -1853,7 +1971,7 @@ var SchematicComponentDetailsTooltip = ({
1853
1971
  onClick: (event) => event.stopPropagation(),
1854
1972
  onWheel: (event) => event.stopPropagation(),
1855
1973
  children: [
1856
- /* @__PURE__ */ jsxs2(
1974
+ /* @__PURE__ */ jsxs3(
1857
1975
  "dl",
1858
1976
  {
1859
1977
  style: {
@@ -1864,9 +1982,9 @@ var SchematicComponentDetailsTooltip = ({
1864
1982
  padding: "8px"
1865
1983
  },
1866
1984
  children: [
1867
- infoEntries.map((entry) => /* @__PURE__ */ jsxs2("div", { style: { display: "contents" }, children: [
1868
- /* @__PURE__ */ jsx3("dt", { style: detailLabelStyle, children: entry.label }),
1869
- /* @__PURE__ */ jsx3(
1985
+ infoEntries.map((entry) => /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
1986
+ /* @__PURE__ */ jsx4("dt", { style: detailLabelStyle, children: entry.label }),
1987
+ /* @__PURE__ */ jsx4(
1870
1988
  "dd",
1871
1989
  {
1872
1990
  style: {
@@ -1882,9 +2000,9 @@ var SchematicComponentDetailsTooltip = ({
1882
2000
  }
1883
2001
  )
1884
2002
  ] }, entry.key)),
1885
- supplierPartNumberEntries.map((entry) => /* @__PURE__ */ jsxs2("div", { style: { display: "contents" }, children: [
1886
- /* @__PURE__ */ jsx3("dt", { style: detailLabelStyle, children: entry.label }),
1887
- /* @__PURE__ */ jsx3(
2003
+ supplierPartNumberEntries.map((entry) => /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
2004
+ /* @__PURE__ */ jsx4("dt", { style: detailLabelStyle, children: entry.label }),
2005
+ /* @__PURE__ */ jsx4(
1888
2006
  "dd",
1889
2007
  {
1890
2008
  style: {
@@ -1895,25 +2013,39 @@ var SchematicComponentDetailsTooltip = ({
1895
2013
  lineHeight: 1.45,
1896
2014
  overflowWrap: "anywhere"
1897
2015
  },
1898
- children: entry.links.map((link, index) => /* @__PURE__ */ jsxs2("span", { children: [
1899
- index > 0 && ", ",
1900
- /* @__PURE__ */ jsx3(
1901
- "a",
1902
- {
1903
- href: link.href,
1904
- target: "_blank",
1905
- rel: "noreferrer noopener",
1906
- style: { color: "#2563eb", textDecoration: "underline" },
1907
- children: link.partNumber
1908
- }
1909
- )
1910
- ] }, link.href))
2016
+ children: entry.links.map((link, index) => /* @__PURE__ */ jsxs3(
2017
+ "span",
2018
+ {
2019
+ style: entry.label === "jlcpcb" ? { display: "block", marginTop: index > 0 ? 6 : 0 } : void 0,
2020
+ children: [
2021
+ entry.label !== "jlcpcb" && index > 0 && ", ",
2022
+ /* @__PURE__ */ jsx4(
2023
+ "a",
2024
+ {
2025
+ href: link.href,
2026
+ target: "_blank",
2027
+ rel: "noreferrer noopener",
2028
+ style: { color: "#2563eb", textDecoration: "underline" },
2029
+ children: link.partNumber
2030
+ }
2031
+ ),
2032
+ entry.label === "jlcpcb" && /* @__PURE__ */ jsx4(
2033
+ JlcPartAvailability,
2034
+ {
2035
+ partNumber: link.partNumber
2036
+ },
2037
+ `${sourceComponent.source_component_id}-${link.partNumber}`
2038
+ )
2039
+ ]
2040
+ },
2041
+ link.href
2042
+ ))
1911
2043
  }
1912
2044
  )
1913
2045
  ] }, entry.key)),
1914
- footprinterString && /* @__PURE__ */ jsxs2("div", { style: { display: "contents" }, children: [
1915
- /* @__PURE__ */ jsx3("dt", { style: detailLabelStyle, children: "footprint" }),
1916
- /* @__PURE__ */ jsx3(
2046
+ footprinterString && /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
2047
+ /* @__PURE__ */ jsx4("dt", { style: detailLabelStyle, children: "footprint" }),
2048
+ /* @__PURE__ */ jsx4(
1917
2049
  "dd",
1918
2050
  {
1919
2051
  style: {
@@ -1932,7 +2064,7 @@ var SchematicComponentDetailsTooltip = ({
1932
2064
  ]
1933
2065
  }
1934
2066
  ),
1935
- warnings.length > 0 && /* @__PURE__ */ jsxs2(
2067
+ warnings.length > 0 && /* @__PURE__ */ jsxs3(
1936
2068
  "section",
1937
2069
  {
1938
2070
  "aria-label": "Component warnings",
@@ -1948,16 +2080,16 @@ var SchematicComponentDetailsTooltip = ({
1948
2080
  overflowWrap: "anywhere"
1949
2081
  },
1950
2082
  children: [
1951
- /* @__PURE__ */ jsxs2("strong", { children: [
2083
+ /* @__PURE__ */ jsxs3("strong", { children: [
1952
2084
  "Warnings (",
1953
2085
  warnings.length,
1954
2086
  ")"
1955
2087
  ] }),
1956
- /* @__PURE__ */ jsx3("ul", { style: { margin: "4px 0 0", paddingLeft: "18px" }, children: warnings.map((warning, index) => /* @__PURE__ */ jsx3("li", { children: warning.message }, `${warning.type}-${index}`)) })
2088
+ /* @__PURE__ */ jsx4("ul", { style: { margin: "4px 0 0", paddingLeft: "18px" }, children: warnings.map((warning, index) => /* @__PURE__ */ jsx4("li", { children: warning.message }, `${warning.type}-${index}`)) })
1957
2089
  ]
1958
2090
  }
1959
2091
  ),
1960
- footprintPreviewUrl && /* @__PURE__ */ jsx3("div", { style: { padding: "0 4px 4px" }, children: /* @__PURE__ */ jsx3(
2092
+ footprintPreviewUrl && /* @__PURE__ */ jsx4("div", { style: { padding: "0 4px 4px" }, children: /* @__PURE__ */ jsx4(
1961
2093
  "div",
1962
2094
  {
1963
2095
  style: {
@@ -1967,7 +2099,7 @@ var SchematicComponentDetailsTooltip = ({
1967
2099
  borderRadius: "2px",
1968
2100
  background: "#f8fafc"
1969
2101
  },
1970
- children: /* @__PURE__ */ jsx3(
2102
+ children: /* @__PURE__ */ jsx4(
1971
2103
  "img",
1972
2104
  {
1973
2105
  src: footprintPreviewUrl,
@@ -1990,12 +2122,12 @@ var SchematicComponentDetailsTooltip = ({
1990
2122
  };
1991
2123
 
1992
2124
  // lib/components/SchematicComponentMouseTarget.tsx
1993
- import { useCallback as useCallback5, useEffect as useEffect9, useRef as useRef6, useState as useState5 } from "react";
2125
+ import { useCallback as useCallback5, useEffect as useEffect10, useRef as useRef6, useState as useState6 } from "react";
1994
2126
 
1995
2127
  // lib/hooks/useMouseEventsOverBoundingBox.ts
1996
2128
  import {
1997
2129
  useContext as useContext2,
1998
- useEffect as useEffect8,
2130
+ useEffect as useEffect9,
1999
2131
  useId,
2000
2132
  useMemo as useMemo4,
2001
2133
  useRef as useRef5,
@@ -2017,7 +2149,7 @@ var useMouseEventsOverBoundingBox = (options) => {
2017
2149
  },
2018
2150
  []
2019
2151
  );
2020
- useEffect8(() => {
2152
+ useEffect9(() => {
2021
2153
  context.registerBoundingBox(id, {
2022
2154
  bounds: latestOptionsRef.current.bounds,
2023
2155
  onClick: latestOptionsRef.current.onClick ? handleClick : void 0
@@ -2026,7 +2158,7 @@ var useMouseEventsOverBoundingBox = (options) => {
2026
2158
  context.unregisterBoundingBox(id);
2027
2159
  };
2028
2160
  }, [context, handleClick, id]);
2029
- useEffect8(() => {
2161
+ useEffect9(() => {
2030
2162
  context.updateBoundingBox(id, {
2031
2163
  bounds: latestOptionsRef.current.bounds,
2032
2164
  onClick: latestOptionsRef.current.onClick ? handleClick : void 0
@@ -2050,7 +2182,7 @@ var useMouseEventsOverBoundingBox = (options) => {
2050
2182
  };
2051
2183
 
2052
2184
  // lib/components/SchematicComponentMouseTarget.tsx
2053
- import { jsx as jsx4 } from "react/jsx-runtime";
2185
+ import { jsx as jsx5 } from "react/jsx-runtime";
2054
2186
  var areMeasurementsEqual = (a, b) => {
2055
2187
  if (!a && !b) return true;
2056
2188
  if (!a || !b) return false;
@@ -2065,7 +2197,7 @@ var SchematicComponentMouseTarget = ({
2065
2197
  showOutline,
2066
2198
  circuitJsonKey
2067
2199
  }) => {
2068
- const [measurement, setMeasurement] = useState5(null);
2200
+ const [measurement, setMeasurement] = useState6(null);
2069
2201
  const frameRef = useRef6(null);
2070
2202
  const measure = useCallback5(() => {
2071
2203
  frameRef.current = null;
@@ -2106,10 +2238,10 @@ var SchematicComponentMouseTarget = ({
2106
2238
  if (frameRef.current !== null) return;
2107
2239
  frameRef.current = window.requestAnimationFrame(measure);
2108
2240
  }, [measure]);
2109
- useEffect9(() => {
2241
+ useEffect10(() => {
2110
2242
  scheduleMeasure();
2111
2243
  }, [scheduleMeasure, circuitJsonKey]);
2112
- useEffect9(() => {
2244
+ useEffect10(() => {
2113
2245
  scheduleMeasure();
2114
2246
  const svgDiv = svgDivRef.current;
2115
2247
  const container = containerRef.current;
@@ -2154,7 +2286,7 @@ var SchematicComponentMouseTarget = ({
2154
2286
  bounds,
2155
2287
  onClick: onComponentClick ? handleClick : void 0
2156
2288
  });
2157
- useEffect9(() => {
2289
+ useEffect10(() => {
2158
2290
  if (onHoverChange) {
2159
2291
  onHoverChange(componentId, hovering);
2160
2292
  }
@@ -2163,7 +2295,7 @@ var SchematicComponentMouseTarget = ({
2163
2295
  return null;
2164
2296
  }
2165
2297
  const rect = measurement.rect;
2166
- return /* @__PURE__ */ jsx4(
2298
+ return /* @__PURE__ */ jsx5(
2167
2299
  "div",
2168
2300
  {
2169
2301
  style: {
@@ -2181,8 +2313,8 @@ var SchematicComponentMouseTarget = ({
2181
2313
  };
2182
2314
 
2183
2315
  // lib/components/SchematicPortMouseTarget.tsx
2184
- import { useCallback as useCallback6, useEffect as useEffect10, useRef as useRef7, useState as useState6 } from "react";
2185
- import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
2316
+ import { useCallback as useCallback6, useEffect as useEffect11, useRef as useRef7, useState as useState7 } from "react";
2317
+ import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
2186
2318
  var areMeasurementsEqual2 = (a, b) => {
2187
2319
  if (!a && !b) return true;
2188
2320
  if (!a || !b) return false;
@@ -2198,7 +2330,7 @@ var SchematicPortMouseTarget = ({
2198
2330
  showOutline,
2199
2331
  circuitJsonKey
2200
2332
  }) => {
2201
- const [measurement, setMeasurement] = useState6(null);
2333
+ const [measurement, setMeasurement] = useState7(null);
2202
2334
  const frameRef = useRef7(null);
2203
2335
  const measure = useCallback6(() => {
2204
2336
  frameRef.current = null;
@@ -2240,10 +2372,10 @@ var SchematicPortMouseTarget = ({
2240
2372
  if (frameRef.current !== null) return;
2241
2373
  frameRef.current = window.requestAnimationFrame(measure);
2242
2374
  }, [measure]);
2243
- useEffect10(() => {
2375
+ useEffect11(() => {
2244
2376
  scheduleMeasure();
2245
2377
  }, [scheduleMeasure, circuitJsonKey]);
2246
- useEffect10(() => {
2378
+ useEffect11(() => {
2247
2379
  scheduleMeasure();
2248
2380
  const svgDiv = svgDivRef.current;
2249
2381
  const container = containerRef.current;
@@ -2288,7 +2420,7 @@ var SchematicPortMouseTarget = ({
2288
2420
  bounds,
2289
2421
  onClick: onPortClick ? handleClick : void 0
2290
2422
  });
2291
- useEffect10(() => {
2423
+ useEffect11(() => {
2292
2424
  if (onHoverChange) {
2293
2425
  onHoverChange(portId, hovering);
2294
2426
  }
@@ -2297,8 +2429,8 @@ var SchematicPortMouseTarget = ({
2297
2429
  return null;
2298
2430
  }
2299
2431
  const rect = measurement.rect;
2300
- return /* @__PURE__ */ jsxs3(Fragment3, { children: [
2301
- /* @__PURE__ */ jsx5(
2432
+ return /* @__PURE__ */ jsxs4(Fragment4, { children: [
2433
+ /* @__PURE__ */ jsx6(
2302
2434
  "div",
2303
2435
  {
2304
2436
  style: {
@@ -2316,7 +2448,7 @@ var SchematicPortMouseTarget = ({
2316
2448
  }
2317
2449
  }
2318
2450
  ),
2319
- hovering && portLabel && /* @__PURE__ */ jsx5(
2451
+ hovering && portLabel && /* @__PURE__ */ jsx6(
2320
2452
  "div",
2321
2453
  {
2322
2454
  style: {
@@ -2341,15 +2473,15 @@ var SchematicPortMouseTarget = ({
2341
2473
  };
2342
2474
 
2343
2475
  // lib/components/SchematicSearch.tsx
2344
- import { useEffect as useEffect11, useRef as useRef8, useState as useState7 } from "react";
2476
+ import { useEffect as useEffect12, useRef as useRef8, useState as useState8 } from "react";
2345
2477
 
2346
2478
  // lib/components/SchematicSearchIcons.tsx
2347
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
2479
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
2348
2480
  var Icon = ({
2349
2481
  children,
2350
2482
  size,
2351
2483
  strokeWidth
2352
- }) => /* @__PURE__ */ jsx6(
2484
+ }) => /* @__PURE__ */ jsx7(
2353
2485
  "svg",
2354
2486
  {
2355
2487
  width: size,
@@ -2364,31 +2496,31 @@ var Icon = ({
2364
2496
  children
2365
2497
  }
2366
2498
  );
2367
- var SearchIcon = (props) => /* @__PURE__ */ jsxs4(Icon, { ...props, children: [
2368
- /* @__PURE__ */ jsx6("circle", { cx: "11", cy: "11", r: "8" }),
2369
- /* @__PURE__ */ jsx6("path", { d: "m21 21-4.34-4.34" })
2499
+ var SearchIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
2500
+ /* @__PURE__ */ jsx7("circle", { cx: "11", cy: "11", r: "8" }),
2501
+ /* @__PURE__ */ jsx7("path", { d: "m21 21-4.34-4.34" })
2370
2502
  ] });
2371
- var CloseIcon = (props) => /* @__PURE__ */ jsxs4(Icon, { ...props, children: [
2372
- /* @__PURE__ */ jsx6("path", { d: "M18 6 6 18" }),
2373
- /* @__PURE__ */ jsx6("path", { d: "m6 6 12 12" })
2503
+ var CloseIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
2504
+ /* @__PURE__ */ jsx7("path", { d: "M18 6 6 18" }),
2505
+ /* @__PURE__ */ jsx7("path", { d: "m6 6 12 12" })
2374
2506
  ] });
2375
- var ComponentIcon = (props) => /* @__PURE__ */ jsxs4(Icon, { ...props, children: [
2376
- /* @__PURE__ */ jsx6("rect", { x: "4", y: "4", width: "16", height: "16", rx: "2" }),
2377
- /* @__PURE__ */ jsx6("rect", { x: "8", y: "8", width: "8", height: "8", rx: "1" }),
2378
- /* @__PURE__ */ jsx6("path", { d: "M7 2v2M12 2v2M17 2v2M7 20v2M12 20v2M17 20v2M2 7h2M2 12h2M2 17h2M20 7h2M20 12h2M20 17h2" })
2507
+ var ComponentIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
2508
+ /* @__PURE__ */ jsx7("rect", { x: "4", y: "4", width: "16", height: "16", rx: "2" }),
2509
+ /* @__PURE__ */ jsx7("rect", { x: "8", y: "8", width: "8", height: "8", rx: "1" }),
2510
+ /* @__PURE__ */ jsx7("path", { d: "M7 2v2M12 2v2M17 2v2M7 20v2M12 20v2M17 20v2M2 7h2M2 12h2M2 17h2M20 7h2M20 12h2M20 17h2" })
2379
2511
  ] });
2380
- var NetIcon = (props) => /* @__PURE__ */ jsxs4(Icon, { ...props, children: [
2381
- /* @__PURE__ */ jsx6("path", { d: "M15 6a9 9 0 0 0-9 9V3" }),
2382
- /* @__PURE__ */ jsx6("circle", { cx: "18", cy: "6", r: "3" }),
2383
- /* @__PURE__ */ jsx6("circle", { cx: "6", cy: "18", r: "3" })
2512
+ var NetIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
2513
+ /* @__PURE__ */ jsx7("path", { d: "M15 6a9 9 0 0 0-9 9V3" }),
2514
+ /* @__PURE__ */ jsx7("circle", { cx: "18", cy: "6", r: "3" }),
2515
+ /* @__PURE__ */ jsx7("circle", { cx: "6", cy: "18", r: "3" })
2384
2516
  ] });
2385
- var EnterIcon = (props) => /* @__PURE__ */ jsxs4(Icon, { ...props, children: [
2386
- /* @__PURE__ */ jsx6("path", { d: "M20 4v7a4 4 0 0 1-4 4H4" }),
2387
- /* @__PURE__ */ jsx6("path", { d: "m9 10-5 5 5 5" })
2517
+ var EnterIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
2518
+ /* @__PURE__ */ jsx7("path", { d: "M20 4v7a4 4 0 0 1-4 4H4" }),
2519
+ /* @__PURE__ */ jsx7("path", { d: "m9 10-5 5 5 5" })
2388
2520
  ] });
2389
2521
 
2390
2522
  // lib/components/SchematicSearch.tsx
2391
- import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
2523
+ import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
2392
2524
  var HighlightedSearchText = ({
2393
2525
  text,
2394
2526
  query
@@ -2404,7 +2536,7 @@ var HighlightedSearchText = ({
2404
2536
  parts.push(text.slice(cursor, matchIndex));
2405
2537
  }
2406
2538
  parts.push(
2407
- /* @__PURE__ */ jsx7("strong", { style: { fontWeight: 700 }, children: text.slice(matchIndex, matchIndex + normalizedQuery.length) }, `${matchIndex}-${cursor}`)
2539
+ /* @__PURE__ */ jsx8("strong", { style: { fontWeight: 700 }, children: text.slice(matchIndex, matchIndex + normalizedQuery.length) }, `${matchIndex}-${cursor}`)
2408
2540
  );
2409
2541
  cursor = matchIndex + normalizedQuery.length;
2410
2542
  matchIndex = normalizedText.indexOf(normalizedQuery, cursor);
@@ -2426,13 +2558,13 @@ var SchematicSearch = ({
2426
2558
  onSelect,
2427
2559
  viewerContainerRef
2428
2560
  }) => {
2429
- const [isOpen, setIsOpen] = useState7(false);
2430
- const [activeResultId, setActiveResultId] = useState7(null);
2431
- const [hoveredResultId, setHoveredResultId] = useState7(null);
2561
+ const [isOpen, setIsOpen] = useState8(false);
2562
+ const [activeResultId, setActiveResultId] = useState8(null);
2563
+ const [hoveredResultId, setHoveredResultId] = useState8(null);
2432
2564
  const inputRef = useRef8(null);
2433
2565
  const resultsListRef = useRef8(null);
2434
2566
  const shortcutLabel = getShortcutLabel();
2435
- useEffect11(() => {
2567
+ useEffect12(() => {
2436
2568
  setActiveResultId((currentId) => {
2437
2569
  if (results.some((result) => result.target.id === currentId)) {
2438
2570
  return currentId;
@@ -2440,11 +2572,11 @@ var SchematicSearch = ({
2440
2572
  return results.find((result) => result.kind === "component")?.target.id ?? results[0]?.target.id ?? null;
2441
2573
  });
2442
2574
  }, [results]);
2443
- useEffect11(() => {
2575
+ useEffect12(() => {
2444
2576
  if (!activeResultId) return;
2445
2577
  resultsListRef.current?.querySelector(`[data-search-result-id="${activeResultId}"]`)?.scrollIntoView({ behavior: "smooth", block: "nearest" });
2446
2578
  }, [activeResultId]);
2447
- useEffect11(() => {
2579
+ useEffect12(() => {
2448
2580
  const handleSearchShortcut = (event) => {
2449
2581
  if (event.key === "Escape" && isOpen) {
2450
2582
  event.preventDefault();
@@ -2545,8 +2677,8 @@ var SchematicSearch = ({
2545
2677
  };
2546
2678
  const renderResultSection = (title, sectionResults) => {
2547
2679
  if (sectionResults.length === 0) return null;
2548
- return /* @__PURE__ */ jsxs5("section", { children: [
2549
- /* @__PURE__ */ jsx7(
2680
+ return /* @__PURE__ */ jsxs6("section", { children: [
2681
+ /* @__PURE__ */ jsx8(
2550
2682
  "div",
2551
2683
  {
2552
2684
  style: {
@@ -2566,16 +2698,16 @@ var SchematicSearch = ({
2566
2698
  const hovering = result.target.id === hoveredResultId;
2567
2699
  let resultBackground = "#ffffff";
2568
2700
  if (hovering || active) resultBackground = "#f1f3f5";
2569
- let resultIcon = /* @__PURE__ */ jsx7(NetIcon, { size: 15, strokeWidth: 1.8 });
2701
+ let resultIcon = /* @__PURE__ */ jsx8(NetIcon, { size: 15, strokeWidth: 1.8 });
2570
2702
  if (result.kind === "component") {
2571
- resultIcon = /* @__PURE__ */ jsx7(ComponentIcon, { size: 15, strokeWidth: 1.8 });
2703
+ resultIcon = /* @__PURE__ */ jsx8(ComponentIcon, { size: 15, strokeWidth: 1.8 });
2572
2704
  }
2573
2705
  const selectResult = () => {
2574
2706
  inputRef.current?.blur();
2575
2707
  setActiveResultId(result.target.id);
2576
2708
  onSelect(result);
2577
2709
  };
2578
- return /* @__PURE__ */ jsxs5(
2710
+ return /* @__PURE__ */ jsxs6(
2579
2711
  "button",
2580
2712
  {
2581
2713
  type: "button",
@@ -2601,7 +2733,7 @@ var SchematicSearch = ({
2601
2733
  textAlign: "left"
2602
2734
  },
2603
2735
  children: [
2604
- /* @__PURE__ */ jsx7(
2736
+ /* @__PURE__ */ jsx8(
2605
2737
  "span",
2606
2738
  {
2607
2739
  style: {
@@ -2618,8 +2750,8 @@ var SchematicSearch = ({
2618
2750
  children: resultIcon
2619
2751
  }
2620
2752
  ),
2621
- /* @__PURE__ */ jsxs5("span", { style: { minWidth: 0, flex: 1 }, children: [
2622
- /* @__PURE__ */ jsx7(
2753
+ /* @__PURE__ */ jsxs6("span", { style: { minWidth: 0, flex: 1 }, children: [
2754
+ /* @__PURE__ */ jsx8(
2623
2755
  "span",
2624
2756
  {
2625
2757
  style: {
@@ -2631,10 +2763,10 @@ var SchematicSearch = ({
2631
2763
  textOverflow: "ellipsis",
2632
2764
  whiteSpace: "nowrap"
2633
2765
  },
2634
- children: /* @__PURE__ */ jsx7(HighlightedSearchText, { text: result.label, query })
2766
+ children: /* @__PURE__ */ jsx8(HighlightedSearchText, { text: result.label, query })
2635
2767
  }
2636
2768
  ),
2637
- result.detail && /* @__PURE__ */ jsx7(
2769
+ result.detail && /* @__PURE__ */ jsx8(
2638
2770
  "span",
2639
2771
  {
2640
2772
  style: {
@@ -2650,7 +2782,7 @@ var SchematicSearch = ({
2650
2782
  children: result.detail
2651
2783
  }
2652
2784
  ),
2653
- result.schematicSheetName && /* @__PURE__ */ jsxs5(
2785
+ result.schematicSheetName && /* @__PURE__ */ jsxs6(
2654
2786
  "span",
2655
2787
  {
2656
2788
  style: {
@@ -2670,7 +2802,7 @@ var SchematicSearch = ({
2670
2802
  }
2671
2803
  )
2672
2804
  ] }),
2673
- active && /* @__PURE__ */ jsx7(
2805
+ active && /* @__PURE__ */ jsx8(
2674
2806
  "span",
2675
2807
  {
2676
2808
  title: "Press Enter to open",
@@ -2680,7 +2812,7 @@ var SchematicSearch = ({
2680
2812
  fontSize: "17px",
2681
2813
  lineHeight: 1
2682
2814
  },
2683
- children: /* @__PURE__ */ jsx7(EnterIcon, { size: 14, strokeWidth: 1.8 })
2815
+ children: /* @__PURE__ */ jsx8(EnterIcon, { size: 14, strokeWidth: 1.8 })
2684
2816
  }
2685
2817
  )
2686
2818
  ]
@@ -2690,7 +2822,7 @@ var SchematicSearch = ({
2690
2822
  })
2691
2823
  ] });
2692
2824
  };
2693
- return /* @__PURE__ */ jsx7(
2825
+ return /* @__PURE__ */ jsx8(
2694
2826
  "div",
2695
2827
  {
2696
2828
  "data-schematic-search": true,
@@ -2703,7 +2835,7 @@ var SchematicSearch = ({
2703
2835
  zIndex: zIndexMap.schematicSearch,
2704
2836
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
2705
2837
  },
2706
- children: !isOpen ? /* @__PURE__ */ jsx7(
2838
+ children: !isOpen ? /* @__PURE__ */ jsx8(
2707
2839
  "button",
2708
2840
  {
2709
2841
  type: "button",
@@ -2734,9 +2866,9 @@ var SchematicSearch = ({
2734
2866
  cursor: "pointer",
2735
2867
  boxShadow: "0 2px 4px rgba(0,0,0,0.1)"
2736
2868
  },
2737
- children: /* @__PURE__ */ jsx7(SearchIcon, { size: 16, strokeWidth: 2 })
2869
+ children: /* @__PURE__ */ jsx8(SearchIcon, { size: 16, strokeWidth: 2 })
2738
2870
  }
2739
- ) : /* @__PURE__ */ jsxs5(
2871
+ ) : /* @__PURE__ */ jsxs6(
2740
2872
  "div",
2741
2873
  {
2742
2874
  onKeyDown: handleSearchKeyDown,
@@ -2749,7 +2881,7 @@ var SchematicSearch = ({
2749
2881
  boxShadow: "0 2px 4px rgba(0,0,0,0.1)"
2750
2882
  },
2751
2883
  children: [
2752
- /* @__PURE__ */ jsxs5(
2884
+ /* @__PURE__ */ jsxs6(
2753
2885
  "div",
2754
2886
  {
2755
2887
  style: {
@@ -2762,8 +2894,8 @@ var SchematicSearch = ({
2762
2894
  borderBottom: searchHeaderBorder
2763
2895
  },
2764
2896
  children: [
2765
- /* @__PURE__ */ jsx7(SearchIcon, { size: 15, strokeWidth: 2 }),
2766
- /* @__PURE__ */ jsx7(
2897
+ /* @__PURE__ */ jsx8(SearchIcon, { size: 15, strokeWidth: 2 }),
2898
+ /* @__PURE__ */ jsx8(
2767
2899
  "input",
2768
2900
  {
2769
2901
  ref: inputRef,
@@ -2783,7 +2915,7 @@ var SchematicSearch = ({
2783
2915
  }
2784
2916
  }
2785
2917
  ),
2786
- query && results.length > 0 ? /* @__PURE__ */ jsx7(
2918
+ query && results.length > 0 ? /* @__PURE__ */ jsx8(
2787
2919
  "span",
2788
2920
  {
2789
2921
  style: {
@@ -2794,7 +2926,7 @@ var SchematicSearch = ({
2794
2926
  },
2795
2927
  children: resultCountLabel
2796
2928
  }
2797
- ) : /* @__PURE__ */ jsx7(
2929
+ ) : /* @__PURE__ */ jsx8(
2798
2930
  "kbd",
2799
2931
  {
2800
2932
  style: {
@@ -2811,7 +2943,7 @@ var SchematicSearch = ({
2811
2943
  children: shortcutLabel
2812
2944
  }
2813
2945
  ),
2814
- isOpen && /* @__PURE__ */ jsx7(
2946
+ isOpen && /* @__PURE__ */ jsx8(
2815
2947
  "button",
2816
2948
  {
2817
2949
  type: "button",
@@ -2834,13 +2966,13 @@ var SchematicSearch = ({
2834
2966
  padding: 0,
2835
2967
  lineHeight: 1
2836
2968
  },
2837
- children: /* @__PURE__ */ jsx7(CloseIcon, { size: 16, strokeWidth: 2 })
2969
+ children: /* @__PURE__ */ jsx8(CloseIcon, { size: 16, strokeWidth: 2 })
2838
2970
  }
2839
2971
  )
2840
2972
  ]
2841
2973
  }
2842
2974
  ),
2843
- query && /* @__PURE__ */ jsx7(
2975
+ query && /* @__PURE__ */ jsx8(
2844
2976
  "div",
2845
2977
  {
2846
2978
  ref: resultsListRef,
@@ -2855,7 +2987,7 @@ var SchematicSearch = ({
2855
2987
  },
2856
2988
  onWheel: (event) => event.stopPropagation(),
2857
2989
  onTouchMove: (event) => event.stopPropagation(),
2858
- children: results.length === 0 ? /* @__PURE__ */ jsx7(
2990
+ children: results.length === 0 ? /* @__PURE__ */ jsx8(
2859
2991
  "div",
2860
2992
  {
2861
2993
  style: {
@@ -2865,7 +2997,7 @@ var SchematicSearch = ({
2865
2997
  },
2866
2998
  children: "No matching components or nets"
2867
2999
  }
2868
- ) : /* @__PURE__ */ jsxs5(Fragment4, { children: [
3000
+ ) : /* @__PURE__ */ jsxs6(Fragment5, { children: [
2869
3001
  renderResultSection("components", componentResults),
2870
3002
  renderResultSection("nets", netResults)
2871
3003
  ] })
@@ -2879,9 +3011,9 @@ var SchematicSearch = ({
2879
3011
  };
2880
3012
 
2881
3013
  // lib/components/SchematicSheetSelector.tsx
2882
- import { useState as useState8 } from "react";
3014
+ import { useState as useState9 } from "react";
2883
3015
  import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
2884
- import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
3016
+ import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
2885
3017
  var FONT_FAMILY = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
2886
3018
  var contentStyles = {
2887
3019
  backgroundColor: "#ffffff",
@@ -2931,7 +3063,7 @@ var MENU_CSS = `
2931
3063
  .sv-sheet-chevron { transition: transform 0.2s ease; }
2932
3064
  [data-state="open"] > .sv-sheet-chevron { transform: rotate(180deg); }
2933
3065
  `;
2934
- var CheckIcon = () => /* @__PURE__ */ jsx8(
3066
+ var CheckIcon = () => /* @__PURE__ */ jsx9(
2935
3067
  "svg",
2936
3068
  {
2937
3069
  width: "14",
@@ -2943,10 +3075,10 @@ var CheckIcon = () => /* @__PURE__ */ jsx8(
2943
3075
  strokeLinecap: "round",
2944
3076
  strokeLinejoin: "round",
2945
3077
  "aria-hidden": "true",
2946
- children: /* @__PURE__ */ jsx8("path", { d: "M20 6 9 17l-5-5" })
3078
+ children: /* @__PURE__ */ jsx9("path", { d: "M20 6 9 17l-5-5" })
2947
3079
  }
2948
3080
  );
2949
- var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx8(
3081
+ var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx9(
2950
3082
  "svg",
2951
3083
  {
2952
3084
  className,
@@ -2960,7 +3092,7 @@ var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx8(
2960
3092
  strokeLinejoin: "round",
2961
3093
  style: { opacity: 0.6, flexShrink: 0 },
2962
3094
  "aria-hidden": "true",
2963
- children: /* @__PURE__ */ jsx8("path", { d: "m6 9 6 6 6-6" })
3095
+ children: /* @__PURE__ */ jsx9("path", { d: "m6 9 6 6 6-6" })
2964
3096
  }
2965
3097
  );
2966
3098
  var SchematicSheetSelector = ({
@@ -2968,16 +3100,16 @@ var SchematicSheetSelector = ({
2968
3100
  selectedSheetId,
2969
3101
  onSelectSheet
2970
3102
  }) => {
2971
- const [open, setOpen] = useState8(false);
3103
+ const [open, setOpen] = useState9(false);
2972
3104
  if (sheets.length <= 1) return null;
2973
3105
  const selectedSheet = sheets.find(
2974
3106
  (s) => s.schematic_sheet_id === selectedSheetId
2975
3107
  );
2976
3108
  const selectedLabel = selectedSheet?.name ?? "Select sheet";
2977
- return /* @__PURE__ */ jsxs6(Fragment5, { children: [
2978
- /* @__PURE__ */ jsx8("style", { children: MENU_CSS }),
2979
- /* @__PURE__ */ jsxs6(DropdownMenu.Root, { open, onOpenChange: setOpen, modal: false, children: [
2980
- /* @__PURE__ */ jsx8(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs6(
3109
+ return /* @__PURE__ */ jsxs7(Fragment6, { children: [
3110
+ /* @__PURE__ */ jsx9("style", { children: MENU_CSS }),
3111
+ /* @__PURE__ */ jsxs7(DropdownMenu.Root, { open, onOpenChange: setOpen, modal: false, children: [
3112
+ /* @__PURE__ */ jsx9(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs7(
2981
3113
  "button",
2982
3114
  {
2983
3115
  type: "button",
@@ -3002,13 +3134,13 @@ var SchematicSheetSelector = ({
3002
3134
  fontFamily: FONT_FAMILY
3003
3135
  },
3004
3136
  children: [
3005
- /* @__PURE__ */ jsx8("span", { style: { color: "#888888", flexShrink: 0 }, children: "Sheet:" }),
3006
- /* @__PURE__ */ jsx8("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: selectedLabel }),
3007
- /* @__PURE__ */ jsx8(ChevronDownIcon, { className: "sv-sheet-chevron" })
3137
+ /* @__PURE__ */ jsx9("span", { style: { color: "#888888", flexShrink: 0 }, children: "Sheet:" }),
3138
+ /* @__PURE__ */ jsx9("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: selectedLabel }),
3139
+ /* @__PURE__ */ jsx9(ChevronDownIcon, { className: "sv-sheet-chevron" })
3008
3140
  ]
3009
3141
  }
3010
3142
  ) }),
3011
- /* @__PURE__ */ jsx8(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx8(
3143
+ /* @__PURE__ */ jsx9(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx9(
3012
3144
  DropdownMenu.Content,
3013
3145
  {
3014
3146
  style: contentStyles,
@@ -3018,7 +3150,7 @@ var SchematicSheetSelector = ({
3018
3150
  collisionPadding: 10,
3019
3151
  children: sheets.map((sheet) => {
3020
3152
  const selected = sheet.schematic_sheet_id === selectedSheetId;
3021
- return /* @__PURE__ */ jsxs6(
3153
+ return /* @__PURE__ */ jsxs7(
3022
3154
  DropdownMenu.Item,
3023
3155
  {
3024
3156
  className: "sv-sheet-item",
@@ -3030,8 +3162,8 @@ var SchematicSheetSelector = ({
3030
3162
  setOpen(false);
3031
3163
  },
3032
3164
  children: [
3033
- /* @__PURE__ */ jsx8("span", { style: iconSlotStyles, children: selected && /* @__PURE__ */ jsx8(CheckIcon, {}) }),
3034
- /* @__PURE__ */ jsx8("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: sheet.name })
3165
+ /* @__PURE__ */ jsx9("span", { style: iconSlotStyles, children: selected && /* @__PURE__ */ jsx9(CheckIcon, {}) }),
3166
+ /* @__PURE__ */ jsx9("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: sheet.name })
3035
3167
  ]
3036
3168
  },
3037
3169
  sheet.schematic_sheet_id
@@ -3044,14 +3176,14 @@ var SchematicSheetSelector = ({
3044
3176
  };
3045
3177
 
3046
3178
  // lib/components/SchematicWarningsButton.tsx
3047
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
3179
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
3048
3180
  var SchematicWarningsButton = ({
3049
3181
  count,
3050
3182
  showWarnings,
3051
3183
  onToggle
3052
3184
  }) => {
3053
3185
  const label = `${showWarnings ? "Hide" : "Show"} ${count} ${count === 1 ? "warning" : "warnings"}`;
3054
- return /* @__PURE__ */ jsxs7(
3186
+ return /* @__PURE__ */ jsxs8(
3055
3187
  "button",
3056
3188
  {
3057
3189
  type: "button",
@@ -3081,7 +3213,7 @@ var SchematicWarningsButton = ({
3081
3213
  fontWeight: 600
3082
3214
  },
3083
3215
  children: [
3084
- /* @__PURE__ */ jsxs7(
3216
+ /* @__PURE__ */ jsxs8(
3085
3217
  "svg",
3086
3218
  {
3087
3219
  width: "16",
@@ -3094,12 +3226,12 @@ var SchematicWarningsButton = ({
3094
3226
  strokeLinejoin: "round",
3095
3227
  "aria-hidden": "true",
3096
3228
  children: [
3097
- /* @__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" }),
3098
- /* @__PURE__ */ jsx9("path", { d: "M12 9v4m0 4h.01" })
3229
+ /* @__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" }),
3230
+ /* @__PURE__ */ jsx10("path", { d: "M12 9v4m0 4h.01" })
3099
3231
  ]
3100
3232
  }
3101
3233
  ),
3102
- /* @__PURE__ */ jsx9("span", { children: count })
3234
+ /* @__PURE__ */ jsx10("span", { children: count })
3103
3235
  ]
3104
3236
  }
3105
3237
  );
@@ -3113,7 +3245,7 @@ import { useMemo as useMemo5 } from "react";
3113
3245
  // package.json
3114
3246
  var package_default = {
3115
3247
  name: "@tscircuit/schematic-viewer",
3116
- version: "2.0.99",
3248
+ version: "2.0.100",
3117
3249
  repository: {
3118
3250
  type: "git",
3119
3251
  url: "https://github.com/tscircuit/schematic-viewer"
@@ -3169,7 +3301,7 @@ var package_default = {
3169
3301
  };
3170
3302
 
3171
3303
  // lib/components/ViewMenu.tsx
3172
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
3304
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
3173
3305
  var FONT_FAMILY2 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
3174
3306
  var contentStyles2 = {
3175
3307
  backgroundColor: "#262626",
@@ -3218,7 +3350,7 @@ var HIGHLIGHT_CSS = `
3218
3350
  .sv-vm-item:hover:not([data-disabled]) { background-color: #404040; }
3219
3351
  .sv-vm-item[data-disabled] { opacity: 0.45; cursor: not-allowed; }
3220
3352
  `;
3221
- var CheckIcon2 = () => /* @__PURE__ */ jsx10(
3353
+ var CheckIcon2 = () => /* @__PURE__ */ jsx11(
3222
3354
  "svg",
3223
3355
  {
3224
3356
  width: "14",
@@ -3230,7 +3362,7 @@ var CheckIcon2 = () => /* @__PURE__ */ jsx10(
3230
3362
  strokeLinecap: "round",
3231
3363
  strokeLinejoin: "round",
3232
3364
  "aria-hidden": "true",
3233
- children: /* @__PURE__ */ jsx10("path", { d: "M20 6 9 17l-5-5" })
3365
+ children: /* @__PURE__ */ jsx11("path", { d: "M20 6 9 17l-5-5" })
3234
3366
  }
3235
3367
  );
3236
3368
  var ViewMenu = ({
@@ -3284,7 +3416,7 @@ var ViewMenu = ({
3284
3416
  return false;
3285
3417
  }
3286
3418
  }, [circuitJsonKey]);
3287
- return /* @__PURE__ */ jsx10(
3419
+ return /* @__PURE__ */ jsx11(
3288
3420
  "div",
3289
3421
  {
3290
3422
  ref: menuRef,
@@ -3295,9 +3427,9 @@ var ViewMenu = ({
3295
3427
  width: 0,
3296
3428
  height: 0
3297
3429
  },
3298
- children: /* @__PURE__ */ jsxs8(DropdownMenu2.Root, { open: true, onOpenChange, modal: false, children: [
3299
- /* @__PURE__ */ jsx10(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx10("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
3300
- /* @__PURE__ */ jsx10(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs8(
3430
+ children: /* @__PURE__ */ jsxs9(DropdownMenu2.Root, { open: true, onOpenChange, modal: false, children: [
3431
+ /* @__PURE__ */ jsx11(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx11("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
3432
+ /* @__PURE__ */ jsx11(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs9(
3301
3433
  DropdownMenu2.Content,
3302
3434
  {
3303
3435
  style: contentStyles2,
@@ -3306,20 +3438,20 @@ var ViewMenu = ({
3306
3438
  collisionPadding: 10,
3307
3439
  avoidCollisions: true,
3308
3440
  children: [
3309
- /* @__PURE__ */ jsx10("style", { children: HIGHLIGHT_CSS }),
3310
- netLocations.length > 0 && /* @__PURE__ */ jsxs8(DropdownMenu2.Sub, { children: [
3311
- /* @__PURE__ */ jsxs8(
3441
+ /* @__PURE__ */ jsx11("style", { children: HIGHLIGHT_CSS }),
3442
+ netLocations.length > 0 && /* @__PURE__ */ jsxs9(DropdownMenu2.Sub, { children: [
3443
+ /* @__PURE__ */ jsxs9(
3312
3444
  DropdownMenu2.SubTrigger,
3313
3445
  {
3314
3446
  className: "sv-vm-item",
3315
3447
  style: itemStyles2,
3316
3448
  children: [
3317
3449
  "Net Locations ",
3318
- /* @__PURE__ */ jsx10("span", { style: { marginLeft: "auto" }, children: "\u203A" })
3450
+ /* @__PURE__ */ jsx11("span", { style: { marginLeft: "auto" }, children: "\u203A" })
3319
3451
  ]
3320
3452
  }
3321
3453
  ),
3322
- /* @__PURE__ */ jsx10(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsx10(
3454
+ /* @__PURE__ */ jsx11(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsx11(
3323
3455
  DropdownMenu2.SubContent,
3324
3456
  {
3325
3457
  style: {
@@ -3328,7 +3460,7 @@ var ViewMenu = ({
3328
3460
  overflowY: "auto"
3329
3461
  },
3330
3462
  collisionPadding: 10,
3331
- children: netLocations.map((location, index) => /* @__PURE__ */ jsx10(
3463
+ children: netLocations.map((location, index) => /* @__PURE__ */ jsx11(
3332
3464
  DropdownMenu2.Item,
3333
3465
  {
3334
3466
  className: "sv-vm-item",
@@ -3341,7 +3473,7 @@ var ViewMenu = ({
3341
3473
  }
3342
3474
  ) })
3343
3475
  ] }),
3344
- /* @__PURE__ */ jsxs8(
3476
+ /* @__PURE__ */ jsxs9(
3345
3477
  DropdownMenu2.Item,
3346
3478
  {
3347
3479
  className: "sv-vm-item",
@@ -3354,12 +3486,12 @@ var ViewMenu = ({
3354
3486
  if (hasPorts) onTogglePorts(!showPorts);
3355
3487
  },
3356
3488
  children: [
3357
- /* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: showPorts && /* @__PURE__ */ jsx10(CheckIcon2, {}) }),
3358
- /* @__PURE__ */ jsx10("span", { children: "Show Schematic Ports" })
3489
+ /* @__PURE__ */ jsx11("span", { style: iconSlotStyles2, children: showPorts && /* @__PURE__ */ jsx11(CheckIcon2, {}) }),
3490
+ /* @__PURE__ */ jsx11("span", { children: "Show Schematic Ports" })
3359
3491
  ]
3360
3492
  }
3361
3493
  ),
3362
- /* @__PURE__ */ jsxs8(
3494
+ /* @__PURE__ */ jsxs9(
3363
3495
  DropdownMenu2.Item,
3364
3496
  {
3365
3497
  className: "sv-vm-item",
@@ -3372,12 +3504,12 @@ var ViewMenu = ({
3372
3504
  if (hasGroups) onToggleGroups(!showGroups);
3373
3505
  },
3374
3506
  children: [
3375
- /* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: showGroups && /* @__PURE__ */ jsx10(CheckIcon2, {}) }),
3376
- /* @__PURE__ */ jsx10("span", { children: "View Schematic Groups" })
3507
+ /* @__PURE__ */ jsx11("span", { style: iconSlotStyles2, children: showGroups && /* @__PURE__ */ jsx11(CheckIcon2, {}) }),
3508
+ /* @__PURE__ */ jsx11("span", { children: "View Schematic Groups" })
3377
3509
  ]
3378
3510
  }
3379
3511
  ),
3380
- /* @__PURE__ */ jsxs8(
3512
+ /* @__PURE__ */ jsxs9(
3381
3513
  DropdownMenu2.Item,
3382
3514
  {
3383
3515
  className: "sv-vm-item",
@@ -3388,12 +3520,12 @@ var ViewMenu = ({
3388
3520
  onToggleGrid(!showGrid);
3389
3521
  },
3390
3522
  children: [
3391
- /* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: showGrid && /* @__PURE__ */ jsx10(CheckIcon2, {}) }),
3392
- /* @__PURE__ */ jsx10("span", { children: "Show Grid" })
3523
+ /* @__PURE__ */ jsx11("span", { style: iconSlotStyles2, children: showGrid && /* @__PURE__ */ jsx11(CheckIcon2, {}) }),
3524
+ /* @__PURE__ */ jsx11("span", { children: "Show Grid" })
3393
3525
  ]
3394
3526
  }
3395
3527
  ),
3396
- /* @__PURE__ */ jsxs8(
3528
+ /* @__PURE__ */ jsxs9(
3397
3529
  DropdownMenu2.CheckboxItem,
3398
3530
  {
3399
3531
  className: "sv-vm-item",
@@ -3402,26 +3534,26 @@ var ViewMenu = ({
3402
3534
  onCheckedChange: onToggleWarnings,
3403
3535
  onSelect: (event) => event.preventDefault(),
3404
3536
  children: [
3405
- /* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: /* @__PURE__ */ jsx10(DropdownMenu2.ItemIndicator, { children: /* @__PURE__ */ jsx10(CheckIcon2, {}) }) }),
3406
- /* @__PURE__ */ jsx10("span", { children: "Show Warnings" })
3537
+ /* @__PURE__ */ jsx11("span", { style: iconSlotStyles2, children: /* @__PURE__ */ jsx11(DropdownMenu2.ItemIndicator, { children: /* @__PURE__ */ jsx11(CheckIcon2, {}) }) }),
3538
+ /* @__PURE__ */ jsx11("span", { children: "Show Warnings" })
3407
3539
  ]
3408
3540
  }
3409
3541
  ),
3410
- /* @__PURE__ */ jsx10(DropdownMenu2.Separator, { style: separatorStyles }),
3411
- /* @__PURE__ */ jsxs8(
3542
+ /* @__PURE__ */ jsx11(DropdownMenu2.Separator, { style: separatorStyles }),
3543
+ /* @__PURE__ */ jsxs9(
3412
3544
  DropdownMenu2.Item,
3413
3545
  {
3414
3546
  className: "sv-vm-item",
3415
3547
  style: itemStyles2,
3416
3548
  onSelect: onRunStyleAnalysis,
3417
3549
  children: [
3418
- /* @__PURE__ */ jsx10("span", { style: iconSlotStyles2 }),
3419
- /* @__PURE__ */ jsx10("span", { children: "Run Style Analysis" })
3550
+ /* @__PURE__ */ jsx11("span", { style: iconSlotStyles2 }),
3551
+ /* @__PURE__ */ jsx11("span", { children: "Run Style Analysis" })
3420
3552
  ]
3421
3553
  }
3422
3554
  ),
3423
- /* @__PURE__ */ jsx10(DropdownMenu2.Separator, { style: separatorStyles }),
3424
- /* @__PURE__ */ jsxs8(
3555
+ /* @__PURE__ */ jsx11(DropdownMenu2.Separator, { style: separatorStyles }),
3556
+ /* @__PURE__ */ jsxs9(
3425
3557
  "div",
3426
3558
  {
3427
3559
  style: {
@@ -3447,7 +3579,7 @@ var ViewMenu = ({
3447
3579
  };
3448
3580
 
3449
3581
  // lib/components/SchematicViewer.tsx
3450
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
3582
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
3451
3583
  var SchematicViewer = ({
3452
3584
  circuitJson,
3453
3585
  containerStyle,
@@ -3486,7 +3618,7 @@ var SchematicViewer = ({
3486
3618
  }, [circuitJsonKey]);
3487
3619
  const hasMultipleSheets = schematicSheets.length > 1;
3488
3620
  const defaultSheetId = schematicSheets[0]?.schematic_sheet_id;
3489
- const [selectedSheetId, setSelectedSheetId] = useState9(
3621
+ const [selectedSheetId, setSelectedSheetId] = useState10(
3490
3622
  () => {
3491
3623
  const stored = getStoredString(STORAGE_KEYS.SELECTED_SCHEMATIC_SHEET);
3492
3624
  if (stored && schematicSheets.some((s) => s.schematic_sheet_id === stored)) {
@@ -3495,7 +3627,7 @@ var SchematicViewer = ({
3495
3627
  return defaultSheetId;
3496
3628
  }
3497
3629
  );
3498
- useEffect12(() => {
3630
+ useEffect13(() => {
3499
3631
  const stillExists = selectedSheetId !== void 0 && schematicSheets.some((s) => s.schematic_sheet_id === selectedSheetId);
3500
3632
  if (!stillExists) {
3501
3633
  setSelectedSheetId(defaultSheetId);
@@ -3510,31 +3642,31 @@ var SchematicViewer = ({
3510
3642
  },
3511
3643
  [onSchematicSheetChange]
3512
3644
  );
3513
- const [showGridInternal, setShowGridInternal] = useState9(false);
3514
- const [analysisCircuitJson, setAnalysisCircuitJson] = useState9(null);
3515
- const [showWarnings, setShowWarnings] = useState9(false);
3645
+ const [showGridInternal, setShowGridInternal] = useState10(false);
3646
+ const [analysisCircuitJson, setAnalysisCircuitJson] = useState10(null);
3647
+ const [showWarnings, setShowWarnings] = useState10(false);
3516
3648
  const warningCount = circuitJson.filter(
3517
3649
  (element) => element.type.startsWith("schematic_") && element.type.endsWith("_warning")
3518
3650
  ).length;
3519
3651
  const showGrid = debugGrid || showGridInternal;
3520
- const [isInteractionEnabled, setIsInteractionEnabled] = useState9(
3652
+ const [isInteractionEnabled, setIsInteractionEnabled] = useState10(
3521
3653
  !clickToInteractEnabled
3522
3654
  );
3523
- const [showSchematicGroups, setShowSchematicGroups] = useState9(() => {
3655
+ const [showSchematicGroups, setShowSchematicGroups] = useState10(() => {
3524
3656
  if (disableGroups) return false;
3525
3657
  return getStoredBoolean(STORAGE_KEYS.IS_SHOWING_SCHEMATIC_GROUPS, false);
3526
3658
  });
3527
- const [showSchematicPortsInternal, setShowSchematicPortsInternal] = useState9(
3659
+ const [showSchematicPortsInternal, setShowSchematicPortsInternal] = useState10(
3528
3660
  () => showSchematicPorts ?? getStoredBoolean(STORAGE_KEYS.IS_SHOWING_SCHEMATIC_PORTS, false)
3529
3661
  );
3530
- useEffect12(() => {
3662
+ useEffect13(() => {
3531
3663
  if (showSchematicPorts !== void 0) {
3532
3664
  setShowSchematicPortsInternal(showSchematicPorts);
3533
3665
  }
3534
3666
  }, [showSchematicPorts]);
3535
- const [isHoveringClickableComponent, setIsHoveringClickableComponent] = useState9(false);
3667
+ const [isHoveringClickableComponent, setIsHoveringClickableComponent] = useState10(false);
3536
3668
  const hoveringComponentsRef = useRef9(/* @__PURE__ */ new Set());
3537
- const [selectedSchematicComponent, setSelectedSchematicComponent] = useState9(null);
3669
+ const [selectedSchematicComponent, setSelectedSchematicComponent] = useState10(null);
3538
3670
  const handleComponentHoverChange = useCallback7(
3539
3671
  (componentId, isHovering) => {
3540
3672
  if (isHovering) {
@@ -3546,7 +3678,7 @@ var SchematicViewer = ({
3546
3678
  },
3547
3679
  []
3548
3680
  );
3549
- const [isHoveringClickablePort, setIsHoveringClickablePort] = useState9(false);
3681
+ const [isHoveringClickablePort, setIsHoveringClickablePort] = useState10(false);
3550
3682
  const hoveringPortsRef = useRef9(/* @__PURE__ */ new Set());
3551
3683
  const handlePortHoverChange = useCallback7(
3552
3684
  (portId, isHovering) => {
@@ -3699,10 +3831,10 @@ var SchematicViewer = ({
3699
3831
  },
3700
3832
  [containerRef, onSchematicComponentClicked]
3701
3833
  );
3702
- useEffect12(() => {
3834
+ useEffect13(() => {
3703
3835
  setSelectedSchematicComponent(null);
3704
3836
  }, [circuitJsonKey, activeSheetId]);
3705
- useEffect12(() => {
3837
+ useEffect13(() => {
3706
3838
  if (!selectedSchematicComponent) return;
3707
3839
  const handleKeyDown = (event) => {
3708
3840
  if (event.key === "Escape") {
@@ -3786,7 +3918,7 @@ var SchematicViewer = ({
3786
3918
  enabled: netHoverHighlightEnabled
3787
3919
  });
3788
3920
  const svgDiv = useMemo6(
3789
- () => /* @__PURE__ */ jsx11(
3921
+ () => /* @__PURE__ */ jsx12(
3790
3922
  "div",
3791
3923
  {
3792
3924
  ref: svgDivRef,
@@ -3801,10 +3933,10 @@ var SchematicViewer = ({
3801
3933
  [svgString, isInteractionEnabled, clickToInteractEnabled]
3802
3934
  );
3803
3935
  useSchematicWarnings({ svgDivRef, svgContent: svgDiv, circuitJsonKey });
3804
- return /* @__PURE__ */ jsxs9(MouseTracker, { children: [
3805
- netHoverHighlightEnabled && /* @__PURE__ */ jsx11("style", { children: `.sch-net-faded { opacity: 0.35; }
3936
+ return /* @__PURE__ */ jsxs10(MouseTracker, { children: [
3937
+ netHoverHighlightEnabled && /* @__PURE__ */ jsx12("style", { children: `.sch-net-faded { opacity: 0.35; }
3806
3938
  svg :is(g.trace, g.trace-overlays, g[data-schematic-component-id], [data-schematic-net-label-id]) { transition: opacity 0.12s ease-in-out; }` }),
3807
- searchEnabled && /* @__PURE__ */ jsx11("style", { children: `.schematic-search-match text,
3939
+ searchEnabled && /* @__PURE__ */ jsx12("style", { children: `.schematic-search-match text,
3808
3940
  text.schematic-search-match {
3809
3941
  fill: #ff00d4 !important;
3810
3942
  }
@@ -3820,9 +3952,9 @@ var SchematicViewer = ({
3820
3952
  flex-direction: column;
3821
3953
  }
3822
3954
  }` }),
3823
- /* @__PURE__ */ jsx11("style", { children: ".schematic-component-clickable [data-schematic-component-id]:hover { cursor: pointer !important; }" }),
3824
- onSchematicPortClicked && /* @__PURE__ */ jsx11("style", { children: "[data-schematic-port-id]:hover { cursor: pointer !important; }" }),
3825
- /* @__PURE__ */ jsxs9(
3955
+ /* @__PURE__ */ jsx12("style", { children: ".schematic-component-clickable [data-schematic-component-id]:hover { cursor: pointer !important; }" }),
3956
+ onSchematicPortClicked && /* @__PURE__ */ jsx12("style", { children: "[data-schematic-port-id]:hover { cursor: pointer !important; }" }),
3957
+ /* @__PURE__ */ jsxs10(
3826
3958
  "div",
3827
3959
  {
3828
3960
  ref: containerRef,
@@ -3857,7 +3989,7 @@ var SchematicViewer = ({
3857
3989
  },
3858
3990
  onTouchCancel: contextMenuEventHandlers.onTouchCancel,
3859
3991
  children: [
3860
- !isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */ jsx11(
3992
+ !isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */ jsx12(
3861
3993
  "div",
3862
3994
  {
3863
3995
  onClick: (e) => {
@@ -3876,7 +4008,7 @@ var SchematicViewer = ({
3876
4008
  pointerEvents: "all",
3877
4009
  touchAction: "pan-x pan-y pinch-zoom"
3878
4010
  },
3879
- children: /* @__PURE__ */ jsx11(
4011
+ children: /* @__PURE__ */ jsx12(
3880
4012
  "div",
3881
4013
  {
3882
4014
  style: {
@@ -3893,14 +4025,14 @@ var SchematicViewer = ({
3893
4025
  )
3894
4026
  }
3895
4027
  ),
3896
- analysisCircuitJson && /* @__PURE__ */ jsx11(
4028
+ analysisCircuitJson && /* @__PURE__ */ jsx12(
3897
4029
  StyleAnalysisDialog,
3898
4030
  {
3899
4031
  circuitJson: analysisCircuitJson,
3900
4032
  onClose: () => setAnalysisCircuitJson(null)
3901
4033
  }
3902
4034
  ),
3903
- menuVisible && /* @__PURE__ */ jsx11(
4035
+ menuVisible && /* @__PURE__ */ jsx12(
3904
4036
  ViewMenu,
3905
4037
  {
3906
4038
  circuitJson,
@@ -3941,7 +4073,7 @@ var SchematicViewer = ({
3941
4073
  onToggleGrid: setShowGridInternal
3942
4074
  }
3943
4075
  ),
3944
- /* @__PURE__ */ jsxs9(
4076
+ /* @__PURE__ */ jsxs10(
3945
4077
  "div",
3946
4078
  {
3947
4079
  className: "schematic-viewer-toolbar",
@@ -3955,7 +4087,7 @@ var SchematicViewer = ({
3955
4087
  zIndex: zIndexMap.schematicSearch
3956
4088
  },
3957
4089
  children: [
3958
- /* @__PURE__ */ jsx11(
4090
+ /* @__PURE__ */ jsx12(
3959
4091
  SchematicSheetSelector,
3960
4092
  {
3961
4093
  sheets: schematicSheets,
@@ -3963,7 +4095,7 @@ var SchematicViewer = ({
3963
4095
  onSelectSheet: handleSelectSheet
3964
4096
  }
3965
4097
  ),
3966
- searchEnabled && /* @__PURE__ */ jsx11(
4098
+ searchEnabled && /* @__PURE__ */ jsx12(
3967
4099
  SchematicSearch,
3968
4100
  {
3969
4101
  query: searchQuery,
@@ -3974,7 +4106,7 @@ var SchematicViewer = ({
3974
4106
  viewerContainerRef: containerRef
3975
4107
  }
3976
4108
  ),
3977
- warningCount > 0 && /* @__PURE__ */ jsx11(
4109
+ warningCount > 0 && /* @__PURE__ */ jsx12(
3978
4110
  SchematicWarningsButton,
3979
4111
  {
3980
4112
  count: warningCount,
@@ -3985,7 +4117,7 @@ var SchematicViewer = ({
3985
4117
  ]
3986
4118
  }
3987
4119
  ),
3988
- schematicComponentIds.map((componentId) => /* @__PURE__ */ jsx11(
4120
+ schematicComponentIds.map((componentId) => /* @__PURE__ */ jsx12(
3989
4121
  SchematicComponentMouseTarget,
3990
4122
  {
3991
4123
  componentId,
@@ -3999,7 +4131,7 @@ var SchematicViewer = ({
3999
4131
  componentId
4000
4132
  )),
4001
4133
  svgDiv,
4002
- selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */ jsx11(
4134
+ selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */ jsx12(
4003
4135
  SchematicComponentDetailsTooltip,
4004
4136
  {
4005
4137
  sourceComponent: selectedComponentDetails.sourceComponent,
@@ -4010,7 +4142,7 @@ var SchematicViewer = ({
4010
4142
  ...componentTooltipLayout
4011
4143
  }
4012
4144
  ),
4013
- showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */ jsx11(
4145
+ showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */ jsx12(
4014
4146
  SchematicPortMouseTarget,
4015
4147
  {
4016
4148
  portId,
@@ -4040,7 +4172,7 @@ import {
4040
4172
  convertCircuitJsonToSchematicSimulationSvg,
4041
4173
  convertCircuitJsonToSimulationGraphSvg
4042
4174
  } from "circuit-to-svg";
4043
- import { useEffect as useEffect13, useMemo as useMemo7, useRef as useRef10, useState as useState11 } from "react";
4175
+ import { useEffect as useEffect14, useMemo as useMemo7, useRef as useRef10, useState as useState12 } from "react";
4044
4176
  import { toString as transformToString2 } from "transformation-matrix";
4045
4177
  import { useMouseMatrixTransform as useMouseMatrixTransform2 } from "use-mouse-matrix-transform";
4046
4178
 
@@ -4058,8 +4190,8 @@ var getAnalogSimulationBackgroundColor = (simulationSvg, colorOverrides) => getR
4058
4190
 
4059
4191
  // lib/components/AnalogSimulationSelector.tsx
4060
4192
  import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
4061
- import { useState as useState10 } from "react";
4062
- import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
4193
+ import { useState as useState11 } from "react";
4194
+ import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
4063
4195
  var FONT_FAMILY3 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
4064
4196
  var contentStyles3 = {
4065
4197
  backgroundColor: "#ffffff",
@@ -4109,7 +4241,7 @@ var MENU_CSS2 = `
4109
4241
  .sv-simulation-chevron { transition: transform 0.2s ease; }
4110
4242
  [data-state="open"] > .sv-simulation-chevron { transform: rotate(180deg); }
4111
4243
  `;
4112
- var CheckIcon3 = () => /* @__PURE__ */ jsx12(
4244
+ var CheckIcon3 = () => /* @__PURE__ */ jsx13(
4113
4245
  "svg",
4114
4246
  {
4115
4247
  width: "14",
@@ -4121,10 +4253,10 @@ var CheckIcon3 = () => /* @__PURE__ */ jsx12(
4121
4253
  strokeLinecap: "round",
4122
4254
  strokeLinejoin: "round",
4123
4255
  "aria-hidden": "true",
4124
- children: /* @__PURE__ */ jsx12("path", { d: "M20 6 9 17l-5-5" })
4256
+ children: /* @__PURE__ */ jsx13("path", { d: "M20 6 9 17l-5-5" })
4125
4257
  }
4126
4258
  );
4127
- var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx12(
4259
+ var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx13(
4128
4260
  "svg",
4129
4261
  {
4130
4262
  className,
@@ -4138,7 +4270,7 @@ var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx12(
4138
4270
  strokeLinejoin: "round",
4139
4271
  style: { opacity: 0.6, flexShrink: 0 },
4140
4272
  "aria-hidden": "true",
4141
- children: /* @__PURE__ */ jsx12("path", { d: "m6 9 6 6 6-6" })
4273
+ children: /* @__PURE__ */ jsx13("path", { d: "m6 9 6 6 6-6" })
4142
4274
  }
4143
4275
  );
4144
4276
  var getSimulationLabels = (simulations) => {
@@ -4157,17 +4289,17 @@ var AnalogSimulationSelector = ({
4157
4289
  selectedSimulationExperimentId,
4158
4290
  onSelectSimulation
4159
4291
  }) => {
4160
- const [open, setOpen] = useState10(false);
4292
+ const [open, setOpen] = useState11(false);
4161
4293
  if (simulations.length <= 1) return null;
4162
4294
  const simulationLabels = getSimulationLabels(simulations);
4163
4295
  const selectedSimulation = simulationLabels.find(
4164
4296
  ({ simulation }) => simulation.simulation_experiment_id === selectedSimulationExperimentId
4165
4297
  );
4166
4298
  const selectedLabel = selectedSimulation?.label ?? "Select simulation";
4167
- return /* @__PURE__ */ jsxs10(Fragment6, { children: [
4168
- /* @__PURE__ */ jsx12("style", { children: MENU_CSS2 }),
4169
- /* @__PURE__ */ jsxs10(DropdownMenu3.Root, { open, onOpenChange: setOpen, modal: false, children: [
4170
- /* @__PURE__ */ jsx12(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
4299
+ return /* @__PURE__ */ jsxs11(Fragment7, { children: [
4300
+ /* @__PURE__ */ jsx13("style", { children: MENU_CSS2 }),
4301
+ /* @__PURE__ */ jsxs11(DropdownMenu3.Root, { open, onOpenChange: setOpen, modal: false, children: [
4302
+ /* @__PURE__ */ jsx13(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
4171
4303
  "button",
4172
4304
  {
4173
4305
  type: "button",
@@ -4194,13 +4326,13 @@ var AnalogSimulationSelector = ({
4194
4326
  zIndex: zIndexMap.viewMenuIcon
4195
4327
  },
4196
4328
  children: [
4197
- /* @__PURE__ */ jsx12("span", { style: { color: "#888888", flexShrink: 0 }, children: "Simulation:" }),
4198
- /* @__PURE__ */ jsx12("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: selectedLabel }),
4199
- /* @__PURE__ */ jsx12(ChevronDownIcon2, { className: "sv-simulation-chevron" })
4329
+ /* @__PURE__ */ jsx13("span", { style: { color: "#888888", flexShrink: 0 }, children: "Simulation:" }),
4330
+ /* @__PURE__ */ jsx13("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: selectedLabel }),
4331
+ /* @__PURE__ */ jsx13(ChevronDownIcon2, { className: "sv-simulation-chevron" })
4200
4332
  ]
4201
4333
  }
4202
4334
  ) }),
4203
- /* @__PURE__ */ jsx12(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx12(
4335
+ /* @__PURE__ */ jsx13(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx13(
4204
4336
  DropdownMenu3.Content,
4205
4337
  {
4206
4338
  style: contentStyles3,
@@ -4210,7 +4342,7 @@ var AnalogSimulationSelector = ({
4210
4342
  collisionPadding: 10,
4211
4343
  children: simulationLabels.map(({ simulation, label }) => {
4212
4344
  const selected = simulation.simulation_experiment_id === selectedSimulationExperimentId;
4213
- return /* @__PURE__ */ jsxs10(
4345
+ return /* @__PURE__ */ jsxs11(
4214
4346
  DropdownMenu3.Item,
4215
4347
  {
4216
4348
  className: "sv-simulation-item",
@@ -4222,8 +4354,8 @@ var AnalogSimulationSelector = ({
4222
4354
  setOpen(false);
4223
4355
  },
4224
4356
  children: [
4225
- /* @__PURE__ */ jsx12("span", { style: iconSlotStyles3, children: selected && /* @__PURE__ */ jsx12(CheckIcon3, {}) }),
4226
- /* @__PURE__ */ jsx12("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: label })
4357
+ /* @__PURE__ */ jsx13("span", { style: iconSlotStyles3, children: selected && /* @__PURE__ */ jsx13(CheckIcon3, {}) }),
4358
+ /* @__PURE__ */ jsx13("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: label })
4227
4359
  ]
4228
4360
  },
4229
4361
  simulation.simulation_experiment_id
@@ -4236,7 +4368,7 @@ var AnalogSimulationSelector = ({
4236
4368
  };
4237
4369
 
4238
4370
  // lib/components/AnalogSimulationViewer.tsx
4239
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
4371
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
4240
4372
  var DEFAULT_RENDER_WIDTH = 1200;
4241
4373
  var DEFAULT_COMBINED_RENDER_ASPECT_RATIO = 1;
4242
4374
  var DEFAULT_GRAPH_ONLY_RENDER_ASPECT_RATIO = 2;
@@ -4251,16 +4383,16 @@ var AnalogSimulationViewer = ({
4251
4383
  onSimulationChange,
4252
4384
  acSweepView = "magnitude"
4253
4385
  }) => {
4254
- const [circuitJson, setCircuitJson] = useState11(null);
4255
- const [isLoading, setIsLoading] = useState11(true);
4256
- const [error, setError] = useState11(null);
4257
- const [svgObjectUrl, setSvgObjectUrl] = useState11(null);
4386
+ const [circuitJson, setCircuitJson] = useState12(null);
4387
+ const [isLoading, setIsLoading] = useState12(true);
4388
+ const [error, setError] = useState12(null);
4389
+ const [svgObjectUrl, setSvgObjectUrl] = useState12(null);
4258
4390
  const containerRef = useRef10(null);
4259
4391
  const imgRef = useRef10(null);
4260
4392
  const { containerWidth } = useResizeHandling(
4261
4393
  containerRef
4262
4394
  );
4263
- const [isDragging, setIsDragging] = useState11(false);
4395
+ const [isDragging, setIsDragging] = useState12(false);
4264
4396
  const {
4265
4397
  ref: transformRef,
4266
4398
  cancelDrag: _cancelDrag,
@@ -4276,7 +4408,7 @@ var AnalogSimulationViewer = ({
4276
4408
  const renderAspectRatio = width && height ? width / height : defaultRenderAspectRatio;
4277
4409
  const effectiveWidth = width || (height ? height * renderAspectRatio : containerWidth) || DEFAULT_RENDER_WIDTH;
4278
4410
  const effectiveHeight = height || effectiveWidth / renderAspectRatio;
4279
- useEffect13(() => {
4411
+ useEffect14(() => {
4280
4412
  setIsLoading(true);
4281
4413
  setError(null);
4282
4414
  setCircuitJson(inputCircuitJson);
@@ -4288,11 +4420,11 @@ var AnalogSimulationViewer = ({
4288
4420
  (element) => element.type === "simulation_experiment"
4289
4421
  );
4290
4422
  }, [circuitJson]);
4291
- const [selectedSimulationExperimentId, setSelectedSimulationExperimentId] = useState11(null);
4423
+ const [selectedSimulationExperimentId, setSelectedSimulationExperimentId] = useState12(null);
4292
4424
  const simulationExperimentId = (selectedSimulationExperimentId && simulationExperiments.some(
4293
4425
  (simulation) => simulation.simulation_experiment_id === selectedSimulationExperimentId
4294
4426
  ) ? selectedSimulationExperimentId : simulationExperiments[0]?.simulation_experiment_id) ?? null;
4295
- useEffect13(() => {
4427
+ useEffect14(() => {
4296
4428
  if (simulationExperimentId !== selectedSimulationExperimentId) {
4297
4429
  setSelectedSimulationExperimentId(simulationExperimentId);
4298
4430
  }
@@ -4329,7 +4461,7 @@ var AnalogSimulationViewer = ({
4329
4461
  simulationExperimentId,
4330
4462
  acSweepView
4331
4463
  ]);
4332
- useEffect13(() => {
4464
+ useEffect14(() => {
4333
4465
  if (!simulationSvg) {
4334
4466
  setSvgObjectUrl(null);
4335
4467
  return;
@@ -4355,7 +4487,7 @@ var AnalogSimulationViewer = ({
4355
4487
  const handleTouchStart = (_e) => {
4356
4488
  setIsDragging(true);
4357
4489
  };
4358
- useEffect13(() => {
4490
+ useEffect14(() => {
4359
4491
  const handleMouseUp = () => {
4360
4492
  setIsDragging(false);
4361
4493
  };
@@ -4370,7 +4502,7 @@ var AnalogSimulationViewer = ({
4370
4502
  };
4371
4503
  }, []);
4372
4504
  if (isLoading) {
4373
- return /* @__PURE__ */ jsx13(
4505
+ return /* @__PURE__ */ jsx14(
4374
4506
  "div",
4375
4507
  {
4376
4508
  style: {
@@ -4390,7 +4522,7 @@ var AnalogSimulationViewer = ({
4390
4522
  );
4391
4523
  }
4392
4524
  if (error) {
4393
- return /* @__PURE__ */ jsx13(
4525
+ return /* @__PURE__ */ jsx14(
4394
4526
  "div",
4395
4527
  {
4396
4528
  style: {
@@ -4405,15 +4537,15 @@ var AnalogSimulationViewer = ({
4405
4537
  ...containerStyle
4406
4538
  },
4407
4539
  className,
4408
- children: /* @__PURE__ */ jsxs11("div", { style: { textAlign: "center", padding: "20px" }, children: [
4409
- /* @__PURE__ */ jsx13("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "Circuit Conversion Error" }),
4410
- /* @__PURE__ */ jsx13("div", { style: { fontSize: "14px" }, children: error })
4540
+ children: /* @__PURE__ */ jsxs12("div", { style: { textAlign: "center", padding: "20px" }, children: [
4541
+ /* @__PURE__ */ jsx14("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "Circuit Conversion Error" }),
4542
+ /* @__PURE__ */ jsx14("div", { style: { fontSize: "14px" }, children: error })
4411
4543
  ] })
4412
4544
  }
4413
4545
  );
4414
4546
  }
4415
4547
  if (!simulationSvg) {
4416
- return /* @__PURE__ */ jsxs11(
4548
+ return /* @__PURE__ */ jsxs12(
4417
4549
  "div",
4418
4550
  {
4419
4551
  style: {
@@ -4429,11 +4561,11 @@ var AnalogSimulationViewer = ({
4429
4561
  },
4430
4562
  className,
4431
4563
  children: [
4432
- /* @__PURE__ */ jsx13("div", { style: { fontSize: "16px", color: "#475569", fontWeight: 500 }, children: "No Simulation Found" }),
4433
- /* @__PURE__ */ jsxs11("div", { style: { fontSize: "14px", color: "#64748b" }, children: [
4564
+ /* @__PURE__ */ jsx14("div", { style: { fontSize: "16px", color: "#475569", fontWeight: 500 }, children: "No Simulation Found" }),
4565
+ /* @__PURE__ */ jsxs12("div", { style: { fontSize: "14px", color: "#64748b" }, children: [
4434
4566
  "Use",
4435
4567
  " ",
4436
- /* @__PURE__ */ jsx13(
4568
+ /* @__PURE__ */ jsx14(
4437
4569
  "code",
4438
4570
  {
4439
4571
  style: {
@@ -4453,7 +4585,7 @@ var AnalogSimulationViewer = ({
4453
4585
  }
4454
4586
  );
4455
4587
  }
4456
- return /* @__PURE__ */ jsxs11(
4588
+ return /* @__PURE__ */ jsxs12(
4457
4589
  "div",
4458
4590
  {
4459
4591
  ref: (node) => {
@@ -4472,7 +4604,7 @@ var AnalogSimulationViewer = ({
4472
4604
  onMouseDown: handleMouseDown,
4473
4605
  onTouchStart: handleTouchStart,
4474
4606
  children: [
4475
- /* @__PURE__ */ jsx13(
4607
+ /* @__PURE__ */ jsx14(
4476
4608
  AnalogSimulationSelector,
4477
4609
  {
4478
4610
  simulations: simulationExperiments,
@@ -4480,7 +4612,7 @@ var AnalogSimulationViewer = ({
4480
4612
  onSelectSimulation: handleSelectSimulation
4481
4613
  }
4482
4614
  ),
4483
- svgObjectUrl ? /* @__PURE__ */ jsx13(
4615
+ svgObjectUrl ? /* @__PURE__ */ jsx14(
4484
4616
  "img",
4485
4617
  {
4486
4618
  ref: imgRef,
@@ -4494,7 +4626,7 @@ var AnalogSimulationViewer = ({
4494
4626
  objectFit: "contain"
4495
4627
  }
4496
4628
  }
4497
- ) : /* @__PURE__ */ jsx13(
4629
+ ) : /* @__PURE__ */ jsx14(
4498
4630
  "div",
4499
4631
  {
4500
4632
  style: {
@@ -4515,9 +4647,9 @@ var AnalogSimulationViewer = ({
4515
4647
  };
4516
4648
 
4517
4649
  // lib/hooks/useSchematicViewerController.ts
4518
- import { useCallback as useCallback8, useMemo as useMemo8, useState as useState12 } from "react";
4650
+ import { useCallback as useCallback8, useMemo as useMemo8, useState as useState13 } from "react";
4519
4651
  var useSchematicViewerController = () => {
4520
- const [focusRequest, setFocusRequest] = useState12(null);
4652
+ const [focusRequest, setFocusRequest] = useState13(null);
4521
4653
  const focusSchematicComponent = useCallback8(
4522
4654
  (schematicComponentId) => {
4523
4655
  setFocusRequest({ schematicComponentId });