@tscircuit/runframe 0.0.723 → 0.0.724

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.
@@ -17,6 +17,26 @@ if (!window.location.hostname.includes("localhost") && !window.location.hostname
17
17
  }
18
18
  }
19
19
 
20
+ // lib/utils/bytesToBase64.ts
21
+ function bytesToBase64(bytes) {
22
+ let binary = "";
23
+ const len = bytes.byteLength;
24
+ for (let i = 0; i < len; i++) {
25
+ binary += String.fromCharCode(bytes[i]);
26
+ }
27
+ return btoa(binary);
28
+ }
29
+
30
+ // lib/utils/encodeFsMapToUrlHash.ts
31
+ import { gzipSync, strToU8 } from "fflate";
32
+ function encodeFsMapToUrlHash(fsMap, snippet_type) {
33
+ const text = JSON.stringify(fsMap);
34
+ const compressedData = gzipSync(strToU8(text));
35
+ const base64Data = bytesToBase64(compressedData);
36
+ const typeParam = snippet_type ? `&snippet_type=${snippet_type}` : "";
37
+ return `${window.location.origin}/editor?${typeParam}#data:application/gzip;base64,${base64Data}`;
38
+ }
39
+
20
40
  // lib/utils/index.ts
21
41
  function cn(...inputs) {
22
42
  return twMerge(clsx(inputs));
@@ -367,6 +387,7 @@ var ErrorTabContent = ({
367
387
  autoroutingLog,
368
388
  circuitJsonErrors,
369
389
  circuitJsonWarnings,
390
+ fsMap,
370
391
  onReportAutoroutingLog,
371
392
  errorMessage,
372
393
  errorStack,
@@ -577,7 +598,7 @@ ${currentError.stack}`;
577
598
  className: "rf-p-1",
578
599
  onClick: () => {
579
600
  const title = `Error ${currentError.type}`.replace(/[^a-zA-Z0-9 ]/g, " ").replace(/\s+/g, " ").slice(0, 100);
580
- const url = createSnippetUrl(code ?? "");
601
+ const url = fsMap ? encodeFsMapToUrlHash(Object.fromEntries(fsMap)) : createSnippetUrl(code ?? "");
581
602
  let errorDetails = `${currentError.type}: ${currentError.message}`;
582
603
  if (evalVersion) errorDetails += `
583
604
  @tscircuit/eval@${evalVersion}`;
@@ -592,9 +613,11 @@ ${currentError.stack}`;
592
613
  ${errorDetails}
593
614
  \`\`\`
594
615
  `;
595
- if (url.length > 3e3 || body.length > 4e3) {
616
+ if (body.length > 35e3) {
596
617
  const truncatedMessage = currentError.message.length > 500 ? `${currentError.message.slice(0, 500)}...` : currentError.message;
597
- body = `### Error
618
+ body = `[Package code to reproduce](${url})
619
+
620
+ ### Error
598
621
  \`\`\`
599
622
  ${currentError.type}: ${truncatedMessage}
600
623
  \`\`\``;
@@ -1261,7 +1284,7 @@ var useErrorTelemetry = ({
1261
1284
  };
1262
1285
 
1263
1286
  // package.json
1264
- var version = "0.0.722";
1287
+ var version = "0.0.723";
1265
1288
 
1266
1289
  // lib/components/RunFrame/runner-store/use-runner-store.ts
1267
1290
  import { create } from "zustand";
@@ -1289,6 +1312,7 @@ var dropdownMenuItems = [
1289
1312
  ];
1290
1313
  var CircuitJsonPreview = ({
1291
1314
  code,
1315
+ fsMap,
1292
1316
  onRunClicked = void 0,
1293
1317
  errorMessage,
1294
1318
  errorStack,
@@ -1666,6 +1690,7 @@ var CircuitJsonPreview = ({
1666
1690
  ErrorTabContent,
1667
1691
  {
1668
1692
  code,
1693
+ fsMap,
1669
1694
  circuitJsonErrors,
1670
1695
  circuitJsonWarnings,
1671
1696
  errorMessage,
package/dist/preview.d.ts CHANGED
@@ -35,6 +35,7 @@ interface PreviewContentProps {
35
35
  onRunClicked?: () => void;
36
36
  tsxRunTriggerCount?: number;
37
37
  errorMessage?: string | null;
38
+ fsMap?: Map<string, string>;
38
39
  errorStack?: string | null;
39
40
  autoroutingGraphics?: any;
40
41
  circuitJson: CircuitJson | null;
@@ -95,7 +96,7 @@ declare global {
95
96
  }
96
97
  }
97
98
 
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;
99
+ 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, }: PreviewContentProps) => react_jsx_runtime.JSX.Element;
99
100
 
100
101
  interface BomTableProps {
101
102
  circuitJson: AnyCircuitElement[];
package/dist/preview.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  linkify,
9
9
  useOrderDialog,
10
10
  useOrderDialogCli
11
- } from "./chunk-KFL2EXDS.js";
11
+ } from "./chunk-A4J66D7N.js";
12
12
  export {
13
13
  BomTable,
14
14
  CadViewer,
package/dist/runner.js CHANGED
@@ -37,7 +37,7 @@ import {
37
37
  useOrderDialogCli,
38
38
  useRunFrameStore,
39
39
  useRunnerStore
40
- } from "./chunk-KFL2EXDS.js";
40
+ } from "./chunk-A4J66D7N.js";
41
41
 
42
42
  // lib/components/RunFrame/RunFrame.tsx
43
43
  import { createCircuitWebWorker } from "@tscircuit/eval/worker";
@@ -478,6 +478,7 @@ var RunFrame = (props) => {
478
478
  CircuitJsonPreview,
479
479
  {
480
480
  code: fsMap.get(props.entrypoint ?? props.mainComponentPath),
481
+ fsMap,
481
482
  defaultActiveTab: props.defaultActiveTab ?? props.defaultTab,
482
483
  defaultTab: props.defaultTab,
483
484
  availableTabs: props.availableTabs,