@tscircuit/runframe 0.0.700 → 0.0.702

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/README.md CHANGED
@@ -30,6 +30,8 @@ circuit.add(
30
30
  onRenderingFinished={({ circuitJson }) => void}
31
31
  onRenderEvent={(event) => void}
32
32
  onError={(error) => void}
33
+ availableTabs={["pcb", "schematic", "cad"]}
34
+ defaultTab="pcb"
33
35
  />
34
36
  )
35
37
  ```
@@ -1261,7 +1261,7 @@ var useErrorTelemetry = ({
1261
1261
  };
1262
1262
 
1263
1263
  // package.json
1264
- var version = "0.0.699";
1264
+ var version = "0.0.701";
1265
1265
 
1266
1266
  // lib/components/RunFrame/runner-store/use-runner-store.ts
1267
1267
  import { create } from "zustand";
@@ -1314,6 +1314,8 @@ var CircuitJsonPreview = ({
1314
1314
  onEditEvent,
1315
1315
  editEvents,
1316
1316
  defaultActiveTab,
1317
+ defaultTab,
1318
+ availableTabs,
1317
1319
  autoRotate3dViewerDisabled,
1318
1320
  showSchematicDebugGrid = false,
1319
1321
  showToggleFullScreen = true,
@@ -1340,7 +1342,7 @@ var CircuitJsonPreview = ({
1340
1342
  circuitJsonErrors
1341
1343
  });
1342
1344
  const [activeTab, setActiveTabState] = useState5(
1343
- defaultActiveTab ?? "pcb"
1345
+ defaultActiveTab ?? defaultTab ?? availableTabs?.[0] ?? "pcb"
1344
1346
  );
1345
1347
  const [lastActiveTab, setLastActiveTab] = useState5(null);
1346
1348
  const [isFullScreen, setIsFullScreen] = useState5(defaultToFullScreen);
@@ -1365,7 +1367,9 @@ var CircuitJsonPreview = ({
1365
1367
  }, [errorMessage]);
1366
1368
  useEffect4(() => {
1367
1369
  if ((activeTab === "code" || activeTab === "errors") && circuitJson && !errorMessage) {
1368
- setActiveTab(lastActiveTab ?? defaultActiveTab ?? "pcb");
1370
+ setActiveTab(
1371
+ lastActiveTab ?? defaultActiveTab ?? defaultTab ?? availableTabs?.[0] ?? "pcb"
1372
+ );
1369
1373
  }
1370
1374
  }, [circuitJson]);
1371
1375
  const setCadViewerRef = useCallback((value) => {
@@ -1414,7 +1418,7 @@ var CircuitJsonPreview = ({
1414
1418
  ] }),
1415
1419
  showRightHeaderContent && /* @__PURE__ */ jsxs12(TabsList, { children: [
1416
1420
  showCodeTab && /* @__PURE__ */ jsx16(TabsTrigger, { value: "code", children: "Code" }),
1417
- /* @__PURE__ */ jsxs12(TabsTrigger, { value: "pcb", className: "rf-whitespace-nowrap", children: [
1421
+ !availableTabs || availableTabs.includes("pcb") ? /* @__PURE__ */ jsxs12(TabsTrigger, { value: "pcb", className: "rf-whitespace-nowrap", children: [
1418
1422
  circuitJson && /* @__PURE__ */ jsx16(
1419
1423
  "span",
1420
1424
  {
@@ -1425,20 +1429,27 @@ var CircuitJsonPreview = ({
1425
1429
  }
1426
1430
  ),
1427
1431
  "PCB"
1428
- ] }),
1429
- /* @__PURE__ */ jsxs12(TabsTrigger, { value: "schematic", className: "rf-whitespace-nowrap", children: [
1430
- circuitJson && /* @__PURE__ */ jsx16(
1431
- "span",
1432
- {
1433
- className: cn(
1434
- "rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",
1435
- !hasCodeChangedSinceLastRun ? "rf-bg-blue-500" : "rf-bg-gray-500"
1436
- )
1437
- }
1438
- ),
1439
- "Schematic"
1440
- ] }),
1441
- /* @__PURE__ */ jsxs12(TabsTrigger, { value: "cad", children: [
1432
+ ] }) : null,
1433
+ !availableTabs || availableTabs.includes("schematic") ? /* @__PURE__ */ jsxs12(
1434
+ TabsTrigger,
1435
+ {
1436
+ value: "schematic",
1437
+ className: "rf-whitespace-nowrap",
1438
+ children: [
1439
+ circuitJson && /* @__PURE__ */ jsx16(
1440
+ "span",
1441
+ {
1442
+ className: cn(
1443
+ "rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",
1444
+ !hasCodeChangedSinceLastRun ? "rf-bg-blue-500" : "rf-bg-gray-500"
1445
+ )
1446
+ }
1447
+ ),
1448
+ "Schematic"
1449
+ ]
1450
+ }
1451
+ ) : null,
1452
+ !availableTabs || availableTabs.includes("cad") ? /* @__PURE__ */ jsxs12(TabsTrigger, { value: "cad", children: [
1442
1453
  circuitJson && /* @__PURE__ */ jsx16(
1443
1454
  "span",
1444
1455
  {
@@ -1449,7 +1460,7 @@ var CircuitJsonPreview = ({
1449
1460
  }
1450
1461
  ),
1451
1462
  "3D"
1452
- ] }),
1463
+ ] }) : null,
1453
1464
  !["pcb", "cad", "schematic"].includes(activeTab) && /* @__PURE__ */ jsx16(TabsTrigger, { value: activeTab, children: capitalizeFirstLetters(activeTab) }),
1454
1465
  /* @__PURE__ */ jsxs12(DropdownMenu, { children: [
1455
1466
  /* @__PURE__ */ jsx16(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12("div", { className: "rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative", children: [
@@ -1457,7 +1468,9 @@ var CircuitJsonPreview = ({
1457
1468
  (circuitJsonErrors && circuitJsonErrors.length > 0 || errorMessage) && /* @__PURE__ */ jsx16("span", { className: "rf-inline-flex rf-absolute rf-top-[6px] rf-right-[4px] rf-items-center rf-justify-center rf-w-1 rf-h-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full" })
1458
1469
  ] }) }),
1459
1470
  /* @__PURE__ */ jsxs12(DropdownMenuContent, { className: "rf-*:text-xs", children: [
1460
- dropdownMenuItems.map((item) => /* @__PURE__ */ jsxs12(
1471
+ dropdownMenuItems.filter(
1472
+ (item) => !availableTabs || availableTabs.includes(item)
1473
+ ).map((item) => /* @__PURE__ */ jsxs12(
1461
1474
  DropdownMenuItem,
1462
1475
  {
1463
1476
  onSelect: () => setActiveTab(item),
@@ -1509,7 +1522,7 @@ var CircuitJsonPreview = ({
1509
1522
  children: /* @__PURE__ */ jsx16("div", { className: "rf-h-full", children: codeTabContent })
1510
1523
  }
1511
1524
  ),
1512
- /* @__PURE__ */ jsx16(TabsContent, { value: "pcb", children: /* @__PURE__ */ jsx16(
1525
+ (!availableTabs || availableTabs.includes("pcb")) && /* @__PURE__ */ jsx16(TabsContent, { value: "pcb", children: /* @__PURE__ */ jsx16(
1513
1526
  "div",
1514
1527
  {
1515
1528
  className: cn(
@@ -1544,7 +1557,7 @@ var CircuitJsonPreview = ({
1544
1557
  )
1545
1558
  }
1546
1559
  ) }),
1547
- /* @__PURE__ */ jsx16(TabsContent, { value: "assembly", children: /* @__PURE__ */ jsx16(
1560
+ (!availableTabs || availableTabs.includes("assembly")) && /* @__PURE__ */ jsx16(TabsContent, { value: "assembly", children: /* @__PURE__ */ jsx16(
1548
1561
  "div",
1549
1562
  {
1550
1563
  className: cn(
@@ -1564,7 +1577,7 @@ var CircuitJsonPreview = ({
1564
1577
  ) : /* @__PURE__ */ jsx16(PreviewEmptyState_default, { onRunClicked }) })
1565
1578
  }
1566
1579
  ) }),
1567
- /* @__PURE__ */ jsx16(TabsContent, { value: "schematic", children: /* @__PURE__ */ jsx16(
1580
+ (!availableTabs || availableTabs.includes("schematic")) && /* @__PURE__ */ jsx16(TabsContent, { value: "schematic", children: /* @__PURE__ */ jsx16(
1568
1581
  "div",
1569
1582
  {
1570
1583
  className: cn(
@@ -1596,7 +1609,7 @@ var CircuitJsonPreview = ({
1596
1609
  )
1597
1610
  }
1598
1611
  ) }),
1599
- /* @__PURE__ */ jsx16(TabsContent, { value: "cad", children: /* @__PURE__ */ jsx16(
1612
+ (!availableTabs || availableTabs.includes("cad")) && /* @__PURE__ */ jsx16(TabsContent, { value: "cad", children: /* @__PURE__ */ jsx16(
1600
1613
  "div",
1601
1614
  {
1602
1615
  className: cn(
@@ -1613,7 +1626,7 @@ var CircuitJsonPreview = ({
1613
1626
  ) : /* @__PURE__ */ jsx16(PreviewEmptyState_default, { onRunClicked }) })
1614
1627
  }
1615
1628
  ) }),
1616
- /* @__PURE__ */ jsx16(TabsContent, { value: "bom", children: /* @__PURE__ */ jsx16(
1629
+ (!availableTabs || availableTabs.includes("bom")) && /* @__PURE__ */ jsx16(TabsContent, { value: "bom", children: /* @__PURE__ */ jsx16(
1617
1630
  "div",
1618
1631
  {
1619
1632
  className: cn(
@@ -1632,7 +1645,7 @@ var CircuitJsonPreview = ({
1632
1645
  )
1633
1646
  }
1634
1647
  ) }),
1635
- /* @__PURE__ */ jsx16(TabsContent, { value: "circuit_json", children: /* @__PURE__ */ jsx16(
1648
+ (!availableTabs || availableTabs.includes("circuit_json")) && /* @__PURE__ */ jsx16(TabsContent, { value: "circuit_json", children: /* @__PURE__ */ jsx16(
1636
1649
  "div",
1637
1650
  {
1638
1651
  className: cn(
@@ -1642,7 +1655,7 @@ var CircuitJsonPreview = ({
1642
1655
  children: /* @__PURE__ */ jsx16(ErrorBoundary, { fallback: /* @__PURE__ */ jsx16("div", { children: "Error loading JSON viewer" }), children: circuitJson ? /* @__PURE__ */ jsx16(CircuitJsonTableViewer, { elements: circuitJson }) : /* @__PURE__ */ jsx16(PreviewEmptyState_default, { onRunClicked }) })
1643
1656
  }
1644
1657
  ) }),
1645
- /* @__PURE__ */ jsx16(TabsContent, { value: "errors", children: /* @__PURE__ */ jsx16(
1658
+ (!availableTabs || availableTabs.includes("errors")) && /* @__PURE__ */ jsx16(TabsContent, { value: "errors", children: /* @__PURE__ */ jsx16(
1646
1659
  "div",
1647
1660
  {
1648
1661
  className: cn(
@@ -1665,7 +1678,7 @@ var CircuitJsonPreview = ({
1665
1678
  ) : /* @__PURE__ */ jsx16(PreviewEmptyState_default, { onRunClicked })
1666
1679
  }
1667
1680
  ) }),
1668
- showRenderLogTab && /* @__PURE__ */ jsx16(TabsContent, { value: "render_log", children: /* @__PURE__ */ jsx16(RenderLogViewer, { renderLog }) })
1681
+ showRenderLogTab && (!availableTabs || availableTabs.includes("render_log")) && /* @__PURE__ */ jsx16(TabsContent, { value: "render_log", children: /* @__PURE__ */ jsx16(RenderLogViewer, { renderLog }) })
1669
1682
  ]
1670
1683
  }
1671
1684
  )
package/dist/preview.d.ts CHANGED
@@ -66,6 +66,14 @@ interface PreviewContentProps {
66
66
  isStreaming?: boolean;
67
67
  hasCodeChangedSinceLastRun?: boolean;
68
68
  defaultActiveTab?: TabId;
69
+ /**
70
+ * Alias for defaultActiveTab
71
+ */
72
+ defaultTab?: TabId;
73
+ /**
74
+ * Tabs to display. Defaults to all
75
+ */
76
+ availableTabs?: TabId[];
69
77
  renderLog?: RenderLog | null;
70
78
  /**
71
79
  * Name of the currently running async effect from @tscircuit/core, if any
@@ -87,7 +95,7 @@ declare global {
87
95
  }
88
96
  }
89
97
 
90
- declare const CircuitJsonPreview: ({ code, onRunClicked, errorMessage, errorStack, 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, activeEffectName, }: PreviewContentProps) => react_jsx_runtime.JSX.Element;
98
+ declare const CircuitJsonPreview: ({ code, onRunClicked, errorMessage, errorStack, circuitJson, autoroutingGraphics, showRightHeaderContent, showCodeTab, codeTabContent, showJsonTab, showRenderLogTab, onActiveTabChange, renderLog, showImportAndFormatButtons, className, headerClassName, leftHeaderContent, readOnly, isStreaming, autoroutingLog, onReportAutoroutingLog, isRunningCode, hasCodeChangedSinceLastRun, onEditEvent, editEvents, defaultActiveTab, defaultTab, availableTabs, autoRotate3dViewerDisabled, showSchematicDebugGrid, showToggleFullScreen, defaultToFullScreen, activeEffectName, }: PreviewContentProps) => react_jsx_runtime.JSX.Element;
91
99
 
92
100
  interface BomTableProps {
93
101
  circuitJson: AnyCircuitElement[];
package/dist/preview.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  linkify,
9
9
  useOrderDialog,
10
10
  useOrderDialogCli
11
- } from "./chunk-UA6KVLUV.js";
11
+ } from "./chunk-AK3XQA6P.js";
12
12
  export {
13
13
  BomTable,
14
14
  CadViewer,
package/dist/runner.d.ts CHANGED
@@ -82,6 +82,14 @@ interface RunFrameProps {
82
82
  */
83
83
  debug?: boolean;
84
84
  defaultActiveTab?: TabId;
85
+ /**
86
+ * Alias for defaultActiveTab
87
+ */
88
+ defaultTab?: TabId;
89
+ /**
90
+ * Tabs to display. Defaults to all
91
+ */
92
+ availableTabs?: TabId[];
85
93
  evalWebWorkerBlobUrl?: string;
86
94
  evalVersion?: string;
87
95
  forceLatestEvalVersion?: boolean;
package/dist/runner.js CHANGED
@@ -37,7 +37,7 @@ import {
37
37
  useOrderDialogCli,
38
38
  useRunFrameStore,
39
39
  useRunnerStore
40
- } from "./chunk-UA6KVLUV.js";
40
+ } from "./chunk-AK3XQA6P.js";
41
41
 
42
42
  // lib/components/RunFrame/RunFrame.tsx
43
43
  import { createCircuitWebWorker } from "@tscircuit/eval/worker";
@@ -235,7 +235,7 @@ var RunFrame = (props) => {
235
235
  const [renderLog, setRenderLog] = useState(null);
236
236
  const [autoroutingLog, setAutoroutingLog] = useState({});
237
237
  const [activeTab, setActiveTab] = useState(
238
- props.defaultActiveTab ?? "pcb"
238
+ props.defaultActiveTab ?? props.defaultTab ?? "pcb"
239
239
  );
240
240
  useEffect(() => {
241
241
  if (props.debug) Debug.enable("run-frame*");
@@ -472,7 +472,9 @@ var RunFrame = (props) => {
472
472
  CircuitJsonPreview,
473
473
  {
474
474
  code: fsMap.get(props.entrypoint ?? props.mainComponentPath),
475
- defaultActiveTab: props.defaultActiveTab,
475
+ defaultActiveTab: props.defaultActiveTab ?? props.defaultTab,
476
+ defaultTab: props.defaultTab,
477
+ availableTabs: props.availableTabs,
476
478
  showToggleFullScreen: props.showToggleFullScreen,
477
479
  autoroutingGraphics,
478
480
  autoroutingLog,