@tscircuit/runframe 0.0.550 → 0.0.552
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-6HPHICW4.js → chunk-7HEREWUP.js} +80 -82
- package/dist/preview.js +1 -1
- package/dist/runner.js +1 -1
- package/dist/standalone-preview.min.js +1037 -1039
- package/dist/standalone.min.js +1059 -1061
- package/package.json +2 -2
|
@@ -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 } from "react";
|
|
57
|
+
import { useCallback, useEffect as useEffect2, useState as useState5, useMemo as useMemo2 } from "react";
|
|
58
58
|
|
|
59
59
|
// lib/components/ErrorFallback.tsx
|
|
60
60
|
import "react";
|
|
@@ -347,7 +347,7 @@ var AutoroutingLogOptions = ({
|
|
|
347
347
|
] }) });
|
|
348
348
|
|
|
349
349
|
// lib/components/ErrorTabContent/ErrorTabContent.tsx
|
|
350
|
-
import { useState } from "react";
|
|
350
|
+
import { useState, useMemo } from "react";
|
|
351
351
|
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
352
352
|
var ErrorTabContent = ({
|
|
353
353
|
code,
|
|
@@ -357,7 +357,30 @@ var ErrorTabContent = ({
|
|
|
357
357
|
errorMessage,
|
|
358
358
|
errorStack
|
|
359
359
|
}) => {
|
|
360
|
-
|
|
360
|
+
const unifiedErrors = useMemo(() => {
|
|
361
|
+
const errors = [];
|
|
362
|
+
if (errorMessage) {
|
|
363
|
+
errors.push({
|
|
364
|
+
type: "Execution Error",
|
|
365
|
+
message: errorMessage,
|
|
366
|
+
stack: errorStack || void 0,
|
|
367
|
+
source: "execution"
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
if (circuitJsonErrors && circuitJsonErrors.length > 0) {
|
|
371
|
+
circuitJsonErrors.forEach((error) => {
|
|
372
|
+
errors.push({
|
|
373
|
+
type: error.type || "Circuit JSON Error",
|
|
374
|
+
message: error.message || "No error message available",
|
|
375
|
+
stack: error.stack || "",
|
|
376
|
+
source: "circuitJson"
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
return errors;
|
|
381
|
+
}, [errorMessage, errorStack, circuitJsonErrors]);
|
|
382
|
+
const [currentErrorIndex, setCurrentErrorIndex] = useState(0);
|
|
383
|
+
if (unifiedErrors.length === 0) {
|
|
361
384
|
return /* @__PURE__ */ jsxs4("div", { className: "px-2", children: [
|
|
362
385
|
/* @__PURE__ */ jsx6("div", { className: "rf-mt-4 rf-bg-green-50 rf-rounded-md rf-border rf-border-green-200", children: /* @__PURE__ */ jsxs4("div", { className: "rf-p-4", children: [
|
|
363
386
|
/* @__PURE__ */ jsx6("h3", { className: "rf-text-lg rf-font-semibold rf-text-green-800 rf-mb-3", children: "No Errors \u{1F44C}" }),
|
|
@@ -372,63 +395,55 @@ var ErrorTabContent = ({
|
|
|
372
395
|
) })
|
|
373
396
|
] });
|
|
374
397
|
}
|
|
375
|
-
const [currentErrorIndex, setCurrentErrorIndex] = useState(0);
|
|
376
398
|
const handlePrev = () => {
|
|
377
399
|
setCurrentErrorIndex((prev) => Math.max(prev - 1, 0));
|
|
378
400
|
};
|
|
379
401
|
const handleNext = () => {
|
|
380
|
-
setCurrentErrorIndex(
|
|
381
|
-
(prev) => Math.min(prev + 1, circuitJsonErrors.length - 1)
|
|
382
|
-
);
|
|
402
|
+
setCurrentErrorIndex((prev) => Math.min(prev + 1, unifiedErrors.length - 1));
|
|
383
403
|
};
|
|
404
|
+
const currentError = unifiedErrors[currentErrorIndex];
|
|
384
405
|
return /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
385
406
|
/* @__PURE__ */ jsxs4("div", { className: "rf-w-[95%] rf-mx-auto", children: [
|
|
386
|
-
|
|
387
|
-
/* @__PURE__ */ jsx6(
|
|
388
|
-
|
|
389
|
-
|
|
407
|
+
unifiedErrors.length > 1 && /* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-items-center rf-gap-2 rf-mb-2", children: [
|
|
408
|
+
/* @__PURE__ */ jsx6(
|
|
409
|
+
"button",
|
|
410
|
+
{
|
|
411
|
+
type: "button",
|
|
412
|
+
className: "rf-p-1 rf-rounded-sm rf-transition-colors",
|
|
413
|
+
onClick: handlePrev,
|
|
414
|
+
disabled: currentErrorIndex === 0,
|
|
415
|
+
children: /* @__PURE__ */ jsx6(ChevronLeft, { className: "rf-h-4 rf-w-4 rf-text-red-500" })
|
|
416
|
+
}
|
|
417
|
+
),
|
|
418
|
+
/* @__PURE__ */ jsx6(
|
|
419
|
+
"button",
|
|
420
|
+
{
|
|
421
|
+
type: "button",
|
|
422
|
+
className: "rf-p-1 rf-rounded-sm rf-transition-colors",
|
|
423
|
+
onClick: handleNext,
|
|
424
|
+
disabled: currentErrorIndex === unifiedErrors.length - 1,
|
|
425
|
+
children: /* @__PURE__ */ jsx6(ChevronRight2, { className: "rf-h-4 rf-w-4 rf-text-red-500" })
|
|
426
|
+
}
|
|
427
|
+
),
|
|
428
|
+
/* @__PURE__ */ jsxs4("span", { className: "rf-text-sm rf-text-red-600", children: [
|
|
429
|
+
currentErrorIndex + 1,
|
|
430
|
+
" of ",
|
|
431
|
+
unifiedErrors.length,
|
|
432
|
+
" errors"
|
|
433
|
+
] })
|
|
434
|
+
] }),
|
|
435
|
+
/* @__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: [
|
|
436
|
+
/* @__PURE__ */ jsx6("h3", { className: "rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-1", children: currentError.type }),
|
|
437
|
+
/* @__PURE__ */ jsx6("p", { className: "rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600", children: currentError.message }),
|
|
438
|
+
currentError.stack && /* @__PURE__ */ jsx6(
|
|
390
439
|
"details",
|
|
391
440
|
{
|
|
392
441
|
style: { whiteSpace: "pre-wrap" },
|
|
393
442
|
className: "rf-text-xs rf-font-mono rf-text-red-600 rf-mt-2",
|
|
394
|
-
children:
|
|
443
|
+
children: currentError.stack
|
|
395
444
|
}
|
|
396
445
|
)
|
|
397
|
-
] })
|
|
398
|
-
circuitJsonErrors && circuitJsonErrors.length > 0 && /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
399
|
-
/* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-items-center rf-gap-2 rf-mb-2", children: [
|
|
400
|
-
/* @__PURE__ */ jsx6(
|
|
401
|
-
"button",
|
|
402
|
-
{
|
|
403
|
-
type: "button",
|
|
404
|
-
className: "rf-p-1 rf-rounded-sm rf-transition-colors",
|
|
405
|
-
onClick: handlePrev,
|
|
406
|
-
disabled: currentErrorIndex === 0,
|
|
407
|
-
children: /* @__PURE__ */ jsx6(ChevronLeft, { className: "rf-h-4 rf-w-4 rf-text-red-500" })
|
|
408
|
-
}
|
|
409
|
-
),
|
|
410
|
-
/* @__PURE__ */ jsx6(
|
|
411
|
-
"button",
|
|
412
|
-
{
|
|
413
|
-
type: "button",
|
|
414
|
-
className: "rf-p-1 rf-rounded-sm rf-transition-colors",
|
|
415
|
-
onClick: handleNext,
|
|
416
|
-
disabled: currentErrorIndex === circuitJsonErrors.length - 1,
|
|
417
|
-
children: /* @__PURE__ */ jsx6(ChevronRight2, { className: "rf-h-4 rf-w-4 rf-text-red-500" })
|
|
418
|
-
}
|
|
419
|
-
),
|
|
420
|
-
/* @__PURE__ */ jsxs4("span", { children: [
|
|
421
|
-
currentErrorIndex + 1,
|
|
422
|
-
" of ",
|
|
423
|
-
circuitJsonErrors.length,
|
|
424
|
-
" error"
|
|
425
|
-
] })
|
|
426
|
-
] }),
|
|
427
|
-
/* @__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: [
|
|
428
|
-
/* @__PURE__ */ jsx6("h3", { className: "rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-1", children: circuitJsonErrors[currentErrorIndex].type }),
|
|
429
|
-
/* @__PURE__ */ jsx6("p", { className: "rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600", children: circuitJsonErrors[currentErrorIndex].message })
|
|
430
|
-
] }) })
|
|
431
|
-
] })
|
|
446
|
+
] }) })
|
|
432
447
|
] }),
|
|
433
448
|
/* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-gap-2 rf-mt-4 rf-justify-end", children: [
|
|
434
449
|
/* @__PURE__ */ jsx6(
|
|
@@ -444,14 +459,8 @@ var ErrorTabContent = ({
|
|
|
444
459
|
variant: "outline",
|
|
445
460
|
className: "rf-p-1",
|
|
446
461
|
onClick: () => {
|
|
447
|
-
const
|
|
448
|
-
|
|
449
|
-
message: errorMessage ?? "",
|
|
450
|
-
stack: errorStack ?? ""
|
|
451
|
-
};
|
|
452
|
-
navigator.clipboard.writeText(
|
|
453
|
-
`${activeError.type}: ${activeError.message}${activeError.stack ? "\n" + activeError.stack : ""}`
|
|
454
|
-
);
|
|
462
|
+
const errorText = `${currentError.type}: ${currentError.message}${currentError.stack ? "\n" + currentError.stack : ""}`;
|
|
463
|
+
navigator.clipboard.writeText(errorText);
|
|
455
464
|
alert("Error copied to clipboard!");
|
|
456
465
|
},
|
|
457
466
|
children: [
|
|
@@ -466,36 +475,25 @@ var ErrorTabContent = ({
|
|
|
466
475
|
variant: "outline",
|
|
467
476
|
className: "rf-p-1",
|
|
468
477
|
onClick: () => {
|
|
469
|
-
const
|
|
470
|
-
type: "Execution Error",
|
|
471
|
-
message: errorMessage ?? "",
|
|
472
|
-
stack: errorStack ?? ""
|
|
473
|
-
};
|
|
474
|
-
const title = `Error: ${error.type}`.replace(/[^a-zA-Z0-9 ]/g, " ").replace(/\s+/g, " ").slice(0, 100);
|
|
478
|
+
const title = `Error ${currentError.type}`.replace(/[^a-zA-Z0-9 ]/g, " ").replace(/\s+/g, " ").slice(0, 100);
|
|
475
479
|
const url = createSnippetUrl(code ?? "");
|
|
476
|
-
|
|
480
|
+
const errorDetails = `${currentError.type}: ${currentError.message}${currentError.stack ? "\n" + currentError.stack : ""}`;
|
|
481
|
+
let body = `[Package code to reproduce](${url})
|
|
477
482
|
|
|
478
483
|
### Error
|
|
479
484
|
\`\`\`
|
|
480
|
-
${
|
|
485
|
+
${errorDetails}
|
|
481
486
|
\`\`\`
|
|
482
487
|
`;
|
|
483
|
-
if (body.length > 4e3) {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
\`\`\`
|
|
487
|
-
|
|
488
|
-
### Error
|
|
488
|
+
if (url.length > 3e3 || body.length > 4e3) {
|
|
489
|
+
const truncatedMessage = currentError.message.length > 500 ? `${currentError.message.slice(0, 500)}...` : currentError.message;
|
|
490
|
+
body = `### Error
|
|
489
491
|
\`\`\`
|
|
490
|
-
${
|
|
492
|
+
${currentError.type}: ${truncatedMessage}
|
|
491
493
|
\`\`\``;
|
|
492
494
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
title
|
|
496
|
-
)}&body=${encodeURIComponent(body)}`,
|
|
497
|
-
"_blank"
|
|
498
|
-
);
|
|
495
|
+
const issueUrl = `https://github.com/tscircuit/tscircuit.com/issues/new?title=${encodeURIComponent(title)}&body=${encodeURIComponent(body)}`;
|
|
496
|
+
window.open(issueUrl, "_blank");
|
|
499
497
|
},
|
|
500
498
|
children: [
|
|
501
499
|
/* @__PURE__ */ jsx6(GitHubLogoIcon, { className: "rf-w-4 rf-h-4" }),
|
|
@@ -1107,7 +1105,7 @@ var RenderLogViewer = ({
|
|
|
1107
1105
|
};
|
|
1108
1106
|
|
|
1109
1107
|
// package.json
|
|
1110
|
-
var version = "0.0.
|
|
1108
|
+
var version = "0.0.551";
|
|
1111
1109
|
|
|
1112
1110
|
// lib/components/CircuitJsonPreview/CircuitJsonPreview.tsx
|
|
1113
1111
|
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
@@ -1151,7 +1149,7 @@ var CircuitJsonPreview = ({
|
|
|
1151
1149
|
defaultToFullScreen = false
|
|
1152
1150
|
}) => {
|
|
1153
1151
|
useStyles();
|
|
1154
|
-
const circuitJsonErrors =
|
|
1152
|
+
const circuitJsonErrors = useMemo2(() => {
|
|
1155
1153
|
if (!circuitJson) return null;
|
|
1156
1154
|
return circuitJson.filter(
|
|
1157
1155
|
(e) => e && "error_type" in e || e.type.includes("error")
|
|
@@ -1736,7 +1734,7 @@ import { QueryClient, QueryClientProvider } from "react-query";
|
|
|
1736
1734
|
// lib/components/OrderDialog/InitialOrder.tsx
|
|
1737
1735
|
import { Loader2 as Loader22 } from "lucide-react";
|
|
1738
1736
|
import { GitHubLogoIcon as GitHubLogoIcon2 } from "@radix-ui/react-icons";
|
|
1739
|
-
import { useEffect as useEffect3, useMemo as
|
|
1737
|
+
import { useEffect as useEffect3, useMemo as useMemo3, useState as useState6 } from "react";
|
|
1740
1738
|
|
|
1741
1739
|
// lib/components/OrderDialog/VendorQuoteCard.tsx
|
|
1742
1740
|
import { Truck, Package } from "lucide-react";
|
|
@@ -1954,7 +1952,7 @@ var InitialOrderScreen = ({
|
|
|
1954
1952
|
setSelectedShippingCarrier(lowest?.carrier || null);
|
|
1955
1953
|
}
|
|
1956
1954
|
}, [orderQuote]);
|
|
1957
|
-
const lowestShippingCarrierCost =
|
|
1955
|
+
const lowestShippingCarrierCost = useMemo3(() => {
|
|
1958
1956
|
return orderQuote && Array.isArray(orderQuote.shipping_options) && orderQuote.shipping_options.length > 0 ? orderQuote.shipping_options.reduce(
|
|
1959
1957
|
(min, curr) => curr.cost < min.cost ? curr : min,
|
|
1960
1958
|
orderQuote.shipping_options[0]
|
|
@@ -2095,7 +2093,7 @@ var CliOrderDialog = ({
|
|
|
2095
2093
|
};
|
|
2096
2094
|
|
|
2097
2095
|
// lib/components/OrderDialog/useOrderDialog.tsx
|
|
2098
|
-
import { useState as useState7, useMemo as
|
|
2096
|
+
import { useState as useState7, useMemo as useMemo4, useCallback as useCallback2 } from "react";
|
|
2099
2097
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2100
2098
|
var useOrderDialogCli = () => {
|
|
2101
2099
|
const [isOpen, setIsOpen] = useState7(false);
|
|
@@ -2126,7 +2124,7 @@ var useOrderDialog = ({
|
|
|
2126
2124
|
setStage("initial");
|
|
2127
2125
|
}, []);
|
|
2128
2126
|
const open = useCallback2(() => setIsOpen(true), []);
|
|
2129
|
-
const MemoizedOrderDialog =
|
|
2127
|
+
const MemoizedOrderDialog = useMemo4(() => {
|
|
2130
2128
|
return (props) => /* @__PURE__ */ jsx22(
|
|
2131
2129
|
OrderDialog,
|
|
2132
2130
|
{
|
package/dist/preview.js
CHANGED
package/dist/runner.js
CHANGED