@tscircuit/runframe 0.0.306 → 0.0.308
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/runner.js +188 -186
- package/dist/standalone.min.js +809 -809
- package/package.json +1 -1
package/dist/runner.js
CHANGED
|
@@ -458,7 +458,6 @@ var RunFrame = (props) => {
|
|
|
458
458
|
}).then(() => {
|
|
459
459
|
return { success: true };
|
|
460
460
|
}).catch((e) => {
|
|
461
|
-
console.log("error", e);
|
|
462
461
|
const message = e.message.replace("Error: ", "");
|
|
463
462
|
props.onError?.(e);
|
|
464
463
|
setError({ error: message, stack: e.stack });
|
|
@@ -1473,8 +1472,9 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber) => {
|
|
|
1473
1472
|
import { useState as useState8 } from "react";
|
|
1474
1473
|
|
|
1475
1474
|
// lib/components/OrderDialog/OrderDialog.tsx
|
|
1476
|
-
import
|
|
1475
|
+
import ky3 from "ky";
|
|
1477
1476
|
import { useState as useState7 } from "react";
|
|
1477
|
+
import { QueryClient, QueryClientProvider } from "react-query";
|
|
1478
1478
|
|
|
1479
1479
|
// lib/components/OrderDialog/CheckoutOrder.tsx
|
|
1480
1480
|
import { MapPin } from "lucide-react";
|
|
@@ -1484,7 +1484,7 @@ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
|
1484
1484
|
var CheckoutOrder = ({
|
|
1485
1485
|
finalCost,
|
|
1486
1486
|
onConfirmCheckout,
|
|
1487
|
-
|
|
1487
|
+
onCancel
|
|
1488
1488
|
}) => {
|
|
1489
1489
|
const [selectedAddressId, setSelectedAddressId] = useState6(
|
|
1490
1490
|
null
|
|
@@ -1706,9 +1706,9 @@ var CheckoutOrder = ({
|
|
|
1706
1706
|
Button,
|
|
1707
1707
|
{
|
|
1708
1708
|
variant: "outline",
|
|
1709
|
-
onClick:
|
|
1709
|
+
onClick: onCancel,
|
|
1710
1710
|
className: "rf-w-full rf-mt-3",
|
|
1711
|
-
children: "
|
|
1711
|
+
children: "Cancel"
|
|
1712
1712
|
}
|
|
1713
1713
|
)
|
|
1714
1714
|
] })
|
|
@@ -1750,7 +1750,7 @@ var InitialOrderScreen = ({
|
|
|
1750
1750
|
};
|
|
1751
1751
|
|
|
1752
1752
|
// lib/components/OrderDialog/StepwiseProgress.tsx
|
|
1753
|
-
import
|
|
1753
|
+
import ky2 from "ky";
|
|
1754
1754
|
|
|
1755
1755
|
// lib/components/ui/progress.tsx
|
|
1756
1756
|
import * as React5 from "react";
|
|
@@ -1777,84 +1777,10 @@ var Progress = React5.forwardRef(({ className, value, ...props }, ref) => /* @__
|
|
|
1777
1777
|
Progress.displayName = "Progress";
|
|
1778
1778
|
|
|
1779
1779
|
// lib/components/OrderDialog/StepwiseProgress.tsx
|
|
1780
|
-
import {
|
|
1781
|
-
|
|
1782
|
-
steps,
|
|
1783
|
-
title = "Order PCB",
|
|
1784
|
-
onCancel,
|
|
1785
|
-
onContinue,
|
|
1786
|
-
continueButtonText = "Continue",
|
|
1787
|
-
cancelButtonText = "Cancel",
|
|
1788
|
-
loading = false
|
|
1789
|
-
}) => {
|
|
1790
|
-
const completedSteps = steps.filter((step) => step.completed);
|
|
1791
|
-
const activeStep = steps.find((step) => step.active);
|
|
1792
|
-
const totalSteps = steps.length;
|
|
1793
|
-
const progress = Math.round(completedSteps.length / totalSteps * 100);
|
|
1794
|
-
const displayedCompletedSteps = completedSteps.slice(-1);
|
|
1795
|
-
return /* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-flex-col rf-bg-white rf-rounded-xl rf-p-6 rf-max-w-xl rf-w-full rf-mx-auto", children: [
|
|
1796
|
-
/* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-items-center rf-justify-between rf-mb-6", children: [
|
|
1797
|
-
/* @__PURE__ */ jsx11("h2", { className: "rf-text-2xl rf-font-bold", children: title }),
|
|
1798
|
-
/* @__PURE__ */ jsxs8("div", { className: "rf-text-sm rf-text-muted-foreground", children: [
|
|
1799
|
-
completedSteps.length,
|
|
1800
|
-
" of ",
|
|
1801
|
-
totalSteps,
|
|
1802
|
-
" completed"
|
|
1803
|
-
] })
|
|
1804
|
-
] }),
|
|
1805
|
-
/* @__PURE__ */ jsx11(Progress, { value: progress, className: "rf-h-2 rf-mb-8" }),
|
|
1806
|
-
/* @__PURE__ */ jsxs8("div", { className: "rf-space-y-6 rf-mb-8", children: [
|
|
1807
|
-
displayedCompletedSteps.map((step, index) => /* @__PURE__ */ jsxs8(
|
|
1808
|
-
"div",
|
|
1809
|
-
{
|
|
1810
|
-
className: "rf-flex rf-items-start rf-gap-4",
|
|
1811
|
-
children: [
|
|
1812
|
-
/* @__PURE__ */ jsx11("div", { className: "rf-flex-shrink-0 rf-mt-0.5", children: /* @__PURE__ */ jsx11("div", { className: "rf-w-8 rf-h-8 rf-rounded-full rf-bg-green-100 rf-flex rf-items-center rf-justify-center", children: /* @__PURE__ */ jsx11(Check2, { className: "rf-h-5 rf-w-5 rf-text-green-600" }) }) }),
|
|
1813
|
-
/* @__PURE__ */ jsxs8("div", { className: "rf-flex-1", children: [
|
|
1814
|
-
/* @__PURE__ */ jsx11("p", { className: "rf-text-sm rf-font-medium rf-text-muted-foreground", children: index === displayedCompletedSteps.length - 1 ? "Last Completed" : "Completed" }),
|
|
1815
|
-
/* @__PURE__ */ jsxs8("p", { className: "rf-font-medium rf-text-green-600", children: [
|
|
1816
|
-
step.order_step_id,
|
|
1817
|
-
". ",
|
|
1818
|
-
step.title
|
|
1819
|
-
] })
|
|
1820
|
-
] })
|
|
1821
|
-
]
|
|
1822
|
-
},
|
|
1823
|
-
step.order_step_id
|
|
1824
|
-
)),
|
|
1825
|
-
completedSteps.length > 0 && activeStep && /* @__PURE__ */ jsx11("div", { className: "rf-pl-4", children: /* @__PURE__ */ jsx11(ArrowDown, { className: "rf-h-5 rf-w-5 rf-text-muted-foreground" }) }),
|
|
1826
|
-
activeStep && /* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-items-start rf-gap-4", children: [
|
|
1827
|
-
/* @__PURE__ */ jsx11("div", { className: "rf-flex-shrink-0 rf-mt-0.5", children: /* @__PURE__ */ jsx11("div", { className: "rf-w-8 rf-h-8 rf-rounded-full rf-bg-blue-100 rf-flex rf-items-center rf-justify-center", children: loading ? /* @__PURE__ */ jsx11(Loader23, { className: "rf-h-5 rf-w-5 rf-text-blue-600 rf-animate-spin" }) : /* @__PURE__ */ jsx11("div", { className: "rf-h-2.5 rf-w-2.5 rf-rounded-full rf-bg-blue-600" }) }) }),
|
|
1828
|
-
/* @__PURE__ */ jsxs8("div", { className: "rf-flex-1", children: [
|
|
1829
|
-
/* @__PURE__ */ jsx11("p", { className: "rf-text-sm rf-font-medium rf-text-muted-foreground", children: "Current Step" }),
|
|
1830
|
-
/* @__PURE__ */ jsxs8("p", { className: "rf-font-medium rf-text-blue-600", children: [
|
|
1831
|
-
activeStep.order_step_id,
|
|
1832
|
-
". ",
|
|
1833
|
-
activeStep.title
|
|
1834
|
-
] })
|
|
1835
|
-
] })
|
|
1836
|
-
] })
|
|
1837
|
-
] }),
|
|
1838
|
-
/* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-justify-end rf-gap-3 rf-mt-auto", children: [
|
|
1839
|
-
onCancel && /* @__PURE__ */ jsx11(Button, { variant: "outline", onClick: onCancel, className: "rf-px-6", children: cancelButtonText }),
|
|
1840
|
-
onContinue && /* @__PURE__ */ jsx11(
|
|
1841
|
-
Button,
|
|
1842
|
-
{
|
|
1843
|
-
onClick: onContinue,
|
|
1844
|
-
className: "rf-px-6 rf-bg-gray-700 rf-hover:bg-gray-800",
|
|
1845
|
-
disabled: loading || !activeStep,
|
|
1846
|
-
children: loading ? /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1847
|
-
/* @__PURE__ */ jsx11(Loader23, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-animate-spin" }),
|
|
1848
|
-
"Processing..."
|
|
1849
|
-
] }) : continueButtonText
|
|
1850
|
-
}
|
|
1851
|
-
)
|
|
1852
|
-
] })
|
|
1853
|
-
] });
|
|
1854
|
-
};
|
|
1780
|
+
import { ArrowDown, Check as Check2, Loader2 as Loader23 } from "lucide-react";
|
|
1781
|
+
import { useQuery } from "react-query";
|
|
1855
1782
|
|
|
1856
|
-
// lib/
|
|
1857
|
-
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1783
|
+
// lib/utils/order-steps.ts
|
|
1858
1784
|
var orderSteps = [
|
|
1859
1785
|
{ order_step_id: 1, key: "are_gerbers_generated", title: "Generate Gerbers" },
|
|
1860
1786
|
{ order_step_id: 2, key: "are_gerbers_uploaded", title: "Upload Gerbers" },
|
|
@@ -1916,22 +1842,107 @@ var orderSteps = [
|
|
|
1916
1842
|
active: index === 0
|
|
1917
1843
|
// First step starts as active
|
|
1918
1844
|
}));
|
|
1845
|
+
|
|
1846
|
+
// lib/components/OrderDialog/StepwiseProgress.tsx
|
|
1847
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1848
|
+
var StepwiseProgressPanel = ({
|
|
1849
|
+
orderId,
|
|
1850
|
+
title = "Order PCB",
|
|
1851
|
+
onCancel,
|
|
1852
|
+
loading: externalLoading = false,
|
|
1853
|
+
setStage
|
|
1854
|
+
}) => {
|
|
1855
|
+
const { data, isLoading } = useQuery({
|
|
1856
|
+
queryKey: ["orderState", orderId],
|
|
1857
|
+
queryFn: async () => {
|
|
1858
|
+
const response = await ky2.get("registry/orders/get", {
|
|
1859
|
+
searchParams: { order_id: orderId },
|
|
1860
|
+
headers: {
|
|
1861
|
+
Authorization: `Bearer account-1234`
|
|
1862
|
+
}
|
|
1863
|
+
}).json();
|
|
1864
|
+
if (response.orderState.current_step === "is_added_to_cart") {
|
|
1865
|
+
setStage("checkout");
|
|
1866
|
+
}
|
|
1867
|
+
return response;
|
|
1868
|
+
},
|
|
1869
|
+
refetchInterval: 2e3,
|
|
1870
|
+
refetchIntervalInBackground: true
|
|
1871
|
+
});
|
|
1872
|
+
const steps = orderSteps.map((step) => {
|
|
1873
|
+
if (!data?.orderState) return step;
|
|
1874
|
+
const currentStepIndex = orderSteps.findIndex(
|
|
1875
|
+
(orderStep) => orderStep.key === data.orderState.current_step
|
|
1876
|
+
);
|
|
1877
|
+
const stepIndex = orderSteps.findIndex(
|
|
1878
|
+
(orderStep) => orderStep.key === step.key
|
|
1879
|
+
);
|
|
1880
|
+
return {
|
|
1881
|
+
...step,
|
|
1882
|
+
completed: stepIndex < currentStepIndex,
|
|
1883
|
+
active: stepIndex === currentStepIndex
|
|
1884
|
+
};
|
|
1885
|
+
});
|
|
1886
|
+
const completedSteps = steps.filter((step) => step.completed);
|
|
1887
|
+
const activeStep = steps.find((step) => step.active);
|
|
1888
|
+
const lastCompletedStep = completedSteps[completedSteps.length - 1];
|
|
1889
|
+
const totalSteps = steps.length;
|
|
1890
|
+
const progress = Math.round(completedSteps.length / totalSteps * 100);
|
|
1891
|
+
const loading = isLoading || externalLoading;
|
|
1892
|
+
return /* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-flex-col rf-bg-white rf-rounded-xl rf-p-6 rf-max-w-xl rf-w-full rf-mx-auto", children: [
|
|
1893
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-items-center rf-justify-between rf-mb-6", children: [
|
|
1894
|
+
/* @__PURE__ */ jsx11("h2", { className: "rf-text-2xl rf-font-bold", children: title }),
|
|
1895
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-text-sm rf-text-muted-foreground", children: [
|
|
1896
|
+
completedSteps.length,
|
|
1897
|
+
" of ",
|
|
1898
|
+
totalSteps,
|
|
1899
|
+
" completed"
|
|
1900
|
+
] })
|
|
1901
|
+
] }),
|
|
1902
|
+
/* @__PURE__ */ jsx11(Progress, { value: progress, className: "rf-h-2 rf-mb-8" }),
|
|
1903
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-space-y-6 rf-mb-8", children: [
|
|
1904
|
+
lastCompletedStep && /* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-items-start rf-gap-4", children: [
|
|
1905
|
+
/* @__PURE__ */ jsx11("div", { className: "rf-flex-shrink-0 rf-mt-0.5", children: /* @__PURE__ */ jsx11("div", { className: "rf-w-8 rf-h-8 rf-rounded-full rf-bg-green-100 rf-flex rf-items-center rf-justify-center", children: /* @__PURE__ */ jsx11(Check2, { className: "rf-h-5 rf-w-5 rf-text-green-600" }) }) }),
|
|
1906
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex-1", children: [
|
|
1907
|
+
/* @__PURE__ */ jsx11("p", { className: "rf-text-sm rf-font-medium rf-text-muted-foreground", children: "Last Completed" }),
|
|
1908
|
+
/* @__PURE__ */ jsxs8("p", { className: "rf-font-medium rf-text-green-600", children: [
|
|
1909
|
+
lastCompletedStep.order_step_id,
|
|
1910
|
+
". ",
|
|
1911
|
+
lastCompletedStep.title
|
|
1912
|
+
] })
|
|
1913
|
+
] })
|
|
1914
|
+
] }),
|
|
1915
|
+
lastCompletedStep && activeStep && /* @__PURE__ */ jsx11("div", { className: "rf-pl-4", children: /* @__PURE__ */ jsx11(ArrowDown, { className: "rf-h-5 rf-w-5 rf-text-muted-foreground" }) }),
|
|
1916
|
+
activeStep && /* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-items-start rf-gap-4", children: [
|
|
1917
|
+
/* @__PURE__ */ jsx11("div", { className: "rf-flex-shrink-0 rf-mt-0.5", children: /* @__PURE__ */ jsx11("div", { className: "rf-w-8 rf-h-8 rf-rounded-full rf-bg-blue-100 rf-flex rf-items-center rf-justify-center", children: loading ? /* @__PURE__ */ jsx11(Loader23, { className: "rf-h-5 rf-w-5 rf-text-blue-600 rf-animate-spin" }) : /* @__PURE__ */ jsx11("div", { className: "rf-h-2.5 rf-w-2.5 rf-rounded-full rf-bg-blue-600" }) }) }),
|
|
1918
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex-1", children: [
|
|
1919
|
+
/* @__PURE__ */ jsx11("p", { className: "rf-text-sm rf-font-medium rf-text-muted-foreground", children: "Current Step" }),
|
|
1920
|
+
/* @__PURE__ */ jsxs8("p", { className: "rf-font-medium rf-text-blue-600", children: [
|
|
1921
|
+
activeStep.order_step_id,
|
|
1922
|
+
". ",
|
|
1923
|
+
activeStep.title
|
|
1924
|
+
] })
|
|
1925
|
+
] })
|
|
1926
|
+
] })
|
|
1927
|
+
] }),
|
|
1928
|
+
/* @__PURE__ */ jsx11("div", { className: "rf-flex rf-justify-end rf-gap-3 rf-mt-auto", children: onCancel && /* @__PURE__ */ jsx11(Button, { variant: "outline", onClick: onCancel, className: "rf-px-6", children: "Cancel" }) })
|
|
1929
|
+
] });
|
|
1930
|
+
};
|
|
1931
|
+
|
|
1932
|
+
// lib/components/OrderDialog/OrderDialog.tsx
|
|
1933
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1934
|
+
var queryClient = new QueryClient();
|
|
1919
1935
|
var OrderDialog = ({
|
|
1920
1936
|
isOpen,
|
|
1921
1937
|
onClose,
|
|
1922
1938
|
stage,
|
|
1923
|
-
setStage
|
|
1939
|
+
setStage,
|
|
1940
|
+
circuitJson
|
|
1924
1941
|
}) => {
|
|
1925
1942
|
const [order, setOrder] = useState7(null);
|
|
1926
|
-
const [orderState, setOrderState] = useState7(null);
|
|
1927
|
-
const [steps, setSteps] = useState7(orderSteps);
|
|
1928
1943
|
const [loading, setLoading] = useState7(false);
|
|
1929
|
-
const circuitJson = useRunFrameStore((state) => state.circuitJson);
|
|
1930
|
-
const simulateScenarioOrder = useRunFrameStore(
|
|
1931
|
-
(state) => state.simulateScenarioOrder
|
|
1932
|
-
);
|
|
1933
1944
|
const createOrder = async () => {
|
|
1934
|
-
const { order: order2 } = await
|
|
1945
|
+
const { order: order2 } = await ky3.post("registry/orders/create", {
|
|
1935
1946
|
json: {
|
|
1936
1947
|
circuit_json: circuitJson
|
|
1937
1948
|
},
|
|
@@ -1941,57 +1952,12 @@ var OrderDialog = ({
|
|
|
1941
1952
|
}).json();
|
|
1942
1953
|
return order2;
|
|
1943
1954
|
};
|
|
1944
|
-
const
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
response = await ky2.get("registry/orders/get", {
|
|
1948
|
-
searchParams: {
|
|
1949
|
-
order_id: orderId,
|
|
1950
|
-
...simulateScenarioOrder ? { _simulate_scenario: simulateScenarioOrder } : {}
|
|
1951
|
-
},
|
|
1952
|
-
headers: {
|
|
1953
|
-
Authorization: `Bearer account-1234`
|
|
1954
|
-
}
|
|
1955
|
-
}).json();
|
|
1956
|
-
} catch (error) {
|
|
1957
|
-
console.error(error);
|
|
1958
|
-
}
|
|
1959
|
-
setOrder(response.order);
|
|
1960
|
-
setOrderState(response.orderState);
|
|
1955
|
+
const handleInitialContinue = async () => {
|
|
1956
|
+
const order2 = await createOrder();
|
|
1957
|
+
setOrder(order2);
|
|
1961
1958
|
setStage("progress");
|
|
1962
1959
|
};
|
|
1963
|
-
|
|
1964
|
-
setLoading(true);
|
|
1965
|
-
try {
|
|
1966
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
1967
|
-
setSteps((currentSteps) => {
|
|
1968
|
-
const activeStepIndex = currentSteps.findIndex((step) => step.active);
|
|
1969
|
-
if (activeStepIndex === -1) return currentSteps;
|
|
1970
|
-
const newSteps = [...currentSteps];
|
|
1971
|
-
newSteps[activeStepIndex] = {
|
|
1972
|
-
...newSteps[activeStepIndex],
|
|
1973
|
-
completed: true,
|
|
1974
|
-
active: false
|
|
1975
|
-
};
|
|
1976
|
-
if (activeStepIndex === currentSteps.length - 1) {
|
|
1977
|
-
setTimeout(() => setStage("checkout"), 500);
|
|
1978
|
-
} else {
|
|
1979
|
-
newSteps[activeStepIndex + 1] = {
|
|
1980
|
-
...newSteps[activeStepIndex + 1],
|
|
1981
|
-
active: true
|
|
1982
|
-
};
|
|
1983
|
-
}
|
|
1984
|
-
return newSteps;
|
|
1985
|
-
});
|
|
1986
|
-
} catch (error) {
|
|
1987
|
-
console.error(error);
|
|
1988
|
-
}
|
|
1989
|
-
setLoading(false);
|
|
1990
|
-
};
|
|
1991
|
-
const handleInitialContinue = () => {
|
|
1992
|
-
setStage("progress");
|
|
1993
|
-
};
|
|
1994
|
-
return /* @__PURE__ */ jsx12(AlertDialog, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ jsx12(AlertDialogContent, { className: "!rf-max-w-[660px] !rf-p-0", children: /* @__PURE__ */ jsxs9("div", { className: "rf-relative rf-w-full", children: [
|
|
1960
|
+
return /* @__PURE__ */ jsx12(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx12(AlertDialog, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ jsx12(AlertDialogContent, { className: "!rf-max-w-[660px] !rf-p-0", children: /* @__PURE__ */ jsxs9("div", { className: "rf-relative rf-w-full", children: [
|
|
1995
1961
|
stage === "initial" && /* @__PURE__ */ jsx12(
|
|
1996
1962
|
InitialOrderScreen,
|
|
1997
1963
|
{
|
|
@@ -1999,13 +1965,13 @@ var OrderDialog = ({
|
|
|
1999
1965
|
onContinue: handleInitialContinue
|
|
2000
1966
|
}
|
|
2001
1967
|
),
|
|
2002
|
-
stage === "progress" && /* @__PURE__ */ jsx12(
|
|
1968
|
+
stage === "progress" && order?.order_id && /* @__PURE__ */ jsx12(
|
|
2003
1969
|
StepwiseProgressPanel,
|
|
2004
1970
|
{
|
|
2005
|
-
steps,
|
|
2006
1971
|
onCancel: onClose,
|
|
2007
|
-
|
|
2008
|
-
|
|
1972
|
+
loading,
|
|
1973
|
+
orderId: order?.order_id,
|
|
1974
|
+
setStage
|
|
2009
1975
|
}
|
|
2010
1976
|
),
|
|
2011
1977
|
stage === "checkout" && /* @__PURE__ */ jsx12(
|
|
@@ -2013,14 +1979,51 @@ var OrderDialog = ({
|
|
|
2013
1979
|
{
|
|
2014
1980
|
finalCost: 0,
|
|
2015
1981
|
onConfirmCheckout: () => onClose(),
|
|
2016
|
-
|
|
1982
|
+
onCancel: () => onClose()
|
|
2017
1983
|
}
|
|
2018
1984
|
)
|
|
2019
|
-
] }) }) });
|
|
1985
|
+
] }) }) }) });
|
|
2020
1986
|
};
|
|
2021
1987
|
|
|
2022
|
-
// lib/components/OrderDialog/
|
|
1988
|
+
// lib/components/OrderDialog/CliOrderDialog.tsx
|
|
2023
1989
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1990
|
+
var CliOrderDialog = ({
|
|
1991
|
+
isOpen,
|
|
1992
|
+
onClose,
|
|
1993
|
+
stage,
|
|
1994
|
+
setStage
|
|
1995
|
+
}) => {
|
|
1996
|
+
const circuitJson = useRunFrameStore((state) => state.circuitJson);
|
|
1997
|
+
return /* @__PURE__ */ jsx13(
|
|
1998
|
+
OrderDialog,
|
|
1999
|
+
{
|
|
2000
|
+
isOpen,
|
|
2001
|
+
onClose,
|
|
2002
|
+
stage,
|
|
2003
|
+
setStage,
|
|
2004
|
+
circuitJson
|
|
2005
|
+
}
|
|
2006
|
+
);
|
|
2007
|
+
};
|
|
2008
|
+
|
|
2009
|
+
// lib/components/OrderDialog/useOrderDialog.tsx
|
|
2010
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2011
|
+
var OrderDialogComponent = ({
|
|
2012
|
+
isOpen,
|
|
2013
|
+
onClose,
|
|
2014
|
+
stage,
|
|
2015
|
+
setStage
|
|
2016
|
+
}) => {
|
|
2017
|
+
return /* @__PURE__ */ jsx14(
|
|
2018
|
+
CliOrderDialog,
|
|
2019
|
+
{
|
|
2020
|
+
isOpen,
|
|
2021
|
+
onClose,
|
|
2022
|
+
stage,
|
|
2023
|
+
setStage
|
|
2024
|
+
}
|
|
2025
|
+
);
|
|
2026
|
+
};
|
|
2024
2027
|
var useOrderDialog = () => {
|
|
2025
2028
|
const [isOpen, setIsOpen] = useState8(false);
|
|
2026
2029
|
const [stage, setStage] = useState8("initial");
|
|
@@ -2036,22 +2039,13 @@ var useOrderDialog = () => {
|
|
|
2036
2039
|
open: () => setIsOpen(true),
|
|
2037
2040
|
close: handleClose,
|
|
2038
2041
|
setStage,
|
|
2039
|
-
OrderDialog:
|
|
2040
|
-
|
|
2041
|
-
OrderDialog,
|
|
2042
|
-
{
|
|
2043
|
-
isOpen,
|
|
2044
|
-
onClose: handleClose,
|
|
2045
|
-
stage,
|
|
2046
|
-
setStage
|
|
2047
|
-
}
|
|
2048
|
-
);
|
|
2049
|
-
}
|
|
2042
|
+
OrderDialog: OrderDialogComponent
|
|
2043
|
+
// returns reference and not factory
|
|
2050
2044
|
};
|
|
2051
2045
|
};
|
|
2052
2046
|
|
|
2053
2047
|
// lib/components/RunFrameForCli/LeftHeader.tsx
|
|
2054
|
-
import { Fragment as
|
|
2048
|
+
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2055
2049
|
var RunframeCliLeftHeader = (props) => {
|
|
2056
2050
|
const lastRunEvalVersion = useRunnerStore((s) => s.lastRunEvalVersion);
|
|
2057
2051
|
const [snippetName, setSnippetName] = useState9(null);
|
|
@@ -2142,11 +2136,11 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2142
2136
|
};
|
|
2143
2137
|
const circuitJson = useRunFrameStore((state) => state.circuitJson);
|
|
2144
2138
|
const [isImportDialogOpen, setIsImportDialogOpen] = useState9(false);
|
|
2145
|
-
return /* @__PURE__ */ jsxs10(
|
|
2139
|
+
return /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
2146
2140
|
/* @__PURE__ */ jsxs10(DropdownMenu, { children: [
|
|
2147
|
-
/* @__PURE__ */
|
|
2141
|
+
/* @__PURE__ */ jsx15(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx15("div", { className: "rf-whitespace-nowrap rf-text-xs font-medium rf-p-2 rf-mx-1 rf-cursor-pointer rf-relative", children: "File" }) }),
|
|
2148
2142
|
/* @__PURE__ */ jsxs10(DropdownMenuContent, { children: [
|
|
2149
|
-
/* @__PURE__ */
|
|
2143
|
+
/* @__PURE__ */ jsx15(
|
|
2150
2144
|
DropdownMenuItem,
|
|
2151
2145
|
{
|
|
2152
2146
|
className: "rf-text-xs",
|
|
@@ -2155,7 +2149,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2155
2149
|
children: isSaving ? "Saving..." : "Push"
|
|
2156
2150
|
}
|
|
2157
2151
|
),
|
|
2158
|
-
parseInt(window.location.port) > 5e3 && /* @__PURE__ */
|
|
2152
|
+
parseInt(window.location.port) > 5e3 && /* @__PURE__ */ jsx15(
|
|
2159
2153
|
DropdownMenuItem,
|
|
2160
2154
|
{
|
|
2161
2155
|
className: "rf-text-xs",
|
|
@@ -2165,7 +2159,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2165
2159
|
children: "Order"
|
|
2166
2160
|
}
|
|
2167
2161
|
),
|
|
2168
|
-
/* @__PURE__ */
|
|
2162
|
+
/* @__PURE__ */ jsx15(
|
|
2169
2163
|
DropdownMenuItem,
|
|
2170
2164
|
{
|
|
2171
2165
|
className: "rf-text-xs",
|
|
@@ -2175,7 +2169,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2175
2169
|
}
|
|
2176
2170
|
),
|
|
2177
2171
|
/* @__PURE__ */ jsxs10(DropdownMenuSub, { children: [
|
|
2178
|
-
/* @__PURE__ */
|
|
2172
|
+
/* @__PURE__ */ jsx15(
|
|
2179
2173
|
DropdownMenuSubTrigger,
|
|
2180
2174
|
{
|
|
2181
2175
|
className: "rf-text-xs",
|
|
@@ -2183,7 +2177,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2183
2177
|
children: isExporting ? "Exporting..." : "Export"
|
|
2184
2178
|
}
|
|
2185
2179
|
),
|
|
2186
|
-
/* @__PURE__ */
|
|
2180
|
+
/* @__PURE__ */ jsx15(DropdownMenuPortal, { children: /* @__PURE__ */ jsx15(DropdownMenuSubContent, { children: availableExports.map((exp, i) => /* @__PURE__ */ jsx15(
|
|
2187
2181
|
DropdownMenuItem,
|
|
2188
2182
|
{
|
|
2189
2183
|
onSelect: () => {
|
|
@@ -2198,16 +2192,16 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2198
2192
|
});
|
|
2199
2193
|
},
|
|
2200
2194
|
disabled: isExporting,
|
|
2201
|
-
children: /* @__PURE__ */
|
|
2195
|
+
children: /* @__PURE__ */ jsx15("span", { className: "rf-text-xs", children: exp.name })
|
|
2202
2196
|
},
|
|
2203
2197
|
i
|
|
2204
2198
|
)) }) })
|
|
2205
2199
|
] }),
|
|
2206
2200
|
/* @__PURE__ */ jsxs10(DropdownMenuSub, { children: [
|
|
2207
|
-
/* @__PURE__ */
|
|
2208
|
-
/* @__PURE__ */
|
|
2209
|
-
/* @__PURE__ */
|
|
2210
|
-
/* @__PURE__ */
|
|
2201
|
+
/* @__PURE__ */ jsx15(DropdownMenuSubTrigger, { className: "rf-text-xs", children: "Advanced" }),
|
|
2202
|
+
/* @__PURE__ */ jsx15(DropdownMenuPortal, { children: /* @__PURE__ */ jsxs10(DropdownMenuSubContent, { children: [
|
|
2203
|
+
/* @__PURE__ */ jsx15(DropdownMenuItem, { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsxs10("div", { className: "rf-flex rf-items-center rf-gap-2", children: [
|
|
2204
|
+
/* @__PURE__ */ jsx15(
|
|
2211
2205
|
Checkbox,
|
|
2212
2206
|
{
|
|
2213
2207
|
id: "load-latest-eval",
|
|
@@ -2217,7 +2211,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2217
2211
|
}
|
|
2218
2212
|
}
|
|
2219
2213
|
),
|
|
2220
|
-
/* @__PURE__ */
|
|
2214
|
+
/* @__PURE__ */ jsx15(
|
|
2221
2215
|
"label",
|
|
2222
2216
|
{
|
|
2223
2217
|
htmlFor: "load-latest-eval",
|
|
@@ -2226,31 +2220,31 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2226
2220
|
}
|
|
2227
2221
|
)
|
|
2228
2222
|
] }) }),
|
|
2229
|
-
lastRunEvalVersion && /* @__PURE__ */
|
|
2223
|
+
lastRunEvalVersion && /* @__PURE__ */ jsx15(DropdownMenuItem, { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsx15("div", { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsxs10("span", { className: "rf-text-xs", children: [
|
|
2230
2224
|
"@tscircuit/eval@",
|
|
2231
2225
|
lastRunEvalVersion
|
|
2232
2226
|
] }) }) }),
|
|
2233
|
-
/* @__PURE__ */
|
|
2227
|
+
/* @__PURE__ */ jsx15(
|
|
2234
2228
|
DropdownMenuItem,
|
|
2235
2229
|
{
|
|
2236
2230
|
className: "rf-flex rf-items-center rf-gap-2",
|
|
2237
2231
|
onClick: () => {
|
|
2238
2232
|
window.open("/api/admin", "_blank");
|
|
2239
2233
|
},
|
|
2240
|
-
children: /* @__PURE__ */
|
|
2234
|
+
children: /* @__PURE__ */ jsx15("div", { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsx15("span", { className: "rf-text-xs", children: "CLI Admin Panel" }) })
|
|
2241
2235
|
}
|
|
2242
2236
|
)
|
|
2243
2237
|
] }) })
|
|
2244
2238
|
] })
|
|
2245
2239
|
] }),
|
|
2246
|
-
/* @__PURE__ */
|
|
2240
|
+
/* @__PURE__ */ jsx15(AlertDialog, { open: isError, onOpenChange: setIsError, children: /* @__PURE__ */ jsxs10(AlertDialogContent, { children: [
|
|
2247
2241
|
/* @__PURE__ */ jsxs10(AlertDialogHeader, { children: [
|
|
2248
|
-
/* @__PURE__ */
|
|
2249
|
-
/* @__PURE__ */
|
|
2242
|
+
/* @__PURE__ */ jsx15(AlertDialogTitle, { children: "Error Saving Snippet" }),
|
|
2243
|
+
/* @__PURE__ */ jsx15(AlertDialogDescription, { children: errorMessage })
|
|
2250
2244
|
] }),
|
|
2251
|
-
/* @__PURE__ */
|
|
2245
|
+
/* @__PURE__ */ jsx15(AlertDialogFooter, { children: /* @__PURE__ */ jsx15(AlertDialogCancel, { onClick: () => setIsError(false), children: "Dismiss" }) })
|
|
2252
2246
|
] }) }),
|
|
2253
|
-
/* @__PURE__ */
|
|
2247
|
+
/* @__PURE__ */ jsx15(
|
|
2254
2248
|
SelectSnippetDialog,
|
|
2255
2249
|
{
|
|
2256
2250
|
snippetNames: availableSnippets ?? [],
|
|
@@ -2269,7 +2263,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2269
2263
|
}
|
|
2270
2264
|
)
|
|
2271
2265
|
] }),
|
|
2272
|
-
/* @__PURE__ */
|
|
2266
|
+
/* @__PURE__ */ jsx15(
|
|
2273
2267
|
ImportComponentDialog,
|
|
2274
2268
|
{
|
|
2275
2269
|
isOpen: isImportDialogOpen,
|
|
@@ -2298,19 +2292,27 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2298
2292
|
}
|
|
2299
2293
|
}
|
|
2300
2294
|
),
|
|
2301
|
-
/* @__PURE__ */
|
|
2302
|
-
/* @__PURE__ */
|
|
2295
|
+
/* @__PURE__ */ jsx15(Toaster, { position: "top-center", reverseOrder: false }),
|
|
2296
|
+
/* @__PURE__ */ jsx15(
|
|
2297
|
+
orderDialog.OrderDialog,
|
|
2298
|
+
{
|
|
2299
|
+
isOpen: orderDialog.isOpen,
|
|
2300
|
+
onClose: orderDialog.close,
|
|
2301
|
+
stage: orderDialog.stage,
|
|
2302
|
+
setStage: orderDialog.setStage
|
|
2303
|
+
}
|
|
2304
|
+
)
|
|
2303
2305
|
] });
|
|
2304
2306
|
};
|
|
2305
2307
|
|
|
2306
2308
|
// lib/components/RunFrameForCli/RunFrameForCli.tsx
|
|
2307
|
-
import { jsx as
|
|
2309
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2308
2310
|
var RunFrameForCli = (props) => {
|
|
2309
2311
|
const [shouldLoadLatestEval, setLoadLatestEval] = useLocalStorageState(
|
|
2310
2312
|
"load-latest-eval",
|
|
2311
2313
|
true
|
|
2312
2314
|
);
|
|
2313
|
-
return /* @__PURE__ */
|
|
2315
|
+
return /* @__PURE__ */ jsx16(
|
|
2314
2316
|
RunFrameWithApi,
|
|
2315
2317
|
{
|
|
2316
2318
|
debug: props.debug,
|
|
@@ -2318,7 +2320,7 @@ var RunFrameForCli = (props) => {
|
|
|
2318
2320
|
defaultToFullScreen: true,
|
|
2319
2321
|
showToggleFullScreen: false,
|
|
2320
2322
|
leftHeaderContent: /* @__PURE__ */ jsxs11("div", { className: "rf-flex rf-items-center rf-justify-between", children: [
|
|
2321
|
-
/* @__PURE__ */
|
|
2323
|
+
/* @__PURE__ */ jsx16(
|
|
2322
2324
|
RunframeCliLeftHeader,
|
|
2323
2325
|
{
|
|
2324
2326
|
shouldLoadLatestEval,
|