@tscircuit/runframe 0.0.2350 → 0.0.2352

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.
@@ -2181,7 +2181,7 @@ var usePostHogActivity = (properties) => {
2181
2181
  };
2182
2182
 
2183
2183
  // package.json
2184
- var version = "0.0.2349";
2184
+ var version = "0.0.2351";
2185
2185
  var package_default = {
2186
2186
  name: "@tscircuit/runframe",
2187
2187
  main: "dist/preview.js",
@@ -2237,7 +2237,7 @@ var package_default = {
2237
2237
  "@tscircuit/file-server": "^0.0.32",
2238
2238
  "@tscircuit/internal-dynamic-import": "^0.0.8",
2239
2239
  "@tscircuit/pcb-viewer": "1.11.376",
2240
- "@tscircuit/schematic-viewer": "^2.0.75",
2240
+ "@tscircuit/schematic-viewer": "^2.0.76",
2241
2241
  "@types/bun": "latest",
2242
2242
  "@types/debug": "^4.1.12",
2243
2243
  "@types/react": "^19.1.10",
package/dist/preview.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  SchematicViewer,
8
8
  useOrderDialog,
9
9
  useOrderDialogCli
10
- } from "./chunk-XOHF4YKS.js";
10
+ } from "./chunk-6DCKAWL6.js";
11
11
  export {
12
12
  BomTable,
13
13
  CadViewer,
package/dist/runner.js CHANGED
@@ -39,7 +39,7 @@ import {
39
39
  useRunFrameStore,
40
40
  useRunnerStore,
41
41
  useStyles
42
- } from "./chunk-XOHF4YKS.js";
42
+ } from "./chunk-6DCKAWL6.js";
43
43
 
44
44
  // lib/components/RunFrame/RunFrame.tsx
45
45
  import { createCircuitWebWorker } from "@tscircuit/eval/worker";
@@ -54,7 +54,8 @@ import { AlertTriangle } from "lucide-react";
54
54
  import { jsx, jsxs } from "react/jsx-runtime";
