@tscircuit/runframe 0.0.970 → 0.0.971

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
@@ -57,15 +57,38 @@ const App = () => (
57
57
  )
58
58
  ```
59
59
 
60
- The CircuitJsonPreview component provides:
61
-
62
- - PCB view with interactive component placement
63
- - Schematic view
64
- - Assembly view
65
- - 3D view
66
- - Bill of Materials (BOM) table
67
- - Circuit JSON viewer
68
- - Error display
60
+ ### Using RunFrameStaticBuildViewer for Lazy-Loaded Circuit JSON
61
+
62
+ For displaying circuit JSON files that are fetched on-demand without code execution:
63
+
64
+ ```tsx
65
+ import { RunFrameStaticBuildViewer } from "@tscircuit/runframe"
66
+
67
+ const App = () => (
68
+ <RunFrameStaticBuildViewer
69
+ files={[
70
+ {
71
+ filePath: "main.circuit.json",
72
+ fileStaticAssetUrl: "https://api.example.com/circuits/main.json"
73
+ },
74
+ {
75
+ filePath: "components/sensor.circuit.json",
76
+ fileStaticAssetUrl: "https://api.example.com/circuits/sensor.json"
77
+ }
78
+ ]}
79
+ // Optional: Custom fetch function for authentication, caching, etc.
80
+ onFetchFile={async (fileRef) => {
81
+ const response = await fetch(fileRef.fileStaticAssetUrl, {
82
+ headers: { Authorization: 'Bearer token' }
83
+ })
84
+ return response.json()
85
+ }}
86
+ projectName="My Project"
87
+ defaultToFullScreen={false}
88
+ showToggleFullScreen={true}
89
+ />
90
+ )
91
+ ```
69
92
 
70
93
  ### Providing the Blob URL (to avoid loading webworker from CDN)
71
94
 
@@ -1426,7 +1426,7 @@ var useErrorTelemetry = ({
1426
1426
  };
1427
1427
 
1428
1428
  // package.json
1429
- var version = "0.0.969";
1429
+ var version = "0.0.970";
1430
1430
 
1431
1431
  // lib/hooks/use-eval-versions.ts
1432
1432
  import { useEffect as useEffect5, useMemo as useMemo2, useState as useState6 } from "react";
@@ -3516,7 +3516,7 @@ var FileMenuLeftHeader = (props) => {
3516
3516
  exportAndDownload({
3517
3517
  exportName: exp.name,
3518
3518
  circuitJson,
3519
- projectName: snippetName ?? "Untitled"
3519
+ projectName: props.projectName ?? snippetName ?? "Untitled"
3520
3520
  });
3521
3521
  },
3522
3522
  disabled: isExporting,
@@ -3678,6 +3678,7 @@ var CircuitJsonPreview = ({
3678
3678
  allowSelectingVersion = true,
3679
3679
  showFileMenu = false,
3680
3680
  isWebEmbedded = false,
3681
+ projectName,
3681
3682
  onRerunWithDebug
3682
3683
  }) => {
3683
3684
  useStyles();
@@ -3774,7 +3775,8 @@ var CircuitJsonPreview = ({
3774
3775
  FileMenuLeftHeader,
3775
3776
  {
3776
3777
  isWebEmbedded,
3777
- circuitJson
3778
+ circuitJson,
3779
+ projectName
3778
3780
  }
3779
3781
  ),
3780
3782
  (leftHeaderContent || showFileMenu) && /* @__PURE__ */ jsx31("div", { className: "rf-flex-grow" }),
package/dist/preview.d.ts CHANGED
@@ -105,6 +105,10 @@ interface PreviewContentProps {
105
105
  * Whether the preview is being embedded in a web page
106
106
  */
107
107
  isWebEmbedded?: boolean;
108
+ /**
109
+ * Project name to use for exports
110
+ */
111
+ projectName?: string;
108
112
  /**
109
113
  * Callback to rerun render with debug options
110
114
  */
@@ -117,7 +121,7 @@ declare global {
117
121
  }
118
122
  }
119
123
 
120
- declare const CircuitJsonPreview: ({ code, fsMap, 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, allowSelectingVersion, showFileMenu, isWebEmbedded, onRerunWithDebug, }: PreviewContentProps) => react_jsx_runtime.JSX.Element;
124
+ declare const CircuitJsonPreview: ({ code, fsMap, 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, allowSelectingVersion, showFileMenu, isWebEmbedded, projectName, onRerunWithDebug, }: PreviewContentProps) => react_jsx_runtime.JSX.Element;
121
125
 
122
126
  interface BomTableProps {
123
127
  circuitJson: AnyCircuitElement[];
package/dist/preview.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  linkify,
9
9
  useOrderDialog,
10
10
  useOrderDialogCli
11
- } from "./chunk-GEXWDQ4P.js";
11
+ } from "./chunk-7PCGNX3W.js";
12
12
  export {
13
13
  BomTable,
14
14
  CadViewer,
package/dist/runner.d.ts CHANGED
@@ -6,7 +6,7 @@ export { SchematicViewer } from '@tscircuit/schematic-viewer';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
7
  import { ManualEditEvent } from '@tscircuit/props';
8
8
  import { Package } from '@tscircuit/fake-snippets/schema';
9
- import 'circuit-json';
9
+ import { CircuitJson } from 'circuit-json';
10
10
  import 'three';
11
11
  import 'react';
12
12
 
@@ -235,4 +235,27 @@ declare const searchTscircuitComponents: (query: string) => Promise<Package[]>;
235
235
  */
236
236
  declare const mapTscircuitSnippetToSearchResult: (tscircuitSnippet: Package) => ComponentSearchResult;
237
237
 
238
- export { type ComponentSearchResult, ImportComponentDialog, RunFrame, RunFrameForCli, type RunFrameProps, RunFrameWithApi, type RunFrameWithApiProps, TabId, guessEntrypoint, guessManualEditsFilePath, mapJLCComponentToSearchResult, mapTscircuitSnippetToSearchResult, searchJLCComponents, searchTscircuitComponents };
238
+ interface CircuitJsonFileReference {
239
+ filePath: string;
240
+ fileStaticAssetUrl: string;
241
+ }
242
+ interface RunFrameStaticBuildViewerProps {
243
+ debug?: boolean;
244
+ files: CircuitJsonFileReference[];
245
+ onFetchFile?: (fileRef: CircuitJsonFileReference) => Promise<CircuitJson>;
246
+ initialCircuitPath?: string;
247
+ onCircuitJsonPathChange?: (path: string) => void;
248
+ defaultToFullScreen?: boolean;
249
+ showToggleFullScreen?: boolean;
250
+ projectName?: string;
251
+ showFileMenu?: boolean;
252
+ }
253
+ declare const RunFrameStaticBuildViewer: (props: RunFrameStaticBuildViewerProps) => react_jsx_runtime.JSX.Element;
254
+
255
+ declare const CircuitJsonFileSelectorCombobox: ({ files, onFileChange, currentFile, }: {
256
+ files: string[];
257
+ currentFile: string;
258
+ onFileChange: (value: string) => void;
259
+ }) => react_jsx_runtime.JSX.Element;
260
+
261
+ export { CircuitJsonFileSelectorCombobox, type ComponentSearchResult, ImportComponentDialog, RunFrame, RunFrameForCli, type RunFrameProps, RunFrameStaticBuildViewer, type RunFrameStaticBuildViewerProps, RunFrameWithApi, type RunFrameWithApiProps, TabId, guessEntrypoint, guessManualEditsFilePath, mapJLCComponentToSearchResult, mapTscircuitSnippetToSearchResult, searchJLCComponents, searchTscircuitComponents };