@tscircuit/runframe 0.0.585 → 0.0.587

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.
@@ -54,7 +54,7 @@ TabsContent.displayName = TabsPrimitive.Content.displayName;
54
54
 
55
55
  // lib/components/CircuitJsonPreview/CircuitJsonPreview.tsx
56
56
  import { CadViewer } from "@tscircuit/3d-viewer";
57
- import { useCallback, useEffect as useEffect2, useState as useState5, useMemo as useMemo2 } from "react";
57
+ import { useCallback, useEffect as useEffect3, useState as useState5, useMemo as useMemo2 } from "react";
58
58
 
59
59
  // lib/components/ErrorFallback.tsx
60
60
  import "react";
@@ -356,7 +356,9 @@ var ErrorTabContent = ({
356
356
  circuitJsonWarnings,
357
357
  onReportAutoroutingLog,
358
358
  errorMessage,
359
- errorStack
359
+ errorStack,
360
+ circuitJson,
361
+ evalVersion
360
362
  }) => {
361
363
  const unifiedErrors = useMemo(() => {
362
364
  const errors = [];
@@ -380,6 +382,13 @@ var ErrorTabContent = ({
380
382
  }
381
383
  return errors;
382
384
  }, [errorMessage, errorStack, circuitJsonErrors]);
385
+ const softwareUsedString = useMemo(() => {
386
+ if (!circuitJson || !Array.isArray(circuitJson)) return void 0;
387
+ const metadata = circuitJson.find(
388
+ (el) => el.type === "source_project_metadata"
389
+ );
390
+ return metadata?.software_used_string;
391
+ }, [circuitJson]);
383
392
  const unifiedWarnings = useMemo(() => {
384
393
  const warnings = [];
385
394
  if (circuitJsonWarnings && circuitJsonWarnings.length > 0) {
@@ -460,12 +469,18 @@ var ErrorTabContent = ({
460
469
  currentError && /* @__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: [
461
470
  /* @__PURE__ */ jsx6("h3", { className: "rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-1", children: currentError.type }),
462
471
  /* @__PURE__ */ jsx6("p", { className: "rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600", children: currentError.message }),
463
- currentError.stack && /* @__PURE__ */ jsx6(
472
+ (currentError.stack || evalVersion || softwareUsedString) && /* @__PURE__ */ jsxs4(
464
473
  "details",
465
474
  {
466
475
  style: { whiteSpace: "pre-wrap" },
467
476
  className: "rf-text-xs rf-font-mono rf-text-red-600 rf-mt-2",
468
- children: currentError.stack
477
+ children: [
478
+ evalVersion && `@tscircuit/eval@${evalVersion}
479
+ `,
480
+ softwareUsedString && `${softwareUsedString}
481
+ `,
482
+ currentError.stack
483
+ ]
469
484
  }
470
485
  )
471
486
  ] }) }),
@@ -526,7 +541,13 @@ var ErrorTabContent = ({
526
541
  variant: "outline",
527
542
  className: "rf-p-1",
528
543
  onClick: () => {
529
- const errorText = `${currentError.type}: ${currentError.message}${currentError.stack ? "\n" + currentError.stack : ""}`;
544
+ let errorText = `${currentError.type}: ${currentError.message}`;
545
+ if (evalVersion) errorText += `
546
+ @tscircuit/eval@${evalVersion}`;
547
+ if (softwareUsedString) errorText += `
548
+ ${softwareUsedString}`;
549
+ if (currentError.stack) errorText += `
550
+ ${currentError.stack}`;
530
551
  navigator.clipboard.writeText(errorText);
531
552
  alert("Error copied to clipboard!");
532
553
  },
@@ -544,7 +565,13 @@ var ErrorTabContent = ({
544
565
  onClick: () => {
545
566
  const title = `Error ${currentError.type}`.replace(/[^a-zA-Z0-9 ]/g, " ").replace(/\s+/g, " ").slice(0, 100);
546
567
  const url = createSnippetUrl(code ?? "");
547
- const errorDetails = `${currentError.type}: ${currentError.message}${currentError.stack ? "\n" + currentError.stack : ""}`;
568
+ let errorDetails = `${currentError.type}: ${currentError.message}`;
569
+ if (evalVersion) errorDetails += `
570
+ @tscircuit/eval@${evalVersion}`;
571
+ if (softwareUsedString) errorDetails += `
572
+ ${softwareUsedString}`;
573
+ if (currentError.stack) errorDetails += `
574
+ ${currentError.stack}`;
548
575
  let body = `[Package code to reproduce](${url})
549
576
 
550
577
  ### Error
@@ -1043,6 +1070,21 @@ var useStyles = () => {
1043
1070
  }, []);
1044
1071
  };
1045
1072
 
1073
+ // lib/hooks/use-fullscreen-body-scroll.ts
1074
+ import { useEffect as useEffect2 } from "react";
1075
+ var useFullscreenBodyScroll = (isFullScreen) => {
1076
+ useEffect2(() => {
1077
+ if (isFullScreen) {
1078
+ document.body.style.overflow = "hidden";
1079
+ } else {
1080
+ document.body.style.overflow = "";
1081
+ }
1082
+ return () => {
1083
+ document.body.style.overflow = "";
1084
+ };
1085
+ }, [isFullScreen]);
1086
+ };
1087
+
1046
1088
  // lib/components/RenderLogViewer/RenderLogViewer.tsx
1047
1089
  import { orderedRenderPhases as orderedRenderPhases2 } from "@tscircuit/core";
1048
1090
  import { useState as useState4 } from "react";
@@ -1172,7 +1214,22 @@ var RenderLogViewer = ({
1172
1214
  };
1173
1215
 
1174
1216
  // package.json
1175
- var version = "0.0.584";
1217
+ var version = "0.0.586";
1218
+
1219
+ // lib/components/RunFrame/runner-store/use-runner-store.ts
1220
+ import { create } from "zustand";
1221
+ import { devtools } from "zustand/middleware";
1222
+ var useRunnerStore = create()(
1223
+ devtools(
1224
+ (set) => ({
1225
+ lastRunEvalVersion: void 0,
1226
+ setLastRunEvalVersion: (version2) => {
1227
+ set({ lastRunEvalVersion: version2 });
1228
+ }
1229
+ }),
1230
+ { name: "runframe-runner-store" }
1231
+ )
1232
+ );
1176
1233
 
1177
1234
  // lib/components/CircuitJsonPreview/CircuitJsonPreview.tsx
1178
1235
  import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
@@ -1217,6 +1274,7 @@ var CircuitJsonPreview = ({
1217
1274
  activeEffectName
1218
1275
  }) => {
1219
1276
  useStyles();
1277
+ const lastRunEvalVersion = useRunnerStore((s) => s.lastRunEvalVersion);
1220
1278
  const circuitJsonErrors = useMemo2(() => {
1221
1279
  if (!circuitJson) return null;
1222
1280
  return circuitJson.filter(
@@ -1233,6 +1291,7 @@ var CircuitJsonPreview = ({
1233
1291
  defaultActiveTab ?? "pcb"
1234
1292
  );
1235
1293
  const [isFullScreen, setIsFullScreen] = useState5(defaultToFullScreen);
1294
+ useFullscreenBodyScroll(isFullScreen);
1236
1295
  const setActiveTab = useCallback(
1237
1296
  (tab) => {
1238
1297
  setActiveTabState(tab);
@@ -1243,12 +1302,12 @@ var CircuitJsonPreview = ({
1243
1302
  const toggleFullScreen = () => {
1244
1303
  setIsFullScreen(!isFullScreen);
1245
1304
  };
1246
- useEffect2(() => {
1305
+ useEffect3(() => {
1247
1306
  if (errorMessage) {
1248
1307
  setActiveTab("errors");
1249
1308
  }
1250
1309
  }, [errorMessage]);
1251
- useEffect2(() => {
1310
+ useEffect3(() => {
1252
1311
  if ((activeTab === "code" || activeTab === "errors") && circuitJson && !errorMessage) {
1253
1312
  setActiveTab(defaultActiveTab ?? "pcb");
1254
1313
  }
@@ -1265,7 +1324,7 @@ var CircuitJsonPreview = ({
1265
1324
  {
1266
1325
  className: cn(
1267
1326
  "rf-md:sticky rf-md:top-2",
1268
- isFullScreen && "rf-fixed rf-top-0 rf-left-0 rf-w-full rf-bg-white"
1327
+ isFullScreen && "rf-fixed rf-top-0 rf-left-0 rf-w-full rf-h-full rf-bg-white rf-overflow-hidden"
1269
1328
  ),
1270
1329
  children: /* @__PURE__ */ jsxs12(
1271
1330
  Tabs,
@@ -1528,6 +1587,8 @@ var CircuitJsonPreview = ({
1528
1587
  circuitJsonWarnings,
1529
1588
  errorMessage,
1530
1589
  errorStack,
1590
+ circuitJson,
1591
+ evalVersion: lastRunEvalVersion,
1531
1592
  autoroutingLog,
1532
1593
  onReportAutoroutingLog
1533
1594
  }
@@ -1558,8 +1619,8 @@ var debug = Debug("run-frame");
1558
1619
  var debug_default = debug;
1559
1620
 
1560
1621
  // lib/components/RunFrameWithApi/store.ts
1561
- import { create } from "zustand";
1562
- import { devtools } from "zustand/middleware";
1622
+ import { create as create2 } from "zustand";
1623
+ import { devtools as devtools2 } from "zustand/middleware";
1563
1624
 
1564
1625
  // lib/components/RunFrameWithApi/api-base.ts
1565
1626
  var API_BASE = window.TSCIRCUIT_FILESERVER_API_BASE_URL ?? "/api";
@@ -1598,8 +1659,8 @@ async function getInitialFilesApi() {
1598
1659
  }
1599
1660
  return fileMap;
1600
1661
  }
1601
- var useRunFrameStore = create()(
1602
- devtools(
1662
+ var useRunFrameStore = create2()(
1663
+ devtools2(
1603
1664
  (set, get) => ({
1604
1665
  fsMap: /* @__PURE__ */ new Map(),
1605
1666
  lastEventTime: (/* @__PURE__ */ new Date()).toISOString(),
@@ -1809,7 +1870,7 @@ import { QueryClient, QueryClientProvider } from "react-query";
1809
1870
  // lib/components/OrderDialog/InitialOrder.tsx
1810
1871
  import { Loader2 as Loader22 } from "lucide-react";
1811
1872
  import { GitHubLogoIcon as GitHubLogoIcon2 } from "@radix-ui/react-icons";
1812
- import { useEffect as useEffect3, useMemo as useMemo3, useState as useState6 } from "react";
1873
+ import { useEffect as useEffect4, useMemo as useMemo3, useState as useState6 } from "react";
1813
1874
 
1814
1875
  // lib/components/OrderDialog/VendorQuoteCard.tsx
1815
1876
  import { Truck, Package } from "lucide-react";
@@ -2005,7 +2066,7 @@ var InitialOrderScreen = ({
2005
2066
  const [selectedShippingCarrier, setSelectedShippingCarrier] = useState6(null);
2006
2067
  const [orderQuoteId, setOrderQuoteId] = useState6(null);
2007
2068
  const { mutate: createOrderQuote2, error: createOrderQuoteError } = useCreateOrderQuote();
2008
- useEffect3(() => {
2069
+ useEffect4(() => {
2009
2070
  if (packageReleaseId) {
2010
2071
  createOrderQuote2(packageReleaseId, {
2011
2072
  onSuccess: (data) => {
@@ -2021,7 +2082,7 @@ var InitialOrderScreen = ({
2021
2082
  );
2022
2083
  window.location.href = `${stripeCheckoutBaseUrl}?client_reference_id=${orderQuoteId2}&shipping_option=${selectedShippingCarrier}`;
2023
2084
  };
2024
- useEffect3(() => {
2085
+ useEffect4(() => {
2025
2086
  if (selectedShippingCarrier === null && orderQuote && Array.isArray(orderQuote.shipping_options) && orderQuote.shipping_options.length > 0) {
2026
2087
  const lowest = orderQuote.shipping_options.reduce(
2027
2088
  (min, curr) => curr.cost < min.cost ? curr : min,
@@ -2242,6 +2303,7 @@ export {
2242
2303
  linkify,
2243
2304
  BomTable,
2244
2305
  PcbViewerWithContainerHeight,
2306
+ useRunnerStore,
2245
2307
  CircuitJsonPreview,
2246
2308
  debug_default,
2247
2309
  API_BASE,
package/dist/preview.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  linkify,
9
9
  useOrderDialog,
10
10
  useOrderDialogCli
11
- } from "./chunk-H7IWDJUR.js";
11
+ } from "./chunk-H6JVKVQZ.js";
12
12
  export {
13
13
  BomTable,
14
14
  CadViewer,
package/dist/runner.js CHANGED
@@ -35,8 +35,9 @@ import {
35
35
  toast,
36
36
  useOrderDialog,
37
37
  useOrderDialogCli,
38
- useRunFrameStore
39
- } from "./chunk-H7IWDJUR.js";
38
+ useRunFrameStore,
39
+ useRunnerStore
40
+ } from "./chunk-H6JVKVQZ.js";
40
41
 
41
42
  // lib/components/RunFrame/RunFrame.tsx
42
43
  import { createCircuitWebWorker } from "@tscircuit/eval/worker";
@@ -96,21 +97,6 @@ var getChangesBetweenFsMaps = (fsMap1, fsMap2) => {
96
97
  return changes;
97
98
  };
98
99
 
99
- // lib/components/RunFrame/runner-store/use-runner-store.ts
100
- import { create } from "zustand";
101
- import { devtools } from "zustand/middleware";
102
- var useRunnerStore = create()(
103
- devtools(
104
- (set) => ({
105
- lastRunEvalVersion: void 0,
106
- setLastRunEvalVersion: (version) => {
107
- set({ lastRunEvalVersion: version });
108
- }
109
- }),
110
- { name: "runframe-runner-store" }
111
- )
112
- );
113
-
114
100
  // lib/components/RunFrame/useMutex.tsx
115
101
  import { useCallback, useRef } from "react";
116
102
  function useMutex() {
@@ -285,6 +271,7 @@ var RunFrame = (props) => {
285
271
  verbose: true
286
272
  });
287
273
  globalThis.runFrameWorker = worker;
274
+ setLastRunEvalVersion(evalVersion);
288
275
  props.onRenderStarted?.();
289
276
  const fsMapObj2 = fsMap instanceof Map ? Object.fromEntries(fsMap.entries()) : fsMap;
290
277
  const renderIds = /* @__PURE__ */ new Set();