@tscircuit/schematic-viewer 2.0.110 → 2.0.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +313 -199
- 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 useCallback8, useEffect as
|
|
1287
|
+
import { useCallback as useCallback8, useEffect as useEffect15, useMemo as useMemo6, useRef as useRef8, 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
|
|
|
@@ -1515,6 +1515,11 @@ var getSourceComponentInfoEntries = (sourceComponent) => Object.entries(sourceCo
|
|
|
1515
1515
|
label: key,
|
|
1516
1516
|
value: formatComponentValue(sourceComponent, key, value)
|
|
1517
1517
|
}));
|
|
1518
|
+
var getDatasheetChipName = (sourceComponent) => {
|
|
1519
|
+
if (sourceComponent.ftype !== "simple_chip") return null;
|
|
1520
|
+
const partNumber = sourceComponent.manufacturer_part_number;
|
|
1521
|
+
return typeof partNumber === "string" && partNumber.trim() ? partNumber.trim() : null;
|
|
1522
|
+
};
|
|
1518
1523
|
var getSupplierPartNumberEntries = (sourceComponent) => {
|
|
1519
1524
|
const supplierPartNumbers = sourceComponent.supplier_part_numbers;
|
|
1520
1525
|
if (!supplierPartNumbers) return [];
|
|
@@ -1823,9 +1828,89 @@ var MouseTrackerProvider = ({ children }) => {
|
|
|
1823
1828
|
// lib/components/SchematicComponentDetailsTooltip.tsx
|
|
1824
1829
|
import { useMemo as useMemo3 } from "react";
|
|
1825
1830
|
|
|
1826
|
-
// lib/components/
|
|
1831
|
+
// lib/components/DatasheetDescription.tsx
|
|
1827
1832
|
import { useEffect as useEffect8, useState as useState5 } from "react";
|
|
1828
1833
|
|
|
1834
|
+
// lib/utils/datasheet-description.ts
|
|
1835
|
+
var fetchDatasheetDescription = async (chipName, signal, platformFetch = fetch) => {
|
|
1836
|
+
const response = await platformFetch(
|
|
1837
|
+
`https://api.tscircuit.com/datasheets/get?chip_name=${encodeURIComponent(chipName)}`,
|
|
1838
|
+
{ signal }
|
|
1839
|
+
);
|
|
1840
|
+
if (!response.ok) throw new Error("Datasheet lookup failed");
|
|
1841
|
+
const data = await response.json();
|
|
1842
|
+
const description = data?.datasheet?.ai_description;
|
|
1843
|
+
return typeof description === "string" && description.trim() ? description.trim() : null;
|
|
1844
|
+
};
|
|
1845
|
+
|
|
1846
|
+
// lib/components/DatasheetDescription.tsx
|
|
1847
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
1848
|
+
var COLLAPSED_DESCRIPTION_LENGTH = 100;
|
|
1849
|
+
var DatasheetDescription = ({
|
|
1850
|
+
chipName,
|
|
1851
|
+
platformConfig
|
|
1852
|
+
}) => {
|
|
1853
|
+
const [description, setDescription] = useState5(null);
|
|
1854
|
+
const [loading, setLoading] = useState5(true);
|
|
1855
|
+
const [expanded, setExpanded] = useState5(false);
|
|
1856
|
+
const platformFetch = platformConfig?.platformFetch;
|
|
1857
|
+
useEffect8(() => {
|
|
1858
|
+
const controller = new AbortController();
|
|
1859
|
+
let active = true;
|
|
1860
|
+
setLoading(true);
|
|
1861
|
+
setDescription(null);
|
|
1862
|
+
setExpanded(false);
|
|
1863
|
+
const timeout = setTimeout(() => {
|
|
1864
|
+
controller.abort();
|
|
1865
|
+
if (active) setLoading(false);
|
|
1866
|
+
}, 1e4);
|
|
1867
|
+
Promise.resolve().then(
|
|
1868
|
+
() => fetchDatasheetDescription(chipName, controller.signal, platformFetch)
|
|
1869
|
+
).then((result) => {
|
|
1870
|
+
if (active) setDescription(result);
|
|
1871
|
+
}).catch(() => {
|
|
1872
|
+
}).finally(() => {
|
|
1873
|
+
clearTimeout(timeout);
|
|
1874
|
+
if (active) setLoading(false);
|
|
1875
|
+
});
|
|
1876
|
+
return () => {
|
|
1877
|
+
active = false;
|
|
1878
|
+
clearTimeout(timeout);
|
|
1879
|
+
controller.abort();
|
|
1880
|
+
};
|
|
1881
|
+
}, [chipName, platformFetch]);
|
|
1882
|
+
const isCollapsed = !expanded && description !== null && description.length > COLLAPSED_DESCRIPTION_LENGTH;
|
|
1883
|
+
return /* @__PURE__ */ jsx3(
|
|
1884
|
+
"span",
|
|
1885
|
+
{
|
|
1886
|
+
role: "status",
|
|
1887
|
+
"aria-label": `${chipName} description`,
|
|
1888
|
+
"aria-busy": loading,
|
|
1889
|
+
style: loading ? { color: "#64748b" } : void 0,
|
|
1890
|
+
children: loading ? "Loading\u2026" : description && isCollapsed ? /* @__PURE__ */ jsx3(
|
|
1891
|
+
"span",
|
|
1892
|
+
{
|
|
1893
|
+
role: "button",
|
|
1894
|
+
tabIndex: 0,
|
|
1895
|
+
"aria-expanded": false,
|
|
1896
|
+
title: "Show full description",
|
|
1897
|
+
style: { cursor: "pointer" },
|
|
1898
|
+
onClick: () => setExpanded(true),
|
|
1899
|
+
onKeyDown: (event) => {
|
|
1900
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
1901
|
+
event.preventDefault();
|
|
1902
|
+
setExpanded(true);
|
|
1903
|
+
},
|
|
1904
|
+
children: `${description.slice(0, COLLAPSED_DESCRIPTION_LENGTH).trimEnd()}...`
|
|
1905
|
+
}
|
|
1906
|
+
) : description ?? "-"
|
|
1907
|
+
}
|
|
1908
|
+
);
|
|
1909
|
+
};
|
|
1910
|
+
|
|
1911
|
+
// lib/components/JlcPartAvailability.tsx
|
|
1912
|
+
import { useEffect as useEffect9, useState as useState6 } from "react";
|
|
1913
|
+
|
|
1829
1914
|
// lib/utils/jlc-part-availability.ts
|
|
1830
1915
|
var nonNegativeNumber = (value) => {
|
|
1831
1916
|
if (typeof value !== "number" && typeof value !== "string") return null;
|
|
@@ -1873,7 +1958,7 @@ var fetchJlcPartAvailability = async (partNumber, signal, platformFetch = fetch)
|
|
|
1873
1958
|
};
|
|
1874
1959
|
|
|
1875
1960
|
// lib/components/JlcPartAvailability.tsx
|
|
1876
|
-
import { Fragment as Fragment3, jsx as
|
|
1961
|
+
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1877
1962
|
var formatPrice = (availability) => {
|
|
1878
1963
|
if (availability?.price == null) return "Price unavailable";
|
|
1879
1964
|
const options = { minimumFractionDigits: 2, maximumFractionDigits: 6 };
|
|
@@ -1890,11 +1975,11 @@ var JlcPartAvailability = ({
|
|
|
1890
1975
|
partNumber,
|
|
1891
1976
|
platformConfig
|
|
1892
1977
|
}) => {
|
|
1893
|
-
const [result, setResult] =
|
|
1894
|
-
const [loading, setLoading] =
|
|
1978
|
+
const [result, setResult] = useState6(null);
|
|
1979
|
+
const [loading, setLoading] = useState6(true);
|
|
1895
1980
|
const partsEngine = platformConfig?.partsEngine;
|
|
1896
1981
|
const platformFetch = platformConfig?.platformFetch;
|
|
1897
|
-
|
|
1982
|
+
useEffect9(() => {
|
|
1898
1983
|
const controller = new AbortController();
|
|
1899
1984
|
let active = true;
|
|
1900
1985
|
setLoading(true);
|
|
@@ -1930,7 +2015,7 @@ var JlcPartAvailability = ({
|
|
|
1930
2015
|
controller.abort();
|
|
1931
2016
|
};
|
|
1932
2017
|
}, [partNumber, partsEngine, platformFetch]);
|
|
1933
|
-
return /* @__PURE__ */
|
|
2018
|
+
return /* @__PURE__ */ jsx4(
|
|
1934
2019
|
"span",
|
|
1935
2020
|
{
|
|
1936
2021
|
role: "status",
|
|
@@ -1938,7 +2023,7 @@ var JlcPartAvailability = ({
|
|
|
1938
2023
|
"aria-busy": loading,
|
|
1939
2024
|
style: { display: "block", color: "#64748b", marginTop: "2px" },
|
|
1940
2025
|
children: loading ? /* @__PURE__ */ jsxs2("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
|
|
1941
|
-
/* @__PURE__ */
|
|
2026
|
+
/* @__PURE__ */ jsx4("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(
|
|
1942
2027
|
"circle",
|
|
1943
2028
|
{
|
|
1944
2029
|
cx: "6",
|
|
@@ -1948,7 +2033,7 @@ var JlcPartAvailability = ({
|
|
|
1948
2033
|
stroke: "currentColor",
|
|
1949
2034
|
strokeWidth: "2",
|
|
1950
2035
|
strokeDasharray: "18 8",
|
|
1951
|
-
children: /* @__PURE__ */
|
|
2036
|
+
children: /* @__PURE__ */ jsx4(
|
|
1952
2037
|
"animateTransform",
|
|
1953
2038
|
{
|
|
1954
2039
|
attributeName: "transform",
|
|
@@ -1963,15 +2048,15 @@ var JlcPartAvailability = ({
|
|
|
1963
2048
|
) }),
|
|
1964
2049
|
"Loading price and stock\u2026"
|
|
1965
2050
|
] }) : /* @__PURE__ */ jsxs2(Fragment3, { children: [
|
|
1966
|
-
/* @__PURE__ */
|
|
1967
|
-
/* @__PURE__ */
|
|
2051
|
+
/* @__PURE__ */ jsx4("span", { style: { display: "block" }, children: formatPrice(result) }),
|
|
2052
|
+
/* @__PURE__ */ jsx4("span", { style: { display: "block" }, children: result?.stock != null ? `${result.stock.toLocaleString("en-US")} in stock` : "Stock unavailable" })
|
|
1968
2053
|
] })
|
|
1969
2054
|
}
|
|
1970
2055
|
);
|
|
1971
2056
|
};
|
|
1972
2057
|
|
|
1973
2058
|
// lib/components/SchematicComponentDetailsTooltip.tsx
|
|
1974
|
-
import { jsx as
|
|
2059
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1975
2060
|
var detailLabelStyle = {
|
|
1976
2061
|
color: "#64748b",
|
|
1977
2062
|
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',
|
|
@@ -1995,6 +2080,10 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
1995
2080
|
() => getSourceComponentInfoEntries(sourceComponent),
|
|
1996
2081
|
[sourceComponent]
|
|
1997
2082
|
);
|
|
2083
|
+
const datasheetChipName = useMemo3(
|
|
2084
|
+
() => getDatasheetChipName(sourceComponent),
|
|
2085
|
+
[sourceComponent]
|
|
2086
|
+
);
|
|
1998
2087
|
const supplierPartNumberEntries = useMemo3(
|
|
1999
2088
|
() => getSupplierPartNumberEntries(sourceComponent),
|
|
2000
2089
|
[sourceComponent]
|
|
@@ -2053,8 +2142,8 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
2053
2142
|
},
|
|
2054
2143
|
children: [
|
|
2055
2144
|
infoEntries.map((entry) => /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
|
|
2056
|
-
/* @__PURE__ */
|
|
2057
|
-
/* @__PURE__ */
|
|
2145
|
+
/* @__PURE__ */ jsx5("dt", { style: detailLabelStyle, children: entry.label }),
|
|
2146
|
+
/* @__PURE__ */ jsx5(
|
|
2058
2147
|
"dd",
|
|
2059
2148
|
{
|
|
2060
2149
|
style: {
|
|
@@ -2070,9 +2159,34 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
2070
2159
|
}
|
|
2071
2160
|
)
|
|
2072
2161
|
] }, entry.key)),
|
|
2162
|
+
datasheetChipName && /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
|
|
2163
|
+
/* @__PURE__ */ jsx5("dt", { style: detailLabelStyle, children: "description" }),
|
|
2164
|
+
/* @__PURE__ */ jsx5(
|
|
2165
|
+
"dd",
|
|
2166
|
+
{
|
|
2167
|
+
style: {
|
|
2168
|
+
minWidth: 0,
|
|
2169
|
+
margin: 0,
|
|
2170
|
+
color: "#1e293b",
|
|
2171
|
+
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',
|
|
2172
|
+
fontSize: "12px",
|
|
2173
|
+
lineHeight: 1.45,
|
|
2174
|
+
overflowWrap: "anywhere"
|
|
2175
|
+
},
|
|
2176
|
+
children: /* @__PURE__ */ jsx5(
|
|
2177
|
+
DatasheetDescription,
|
|
2178
|
+
{
|
|
2179
|
+
chipName: datasheetChipName,
|
|
2180
|
+
platformConfig
|
|
2181
|
+
},
|
|
2182
|
+
datasheetChipName
|
|
2183
|
+
)
|
|
2184
|
+
}
|
|
2185
|
+
)
|
|
2186
|
+
] }),
|
|
2073
2187
|
supplierPartNumberEntries.map((entry) => /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
|
|
2074
|
-
/* @__PURE__ */
|
|
2075
|
-
/* @__PURE__ */
|
|
2188
|
+
/* @__PURE__ */ jsx5("dt", { style: detailLabelStyle, children: entry.label }),
|
|
2189
|
+
/* @__PURE__ */ jsx5(
|
|
2076
2190
|
"dd",
|
|
2077
2191
|
{
|
|
2078
2192
|
style: {
|
|
@@ -2089,7 +2203,7 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
2089
2203
|
style: entry.label === "jlcpcb" ? { display: "block", marginTop: index > 0 ? 6 : 0 } : void 0,
|
|
2090
2204
|
children: [
|
|
2091
2205
|
entry.label !== "jlcpcb" && index > 0 && ", ",
|
|
2092
|
-
/* @__PURE__ */
|
|
2206
|
+
/* @__PURE__ */ jsx5(
|
|
2093
2207
|
"a",
|
|
2094
2208
|
{
|
|
2095
2209
|
href: link.href,
|
|
@@ -2099,7 +2213,7 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
2099
2213
|
children: link.partNumber
|
|
2100
2214
|
}
|
|
2101
2215
|
),
|
|
2102
|
-
entry.label === "jlcpcb" && /* @__PURE__ */
|
|
2216
|
+
entry.label === "jlcpcb" && /* @__PURE__ */ jsx5(
|
|
2103
2217
|
JlcPartAvailability,
|
|
2104
2218
|
{
|
|
2105
2219
|
partNumber: link.partNumber,
|
|
@@ -2115,8 +2229,8 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
2115
2229
|
)
|
|
2116
2230
|
] }, entry.key)),
|
|
2117
2231
|
footprinterString && /* @__PURE__ */ jsxs3("div", { style: { display: "contents" }, children: [
|
|
2118
|
-
/* @__PURE__ */
|
|
2119
|
-
/* @__PURE__ */
|
|
2232
|
+
/* @__PURE__ */ jsx5("dt", { style: detailLabelStyle, children: "footprint" }),
|
|
2233
|
+
/* @__PURE__ */ jsx5(
|
|
2120
2234
|
"dd",
|
|
2121
2235
|
{
|
|
2122
2236
|
style: {
|
|
@@ -2156,11 +2270,11 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
2156
2270
|
warnings.length,
|
|
2157
2271
|
")"
|
|
2158
2272
|
] }),
|
|
2159
|
-
/* @__PURE__ */
|
|
2273
|
+
/* @__PURE__ */ jsx5("ul", { style: { margin: "4px 0 0", paddingLeft: "18px" }, children: warnings.map((warning, index) => /* @__PURE__ */ jsx5("li", { children: warning.message }, `${warning.type}-${index}`)) })
|
|
2160
2274
|
]
|
|
2161
2275
|
}
|
|
2162
2276
|
),
|
|
2163
|
-
footprintPreviewUrl && /* @__PURE__ */
|
|
2277
|
+
footprintPreviewUrl && /* @__PURE__ */ jsx5("div", { style: { padding: "0 4px 4px" }, children: /* @__PURE__ */ jsx5(
|
|
2164
2278
|
"div",
|
|
2165
2279
|
{
|
|
2166
2280
|
style: {
|
|
@@ -2170,7 +2284,7 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
2170
2284
|
borderRadius: "2px",
|
|
2171
2285
|
background: "#f8fafc"
|
|
2172
2286
|
},
|
|
2173
|
-
children: /* @__PURE__ */
|
|
2287
|
+
children: /* @__PURE__ */ jsx5(
|
|
2174
2288
|
"img",
|
|
2175
2289
|
{
|
|
2176
2290
|
src: footprintPreviewUrl,
|
|
@@ -2193,12 +2307,12 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
2193
2307
|
};
|
|
2194
2308
|
|
|
2195
2309
|
// lib/components/SchematicComponentMouseTarget.tsx
|
|
2196
|
-
import { useCallback as useCallback6, useEffect as
|
|
2310
|
+
import { useCallback as useCallback6, useEffect as useEffect12 } from "react";
|
|
2197
2311
|
|
|
2198
2312
|
// lib/hooks/useMouseEventsOverBoundingBox.ts
|
|
2199
2313
|
import {
|
|
2200
2314
|
useContext as useContext2,
|
|
2201
|
-
useEffect as
|
|
2315
|
+
useEffect as useEffect10,
|
|
2202
2316
|
useId,
|
|
2203
2317
|
useMemo as useMemo4,
|
|
2204
2318
|
useRef as useRef5,
|
|
@@ -2220,7 +2334,7 @@ var useMouseEventsOverBoundingBox = (options) => {
|
|
|
2220
2334
|
},
|
|
2221
2335
|
[]
|
|
2222
2336
|
);
|
|
2223
|
-
|
|
2337
|
+
useEffect10(() => {
|
|
2224
2338
|
context.registerBoundingBox(id, {
|
|
2225
2339
|
bounds: latestOptionsRef.current.bounds,
|
|
2226
2340
|
onClick: latestOptionsRef.current.onClick ? handleClick : void 0
|
|
@@ -2229,7 +2343,7 @@ var useMouseEventsOverBoundingBox = (options) => {
|
|
|
2229
2343
|
context.unregisterBoundingBox(id);
|
|
2230
2344
|
};
|
|
2231
2345
|
}, [context, handleClick, id]);
|
|
2232
|
-
|
|
2346
|
+
useEffect10(() => {
|
|
2233
2347
|
context.updateBoundingBox(id, {
|
|
2234
2348
|
bounds: latestOptionsRef.current.bounds,
|
|
2235
2349
|
onClick: latestOptionsRef.current.onClick ? handleClick : void 0
|
|
@@ -2253,7 +2367,7 @@ var useMouseEventsOverBoundingBox = (options) => {
|
|
|
2253
2367
|
};
|
|
2254
2368
|
|
|
2255
2369
|
// lib/hooks/useSvgElementMeasurement.ts
|
|
2256
|
-
import { useCallback as useCallback5, useEffect as
|
|
2370
|
+
import { useCallback as useCallback5, useEffect as useEffect11, useRef as useRef6, useState as useState7 } from "react";
|
|
2257
2371
|
var areMeasurementsEqual = (a, b) => {
|
|
2258
2372
|
if (!a && !b) return true;
|
|
2259
2373
|
if (!a || !b) return false;
|
|
@@ -2266,7 +2380,7 @@ var useSvgElementMeasurement = ({
|
|
|
2266
2380
|
circuitJsonKey,
|
|
2267
2381
|
padding = 0
|
|
2268
2382
|
}) => {
|
|
2269
|
-
const [measurement, setMeasurement] =
|
|
2383
|
+
const [measurement, setMeasurement] = useState7(
|
|
2270
2384
|
null
|
|
2271
2385
|
);
|
|
2272
2386
|
const frameRef = useRef6(null);
|
|
@@ -2309,10 +2423,10 @@ var useSvgElementMeasurement = ({
|
|
|
2309
2423
|
if (frameRef.current !== null) return;
|
|
2310
2424
|
frameRef.current = window.requestAnimationFrame(measure);
|
|
2311
2425
|
}, [measure]);
|
|
2312
|
-
|
|
2426
|
+
useEffect11(() => {
|
|
2313
2427
|
scheduleMeasure();
|
|
2314
2428
|
}, [scheduleMeasure, circuitJsonKey]);
|
|
2315
|
-
|
|
2429
|
+
useEffect11(() => {
|
|
2316
2430
|
scheduleMeasure();
|
|
2317
2431
|
const svgDiv = svgDivRef.current;
|
|
2318
2432
|
const container = containerRef.current;
|
|
@@ -2348,7 +2462,7 @@ var useSvgElementMeasurement = ({
|
|
|
2348
2462
|
};
|
|
2349
2463
|
|
|
2350
2464
|
// lib/components/SchematicComponentMouseTarget.tsx
|
|
2351
|
-
import { jsx as
|
|
2465
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
2352
2466
|
var SchematicComponentMouseTarget = ({
|
|
2353
2467
|
componentId,
|
|
2354
2468
|
svgDivRef,
|
|
@@ -2377,7 +2491,7 @@ var SchematicComponentMouseTarget = ({
|
|
|
2377
2491
|
bounds,
|
|
2378
2492
|
onClick: onComponentClick ? handleClick : void 0
|
|
2379
2493
|
});
|
|
2380
|
-
|
|
2494
|
+
useEffect12(() => {
|
|
2381
2495
|
if (onHoverChange) {
|
|
2382
2496
|
onHoverChange(componentId, hovering);
|
|
2383
2497
|
}
|
|
@@ -2386,7 +2500,7 @@ var SchematicComponentMouseTarget = ({
|
|
|
2386
2500
|
return null;
|
|
2387
2501
|
}
|
|
2388
2502
|
const rect = measurement.rect;
|
|
2389
|
-
return /* @__PURE__ */
|
|
2503
|
+
return /* @__PURE__ */ jsx6(
|
|
2390
2504
|
"div",
|
|
2391
2505
|
{
|
|
2392
2506
|
style: {
|
|
@@ -2404,7 +2518,7 @@ var SchematicComponentMouseTarget = ({
|
|
|
2404
2518
|
};
|
|
2405
2519
|
|
|
2406
2520
|
// lib/components/SchematicElementHighlight.tsx
|
|
2407
|
-
import { jsx as
|
|
2521
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
2408
2522
|
var SchematicElementHighlight = ({
|
|
2409
2523
|
selector,
|
|
2410
2524
|
svgDivRef,
|
|
@@ -2419,7 +2533,7 @@ var SchematicElementHighlight = ({
|
|
|
2419
2533
|
padding: 4
|
|
2420
2534
|
});
|
|
2421
2535
|
if (!measurement) return null;
|
|
2422
|
-
return /* @__PURE__ */
|
|
2536
|
+
return /* @__PURE__ */ jsx7(
|
|
2423
2537
|
"div",
|
|
2424
2538
|
{
|
|
2425
2539
|
"data-schematic-element-highlight": true,
|
|
@@ -2439,8 +2553,8 @@ var SchematicElementHighlight = ({
|
|
|
2439
2553
|
};
|
|
2440
2554
|
|
|
2441
2555
|
// lib/components/SchematicPortMouseTarget.tsx
|
|
2442
|
-
import { useCallback as useCallback7, useEffect as
|
|
2443
|
-
import { Fragment as Fragment4, jsx as
|
|
2556
|
+
import { useCallback as useCallback7, useEffect as useEffect13 } from "react";
|
|
2557
|
+
import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2444
2558
|
var SchematicPortMouseTarget = ({
|
|
2445
2559
|
portId,
|
|
2446
2560
|
portLabel,
|
|
@@ -2472,7 +2586,7 @@ var SchematicPortMouseTarget = ({
|
|
|
2472
2586
|
bounds,
|
|
2473
2587
|
onClick: onPortClick ? handleClick : void 0
|
|
2474
2588
|
});
|
|
2475
|
-
|
|
2589
|
+
useEffect13(() => {
|
|
2476
2590
|
if (onHoverChange) {
|
|
2477
2591
|
onHoverChange(portId, hovering);
|
|
2478
2592
|
}
|
|
@@ -2482,7 +2596,7 @@ var SchematicPortMouseTarget = ({
|
|
|
2482
2596
|
}
|
|
2483
2597
|
const rect = measurement.rect;
|
|
2484
2598
|
return /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
2485
|
-
/* @__PURE__ */
|
|
2599
|
+
/* @__PURE__ */ jsx8(
|
|
2486
2600
|
"div",
|
|
2487
2601
|
{
|
|
2488
2602
|
style: {
|
|
@@ -2500,7 +2614,7 @@ var SchematicPortMouseTarget = ({
|
|
|
2500
2614
|
}
|
|
2501
2615
|
}
|
|
2502
2616
|
),
|
|
2503
|
-
hovering && portLabel && /* @__PURE__ */
|
|
2617
|
+
hovering && portLabel && /* @__PURE__ */ jsx8(
|
|
2504
2618
|
"div",
|
|
2505
2619
|
{
|
|
2506
2620
|
style: {
|
|
@@ -2525,15 +2639,15 @@ var SchematicPortMouseTarget = ({
|
|
|
2525
2639
|
};
|
|
2526
2640
|
|
|
2527
2641
|
// lib/components/SchematicSearch.tsx
|
|
2528
|
-
import { useEffect as
|
|
2642
|
+
import { useEffect as useEffect14, useRef as useRef7, useState as useState8 } from "react";
|
|
2529
2643
|
|
|
2530
2644
|
// lib/components/SchematicSearchIcons.tsx
|
|
2531
|
-
import { jsx as
|
|
2645
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2532
2646
|
var Icon = ({
|
|
2533
2647
|
children,
|
|
2534
2648
|
size,
|
|
2535
2649
|
strokeWidth
|
|
2536
|
-
}) => /* @__PURE__ */
|
|
2650
|
+
}) => /* @__PURE__ */ jsx9(
|
|
2537
2651
|
"svg",
|
|
2538
2652
|
{
|
|
2539
2653
|
width: size,
|
|
@@ -2549,30 +2663,30 @@ var Icon = ({
|
|
|
2549
2663
|
}
|
|
2550
2664
|
);
|
|
2551
2665
|
var SearchIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
|
|
2552
|
-
/* @__PURE__ */
|
|
2553
|
-
/* @__PURE__ */
|
|
2666
|
+
/* @__PURE__ */ jsx9("circle", { cx: "11", cy: "11", r: "8" }),
|
|
2667
|
+
/* @__PURE__ */ jsx9("path", { d: "m21 21-4.34-4.34" })
|
|
2554
2668
|
] });
|
|
2555
2669
|
var CloseIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
|
|
2556
|
-
/* @__PURE__ */
|
|
2557
|
-
/* @__PURE__ */
|
|
2670
|
+
/* @__PURE__ */ jsx9("path", { d: "M18 6 6 18" }),
|
|
2671
|
+
/* @__PURE__ */ jsx9("path", { d: "m6 6 12 12" })
|
|
2558
2672
|
] });
|
|
2559
2673
|
var ComponentIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
|
|
2560
|
-
/* @__PURE__ */
|
|
2561
|
-
/* @__PURE__ */
|
|
2562
|
-
/* @__PURE__ */
|
|
2674
|
+
/* @__PURE__ */ jsx9("rect", { x: "4", y: "4", width: "16", height: "16", rx: "2" }),
|
|
2675
|
+
/* @__PURE__ */ jsx9("rect", { x: "8", y: "8", width: "8", height: "8", rx: "1" }),
|
|
2676
|
+
/* @__PURE__ */ jsx9("path", { d: "M7 2v2M12 2v2M17 2v2M7 20v2M12 20v2M17 20v2M2 7h2M2 12h2M2 17h2M20 7h2M20 12h2M20 17h2" })
|
|
2563
2677
|
] });
|
|
2564
2678
|
var NetIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
|
|
2565
|
-
/* @__PURE__ */
|
|
2566
|
-
/* @__PURE__ */
|
|
2567
|
-
/* @__PURE__ */
|
|
2679
|
+
/* @__PURE__ */ jsx9("path", { d: "M15 6a9 9 0 0 0-9 9V3" }),
|
|
2680
|
+
/* @__PURE__ */ jsx9("circle", { cx: "18", cy: "6", r: "3" }),
|
|
2681
|
+
/* @__PURE__ */ jsx9("circle", { cx: "6", cy: "18", r: "3" })
|
|
2568
2682
|
] });
|
|
2569
2683
|
var EnterIcon = (props) => /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
|
|
2570
|
-
/* @__PURE__ */
|
|
2571
|
-
/* @__PURE__ */
|
|
2684
|
+
/* @__PURE__ */ jsx9("path", { d: "M20 4v7a4 4 0 0 1-4 4H4" }),
|
|
2685
|
+
/* @__PURE__ */ jsx9("path", { d: "m9 10-5 5 5 5" })
|
|
2572
2686
|
] });
|
|
2573
2687
|
|
|
2574
2688
|
// lib/components/SchematicSearch.tsx
|
|
2575
|
-
import { Fragment as Fragment5, jsx as
|
|
2689
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2576
2690
|
var HighlightedSearchText = ({
|
|
2577
2691
|
text,
|
|
2578
2692
|
query
|
|
@@ -2588,7 +2702,7 @@ var HighlightedSearchText = ({
|
|
|
2588
2702
|
parts.push(text.slice(cursor, matchIndex));
|
|
2589
2703
|
}
|
|
2590
2704
|
parts.push(
|
|
2591
|
-
/* @__PURE__ */
|
|
2705
|
+
/* @__PURE__ */ jsx10("strong", { style: { fontWeight: 700 }, children: text.slice(matchIndex, matchIndex + normalizedQuery.length) }, `${matchIndex}-${cursor}`)
|
|
2592
2706
|
);
|
|
2593
2707
|
cursor = matchIndex + normalizedQuery.length;
|
|
2594
2708
|
matchIndex = normalizedText.indexOf(normalizedQuery, cursor);
|
|
@@ -2610,13 +2724,13 @@ var SchematicSearch = ({
|
|
|
2610
2724
|
onSelect,
|
|
2611
2725
|
viewerContainerRef
|
|
2612
2726
|
}) => {
|
|
2613
|
-
const [isOpen, setIsOpen] =
|
|
2614
|
-
const [activeResultId, setActiveResultId] =
|
|
2615
|
-
const [hoveredResultId, setHoveredResultId] =
|
|
2727
|
+
const [isOpen, setIsOpen] = useState8(false);
|
|
2728
|
+
const [activeResultId, setActiveResultId] = useState8(null);
|
|
2729
|
+
const [hoveredResultId, setHoveredResultId] = useState8(null);
|
|
2616
2730
|
const inputRef = useRef7(null);
|
|
2617
2731
|
const resultsListRef = useRef7(null);
|
|
2618
2732
|
const shortcutLabel = getShortcutLabel();
|
|
2619
|
-
|
|
2733
|
+
useEffect14(() => {
|
|
2620
2734
|
setActiveResultId((currentId) => {
|
|
2621
2735
|
if (results.some((result) => result.target.id === currentId)) {
|
|
2622
2736
|
return currentId;
|
|
@@ -2624,11 +2738,11 @@ var SchematicSearch = ({
|
|
|
2624
2738
|
return results.find((result) => result.kind === "component")?.target.id ?? results[0]?.target.id ?? null;
|
|
2625
2739
|
});
|
|
2626
2740
|
}, [results]);
|
|
2627
|
-
|
|
2741
|
+
useEffect14(() => {
|
|
2628
2742
|
if (!activeResultId) return;
|
|
2629
2743
|
resultsListRef.current?.querySelector(`[data-search-result-id="${activeResultId}"]`)?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
2630
2744
|
}, [activeResultId]);
|
|
2631
|
-
|
|
2745
|
+
useEffect14(() => {
|
|
2632
2746
|
const handleSearchShortcut = (event) => {
|
|
2633
2747
|
if (event.key === "Escape" && isOpen) {
|
|
2634
2748
|
event.preventDefault();
|
|
@@ -2730,7 +2844,7 @@ var SchematicSearch = ({
|
|
|
2730
2844
|
const renderResultSection = (title, sectionResults) => {
|
|
2731
2845
|
if (sectionResults.length === 0) return null;
|
|
2732
2846
|
return /* @__PURE__ */ jsxs6("section", { children: [
|
|
2733
|
-
/* @__PURE__ */
|
|
2847
|
+
/* @__PURE__ */ jsx10(
|
|
2734
2848
|
"div",
|
|
2735
2849
|
{
|
|
2736
2850
|
style: {
|
|
@@ -2750,9 +2864,9 @@ var SchematicSearch = ({
|
|
|
2750
2864
|
const hovering = result.target.id === hoveredResultId;
|
|
2751
2865
|
let resultBackground = "#ffffff";
|
|
2752
2866
|
if (hovering || active) resultBackground = "#f1f3f5";
|
|
2753
|
-
let resultIcon = /* @__PURE__ */
|
|
2867
|
+
let resultIcon = /* @__PURE__ */ jsx10(NetIcon, { size: 15, strokeWidth: 1.8 });
|
|
2754
2868
|
if (result.kind === "component") {
|
|
2755
|
-
resultIcon = /* @__PURE__ */
|
|
2869
|
+
resultIcon = /* @__PURE__ */ jsx10(ComponentIcon, { size: 15, strokeWidth: 1.8 });
|
|
2756
2870
|
}
|
|
2757
2871
|
const selectResult = () => {
|
|
2758
2872
|
inputRef.current?.blur();
|
|
@@ -2785,7 +2899,7 @@ var SchematicSearch = ({
|
|
|
2785
2899
|
textAlign: "left"
|
|
2786
2900
|
},
|
|
2787
2901
|
children: [
|
|
2788
|
-
/* @__PURE__ */
|
|
2902
|
+
/* @__PURE__ */ jsx10(
|
|
2789
2903
|
"span",
|
|
2790
2904
|
{
|
|
2791
2905
|
style: {
|
|
@@ -2803,7 +2917,7 @@ var SchematicSearch = ({
|
|
|
2803
2917
|
}
|
|
2804
2918
|
),
|
|
2805
2919
|
/* @__PURE__ */ jsxs6("span", { style: { minWidth: 0, flex: 1 }, children: [
|
|
2806
|
-
/* @__PURE__ */
|
|
2920
|
+
/* @__PURE__ */ jsx10(
|
|
2807
2921
|
"span",
|
|
2808
2922
|
{
|
|
2809
2923
|
style: {
|
|
@@ -2815,10 +2929,10 @@ var SchematicSearch = ({
|
|
|
2815
2929
|
textOverflow: "ellipsis",
|
|
2816
2930
|
whiteSpace: "nowrap"
|
|
2817
2931
|
},
|
|
2818
|
-
children: /* @__PURE__ */
|
|
2932
|
+
children: /* @__PURE__ */ jsx10(HighlightedSearchText, { text: result.label, query })
|
|
2819
2933
|
}
|
|
2820
2934
|
),
|
|
2821
|
-
result.detail && /* @__PURE__ */
|
|
2935
|
+
result.detail && /* @__PURE__ */ jsx10(
|
|
2822
2936
|
"span",
|
|
2823
2937
|
{
|
|
2824
2938
|
style: {
|
|
@@ -2854,7 +2968,7 @@ var SchematicSearch = ({
|
|
|
2854
2968
|
}
|
|
2855
2969
|
)
|
|
2856
2970
|
] }),
|
|
2857
|
-
active && /* @__PURE__ */
|
|
2971
|
+
active && /* @__PURE__ */ jsx10(
|
|
2858
2972
|
"span",
|
|
2859
2973
|
{
|
|
2860
2974
|
title: "Press Enter to open",
|
|
@@ -2864,7 +2978,7 @@ var SchematicSearch = ({
|
|
|
2864
2978
|
fontSize: "17px",
|
|
2865
2979
|
lineHeight: 1
|
|
2866
2980
|
},
|
|
2867
|
-
children: /* @__PURE__ */
|
|
2981
|
+
children: /* @__PURE__ */ jsx10(EnterIcon, { size: 14, strokeWidth: 1.8 })
|
|
2868
2982
|
}
|
|
2869
2983
|
)
|
|
2870
2984
|
]
|
|
@@ -2874,7 +2988,7 @@ var SchematicSearch = ({
|
|
|
2874
2988
|
})
|
|
2875
2989
|
] });
|
|
2876
2990
|
};
|
|
2877
|
-
return /* @__PURE__ */
|
|
2991
|
+
return /* @__PURE__ */ jsx10(
|
|
2878
2992
|
"div",
|
|
2879
2993
|
{
|
|
2880
2994
|
"data-schematic-search": true,
|
|
@@ -2887,7 +3001,7 @@ var SchematicSearch = ({
|
|
|
2887
3001
|
zIndex: zIndexMap.schematicSearch,
|
|
2888
3002
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
|
|
2889
3003
|
},
|
|
2890
|
-
children: !isOpen ? /* @__PURE__ */
|
|
3004
|
+
children: !isOpen ? /* @__PURE__ */ jsx10(
|
|
2891
3005
|
"button",
|
|
2892
3006
|
{
|
|
2893
3007
|
type: "button",
|
|
@@ -2918,7 +3032,7 @@ var SchematicSearch = ({
|
|
|
2918
3032
|
cursor: "pointer",
|
|
2919
3033
|
boxShadow: "0 2px 4px rgba(0,0,0,0.1)"
|
|
2920
3034
|
},
|
|
2921
|
-
children: /* @__PURE__ */
|
|
3035
|
+
children: /* @__PURE__ */ jsx10(SearchIcon, { size: 16, strokeWidth: 2 })
|
|
2922
3036
|
}
|
|
2923
3037
|
) : /* @__PURE__ */ jsxs6(
|
|
2924
3038
|
"div",
|
|
@@ -2946,8 +3060,8 @@ var SchematicSearch = ({
|
|
|
2946
3060
|
borderBottom: searchHeaderBorder
|
|
2947
3061
|
},
|
|
2948
3062
|
children: [
|
|
2949
|
-
/* @__PURE__ */
|
|
2950
|
-
/* @__PURE__ */
|
|
3063
|
+
/* @__PURE__ */ jsx10(SearchIcon, { size: 15, strokeWidth: 2 }),
|
|
3064
|
+
/* @__PURE__ */ jsx10(
|
|
2951
3065
|
"input",
|
|
2952
3066
|
{
|
|
2953
3067
|
ref: inputRef,
|
|
@@ -2967,7 +3081,7 @@ var SchematicSearch = ({
|
|
|
2967
3081
|
}
|
|
2968
3082
|
}
|
|
2969
3083
|
),
|
|
2970
|
-
query && results.length > 0 ? /* @__PURE__ */
|
|
3084
|
+
query && results.length > 0 ? /* @__PURE__ */ jsx10(
|
|
2971
3085
|
"span",
|
|
2972
3086
|
{
|
|
2973
3087
|
style: {
|
|
@@ -2978,7 +3092,7 @@ var SchematicSearch = ({
|
|
|
2978
3092
|
},
|
|
2979
3093
|
children: resultCountLabel
|
|
2980
3094
|
}
|
|
2981
|
-
) : /* @__PURE__ */
|
|
3095
|
+
) : /* @__PURE__ */ jsx10(
|
|
2982
3096
|
"kbd",
|
|
2983
3097
|
{
|
|
2984
3098
|
style: {
|
|
@@ -2995,7 +3109,7 @@ var SchematicSearch = ({
|
|
|
2995
3109
|
children: shortcutLabel
|
|
2996
3110
|
}
|
|
2997
3111
|
),
|
|
2998
|
-
isOpen && /* @__PURE__ */
|
|
3112
|
+
isOpen && /* @__PURE__ */ jsx10(
|
|
2999
3113
|
"button",
|
|
3000
3114
|
{
|
|
3001
3115
|
type: "button",
|
|
@@ -3018,13 +3132,13 @@ var SchematicSearch = ({
|
|
|
3018
3132
|
padding: 0,
|
|
3019
3133
|
lineHeight: 1
|
|
3020
3134
|
},
|
|
3021
|
-
children: /* @__PURE__ */
|
|
3135
|
+
children: /* @__PURE__ */ jsx10(CloseIcon, { size: 16, strokeWidth: 2 })
|
|
3022
3136
|
}
|
|
3023
3137
|
)
|
|
3024
3138
|
]
|
|
3025
3139
|
}
|
|
3026
3140
|
),
|
|
3027
|
-
query && /* @__PURE__ */
|
|
3141
|
+
query && /* @__PURE__ */ jsx10(
|
|
3028
3142
|
"div",
|
|
3029
3143
|
{
|
|
3030
3144
|
ref: resultsListRef,
|
|
@@ -3039,7 +3153,7 @@ var SchematicSearch = ({
|
|
|
3039
3153
|
},
|
|
3040
3154
|
onWheel: (event) => event.stopPropagation(),
|
|
3041
3155
|
onTouchMove: (event) => event.stopPropagation(),
|
|
3042
|
-
children: results.length === 0 ? /* @__PURE__ */
|
|
3156
|
+
children: results.length === 0 ? /* @__PURE__ */ jsx10(
|
|
3043
3157
|
"div",
|
|
3044
3158
|
{
|
|
3045
3159
|
style: {
|
|
@@ -3063,9 +3177,9 @@ var SchematicSearch = ({
|
|
|
3063
3177
|
};
|
|
3064
3178
|
|
|
3065
3179
|
// lib/components/SchematicSheetSelector.tsx
|
|
3066
|
-
import { useState as
|
|
3180
|
+
import { useState as useState9 } from "react";
|
|
3067
3181
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
3068
|
-
import { Fragment as Fragment6, jsx as
|
|
3182
|
+
import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3069
3183
|
var FONT_FAMILY = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
3070
3184
|
var contentStyles = {
|
|
3071
3185
|
backgroundColor: "#ffffff",
|
|
@@ -3115,7 +3229,7 @@ var MENU_CSS = `
|
|
|
3115
3229
|
.sv-sheet-chevron { transition: transform 0.2s ease; }
|
|
3116
3230
|
[data-state="open"] > .sv-sheet-chevron { transform: rotate(180deg); }
|
|
3117
3231
|
`;
|
|
3118
|
-
var CheckIcon = () => /* @__PURE__ */
|
|
3232
|
+
var CheckIcon = () => /* @__PURE__ */ jsx11(
|
|
3119
3233
|
"svg",
|
|
3120
3234
|
{
|
|
3121
3235
|
width: "14",
|
|
@@ -3127,10 +3241,10 @@ var CheckIcon = () => /* @__PURE__ */ jsx10(
|
|
|
3127
3241
|
strokeLinecap: "round",
|
|
3128
3242
|
strokeLinejoin: "round",
|
|
3129
3243
|
"aria-hidden": "true",
|
|
3130
|
-
children: /* @__PURE__ */
|
|
3244
|
+
children: /* @__PURE__ */ jsx11("path", { d: "M20 6 9 17l-5-5" })
|
|
3131
3245
|
}
|
|
3132
3246
|
);
|
|
3133
|
-
var ChevronDownIcon = ({ className }) => /* @__PURE__ */
|
|
3247
|
+
var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx11(
|
|
3134
3248
|
"svg",
|
|
3135
3249
|
{
|
|
3136
3250
|
className,
|
|
@@ -3144,7 +3258,7 @@ var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx10(
|
|
|
3144
3258
|
strokeLinejoin: "round",
|
|
3145
3259
|
style: { opacity: 0.6, flexShrink: 0 },
|
|
3146
3260
|
"aria-hidden": "true",
|
|
3147
|
-
children: /* @__PURE__ */
|
|
3261
|
+
children: /* @__PURE__ */ jsx11("path", { d: "m6 9 6 6 6-6" })
|
|
3148
3262
|
}
|
|
3149
3263
|
);
|
|
3150
3264
|
var SchematicSheetSelector = ({
|
|
@@ -3152,16 +3266,16 @@ var SchematicSheetSelector = ({
|
|
|
3152
3266
|
selectedSheetId,
|
|
3153
3267
|
onSelectSheet
|
|
3154
3268
|
}) => {
|
|
3155
|
-
const [open, setOpen] =
|
|
3269
|
+
const [open, setOpen] = useState9(false);
|
|
3156
3270
|
if (sheets.length <= 1) return null;
|
|
3157
3271
|
const selectedSheet = sheets.find(
|
|
3158
3272
|
(s) => s.schematic_sheet_id === selectedSheetId
|
|
3159
3273
|
);
|
|
3160
3274
|
const selectedLabel = selectedSheet?.name ?? "Select sheet";
|
|
3161
3275
|
return /* @__PURE__ */ jsxs7(Fragment6, { children: [
|
|
3162
|
-
/* @__PURE__ */
|
|
3276
|
+
/* @__PURE__ */ jsx11("style", { children: MENU_CSS }),
|
|
3163
3277
|
/* @__PURE__ */ jsxs7(DropdownMenu.Root, { open, onOpenChange: setOpen, modal: false, children: [
|
|
3164
|
-
/* @__PURE__ */
|
|
3278
|
+
/* @__PURE__ */ jsx11(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs7(
|
|
3165
3279
|
"button",
|
|
3166
3280
|
{
|
|
3167
3281
|
type: "button",
|
|
@@ -3186,13 +3300,13 @@ var SchematicSheetSelector = ({
|
|
|
3186
3300
|
fontFamily: FONT_FAMILY
|
|
3187
3301
|
},
|
|
3188
3302
|
children: [
|
|
3189
|
-
/* @__PURE__ */
|
|
3190
|
-
/* @__PURE__ */
|
|
3191
|
-
/* @__PURE__ */
|
|
3303
|
+
/* @__PURE__ */ jsx11("span", { style: { color: "#888888", flexShrink: 0 }, children: "Sheet:" }),
|
|
3304
|
+
/* @__PURE__ */ jsx11("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: selectedLabel }),
|
|
3305
|
+
/* @__PURE__ */ jsx11(ChevronDownIcon, { className: "sv-sheet-chevron" })
|
|
3192
3306
|
]
|
|
3193
3307
|
}
|
|
3194
3308
|
) }),
|
|
3195
|
-
/* @__PURE__ */
|
|
3309
|
+
/* @__PURE__ */ jsx11(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx11(
|
|
3196
3310
|
DropdownMenu.Content,
|
|
3197
3311
|
{
|
|
3198
3312
|
style: contentStyles,
|
|
@@ -3214,8 +3328,8 @@ var SchematicSheetSelector = ({
|
|
|
3214
3328
|
setOpen(false);
|
|
3215
3329
|
},
|
|
3216
3330
|
children: [
|
|
3217
|
-
/* @__PURE__ */
|
|
3218
|
-
/* @__PURE__ */
|
|
3331
|
+
/* @__PURE__ */ jsx11("span", { style: iconSlotStyles, children: selected && /* @__PURE__ */ jsx11(CheckIcon, {}) }),
|
|
3332
|
+
/* @__PURE__ */ jsx11("span", { style: { ...ellipsisStyles, minWidth: 0 }, children: sheet.name })
|
|
3219
3333
|
]
|
|
3220
3334
|
},
|
|
3221
3335
|
sheet.schematic_sheet_id
|
|
@@ -3228,7 +3342,7 @@ var SchematicSheetSelector = ({
|
|
|
3228
3342
|
};
|
|
3229
3343
|
|
|
3230
3344
|
// lib/components/SchematicWarningsButton.tsx
|
|
3231
|
-
import { jsx as
|
|
3345
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3232
3346
|
var SchematicWarningsButton = ({
|
|
3233
3347
|
count,
|
|
3234
3348
|
showWarnings,
|
|
@@ -3278,12 +3392,12 @@ var SchematicWarningsButton = ({
|
|
|
3278
3392
|
strokeLinejoin: "round",
|
|
3279
3393
|
"aria-hidden": "true",
|
|
3280
3394
|
children: [
|
|
3281
|
-
/* @__PURE__ */
|
|
3282
|
-
/* @__PURE__ */
|
|
3395
|
+
/* @__PURE__ */ jsx12("path", { d: "M10.3 3.9 1.8 18.1A2 2 0 0 0 3.5 21h17a2 2 0 0 0 1.7-2.9L13.7 3.9a2 2 0 0 0-3.4 0Z" }),
|
|
3396
|
+
/* @__PURE__ */ jsx12("path", { d: "M12 9v4m0 4h.01" })
|
|
3283
3397
|
]
|
|
3284
3398
|
}
|
|
3285
3399
|
),
|
|
3286
|
-
/* @__PURE__ */
|
|
3400
|
+
/* @__PURE__ */ jsx12("span", { children: count })
|
|
3287
3401
|
]
|
|
3288
3402
|
}
|
|
3289
3403
|
);
|
|
@@ -3297,7 +3411,7 @@ import { useMemo as useMemo5 } from "react";
|
|
|
3297
3411
|
// package.json
|
|
3298
3412
|
var package_default = {
|
|
3299
3413
|
name: "@tscircuit/schematic-viewer",
|
|
3300
|
-
version: "2.0.
|
|
3414
|
+
version: "2.0.110",
|
|
3301
3415
|
repository: {
|
|
3302
3416
|
type: "git",
|
|
3303
3417
|
url: "https://github.com/tscircuit/schematic-viewer"
|
|
@@ -3363,7 +3477,7 @@ var package_default = {
|
|
|
3363
3477
|
};
|
|
3364
3478
|
|
|
3365
3479
|
// lib/components/ViewMenu.tsx
|
|
3366
|
-
import { Fragment as Fragment7, jsx as
|
|
3480
|
+
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3367
3481
|
var FONT_FAMILY2 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
3368
3482
|
var contentStyles2 = {
|
|
3369
3483
|
backgroundColor: "#262626",
|
|
@@ -3412,7 +3526,7 @@ var HIGHLIGHT_CSS = `
|
|
|
3412
3526
|
.sv-vm-item:hover:not([data-disabled]) { background-color: #404040; }
|
|
3413
3527
|
.sv-vm-item[data-disabled] { opacity: 0.45; cursor: not-allowed; }
|
|
3414
3528
|
`;
|
|
3415
|
-
var CheckIcon2 = () => /* @__PURE__ */
|
|
3529
|
+
var CheckIcon2 = () => /* @__PURE__ */ jsx13(
|
|
3416
3530
|
"svg",
|
|
3417
3531
|
{
|
|
3418
3532
|
width: "14",
|
|
@@ -3424,7 +3538,7 @@ var CheckIcon2 = () => /* @__PURE__ */ jsx12(
|
|
|
3424
3538
|
strokeLinecap: "round",
|
|
3425
3539
|
strokeLinejoin: "round",
|
|
3426
3540
|
"aria-hidden": "true",
|
|
3427
|
-
children: /* @__PURE__ */
|
|
3541
|
+
children: /* @__PURE__ */ jsx13("path", { d: "M20 6 9 17l-5-5" })
|
|
3428
3542
|
}
|
|
3429
3543
|
);
|
|
3430
3544
|
var ViewMenu = ({
|
|
@@ -3482,7 +3596,7 @@ var ViewMenu = ({
|
|
|
3482
3596
|
}
|
|
3483
3597
|
}, [circuitJsonKey]);
|
|
3484
3598
|
if (isComponentMenu && (!pcbComponent || !onViewPcbComponent)) return null;
|
|
3485
|
-
return /* @__PURE__ */
|
|
3599
|
+
return /* @__PURE__ */ jsx13(
|
|
3486
3600
|
"div",
|
|
3487
3601
|
{
|
|
3488
3602
|
ref: menuRef,
|
|
@@ -3494,8 +3608,8 @@ var ViewMenu = ({
|
|
|
3494
3608
|
height: 0
|
|
3495
3609
|
},
|
|
3496
3610
|
children: /* @__PURE__ */ jsxs9(DropdownMenu2.Root, { open: true, onOpenChange, modal: false, children: [
|
|
3497
|
-
/* @__PURE__ */
|
|
3498
|
-
/* @__PURE__ */
|
|
3611
|
+
/* @__PURE__ */ jsx13(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx13("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
|
|
3612
|
+
/* @__PURE__ */ jsx13(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs9(
|
|
3499
3613
|
DropdownMenu2.Content,
|
|
3500
3614
|
{
|
|
3501
3615
|
style: contentStyles2,
|
|
@@ -3504,8 +3618,8 @@ var ViewMenu = ({
|
|
|
3504
3618
|
collisionPadding: 10,
|
|
3505
3619
|
avoidCollisions: true,
|
|
3506
3620
|
children: [
|
|
3507
|
-
/* @__PURE__ */
|
|
3508
|
-
pcbComponent && onViewPcbComponent && /* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ jsx13("style", { children: HIGHLIGHT_CSS }),
|
|
3622
|
+
pcbComponent && onViewPcbComponent && /* @__PURE__ */ jsx13(Fragment7, { children: /* @__PURE__ */ jsxs9(
|
|
3509
3623
|
DropdownMenu2.Item,
|
|
3510
3624
|
{
|
|
3511
3625
|
className: "sv-vm-item",
|
|
@@ -3515,8 +3629,8 @@ var ViewMenu = ({
|
|
|
3515
3629
|
onViewPcbComponent(pcbComponent);
|
|
3516
3630
|
},
|
|
3517
3631
|
children: [
|
|
3518
|
-
/* @__PURE__ */
|
|
3519
|
-
/* @__PURE__ */
|
|
3632
|
+
/* @__PURE__ */ jsx13("span", { style: iconSlotStyles2, children: "\u2197" }),
|
|
3633
|
+
/* @__PURE__ */ jsx13("span", { children: "Show on PCB" })
|
|
3520
3634
|
]
|
|
3521
3635
|
}
|
|
3522
3636
|
) }),
|
|
@@ -3528,11 +3642,11 @@ var ViewMenu = ({
|
|
|
3528
3642
|
style: itemStyles2,
|
|
3529
3643
|
children: [
|
|
3530
3644
|
"Net Locations ",
|
|
3531
|
-
/* @__PURE__ */
|
|
3645
|
+
/* @__PURE__ */ jsx13("span", { style: { marginLeft: "auto" }, children: "\u203A" })
|
|
3532
3646
|
]
|
|
3533
3647
|
}
|
|
3534
3648
|
),
|
|
3535
|
-
/* @__PURE__ */
|
|
3649
|
+
/* @__PURE__ */ jsx13(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsx13(
|
|
3536
3650
|
DropdownMenu2.SubContent,
|
|
3537
3651
|
{
|
|
3538
3652
|
style: {
|
|
@@ -3541,7 +3655,7 @@ var ViewMenu = ({
|
|
|
3541
3655
|
overflowY: "auto"
|
|
3542
3656
|
},
|
|
3543
3657
|
collisionPadding: 10,
|
|
3544
|
-
children: netLocations.map((location, index) => /* @__PURE__ */
|
|
3658
|
+
children: netLocations.map((location, index) => /* @__PURE__ */ jsx13(
|
|
3545
3659
|
DropdownMenu2.Item,
|
|
3546
3660
|
{
|
|
3547
3661
|
className: "sv-vm-item",
|
|
@@ -3568,8 +3682,8 @@ var ViewMenu = ({
|
|
|
3568
3682
|
if (hasPorts) onTogglePorts(!showPorts);
|
|
3569
3683
|
},
|
|
3570
3684
|
children: [
|
|
3571
|
-
/* @__PURE__ */
|
|
3572
|
-
/* @__PURE__ */
|
|
3685
|
+
/* @__PURE__ */ jsx13("span", { style: iconSlotStyles2, children: showPorts && /* @__PURE__ */ jsx13(CheckIcon2, {}) }),
|
|
3686
|
+
/* @__PURE__ */ jsx13("span", { children: "Show Schematic Ports" })
|
|
3573
3687
|
]
|
|
3574
3688
|
}
|
|
3575
3689
|
),
|
|
@@ -3586,8 +3700,8 @@ var ViewMenu = ({
|
|
|
3586
3700
|
if (hasGroups) onToggleGroups(!showGroups);
|
|
3587
3701
|
},
|
|
3588
3702
|
children: [
|
|
3589
|
-
/* @__PURE__ */
|
|
3590
|
-
/* @__PURE__ */
|
|
3703
|
+
/* @__PURE__ */ jsx13("span", { style: iconSlotStyles2, children: showGroups && /* @__PURE__ */ jsx13(CheckIcon2, {}) }),
|
|
3704
|
+
/* @__PURE__ */ jsx13("span", { children: "View Schematic Groups" })
|
|
3591
3705
|
]
|
|
3592
3706
|
}
|
|
3593
3707
|
),
|
|
@@ -3602,8 +3716,8 @@ var ViewMenu = ({
|
|
|
3602
3716
|
onToggleGrid(!showGrid);
|
|
3603
3717
|
},
|
|
3604
3718
|
children: [
|
|
3605
|
-
/* @__PURE__ */
|
|
3606
|
-
/* @__PURE__ */
|
|
3719
|
+
/* @__PURE__ */ jsx13("span", { style: iconSlotStyles2, children: showGrid && /* @__PURE__ */ jsx13(CheckIcon2, {}) }),
|
|
3720
|
+
/* @__PURE__ */ jsx13("span", { children: "Show Grid" })
|
|
3607
3721
|
]
|
|
3608
3722
|
}
|
|
3609
3723
|
),
|
|
@@ -3616,12 +3730,12 @@ var ViewMenu = ({
|
|
|
3616
3730
|
onCheckedChange: onToggleWarnings,
|
|
3617
3731
|
onSelect: (event) => event.preventDefault(),
|
|
3618
3732
|
children: [
|
|
3619
|
-
/* @__PURE__ */
|
|
3620
|
-
/* @__PURE__ */
|
|
3733
|
+
/* @__PURE__ */ jsx13("span", { style: iconSlotStyles2, children: /* @__PURE__ */ jsx13(DropdownMenu2.ItemIndicator, { children: /* @__PURE__ */ jsx13(CheckIcon2, {}) }) }),
|
|
3734
|
+
/* @__PURE__ */ jsx13("span", { children: "Show Warnings" })
|
|
3621
3735
|
]
|
|
3622
3736
|
}
|
|
3623
3737
|
),
|
|
3624
|
-
/* @__PURE__ */
|
|
3738
|
+
/* @__PURE__ */ jsx13(DropdownMenu2.Separator, { style: separatorStyles }),
|
|
3625
3739
|
/* @__PURE__ */ jsxs9(
|
|
3626
3740
|
DropdownMenu2.Item,
|
|
3627
3741
|
{
|
|
@@ -3629,12 +3743,12 @@ var ViewMenu = ({
|
|
|
3629
3743
|
style: itemStyles2,
|
|
3630
3744
|
onSelect: onRunStyleAnalysis,
|
|
3631
3745
|
children: [
|
|
3632
|
-
/* @__PURE__ */
|
|
3633
|
-
/* @__PURE__ */
|
|
3746
|
+
/* @__PURE__ */ jsx13("span", { style: iconSlotStyles2 }),
|
|
3747
|
+
/* @__PURE__ */ jsx13("span", { children: "Run Style Analysis" })
|
|
3634
3748
|
]
|
|
3635
3749
|
}
|
|
3636
3750
|
),
|
|
3637
|
-
/* @__PURE__ */
|
|
3751
|
+
/* @__PURE__ */ jsx13(DropdownMenu2.Separator, { style: separatorStyles }),
|
|
3638
3752
|
/* @__PURE__ */ jsxs9(
|
|
3639
3753
|
"div",
|
|
3640
3754
|
{
|
|
@@ -3662,7 +3776,7 @@ var ViewMenu = ({
|
|
|
3662
3776
|
};
|
|
3663
3777
|
|
|
3664
3778
|
// lib/components/SchematicViewer.tsx
|
|
3665
|
-
import { jsx as
|
|
3779
|
+
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3666
3780
|
var SchematicViewer = ({
|
|
3667
3781
|
circuitJson,
|
|
3668
3782
|
platformConfig,
|
|
@@ -3705,7 +3819,7 @@ var SchematicViewer = ({
|
|
|
3705
3819
|
}, [circuitJsonKey]);
|
|
3706
3820
|
const hasMultipleSheets = schematicSheets.length > 1;
|
|
3707
3821
|
const defaultSheetId = schematicSheets[0]?.schematic_sheet_id;
|
|
3708
|
-
const [selectedSheetId, setSelectedSheetId] =
|
|
3822
|
+
const [selectedSheetId, setSelectedSheetId] = useState10(
|
|
3709
3823
|
() => {
|
|
3710
3824
|
const stored = getStoredString(STORAGE_KEYS.SELECTED_SCHEMATIC_SHEET);
|
|
3711
3825
|
if (stored && schematicSheets.some((s) => s.schematic_sheet_id === stored)) {
|
|
@@ -3714,7 +3828,7 @@ var SchematicViewer = ({
|
|
|
3714
3828
|
return defaultSheetId;
|
|
3715
3829
|
}
|
|
3716
3830
|
);
|
|
3717
|
-
|
|
3831
|
+
useEffect15(() => {
|
|
3718
3832
|
const stillExists = selectedSheetId !== void 0 && schematicSheets.some((s) => s.schematic_sheet_id === selectedSheetId);
|
|
3719
3833
|
if (!stillExists) {
|
|
3720
3834
|
setSelectedSheetId(defaultSheetId);
|
|
@@ -3729,31 +3843,31 @@ var SchematicViewer = ({
|
|
|
3729
3843
|
},
|
|
3730
3844
|
[onSchematicSheetChange]
|
|
3731
3845
|
);
|
|
3732
|
-
const [showGridInternal, setShowGridInternal] =
|
|
3733
|
-
const [analysisCircuitJson, setAnalysisCircuitJson] =
|
|
3734
|
-
const [showWarnings, setShowWarnings] =
|
|
3846
|
+
const [showGridInternal, setShowGridInternal] = useState10(false);
|
|
3847
|
+
const [analysisCircuitJson, setAnalysisCircuitJson] = useState10(null);
|
|
3848
|
+
const [showWarnings, setShowWarnings] = useState10(false);
|
|
3735
3849
|
const warningCount = circuitJson.filter(
|
|
3736
3850
|
(element) => element.type.startsWith("schematic_") && element.type.endsWith("_warning")
|
|
3737
3851
|
).length;
|
|
3738
3852
|
const showGrid = debugGrid || showGridInternal;
|
|
3739
|
-
const [isInteractionEnabled, setIsInteractionEnabled] =
|
|
3853
|
+
const [isInteractionEnabled, setIsInteractionEnabled] = useState10(
|
|
3740
3854
|
!clickToInteractEnabled
|
|
3741
3855
|
);
|
|
3742
|
-
const [showSchematicGroups, setShowSchematicGroups] =
|
|
3856
|
+
const [showSchematicGroups, setShowSchematicGroups] = useState10(() => {
|
|
3743
3857
|
if (disableGroups) return false;
|
|
3744
3858
|
return getStoredBoolean(STORAGE_KEYS.IS_SHOWING_SCHEMATIC_GROUPS, false);
|
|
3745
3859
|
});
|
|
3746
|
-
const [showSchematicPortsInternal, setShowSchematicPortsInternal] =
|
|
3860
|
+
const [showSchematicPortsInternal, setShowSchematicPortsInternal] = useState10(
|
|
3747
3861
|
() => showSchematicPorts ?? getStoredBoolean(STORAGE_KEYS.IS_SHOWING_SCHEMATIC_PORTS, false)
|
|
3748
3862
|
);
|
|
3749
|
-
|
|
3863
|
+
useEffect15(() => {
|
|
3750
3864
|
if (showSchematicPorts !== void 0) {
|
|
3751
3865
|
setShowSchematicPortsInternal(showSchematicPorts);
|
|
3752
3866
|
}
|
|
3753
3867
|
}, [showSchematicPorts]);
|
|
3754
|
-
const [isHoveringClickableComponent, setIsHoveringClickableComponent] =
|
|
3868
|
+
const [isHoveringClickableComponent, setIsHoveringClickableComponent] = useState10(false);
|
|
3755
3869
|
const hoveringComponentsRef = useRef8(/* @__PURE__ */ new Set());
|
|
3756
|
-
const [selectedSchematicComponent, setSelectedSchematicComponent] =
|
|
3870
|
+
const [selectedSchematicComponent, setSelectedSchematicComponent] = useState10(null);
|
|
3757
3871
|
const handleComponentHoverChange = useCallback8(
|
|
3758
3872
|
(componentId, isHovering) => {
|
|
3759
3873
|
if (isHovering) {
|
|
@@ -3765,7 +3879,7 @@ var SchematicViewer = ({
|
|
|
3765
3879
|
},
|
|
3766
3880
|
[]
|
|
3767
3881
|
);
|
|
3768
|
-
const [isHoveringClickablePort, setIsHoveringClickablePort] =
|
|
3882
|
+
const [isHoveringClickablePort, setIsHoveringClickablePort] = useState10(false);
|
|
3769
3883
|
const hoveringPortsRef = useRef8(/* @__PURE__ */ new Set());
|
|
3770
3884
|
const handlePortHoverChange = useCallback8(
|
|
3771
3885
|
(portId, isHovering) => {
|
|
@@ -3918,10 +4032,10 @@ var SchematicViewer = ({
|
|
|
3918
4032
|
},
|
|
3919
4033
|
[containerRef, onSchematicComponentClicked]
|
|
3920
4034
|
);
|
|
3921
|
-
|
|
4035
|
+
useEffect15(() => {
|
|
3922
4036
|
setSelectedSchematicComponent(null);
|
|
3923
4037
|
}, [circuitJsonKey, activeSheetId]);
|
|
3924
|
-
|
|
4038
|
+
useEffect15(() => {
|
|
3925
4039
|
if (!selectedSchematicComponent) return;
|
|
3926
4040
|
const handleKeyDown = (event) => {
|
|
3927
4041
|
if (event.key === "Escape") {
|
|
@@ -4005,7 +4119,7 @@ var SchematicViewer = ({
|
|
|
4005
4119
|
enabled: netHoverHighlightEnabled
|
|
4006
4120
|
});
|
|
4007
4121
|
const svgDiv = useMemo6(
|
|
4008
|
-
() => /* @__PURE__ */
|
|
4122
|
+
() => /* @__PURE__ */ jsx14(
|
|
4009
4123
|
"div",
|
|
4010
4124
|
{
|
|
4011
4125
|
ref: svgDivRef,
|
|
@@ -4021,9 +4135,9 @@ var SchematicViewer = ({
|
|
|
4021
4135
|
);
|
|
4022
4136
|
useSchematicWarnings({ svgDivRef, svgContent: svgDiv, circuitJsonKey });
|
|
4023
4137
|
return /* @__PURE__ */ jsxs10(MouseTracker, { children: [
|
|
4024
|
-
netHoverHighlightEnabled && /* @__PURE__ */
|
|
4138
|
+
netHoverHighlightEnabled && /* @__PURE__ */ jsx14("style", { children: `.sch-net-faded { opacity: 0.35; }
|
|
4025
4139
|
svg :is(g.trace, g.trace-overlays, g[data-schematic-component-id], [data-schematic-net-label-id]) { transition: opacity 0.12s ease-in-out; }` }),
|
|
4026
|
-
searchEnabled && /* @__PURE__ */
|
|
4140
|
+
searchEnabled && /* @__PURE__ */ jsx14("style", { children: `.schematic-search-match text,
|
|
4027
4141
|
text.schematic-search-match {
|
|
4028
4142
|
fill: #ff00d4 !important;
|
|
4029
4143
|
}
|
|
@@ -4039,11 +4153,11 @@ var SchematicViewer = ({
|
|
|
4039
4153
|
flex-direction: column;
|
|
4040
4154
|
}
|
|
4041
4155
|
}` }),
|
|
4042
|
-
/* @__PURE__ */
|
|
4156
|
+
/* @__PURE__ */ jsx14("style", { children: `
|
|
4043
4157
|
.schematic-component-clickable > svg { overflow: visible; }
|
|
4044
4158
|
.schematic-component-clickable [data-schematic-component-id]:hover { cursor: pointer !important; }
|
|
4045
4159
|
` }),
|
|
4046
|
-
onSchematicPortClicked && /* @__PURE__ */
|
|
4160
|
+
onSchematicPortClicked && /* @__PURE__ */ jsx14("style", { children: "[data-schematic-port-id]:hover { cursor: pointer !important; }" }),
|
|
4047
4161
|
/* @__PURE__ */ jsxs10(
|
|
4048
4162
|
"div",
|
|
4049
4163
|
{
|
|
@@ -4079,7 +4193,7 @@ var SchematicViewer = ({
|
|
|
4079
4193
|
},
|
|
4080
4194
|
onTouchCancel: contextMenuEventHandlers.onTouchCancel,
|
|
4081
4195
|
children: [
|
|
4082
|
-
!isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */
|
|
4196
|
+
!isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */ jsx14(
|
|
4083
4197
|
"div",
|
|
4084
4198
|
{
|
|
4085
4199
|
onClick: (e) => {
|
|
@@ -4098,7 +4212,7 @@ var SchematicViewer = ({
|
|
|
4098
4212
|
pointerEvents: "all",
|
|
4099
4213
|
touchAction: "pan-x pan-y pinch-zoom"
|
|
4100
4214
|
},
|
|
4101
|
-
children: /* @__PURE__ */
|
|
4215
|
+
children: /* @__PURE__ */ jsx14(
|
|
4102
4216
|
"div",
|
|
4103
4217
|
{
|
|
4104
4218
|
style: {
|
|
@@ -4115,14 +4229,14 @@ var SchematicViewer = ({
|
|
|
4115
4229
|
)
|
|
4116
4230
|
}
|
|
4117
4231
|
),
|
|
4118
|
-
analysisCircuitJson && /* @__PURE__ */
|
|
4232
|
+
analysisCircuitJson && /* @__PURE__ */ jsx14(
|
|
4119
4233
|
StyleAnalysisDialog,
|
|
4120
4234
|
{
|
|
4121
4235
|
circuitJson: analysisCircuitJson,
|
|
4122
4236
|
onClose: () => setAnalysisCircuitJson(null)
|
|
4123
4237
|
}
|
|
4124
4238
|
),
|
|
4125
|
-
menuVisible && /* @__PURE__ */
|
|
4239
|
+
menuVisible && /* @__PURE__ */ jsx14(
|
|
4126
4240
|
ViewMenu,
|
|
4127
4241
|
{
|
|
4128
4242
|
isComponentMenu: !!getSchematicComponentAtElement(menuTarget, circuitJson),
|
|
@@ -4180,7 +4294,7 @@ var SchematicViewer = ({
|
|
|
4180
4294
|
zIndex: zIndexMap.schematicSearch
|
|
4181
4295
|
},
|
|
4182
4296
|
children: [
|
|
4183
|
-
/* @__PURE__ */
|
|
4297
|
+
/* @__PURE__ */ jsx14(
|
|
4184
4298
|
SchematicSheetSelector,
|
|
4185
4299
|
{
|
|
4186
4300
|
sheets: schematicSheets,
|
|
@@ -4188,7 +4302,7 @@ var SchematicViewer = ({
|
|
|
4188
4302
|
onSelectSheet: handleSelectSheet
|
|
4189
4303
|
}
|
|
4190
4304
|
),
|
|
4191
|
-
searchEnabled && /* @__PURE__ */
|
|
4305
|
+
searchEnabled && /* @__PURE__ */ jsx14(
|
|
4192
4306
|
SchematicSearch,
|
|
4193
4307
|
{
|
|
4194
4308
|
query: searchQuery,
|
|
@@ -4199,7 +4313,7 @@ var SchematicViewer = ({
|
|
|
4199
4313
|
viewerContainerRef: containerRef
|
|
4200
4314
|
}
|
|
4201
4315
|
),
|
|
4202
|
-
warningCount > 0 && /* @__PURE__ */
|
|
4316
|
+
warningCount > 0 && /* @__PURE__ */ jsx14(
|
|
4203
4317
|
SchematicWarningsButton,
|
|
4204
4318
|
{
|
|
4205
4319
|
count: warningCount,
|
|
@@ -4210,7 +4324,7 @@ var SchematicViewer = ({
|
|
|
4210
4324
|
]
|
|
4211
4325
|
}
|
|
4212
4326
|
),
|
|
4213
|
-
schematicComponentIds.map((componentId) => /* @__PURE__ */
|
|
4327
|
+
schematicComponentIds.map((componentId) => /* @__PURE__ */ jsx14(
|
|
4214
4328
|
SchematicComponentMouseTarget,
|
|
4215
4329
|
{
|
|
4216
4330
|
componentId,
|
|
@@ -4223,7 +4337,7 @@ var SchematicViewer = ({
|
|
|
4223
4337
|
},
|
|
4224
4338
|
componentId
|
|
4225
4339
|
)),
|
|
4226
|
-
highlightedSchematicComponentIds?.map((componentId) => /* @__PURE__ */
|
|
4340
|
+
highlightedSchematicComponentIds?.map((componentId) => /* @__PURE__ */ jsx14(
|
|
4227
4341
|
SchematicElementHighlight,
|
|
4228
4342
|
{
|
|
4229
4343
|
selector: `[data-schematic-component-id="${componentId}"]`,
|
|
@@ -4233,7 +4347,7 @@ var SchematicViewer = ({
|
|
|
4233
4347
|
},
|
|
4234
4348
|
`component-${componentId}`
|
|
4235
4349
|
)),
|
|
4236
|
-
highlightedSchematicTextIds?.map((textId) => /* @__PURE__ */
|
|
4350
|
+
highlightedSchematicTextIds?.map((textId) => /* @__PURE__ */ jsx14(
|
|
4237
4351
|
SchematicElementHighlight,
|
|
4238
4352
|
{
|
|
4239
4353
|
selector: `[data-schematic-text-id="${textId}"]`,
|
|
@@ -4244,7 +4358,7 @@ var SchematicViewer = ({
|
|
|
4244
4358
|
`text-${textId}`
|
|
4245
4359
|
)),
|
|
4246
4360
|
svgDiv,
|
|
4247
|
-
selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */
|
|
4361
|
+
selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */ jsx14(
|
|
4248
4362
|
SchematicComponentDetailsTooltip,
|
|
4249
4363
|
{
|
|
4250
4364
|
platformConfig,
|
|
@@ -4256,7 +4370,7 @@ var SchematicViewer = ({
|
|
|
4256
4370
|
...componentTooltipLayout
|
|
4257
4371
|
}
|
|
4258
4372
|
),
|
|
4259
|
-
showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */
|
|
4373
|
+
showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */ jsx14(
|
|
4260
4374
|
SchematicPortMouseTarget,
|
|
4261
4375
|
{
|
|
4262
4376
|
portId,
|
|
@@ -4286,7 +4400,7 @@ import {
|
|
|
4286
4400
|
convertCircuitJsonToSchematicSimulationSvg,
|
|
4287
4401
|
convertCircuitJsonToSimulationGraphSvg
|
|
4288
4402
|
} from "circuit-to-svg";
|
|
4289
|
-
import { useEffect as
|
|
4403
|
+
import { useEffect as useEffect16, useMemo as useMemo7, useRef as useRef9, useState as useState12 } from "react";
|
|
4290
4404
|
import { toString as transformToString2 } from "transformation-matrix";
|
|
4291
4405
|
import { useMouseMatrixTransform as useMouseMatrixTransform2 } from "use-mouse-matrix-transform";
|
|
4292
4406
|
|
|
@@ -4304,8 +4418,8 @@ var getAnalogSimulationBackgroundColor = (simulationSvg, colorOverrides) => getR
|
|
|
4304
4418
|
|
|
4305
4419
|
// lib/components/AnalogSimulationSelector.tsx
|
|
4306
4420
|
import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
|
|
4307
|
-
import { useState as
|
|
4308
|
-
import { Fragment as Fragment8, jsx as
|
|
4421
|
+
import { useState as useState11 } from "react";
|
|
4422
|
+
import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4309
4423
|
var FONT_FAMILY3 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
4310
4424
|
var contentStyles3 = {
|
|
4311
4425
|
backgroundColor: "#ffffff",
|
|
@@ -4355,7 +4469,7 @@ var MENU_CSS2 = `
|
|
|
4355
4469
|
.sv-simulation-chevron { transition: transform 0.2s ease; }
|
|
4356
4470
|
[data-state="open"] > .sv-simulation-chevron { transform: rotate(180deg); }
|
|
4357
4471
|
`;
|
|
4358
|
-
var CheckIcon3 = () => /* @__PURE__ */
|
|
4472
|
+
var CheckIcon3 = () => /* @__PURE__ */ jsx15(
|
|
4359
4473
|
"svg",
|
|
4360
4474
|
{
|
|
4361
4475
|
width: "14",
|
|
@@ -4367,10 +4481,10 @@ var CheckIcon3 = () => /* @__PURE__ */ jsx14(
|
|
|
4367
4481
|
strokeLinecap: "round",
|
|
4368
4482
|
strokeLinejoin: "round",
|
|
4369
4483
|
"aria-hidden": "true",
|
|
4370
|
-
children: /* @__PURE__ */
|
|
4484
|
+
children: /* @__PURE__ */ jsx15("path", { d: "M20 6 9 17l-5-5" })
|
|
4371
4485
|
}
|
|
4372
4486
|
);
|
|
4373
|
-
var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */
|
|
4487
|
+
var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx15(
|
|
4374
4488
|
"svg",
|
|
4375
4489
|
{
|
|
4376
4490
|
className,
|
|
@@ -4384,7 +4498,7 @@ var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx14(
|
|
|
4384
4498
|
strokeLinejoin: "round",
|
|
4385
4499
|
style: { opacity: 0.6, flexShrink: 0 },
|
|
4386
4500
|
"aria-hidden": "true",
|
|
4387
|
-
children: /* @__PURE__ */
|
|
4501
|
+
children: /* @__PURE__ */ jsx15("path", { d: "m6 9 6 6 6-6" })
|
|
4388
4502
|
}
|
|
4389
4503
|
);
|
|
4390
4504
|
var getSimulationLabels = (simulations) => {
|
|
@@ -4403,7 +4517,7 @@ var AnalogSimulationSelector = ({
|
|
|
4403
4517
|
selectedSimulationExperimentId,
|
|
4404
4518
|
onSelectSimulation
|
|
4405
4519
|
}) => {
|
|
4406
|
-
const [open, setOpen] =
|
|
4520
|
+
const [open, setOpen] = useState11(false);
|
|
4407
4521
|
if (simulations.length <= 1) return null;
|
|
4408
4522
|
const simulationLabels = getSimulationLabels(simulations);
|
|
4409
4523
|
const selectedSimulation = simulationLabels.find(
|
|
@@ -4411,9 +4525,9 @@ var AnalogSimulationSelector = ({
|
|
|
4411
4525
|
);
|
|
4412
4526
|
const selectedLabel = selectedSimulation?.label ?? "Select simulation";
|
|
4413
4527
|
return /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
4414
|
-
/* @__PURE__ */
|
|
4528
|
+
/* @__PURE__ */ jsx15("style", { children: MENU_CSS2 }),
|
|
4415
4529
|
/* @__PURE__ */ jsxs11(DropdownMenu3.Root, { open, onOpenChange: setOpen, modal: false, children: [
|
|
4416
|
-
/* @__PURE__ */
|
|
4530
|
+
/* @__PURE__ */ jsx15(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
|
|
4417
4531
|
"button",
|
|
4418
4532
|
{
|
|
4419
4533
|
type: "button",
|
|
@@ -4440,13 +4554,13 @@ var AnalogSimulationSelector = ({
|
|
|
4440
4554
|
zIndex: zIndexMap.viewMenuIcon
|
|
4441
4555
|
},
|
|
4442
4556
|
children: [
|
|
4443
|
-
/* @__PURE__ */
|
|
4444
|
-
/* @__PURE__ */
|
|
4445
|
-
/* @__PURE__ */
|
|
4557
|
+
/* @__PURE__ */ jsx15("span", { style: { color: "#888888", flexShrink: 0 }, children: "Simulation:" }),
|
|
4558
|
+
/* @__PURE__ */ jsx15("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: selectedLabel }),
|
|
4559
|
+
/* @__PURE__ */ jsx15(ChevronDownIcon2, { className: "sv-simulation-chevron" })
|
|
4446
4560
|
]
|
|
4447
4561
|
}
|
|
4448
4562
|
) }),
|
|
4449
|
-
/* @__PURE__ */
|
|
4563
|
+
/* @__PURE__ */ jsx15(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx15(
|
|
4450
4564
|
DropdownMenu3.Content,
|
|
4451
4565
|
{
|
|
4452
4566
|
style: contentStyles3,
|
|
@@ -4468,8 +4582,8 @@ var AnalogSimulationSelector = ({
|
|
|
4468
4582
|
setOpen(false);
|
|
4469
4583
|
},
|
|
4470
4584
|
children: [
|
|
4471
|
-
/* @__PURE__ */
|
|
4472
|
-
/* @__PURE__ */
|
|
4585
|
+
/* @__PURE__ */ jsx15("span", { style: iconSlotStyles3, children: selected && /* @__PURE__ */ jsx15(CheckIcon3, {}) }),
|
|
4586
|
+
/* @__PURE__ */ jsx15("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: label })
|
|
4473
4587
|
]
|
|
4474
4588
|
},
|
|
4475
4589
|
simulation.simulation_experiment_id
|
|
@@ -4482,7 +4596,7 @@ var AnalogSimulationSelector = ({
|
|
|
4482
4596
|
};
|
|
4483
4597
|
|
|
4484
4598
|
// lib/components/AnalogSimulationViewer.tsx
|
|
4485
|
-
import { jsx as
|
|
4599
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4486
4600
|
var DEFAULT_RENDER_WIDTH = 1200;
|
|
4487
4601
|
var DEFAULT_COMBINED_RENDER_ASPECT_RATIO = 1;
|
|
4488
4602
|
var DEFAULT_GRAPH_ONLY_RENDER_ASPECT_RATIO = 2;
|
|
@@ -4497,16 +4611,16 @@ var AnalogSimulationViewer = ({
|
|
|
4497
4611
|
onSimulationChange,
|
|
4498
4612
|
acSweepView = "magnitude"
|
|
4499
4613
|
}) => {
|
|
4500
|
-
const [circuitJson, setCircuitJson] =
|
|
4501
|
-
const [isLoading, setIsLoading] =
|
|
4502
|
-
const [error, setError] =
|
|
4503
|
-
const [svgObjectUrl, setSvgObjectUrl] =
|
|
4614
|
+
const [circuitJson, setCircuitJson] = useState12(null);
|
|
4615
|
+
const [isLoading, setIsLoading] = useState12(true);
|
|
4616
|
+
const [error, setError] = useState12(null);
|
|
4617
|
+
const [svgObjectUrl, setSvgObjectUrl] = useState12(null);
|
|
4504
4618
|
const containerRef = useRef9(null);
|
|
4505
4619
|
const imgRef = useRef9(null);
|
|
4506
4620
|
const { containerWidth } = useResizeHandling(
|
|
4507
4621
|
containerRef
|
|
4508
4622
|
);
|
|
4509
|
-
const [isDragging, setIsDragging] =
|
|
4623
|
+
const [isDragging, setIsDragging] = useState12(false);
|
|
4510
4624
|
const {
|
|
4511
4625
|
ref: transformRef,
|
|
4512
4626
|
cancelDrag: _cancelDrag,
|
|
@@ -4522,7 +4636,7 @@ var AnalogSimulationViewer = ({
|
|
|
4522
4636
|
const renderAspectRatio = width && height ? width / height : defaultRenderAspectRatio;
|
|
4523
4637
|
const effectiveWidth = width || (height ? height * renderAspectRatio : containerWidth) || DEFAULT_RENDER_WIDTH;
|
|
4524
4638
|
const effectiveHeight = height || effectiveWidth / renderAspectRatio;
|
|
4525
|
-
|
|
4639
|
+
useEffect16(() => {
|
|
4526
4640
|
setIsLoading(true);
|
|
4527
4641
|
setError(null);
|
|
4528
4642
|
setCircuitJson(inputCircuitJson);
|
|
@@ -4534,11 +4648,11 @@ var AnalogSimulationViewer = ({
|
|
|
4534
4648
|
(element) => element.type === "simulation_experiment"
|
|
4535
4649
|
);
|
|
4536
4650
|
}, [circuitJson]);
|
|
4537
|
-
const [selectedSimulationExperimentId, setSelectedSimulationExperimentId] =
|
|
4651
|
+
const [selectedSimulationExperimentId, setSelectedSimulationExperimentId] = useState12(null);
|
|
4538
4652
|
const simulationExperimentId = (selectedSimulationExperimentId && simulationExperiments.some(
|
|
4539
4653
|
(simulation) => simulation.simulation_experiment_id === selectedSimulationExperimentId
|
|
4540
4654
|
) ? selectedSimulationExperimentId : simulationExperiments[0]?.simulation_experiment_id) ?? null;
|
|
4541
|
-
|
|
4655
|
+
useEffect16(() => {
|
|
4542
4656
|
if (simulationExperimentId !== selectedSimulationExperimentId) {
|
|
4543
4657
|
setSelectedSimulationExperimentId(simulationExperimentId);
|
|
4544
4658
|
}
|
|
@@ -4575,7 +4689,7 @@ var AnalogSimulationViewer = ({
|
|
|
4575
4689
|
simulationExperimentId,
|
|
4576
4690
|
acSweepView
|
|
4577
4691
|
]);
|
|
4578
|
-
|
|
4692
|
+
useEffect16(() => {
|
|
4579
4693
|
if (!simulationSvg) {
|
|
4580
4694
|
setSvgObjectUrl(null);
|
|
4581
4695
|
return;
|
|
@@ -4601,7 +4715,7 @@ var AnalogSimulationViewer = ({
|
|
|
4601
4715
|
const handleTouchStart = (_e) => {
|
|
4602
4716
|
setIsDragging(true);
|
|
4603
4717
|
};
|
|
4604
|
-
|
|
4718
|
+
useEffect16(() => {
|
|
4605
4719
|
const handleMouseUp = () => {
|
|
4606
4720
|
setIsDragging(false);
|
|
4607
4721
|
};
|
|
@@ -4616,7 +4730,7 @@ var AnalogSimulationViewer = ({
|
|
|
4616
4730
|
};
|
|
4617
4731
|
}, []);
|
|
4618
4732
|
if (isLoading) {
|
|
4619
|
-
return /* @__PURE__ */
|
|
4733
|
+
return /* @__PURE__ */ jsx16(
|
|
4620
4734
|
"div",
|
|
4621
4735
|
{
|
|
4622
4736
|
style: {
|
|
@@ -4636,7 +4750,7 @@ var AnalogSimulationViewer = ({
|
|
|
4636
4750
|
);
|
|
4637
4751
|
}
|
|
4638
4752
|
if (error) {
|
|
4639
|
-
return /* @__PURE__ */
|
|
4753
|
+
return /* @__PURE__ */ jsx16(
|
|
4640
4754
|
"div",
|
|
4641
4755
|
{
|
|
4642
4756
|
style: {
|
|
@@ -4652,8 +4766,8 @@ var AnalogSimulationViewer = ({
|
|
|
4652
4766
|
},
|
|
4653
4767
|
className,
|
|
4654
4768
|
children: /* @__PURE__ */ jsxs12("div", { style: { textAlign: "center", padding: "20px" }, children: [
|
|
4655
|
-
/* @__PURE__ */
|
|
4656
|
-
/* @__PURE__ */
|
|
4769
|
+
/* @__PURE__ */ jsx16("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "Circuit Conversion Error" }),
|
|
4770
|
+
/* @__PURE__ */ jsx16("div", { style: { fontSize: "14px" }, children: error })
|
|
4657
4771
|
] })
|
|
4658
4772
|
}
|
|
4659
4773
|
);
|
|
@@ -4675,11 +4789,11 @@ var AnalogSimulationViewer = ({
|
|
|
4675
4789
|
},
|
|
4676
4790
|
className,
|
|
4677
4791
|
children: [
|
|
4678
|
-
/* @__PURE__ */
|
|
4792
|
+
/* @__PURE__ */ jsx16("div", { style: { fontSize: "16px", color: "#475569", fontWeight: 500 }, children: "No Simulation Found" }),
|
|
4679
4793
|
/* @__PURE__ */ jsxs12("div", { style: { fontSize: "14px", color: "#64748b" }, children: [
|
|
4680
4794
|
"Use",
|
|
4681
4795
|
" ",
|
|
4682
|
-
/* @__PURE__ */
|
|
4796
|
+
/* @__PURE__ */ jsx16(
|
|
4683
4797
|
"code",
|
|
4684
4798
|
{
|
|
4685
4799
|
style: {
|
|
@@ -4718,7 +4832,7 @@ var AnalogSimulationViewer = ({
|
|
|
4718
4832
|
onMouseDown: handleMouseDown,
|
|
4719
4833
|
onTouchStart: handleTouchStart,
|
|
4720
4834
|
children: [
|
|
4721
|
-
/* @__PURE__ */
|
|
4835
|
+
/* @__PURE__ */ jsx16(
|
|
4722
4836
|
AnalogSimulationSelector,
|
|
4723
4837
|
{
|
|
4724
4838
|
simulations: simulationExperiments,
|
|
@@ -4726,7 +4840,7 @@ var AnalogSimulationViewer = ({
|
|
|
4726
4840
|
onSelectSimulation: handleSelectSimulation
|
|
4727
4841
|
}
|
|
4728
4842
|
),
|
|
4729
|
-
svgObjectUrl ? /* @__PURE__ */
|
|
4843
|
+
svgObjectUrl ? /* @__PURE__ */ jsx16(
|
|
4730
4844
|
"img",
|
|
4731
4845
|
{
|
|
4732
4846
|
ref: imgRef,
|
|
@@ -4740,7 +4854,7 @@ var AnalogSimulationViewer = ({
|
|
|
4740
4854
|
objectFit: "contain"
|
|
4741
4855
|
}
|
|
4742
4856
|
}
|
|
4743
|
-
) : /* @__PURE__ */
|
|
4857
|
+
) : /* @__PURE__ */ jsx16(
|
|
4744
4858
|
"div",
|
|
4745
4859
|
{
|
|
4746
4860
|
style: {
|
|
@@ -4761,9 +4875,9 @@ var AnalogSimulationViewer = ({
|
|
|
4761
4875
|
};
|
|
4762
4876
|
|
|
4763
4877
|
// lib/hooks/useSchematicViewerController.ts
|
|
4764
|
-
import { useCallback as useCallback9, useMemo as useMemo8, useState as
|
|
4878
|
+
import { useCallback as useCallback9, useMemo as useMemo8, useState as useState13 } from "react";
|
|
4765
4879
|
var useSchematicViewerController = () => {
|
|
4766
|
-
const [focusRequest, setFocusRequest] =
|
|
4880
|
+
const [focusRequest, setFocusRequest] = useState13(null);
|
|
4767
4881
|
const focusSchematicComponent = useCallback9(
|
|
4768
4882
|
(schematicComponentId) => {
|
|
4769
4883
|
setFocusRequest({ schematicComponentId });
|