@tscircuit/runframe 0.0.723 → 0.0.725
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/dist/{chunk-KFL2EXDS.js → chunk-QU4HZ6KG.js} +30 -5
- package/dist/preview.d.ts +2 -1
- package/dist/preview.js +1 -1
- package/dist/runner.js +7 -3
- package/dist/standalone-preview.min.js +623 -621
- package/dist/standalone.min.js +786 -784
- package/package.json +2 -1
|
@@ -17,6 +17,22 @@ 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
|
+
const binString = String.fromCodePoint(...bytes);
|
|
23
|
+
return btoa(binString);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// lib/utils/encodeFsMapToUrlHash.ts
|
|
27
|
+
import { gzipSync, strToU8 } from "fflate";
|
|
28
|
+
function encodeFsMapToUrlHash(fsMap, snippet_type) {
|
|
29
|
+
const text = JSON.stringify(fsMap);
|
|
30
|
+
const compressedData = gzipSync(strToU8(text));
|
|
31
|
+
const base64Data = bytesToBase64(compressedData);
|
|
32
|
+
const typeParam = snippet_type ? `&snippet_type=${snippet_type}` : "";
|
|
33
|
+
return `${window.location.origin}/editor?${typeParam}#data:application/gzip;base64,${base64Data}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
20
36
|
// lib/utils/index.ts
|
|
21
37
|
function cn(...inputs) {
|
|
22
38
|
return twMerge(clsx(inputs));
|
|
@@ -364,6 +380,7 @@ import { useState, useMemo } from "react";
|
|
|
364
380
|
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
365
381
|
var ErrorTabContent = ({
|
|
366
382
|
code,
|
|
383
|
+
fsMap,
|
|
367
384
|
autoroutingLog,
|
|
368
385
|
circuitJsonErrors,
|
|
369
386
|
circuitJsonWarnings,
|
|
@@ -577,7 +594,9 @@ ${currentError.stack}`;
|
|
|
577
594
|
className: "rf-p-1",
|
|
578
595
|
onClick: () => {
|
|
579
596
|
const title = `Error ${currentError.type}`.replace(/[^a-zA-Z0-9 ]/g, " ").replace(/\s+/g, " ").slice(0, 100);
|
|
580
|
-
const url =
|
|
597
|
+
const url = fsMap ? encodeFsMapToUrlHash(
|
|
598
|
+
fsMap instanceof Map ? Object.fromEntries(fsMap.entries()) : fsMap
|
|
599
|
+
) : createSnippetUrl(code ?? "");
|
|
581
600
|
let errorDetails = `${currentError.type}: ${currentError.message}`;
|
|
582
601
|
if (evalVersion) errorDetails += `
|
|
583
602
|
@tscircuit/eval@${evalVersion}`;
|
|
@@ -592,9 +611,11 @@ ${currentError.stack}`;
|
|
|
592
611
|
${errorDetails}
|
|
593
612
|
\`\`\`
|
|
594
613
|
`;
|
|
595
|
-
if (
|
|
614
|
+
if (body.length > 35e3) {
|
|
596
615
|
const truncatedMessage = currentError.message.length > 500 ? `${currentError.message.slice(0, 500)}...` : currentError.message;
|
|
597
|
-
body =
|
|
616
|
+
body = `[Package code to reproduce](${url})
|
|
617
|
+
|
|
618
|
+
### Error
|
|
598
619
|
\`\`\`
|
|
599
620
|
${currentError.type}: ${truncatedMessage}
|
|
600
621
|
\`\`\``;
|
|
@@ -1261,7 +1282,7 @@ var useErrorTelemetry = ({
|
|
|
1261
1282
|
};
|
|
1262
1283
|
|
|
1263
1284
|
// package.json
|
|
1264
|
-
var version = "0.0.
|
|
1285
|
+
var version = "0.0.724";
|
|
1265
1286
|
|
|
1266
1287
|
// lib/components/RunFrame/runner-store/use-runner-store.ts
|
|
1267
1288
|
import { create } from "zustand";
|
|
@@ -1289,6 +1310,7 @@ var dropdownMenuItems = [
|
|
|
1289
1310
|
];
|
|
1290
1311
|
var CircuitJsonPreview = ({
|
|
1291
1312
|
code,
|
|
1313
|
+
fsMap,
|
|
1292
1314
|
onRunClicked = void 0,
|
|
1293
1315
|
errorMessage,
|
|
1294
1316
|
errorStack,
|
|
@@ -1548,7 +1570,9 @@ var CircuitJsonPreview = ({
|
|
|
1548
1570
|
),
|
|
1549
1571
|
onEditEventsChanged: (editEvents2) => {
|
|
1550
1572
|
if (onEditEvent) {
|
|
1551
|
-
|
|
1573
|
+
for (const e of editEvents2) {
|
|
1574
|
+
onEditEvent(e);
|
|
1575
|
+
}
|
|
1552
1576
|
}
|
|
1553
1577
|
}
|
|
1554
1578
|
}
|
|
@@ -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
|
@@ -31,6 +31,7 @@ type TabId = "code" | "pcb" | "schematic" | "assembly" | "cad" | "bom" | "circui
|
|
|
31
31
|
interface PreviewContentProps {
|
|
32
32
|
defaultToFullScreen?: boolean;
|
|
33
33
|
code?: string;
|
|
34
|
+
fsMap?: Map<string, string> | Record<string, string>;
|
|
34
35
|
readOnly?: boolean;
|
|
35
36
|
onRunClicked?: () => void;
|
|
36
37
|
tsxRunTriggerCount?: number;
|
|
@@ -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
package/dist/runner.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
useOrderDialogCli,
|
|
38
38
|
useRunFrameStore,
|
|
39
39
|
useRunnerStore
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-QU4HZ6KG.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,
|
|
@@ -1744,7 +1745,10 @@ var exportFabricationFiles = async ({
|
|
|
1744
1745
|
projectName
|
|
1745
1746
|
}) => {
|
|
1746
1747
|
const zip = new JSZip();
|
|
1747
|
-
const
|
|
1748
|
+
const filteredCircuitJson = circuitJson.filter(
|
|
1749
|
+
(element) => !("error_type" in element) && !("warning_type" in element)
|
|
1750
|
+
);
|
|
1751
|
+
const gerberLayerCmds = convertSoupToGerberCommands(filteredCircuitJson, {
|
|
1748
1752
|
flip_y_axis: false
|
|
1749
1753
|
});
|
|
1750
1754
|
const gerberFileContents = stringifyGerberCommandLayers(gerberLayerCmds);
|
|
@@ -1752,7 +1756,7 @@ var exportFabricationFiles = async ({
|
|
|
1752
1756
|
zip.file(`gerber/${fileName}.gbr`, fileContents);
|
|
1753
1757
|
}
|
|
1754
1758
|
const drillCmds = convertSoupToExcellonDrillCommands({
|
|
1755
|
-
circuitJson,
|
|
1759
|
+
circuitJson: filteredCircuitJson,
|
|
1756
1760
|
is_plated: true,
|
|
1757
1761
|
flip_y_axis: false
|
|
1758
1762
|
});
|