@tscircuit/runframe 0.0.276 → 0.0.278
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-TPHHXIJB.js → chunk-RN4VAWJG.js} +2 -4
- package/dist/preview.d.ts +1 -2
- package/dist/preview.js +1 -1
- package/dist/runner.d.ts +2 -1
- package/dist/runner.js +51 -35
- package/dist/standalone-preview.min.js +254 -254
- package/dist/standalone.min.js +507 -507
- package/package.json +2 -2
|
@@ -988,7 +988,7 @@ var RenderLogViewer = ({
|
|
|
988
988
|
};
|
|
989
989
|
|
|
990
990
|
// package.json
|
|
991
|
-
var version = "0.0.
|
|
991
|
+
var version = "0.0.276";
|
|
992
992
|
|
|
993
993
|
// lib/components/CircuitJsonPreview/CircuitJsonPreview.tsx
|
|
994
994
|
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
@@ -1003,7 +1003,6 @@ var CircuitJsonPreview = ({
|
|
|
1003
1003
|
code,
|
|
1004
1004
|
onRunClicked = void 0,
|
|
1005
1005
|
errorMessage,
|
|
1006
|
-
circuitJsonKey = "",
|
|
1007
1006
|
circuitJson,
|
|
1008
1007
|
autoroutingGraphics,
|
|
1009
1008
|
showRightHeaderContent = true,
|
|
@@ -1208,8 +1207,7 @@ var CircuitJsonPreview = ({
|
|
|
1208
1207
|
editEvents2.forEach((e) => onEditEvent(e));
|
|
1209
1208
|
}
|
|
1210
1209
|
}
|
|
1211
|
-
}
|
|
1212
|
-
circuitJsonKey
|
|
1210
|
+
}
|
|
1213
1211
|
) : /* @__PURE__ */ jsx16(PreviewEmptyState_default, { onRunClicked })
|
|
1214
1212
|
}
|
|
1215
1213
|
)
|
package/dist/preview.d.ts
CHANGED
|
@@ -28,7 +28,6 @@ interface PreviewContentProps {
|
|
|
28
28
|
errorMessage?: string | null;
|
|
29
29
|
autoroutingGraphics?: any;
|
|
30
30
|
circuitJson: any;
|
|
31
|
-
circuitJsonKey?: string;
|
|
32
31
|
className?: string;
|
|
33
32
|
showCodeTab?: boolean;
|
|
34
33
|
showRenderLogTab?: boolean;
|
|
@@ -68,6 +67,6 @@ interface PreviewContentProps {
|
|
|
68
67
|
}) => void;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
declare const CircuitJsonPreview: ({ code, onRunClicked, errorMessage,
|
|
70
|
+
declare const CircuitJsonPreview: ({ code, onRunClicked, errorMessage, circuitJson, autoroutingGraphics, showRightHeaderContent, showCodeTab, codeTabContent, showJsonTab, showRenderLogTab, onActiveTabChange, renderLog, showImportAndFormatButtons, className, headerClassName, leftHeaderContent, readOnly, isStreaming, autoroutingLog, onReportAutoroutingLog, isRunningCode, hasCodeChangedSinceLastRun, onEditEvent, editEvents, defaultActiveTab, autoRotate3dViewerDisabled, showSchematicDebugGrid, showToggleFullScreen, defaultToFullScreen, }: PreviewContentProps) => react_jsx_runtime.JSX.Element;
|
|
72
71
|
|
|
73
72
|
export { CircuitJsonPreview, type PreviewContentProps, type TabId };
|
package/dist/preview.js
CHANGED
package/dist/runner.d.ts
CHANGED
|
@@ -85,6 +85,7 @@ declare global {
|
|
|
85
85
|
declare const RunFrame: (props: RunFrameProps) => react_jsx_runtime.JSX.Element;
|
|
86
86
|
|
|
87
87
|
declare const guessEntrypoint: (files: string[]) => string | undefined;
|
|
88
|
+
declare const guessManualEditsFilePath: (files: string[]) => string | undefined;
|
|
88
89
|
interface RunFrameWithApiProps {
|
|
89
90
|
/**
|
|
90
91
|
* Base URL for the API endpoints
|
|
@@ -103,4 +104,4 @@ declare const RunFrameForCli: (props: {
|
|
|
103
104
|
debug?: boolean;
|
|
104
105
|
}) => react_jsx_runtime.JSX.Element;
|
|
105
106
|
|
|
106
|
-
export { RunFrame, RunFrameForCli, type RunFrameProps, RunFrameWithApi, type RunFrameWithApiProps, TabId, guessEntrypoint };
|
|
107
|
+
export { RunFrame, RunFrameForCli, type RunFrameProps, RunFrameWithApi, type RunFrameWithApiProps, TabId, guessEntrypoint, guessManualEditsFilePath };
|
package/dist/runner.js
CHANGED
|
@@ -14,11 +14,11 @@ import {
|
|
|
14
14
|
TabsTrigger,
|
|
15
15
|
buttonVariants,
|
|
16
16
|
cn
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-RN4VAWJG.js";
|
|
18
18
|
|
|
19
19
|
// lib/components/RunFrame/RunFrame.tsx
|
|
20
20
|
import { createCircuitWebWorker } from "@tscircuit/eval/worker";
|
|
21
|
-
import { useEffect,
|
|
21
|
+
import { useEffect, useReducer, useRef as useRef2, useState } from "react";
|
|
22
22
|
import Debug2 from "debug";
|
|
23
23
|
import { Loader2, Play, Square } from "lucide-react";
|
|
24
24
|
|
|
@@ -493,9 +493,6 @@ var RunFrame = (props) => {
|
|
|
493
493
|
};
|
|
494
494
|
runMutex.runWithMutex(runWorker);
|
|
495
495
|
}, [props.fsMap, props.entrypoint, runCountTrigger, props.evalVersion]);
|
|
496
|
-
const circuitJsonKey = useMemo(() => {
|
|
497
|
-
return `cj-${Math.random().toString(36).substring(2, 15)}`;
|
|
498
|
-
}, [circuitJson]);
|
|
499
496
|
const lastEditEventRef = useRef2(null);
|
|
500
497
|
const dragTimeout = useRef2(null);
|
|
501
498
|
const handleEditEvent = (event) => {
|
|
@@ -571,7 +568,6 @@ var RunFrame = (props) => {
|
|
|
571
568
|
] }),
|
|
572
569
|
onActiveTabChange: setActiveTab,
|
|
573
570
|
circuitJson,
|
|
574
|
-
circuitJsonKey,
|
|
575
571
|
renderLog,
|
|
576
572
|
isRunningCode: isRunning,
|
|
577
573
|
errorMessage: error?.error,
|
|
@@ -644,9 +640,11 @@ var useEditEventController = () => {
|
|
|
644
640
|
|
|
645
641
|
// lib/components/RunFrameWithApi/RunFrameWithApi.tsx
|
|
646
642
|
import Debug3 from "debug";
|
|
643
|
+
import { applyPcbEditEventsToManualEditsFile } from "@tscircuit/core";
|
|
647
644
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
648
645
|
var debug5 = Debug3("run-frame:RunFrameWithApi");
|
|
649
646
|
var guessEntrypoint = (files) => files.find((file) => file.includes("entrypoint.")) ?? files.find((file) => file.includes("index.")) ?? files.find((file) => file.includes("main.")) ?? files.find((file) => file.endsWith(".tsx"));
|
|
647
|
+
var guessManualEditsFilePath = (files) => files.find((file) => file.includes("manual-edits.")) ?? files.find((file) => file.includes("manual-edit.")) ?? files.find((file) => file.endsWith(".json"));
|
|
650
648
|
var RunFrameWithApi = (props) => {
|
|
651
649
|
const { apiBaseUrl, leftHeaderContent } = props;
|
|
652
650
|
useEffect3(() => {
|
|
@@ -660,6 +658,7 @@ var RunFrameWithApi = (props) => {
|
|
|
660
658
|
})
|
|
661
659
|
);
|
|
662
660
|
const fsMap = useRunFrameStore((s) => s.fsMap);
|
|
661
|
+
const circuitJson = useRunFrameStore((s) => s.circuitJson);
|
|
663
662
|
useEffect3(() => {
|
|
664
663
|
loadInitialFiles();
|
|
665
664
|
}, []);
|
|
@@ -720,15 +719,31 @@ var RunFrameWithApi = (props) => {
|
|
|
720
719
|
...ee
|
|
721
720
|
})
|
|
722
721
|
});
|
|
722
|
+
const manualEditsFilePath = guessManualEditsFilePath(Array.from(fsMap.keys())) ?? "manual-edits.json";
|
|
723
|
+
const manualEditsFile = fsMap.get(manualEditsFilePath);
|
|
724
|
+
const updatedManualEdits = applyPcbEditEventsToManualEditsFile({
|
|
725
|
+
circuitJson,
|
|
726
|
+
editEvents: [ee],
|
|
727
|
+
manualEditsFile: JSON.parse(manualEditsFile ?? "{}")
|
|
728
|
+
});
|
|
729
|
+
fetch(`${API_BASE}/files/upsert`, {
|
|
730
|
+
method: "POST",
|
|
731
|
+
headers: { "Content-Type": "application/json" },
|
|
732
|
+
body: JSON.stringify({
|
|
733
|
+
file_path: manualEditsFilePath,
|
|
734
|
+
text_content: JSON.stringify(updatedManualEdits),
|
|
735
|
+
initiator: "runframe"
|
|
736
|
+
})
|
|
737
|
+
});
|
|
723
738
|
}
|
|
724
739
|
}
|
|
725
740
|
);
|
|
726
741
|
};
|
|
727
742
|
|
|
728
743
|
// lib/hooks/use-local-storage-state.ts
|
|
729
|
-
import { useState as
|
|
744
|
+
import { useState as useState3, useEffect as useEffect4 } from "react";
|
|
730
745
|
function useLocalStorageState(key, initialValue) {
|
|
731
|
-
const [state, setState] =
|
|
746
|
+
const [state, setState] = useState3(() => {
|
|
732
747
|
try {
|
|
733
748
|
const item = window.localStorage.getItem(key);
|
|
734
749
|
return item ? JSON.parse(item) : initialValue;
|
|
@@ -748,10 +763,10 @@ function useLocalStorageState(key, initialValue) {
|
|
|
748
763
|
}
|
|
749
764
|
|
|
750
765
|
// lib/components/RunFrameForCli/LeftHeader.tsx
|
|
751
|
-
import { useEffect as useEffect7, useMemo as
|
|
766
|
+
import { useEffect as useEffect7, useMemo as useMemo3, useState as useState6 } from "react";
|
|
752
767
|
|
|
753
768
|
// lib/components/RunFrameForCli/SelectSnippetDialog.tsx
|
|
754
|
-
import { useState as
|
|
769
|
+
import { useState as useState4 } from "react";
|
|
755
770
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
756
771
|
var SelectSnippetDialog = ({
|
|
757
772
|
snippetNames,
|
|
@@ -759,8 +774,8 @@ var SelectSnippetDialog = ({
|
|
|
759
774
|
onCancel,
|
|
760
775
|
isOpen
|
|
761
776
|
}) => {
|
|
762
|
-
const [selectedName, setSelectedName] =
|
|
763
|
-
const [searchInput, setSearchInput] =
|
|
777
|
+
const [selectedName, setSelectedName] = useState4("");
|
|
778
|
+
const [searchInput, setSearchInput] = useState4("");
|
|
764
779
|
if (!isOpen) return null;
|
|
765
780
|
const filteredSnippets = snippetNames.filter(
|
|
766
781
|
(name) => name.toLowerCase().includes(searchInput.toLowerCase())
|
|
@@ -989,7 +1004,7 @@ Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
|
989
1004
|
|
|
990
1005
|
// lib/components/ImportComponentDialog/ImportComponentDialog.tsx
|
|
991
1006
|
import "react";
|
|
992
|
-
import { useState as
|
|
1007
|
+
import { useState as useState5, useEffect as useEffect6 } from "react";
|
|
993
1008
|
import { Loader2 as Loader22, Search, ExternalLink } from "lucide-react";
|
|
994
1009
|
|
|
995
1010
|
// lib/components/ui/input.tsx
|
|
@@ -1085,18 +1100,18 @@ var ImportComponentDialog = ({
|
|
|
1085
1100
|
onClose,
|
|
1086
1101
|
onImport
|
|
1087
1102
|
}) => {
|
|
1088
|
-
const [searchQuery, setSearchQuery] =
|
|
1089
|
-
const [searchResults, setSearchResults] =
|
|
1103
|
+
const [searchQuery, setSearchQuery] = useState5("");
|
|
1104
|
+
const [searchResults, setSearchResults] = useState5(
|
|
1090
1105
|
[]
|
|
1091
1106
|
);
|
|
1092
|
-
const [hasSearched, setHasSearched] =
|
|
1093
|
-
const [isLoading, setIsLoading] =
|
|
1094
|
-
const [selectedComponent, setSelectedComponent] =
|
|
1095
|
-
const [activeTab, setActiveTab] =
|
|
1107
|
+
const [hasSearched, setHasSearched] = useState5(false);
|
|
1108
|
+
const [isLoading, setIsLoading] = useState5(false);
|
|
1109
|
+
const [selectedComponent, setSelectedComponent] = useState5(null);
|
|
1110
|
+
const [activeTab, setActiveTab] = useState5(
|
|
1096
1111
|
"tscircuit"
|
|
1097
1112
|
);
|
|
1098
|
-
const [detailsOpen, setDetailsOpen] =
|
|
1099
|
-
const [detailsComponent, setDetailsComponent] =
|
|
1113
|
+
const [detailsOpen, setDetailsOpen] = useState5(false);
|
|
1114
|
+
const [detailsComponent, setDetailsComponent] = useState5(null);
|
|
1100
1115
|
const handleSearch = async () => {
|
|
1101
1116
|
if (!searchQuery.trim()) return;
|
|
1102
1117
|
setIsLoading(true);
|
|
@@ -1328,26 +1343,26 @@ var availableExports = [
|
|
|
1328
1343
|
];
|
|
1329
1344
|
var RunframeCliLeftHeader = (props) => {
|
|
1330
1345
|
const lastRunEvalVersion = useRunnerStore((s) => s.lastRunEvalVersion);
|
|
1331
|
-
const [snippetName, setSnippetName] =
|
|
1332
|
-
const [hasUnsavedChanges, setHasUnsavedChanges] =
|
|
1333
|
-
const [hasNeverBeenSaved, setHasNeverBeenSaved] =
|
|
1334
|
-
const [isSaving, setIsSaving] =
|
|
1335
|
-
const [requestToSaveSentAt, setRequestToSaveSentAt] =
|
|
1346
|
+
const [snippetName, setSnippetName] = useState6(null);
|
|
1347
|
+
const [hasUnsavedChanges, setHasUnsavedChanges] = useState6(false);
|
|
1348
|
+
const [hasNeverBeenSaved, setHasNeverBeenSaved] = useState6(true);
|
|
1349
|
+
const [isSaving, setIsSaving] = useState6(false);
|
|
1350
|
+
const [requestToSaveSentAt, setRequestToSaveSentAt] = useState6(
|
|
1336
1351
|
null
|
|
1337
1352
|
);
|
|
1338
|
-
const [availableSnippets, setAvailableSnippets] =
|
|
1353
|
+
const [availableSnippets, setAvailableSnippets] = useState6(
|
|
1339
1354
|
null
|
|
1340
1355
|
);
|
|
1341
|
-
const [isSelectSnippetDialogOpen, setIsSelectSnippetDialogOpen] =
|
|
1342
|
-
const [notificationMessage, setNotificationMessage] =
|
|
1356
|
+
const [isSelectSnippetDialogOpen, setIsSelectSnippetDialogOpen] = useState6(false);
|
|
1357
|
+
const [notificationMessage, setNotificationMessage] = useState6(
|
|
1343
1358
|
null
|
|
1344
1359
|
);
|
|
1345
|
-
const [errorMessage, setErrorMessage] =
|
|
1346
|
-
const [isError, setIsError] =
|
|
1347
|
-
const [isExporting, setisExporting] =
|
|
1360
|
+
const [errorMessage, setErrorMessage] = useState6(null);
|
|
1361
|
+
const [isError, setIsError] = useState6(false);
|
|
1362
|
+
const [isExporting, setisExporting] = useState6(false);
|
|
1348
1363
|
const pushEvent = useRunFrameStore((state) => state.pushEvent);
|
|
1349
1364
|
const recentEvents = useRunFrameStore((state) => state.recentEvents);
|
|
1350
|
-
const firstRenderTime =
|
|
1365
|
+
const firstRenderTime = useMemo3(() => Date.now(), []);
|
|
1351
1366
|
useEventHandler((event) => {
|
|
1352
1367
|
if (new Date(event.created_at).valueOf() < firstRenderTime + 500) return;
|
|
1353
1368
|
if (event.event_type === "FILE_UPDATED") {
|
|
@@ -1413,7 +1428,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
1413
1428
|
snippet_name: snippetName
|
|
1414
1429
|
});
|
|
1415
1430
|
};
|
|
1416
|
-
const [isImportDialogOpen, setIsImportDialogOpen] =
|
|
1431
|
+
const [isImportDialogOpen, setIsImportDialogOpen] = useState6(false);
|
|
1417
1432
|
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1418
1433
|
/* @__PURE__ */ jsxs6(DropdownMenu, { children: [
|
|
1419
1434
|
/* @__PURE__ */ jsx8(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx8("div", { className: "rf-whitespace-nowrap rf-text-xs font-medium rf-p-2 rf-mx-1 rf-cursor-pointer rf-relative", children: "File" }) }),
|
|
@@ -1604,5 +1619,6 @@ export {
|
|
|
1604
1619
|
RunFrame,
|
|
1605
1620
|
RunFrameForCli,
|
|
1606
1621
|
RunFrameWithApi,
|
|
1607
|
-
guessEntrypoint
|
|
1622
|
+
guessEntrypoint,
|
|
1623
|
+
guessManualEditsFilePath
|
|
1608
1624
|
};
|