@tscircuit/runframe 0.0.1457 → 0.0.1459
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-B4PLT3KP.js → chunk-RS5BHI4M.js} +2 -2
- package/dist/preview.js +1 -1
- package/dist/runner.js +151 -232
- package/dist/standalone-preview.min.js +2 -2
- package/dist/standalone.min.js +560 -560
- package/package.json +1 -1
package/dist/runner.js
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
useRunFrameStore,
|
|
35
35
|
useRunnerStore,
|
|
36
36
|
useStyles
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-RS5BHI4M.js";
|
|
38
38
|
|
|
39
39
|
// lib/components/RunFrame/RunFrame.tsx
|
|
40
40
|
import { createCircuitWebWorker } from "@tscircuit/eval/worker";
|
|
@@ -193,6 +193,38 @@ var LoadingSkeleton = ({
|
|
|
193
193
|
] });
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
+
// lib/hooks/use-circuit-json-file.ts
|
|
197
|
+
import { useMemo } from "react";
|
|
198
|
+
var useCircuitJsonFile = ({
|
|
199
|
+
mainComponentPath,
|
|
200
|
+
fsMap
|
|
201
|
+
}) => {
|
|
202
|
+
return useMemo(() => {
|
|
203
|
+
const isStaticCircuitJson = mainComponentPath?.endsWith(".circuit.json") || mainComponentPath?.toLowerCase() === "circuit.json";
|
|
204
|
+
if (!isStaticCircuitJson) {
|
|
205
|
+
return { isStaticCircuitJson: false, circuitJson: null, error: null };
|
|
206
|
+
}
|
|
207
|
+
const circuitJsonContent = fsMap.get(mainComponentPath);
|
|
208
|
+
if (!circuitJsonContent) {
|
|
209
|
+
return {
|
|
210
|
+
isStaticCircuitJson: true,
|
|
211
|
+
circuitJson: null,
|
|
212
|
+
error: `Circuit JSON file not found: ${mainComponentPath}`
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
try {
|
|
216
|
+
const parsed = JSON.parse(circuitJsonContent);
|
|
217
|
+
return { isStaticCircuitJson: true, circuitJson: parsed, error: null };
|
|
218
|
+
} catch (e) {
|
|
219
|
+
return {
|
|
220
|
+
isStaticCircuitJson: true,
|
|
221
|
+
circuitJson: null,
|
|
222
|
+
error: `Failed to parse circuit.json: ${e instanceof Error ? e.message : String(e)}`
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}, [mainComponentPath, fsMap]);
|
|
226
|
+
};
|
|
227
|
+
|
|
196
228
|
// lib/components/RunFrame/run-completion.ts
|
|
197
229
|
var isCircuitJsonError = (entry) => {
|
|
198
230
|
if (!entry || typeof entry !== "object") return false;
|
|
@@ -365,8 +397,26 @@ var RunFrame = (props) => {
|
|
|
365
397
|
);
|
|
366
398
|
const lastFsMapRef = useRef2(null);
|
|
367
399
|
const lastEntrypointRef = useRef2(null);
|
|
400
|
+
const {
|
|
401
|
+
isStaticCircuitJson,
|
|
402
|
+
circuitJson: circuitJsonFileParsedContent,
|
|
403
|
+
error: circuitJsonFileError
|
|
404
|
+
} = useCircuitJsonFile({
|
|
405
|
+
mainComponentPath: props.mainComponentPath,
|
|
406
|
+
fsMap
|
|
407
|
+
});
|
|
408
|
+
useEffect(() => {
|
|
409
|
+
if (!isStaticCircuitJson) return;
|
|
410
|
+
if (circuitJsonFileParsedContent) {
|
|
411
|
+
setCircuitJson(circuitJsonFileParsedContent);
|
|
412
|
+
setError(null);
|
|
413
|
+
} else if (circuitJsonFileError) {
|
|
414
|
+
setError({ error: circuitJsonFileError, stack: "" });
|
|
415
|
+
}
|
|
416
|
+
}, [isStaticCircuitJson, circuitJsonFileParsedContent, circuitJsonFileError]);
|
|
368
417
|
useEffect(() => {
|
|
369
418
|
if (props.isLoadingFiles) return;
|
|
419
|
+
if (isStaticCircuitJson) return;
|
|
370
420
|
const fsMapObj = fsMap instanceof Map ? Object.fromEntries(fsMap.entries()) : fsMap;
|
|
371
421
|
if (!fsMapObj || Object.keys(fsMapObj).length === 0) {
|
|
372
422
|
setError({
|
|
@@ -584,7 +634,8 @@ var RunFrame = (props) => {
|
|
|
584
634
|
props.evalVersion,
|
|
585
635
|
props.mainComponentPath,
|
|
586
636
|
props.isLoadingFiles,
|
|
587
|
-
currentDebugOption
|
|
637
|
+
currentDebugOption,
|
|
638
|
+
isStaticCircuitJson
|
|
588
639
|
]);
|
|
589
640
|
const lastEditEventRef = useRef2(null);
|
|
590
641
|
const dragTimeout = useRef2(null);
|
|
@@ -872,11 +923,11 @@ var useSyncPageTitle = () => {
|
|
|
872
923
|
};
|
|
873
924
|
|
|
874
925
|
// lib/components/RunFrameWithApi/RunFrameWithApi.tsx
|
|
875
|
-
import { useCallback as useCallback4, useEffect as useEffect7, useMemo as
|
|
926
|
+
import { useCallback as useCallback4, useEffect as useEffect7, useMemo as useMemo4, useState as useState6 } from "react";
|
|
876
927
|
import { applyEditEventsToManualEditsFile } from "@tscircuit/core";
|
|
877
928
|
|
|
878
929
|
// lib/components/RunFrameWithApi/EnhancedFileSelectorCombobox/EnhancedFileSelectorCombobox.tsx
|
|
879
|
-
import { useEffect as useEffect6, useState as useState5, useRef as useRef3, useMemo as
|
|
930
|
+
import { useEffect as useEffect6, useState as useState5, useRef as useRef3, useMemo as useMemo3, useCallback as useCallback3 } from "react";
|
|
880
931
|
|
|
881
932
|
// lib/components/RunFrameWithApi/EnhancedFileSelectorCombobox/useCurrentFolder.ts
|
|
882
933
|
import { useState as useState4, useEffect as useEffect5 } from "react";
|
|
@@ -971,7 +1022,7 @@ var CommandList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
971
1022
|
{
|
|
972
1023
|
ref,
|
|
973
1024
|
className: cn(
|
|
974
|
-
"rf-max-h-[300px] rf-overflow-y-auto rf-overflow-x-hidden",
|
|
1025
|
+
"rf-max-h-[300px] rf-overflow-y-auto rf-overflow-x-hidden rf-py-1",
|
|
975
1026
|
className
|
|
976
1027
|
),
|
|
977
1028
|
...props
|
|
@@ -992,7 +1043,7 @@ var CommandGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
992
1043
|
{
|
|
993
1044
|
ref,
|
|
994
1045
|
className: cn(
|
|
995
|
-
"rf-overflow-hidden rf-
|
|
1046
|
+
"rf-overflow-hidden rf-px-1 rf-py-0 rf-text-zinc-950 [&_[cmdk-group-heading]]:rf-px-2 [&_[cmdk-group-heading]]:rf-py-1.5 [&_[cmdk-group-heading]]:rf-text-xs [&_[cmdk-group-heading]]:rf-font-medium [&_[cmdk-group-heading]]:rf-text-zinc-500 dark:rf-text-zinc-50 dark:[&_[cmdk-group-heading]]:rf-text-zinc-400",
|
|
996
1047
|
className
|
|
997
1048
|
),
|
|
998
1049
|
...props
|
|
@@ -1066,14 +1117,12 @@ import {
|
|
|
1066
1117
|
ChevronsUpDown,
|
|
1067
1118
|
Check,
|
|
1068
1119
|
ChevronRight,
|
|
1120
|
+
ChevronDown,
|
|
1069
1121
|
File,
|
|
1070
1122
|
FileText,
|
|
1071
1123
|
Code,
|
|
1072
1124
|
Folder,
|
|
1073
1125
|
ArrowUp,
|
|
1074
|
-
Star,
|
|
1075
|
-
Eye,
|
|
1076
|
-
EyeOff,
|
|
1077
1126
|
Clock,
|
|
1078
1127
|
Save
|
|
1079
1128
|
} from "lucide-react";
|
|
@@ -1193,7 +1242,7 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1193
1242
|
const [recentlyViewedFiles, setRecentlyViewedFiles] = useLocalStorageState("runframe:recentlyViewed", []);
|
|
1194
1243
|
const [showRecents, setShowRecents] = useLocalStorageState(
|
|
1195
1244
|
"runframe:showRecents",
|
|
1196
|
-
|
|
1245
|
+
false
|
|
1197
1246
|
);
|
|
1198
1247
|
useEffect6(() => {
|
|
1199
1248
|
const handleKeyDown = (e) => {
|
|
@@ -1326,7 +1375,7 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1326
1375
|
}
|
|
1327
1376
|
}
|
|
1328
1377
|
}, [currentFiles, currentFile]);
|
|
1329
|
-
const recentFiles =
|
|
1378
|
+
const recentFiles = useMemo3(() => {
|
|
1330
1379
|
const validSavedFiles = recentlySavedFiles.filter(
|
|
1331
1380
|
(file2) => filteredFiles.includes(file2)
|
|
1332
1381
|
);
|
|
@@ -1380,7 +1429,7 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1380
1429
|
PopoverContent,
|
|
1381
1430
|
{
|
|
1382
1431
|
className: cn(
|
|
1383
|
-
"!rf-p-0 !rf-overflow-
|
|
1432
|
+
"!rf-p-0 !rf-overflow-y-auto !rf-max-h-[80vh] !rf-z-[200]",
|
|
1384
1433
|
getDropdownWidth()
|
|
1385
1434
|
),
|
|
1386
1435
|
children: /* @__PURE__ */ jsxs5(Command, { shouldFilter: false, children: [
|
|
@@ -1393,7 +1442,53 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1393
1442
|
onValueChange: setSearchValue
|
|
1394
1443
|
}
|
|
1395
1444
|
),
|
|
1396
|
-
/* @__PURE__ */ jsxs5("div", { className: "rf-
|
|
1445
|
+
recentFiles.length > 0 && /* @__PURE__ */ jsxs5("div", { className: "rf-border-b rf-border-gray-200", children: [
|
|
1446
|
+
/* @__PURE__ */ jsxs5(
|
|
1447
|
+
"button",
|
|
1448
|
+
{
|
|
1449
|
+
onClick: () => setShowRecents(!showRecents),
|
|
1450
|
+
className: "rf-w-full rf-px-3 rf-py-2 rf-flex rf-items-center rf-justify-between rf-text-xs rf-text-slate-600 hover:rf-bg-slate-50 rf-bg-transparent rf-border-none rf-cursor-pointer",
|
|
1451
|
+
children: [
|
|
1452
|
+
/* @__PURE__ */ jsx6("span", { className: "rf-font-medium", children: "Recent Files" }),
|
|
1453
|
+
/* @__PURE__ */ jsx6(
|
|
1454
|
+
ChevronDown,
|
|
1455
|
+
{
|
|
1456
|
+
className: cn(
|
|
1457
|
+
"rf-h-4 rf-w-4 rf-transition-transform",
|
|
1458
|
+
!showRecents && "-rf-rotate-90"
|
|
1459
|
+
)
|
|
1460
|
+
}
|
|
1461
|
+
)
|
|
1462
|
+
]
|
|
1463
|
+
}
|
|
1464
|
+
),
|
|
1465
|
+
showRecents && /* @__PURE__ */ jsx6("div", { className: "rf-pb-1", children: recentFiles.map((item, index) => /* @__PURE__ */ jsxs5(
|
|
1466
|
+
"div",
|
|
1467
|
+
{
|
|
1468
|
+
onClick: () => selectFile(item.path, index, true),
|
|
1469
|
+
className: cn(
|
|
1470
|
+
"rf-flex rf-items-center rf-px-3 rf-py-1.5 rf-cursor-pointer hover:rf-bg-slate-100",
|
|
1471
|
+
item.path === currentFile && "rf-font-medium"
|
|
1472
|
+
),
|
|
1473
|
+
children: [
|
|
1474
|
+
item.type === "saved" ? /* @__PURE__ */ jsx6("span", { title: "Recently saved", children: /* @__PURE__ */ jsx6(Save, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-text-green-500" }) }) : /* @__PURE__ */ jsx6("span", { title: "Recently viewed", children: /* @__PURE__ */ jsx6(Clock, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-text-blue-500" }) }),
|
|
1475
|
+
/* @__PURE__ */ jsx6("span", { className: "rf-text-sm", children: getDisplayName(item.path.split("/").pop() || "") }),
|
|
1476
|
+
/* @__PURE__ */ jsx6("span", { className: "rf-text-xs rf-text-muted-foreground rf-ml-2 rf-truncate rf-max-w-[40%]", children: getDirectoryPath2(item.path) }),
|
|
1477
|
+
/* @__PURE__ */ jsx6(
|
|
1478
|
+
Check,
|
|
1479
|
+
{
|
|
1480
|
+
className: cn(
|
|
1481
|
+
"rf-ml-auto rf-h-4 rf-w-4",
|
|
1482
|
+
item.path === currentFile ? "rf-opacity-100" : "rf-opacity-0"
|
|
1483
|
+
)
|
|
1484
|
+
}
|
|
1485
|
+
)
|
|
1486
|
+
]
|
|
1487
|
+
},
|
|
1488
|
+
item.path
|
|
1489
|
+
)) })
|
|
1490
|
+
] }),
|
|
1491
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-px-3 rf-py-2 rf-bg-slate-50 rf-flex rf-items-center rf-justify-between rf-gap-2", children: [
|
|
1397
1492
|
/* @__PURE__ */ jsx6("div", { className: "rf-flex rf-items-center rf-text-xs rf-text-slate-600 rf-min-w-0 rf-flex-1", children: /* @__PURE__ */ jsxs5("div", { className: "rf-flex rf-items-center rf-min-w-0", children: [
|
|
1398
1493
|
/* @__PURE__ */ jsx6(
|
|
1399
1494
|
"button",
|
|
@@ -1446,182 +1541,54 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1446
1541
|
}
|
|
1447
1542
|
) })
|
|
1448
1543
|
] }),
|
|
1449
|
-
/* @__PURE__ */ jsx6(CommandList, { className: "rf-
|
|
1544
|
+
/* @__PURE__ */ jsx6(CommandList, { className: "rf-overflow-visible rf-max-h-none", children: !isSearching ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1450
1545
|
/* @__PURE__ */ jsx6(CommandEmpty, { children: emptyMessage }),
|
|
1451
|
-
|
|
1452
|
-
|
|
1546
|
+
currentFiles.length > 0 && /* @__PURE__ */ jsx6(CommandGroup, { children: currentFiles.map((fileNode, index) => /* @__PURE__ */ jsxs5(
|
|
1547
|
+
CommandItem,
|
|
1453
1548
|
{
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1549
|
+
value: `current:${fileNode.path}`,
|
|
1550
|
+
onSelect: () => selectFile(fileNode.path, index),
|
|
1551
|
+
className: cn(
|
|
1552
|
+
fileNode.path === currentFile && "rf-font-medium",
|
|
1553
|
+
"rf-group"
|
|
1554
|
+
),
|
|
1555
|
+
children: [
|
|
1556
|
+
/* @__PURE__ */ jsx6("span", { className: "rf-mr-2", children: defaultFileIcon(fileNode.name) }),
|
|
1557
|
+
getDisplayName(fileNode.name),
|
|
1558
|
+
/* @__PURE__ */ jsx6("div", { className: "rf-ml-auto rf-flex rf-items-center rf-gap-1", children: /* @__PURE__ */ jsx6(
|
|
1559
|
+
Check,
|
|
1458
1560
|
{
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
children: showRecents ? /* @__PURE__ */ jsx6(Eye, { className: "rf-h-3.5 rf-w-3.5" }) : /* @__PURE__ */ jsx6(EyeOff, { className: "rf-h-3.5 rf-w-3.5" })
|
|
1463
|
-
}
|
|
1464
|
-
)
|
|
1465
|
-
] }),
|
|
1466
|
-
className: "rf-border-b rf-border-gray-200 rf-pb-1 rf-bg-blue-50/30",
|
|
1467
|
-
children: showRecents && recentFiles.map((item, index) => /* @__PURE__ */ jsxs5(
|
|
1468
|
-
CommandItem,
|
|
1469
|
-
{
|
|
1470
|
-
value: `recent:${item.path}`,
|
|
1471
|
-
onSelect: () => selectFile(item.path, index, true),
|
|
1472
|
-
className: cn(
|
|
1473
|
-
item.path === currentFile && "rf-font-medium"
|
|
1474
|
-
),
|
|
1475
|
-
children: [
|
|
1476
|
-
item.type === "saved" ? /* @__PURE__ */ jsx6("span", { title: "Recently saved", children: /* @__PURE__ */ jsx6(Save, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-text-green-500" }) }) : /* @__PURE__ */ jsx6("span", { title: "Recently viewed", children: /* @__PURE__ */ jsx6(Clock, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-text-blue-500" }) }),
|
|
1477
|
-
getDisplayName(item.path.split("/").pop() || ""),
|
|
1478
|
-
/* @__PURE__ */ jsx6("span", { className: "rf-text-xs rf-text-muted-foreground rf-ml-2 rf-truncate rf-max-w-[40%]", children: getDirectoryPath2(item.path) }),
|
|
1479
|
-
/* @__PURE__ */ jsx6(
|
|
1480
|
-
Check,
|
|
1481
|
-
{
|
|
1482
|
-
className: cn(
|
|
1483
|
-
"rf-ml-auto rf-h-4 rf-w-4",
|
|
1484
|
-
item.path === currentFile ? "rf-opacity-100" : "rf-opacity-0"
|
|
1485
|
-
)
|
|
1486
|
-
}
|
|
1561
|
+
className: cn(
|
|
1562
|
+
"rf-h-4 rf-w-4",
|
|
1563
|
+
fileNode.path === currentFile ? "rf-opacity-100" : "rf-opacity-0"
|
|
1487
1564
|
)
|
|
1488
|
-
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
),
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
{
|
|
1497
|
-
heading: "Favorites",
|
|
1498
|
-
className: "rf-border-b rf-border-gray-200 rf-pb-1 rf-bg-amber-50/30",
|
|
1499
|
-
children: pinnedFiles.filter((path) => filteredFiles.includes(path)).map((path, index) => /* @__PURE__ */ jsxs5(
|
|
1500
|
-
CommandItem,
|
|
1501
|
-
{
|
|
1502
|
-
value: `favorite:${path}`,
|
|
1503
|
-
onSelect: () => selectFile(path, index, true),
|
|
1504
|
-
className: cn(
|
|
1505
|
-
path === currentFile && "rf-font-medium",
|
|
1506
|
-
"rf-group"
|
|
1507
|
-
),
|
|
1508
|
-
children: [
|
|
1509
|
-
onToggleFavorite && /* @__PURE__ */ jsx6(
|
|
1510
|
-
"button",
|
|
1511
|
-
{
|
|
1512
|
-
type: "button",
|
|
1513
|
-
onClick: (e) => {
|
|
1514
|
-
e.stopPropagation();
|
|
1515
|
-
onToggleFavorite(path);
|
|
1516
|
-
},
|
|
1517
|
-
className: "rf-mr-2 rf-p-0 rf-bg-transparent rf-border-none",
|
|
1518
|
-
"aria-label": "Remove from favorites",
|
|
1519
|
-
title: "Remove from favorites",
|
|
1520
|
-
children: /* @__PURE__ */ jsx6(Star, { className: "rf-h-4 rf-w-4 rf-text-amber-500 rf-fill-amber-500" })
|
|
1521
|
-
}
|
|
1522
|
-
),
|
|
1523
|
-
getDisplayName(path.split("/").pop() || ""),
|
|
1524
|
-
/* @__PURE__ */ jsx6("span", { className: "rf-text-xs rf-text-muted-foreground rf-ml-2 rf-truncate rf-max-w-[40%]", children: getDirectoryPath2(path) }),
|
|
1525
|
-
/* @__PURE__ */ jsx6(
|
|
1526
|
-
Check,
|
|
1527
|
-
{
|
|
1528
|
-
className: cn(
|
|
1529
|
-
"rf-ml-auto rf-h-4 rf-w-4",
|
|
1530
|
-
path === currentFile ? "rf-opacity-100" : "rf-opacity-0"
|
|
1531
|
-
)
|
|
1532
|
-
}
|
|
1533
|
-
)
|
|
1534
|
-
]
|
|
1535
|
-
},
|
|
1536
|
-
path
|
|
1537
|
-
))
|
|
1538
|
-
}
|
|
1539
|
-
),
|
|
1540
|
-
currentFiles.length > 0 && /* @__PURE__ */ jsx6(
|
|
1541
|
-
CommandGroup,
|
|
1542
|
-
{
|
|
1543
|
-
className: `rf-border-b rf-border-gray-200 rf-pb-1`,
|
|
1544
|
-
children: currentFiles.map((fileNode, index) => /* @__PURE__ */ jsxs5(
|
|
1545
|
-
CommandItem,
|
|
1546
|
-
{
|
|
1547
|
-
value: `current:${fileNode.path}`,
|
|
1548
|
-
onSelect: () => selectFile(fileNode.path, index),
|
|
1549
|
-
className: cn(
|
|
1550
|
-
fileNode.path === currentFile && "rf-font-medium",
|
|
1551
|
-
"rf-group"
|
|
1552
|
-
),
|
|
1553
|
-
children: [
|
|
1554
|
-
/* @__PURE__ */ jsx6("span", { className: "rf-mr-2", children: defaultFileIcon(fileNode.name) }),
|
|
1555
|
-
getDisplayName(fileNode.name),
|
|
1556
|
-
/* @__PURE__ */ jsxs5("div", { className: "rf-ml-auto rf-flex rf-items-center rf-gap-1", children: [
|
|
1557
|
-
onToggleFavorite && /* @__PURE__ */ jsx6(
|
|
1558
|
-
"button",
|
|
1559
|
-
{
|
|
1560
|
-
type: "button",
|
|
1561
|
-
onClick: (e) => {
|
|
1562
|
-
e.stopPropagation();
|
|
1563
|
-
onToggleFavorite(fileNode.path);
|
|
1564
|
-
},
|
|
1565
|
-
className: cn(
|
|
1566
|
-
"rf-p-1 rf-rounded hover:rf-bg-slate-200 rf-transition-opacity",
|
|
1567
|
-
pinnedFiles.includes(fileNode.path) ? "rf-opacity-100" : "rf-opacity-0 group-hover:rf-opacity-100"
|
|
1568
|
-
),
|
|
1569
|
-
"aria-label": pinnedFiles.includes(fileNode.path) ? "Remove from favorites" : "Add to favorites",
|
|
1570
|
-
title: pinnedFiles.includes(fileNode.path) ? "Remove from favorites" : "Add to favorites",
|
|
1571
|
-
children: /* @__PURE__ */ jsx6(
|
|
1572
|
-
Star,
|
|
1573
|
-
{
|
|
1574
|
-
className: cn(
|
|
1575
|
-
"rf-h-3 rf-w-3",
|
|
1576
|
-
pinnedFiles.includes(fileNode.path) ? "rf-text-amber-500 rf-fill-amber-500" : "rf-text-slate-400"
|
|
1577
|
-
)
|
|
1578
|
-
}
|
|
1579
|
-
)
|
|
1580
|
-
}
|
|
1581
|
-
),
|
|
1582
|
-
/* @__PURE__ */ jsx6(
|
|
1583
|
-
Check,
|
|
1584
|
-
{
|
|
1585
|
-
className: cn(
|
|
1586
|
-
"rf-h-4 rf-w-4",
|
|
1587
|
-
fileNode.path === currentFile ? "rf-opacity-100" : "rf-opacity-0"
|
|
1588
|
-
)
|
|
1589
|
-
}
|
|
1590
|
-
)
|
|
1591
|
-
] })
|
|
1592
|
-
]
|
|
1593
|
-
},
|
|
1594
|
-
fileNode.path
|
|
1595
|
-
))
|
|
1596
|
-
}
|
|
1597
|
-
),
|
|
1598
|
-
currentFolders.length > 0 && /* @__PURE__ */ jsx6(
|
|
1599
|
-
CommandGroup,
|
|
1565
|
+
}
|
|
1566
|
+
) })
|
|
1567
|
+
]
|
|
1568
|
+
},
|
|
1569
|
+
fileNode.path
|
|
1570
|
+
)) }),
|
|
1571
|
+
currentFolders.length > 0 && /* @__PURE__ */ jsx6(CommandGroup, { children: currentFolders.map((folderNode) => /* @__PURE__ */ jsxs5(
|
|
1572
|
+
CommandItem,
|
|
1600
1573
|
{
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
]
|
|
1613
|
-
},
|
|
1614
|
-
folderNode.path
|
|
1615
|
-
))
|
|
1616
|
-
}
|
|
1617
|
-
),
|
|
1574
|
+
value: `folder-${folderNode.path}`,
|
|
1575
|
+
onSelect: () => handleNavigateToFolder(folderNode.path),
|
|
1576
|
+
className: "rf-text-slate-600 hover:rf-text-slate-900",
|
|
1577
|
+
children: [
|
|
1578
|
+
/* @__PURE__ */ jsx6(Folder, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-text-blue-600" }),
|
|
1579
|
+
folderNode.name,
|
|
1580
|
+
/* @__PURE__ */ jsx6(ChevronRight, { className: "rf-ml-auto rf-h-4 rf-w-4" })
|
|
1581
|
+
]
|
|
1582
|
+
},
|
|
1583
|
+
folderNode.path
|
|
1584
|
+
)) }),
|
|
1618
1585
|
currentFiles.length === 0 && currentFolders.length === 0 && /* @__PURE__ */ jsx6("div", { className: "rf-p-4 rf-text-center rf-text-slate-500 rf-text-sm", children: "No files or folders in this directory" })
|
|
1619
1586
|
] }) : /* @__PURE__ */ jsx6(Fragment2, { children: searchResults.currentDirResults.length === 0 && searchResults.globalResults.length === 0 ? /* @__PURE__ */ jsxs5(CommandEmpty, { children: [
|
|
1620
1587
|
'No files found matching "',
|
|
1621
1588
|
searchValue,
|
|
1622
1589
|
'".'
|
|
1623
1590
|
] }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1624
|
-
searchResults.currentDirResults.length > 0 && /* @__PURE__ */ jsx6(CommandGroup, {
|
|
1591
|
+
searchResults.currentDirResults.length > 0 && /* @__PURE__ */ jsx6(CommandGroup, { children: searchResults.currentDirResults.map(
|
|
1625
1592
|
(file2, index) => /* @__PURE__ */ jsxs5(
|
|
1626
1593
|
CommandItem,
|
|
1627
1594
|
{
|
|
@@ -1640,31 +1607,6 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1640
1607
|
/* @__PURE__ */ jsxs5("div", { className: "rf-flex rf-items-center rf-w-full rf-min-w-0", children: [
|
|
1641
1608
|
/* @__PURE__ */ jsx6("span", { className: "rf-truncate rf-flex-1", children: getDisplayName(file2.fileName) }),
|
|
1642
1609
|
/* @__PURE__ */ jsx6("span", { className: "rf-text-xs rf-text-muted-foreground rf-ml-2 rf-truncate rf-max-w-[40%]", children: currentFolder || "/" }),
|
|
1643
|
-
onToggleFavorite && /* @__PURE__ */ jsx6(
|
|
1644
|
-
"button",
|
|
1645
|
-
{
|
|
1646
|
-
type: "button",
|
|
1647
|
-
onClick: (e) => {
|
|
1648
|
-
e.stopPropagation();
|
|
1649
|
-
onToggleFavorite(file2.path);
|
|
1650
|
-
},
|
|
1651
|
-
className: cn(
|
|
1652
|
-
"rf-p-1 rf-rounded hover:rf-bg-slate-200 rf-transition-opacity rf-ml-2",
|
|
1653
|
-
pinnedFiles.includes(file2.path) ? "rf-opacity-100" : "rf-opacity-0 group-hover:rf-opacity-100"
|
|
1654
|
-
),
|
|
1655
|
-
"aria-label": pinnedFiles.includes(file2.path) ? "Remove from favorites" : "Add to favorites",
|
|
1656
|
-
title: pinnedFiles.includes(file2.path) ? "Remove from favorites" : "Add to favorites",
|
|
1657
|
-
children: /* @__PURE__ */ jsx6(
|
|
1658
|
-
Star,
|
|
1659
|
-
{
|
|
1660
|
-
className: cn(
|
|
1661
|
-
"rf-h-3 rf-w-3",
|
|
1662
|
-
pinnedFiles.includes(file2.path) ? "rf-text-amber-500 rf-fill-amber-500" : "rf-text-slate-400"
|
|
1663
|
-
)
|
|
1664
|
-
}
|
|
1665
|
-
)
|
|
1666
|
-
}
|
|
1667
|
-
),
|
|
1668
1610
|
file2.path === currentFile && /* @__PURE__ */ jsx6(Check, { className: "rf-ml-2 rf-h-4 rf-w-4 rf-flex-shrink-0" })
|
|
1669
1611
|
] })
|
|
1670
1612
|
]
|
|
@@ -1672,7 +1614,7 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1672
1614
|
file2.path
|
|
1673
1615
|
)
|
|
1674
1616
|
) }),
|
|
1675
|
-
searchResults.globalResults.length > 0 && /* @__PURE__ */ jsx6(CommandGroup, {
|
|
1617
|
+
searchResults.globalResults.length > 0 && /* @__PURE__ */ jsx6(CommandGroup, { children: searchResults.globalResults.map((file2) => /* @__PURE__ */ jsxs5(
|
|
1676
1618
|
CommandItem,
|
|
1677
1619
|
{
|
|
1678
1620
|
value: `search-global:${file2.path}`,
|
|
@@ -1690,29 +1632,6 @@ var EnhancedFileSelectorCombobox = ({
|
|
|
1690
1632
|
/* @__PURE__ */ jsxs5("div", { className: "rf-flex rf-items-center rf-w-full rf-min-w-0", children: [
|
|
1691
1633
|
/* @__PURE__ */ jsx6("span", { className: "rf-truncate rf-flex-1", children: getDisplayName(file2.fileName) }),
|
|
1692
1634
|
/* @__PURE__ */ jsx6("span", { className: "rf-text-xs rf-text-muted-foreground rf-ml-2 rf-truncate rf-max-w-[40%]", children: getDirectoryPath2(file2.path) }),
|
|
1693
|
-
onToggleFavorite && /* @__PURE__ */ jsx6(
|
|
1694
|
-
"button",
|
|
1695
|
-
{
|
|
1696
|
-
onClick: (e) => {
|
|
1697
|
-
e.stopPropagation();
|
|
1698
|
-
onToggleFavorite(file2.path);
|
|
1699
|
-
},
|
|
1700
|
-
className: cn(
|
|
1701
|
-
"rf-p-1 rf-rounded hover:rf-bg-slate-200 rf-transition-opacity rf-ml-2",
|
|
1702
|
-
pinnedFiles.includes(file2.path) ? "rf-opacity-100" : "rf-opacity-0 group-hover:rf-opacity-100"
|
|
1703
|
-
),
|
|
1704
|
-
title: pinnedFiles.includes(file2.path) ? "Remove from favorites" : "Add to favorites",
|
|
1705
|
-
children: /* @__PURE__ */ jsx6(
|
|
1706
|
-
Star,
|
|
1707
|
-
{
|
|
1708
|
-
className: cn(
|
|
1709
|
-
"rf-h-3 rf-w-3",
|
|
1710
|
-
pinnedFiles.includes(file2.path) ? "rf-text-amber-500 rf-fill-amber-500" : "rf-text-slate-400"
|
|
1711
|
-
)
|
|
1712
|
-
}
|
|
1713
|
-
)
|
|
1714
|
-
}
|
|
1715
|
-
),
|
|
1716
1635
|
file2.path === currentFile && /* @__PURE__ */ jsx6(Check, { className: "rf-ml-2 rf-h-4 rf-w-4 rf-flex-shrink-0" })
|
|
1717
1636
|
] })
|
|
1718
1637
|
]
|
|
@@ -1788,12 +1707,12 @@ var RunFrameWithApi = (props) => {
|
|
|
1788
1707
|
const hasReceivedInitialFiles = useHasReceivedInitialFilesLoaded();
|
|
1789
1708
|
const fsMap = useRunFrameStore((s) => s.fsMap);
|
|
1790
1709
|
const recentlySavedFiles = useRunFrameStore((s) => s.recentlySavedFiles);
|
|
1791
|
-
const allFiles =
|
|
1792
|
-
const projectConfigContent =
|
|
1710
|
+
const allFiles = useMemo4(() => Array.from(fsMap.keys()), [fsMap]);
|
|
1711
|
+
const projectConfigContent = useMemo4(() => {
|
|
1793
1712
|
const rawConfig = fsMap.get("tscircuit.config.json");
|
|
1794
1713
|
return typeof rawConfig === "string" ? rawConfig : void 0;
|
|
1795
1714
|
}, [fsMap]);
|
|
1796
|
-
const boardFiles =
|
|
1715
|
+
const boardFiles = useMemo4(
|
|
1797
1716
|
() => getBoardFilesFromConfig(allFiles, projectConfigContent),
|
|
1798
1717
|
[allFiles, projectConfigContent]
|
|
1799
1718
|
);
|
|
@@ -1818,7 +1737,7 @@ var RunFrameWithApi = (props) => {
|
|
|
1818
1737
|
[setFavorites]
|
|
1819
1738
|
);
|
|
1820
1739
|
const activeFileFilter = props.fileFilter ?? DEFAULT_UI_FILE_FILTER;
|
|
1821
|
-
const visibleBoardFiles =
|
|
1740
|
+
const visibleBoardFiles = useMemo4(
|
|
1822
1741
|
() => boardFiles.filter(activeFileFilter),
|
|
1823
1742
|
[boardFiles, activeFileFilter]
|
|
1824
1743
|
);
|
|
@@ -1889,7 +1808,7 @@ var RunFrameWithApi = (props) => {
|
|
|
1889
1808
|
startPolling();
|
|
1890
1809
|
return () => stopPolling();
|
|
1891
1810
|
}, [startPolling, stopPolling]);
|
|
1892
|
-
const componentProp =
|
|
1811
|
+
const componentProp = useMemo4(
|
|
1893
1812
|
() => String(componentPath).length > 0 ? {
|
|
1894
1813
|
mainComponentPath: componentPath
|
|
1895
1814
|
} : {},
|