@tscircuit/runframe 0.0.1116 → 0.0.1118
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/{chunk-XPVFXTHX.js → chunk-36HJBBYM.js} +2 -2
- package/dist/preview.js +1 -1
- package/dist/runner.js +129 -70
- package/dist/standalone-preview.min.js +4 -4
- package/dist/standalone.min.js +595 -595
- package/package.json +2 -2
|
@@ -1441,7 +1441,7 @@ var useErrorTelemetry = ({
|
|
|
1441
1441
|
};
|
|
1442
1442
|
|
|
1443
1443
|
// package.json
|
|
1444
|
-
var version = "0.0.
|
|
1444
|
+
var version = "0.0.1117";
|
|
1445
1445
|
var package_default = {
|
|
1446
1446
|
name: "@tscircuit/runframe",
|
|
1447
1447
|
main: "dist/preview.js",
|
|
@@ -1496,7 +1496,7 @@ var package_default = {
|
|
|
1496
1496
|
"@tscircuit/file-server": "^0.0.32",
|
|
1497
1497
|
"@tscircuit/footprinter": "^0.0.236",
|
|
1498
1498
|
"@tscircuit/math-utils": "^0.0.25",
|
|
1499
|
-
"@tscircuit/pcb-viewer": "1.11.
|
|
1499
|
+
"@tscircuit/pcb-viewer": "1.11.233",
|
|
1500
1500
|
"@tscircuit/props": "^0.0.365",
|
|
1501
1501
|
"@tscircuit/schematic-trace-solver": "^0.0.40",
|
|
1502
1502
|
"@tscircuit/schematic-viewer": "2.0.45",
|
package/dist/preview.js
CHANGED
package/dist/runner.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
useRunFrameStore,
|
|
33
33
|
useRunnerStore,
|
|
34
34
|
useStyles
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-36HJBBYM.js";
|
|
36
36
|
|
|
37
37
|
// lib/components/RunFrame/RunFrame.tsx
|
|
38
38
|
import { createCircuitWebWorker } from "@tscircuit/eval/worker";
|
|
@@ -742,11 +742,59 @@ var useSyncPageTitle = () => {
|
|
|
742
742
|
};
|
|
743
743
|
|
|
744
744
|
// lib/components/RunFrameWithApi/RunFrameWithApi.tsx
|
|
745
|
-
import { useEffect as
|
|
745
|
+
import { useCallback as useCallback3, useEffect as useEffect7, useMemo as useMemo2, useState as useState6 } from "react";
|
|
746
746
|
import { applyEditEventsToManualEditsFile } from "@tscircuit/core";
|
|
747
747
|
|
|
748
748
|
// lib/components/RunFrameWithApi/EnhancedFileSelectorCombobox/EnhancedFileSelectorCombobox.tsx
|
|
749
|
-
import { useEffect as
|
|
749
|
+
import { useEffect as useEffect6, useState as useState5 } from "react";
|
|
750
|
+
|
|
751
|
+
// lib/components/RunFrameWithApi/EnhancedFileSelectorCombobox/useCurrentFolder.ts
|
|
752
|
+
import { useState as useState4, useEffect as useEffect5 } from "react";
|
|
753
|
+
function getDirectoryPath(filePath) {
|
|
754
|
+
const lastSlashIndex = filePath.lastIndexOf("/");
|
|
755
|
+
if (lastSlashIndex === -1) return "/";
|
|
756
|
+
return filePath.substring(0, lastSlashIndex);
|
|
757
|
+
}
|
|
758
|
+
function useCurrentFolder({
|
|
759
|
+
currentFile,
|
|
760
|
+
files
|
|
761
|
+
}) {
|
|
762
|
+
const [hasManuallyNavigated, setHasManuallyNavigated] = useState4(false);
|
|
763
|
+
const [currentFolder, setCurrentFolder] = useState4(() => {
|
|
764
|
+
if (typeof window !== "undefined") {
|
|
765
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
766
|
+
const hashParams = new URLSearchParams(window.location.hash.slice(1));
|
|
767
|
+
const urlFile = searchParams.get("file") ?? hashParams.get("file");
|
|
768
|
+
if (urlFile && files.includes(urlFile)) {
|
|
769
|
+
const fileDir = getDirectoryPath(urlFile);
|
|
770
|
+
return fileDir === "/" ? null : fileDir;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
if (currentFile && files.includes(currentFile)) {
|
|
774
|
+
const fileDir = getDirectoryPath(currentFile);
|
|
775
|
+
return fileDir === "/" ? null : fileDir;
|
|
776
|
+
}
|
|
777
|
+
return null;
|
|
778
|
+
});
|
|
779
|
+
useEffect5(() => {
|
|
780
|
+
if (currentFile && !hasManuallyNavigated && files.includes(currentFile)) {
|
|
781
|
+
const fileDir = getDirectoryPath(currentFile);
|
|
782
|
+
setCurrentFolder(fileDir === "/" ? null : fileDir);
|
|
783
|
+
}
|
|
784
|
+
}, [currentFile, hasManuallyNavigated, files]);
|
|
785
|
+
const navigateToFolder = (folderPath) => {
|
|
786
|
+
setCurrentFolder(folderPath);
|
|
787
|
+
setHasManuallyNavigated(true);
|
|
788
|
+
};
|
|
789
|
+
const resetManualNavigation = () => {
|
|
790
|
+
setHasManuallyNavigated(false);
|
|
791
|
+
};
|
|
792
|
+
return {
|
|
793
|
+
currentFolder,
|
|
794
|
+
navigateToFolder,
|
|
795
|
+
resetManualNavigation
|
|
796
|
+
};
|
|
797
|
+
}
|
|
750
798
|
|
|
751
799
|
// lib/components/ui/command.tsx
|
|
752
800
|
import * as React from "react";
|
|
@@ -973,7 +1021,7 @@ var defaultFileFilter = (filename) => {
|
|
|
973
1021
|
var defaultDisplayName = (filename) => {
|
|
974
1022
|
return filename.split("/").pop() || "";
|
|
975
1023
|
};
|
|
976
|
-
var
|
|
1024
|
+
var getDirectoryPath2 = (filePath) => {
|
|
977
1025
|
return filePath.substring(0, filePath.lastIndexOf("/")) || "/";
|
|
978
1026
|
};
|
|
979
1027
|
var EnhancedFileSelectorCombobox = ({
|
|
@@ -982,11 +1030,11 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
982
1030
|
currentFile,
|
|
983
1031
|
config = {}
|
|
984
1032
|
}) => {
|
|
985
|
-
const [open, setOpen] =
|
|
986
|
-
const [file, setFile] =
|
|
987
|
-
const
|
|
988
|
-
const [currentFileIndex, setCurrentFileIndex] =
|
|
989
|
-
const [searchValue, setSearchValue] =
|
|
1033
|
+
const [open, setOpen] = useState5(false);
|
|
1034
|
+
const [file, setFile] = useState5(currentFile);
|
|
1035
|
+
const { currentFolder, navigateToFolder, resetManualNavigation } = useCurrentFolder({ currentFile: file, files });
|
|
1036
|
+
const [currentFileIndex, setCurrentFileIndex] = useState5(0);
|
|
1037
|
+
const [searchValue, setSearchValue] = useState5("");
|
|
990
1038
|
const {
|
|
991
1039
|
fileFilter = defaultFileFilter,
|
|
992
1040
|
getDisplayName = defaultDisplayName,
|
|
@@ -996,12 +1044,12 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
996
1044
|
pinnedFiles = [],
|
|
997
1045
|
onToggleFavorite
|
|
998
1046
|
} = config;
|
|
999
|
-
|
|
1047
|
+
useEffect6(() => {
|
|
1000
1048
|
setFile(currentFile);
|
|
1001
1049
|
}, [currentFile]);
|
|
1002
1050
|
const filteredFiles = files.filter(fileFilter);
|
|
1003
1051
|
const fileTree = parseFilesToTree(filteredFiles);
|
|
1004
|
-
const { files: currentFiles, folders: currentFolders } = getCurrentFolderContents(fileTree, currentFolder);
|
|
1052
|
+
const { files: currentFiles, folders: currentFolders } = getCurrentFolderContents(fileTree, currentFolder || "");
|
|
1005
1053
|
const getSearchResults = () => {
|
|
1006
1054
|
if (!searchValue.trim()) return { currentDirResults: [], globalResults: [] };
|
|
1007
1055
|
const searchTerm = searchValue.toLowerCase();
|
|
@@ -1030,17 +1078,15 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1030
1078
|
};
|
|
1031
1079
|
const searchResults = getSearchResults();
|
|
1032
1080
|
const isSearching = searchValue.trim().length > 0;
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1081
|
+
const handleNavigateToFolder = (folderPath) => {
|
|
1082
|
+
navigateToFolder(folderPath);
|
|
1035
1083
|
setCurrentFileIndex(0);
|
|
1036
1084
|
};
|
|
1037
1085
|
const navigateUp = () => {
|
|
1038
1086
|
if (!currentFolder) return;
|
|
1039
|
-
const
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
);
|
|
1043
|
-
navigateToFolder(parentPath);
|
|
1087
|
+
const lastSlashIndex = currentFolder.lastIndexOf("/");
|
|
1088
|
+
const parentPath = lastSlashIndex === -1 ? null : currentFolder.substring(0, lastSlashIndex);
|
|
1089
|
+
handleNavigateToFolder(parentPath);
|
|
1044
1090
|
};
|
|
1045
1091
|
const selectFile = (filePath, index, updateFolder = false) => {
|
|
1046
1092
|
setFile(filePath);
|
|
@@ -1048,15 +1094,12 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1048
1094
|
setOpen(false);
|
|
1049
1095
|
onFileChange(filePath);
|
|
1050
1096
|
if (updateFolder) {
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
} else {
|
|
1055
|
-
setCurrentFolder("");
|
|
1056
|
-
}
|
|
1097
|
+
const lastSlashIndex = filePath.lastIndexOf("/");
|
|
1098
|
+
const fileDir = lastSlashIndex === -1 ? null : filePath.substring(0, lastSlashIndex);
|
|
1099
|
+
handleNavigateToFolder(fileDir);
|
|
1057
1100
|
}
|
|
1058
1101
|
};
|
|
1059
|
-
|
|
1102
|
+
useEffect6(() => {
|
|
1060
1103
|
if (currentFiles.length > 0) {
|
|
1061
1104
|
const fileInCurrentFolder = currentFiles.findIndex(
|
|
1062
1105
|
(f) => f.path === currentFile
|
|
@@ -1066,7 +1109,7 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1066
1109
|
}
|
|
1067
1110
|
}
|
|
1068
1111
|
}, [currentFiles, currentFile]);
|
|
1069
|
-
const displayPath = currentFolder
|
|
1112
|
+
const displayPath = currentFolder ?? "/";
|
|
1070
1113
|
const shortDisplayPath = displayPath.length > 25 ? "..." + displayPath.slice(-22) : displayPath;
|
|
1071
1114
|
const getDropdownWidth = () => {
|
|
1072
1115
|
return "rf-w-[400px] rf-min-w-[400px] rf-max-w-[400px]";
|
|
@@ -1077,7 +1120,10 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1077
1120
|
open,
|
|
1078
1121
|
onOpenChange: (newOpen) => {
|
|
1079
1122
|
setOpen(newOpen);
|
|
1080
|
-
if (!newOpen)
|
|
1123
|
+
if (!newOpen) {
|
|
1124
|
+
setSearchValue("");
|
|
1125
|
+
resetManualNavigation();
|
|
1126
|
+
}
|
|
1081
1127
|
},
|
|
1082
1128
|
children: [
|
|
1083
1129
|
/* @__PURE__ */ jsx5(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs4(
|
|
@@ -1115,12 +1161,12 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1115
1161
|
/* @__PURE__ */ jsx5(
|
|
1116
1162
|
"button",
|
|
1117
1163
|
{
|
|
1118
|
-
onClick: () =>
|
|
1164
|
+
onClick: () => handleNavigateToFolder(null),
|
|
1119
1165
|
className: "rf-text-blue-600 hover:rf-text-blue-800 rf-underline rf-cursor-pointer rf-bg-transparent rf-border-none rf-p-0 rf-flex-shrink-0",
|
|
1120
1166
|
children: "root"
|
|
1121
1167
|
}
|
|
1122
1168
|
),
|
|
1123
|
-
currentFolder
|
|
1169
|
+
currentFolder?.split("/").filter(Boolean).map((segment, index, array) => {
|
|
1124
1170
|
const pathToSegment = array.slice(0, index + 1).join("/");
|
|
1125
1171
|
return /* @__PURE__ */ jsxs4(
|
|
1126
1172
|
"span",
|
|
@@ -1138,7 +1184,7 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1138
1184
|
) : /* @__PURE__ */ jsx5(
|
|
1139
1185
|
"button",
|
|
1140
1186
|
{
|
|
1141
|
-
onClick: () =>
|
|
1187
|
+
onClick: () => handleNavigateToFolder(pathToSegment),
|
|
1142
1188
|
className: "rf-text-blue-600 hover:rf-text-blue-800 rf-underline rf-cursor-pointer rf-bg-transparent rf-border-none rf-p-0 rf-truncate rf-max-w-[100px]",
|
|
1143
1189
|
title: segment,
|
|
1144
1190
|
children: segment
|
|
@@ -1181,7 +1227,7 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1181
1227
|
children: [
|
|
1182
1228
|
/* @__PURE__ */ jsx5(Star, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-text-amber-500 rf-fill-amber-500" }),
|
|
1183
1229
|
getDisplayName(path.split("/").pop() || ""),
|
|
1184
|
-
/* @__PURE__ */ jsx5("span", { className: "rf-text-xs rf-text-muted-foreground rf-ml-2 rf-truncate rf-max-w-[120px]", children:
|
|
1230
|
+
/* @__PURE__ */ jsx5("span", { className: "rf-text-xs rf-text-muted-foreground rf-ml-2 rf-truncate rf-max-w-[120px]", children: getDirectoryPath2(path) }),
|
|
1185
1231
|
/* @__PURE__ */ jsx5(
|
|
1186
1232
|
Check,
|
|
1187
1233
|
{
|
|
@@ -1260,7 +1306,7 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1260
1306
|
CommandItem,
|
|
1261
1307
|
{
|
|
1262
1308
|
value: `folder-${folderNode.path}`,
|
|
1263
|
-
onSelect: () =>
|
|
1309
|
+
onSelect: () => handleNavigateToFolder(folderNode.path),
|
|
1264
1310
|
className: "rf-text-slate-600 hover:rf-text-slate-900",
|
|
1265
1311
|
children: [
|
|
1266
1312
|
/* @__PURE__ */ jsx5(Folder, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-text-blue-600" }),
|
|
@@ -1343,7 +1389,7 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1343
1389
|
/* @__PURE__ */ jsx5("span", { className: "rf-mr-2", children: defaultFileIcon(file2.fileName) }),
|
|
1344
1390
|
/* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-items-center rf-w-full rf-min-w-0", children: [
|
|
1345
1391
|
/* @__PURE__ */ jsx5("span", { className: "rf-truncate rf-flex-1", children: getDisplayName(file2.fileName) }),
|
|
1346
|
-
/* @__PURE__ */ jsx5("span", { className: "rf-text-xs rf-text-muted-foreground rf-ml-2 rf-truncate rf-max-w-[120px]", children:
|
|
1392
|
+
/* @__PURE__ */ jsx5("span", { className: "rf-text-xs rf-text-muted-foreground rf-ml-2 rf-truncate rf-max-w-[120px]", children: getDirectoryPath2(file2.path) }),
|
|
1347
1393
|
onToggleFavorite && /* @__PURE__ */ jsx5(
|
|
1348
1394
|
"button",
|
|
1349
1395
|
{
|
|
@@ -1418,7 +1464,7 @@ var guessEntrypoint = (files) => files.find((file) => file.includes("entrypoint.
|
|
|
1418
1464
|
var guessManualEditsFilePath = (files) => files.find((file) => file.includes("manual-edits.")) ?? files.find((file) => file.includes("manual-edit.")) ?? files.find((file) => file.endsWith(".json"));
|
|
1419
1465
|
var RunFrameWithApi = (props) => {
|
|
1420
1466
|
const { apiBaseUrl, leftHeaderContent } = props;
|
|
1421
|
-
|
|
1467
|
+
useEffect7(() => {
|
|
1422
1468
|
if (props.debug) Debug3.enable("run-frame*");
|
|
1423
1469
|
}, [props.debug]);
|
|
1424
1470
|
const { startPolling, stopPolling } = useRunFrameStore((s) => ({
|
|
@@ -1437,11 +1483,14 @@ var RunFrameWithApi = (props) => {
|
|
|
1437
1483
|
[allFiles, projectConfigContent]
|
|
1438
1484
|
);
|
|
1439
1485
|
const circuitJson = useRunFrameStore((s) => s.circuitJson);
|
|
1440
|
-
const [componentPath, setComponentPath] =
|
|
1441
|
-
|
|
1442
|
-
|
|
1486
|
+
const [componentPath, setComponentPath] = useState6(() => {
|
|
1487
|
+
if (typeof window === "undefined")
|
|
1488
|
+
return props.initialMainComponentPath ?? "";
|
|
1489
|
+
const params = new URLSearchParams(window.location.hash.slice(1));
|
|
1490
|
+
return params.get("file") ?? props.initialMainComponentPath ?? "";
|
|
1491
|
+
});
|
|
1443
1492
|
const isLoadingFiles = !hasReceivedInitialFiles;
|
|
1444
|
-
|
|
1493
|
+
useEffect7(() => {
|
|
1445
1494
|
if (componentPath && boardFiles.includes(componentPath)) {
|
|
1446
1495
|
return;
|
|
1447
1496
|
}
|
|
@@ -1460,10 +1509,20 @@ var RunFrameWithApi = (props) => {
|
|
|
1460
1509
|
setComponentPath(firstMatch);
|
|
1461
1510
|
}
|
|
1462
1511
|
}, [boardFiles, props.initialMainComponentPath, componentPath]);
|
|
1463
|
-
|
|
1512
|
+
const updateFileHash = useCallback3((filePath) => {
|
|
1513
|
+
if (typeof window === "undefined") return;
|
|
1514
|
+
const params = new URLSearchParams(window.location.hash.slice(1));
|
|
1515
|
+
if (params.get("file") === filePath) return;
|
|
1516
|
+
params.set("file", filePath);
|
|
1517
|
+
const newHash = params.toString();
|
|
1518
|
+
const newUrl = `${window.location.pathname}${window.location.search}` + (newHash.length > 0 ? `#${newHash}` : "");
|
|
1519
|
+
window.history.replaceState(null, "", newUrl);
|
|
1520
|
+
}, []);
|
|
1521
|
+
useEffect7(() => {
|
|
1464
1522
|
if (!componentPath) return;
|
|
1523
|
+
updateFileHash(componentPath);
|
|
1465
1524
|
props.onMainComponentPathChange?.(componentPath);
|
|
1466
|
-
}, [componentPath, props.onMainComponentPathChange]);
|
|
1525
|
+
}, [componentPath, props.onMainComponentPathChange, updateFileHash]);
|
|
1467
1526
|
useSyncPageTitle();
|
|
1468
1527
|
const {
|
|
1469
1528
|
editEventsForRender,
|
|
@@ -1471,12 +1530,12 @@ var RunFrameWithApi = (props) => {
|
|
|
1471
1530
|
markRenderStarted,
|
|
1472
1531
|
markRenderComplete
|
|
1473
1532
|
} = useEditEventController();
|
|
1474
|
-
|
|
1533
|
+
useEffect7(() => {
|
|
1475
1534
|
if (apiBaseUrl) {
|
|
1476
1535
|
window.TSCIRCUIT_FILESERVER_API_BASE_URL = apiBaseUrl;
|
|
1477
1536
|
}
|
|
1478
1537
|
}, [apiBaseUrl]);
|
|
1479
|
-
|
|
1538
|
+
useEffect7(() => {
|
|
1480
1539
|
startPolling();
|
|
1481
1540
|
return () => stopPolling();
|
|
1482
1541
|
}, [startPolling, stopPolling]);
|
|
@@ -1558,19 +1617,19 @@ var RunFrameWithApi = (props) => {
|
|
|
1558
1617
|
};
|
|
1559
1618
|
|
|
1560
1619
|
// lib/components/RunFrameForCli/RunFrameForCli.tsx
|
|
1561
|
-
import { useCallback as
|
|
1620
|
+
import { useCallback as useCallback4, useState as useState7 } from "react";
|
|
1562
1621
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1563
1622
|
var RunFrameForCli = (props) => {
|
|
1564
1623
|
const [shouldLoadLatestEval, setLoadLatestEval] = useLocalStorageState(
|
|
1565
1624
|
"load-latest-eval",
|
|
1566
1625
|
true
|
|
1567
1626
|
);
|
|
1568
|
-
const [initialMainComponentPath] =
|
|
1627
|
+
const [initialMainComponentPath] = useState7(() => {
|
|
1569
1628
|
if (typeof window === "undefined") return void 0;
|
|
1570
1629
|
const params = new URLSearchParams(window.location.hash.slice(1));
|
|
1571
1630
|
return params.get("main_component") ?? void 0;
|
|
1572
1631
|
});
|
|
1573
|
-
const updateMainComponentHash =
|
|
1632
|
+
const updateMainComponentHash = useCallback4((mainComponentPath) => {
|
|
1574
1633
|
if (typeof window === "undefined") return;
|
|
1575
1634
|
const params = new URLSearchParams(window.location.hash.slice(1));
|
|
1576
1635
|
if (params.get("main_component") === mainComponentPath) return;
|
|
@@ -1612,7 +1671,7 @@ var RunFrameForCli = (props) => {
|
|
|
1612
1671
|
|
|
1613
1672
|
// lib/components/ImportComponentDialog/ImportComponentDialog.tsx
|
|
1614
1673
|
import "react";
|
|
1615
|
-
import { useState as
|
|
1674
|
+
import { useState as useState8, useEffect as useEffect8 } from "react";
|
|
1616
1675
|
import { Loader2 as Loader22, Search as Search2, ExternalLink } from "lucide-react";
|
|
1617
1676
|
|
|
1618
1677
|
// lib/components/ImportComponentDialog/jlc-api.ts
|
|
@@ -1765,19 +1824,19 @@ var ImportComponentDialog = ({
|
|
|
1765
1824
|
proxyRequestHeaders,
|
|
1766
1825
|
onImport
|
|
1767
1826
|
}) => {
|
|
1768
|
-
const [searchQuery, setSearchQuery] =
|
|
1769
|
-
const [searchResults, setSearchResults] =
|
|
1827
|
+
const [searchQuery, setSearchQuery] = useState8("");
|
|
1828
|
+
const [searchResults, setSearchResults] = useState8(
|
|
1770
1829
|
[]
|
|
1771
1830
|
);
|
|
1772
|
-
const [hasSearched, setHasSearched] =
|
|
1773
|
-
const [isLoading, setIsLoading] =
|
|
1774
|
-
const [selectedComponent, setSelectedComponent] =
|
|
1775
|
-
const [activeTab, setActiveTab] =
|
|
1776
|
-
const [detailsOpen, setDetailsOpen] =
|
|
1777
|
-
const [detailsComponent, setDetailsComponent] =
|
|
1778
|
-
const [packageDetails, setPackageDetails] =
|
|
1779
|
-
const [packageDetailsLoading, setPackageDetailsLoading] =
|
|
1780
|
-
const [previewActiveTab, setPreviewActiveTab] =
|
|
1831
|
+
const [hasSearched, setHasSearched] = useState8(false);
|
|
1832
|
+
const [isLoading, setIsLoading] = useState8(false);
|
|
1833
|
+
const [selectedComponent, setSelectedComponent] = useState8(null);
|
|
1834
|
+
const [activeTab, setActiveTab] = useState8("tscircuit.com");
|
|
1835
|
+
const [detailsOpen, setDetailsOpen] = useState8(false);
|
|
1836
|
+
const [detailsComponent, setDetailsComponent] = useState8(null);
|
|
1837
|
+
const [packageDetails, setPackageDetails] = useState8(null);
|
|
1838
|
+
const [packageDetailsLoading, setPackageDetailsLoading] = useState8(false);
|
|
1839
|
+
const [previewActiveTab, setPreviewActiveTab] = useState8(
|
|
1781
1840
|
"pcb"
|
|
1782
1841
|
);
|
|
1783
1842
|
const pushEvent = useRunFrameStore((s) => s.pushEvent);
|
|
@@ -1869,7 +1928,7 @@ var ImportComponentDialog = ({
|
|
|
1869
1928
|
handleSearch();
|
|
1870
1929
|
}
|
|
1871
1930
|
};
|
|
1872
|
-
|
|
1931
|
+
useEffect8(() => {
|
|
1873
1932
|
setSearchResults([]);
|
|
1874
1933
|
setSelectedComponent(null);
|
|
1875
1934
|
}, [activeTab]);
|
|
@@ -2186,7 +2245,7 @@ var ImportComponentDialog = ({
|
|
|
2186
2245
|
};
|
|
2187
2246
|
|
|
2188
2247
|
// lib/components/RunFrameStaticBuildViewer/RunFrameStaticBuildViewer.tsx
|
|
2189
|
-
import { useCallback as
|
|
2248
|
+
import { useCallback as useCallback5, useEffect as useEffect9, useState as useState9 } from "react";
|
|
2190
2249
|
|
|
2191
2250
|
// lib/components/RunFrameStaticBuildViewer/CircuitJsonFileSelectorCombobox.tsx
|
|
2192
2251
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
@@ -2217,19 +2276,19 @@ import { ErrorBoundary } from "react-error-boundary";
|
|
|
2217
2276
|
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2218
2277
|
var RunFrameStaticBuildViewer = (props) => {
|
|
2219
2278
|
useStyles();
|
|
2220
|
-
const [currentCircuitJsonPath, setCurrentCircuitJsonPath] =
|
|
2279
|
+
const [currentCircuitJsonPath, setCurrentCircuitJsonPath] = useState9(
|
|
2221
2280
|
() => {
|
|
2222
2281
|
return props.initialCircuitPath ?? "";
|
|
2223
2282
|
}
|
|
2224
2283
|
);
|
|
2225
|
-
const [circuitJson, setCircuitJson] =
|
|
2226
|
-
const [isLoadingCurrentFile, setIsLoadingCurrentFile] =
|
|
2227
|
-
const [fileCache, setFileCache] =
|
|
2228
|
-
const [loadingFiles, setLoadingFiles] =
|
|
2229
|
-
const [failedFiles, setFailedFiles] =
|
|
2284
|
+
const [circuitJson, setCircuitJson] = useState9(null);
|
|
2285
|
+
const [isLoadingCurrentFile, setIsLoadingCurrentFile] = useState9(false);
|
|
2286
|
+
const [fileCache, setFileCache] = useState9({});
|
|
2287
|
+
const [loadingFiles, setLoadingFiles] = useState9(/* @__PURE__ */ new Set());
|
|
2288
|
+
const [failedFiles, setFailedFiles] = useState9(/* @__PURE__ */ new Set());
|
|
2230
2289
|
const fileReferences = props.files;
|
|
2231
2290
|
const availableFiles = fileReferences.map((f) => f.filePath);
|
|
2232
|
-
const defaultFetchFile =
|
|
2291
|
+
const defaultFetchFile = useCallback5(
|
|
2233
2292
|
async (fileRef) => {
|
|
2234
2293
|
if (!fileRef.fileStaticAssetUrl) {
|
|
2235
2294
|
throw new Error(
|
|
@@ -2246,7 +2305,7 @@ var RunFrameStaticBuildViewer = (props) => {
|
|
|
2246
2305
|
},
|
|
2247
2306
|
[]
|
|
2248
2307
|
);
|
|
2249
|
-
const loadCircuitJsonFile =
|
|
2308
|
+
const loadCircuitJsonFile = useCallback5(
|
|
2250
2309
|
async (filePath) => {
|
|
2251
2310
|
if (fileCache[filePath]) {
|
|
2252
2311
|
setCircuitJson(fileCache[filePath]);
|
|
@@ -2302,7 +2361,7 @@ var RunFrameStaticBuildViewer = (props) => {
|
|
|
2302
2361
|
defaultFetchFile
|
|
2303
2362
|
]
|
|
2304
2363
|
);
|
|
2305
|
-
|
|
2364
|
+
useEffect9(() => {
|
|
2306
2365
|
if (availableFiles.length === 0) return;
|
|
2307
2366
|
let selectedPath = currentCircuitJsonPath;
|
|
2308
2367
|
if (!selectedPath || !availableFiles.includes(selectedPath)) {
|
|
@@ -2313,10 +2372,10 @@ var RunFrameStaticBuildViewer = (props) => {
|
|
|
2313
2372
|
loadCircuitJsonFile(selectedPath);
|
|
2314
2373
|
}
|
|
2315
2374
|
}, [currentCircuitJsonPath]);
|
|
2316
|
-
const handleFileChange =
|
|
2375
|
+
const handleFileChange = useCallback5((newPath) => {
|
|
2317
2376
|
setCurrentCircuitJsonPath(newPath);
|
|
2318
2377
|
}, []);
|
|
2319
|
-
const retryFailedFile =
|
|
2378
|
+
const retryFailedFile = useCallback5(
|
|
2320
2379
|
(filePath) => {
|
|
2321
2380
|
setFailedFiles((prev) => {
|
|
2322
2381
|
const newSet = new Set(prev);
|