@tscircuit/runframe 0.0.395 → 0.0.397

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.
@@ -415,7 +415,7 @@ var ErrorTabContent = ({
415
415
  ] })
416
416
  ] }),
417
417
  /* @__PURE__ */ jsx6("div", { className: "rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-max-h-[500px] rf-overflow-y-auto rf-px-2", children: /* @__PURE__ */ jsxs4("div", { className: "rf-p-4", children: [
418
- /* @__PURE__ */ jsx6("h3", { className: "rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-1", children: circuitJsonErrors[currentErrorIndex].error_type }),
418
+ /* @__PURE__ */ jsx6("h3", { className: "rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-1", children: circuitJsonErrors[currentErrorIndex].type }),
419
419
  /* @__PURE__ */ jsx6("p", { className: "rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600", children: circuitJsonErrors[currentErrorIndex].message })
420
420
  ] }) })
421
421
  ] })
@@ -436,7 +436,7 @@ var ErrorTabContent = ({
436
436
  onClick: () => {
437
437
  const activeError = circuitJsonErrors[currentErrorIndex];
438
438
  navigator.clipboard.writeText(
439
- `${activeError.error_type}: ${activeError.message}`
439
+ `${activeError.type}: ${activeError.message}`
440
440
  );
441
441
  alert("Error copied to clipboard!");
442
442
  },
@@ -453,16 +453,16 @@ var ErrorTabContent = ({
453
453
  className: "rf-p-1",
454
454
  onClick: () => {
455
455
  const error = circuitJsonErrors ? circuitJsonErrors[currentErrorIndex] : {
456
- error_type: "Execution Error",
456
+ type: "Execution Error",
457
457
  message: errorMessage ?? ""
458
458
  };
459
- const title = `Error: ${error.error_type}`.replace(/[^a-zA-Z0-9 ]/g, " ").replace(/\s+/g, " ").slice(0, 100);
459
+ const title = `Error: ${error.type}`.replace(/[^a-zA-Z0-9 ]/g, " ").replace(/\s+/g, " ").slice(0, 100);
460
460
  const url = createSnippetUrl(code ?? "");
461
461
  let body = `[Snippet code to reproduce](${url})
462
462
 
463
463
  ### Error
464
464
  \\
465
- ${error.error_type}: ${error.message}
465
+ ${error.type}: ${error.message}
466
466
  \\
467
467
  `;
468
468
  if (body.length > 4e3) {
@@ -472,7 +472,7 @@ ${error.error_type}: ${error.message}
472
472
 
473
473
  ### Error
474
474
  \`\`\`
475
- ${error.error_type}: ${error.message}
475
+ ${error.type}: ${error.message}
476
476
  \`\`\``;
477
477
  }
478
478
  window.open(
@@ -1092,7 +1092,7 @@ var RenderLogViewer = ({
1092
1092
  };
1093
1093
 
1094
1094
  // package.json
1095
- var version = "0.0.394";
1095
+ var version = "0.0.396";
1096
1096
 
1097
1097
  // lib/components/CircuitJsonPreview/CircuitJsonPreview.tsx
1098
1098
  import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
@@ -1103,10 +1103,6 @@ var dropdownMenuItems = [
1103
1103
  "errors",
1104
1104
  "render_log"
1105
1105
  ];
1106
- function getCircuitJsonErrors(circuitJson) {
1107
- if (!circuitJson) return null;
1108
- return circuitJson.filter((e) => e && "error_type" in e);
1109
- }
1110
1106
  var CircuitJsonPreview = ({
1111
1107
  code,
1112
1108
  onRunClicked = void 0,
@@ -1139,10 +1135,10 @@ var CircuitJsonPreview = ({
1139
1135
  defaultToFullScreen = false
1140
1136
  }) => {
1141
1137
  useStyles();
1142
- const circuitJsonErrors = useMemo(
1143
- () => getCircuitJsonErrors(circuitJson),
1144
- [circuitJson]
1145
- );
1138
+ const circuitJsonErrors = useMemo(() => {
1139
+ if (!circuitJson) return null;
1140
+ return circuitJson.filter((e) => e && "error_type" in e);
1141
+ }, [circuitJson]);
1146
1142
  const [activeTab, setActiveTabState] = useState5(
1147
1143
  defaultActiveTab ?? "pcb"
1148
1144
  );
package/dist/preview.d.ts CHANGED
@@ -74,34 +74,6 @@ interface PreviewContentProps {
74
74
  }) => void;
75
75
  }
76
76
 
77
- declare function getCircuitJsonErrors(circuitJson: CircuitJson | null): ({
78
- message: string;
79
- type: "pcb_missing_footprint_error";
80
- source_component_id: string;
81
- error_type: "pcb_missing_footprint_error";
82
- pcb_missing_footprint_error_id: string;
83
- subcircuit_id?: string | undefined;
84
- pcb_group_id?: string | undefined;
85
- } | {
86
- message: string;
87
- type: "pcb_trace_error";
88
- source_trace_id: string;
89
- error_type: "pcb_trace_error";
90
- pcb_trace_id: string;
91
- pcb_trace_error_id: string;
92
- pcb_component_ids: string[];
93
- pcb_port_ids: string[];
94
- center?: {
95
- x: number;
96
- y: number;
97
- } | undefined;
98
- } | {
99
- message: string;
100
- type: "schematic_error";
101
- schematic_error_id: string;
102
- error_type: "schematic_port_not_found";
103
- })[] | null;
104
- type CircuitJsonErrors = ReturnType<typeof getCircuitJsonErrors>;
105
77
  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;
106
78
 
107
79
  interface BomTableProps {
@@ -148,4 +120,4 @@ declare const useOrderDialog: () => {
148
120
  OrderDialog: react.FC<OrderDialogProps>;
149
121
  };
150
122
 
151
- export { BomTable, type CircuitJsonErrors, CircuitJsonPreview, PcbViewerWithContainerHeight, type PreviewContentProps, type TabId, linkify, useOrderDialog, useOrderDialogCli };
123
+ export { BomTable, CircuitJsonPreview, PcbViewerWithContainerHeight, type PreviewContentProps, type TabId, linkify, useOrderDialog, useOrderDialogCli };
package/dist/preview.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  linkify,
9
9
  useOrderDialog,
10
10
  useOrderDialogCli
11
- } from "./chunk-H24E2LS5.js";
11
+ } from "./chunk-TKPBP4BT.js";
12
12
  export {
13
13
  BomTable,
14
14
  CadViewer,
package/dist/runner.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TabId } from './preview.js';
2
- export { BomTable, CircuitJsonErrors, CircuitJsonPreview, PcbViewerWithContainerHeight, PreviewContentProps, linkify, useOrderDialog, useOrderDialogCli } from './preview.js';
2
+ export { BomTable, CircuitJsonPreview, PcbViewerWithContainerHeight, PreviewContentProps, linkify, useOrderDialog, useOrderDialogCli } from './preview.js';
3
3
  export { CadViewer } from '@tscircuit/3d-viewer';
4
4
  export { PCBViewer as PcbViewer } from '@tscircuit/pcb-viewer';
5
5
  export { SchematicViewer } from '@tscircuit/schematic-viewer';
@@ -18,6 +18,11 @@ interface RunFrameProps {
18
18
  * @tscircuit/eval will infer the entrypoint
19
19
  */
20
20
  entrypoint?: string;
21
+ /**
22
+ * The path to the main component that should be rendered. If not provided,
23
+ * the default component from the entry point will be used.
24
+ */
25
+ mainComponentPath?: string;
21
26
  /**
22
27
  * Whether to show a run button that controls when code executes
23
28
  */
package/dist/runner.js CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  useOrderDialog,
27
27
  useOrderDialogCli,
28
28
  useRunFrameStore
29
- } from "./chunk-H24E2LS5.js";
29
+ } from "./chunk-TKPBP4BT.js";
30
30
 
31
31
  // lib/components/RunFrame/RunFrame.tsx
32
32
  import { createCircuitWebWorker } from "@tscircuit/eval/worker";
@@ -269,7 +269,8 @@ var RunFrame = (props) => {
269
269
  });
270
270
  const evalResult = await worker.executeWithFsMap({
271
271
  entrypoint: props.entrypoint,
272
- fsMap: fsMapObj2
272
+ fsMap: fsMapObj2,
273
+ ...props.mainComponentPath ? { mainComponentPath: props.mainComponentPath } : {}
273
274
  }).then(() => {
274
275
  return { success: true };
275
276
  }).catch((e) => {