@tscircuit/schematic-viewer 2.0.99 → 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 +375 -240
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
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
|
-
|
|
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__ */
|
|
1939
|
+
return /* @__PURE__ */ jsxs3(
|
|
1822
1940
|
"dialog",
|
|
1823
1941
|
{
|
|
1824
1942
|
open: true,
|
|
@@ -1835,6 +1953,8 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
1835
1953
|
margin: 0,
|
|
1836
1954
|
padding: 0,
|
|
1837
1955
|
overflowY: "auto",
|
|
1956
|
+
overscrollBehavior: "contain",
|
|
1957
|
+
cursor: "auto",
|
|
1838
1958
|
boxSizing: "border-box",
|
|
1839
1959
|
border: "1px solid #cbd5e1",
|
|
1840
1960
|
borderRadius: "4px",
|
|
@@ -1849,8 +1969,9 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
1849
1969
|
},
|
|
1850
1970
|
onMouseDown: (event) => event.stopPropagation(),
|
|
1851
1971
|
onClick: (event) => event.stopPropagation(),
|
|
1972
|
+
onWheel: (event) => event.stopPropagation(),
|
|
1852
1973
|
children: [
|
|
1853
|
-
/* @__PURE__ */
|
|
1974
|
+
/* @__PURE__ */ jsxs3(
|
|
1854
1975
|
"dl",
|
|
1855
1976
|
{
|
|
1856
1977
|
style: {
|
|
@@ -1861,9 +1982,9 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
1861
1982
|
padding: "8px"
|
|
1862
1983
|
},
|
|
1863
1984
|
children: [
|
|
1864
|
-
infoEntries.map((entry) => /* @__PURE__ */
|
|
1865
|
-
/* @__PURE__ */
|
|
1866
|
-
/* @__PURE__ */
|
|
1985
|
+
infoEntries.map((entry) => /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
|
|
1986
|
+
/* @__PURE__ */ jsx4("dt", { style: detailLabelStyle, children: entry.label }),
|
|
1987
|
+
/* @__PURE__ */ jsx4(
|
|
1867
1988
|
"dd",
|
|
1868
1989
|
{
|
|
1869
1990
|
style: {
|
|
@@ -1879,9 +2000,9 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
1879
2000
|
}
|
|
1880
2001
|
)
|
|
1881
2002
|
] }, entry.key)),
|
|
1882
|
-
supplierPartNumberEntries.map((entry) => /* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
1884
|
-
/* @__PURE__ */
|
|
2003
|
+
supplierPartNumberEntries.map((entry) => /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
|
|
2004
|
+
/* @__PURE__ */ jsx4("dt", { style: detailLabelStyle, children: entry.label }),
|
|
2005
|
+
/* @__PURE__ */ jsx4(
|
|
1885
2006
|
"dd",
|
|
1886
2007
|
{
|
|
1887
2008
|
style: {
|
|
@@ -1892,25 +2013,39 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
1892
2013
|
lineHeight: 1.45,
|
|
1893
2014
|
overflowWrap: "anywhere"
|
|
1894
2015
|
},
|
|
1895
|
-
children: entry.links.map((link, index) => /* @__PURE__ */
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
"
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
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
|
+
))
|
|
1908
2043
|
}
|
|
1909
2044
|
)
|
|
1910
2045
|
] }, entry.key)),
|
|
1911
|
-
footprinterString && /* @__PURE__ */
|
|
1912
|
-
/* @__PURE__ */
|
|
1913
|
-
/* @__PURE__ */
|
|
2046
|
+
footprinterString && /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
|
|
2047
|
+
/* @__PURE__ */ jsx4("dt", { style: detailLabelStyle, children: "footprint" }),
|
|
2048
|
+
/* @__PURE__ */ jsx4(
|
|
1914
2049
|
"dd",
|
|
1915
2050
|
{
|
|
1916
2051
|
style: {
|
|
@@ -1929,7 +2064,7 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
1929
2064
|
]
|
|
1930
2065
|
}
|
|
1931
2066
|
),
|
|
1932
|
-
warnings.length > 0 && /* @__PURE__ */
|
|
2067
|
+
warnings.length > 0 && /* @__PURE__ */ jsxs3(
|
|
1933
2068
|
"section",
|
|
1934
2069
|
{
|
|
1935
2070
|
"aria-label": "Component warnings",
|
|
@@ -1945,16 +2080,16 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
1945
2080
|
overflowWrap: "anywhere"
|
|
1946
2081
|
},
|
|
1947
2082
|
children: [
|
|
1948
|
-
/* @__PURE__ */
|
|
2083
|
+
/* @__PURE__ */ jsxs3("strong", { children: [
|
|
1949
2084
|
"Warnings (",
|
|
1950
2085
|
warnings.length,
|
|
1951
2086
|
")"
|
|
1952
2087
|
] }),
|
|
1953
|
-
/* @__PURE__ */
|
|
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}`)) })
|
|
1954
2089
|
]
|
|
1955
2090
|
}
|
|
1956
2091
|
),
|
|
1957
|
-
footprintPreviewUrl && /* @__PURE__ */
|
|
2092
|
+
footprintPreviewUrl && /* @__PURE__ */ jsx4("div", { style: { padding: "0 4px 4px" }, children: /* @__PURE__ */ jsx4(
|
|
1958
2093
|
"div",
|
|
1959
2094
|
{
|
|
1960
2095
|
style: {
|
|
@@ -1964,7 +2099,7 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
1964
2099
|
borderRadius: "2px",
|
|
1965
2100
|
background: "#f8fafc"
|
|
1966
2101
|
},
|
|
1967
|
-
children: /* @__PURE__ */
|
|
2102
|
+
children: /* @__PURE__ */ jsx4(
|
|
1968
2103
|
"img",
|
|
1969
2104
|
{
|
|
1970
2105
|
src: footprintPreviewUrl,
|
|
@@ -1987,12 +2122,12 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
1987
2122
|
};
|
|
1988
2123
|
|
|
1989
2124
|
// lib/components/SchematicComponentMouseTarget.tsx
|
|
1990
|
-
import { useCallback as useCallback5, useEffect as
|
|
2125
|
+
import { useCallback as useCallback5, useEffect as useEffect10, useRef as useRef6, useState as useState6 } from "react";
|
|
1991
2126
|
|
|
1992
2127
|
// lib/hooks/useMouseEventsOverBoundingBox.ts
|
|
1993
2128
|
import {
|
|
1994
2129
|
useContext as useContext2,
|
|
1995
|
-
useEffect as
|
|
2130
|
+
useEffect as useEffect9,
|
|
1996
2131
|
useId,
|
|
1997
2132
|
useMemo as useMemo4,
|
|
1998
2133
|
useRef as useRef5,
|
|
@@ -2014,7 +2149,7 @@ var useMouseEventsOverBoundingBox = (options) => {
|
|
|
2014
2149
|
},
|
|
2015
2150
|
[]
|
|
2016
2151
|
);
|
|
2017
|
-
|
|
2152
|
+
useEffect9(() => {
|
|
2018
2153
|
context.registerBoundingBox(id, {
|
|
2019
2154
|
bounds: latestOptionsRef.current.bounds,
|
|
2020
2155
|
onClick: latestOptionsRef.current.onClick ? handleClick : void 0
|
|
@@ -2023,7 +2158,7 @@ var useMouseEventsOverBoundingBox = (options) => {
|
|
|
2023
2158
|
context.unregisterBoundingBox(id);
|
|
2024
2159
|
};
|
|
2025
2160
|
}, [context, handleClick, id]);
|
|
2026
|
-
|
|
2161
|
+
useEffect9(() => {
|
|
2027
2162
|
context.updateBoundingBox(id, {
|
|
2028
2163
|
bounds: latestOptionsRef.current.bounds,
|
|
2029
2164
|
onClick: latestOptionsRef.current.onClick ? handleClick : void 0
|
|
@@ -2047,7 +2182,7 @@ var useMouseEventsOverBoundingBox = (options) => {
|
|
|
2047
2182
|
};
|
|
2048
2183
|
|
|
2049
2184
|
// lib/components/SchematicComponentMouseTarget.tsx
|
|
2050
|
-
import { jsx as
|
|
2185
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
2051
2186
|
var areMeasurementsEqual = (a, b) => {
|
|
2052
2187
|
if (!a && !b) return true;
|
|
2053
2188
|
if (!a || !b) return false;
|
|
@@ -2062,7 +2197,7 @@ var SchematicComponentMouseTarget = ({
|
|
|
2062
2197
|
showOutline,
|
|
2063
2198
|
circuitJsonKey
|
|
2064
2199
|
}) => {
|
|
2065
|
-
const [measurement, setMeasurement] =
|
|
2200
|
+
const [measurement, setMeasurement] = useState6(null);
|
|
2066
2201
|
const frameRef = useRef6(null);
|
|
2067
2202
|
const measure = useCallback5(() => {
|
|
2068
2203
|
frameRef.current = null;
|
|
@@ -2103,10 +2238,10 @@ var SchematicComponentMouseTarget = ({
|
|
|
2103
2238
|
if (frameRef.current !== null) return;
|
|
2104
2239
|
frameRef.current = window.requestAnimationFrame(measure);
|
|
2105
2240
|
}, [measure]);
|
|
2106
|
-
|
|
2241
|
+
useEffect10(() => {
|
|
2107
2242
|
scheduleMeasure();
|
|
2108
2243
|
}, [scheduleMeasure, circuitJsonKey]);
|
|
2109
|
-
|
|
2244
|
+
useEffect10(() => {
|
|
2110
2245
|
scheduleMeasure();
|
|
2111
2246
|
const svgDiv = svgDivRef.current;
|
|
2112
2247
|
const container = containerRef.current;
|
|
@@ -2151,7 +2286,7 @@ var SchematicComponentMouseTarget = ({
|
|
|
2151
2286
|
bounds,
|
|
2152
2287
|
onClick: onComponentClick ? handleClick : void 0
|
|
2153
2288
|
});
|
|
2154
|
-
|
|
2289
|
+
useEffect10(() => {
|
|
2155
2290
|
if (onHoverChange) {
|
|
2156
2291
|
onHoverChange(componentId, hovering);
|
|
2157
2292
|
}
|
|
@@ -2160,7 +2295,7 @@ var SchematicComponentMouseTarget = ({
|
|
|
2160
2295
|
return null;
|
|
2161
2296
|
}
|
|
2162
2297
|
const rect = measurement.rect;
|
|
2163
|
-
return /* @__PURE__ */
|
|
2298
|
+
return /* @__PURE__ */ jsx5(
|
|
2164
2299
|
"div",
|
|
2165
2300
|
{
|
|
2166
2301
|
style: {
|
|
@@ -2178,8 +2313,8 @@ var SchematicComponentMouseTarget = ({
|
|
|
2178
2313
|
};
|
|
2179
2314
|
|
|
2180
2315
|
// lib/components/SchematicPortMouseTarget.tsx
|
|
2181
|
-
import { useCallback as useCallback6, useEffect as
|
|
2182
|
-
import { Fragment as
|
|
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";
|
|
2183
2318
|
var areMeasurementsEqual2 = (a, b) => {
|
|
2184
2319
|
if (!a && !b) return true;
|
|
2185
2320
|
if (!a || !b) return false;
|
|
@@ -2195,7 +2330,7 @@ var SchematicPortMouseTarget = ({
|
|
|
2195
2330
|
showOutline,
|
|
2196
2331
|
circuitJsonKey
|
|
2197
2332
|
}) => {
|
|
2198
|
-
const [measurement, setMeasurement] =
|
|
2333
|
+
const [measurement, setMeasurement] = useState7(null);
|
|
2199
2334
|
const frameRef = useRef7(null);
|
|
2200
2335
|
const measure = useCallback6(() => {
|
|
2201
2336
|
frameRef.current = null;
|
|
@@ -2237,10 +2372,10 @@ var SchematicPortMouseTarget = ({
|
|
|
2237
2372
|
if (frameRef.current !== null) return;
|
|
2238
2373
|
frameRef.current = window.requestAnimationFrame(measure);
|
|
2239
2374
|
}, [measure]);
|
|
2240
|
-
|
|
2375
|
+
useEffect11(() => {
|
|
2241
2376
|
scheduleMeasure();
|
|
2242
2377
|
}, [scheduleMeasure, circuitJsonKey]);
|
|
2243
|
-
|
|
2378
|
+
useEffect11(() => {
|
|
2244
2379
|
scheduleMeasure();
|
|
2245
2380
|
const svgDiv = svgDivRef.current;
|
|
2246
2381
|
const container = containerRef.current;
|
|
@@ -2285,7 +2420,7 @@ var SchematicPortMouseTarget = ({
|
|
|
2285
2420
|
bounds,
|
|
2286
2421
|
onClick: onPortClick ? handleClick : void 0
|
|
2287
2422
|
});
|
|
2288
|
-
|
|
2423
|
+
useEffect11(() => {
|
|
2289
2424
|
if (onHoverChange) {
|
|
2290
2425
|
onHoverChange(portId, hovering);
|
|
2291
2426
|
}
|
|
@@ -2294,8 +2429,8 @@ var SchematicPortMouseTarget = ({
|
|
|
2294
2429
|
return null;
|
|
2295
2430
|
}
|
|
2296
2431
|
const rect = measurement.rect;
|
|
2297
|
-
return /* @__PURE__ */
|
|
2298
|
-
/* @__PURE__ */
|
|
2432
|
+
return /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
2433
|
+
/* @__PURE__ */ jsx6(
|
|
2299
2434
|
"div",
|
|
2300
2435
|
{
|
|
2301
2436
|
style: {
|
|
@@ -2313,7 +2448,7 @@ var SchematicPortMouseTarget = ({
|
|
|
2313
2448
|
}
|
|
2314
2449
|
}
|
|
2315
2450
|
),
|
|
2316
|
-
hovering && portLabel && /* @__PURE__ */
|
|
2451
|
+
hovering && portLabel && /* @__PURE__ */ jsx6(
|
|
2317
2452
|
"div",
|
|
2318
2453
|
{
|
|
2319
2454
|
style: {
|
|
@@ -2338,15 +2473,15 @@ var SchematicPortMouseTarget = ({
|
|
|
2338
2473
|
};
|
|
2339
2474
|
|
|
2340
2475
|
// lib/components/SchematicSearch.tsx
|
|
2341
|
-
import { useEffect as
|
|
2476
|
+
import { useEffect as useEffect12, useRef as useRef8, useState as useState8 } from "react";
|
|
2342
2477
|
|
|
2343
2478
|
// lib/components/SchematicSearchIcons.tsx
|
|
2344
|
-
import { jsx as
|
|
2479
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2345
2480
|
var Icon = ({
|
|
2346
2481
|
children,
|
|
2347
2482
|
size,
|
|
2348
2483
|
strokeWidth
|
|
2349
|
-
}) => /* @__PURE__ */
|
|
2484
|
+
}) => /* @__PURE__ */ jsx7(
|
|
2350
2485
|
"svg",
|
|
2351
2486
|
{
|
|
2352
2487
|
width: size,
|
|
@@ -2361,31 +2496,31 @@ var Icon = ({
|
|
|
2361
2496
|
children
|
|
2362
2497
|
}
|
|
2363
2498
|
);
|
|
2364
|
-
var SearchIcon = (props) => /* @__PURE__ */
|
|
2365
|
-
/* @__PURE__ */
|
|
2366
|
-
/* @__PURE__ */
|
|
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" })
|
|
2367
2502
|
] });
|
|
2368
|
-
var CloseIcon = (props) => /* @__PURE__ */
|
|
2369
|
-
/* @__PURE__ */
|
|
2370
|
-
/* @__PURE__ */
|
|
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" })
|
|
2371
2506
|
] });
|
|
2372
|
-
var ComponentIcon = (props) => /* @__PURE__ */
|
|
2373
|
-
/* @__PURE__ */
|
|
2374
|
-
/* @__PURE__ */
|
|
2375
|
-
/* @__PURE__ */
|
|
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" })
|
|
2376
2511
|
] });
|
|
2377
|
-
var NetIcon = (props) => /* @__PURE__ */
|
|
2378
|
-
/* @__PURE__ */
|
|
2379
|
-
/* @__PURE__ */
|
|
2380
|
-
/* @__PURE__ */
|
|
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" })
|
|
2381
2516
|
] });
|
|
2382
|
-
var EnterIcon = (props) => /* @__PURE__ */
|
|
2383
|
-
/* @__PURE__ */
|
|
2384
|
-
/* @__PURE__ */
|
|
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" })
|
|
2385
2520
|
] });
|
|
2386
2521
|
|
|
2387
2522
|
// lib/components/SchematicSearch.tsx
|
|
2388
|
-
import { Fragment as
|
|
2523
|
+
import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2389
2524
|
var HighlightedSearchText = ({
|
|
2390
2525
|
text,
|
|
2391
2526
|
query
|
|
@@ -2401,7 +2536,7 @@ var HighlightedSearchText = ({
|
|
|
2401
2536
|
parts.push(text.slice(cursor, matchIndex));
|
|
2402
2537
|
}
|
|
2403
2538
|
parts.push(
|
|
2404
|
-
/* @__PURE__ */
|
|
2539
|
+
/* @__PURE__ */ jsx8("strong", { style: { fontWeight: 700 }, children: text.slice(matchIndex, matchIndex + normalizedQuery.length) }, `${matchIndex}-${cursor}`)
|
|
2405
2540
|
);
|
|
2406
2541
|
cursor = matchIndex + normalizedQuery.length;
|
|
2407
2542
|
matchIndex = normalizedText.indexOf(normalizedQuery, cursor);
|
|
@@ -2423,13 +2558,13 @@ var SchematicSearch = ({
|
|
|
2423
2558
|
onSelect,
|
|
2424
2559
|
viewerContainerRef
|
|
2425
2560
|
}) => {
|
|
2426
|
-
const [isOpen, setIsOpen] =
|
|
2427
|
-
const [activeResultId, setActiveResultId] =
|
|
2428
|
-
const [hoveredResultId, setHoveredResultId] =
|
|
2561
|
+
const [isOpen, setIsOpen] = useState8(false);
|
|
2562
|
+
const [activeResultId, setActiveResultId] = useState8(null);
|
|
2563
|
+
const [hoveredResultId, setHoveredResultId] = useState8(null);
|
|
2429
2564
|
const inputRef = useRef8(null);
|
|
2430
2565
|
const resultsListRef = useRef8(null);
|
|
2431
2566
|
const shortcutLabel = getShortcutLabel();
|
|
2432
|
-
|
|
2567
|
+
useEffect12(() => {
|
|
2433
2568
|
setActiveResultId((currentId) => {
|
|
2434
2569
|
if (results.some((result) => result.target.id === currentId)) {
|
|
2435
2570
|
return currentId;
|
|
@@ -2437,11 +2572,11 @@ var SchematicSearch = ({
|
|
|
2437
2572
|
return results.find((result) => result.kind === "component")?.target.id ?? results[0]?.target.id ?? null;
|
|
2438
2573
|
});
|
|
2439
2574
|
}, [results]);
|
|
2440
|
-
|
|
2575
|
+
useEffect12(() => {
|
|
2441
2576
|
if (!activeResultId) return;
|
|
2442
2577
|
resultsListRef.current?.querySelector(`[data-search-result-id="${activeResultId}"]`)?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
2443
2578
|
}, [activeResultId]);
|
|
2444
|
-
|
|
2579
|
+
useEffect12(() => {
|
|
2445
2580
|
const handleSearchShortcut = (event) => {
|
|
2446
2581
|
if (event.key === "Escape" && isOpen) {
|
|
2447
2582
|
event.preventDefault();
|
|
@@ -2542,8 +2677,8 @@ var SchematicSearch = ({
|
|
|
2542
2677
|
};
|
|
2543
2678
|
const renderResultSection = (title, sectionResults) => {
|
|
2544
2679
|
if (sectionResults.length === 0) return null;
|
|
2545
|
-
return /* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */
|
|
2680
|
+
return /* @__PURE__ */ jsxs6("section", { children: [
|
|
2681
|
+
/* @__PURE__ */ jsx8(
|
|
2547
2682
|
"div",
|
|
2548
2683
|
{
|
|
2549
2684
|
style: {
|
|
@@ -2563,16 +2698,16 @@ var SchematicSearch = ({
|
|
|
2563
2698
|
const hovering = result.target.id === hoveredResultId;
|
|
2564
2699
|
let resultBackground = "#ffffff";
|
|
2565
2700
|
if (hovering || active) resultBackground = "#f1f3f5";
|
|
2566
|
-
let resultIcon = /* @__PURE__ */
|
|
2701
|
+
let resultIcon = /* @__PURE__ */ jsx8(NetIcon, { size: 15, strokeWidth: 1.8 });
|
|
2567
2702
|
if (result.kind === "component") {
|
|
2568
|
-
resultIcon = /* @__PURE__ */
|
|
2703
|
+
resultIcon = /* @__PURE__ */ jsx8(ComponentIcon, { size: 15, strokeWidth: 1.8 });
|
|
2569
2704
|
}
|
|
2570
2705
|
const selectResult = () => {
|
|
2571
2706
|
inputRef.current?.blur();
|
|
2572
2707
|
setActiveResultId(result.target.id);
|
|
2573
2708
|
onSelect(result);
|
|
2574
2709
|
};
|
|
2575
|
-
return /* @__PURE__ */
|
|
2710
|
+
return /* @__PURE__ */ jsxs6(
|
|
2576
2711
|
"button",
|
|
2577
2712
|
{
|
|
2578
2713
|
type: "button",
|
|
@@ -2598,7 +2733,7 @@ var SchematicSearch = ({
|
|
|
2598
2733
|
textAlign: "left"
|
|
2599
2734
|
},
|
|
2600
2735
|
children: [
|
|
2601
|
-
/* @__PURE__ */
|
|
2736
|
+
/* @__PURE__ */ jsx8(
|
|
2602
2737
|
"span",
|
|
2603
2738
|
{
|
|
2604
2739
|
style: {
|
|
@@ -2615,8 +2750,8 @@ var SchematicSearch = ({
|
|
|
2615
2750
|
children: resultIcon
|
|
2616
2751
|
}
|
|
2617
2752
|
),
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
/* @__PURE__ */
|
|
2753
|
+
/* @__PURE__ */ jsxs6("span", { style: { minWidth: 0, flex: 1 }, children: [
|
|
2754
|
+
/* @__PURE__ */ jsx8(
|
|
2620
2755
|
"span",
|
|
2621
2756
|
{
|
|
2622
2757
|
style: {
|
|
@@ -2628,10 +2763,10 @@ var SchematicSearch = ({
|
|
|
2628
2763
|
textOverflow: "ellipsis",
|
|
2629
2764
|
whiteSpace: "nowrap"
|
|
2630
2765
|
},
|
|
2631
|
-
children: /* @__PURE__ */
|
|
2766
|
+
children: /* @__PURE__ */ jsx8(HighlightedSearchText, { text: result.label, query })
|
|
2632
2767
|
}
|
|
2633
2768
|
),
|
|
2634
|
-
result.detail && /* @__PURE__ */
|
|
2769
|
+
result.detail && /* @__PURE__ */ jsx8(
|
|
2635
2770
|
"span",
|
|
2636
2771
|
{
|
|
2637
2772
|
style: {
|
|
@@ -2647,7 +2782,7 @@ var SchematicSearch = ({
|
|
|
2647
2782
|
children: result.detail
|
|
2648
2783
|
}
|
|
2649
2784
|
),
|
|
2650
|
-
result.schematicSheetName && /* @__PURE__ */
|
|
2785
|
+
result.schematicSheetName && /* @__PURE__ */ jsxs6(
|
|
2651
2786
|
"span",
|
|
2652
2787
|
{
|
|
2653
2788
|
style: {
|
|
@@ -2667,7 +2802,7 @@ var SchematicSearch = ({
|
|
|
2667
2802
|
}
|
|
2668
2803
|
)
|
|
2669
2804
|
] }),
|
|
2670
|
-
active && /* @__PURE__ */
|
|
2805
|
+
active && /* @__PURE__ */ jsx8(
|
|
2671
2806
|
"span",
|
|
2672
2807
|
{
|
|
2673
2808
|
title: "Press Enter to open",
|
|
@@ -2677,7 +2812,7 @@ var SchematicSearch = ({
|
|
|
2677
2812
|
fontSize: "17px",
|
|
2678
2813
|
lineHeight: 1
|
|
2679
2814
|
},
|
|
2680
|
-
children: /* @__PURE__ */
|
|
2815
|
+
children: /* @__PURE__ */ jsx8(EnterIcon, { size: 14, strokeWidth: 1.8 })
|
|
2681
2816
|
}
|
|
2682
2817
|
)
|
|
2683
2818
|
]
|
|
@@ -2687,7 +2822,7 @@ var SchematicSearch = ({
|
|
|
2687
2822
|
})
|
|
2688
2823
|
] });
|
|
2689
2824
|
};
|
|
2690
|
-
return /* @__PURE__ */
|
|
2825
|
+
return /* @__PURE__ */ jsx8(
|
|
2691
2826
|
"div",
|
|
2692
2827
|
{
|
|
2693
2828
|
"data-schematic-search": true,
|
|
@@ -2700,7 +2835,7 @@ var SchematicSearch = ({
|
|
|
2700
2835
|
zIndex: zIndexMap.schematicSearch,
|
|
2701
2836
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
|
|
2702
2837
|
},
|
|
2703
|
-
children: !isOpen ? /* @__PURE__ */
|
|
2838
|
+
children: !isOpen ? /* @__PURE__ */ jsx8(
|
|
2704
2839
|
"button",
|
|
2705
2840
|
{
|
|
2706
2841
|
type: "button",
|
|
@@ -2731,9 +2866,9 @@ var SchematicSearch = ({
|
|
|
2731
2866
|
cursor: "pointer",
|
|
2732
2867
|
boxShadow: "0 2px 4px rgba(0,0,0,0.1)"
|
|
2733
2868
|
},
|
|
2734
|
-
children: /* @__PURE__ */
|
|
2869
|
+
children: /* @__PURE__ */ jsx8(SearchIcon, { size: 16, strokeWidth: 2 })
|
|
2735
2870
|
}
|
|
2736
|
-
) : /* @__PURE__ */
|
|
2871
|
+
) : /* @__PURE__ */ jsxs6(
|
|
2737
2872
|
"div",
|
|
2738
2873
|
{
|
|
2739
2874
|
onKeyDown: handleSearchKeyDown,
|
|
@@ -2746,7 +2881,7 @@ var SchematicSearch = ({
|
|
|
2746
2881
|
boxShadow: "0 2px 4px rgba(0,0,0,0.1)"
|
|
2747
2882
|
},
|
|
2748
2883
|
children: [
|
|
2749
|
-
/* @__PURE__ */
|
|
2884
|
+
/* @__PURE__ */ jsxs6(
|
|
2750
2885
|
"div",
|
|
2751
2886
|
{
|
|
2752
2887
|
style: {
|
|
@@ -2759,8 +2894,8 @@ var SchematicSearch = ({
|
|
|
2759
2894
|
borderBottom: searchHeaderBorder
|
|
2760
2895
|
},
|
|
2761
2896
|
children: [
|
|
2762
|
-
/* @__PURE__ */
|
|
2763
|
-
/* @__PURE__ */
|
|
2897
|
+
/* @__PURE__ */ jsx8(SearchIcon, { size: 15, strokeWidth: 2 }),
|
|
2898
|
+
/* @__PURE__ */ jsx8(
|
|
2764
2899
|
"input",
|
|
2765
2900
|
{
|
|
2766
2901
|
ref: inputRef,
|
|
@@ -2780,7 +2915,7 @@ var SchematicSearch = ({
|
|
|
2780
2915
|
}
|
|
2781
2916
|
}
|
|
2782
2917
|
),
|
|
2783
|
-
query && results.length > 0 ? /* @__PURE__ */
|
|
2918
|
+
query && results.length > 0 ? /* @__PURE__ */ jsx8(
|
|
2784
2919
|
"span",
|
|
2785
2920
|
{
|
|
2786
2921
|
style: {
|
|
@@ -2791,7 +2926,7 @@ var SchematicSearch = ({
|
|
|
2791
2926
|
},
|
|
2792
2927
|
children: resultCountLabel
|
|
2793
2928
|
}
|
|
2794
|
-
) : /* @__PURE__ */
|
|
2929
|
+
) : /* @__PURE__ */ jsx8(
|
|
2795
2930
|
"kbd",
|
|
2796
2931
|
{
|
|
2797
2932
|
style: {
|
|
@@ -2808,7 +2943,7 @@ var SchematicSearch = ({
|
|
|
2808
2943
|
children: shortcutLabel
|
|
2809
2944
|
}
|
|
2810
2945
|
),
|
|
2811
|
-
isOpen && /* @__PURE__ */
|
|
2946
|
+
isOpen && /* @__PURE__ */ jsx8(
|
|
2812
2947
|
"button",
|
|
2813
2948
|
{
|
|
2814
2949
|
type: "button",
|
|
@@ -2831,13 +2966,13 @@ var SchematicSearch = ({
|
|
|
2831
2966
|
padding: 0,
|
|
2832
2967
|
lineHeight: 1
|
|
2833
2968
|
},
|
|
2834
|
-
children: /* @__PURE__ */
|
|
2969
|
+
children: /* @__PURE__ */ jsx8(CloseIcon, { size: 16, strokeWidth: 2 })
|
|
2835
2970
|
}
|
|
2836
2971
|
)
|
|
2837
2972
|
]
|
|
2838
2973
|
}
|
|
2839
2974
|
),
|
|
2840
|
-
query && /* @__PURE__ */
|
|
2975
|
+
query && /* @__PURE__ */ jsx8(
|
|
2841
2976
|
"div",
|
|
2842
2977
|
{
|
|
2843
2978
|
ref: resultsListRef,
|
|
@@ -2852,7 +2987,7 @@ var SchematicSearch = ({
|
|
|
2852
2987
|
},
|
|
2853
2988
|
onWheel: (event) => event.stopPropagation(),
|
|
2854
2989
|
onTouchMove: (event) => event.stopPropagation(),
|
|
2855
|
-
children: results.length === 0 ? /* @__PURE__ */
|
|
2990
|
+
children: results.length === 0 ? /* @__PURE__ */ jsx8(
|
|
2856
2991
|
"div",
|
|
2857
2992
|
{
|
|
2858
2993
|
style: {
|
|
@@ -2862,7 +2997,7 @@ var SchematicSearch = ({
|
|
|
2862
2997
|
},
|
|
2863
2998
|
children: "No matching components or nets"
|
|
2864
2999
|
}
|
|
2865
|
-
) : /* @__PURE__ */
|
|
3000
|
+
) : /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
2866
3001
|
renderResultSection("components", componentResults),
|
|
2867
3002
|
renderResultSection("nets", netResults)
|
|
2868
3003
|
] })
|
|
@@ -2876,9 +3011,9 @@ var SchematicSearch = ({
|
|
|
2876
3011
|
};
|
|
2877
3012
|
|
|
2878
3013
|
// lib/components/SchematicSheetSelector.tsx
|
|
2879
|
-
import { useState as
|
|
3014
|
+
import { useState as useState9 } from "react";
|
|
2880
3015
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
2881
|
-
import { Fragment as
|
|
3016
|
+
import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2882
3017
|
var FONT_FAMILY = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
2883
3018
|
var contentStyles = {
|
|
2884
3019
|
backgroundColor: "#ffffff",
|
|
@@ -2928,7 +3063,7 @@ var MENU_CSS = `
|
|
|
2928
3063
|
.sv-sheet-chevron { transition: transform 0.2s ease; }
|
|
2929
3064
|
[data-state="open"] > .sv-sheet-chevron { transform: rotate(180deg); }
|
|
2930
3065
|
`;
|
|
2931
|
-
var CheckIcon = () => /* @__PURE__ */
|
|
3066
|
+
var CheckIcon = () => /* @__PURE__ */ jsx9(
|
|
2932
3067
|
"svg",
|
|
2933
3068
|
{
|
|
2934
3069
|
width: "14",
|
|
@@ -2940,10 +3075,10 @@ var CheckIcon = () => /* @__PURE__ */ jsx8(
|
|
|
2940
3075
|
strokeLinecap: "round",
|
|
2941
3076
|
strokeLinejoin: "round",
|
|
2942
3077
|
"aria-hidden": "true",
|
|
2943
|
-
children: /* @__PURE__ */
|
|
3078
|
+
children: /* @__PURE__ */ jsx9("path", { d: "M20 6 9 17l-5-5" })
|
|
2944
3079
|
}
|
|
2945
3080
|
);
|
|
2946
|
-
var ChevronDownIcon = ({ className }) => /* @__PURE__ */
|
|
3081
|
+
var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx9(
|
|
2947
3082
|
"svg",
|
|
2948
3083
|
{
|
|
2949
3084
|
className,
|
|
@@ -2957,7 +3092,7 @@ var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx8(
|
|
|
2957
3092
|
strokeLinejoin: "round",
|
|
2958
3093
|
style: { opacity: 0.6, flexShrink: 0 },
|
|
2959
3094
|
"aria-hidden": "true",
|
|
2960
|
-
children: /* @__PURE__ */
|
|
3095
|
+
children: /* @__PURE__ */ jsx9("path", { d: "m6 9 6 6 6-6" })
|
|
2961
3096
|
}
|
|
2962
3097
|
);
|
|
2963
3098
|
var SchematicSheetSelector = ({
|
|
@@ -2965,16 +3100,16 @@ var SchematicSheetSelector = ({
|
|
|
2965
3100
|
selectedSheetId,
|
|
2966
3101
|
onSelectSheet
|
|
2967
3102
|
}) => {
|
|
2968
|
-
const [open, setOpen] =
|
|
3103
|
+
const [open, setOpen] = useState9(false);
|
|
2969
3104
|
if (sheets.length <= 1) return null;
|
|
2970
3105
|
const selectedSheet = sheets.find(
|
|
2971
3106
|
(s) => s.schematic_sheet_id === selectedSheetId
|
|
2972
3107
|
);
|
|
2973
3108
|
const selectedLabel = selectedSheet?.name ?? "Select sheet";
|
|
2974
|
-
return /* @__PURE__ */
|
|
2975
|
-
/* @__PURE__ */
|
|
2976
|
-
/* @__PURE__ */
|
|
2977
|
-
/* @__PURE__ */
|
|
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(
|
|
2978
3113
|
"button",
|
|
2979
3114
|
{
|
|
2980
3115
|
type: "button",
|
|
@@ -2999,13 +3134,13 @@ var SchematicSheetSelector = ({
|
|
|
2999
3134
|
fontFamily: FONT_FAMILY
|
|
3000
3135
|
},
|
|
3001
3136
|
children: [
|
|
3002
|
-
/* @__PURE__ */
|
|
3003
|
-
/* @__PURE__ */
|
|
3004
|
-
/* @__PURE__ */
|
|
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" })
|
|
3005
3140
|
]
|
|
3006
3141
|
}
|
|
3007
3142
|
) }),
|
|
3008
|
-
/* @__PURE__ */
|
|
3143
|
+
/* @__PURE__ */ jsx9(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx9(
|
|
3009
3144
|
DropdownMenu.Content,
|
|
3010
3145
|
{
|
|
3011
3146
|
style: contentStyles,
|
|
@@ -3015,7 +3150,7 @@ var SchematicSheetSelector = ({
|
|
|
3015
3150
|
collisionPadding: 10,
|
|
3016
3151
|
children: sheets.map((sheet) => {
|
|
3017
3152
|
const selected = sheet.schematic_sheet_id === selectedSheetId;
|
|
3018
|
-
return /* @__PURE__ */
|
|
3153
|
+
return /* @__PURE__ */ jsxs7(
|
|
3019
3154
|
DropdownMenu.Item,
|
|
3020
3155
|
{
|
|
3021
3156
|
className: "sv-sheet-item",
|
|
@@ -3027,8 +3162,8 @@ var SchematicSheetSelector = ({
|
|
|
3027
3162
|
setOpen(false);
|
|
3028
3163
|
},
|
|
3029
3164
|
children: [
|
|
3030
|
-
/* @__PURE__ */
|
|
3031
|
-
/* @__PURE__ */
|
|
3165
|
+
/* @__PURE__ */ jsx9("span", { style: iconSlotStyles, children: selected && /* @__PURE__ */ jsx9(CheckIcon, {}) }),
|
|
3166
|
+
/* @__PURE__ */ jsx9("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: sheet.name })
|
|
3032
3167
|
]
|
|
3033
3168
|
},
|
|
3034
3169
|
sheet.schematic_sheet_id
|
|
@@ -3041,14 +3176,14 @@ var SchematicSheetSelector = ({
|
|
|
3041
3176
|
};
|
|
3042
3177
|
|
|
3043
3178
|
// lib/components/SchematicWarningsButton.tsx
|
|
3044
|
-
import { jsx as
|
|
3179
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3045
3180
|
var SchematicWarningsButton = ({
|
|
3046
3181
|
count,
|
|
3047
3182
|
showWarnings,
|
|
3048
3183
|
onToggle
|
|
3049
3184
|
}) => {
|
|
3050
3185
|
const label = `${showWarnings ? "Hide" : "Show"} ${count} ${count === 1 ? "warning" : "warnings"}`;
|
|
3051
|
-
return /* @__PURE__ */
|
|
3186
|
+
return /* @__PURE__ */ jsxs8(
|
|
3052
3187
|
"button",
|
|
3053
3188
|
{
|
|
3054
3189
|
type: "button",
|
|
@@ -3078,7 +3213,7 @@ var SchematicWarningsButton = ({
|
|
|
3078
3213
|
fontWeight: 600
|
|
3079
3214
|
},
|
|
3080
3215
|
children: [
|
|
3081
|
-
/* @__PURE__ */
|
|
3216
|
+
/* @__PURE__ */ jsxs8(
|
|
3082
3217
|
"svg",
|
|
3083
3218
|
{
|
|
3084
3219
|
width: "16",
|
|
@@ -3091,12 +3226,12 @@ var SchematicWarningsButton = ({
|
|
|
3091
3226
|
strokeLinejoin: "round",
|
|
3092
3227
|
"aria-hidden": "true",
|
|
3093
3228
|
children: [
|
|
3094
|
-
/* @__PURE__ */
|
|
3095
|
-
/* @__PURE__ */
|
|
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" })
|
|
3096
3231
|
]
|
|
3097
3232
|
}
|
|
3098
3233
|
),
|
|
3099
|
-
/* @__PURE__ */
|
|
3234
|
+
/* @__PURE__ */ jsx10("span", { children: count })
|
|
3100
3235
|
]
|
|
3101
3236
|
}
|
|
3102
3237
|
);
|
|
@@ -3110,7 +3245,7 @@ import { useMemo as useMemo5 } from "react";
|
|
|
3110
3245
|
// package.json
|
|
3111
3246
|
var package_default = {
|
|
3112
3247
|
name: "@tscircuit/schematic-viewer",
|
|
3113
|
-
version: "2.0.
|
|
3248
|
+
version: "2.0.100",
|
|
3114
3249
|
repository: {
|
|
3115
3250
|
type: "git",
|
|
3116
3251
|
url: "https://github.com/tscircuit/schematic-viewer"
|
|
@@ -3166,7 +3301,7 @@ var package_default = {
|
|
|
3166
3301
|
};
|
|
3167
3302
|
|
|
3168
3303
|
// lib/components/ViewMenu.tsx
|
|
3169
|
-
import { jsx as
|
|
3304
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3170
3305
|
var FONT_FAMILY2 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
3171
3306
|
var contentStyles2 = {
|
|
3172
3307
|
backgroundColor: "#262626",
|
|
@@ -3215,7 +3350,7 @@ var HIGHLIGHT_CSS = `
|
|
|
3215
3350
|
.sv-vm-item:hover:not([data-disabled]) { background-color: #404040; }
|
|
3216
3351
|
.sv-vm-item[data-disabled] { opacity: 0.45; cursor: not-allowed; }
|
|
3217
3352
|
`;
|
|
3218
|
-
var CheckIcon2 = () => /* @__PURE__ */
|
|
3353
|
+
var CheckIcon2 = () => /* @__PURE__ */ jsx11(
|
|
3219
3354
|
"svg",
|
|
3220
3355
|
{
|
|
3221
3356
|
width: "14",
|
|
@@ -3227,7 +3362,7 @@ var CheckIcon2 = () => /* @__PURE__ */ jsx10(
|
|
|
3227
3362
|
strokeLinecap: "round",
|
|
3228
3363
|
strokeLinejoin: "round",
|
|
3229
3364
|
"aria-hidden": "true",
|
|
3230
|
-
children: /* @__PURE__ */
|
|
3365
|
+
children: /* @__PURE__ */ jsx11("path", { d: "M20 6 9 17l-5-5" })
|
|
3231
3366
|
}
|
|
3232
3367
|
);
|
|
3233
3368
|
var ViewMenu = ({
|
|
@@ -3281,7 +3416,7 @@ var ViewMenu = ({
|
|
|
3281
3416
|
return false;
|
|
3282
3417
|
}
|
|
3283
3418
|
}, [circuitJsonKey]);
|
|
3284
|
-
return /* @__PURE__ */
|
|
3419
|
+
return /* @__PURE__ */ jsx11(
|
|
3285
3420
|
"div",
|
|
3286
3421
|
{
|
|
3287
3422
|
ref: menuRef,
|
|
@@ -3292,9 +3427,9 @@ var ViewMenu = ({
|
|
|
3292
3427
|
width: 0,
|
|
3293
3428
|
height: 0
|
|
3294
3429
|
},
|
|
3295
|
-
children: /* @__PURE__ */
|
|
3296
|
-
/* @__PURE__ */
|
|
3297
|
-
/* @__PURE__ */
|
|
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(
|
|
3298
3433
|
DropdownMenu2.Content,
|
|
3299
3434
|
{
|
|
3300
3435
|
style: contentStyles2,
|
|
@@ -3303,20 +3438,20 @@ var ViewMenu = ({
|
|
|
3303
3438
|
collisionPadding: 10,
|
|
3304
3439
|
avoidCollisions: true,
|
|
3305
3440
|
children: [
|
|
3306
|
-
/* @__PURE__ */
|
|
3307
|
-
netLocations.length > 0 && /* @__PURE__ */
|
|
3308
|
-
/* @__PURE__ */
|
|
3441
|
+
/* @__PURE__ */ jsx11("style", { children: HIGHLIGHT_CSS }),
|
|
3442
|
+
netLocations.length > 0 && /* @__PURE__ */ jsxs9(DropdownMenu2.Sub, { children: [
|
|
3443
|
+
/* @__PURE__ */ jsxs9(
|
|
3309
3444
|
DropdownMenu2.SubTrigger,
|
|
3310
3445
|
{
|
|
3311
3446
|
className: "sv-vm-item",
|
|
3312
3447
|
style: itemStyles2,
|
|
3313
3448
|
children: [
|
|
3314
3449
|
"Net Locations ",
|
|
3315
|
-
/* @__PURE__ */
|
|
3450
|
+
/* @__PURE__ */ jsx11("span", { style: { marginLeft: "auto" }, children: "\u203A" })
|
|
3316
3451
|
]
|
|
3317
3452
|
}
|
|
3318
3453
|
),
|
|
3319
|
-
/* @__PURE__ */
|
|
3454
|
+
/* @__PURE__ */ jsx11(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsx11(
|
|
3320
3455
|
DropdownMenu2.SubContent,
|
|
3321
3456
|
{
|
|
3322
3457
|
style: {
|
|
@@ -3325,7 +3460,7 @@ var ViewMenu = ({
|
|
|
3325
3460
|
overflowY: "auto"
|
|
3326
3461
|
},
|
|
3327
3462
|
collisionPadding: 10,
|
|
3328
|
-
children: netLocations.map((location, index) => /* @__PURE__ */
|
|
3463
|
+
children: netLocations.map((location, index) => /* @__PURE__ */ jsx11(
|
|
3329
3464
|
DropdownMenu2.Item,
|
|
3330
3465
|
{
|
|
3331
3466
|
className: "sv-vm-item",
|
|
@@ -3338,7 +3473,7 @@ var ViewMenu = ({
|
|
|
3338
3473
|
}
|
|
3339
3474
|
) })
|
|
3340
3475
|
] }),
|
|
3341
|
-
/* @__PURE__ */
|
|
3476
|
+
/* @__PURE__ */ jsxs9(
|
|
3342
3477
|
DropdownMenu2.Item,
|
|
3343
3478
|
{
|
|
3344
3479
|
className: "sv-vm-item",
|
|
@@ -3351,12 +3486,12 @@ var ViewMenu = ({
|
|
|
3351
3486
|
if (hasPorts) onTogglePorts(!showPorts);
|
|
3352
3487
|
},
|
|
3353
3488
|
children: [
|
|
3354
|
-
/* @__PURE__ */
|
|
3355
|
-
/* @__PURE__ */
|
|
3489
|
+
/* @__PURE__ */ jsx11("span", { style: iconSlotStyles2, children: showPorts && /* @__PURE__ */ jsx11(CheckIcon2, {}) }),
|
|
3490
|
+
/* @__PURE__ */ jsx11("span", { children: "Show Schematic Ports" })
|
|
3356
3491
|
]
|
|
3357
3492
|
}
|
|
3358
3493
|
),
|
|
3359
|
-
/* @__PURE__ */
|
|
3494
|
+
/* @__PURE__ */ jsxs9(
|
|
3360
3495
|
DropdownMenu2.Item,
|
|
3361
3496
|
{
|
|
3362
3497
|
className: "sv-vm-item",
|
|
@@ -3369,12 +3504,12 @@ var ViewMenu = ({
|
|
|
3369
3504
|
if (hasGroups) onToggleGroups(!showGroups);
|
|
3370
3505
|
},
|
|
3371
3506
|
children: [
|
|
3372
|
-
/* @__PURE__ */
|
|
3373
|
-
/* @__PURE__ */
|
|
3507
|
+
/* @__PURE__ */ jsx11("span", { style: iconSlotStyles2, children: showGroups && /* @__PURE__ */ jsx11(CheckIcon2, {}) }),
|
|
3508
|
+
/* @__PURE__ */ jsx11("span", { children: "View Schematic Groups" })
|
|
3374
3509
|
]
|
|
3375
3510
|
}
|
|
3376
3511
|
),
|
|
3377
|
-
/* @__PURE__ */
|
|
3512
|
+
/* @__PURE__ */ jsxs9(
|
|
3378
3513
|
DropdownMenu2.Item,
|
|
3379
3514
|
{
|
|
3380
3515
|
className: "sv-vm-item",
|
|
@@ -3385,12 +3520,12 @@ var ViewMenu = ({
|
|
|
3385
3520
|
onToggleGrid(!showGrid);
|
|
3386
3521
|
},
|
|
3387
3522
|
children: [
|
|
3388
|
-
/* @__PURE__ */
|
|
3389
|
-
/* @__PURE__ */
|
|
3523
|
+
/* @__PURE__ */ jsx11("span", { style: iconSlotStyles2, children: showGrid && /* @__PURE__ */ jsx11(CheckIcon2, {}) }),
|
|
3524
|
+
/* @__PURE__ */ jsx11("span", { children: "Show Grid" })
|
|
3390
3525
|
]
|
|
3391
3526
|
}
|
|
3392
3527
|
),
|
|
3393
|
-
/* @__PURE__ */
|
|
3528
|
+
/* @__PURE__ */ jsxs9(
|
|
3394
3529
|
DropdownMenu2.CheckboxItem,
|
|
3395
3530
|
{
|
|
3396
3531
|
className: "sv-vm-item",
|
|
@@ -3399,26 +3534,26 @@ var ViewMenu = ({
|
|
|
3399
3534
|
onCheckedChange: onToggleWarnings,
|
|
3400
3535
|
onSelect: (event) => event.preventDefault(),
|
|
3401
3536
|
children: [
|
|
3402
|
-
/* @__PURE__ */
|
|
3403
|
-
/* @__PURE__ */
|
|
3537
|
+
/* @__PURE__ */ jsx11("span", { style: iconSlotStyles2, children: /* @__PURE__ */ jsx11(DropdownMenu2.ItemIndicator, { children: /* @__PURE__ */ jsx11(CheckIcon2, {}) }) }),
|
|
3538
|
+
/* @__PURE__ */ jsx11("span", { children: "Show Warnings" })
|
|
3404
3539
|
]
|
|
3405
3540
|
}
|
|
3406
3541
|
),
|
|
3407
|
-
/* @__PURE__ */
|
|
3408
|
-
/* @__PURE__ */
|
|
3542
|
+
/* @__PURE__ */ jsx11(DropdownMenu2.Separator, { style: separatorStyles }),
|
|
3543
|
+
/* @__PURE__ */ jsxs9(
|
|
3409
3544
|
DropdownMenu2.Item,
|
|
3410
3545
|
{
|
|
3411
3546
|
className: "sv-vm-item",
|
|
3412
3547
|
style: itemStyles2,
|
|
3413
3548
|
onSelect: onRunStyleAnalysis,
|
|
3414
3549
|
children: [
|
|
3415
|
-
/* @__PURE__ */
|
|
3416
|
-
/* @__PURE__ */
|
|
3550
|
+
/* @__PURE__ */ jsx11("span", { style: iconSlotStyles2 }),
|
|
3551
|
+
/* @__PURE__ */ jsx11("span", { children: "Run Style Analysis" })
|
|
3417
3552
|
]
|
|
3418
3553
|
}
|
|
3419
3554
|
),
|
|
3420
|
-
/* @__PURE__ */
|
|
3421
|
-
/* @__PURE__ */
|
|
3555
|
+
/* @__PURE__ */ jsx11(DropdownMenu2.Separator, { style: separatorStyles }),
|
|
3556
|
+
/* @__PURE__ */ jsxs9(
|
|
3422
3557
|
"div",
|
|
3423
3558
|
{
|
|
3424
3559
|
style: {
|
|
@@ -3444,7 +3579,7 @@ var ViewMenu = ({
|
|
|
3444
3579
|
};
|
|
3445
3580
|
|
|
3446
3581
|
// lib/components/SchematicViewer.tsx
|
|
3447
|
-
import { jsx as
|
|
3582
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3448
3583
|
var SchematicViewer = ({
|
|
3449
3584
|
circuitJson,
|
|
3450
3585
|
containerStyle,
|
|
@@ -3483,7 +3618,7 @@ var SchematicViewer = ({
|
|
|
3483
3618
|
}, [circuitJsonKey]);
|
|
3484
3619
|
const hasMultipleSheets = schematicSheets.length > 1;
|
|
3485
3620
|
const defaultSheetId = schematicSheets[0]?.schematic_sheet_id;
|
|
3486
|
-
const [selectedSheetId, setSelectedSheetId] =
|
|
3621
|
+
const [selectedSheetId, setSelectedSheetId] = useState10(
|
|
3487
3622
|
() => {
|
|
3488
3623
|
const stored = getStoredString(STORAGE_KEYS.SELECTED_SCHEMATIC_SHEET);
|
|
3489
3624
|
if (stored && schematicSheets.some((s) => s.schematic_sheet_id === stored)) {
|
|
@@ -3492,7 +3627,7 @@ var SchematicViewer = ({
|
|
|
3492
3627
|
return defaultSheetId;
|
|
3493
3628
|
}
|
|
3494
3629
|
);
|
|
3495
|
-
|
|
3630
|
+
useEffect13(() => {
|
|
3496
3631
|
const stillExists = selectedSheetId !== void 0 && schematicSheets.some((s) => s.schematic_sheet_id === selectedSheetId);
|
|
3497
3632
|
if (!stillExists) {
|
|
3498
3633
|
setSelectedSheetId(defaultSheetId);
|
|
@@ -3507,31 +3642,31 @@ var SchematicViewer = ({
|
|
|
3507
3642
|
},
|
|
3508
3643
|
[onSchematicSheetChange]
|
|
3509
3644
|
);
|
|
3510
|
-
const [showGridInternal, setShowGridInternal] =
|
|
3511
|
-
const [analysisCircuitJson, setAnalysisCircuitJson] =
|
|
3512
|
-
const [showWarnings, setShowWarnings] =
|
|
3645
|
+
const [showGridInternal, setShowGridInternal] = useState10(false);
|
|
3646
|
+
const [analysisCircuitJson, setAnalysisCircuitJson] = useState10(null);
|
|
3647
|
+
const [showWarnings, setShowWarnings] = useState10(false);
|
|
3513
3648
|
const warningCount = circuitJson.filter(
|
|
3514
3649
|
(element) => element.type.startsWith("schematic_") && element.type.endsWith("_warning")
|
|
3515
3650
|
).length;
|
|
3516
3651
|
const showGrid = debugGrid || showGridInternal;
|
|
3517
|
-
const [isInteractionEnabled, setIsInteractionEnabled] =
|
|
3652
|
+
const [isInteractionEnabled, setIsInteractionEnabled] = useState10(
|
|
3518
3653
|
!clickToInteractEnabled
|
|
3519
3654
|
);
|
|
3520
|
-
const [showSchematicGroups, setShowSchematicGroups] =
|
|
3655
|
+
const [showSchematicGroups, setShowSchematicGroups] = useState10(() => {
|
|
3521
3656
|
if (disableGroups) return false;
|
|
3522
3657
|
return getStoredBoolean(STORAGE_KEYS.IS_SHOWING_SCHEMATIC_GROUPS, false);
|
|
3523
3658
|
});
|
|
3524
|
-
const [showSchematicPortsInternal, setShowSchematicPortsInternal] =
|
|
3659
|
+
const [showSchematicPortsInternal, setShowSchematicPortsInternal] = useState10(
|
|
3525
3660
|
() => showSchematicPorts ?? getStoredBoolean(STORAGE_KEYS.IS_SHOWING_SCHEMATIC_PORTS, false)
|
|
3526
3661
|
);
|
|
3527
|
-
|
|
3662
|
+
useEffect13(() => {
|
|
3528
3663
|
if (showSchematicPorts !== void 0) {
|
|
3529
3664
|
setShowSchematicPortsInternal(showSchematicPorts);
|
|
3530
3665
|
}
|
|
3531
3666
|
}, [showSchematicPorts]);
|
|
3532
|
-
const [isHoveringClickableComponent, setIsHoveringClickableComponent] =
|
|
3667
|
+
const [isHoveringClickableComponent, setIsHoveringClickableComponent] = useState10(false);
|
|
3533
3668
|
const hoveringComponentsRef = useRef9(/* @__PURE__ */ new Set());
|
|
3534
|
-
const [selectedSchematicComponent, setSelectedSchematicComponent] =
|
|
3669
|
+
const [selectedSchematicComponent, setSelectedSchematicComponent] = useState10(null);
|
|
3535
3670
|
const handleComponentHoverChange = useCallback7(
|
|
3536
3671
|
(componentId, isHovering) => {
|
|
3537
3672
|
if (isHovering) {
|
|
@@ -3543,7 +3678,7 @@ var SchematicViewer = ({
|
|
|
3543
3678
|
},
|
|
3544
3679
|
[]
|
|
3545
3680
|
);
|
|
3546
|
-
const [isHoveringClickablePort, setIsHoveringClickablePort] =
|
|
3681
|
+
const [isHoveringClickablePort, setIsHoveringClickablePort] = useState10(false);
|
|
3547
3682
|
const hoveringPortsRef = useRef9(/* @__PURE__ */ new Set());
|
|
3548
3683
|
const handlePortHoverChange = useCallback7(
|
|
3549
3684
|
(portId, isHovering) => {
|
|
@@ -3613,7 +3748,7 @@ var SchematicViewer = ({
|
|
|
3613
3748
|
const shouldPanSchematic = useCallback7(
|
|
3614
3749
|
(event) => {
|
|
3615
3750
|
if (event.target instanceof Element && event.target.closest(
|
|
3616
|
-
"[data-schematic-search], [data-schematic-warnings], .schematic-warning"
|
|
3751
|
+
"[data-schematic-search], [data-schematic-warnings], .schematic-warning, [data-schematic-component-details-tooltip]"
|
|
3617
3752
|
)) {
|
|
3618
3753
|
return false;
|
|
3619
3754
|
}
|
|
@@ -3696,10 +3831,10 @@ var SchematicViewer = ({
|
|
|
3696
3831
|
},
|
|
3697
3832
|
[containerRef, onSchematicComponentClicked]
|
|
3698
3833
|
);
|
|
3699
|
-
|
|
3834
|
+
useEffect13(() => {
|
|
3700
3835
|
setSelectedSchematicComponent(null);
|
|
3701
3836
|
}, [circuitJsonKey, activeSheetId]);
|
|
3702
|
-
|
|
3837
|
+
useEffect13(() => {
|
|
3703
3838
|
if (!selectedSchematicComponent) return;
|
|
3704
3839
|
const handleKeyDown = (event) => {
|
|
3705
3840
|
if (event.key === "Escape") {
|
|
@@ -3783,7 +3918,7 @@ var SchematicViewer = ({
|
|
|
3783
3918
|
enabled: netHoverHighlightEnabled
|
|
3784
3919
|
});
|
|
3785
3920
|
const svgDiv = useMemo6(
|
|
3786
|
-
() => /* @__PURE__ */
|
|
3921
|
+
() => /* @__PURE__ */ jsx12(
|
|
3787
3922
|
"div",
|
|
3788
3923
|
{
|
|
3789
3924
|
ref: svgDivRef,
|
|
@@ -3798,10 +3933,10 @@ var SchematicViewer = ({
|
|
|
3798
3933
|
[svgString, isInteractionEnabled, clickToInteractEnabled]
|
|
3799
3934
|
);
|
|
3800
3935
|
useSchematicWarnings({ svgDivRef, svgContent: svgDiv, circuitJsonKey });
|
|
3801
|
-
return /* @__PURE__ */
|
|
3802
|
-
netHoverHighlightEnabled && /* @__PURE__ */
|
|
3936
|
+
return /* @__PURE__ */ jsxs10(MouseTracker, { children: [
|
|
3937
|
+
netHoverHighlightEnabled && /* @__PURE__ */ jsx12("style", { children: `.sch-net-faded { opacity: 0.35; }
|
|
3803
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; }` }),
|
|
3804
|
-
searchEnabled && /* @__PURE__ */
|
|
3939
|
+
searchEnabled && /* @__PURE__ */ jsx12("style", { children: `.schematic-search-match text,
|
|
3805
3940
|
text.schematic-search-match {
|
|
3806
3941
|
fill: #ff00d4 !important;
|
|
3807
3942
|
}
|
|
@@ -3817,9 +3952,9 @@ var SchematicViewer = ({
|
|
|
3817
3952
|
flex-direction: column;
|
|
3818
3953
|
}
|
|
3819
3954
|
}` }),
|
|
3820
|
-
/* @__PURE__ */
|
|
3821
|
-
onSchematicPortClicked && /* @__PURE__ */
|
|
3822
|
-
/* @__PURE__ */
|
|
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(
|
|
3823
3958
|
"div",
|
|
3824
3959
|
{
|
|
3825
3960
|
ref: containerRef,
|
|
@@ -3854,7 +3989,7 @@ var SchematicViewer = ({
|
|
|
3854
3989
|
},
|
|
3855
3990
|
onTouchCancel: contextMenuEventHandlers.onTouchCancel,
|
|
3856
3991
|
children: [
|
|
3857
|
-
!isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */
|
|
3992
|
+
!isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */ jsx12(
|
|
3858
3993
|
"div",
|
|
3859
3994
|
{
|
|
3860
3995
|
onClick: (e) => {
|
|
@@ -3873,7 +4008,7 @@ var SchematicViewer = ({
|
|
|
3873
4008
|
pointerEvents: "all",
|
|
3874
4009
|
touchAction: "pan-x pan-y pinch-zoom"
|
|
3875
4010
|
},
|
|
3876
|
-
children: /* @__PURE__ */
|
|
4011
|
+
children: /* @__PURE__ */ jsx12(
|
|
3877
4012
|
"div",
|
|
3878
4013
|
{
|
|
3879
4014
|
style: {
|
|
@@ -3890,14 +4025,14 @@ var SchematicViewer = ({
|
|
|
3890
4025
|
)
|
|
3891
4026
|
}
|
|
3892
4027
|
),
|
|
3893
|
-
analysisCircuitJson && /* @__PURE__ */
|
|
4028
|
+
analysisCircuitJson && /* @__PURE__ */ jsx12(
|
|
3894
4029
|
StyleAnalysisDialog,
|
|
3895
4030
|
{
|
|
3896
4031
|
circuitJson: analysisCircuitJson,
|
|
3897
4032
|
onClose: () => setAnalysisCircuitJson(null)
|
|
3898
4033
|
}
|
|
3899
4034
|
),
|
|
3900
|
-
menuVisible && /* @__PURE__ */
|
|
4035
|
+
menuVisible && /* @__PURE__ */ jsx12(
|
|
3901
4036
|
ViewMenu,
|
|
3902
4037
|
{
|
|
3903
4038
|
circuitJson,
|
|
@@ -3938,7 +4073,7 @@ var SchematicViewer = ({
|
|
|
3938
4073
|
onToggleGrid: setShowGridInternal
|
|
3939
4074
|
}
|
|
3940
4075
|
),
|
|
3941
|
-
/* @__PURE__ */
|
|
4076
|
+
/* @__PURE__ */ jsxs10(
|
|
3942
4077
|
"div",
|
|
3943
4078
|
{
|
|
3944
4079
|
className: "schematic-viewer-toolbar",
|
|
@@ -3952,7 +4087,7 @@ var SchematicViewer = ({
|
|
|
3952
4087
|
zIndex: zIndexMap.schematicSearch
|
|
3953
4088
|
},
|
|
3954
4089
|
children: [
|
|
3955
|
-
/* @__PURE__ */
|
|
4090
|
+
/* @__PURE__ */ jsx12(
|
|
3956
4091
|
SchematicSheetSelector,
|
|
3957
4092
|
{
|
|
3958
4093
|
sheets: schematicSheets,
|
|
@@ -3960,7 +4095,7 @@ var SchematicViewer = ({
|
|
|
3960
4095
|
onSelectSheet: handleSelectSheet
|
|
3961
4096
|
}
|
|
3962
4097
|
),
|
|
3963
|
-
searchEnabled && /* @__PURE__ */
|
|
4098
|
+
searchEnabled && /* @__PURE__ */ jsx12(
|
|
3964
4099
|
SchematicSearch,
|
|
3965
4100
|
{
|
|
3966
4101
|
query: searchQuery,
|
|
@@ -3971,7 +4106,7 @@ var SchematicViewer = ({
|
|
|
3971
4106
|
viewerContainerRef: containerRef
|
|
3972
4107
|
}
|
|
3973
4108
|
),
|
|
3974
|
-
warningCount > 0 && /* @__PURE__ */
|
|
4109
|
+
warningCount > 0 && /* @__PURE__ */ jsx12(
|
|
3975
4110
|
SchematicWarningsButton,
|
|
3976
4111
|
{
|
|
3977
4112
|
count: warningCount,
|
|
@@ -3982,7 +4117,7 @@ var SchematicViewer = ({
|
|
|
3982
4117
|
]
|
|
3983
4118
|
}
|
|
3984
4119
|
),
|
|
3985
|
-
schematicComponentIds.map((componentId) => /* @__PURE__ */
|
|
4120
|
+
schematicComponentIds.map((componentId) => /* @__PURE__ */ jsx12(
|
|
3986
4121
|
SchematicComponentMouseTarget,
|
|
3987
4122
|
{
|
|
3988
4123
|
componentId,
|
|
@@ -3996,7 +4131,7 @@ var SchematicViewer = ({
|
|
|
3996
4131
|
componentId
|
|
3997
4132
|
)),
|
|
3998
4133
|
svgDiv,
|
|
3999
|
-
selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */
|
|
4134
|
+
selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */ jsx12(
|
|
4000
4135
|
SchematicComponentDetailsTooltip,
|
|
4001
4136
|
{
|
|
4002
4137
|
sourceComponent: selectedComponentDetails.sourceComponent,
|
|
@@ -4007,7 +4142,7 @@ var SchematicViewer = ({
|
|
|
4007
4142
|
...componentTooltipLayout
|
|
4008
4143
|
}
|
|
4009
4144
|
),
|
|
4010
|
-
showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */
|
|
4145
|
+
showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */ jsx12(
|
|
4011
4146
|
SchematicPortMouseTarget,
|
|
4012
4147
|
{
|
|
4013
4148
|
portId,
|
|
@@ -4037,7 +4172,7 @@ import {
|
|
|
4037
4172
|
convertCircuitJsonToSchematicSimulationSvg,
|
|
4038
4173
|
convertCircuitJsonToSimulationGraphSvg
|
|
4039
4174
|
} from "circuit-to-svg";
|
|
4040
|
-
import { useEffect as
|
|
4175
|
+
import { useEffect as useEffect14, useMemo as useMemo7, useRef as useRef10, useState as useState12 } from "react";
|
|
4041
4176
|
import { toString as transformToString2 } from "transformation-matrix";
|
|
4042
4177
|
import { useMouseMatrixTransform as useMouseMatrixTransform2 } from "use-mouse-matrix-transform";
|
|
4043
4178
|
|
|
@@ -4055,8 +4190,8 @@ var getAnalogSimulationBackgroundColor = (simulationSvg, colorOverrides) => getR
|
|
|
4055
4190
|
|
|
4056
4191
|
// lib/components/AnalogSimulationSelector.tsx
|
|
4057
4192
|
import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
|
|
4058
|
-
import { useState as
|
|
4059
|
-
import { Fragment as
|
|
4193
|
+
import { useState as useState11 } from "react";
|
|
4194
|
+
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4060
4195
|
var FONT_FAMILY3 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
4061
4196
|
var contentStyles3 = {
|
|
4062
4197
|
backgroundColor: "#ffffff",
|
|
@@ -4106,7 +4241,7 @@ var MENU_CSS2 = `
|
|
|
4106
4241
|
.sv-simulation-chevron { transition: transform 0.2s ease; }
|
|
4107
4242
|
[data-state="open"] > .sv-simulation-chevron { transform: rotate(180deg); }
|
|
4108
4243
|
`;
|
|
4109
|
-
var CheckIcon3 = () => /* @__PURE__ */
|
|
4244
|
+
var CheckIcon3 = () => /* @__PURE__ */ jsx13(
|
|
4110
4245
|
"svg",
|
|
4111
4246
|
{
|
|
4112
4247
|
width: "14",
|
|
@@ -4118,10 +4253,10 @@ var CheckIcon3 = () => /* @__PURE__ */ jsx12(
|
|
|
4118
4253
|
strokeLinecap: "round",
|
|
4119
4254
|
strokeLinejoin: "round",
|
|
4120
4255
|
"aria-hidden": "true",
|
|
4121
|
-
children: /* @__PURE__ */
|
|
4256
|
+
children: /* @__PURE__ */ jsx13("path", { d: "M20 6 9 17l-5-5" })
|
|
4122
4257
|
}
|
|
4123
4258
|
);
|
|
4124
|
-
var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */
|
|
4259
|
+
var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx13(
|
|
4125
4260
|
"svg",
|
|
4126
4261
|
{
|
|
4127
4262
|
className,
|
|
@@ -4135,7 +4270,7 @@ var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx12(
|
|
|
4135
4270
|
strokeLinejoin: "round",
|
|
4136
4271
|
style: { opacity: 0.6, flexShrink: 0 },
|
|
4137
4272
|
"aria-hidden": "true",
|
|
4138
|
-
children: /* @__PURE__ */
|
|
4273
|
+
children: /* @__PURE__ */ jsx13("path", { d: "m6 9 6 6 6-6" })
|
|
4139
4274
|
}
|
|
4140
4275
|
);
|
|
4141
4276
|
var getSimulationLabels = (simulations) => {
|
|
@@ -4154,17 +4289,17 @@ var AnalogSimulationSelector = ({
|
|
|
4154
4289
|
selectedSimulationExperimentId,
|
|
4155
4290
|
onSelectSimulation
|
|
4156
4291
|
}) => {
|
|
4157
|
-
const [open, setOpen] =
|
|
4292
|
+
const [open, setOpen] = useState11(false);
|
|
4158
4293
|
if (simulations.length <= 1) return null;
|
|
4159
4294
|
const simulationLabels = getSimulationLabels(simulations);
|
|
4160
4295
|
const selectedSimulation = simulationLabels.find(
|
|
4161
4296
|
({ simulation }) => simulation.simulation_experiment_id === selectedSimulationExperimentId
|
|
4162
4297
|
);
|
|
4163
4298
|
const selectedLabel = selectedSimulation?.label ?? "Select simulation";
|
|
4164
|
-
return /* @__PURE__ */
|
|
4165
|
-
/* @__PURE__ */
|
|
4166
|
-
/* @__PURE__ */
|
|
4167
|
-
/* @__PURE__ */
|
|
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(
|
|
4168
4303
|
"button",
|
|
4169
4304
|
{
|
|
4170
4305
|
type: "button",
|
|
@@ -4191,13 +4326,13 @@ var AnalogSimulationSelector = ({
|
|
|
4191
4326
|
zIndex: zIndexMap.viewMenuIcon
|
|
4192
4327
|
},
|
|
4193
4328
|
children: [
|
|
4194
|
-
/* @__PURE__ */
|
|
4195
|
-
/* @__PURE__ */
|
|
4196
|
-
/* @__PURE__ */
|
|
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" })
|
|
4197
4332
|
]
|
|
4198
4333
|
}
|
|
4199
4334
|
) }),
|
|
4200
|
-
/* @__PURE__ */
|
|
4335
|
+
/* @__PURE__ */ jsx13(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx13(
|
|
4201
4336
|
DropdownMenu3.Content,
|
|
4202
4337
|
{
|
|
4203
4338
|
style: contentStyles3,
|
|
@@ -4207,7 +4342,7 @@ var AnalogSimulationSelector = ({
|
|
|
4207
4342
|
collisionPadding: 10,
|
|
4208
4343
|
children: simulationLabels.map(({ simulation, label }) => {
|
|
4209
4344
|
const selected = simulation.simulation_experiment_id === selectedSimulationExperimentId;
|
|
4210
|
-
return /* @__PURE__ */
|
|
4345
|
+
return /* @__PURE__ */ jsxs11(
|
|
4211
4346
|
DropdownMenu3.Item,
|
|
4212
4347
|
{
|
|
4213
4348
|
className: "sv-simulation-item",
|
|
@@ -4219,8 +4354,8 @@ var AnalogSimulationSelector = ({
|
|
|
4219
4354
|
setOpen(false);
|
|
4220
4355
|
},
|
|
4221
4356
|
children: [
|
|
4222
|
-
/* @__PURE__ */
|
|
4223
|
-
/* @__PURE__ */
|
|
4357
|
+
/* @__PURE__ */ jsx13("span", { style: iconSlotStyles3, children: selected && /* @__PURE__ */ jsx13(CheckIcon3, {}) }),
|
|
4358
|
+
/* @__PURE__ */ jsx13("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: label })
|
|
4224
4359
|
]
|
|
4225
4360
|
},
|
|
4226
4361
|
simulation.simulation_experiment_id
|
|
@@ -4233,7 +4368,7 @@ var AnalogSimulationSelector = ({
|
|
|
4233
4368
|
};
|
|
4234
4369
|
|
|
4235
4370
|
// lib/components/AnalogSimulationViewer.tsx
|
|
4236
|
-
import { jsx as
|
|
4371
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4237
4372
|
var DEFAULT_RENDER_WIDTH = 1200;
|
|
4238
4373
|
var DEFAULT_COMBINED_RENDER_ASPECT_RATIO = 1;
|
|
4239
4374
|
var DEFAULT_GRAPH_ONLY_RENDER_ASPECT_RATIO = 2;
|
|
@@ -4248,16 +4383,16 @@ var AnalogSimulationViewer = ({
|
|
|
4248
4383
|
onSimulationChange,
|
|
4249
4384
|
acSweepView = "magnitude"
|
|
4250
4385
|
}) => {
|
|
4251
|
-
const [circuitJson, setCircuitJson] =
|
|
4252
|
-
const [isLoading, setIsLoading] =
|
|
4253
|
-
const [error, setError] =
|
|
4254
|
-
const [svgObjectUrl, setSvgObjectUrl] =
|
|
4386
|
+
const [circuitJson, setCircuitJson] = useState12(null);
|
|
4387
|
+
const [isLoading, setIsLoading] = useState12(true);
|
|
4388
|
+
const [error, setError] = useState12(null);
|
|
4389
|
+
const [svgObjectUrl, setSvgObjectUrl] = useState12(null);
|
|
4255
4390
|
const containerRef = useRef10(null);
|
|
4256
4391
|
const imgRef = useRef10(null);
|
|
4257
4392
|
const { containerWidth } = useResizeHandling(
|
|
4258
4393
|
containerRef
|
|
4259
4394
|
);
|
|
4260
|
-
const [isDragging, setIsDragging] =
|
|
4395
|
+
const [isDragging, setIsDragging] = useState12(false);
|
|
4261
4396
|
const {
|
|
4262
4397
|
ref: transformRef,
|
|
4263
4398
|
cancelDrag: _cancelDrag,
|
|
@@ -4273,7 +4408,7 @@ var AnalogSimulationViewer = ({
|
|
|
4273
4408
|
const renderAspectRatio = width && height ? width / height : defaultRenderAspectRatio;
|
|
4274
4409
|
const effectiveWidth = width || (height ? height * renderAspectRatio : containerWidth) || DEFAULT_RENDER_WIDTH;
|
|
4275
4410
|
const effectiveHeight = height || effectiveWidth / renderAspectRatio;
|
|
4276
|
-
|
|
4411
|
+
useEffect14(() => {
|
|
4277
4412
|
setIsLoading(true);
|
|
4278
4413
|
setError(null);
|
|
4279
4414
|
setCircuitJson(inputCircuitJson);
|
|
@@ -4285,11 +4420,11 @@ var AnalogSimulationViewer = ({
|
|
|
4285
4420
|
(element) => element.type === "simulation_experiment"
|
|
4286
4421
|
);
|
|
4287
4422
|
}, [circuitJson]);
|
|
4288
|
-
const [selectedSimulationExperimentId, setSelectedSimulationExperimentId] =
|
|
4423
|
+
const [selectedSimulationExperimentId, setSelectedSimulationExperimentId] = useState12(null);
|
|
4289
4424
|
const simulationExperimentId = (selectedSimulationExperimentId && simulationExperiments.some(
|
|
4290
4425
|
(simulation) => simulation.simulation_experiment_id === selectedSimulationExperimentId
|
|
4291
4426
|
) ? selectedSimulationExperimentId : simulationExperiments[0]?.simulation_experiment_id) ?? null;
|
|
4292
|
-
|
|
4427
|
+
useEffect14(() => {
|
|
4293
4428
|
if (simulationExperimentId !== selectedSimulationExperimentId) {
|
|
4294
4429
|
setSelectedSimulationExperimentId(simulationExperimentId);
|
|
4295
4430
|
}
|
|
@@ -4326,7 +4461,7 @@ var AnalogSimulationViewer = ({
|
|
|
4326
4461
|
simulationExperimentId,
|
|
4327
4462
|
acSweepView
|
|
4328
4463
|
]);
|
|
4329
|
-
|
|
4464
|
+
useEffect14(() => {
|
|
4330
4465
|
if (!simulationSvg) {
|
|
4331
4466
|
setSvgObjectUrl(null);
|
|
4332
4467
|
return;
|
|
@@ -4352,7 +4487,7 @@ var AnalogSimulationViewer = ({
|
|
|
4352
4487
|
const handleTouchStart = (_e) => {
|
|
4353
4488
|
setIsDragging(true);
|
|
4354
4489
|
};
|
|
4355
|
-
|
|
4490
|
+
useEffect14(() => {
|
|
4356
4491
|
const handleMouseUp = () => {
|
|
4357
4492
|
setIsDragging(false);
|
|
4358
4493
|
};
|
|
@@ -4367,7 +4502,7 @@ var AnalogSimulationViewer = ({
|
|
|
4367
4502
|
};
|
|
4368
4503
|
}, []);
|
|
4369
4504
|
if (isLoading) {
|
|
4370
|
-
return /* @__PURE__ */
|
|
4505
|
+
return /* @__PURE__ */ jsx14(
|
|
4371
4506
|
"div",
|
|
4372
4507
|
{
|
|
4373
4508
|
style: {
|
|
@@ -4387,7 +4522,7 @@ var AnalogSimulationViewer = ({
|
|
|
4387
4522
|
);
|
|
4388
4523
|
}
|
|
4389
4524
|
if (error) {
|
|
4390
|
-
return /* @__PURE__ */
|
|
4525
|
+
return /* @__PURE__ */ jsx14(
|
|
4391
4526
|
"div",
|
|
4392
4527
|
{
|
|
4393
4528
|
style: {
|
|
@@ -4402,15 +4537,15 @@ var AnalogSimulationViewer = ({
|
|
|
4402
4537
|
...containerStyle
|
|
4403
4538
|
},
|
|
4404
4539
|
className,
|
|
4405
|
-
children: /* @__PURE__ */
|
|
4406
|
-
/* @__PURE__ */
|
|
4407
|
-
/* @__PURE__ */
|
|
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 })
|
|
4408
4543
|
] })
|
|
4409
4544
|
}
|
|
4410
4545
|
);
|
|
4411
4546
|
}
|
|
4412
4547
|
if (!simulationSvg) {
|
|
4413
|
-
return /* @__PURE__ */
|
|
4548
|
+
return /* @__PURE__ */ jsxs12(
|
|
4414
4549
|
"div",
|
|
4415
4550
|
{
|
|
4416
4551
|
style: {
|
|
@@ -4426,11 +4561,11 @@ var AnalogSimulationViewer = ({
|
|
|
4426
4561
|
},
|
|
4427
4562
|
className,
|
|
4428
4563
|
children: [
|
|
4429
|
-
/* @__PURE__ */
|
|
4430
|
-
/* @__PURE__ */
|
|
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: [
|
|
4431
4566
|
"Use",
|
|
4432
4567
|
" ",
|
|
4433
|
-
/* @__PURE__ */
|
|
4568
|
+
/* @__PURE__ */ jsx14(
|
|
4434
4569
|
"code",
|
|
4435
4570
|
{
|
|
4436
4571
|
style: {
|
|
@@ -4450,7 +4585,7 @@ var AnalogSimulationViewer = ({
|
|
|
4450
4585
|
}
|
|
4451
4586
|
);
|
|
4452
4587
|
}
|
|
4453
|
-
return /* @__PURE__ */
|
|
4588
|
+
return /* @__PURE__ */ jsxs12(
|
|
4454
4589
|
"div",
|
|
4455
4590
|
{
|
|
4456
4591
|
ref: (node) => {
|
|
@@ -4469,7 +4604,7 @@ var AnalogSimulationViewer = ({
|
|
|
4469
4604
|
onMouseDown: handleMouseDown,
|
|
4470
4605
|
onTouchStart: handleTouchStart,
|
|
4471
4606
|
children: [
|
|
4472
|
-
/* @__PURE__ */
|
|
4607
|
+
/* @__PURE__ */ jsx14(
|
|
4473
4608
|
AnalogSimulationSelector,
|
|
4474
4609
|
{
|
|
4475
4610
|
simulations: simulationExperiments,
|
|
@@ -4477,7 +4612,7 @@ var AnalogSimulationViewer = ({
|
|
|
4477
4612
|
onSelectSimulation: handleSelectSimulation
|
|
4478
4613
|
}
|
|
4479
4614
|
),
|
|
4480
|
-
svgObjectUrl ? /* @__PURE__ */
|
|
4615
|
+
svgObjectUrl ? /* @__PURE__ */ jsx14(
|
|
4481
4616
|
"img",
|
|
4482
4617
|
{
|
|
4483
4618
|
ref: imgRef,
|
|
@@ -4491,7 +4626,7 @@ var AnalogSimulationViewer = ({
|
|
|
4491
4626
|
objectFit: "contain"
|
|
4492
4627
|
}
|
|
4493
4628
|
}
|
|
4494
|
-
) : /* @__PURE__ */
|
|
4629
|
+
) : /* @__PURE__ */ jsx14(
|
|
4495
4630
|
"div",
|
|
4496
4631
|
{
|
|
4497
4632
|
style: {
|
|
@@ -4512,9 +4647,9 @@ var AnalogSimulationViewer = ({
|
|
|
4512
4647
|
};
|
|
4513
4648
|
|
|
4514
4649
|
// lib/hooks/useSchematicViewerController.ts
|
|
4515
|
-
import { useCallback as useCallback8, useMemo as useMemo8, useState as
|
|
4650
|
+
import { useCallback as useCallback8, useMemo as useMemo8, useState as useState13 } from "react";
|
|
4516
4651
|
var useSchematicViewerController = () => {
|
|
4517
|
-
const [focusRequest, setFocusRequest] =
|
|
4652
|
+
const [focusRequest, setFocusRequest] = useState13(null);
|
|
4518
4653
|
const focusSchematicComponent = useCallback8(
|
|
4519
4654
|
(schematicComponentId) => {
|
|
4520
4655
|
setFocusRequest({ schematicComponentId });
|