55
55
  var RunFrameErrorFallback = ({
56
56
  error,
57
- resetErrorBoundary
57
+ resetErrorBoundary,
58
+ componentStack
58
59
  }) => {
59
60
  const resolvedError = error instanceof Error ? error : new Error(String(error));
60
61
  return /* @__PURE__ */ jsx("section", { className: "rf-h-full rf-w-full rf-grid rf-place-items-center", children: /* @__PURE__ */ jsx("div", { className: "rf-min-h-full rf-flex rf-items-center rf-justify-center rf-px-4", children: /* @__PURE__ */ jsxs("div", { className: "rf-max-w-lg rf-w-full rf-text-center", children: [
@@ -66,6 +67,10 @@ var RunFrameErrorFallback = ({
66
67
  resolvedError.stack && /* @__PURE__ */ jsxs("details", { className: "rf-text-center rf-mb-6", children: [
67
68
  /* @__PURE__ */ jsx("summary", { className: "rf-text-xs rf-text-gray-500 rf-cursor-pointer hover:rf-text-gray-700", children: "View stack trace" }),
68
69
  /* @__PURE__ */ jsx("pre", { className: "rf-text-xs rf-font-mono no-scrollbar rf-whitespace-pre-wrap rf-text-gray-500 rf-bg-gray-100 rf-p-3 rf-rounded-lg rf-mt-2 rf-overflow-auto rf-text-left rf-max-h-[150px]", children: resolvedError.stack })
70
+ ] }),
71
+ componentStack && /* @__PURE__ */ jsxs("details", { className: "rf-text-center rf-mb-6", children: [
72
+ /* @__PURE__ */ jsx("summary", { className: "rf-text-xs rf-text-gray-500 rf-cursor-pointer hover:rf-text-gray-700", children: "View component stack" }),
73
+ /* @__PURE__ */ jsx("pre", { className: "rf-text-xs rf-font-mono no-scrollbar rf-whitespace-pre-wrap rf-text-gray-500 rf-bg-gray-100 rf-p-3 rf-rounded-lg rf-mt-2 rf-overflow-auto rf-text-left rf-max-h-[150px]", children: componentStack })
69
74
  ] })
70
75
  ] }),
71
76
  /* @__PURE__ */ jsxs("div", { className: "rf-flex rf-flex-col rf-gap-2 rf-justify-center", children: [
@@ -323,6 +328,7 @@ var RunFrame = (props) => {
323
328
  const circuitJson = useRunFrameStore((s) => s.circuitJson);
324
329
  const setCircuitJson = useRunFrameStore((s) => s.setCircuitJson);
325
330
  const [error, setError] = useState(null);
331
+ const [componentStack, setComponentStack] = useState(null);
326
332
  const cancelExecutionRef = useRef2(null);
327
333
  const [autoroutingGraphics, setAutoroutingGraphics] = useState(null);
328
334
  const [runCountTrigger, incRunCountTrigger] = useReducer(
@@ -740,122 +746,138 @@ var RunFrame = (props) => {
740
746
  if (props.isLoadingFiles) {
741
747
  return /* @__PURE__ */ jsx3(LoadingSkeleton, {});
742
748
  }
743
- return /* @__PURE__ */ jsx3(ErrorBoundary, { FallbackComponent: RunFrameErrorFallback, children: /* @__PURE__ */ jsx3(
744
- CircuitJsonPreview,
749
+ return /* @__PURE__ */ jsx3(
750
+ ErrorBoundary,
745
751
  {
746
- code: fsMap.get(props.entrypoint ?? props.mainComponentPath),
747
- fsMap,
748
- defaultActiveTab: props.defaultActiveTab ?? props.defaultTab,
749
- defaultTab: props.defaultTab,
750
- availableTabs: props.availableTabs,
751
- schematicSvgOptions: props.schematicSvgOptions,
752
- showToggleFullScreen: props.showToggleFullScreen,
753
- autoroutingGraphics,
754
- autoroutingLog,
755
- onReportAutoroutingLog: props.onReportAutoroutingLog || handleReportAutoroutingLog,
756
- leftHeaderContent: /* @__PURE__ */ jsxs3(Fragment, { children: [
757
- props.showRunButton && /* @__PURE__ */ jsx3(TooltipProvider, { children: /* @__PURE__ */ jsxs3(Tooltip, { children: [
758
- /* @__PURE__ */ jsx3(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3("div", { className: "rf-relative rf-inline-flex", children: [
759
- /* @__PURE__ */ jsxs3(
760
- "button",
761
- {
762
- type: "button",
763
- onClick: () => {
764
- incRunCountTrigger(1);
765
- },
766
- className: "rf-flex rf-items-center rf-gap-2 rf-px-4 rf-py-2 rf-bg-blue-600 hover:rf-bg-blue-700 rf-text-white rf-rounded-md disabled:rf-opacity-50 transition-colors duration-200",
767
- disabled: isRunning || !dependenciesLoaded,
768
- children: [
769
- "Run",
770
- " ",
771
- isRunning || !dependenciesLoaded ? /* @__PURE__ */ jsx3(Loader2, { className: "rf-w-3 rf-h-3 rf-animate-spin" }) : /* @__PURE__ */ jsx3(Play, { className: "rf-w-3 rf-h-3" })
772
- ]
773
- }
774
- ),
775
- isRunning && /* @__PURE__ */ jsx3("div", { className: "rf-flex rf-items-center rf-ml-1", children: /* @__PURE__ */ jsx3(
776
- Button,
777
- {
778
- onClick: (e) => {
779
- e.stopPropagation();
780
- setIsRunning(false);
781
- setRenderLog(null);
782
- setError(null);
783
- if (cancelExecutionRef.current) {
784
- cancelExecutionRef.current();
785
- cancelExecutionRef.current = null;
786
- }
787
- runMutex.cancel();
788
- setActiveAsyncEffects({});
789
- if (globalThis.runFrameWorker) {
790
- globalThis.runFrameWorker.kill();
791
- globalThis.runFrameWorker = null;
752
+ onError: (_error, info) => {
753
+ setComponentStack(info.componentStack ?? null);
754
+ },
755
+ onReset: () => setComponentStack(null),
756
+ fallbackRender: (fallbackProps) => /* @__PURE__ */ jsx3(
757
+ RunFrameErrorFallback,
758
+ {
759
+ ...fallbackProps,
760
+ componentStack
761
+ }
762
+ ),
763
+ children: /* @__PURE__ */ jsx3(
764
+ CircuitJsonPreview,
765
+ {
766
+ code: fsMap.get(props.entrypoint ?? props.mainComponentPath),
767
+ fsMap,
768
+ defaultActiveTab: props.defaultActiveTab ?? props.defaultTab,
769
+ defaultTab: props.defaultTab,
770
+ availableTabs: props.availableTabs,
771
+ schematicSvgOptions: props.schematicSvgOptions,
772
+ showToggleFullScreen: props.showToggleFullScreen,
773
+ autoroutingGraphics,
774
+ autoroutingLog,
775
+ onReportAutoroutingLog: props.onReportAutoroutingLog || handleReportAutoroutingLog,
776
+ leftHeaderContent: /* @__PURE__ */ jsxs3(Fragment, { children: [
777
+ props.showRunButton && /* @__PURE__ */ jsx3(TooltipProvider, { children: /* @__PURE__ */ jsxs3(Tooltip, { children: [
778
+ /* @__PURE__ */ jsx3(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3("div", { className: "rf-relative rf-inline-flex", children: [
779
+ /* @__PURE__ */ jsxs3(
780
+ "button",
781
+ {
782
+ type: "button",
783
+ onClick: () => {
784
+ incRunCountTrigger(1);
785
+ },
786
+ className: "rf-flex rf-items-center rf-gap-2 rf-px-4 rf-py-2 rf-bg-blue-600 hover:rf-bg-blue-700 rf-text-white rf-rounded-md disabled:rf-opacity-50 transition-colors duration-200",
787
+ disabled: isRunning || !dependenciesLoaded,
788
+ children: [
789
+ "Run",
790
+ " ",
791
+ isRunning || !dependenciesLoaded ? /* @__PURE__ */ jsx3(Loader2, { className: "rf-w-3 rf-h-3 rf-animate-spin" }) : /* @__PURE__ */ jsx3(Play, { className: "rf-w-3 rf-h-3" })
792
+ ]
792
793
  }
793
- },
794
- variant: "ghost",
795
- size: "icon",
796
- className: "rf-text-red-300 hover:rf-text-red-400 hover:!rf-bg-transparent [&>svg]:rf-text-red-300 [&>svg]:hover:rf-text-red-400 rf-flex rf-items-center rf-justify-center",
797
- children: /* @__PURE__ */ jsx3(
798
- Square,
794
+ ),
795
+ isRunning && /* @__PURE__ */ jsx3("div", { className: "rf-flex rf-items-center rf-ml-1", children: /* @__PURE__ */ jsx3(
796
+ Button,
799
797
  {
800
- className: "!rf-h-2.5 !rf-w-2.5",
801
- fill: "currentColor",
802
- stroke: "currentColor"
798
+ onClick: (e) => {
799
+ e.stopPropagation();
800
+ setIsRunning(false);
801
+ setRenderLog(null);
802
+ setError(null);
803
+ if (cancelExecutionRef.current) {
804
+ cancelExecutionRef.current();
805
+ cancelExecutionRef.current = null;
806
+ }
807
+ runMutex.cancel();
808
+ setActiveAsyncEffects({});
809
+ if (globalThis.runFrameWorker) {
810
+ globalThis.runFrameWorker.kill();
811
+ globalThis.runFrameWorker = null;
812
+ }
813
+ },
814
+ variant: "ghost",
815
+ size: "icon",
816
+ className: "rf-text-red-300 hover:rf-text-red-400 hover:!rf-bg-transparent [&>svg]:rf-text-red-300 [&>svg]:hover:rf-text-red-400 rf-flex rf-items-center rf-justify-center",
817
+ children: /* @__PURE__ */ jsx3(
818
+ Square,
819
+ {
820
+ className: "!rf-h-2.5 !rf-w-2.5",
821
+ fill: "currentColor",
822
+ stroke: "currentColor"
823
+ }
824
+ )
803
825
  }
804
- )
826
+ ) })
827
+ ] }) }),
828
+ /* @__PURE__ */ jsx3(
829
+ TooltipContent,
830
+ {
831
+ sideOffset: 8,
832
+ className: "rf-p-0 rf-bg-transparent rf-border-none rf-shadow-none rf-pointer-events-none",
833
+ children: /* @__PURE__ */ jsxs3("div", { className: "rf-flex rf-items-center rf-gap-2 rf-px-2.5 rf-py-1.5 rf-bg-slate-900 rf-rounded-md rf-shadow-xl rf-border rf-border-slate-800/60", children: [
834
+ /* @__PURE__ */ jsx3("kbd", { className: "rf-bg-slate-800 rf-px-1.5 rf-py-0.5 rf-rounded rf-text-[10px] rf-font-sans rf-font-medium rf-border rf-border-slate-700 rf-text-slate-200 rf-leading-none", children: "Ctrl" }),
835
+ /* @__PURE__ */ jsx3("span", { className: "rf-text-slate-500 rf-text-[11px] rf-font-medium rf-leading-none", children: "+" }),
836
+ /* @__PURE__ */ jsx3("kbd", { className: "rf-bg-slate-800 rf-px-1.5 rf-py-0.5 rf-rounded rf-text-[10px] rf-font-sans rf-font-medium rf-border rf-border-slate-700 rf-text-slate-200 rf-leading-none", children: "Enter" })
837
+ ] })
838
+ }
839
+ )
840
+ ] }) }),
841
+ props.showFileMenu !== false && /* @__PURE__ */ jsx3(
842
+ FileMenuLeftHeader,
843
+ {
844
+ isWebEmbedded: props.isWebEmbedded,
845
+ onLoginRequired: props.onLoginRequired,
846
+ showSchematicDebugGrid,
847
+ onChangeShowSchematicDebugGrid: setShowSchematicDebugGrid,
848
+ showSchematicPorts,
849
+ onChangeShowSchematicPorts: setShowSchematicPorts,
850
+ autoroutingLog,
851
+ onReportAutoroutingLog: props.onReportAutoroutingLog || handleReportAutoroutingLog
805
852
  }
806
- ) })
807
- ] }) }),
808
- /* @__PURE__ */ jsx3(
809
- TooltipContent,
810
- {
811
- sideOffset: 8,
812
- className: "rf-p-0 rf-bg-transparent rf-border-none rf-shadow-none rf-pointer-events-none",
813
- children: /* @__PURE__ */ jsxs3("div", { className: "rf-flex rf-items-center rf-gap-2 rf-px-2.5 rf-py-1.5 rf-bg-slate-900 rf-rounded-md rf-shadow-xl rf-border rf-border-slate-800/60", children: [
814
- /* @__PURE__ */ jsx3("kbd", { className: "rf-bg-slate-800 rf-px-1.5 rf-py-0.5 rf-rounded rf-text-[10px] rf-font-sans rf-font-medium rf-border rf-border-slate-700 rf-text-slate-200 rf-leading-none", children: "Ctrl" }),
815
- /* @__PURE__ */ jsx3("span", { className: "rf-text-slate-500 rf-text-[11px] rf-font-medium rf-leading-none", children: "+" }),
816
- /* @__PURE__ */ jsx3("kbd", { className: "rf-bg-slate-800 rf-px-1.5 rf-py-0.5 rf-rounded rf-text-[10px] rf-font-sans rf-font-medium rf-border rf-border-slate-700 rf-text-slate-200 rf-leading-none", children: "Enter" })
817
- ] })
818
- }
819
- )
820
- ] }) }),
821
- props.showFileMenu !== false && /* @__PURE__ */ jsx3(
822
- FileMenuLeftHeader,
823
- {
824
- isWebEmbedded: props.isWebEmbedded,
825
- onLoginRequired: props.onLoginRequired,
826
- showSchematicDebugGrid,
827
- onChangeShowSchematicDebugGrid: setShowSchematicDebugGrid,
828
- showSchematicPorts,
829
- onChangeShowSchematicPorts: setShowSchematicPorts,
830
- autoroutingLog,
831
- onReportAutoroutingLog: props.onReportAutoroutingLog || handleReportAutoroutingLog
832
- }
833
- ),
834
- props.leftHeaderContent
835
- ] }),
836
- onActiveTabChange: setActiveTab,
837
- circuitJson,
838
- renderLog,
839
- activeEffectName,
840
- isRunningCode: isRunning,
841
- errorMessage: error?.error,
842
- errorStack: error?.stack,
843
- onEditEvent: handleEditEvent,
844
- editEvents: props.editEvents,
845
- onPcbBoundsSelected: props.onPcbBoundsSelected,
846
- defaultToFullScreen: props.defaultToFullScreen,
847
- onRerunWithDebug: (debugOption) => {
848
- setCurrentDebugOption(debugOption || "");
849
- incRunCountTrigger(1);
850
- },
851
- solverEvents,
852
- isCli: props.isCli,
853
- showSchematicDebugGrid,
854
- showSchematicPorts,
855
- onChangeShowSchematicDebugGrid: setShowSchematicDebugGrid,
856
- onChangeShowSchematicPorts: setShowSchematicPorts
853
+ ),
854
+ props.leftHeaderContent
855
+ ] }),
856
+ onActiveTabChange: setActiveTab,
857
+ circuitJson,
858
+ renderLog,
859
+ activeEffectName,
860
+ isRunningCode: isRunning,
861
+ errorMessage: error?.error,
862
+ errorStack: error?.stack,
863
+ onEditEvent: handleEditEvent,
864
+ editEvents: props.editEvents,
865
+ onPcbBoundsSelected: props.onPcbBoundsSelected,
866
+ defaultToFullScreen: props.defaultToFullScreen,
867
+ onRerunWithDebug: (debugOption) => {
868
+ setCurrentDebugOption(debugOption || "");
869
+ incRunCountTrigger(1);
870
+ },
871
+ solverEvents,
872
+ isCli: props.isCli,
873
+ showSchematicDebugGrid,
874
+ showSchematicPorts,
875
+ onChangeShowSchematicDebugGrid: setShowSchematicDebugGrid,
876
+ onChangeShowSchematicPorts: setShowSchematicPorts
877
+ }
878
+ )
857
879
  }
858
- ) });
880
+ );
859
881
  };
860
882
 
861
883
  // lib/components/RunFrameWithApi/RunFrameWithApi.tsx