@tscircuit/runframe 0.0.288 → 0.0.301
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-QBYYLV3Y.js → chunk-MXMBJL7E.js} +12 -3
- package/dist/preview.d.ts +16 -1
- package/dist/preview.js +13 -3
- package/dist/runner.d.ts +6 -1
- package/dist/runner.js +636 -116
- package/dist/standalone-preview.min.js +992 -1182
- package/dist/standalone.min.js +1026 -1201
- package/package.json +9 -8
package/dist/runner.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BomTable,
|
|
2
3
|
Button,
|
|
3
4
|
CircuitJsonPreview,
|
|
4
5
|
DropdownMenu,
|
|
@@ -9,12 +10,16 @@ import {
|
|
|
9
10
|
DropdownMenuSubContent,
|
|
10
11
|
DropdownMenuSubTrigger,
|
|
11
12
|
DropdownMenuTrigger,
|
|
13
|
+
PCBViewer,
|
|
14
|
+
PcbViewerWithContainerHeight,
|
|
15
|
+
SchematicViewer,
|
|
12
16
|
Tabs,
|
|
13
17
|
TabsList,
|
|
14
18
|
TabsTrigger,
|
|
15
19
|
buttonVariants,
|
|
16
|
-
cn
|
|
17
|
-
|
|
20
|
+
cn,
|
|
21
|
+
linkify
|
|
22
|
+
} from "./chunk-MXMBJL7E.js";
|
|
18
23
|
|
|
19
24
|
// lib/components/RunFrame/RunFrame.tsx
|
|
20
25
|
import { createCircuitWebWorker } from "@tscircuit/eval/worker";
|
|
@@ -22,13 +27,6 @@ import { useEffect, useReducer, useRef as useRef2, useState } from "react";
|
|
|
22
27
|
import Debug2 from "debug";
|
|
23
28
|
import { Loader2, Play, Square } from "lucide-react";
|
|
24
29
|
|
|
25
|
-
// lib/components/RunFrameWithApi/store.ts
|
|
26
|
-
import { create } from "zustand";
|
|
27
|
-
import { devtools } from "zustand/middleware";
|
|
28
|
-
|
|
29
|
-
// lib/components/RunFrameWithApi/api-base.ts
|
|
30
|
-
var API_BASE = window.API_BASE_URL ?? "/api";
|
|
31
|
-
|
|
32
30
|
// lib/components/RunFrameWithApi/store.ts
|
|
33
31
|
import { applyEditEventsToManualEditsFile } from "@tscircuit/core";
|
|
34
32
|
|
|
@@ -37,6 +35,13 @@ import Debug from "debug";
|
|
|
37
35
|
var debug = Debug("run-frame");
|
|
38
36
|
var debug_default = debug;
|
|
39
37
|
|
|
38
|
+
// lib/components/RunFrameWithApi/store.ts
|
|
39
|
+
import { create } from "zustand";
|
|
40
|
+
import { devtools } from "zustand/middleware";
|
|
41
|
+
|
|
42
|
+
// lib/components/RunFrameWithApi/api-base.ts
|
|
43
|
+
var API_BASE = window.API_BASE_URL ?? "/api";
|
|
44
|
+
|
|
40
45
|
// lib/components/RunFrameWithApi/store.ts
|
|
41
46
|
var debug2 = debug_default.extend("store");
|
|
42
47
|
async function upsertFileApi(path, content) {
|
|
@@ -81,6 +86,7 @@ var useRunFrameStore = create()(
|
|
|
81
86
|
circuitJson: null,
|
|
82
87
|
lastManualEditsChangeSentAt: 0,
|
|
83
88
|
recentEvents: [],
|
|
89
|
+
simulateScenarioOrder: void 0,
|
|
84
90
|
loadInitialFiles: async () => {
|
|
85
91
|
const fsMap = await getInitialFilesApi();
|
|
86
92
|
debug2("loaded initial files", { fsMap });
|
|
@@ -181,7 +187,8 @@ var useRunFrameStore = create()(
|
|
|
181
187
|
"manual-edits.json",
|
|
182
188
|
JSON.stringify(updatedManualEditsFileContent, null, 2)
|
|
183
189
|
);
|
|
184
|
-
}
|
|
190
|
+
},
|
|
191
|
+
setSimulateScenarioOrder: (scenarioOrder) => set({ simulateScenarioOrder: scenarioOrder })
|
|
185
192
|
}),
|
|
186
193
|
{ name: "run-frame-store" }
|
|
187
194
|
)
|
|
@@ -763,7 +770,7 @@ function useLocalStorageState(key, initialValue) {
|
|
|
763
770
|
}
|
|
764
771
|
|
|
765
772
|
// lib/components/RunFrameForCli/LeftHeader.tsx
|
|
766
|
-
import { useEffect as
|
|
773
|
+
import { useEffect as useEffect7, useMemo as useMemo3, useState as useState9 } from "react";
|
|
767
774
|
|
|
768
775
|
// lib/components/RunFrameForCli/SelectSnippetDialog.tsx
|
|
769
776
|
import { useState as useState4 } from "react";
|
|
@@ -1462,102 +1469,607 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber) => {
|
|
|
1462
1469
|
};
|
|
1463
1470
|
|
|
1464
1471
|
// lib/components/OrderDialog/useOrderDialog.tsx
|
|
1465
|
-
import { useState as
|
|
1472
|
+
import { useState as useState8 } from "react";
|
|
1466
1473
|
|
|
1467
1474
|
// lib/components/OrderDialog/OrderDialog.tsx
|
|
1468
|
-
import { useState as useState6 } from "react";
|
|
1469
1475
|
import ky2 from "ky";
|
|
1476
|
+
import { useState as useState7 } from "react";
|
|
1477
|
+
|
|
1478
|
+
// lib/components/OrderDialog/CheckoutOrder.tsx
|
|
1479
|
+
import { MapPin } from "lucide-react";
|
|
1480
|
+
import { useState as useState6 } from "react";
|
|
1481
|
+
import { toast as toast2 } from "react-hot-toast";
|
|
1470
1482
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1471
|
-
var
|
|
1472
|
-
|
|
1473
|
-
|
|
1483
|
+
var CheckoutOrder = ({
|
|
1484
|
+
finalCost,
|
|
1485
|
+
onConfirmCheckout,
|
|
1486
|
+
onBack
|
|
1474
1487
|
}) => {
|
|
1475
|
-
const [
|
|
1476
|
-
|
|
1477
|
-
"setup"
|
|
1488
|
+
const [selectedAddressId, setSelectedAddressId] = useState6(
|
|
1489
|
+
null
|
|
1478
1490
|
);
|
|
1479
|
-
const
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
"
|
|
1491
|
+
const [savedAddresses] = useState6([
|
|
1492
|
+
{
|
|
1493
|
+
id: 1,
|
|
1494
|
+
name: "Home",
|
|
1495
|
+
street: "123 Main St",
|
|
1496
|
+
city: "San Francisco",
|
|
1497
|
+
state: "CA",
|
|
1498
|
+
zipCode: "94105",
|
|
1499
|
+
country: "USA",
|
|
1500
|
+
isDefault: true
|
|
1501
|
+
},
|
|
1502
|
+
{
|
|
1503
|
+
id: 2,
|
|
1504
|
+
name: "Office",
|
|
1505
|
+
street: "456 Market St",
|
|
1506
|
+
city: "San Francisco",
|
|
1507
|
+
state: "CA",
|
|
1508
|
+
zipCode: "94103",
|
|
1509
|
+
country: "USA",
|
|
1510
|
+
isDefault: false
|
|
1511
|
+
}
|
|
1512
|
+
]);
|
|
1513
|
+
const [addressForm, setAddressForm] = useState6({
|
|
1514
|
+
name: "",
|
|
1515
|
+
street: "",
|
|
1516
|
+
city: "",
|
|
1517
|
+
state: "",
|
|
1518
|
+
zipCode: "",
|
|
1519
|
+
country: ""
|
|
1520
|
+
});
|
|
1521
|
+
const handleInputChange = (e) => {
|
|
1522
|
+
const { name, value } = e.target;
|
|
1523
|
+
setAddressForm((prev) => ({
|
|
1524
|
+
...prev,
|
|
1525
|
+
[name]: value
|
|
1526
|
+
}));
|
|
1527
|
+
};
|
|
1528
|
+
const handleSelectAddress = (addressId) => {
|
|
1529
|
+
setSelectedAddressId(addressId);
|
|
1530
|
+
const selectedAddress = savedAddresses.find((addr) => addr.id === addressId);
|
|
1531
|
+
if (selectedAddress) {
|
|
1532
|
+
setAddressForm({
|
|
1533
|
+
name: selectedAddress.name,
|
|
1534
|
+
street: selectedAddress.street,
|
|
1535
|
+
city: selectedAddress.city,
|
|
1536
|
+
state: selectedAddress.state,
|
|
1537
|
+
zipCode: selectedAddress.zipCode,
|
|
1538
|
+
country: selectedAddress.country
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
const handleConfirmCheckout = () => {
|
|
1543
|
+
if (!selectedAddressId && (!addressForm.street || !addressForm.city || !addressForm.zipCode)) {
|
|
1544
|
+
toast2.error("Please provide a complete shipping address.");
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
toast2.success("Your PCB order has been placed successfully.");
|
|
1548
|
+
onConfirmCheckout();
|
|
1549
|
+
};
|
|
1550
|
+
return /* @__PURE__ */ jsxs6("div", { className: "rf-bg-white rf-rounded-xl rf-p-6 rf-mx-auto", children: [
|
|
1551
|
+
/* @__PURE__ */ jsx8("h2", { className: "rf-text-2xl rf-font-bold rf-mb-6", children: "Checkout" }),
|
|
1552
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-grid rf-grid-cols-1 md:rf-grid-cols-2 rf-gap-8", children: [
|
|
1553
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-space-y-6", children: [
|
|
1554
|
+
/* @__PURE__ */ jsx8("h3", { className: "rf-text-lg rf-font-semibold", children: "Shipping Address" }),
|
|
1555
|
+
savedAddresses.length > 0 && /* @__PURE__ */ jsxs6("div", { className: "rf-space-y-4", children: [
|
|
1556
|
+
/* @__PURE__ */ jsx8("div", { className: "rf-text-sm rf-font-medium rf-text-gray-500", children: "Saved Addresses" }),
|
|
1557
|
+
/* @__PURE__ */ jsx8("div", { className: "rf-flex rf-flex-wrap rf-gap-3", children: savedAddresses.map((address) => /* @__PURE__ */ jsxs6(
|
|
1558
|
+
"button",
|
|
1559
|
+
{
|
|
1560
|
+
type: "button",
|
|
1561
|
+
onClick: () => handleSelectAddress(address.id),
|
|
1562
|
+
className: cn(
|
|
1563
|
+
"rf-flex rf-items-center rf-gap-2 rf-px-3 rf-py-2 rf-text-sm rf-rounded-md rf-border rf-transition-colors",
|
|
1564
|
+
selectedAddressId === address.id ? "rf-border-blue-500 rf-bg-blue-50 rf-text-blue-700" : "rf-border-gray-200 rf-hover:bg-gray-50"
|
|
1565
|
+
),
|
|
1566
|
+
children: [
|
|
1567
|
+
/* @__PURE__ */ jsx8(MapPin, { className: "rf-h-4 rf-w-4" }),
|
|
1568
|
+
/* @__PURE__ */ jsx8("span", { children: address.name }),
|
|
1569
|
+
address.isDefault && /* @__PURE__ */ jsx8("span", { className: "rf-inline-flex rf-items-center rf-rounded-full rf-bg-blue-100 rf-px-2 rf-py-0.5 rf-text-xs rf-font-medium rf-text-blue-800", children: "Default" })
|
|
1570
|
+
]
|
|
1571
|
+
},
|
|
1572
|
+
address.id
|
|
1573
|
+
)) })
|
|
1574
|
+
] }),
|
|
1575
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-space-y-4", children: [
|
|
1576
|
+
/* @__PURE__ */ jsx8("div", { className: "rf-grid rf-grid-cols-2 rf-gap-4", children: /* @__PURE__ */ jsxs6("div", { className: "rf-space-y-2", children: [
|
|
1577
|
+
/* @__PURE__ */ jsx8("label", { htmlFor: "name", children: "Address Name" }),
|
|
1578
|
+
/* @__PURE__ */ jsx8(
|
|
1579
|
+
Input,
|
|
1580
|
+
{
|
|
1581
|
+
id: "name",
|
|
1582
|
+
name: "name",
|
|
1583
|
+
placeholder: "Home, Office, etc.",
|
|
1584
|
+
value: addressForm.name,
|
|
1585
|
+
onChange: handleInputChange
|
|
1586
|
+
}
|
|
1587
|
+
)
|
|
1588
|
+
] }) }),
|
|
1589
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-space-y-2", children: [
|
|
1590
|
+
/* @__PURE__ */ jsx8("label", { htmlFor: "street", children: "Street Address" }),
|
|
1591
|
+
/* @__PURE__ */ jsx8(
|
|
1592
|
+
Input,
|
|
1593
|
+
{
|
|
1594
|
+
id: "street",
|
|
1595
|
+
name: "street",
|
|
1596
|
+
placeholder: "123 Main St",
|
|
1597
|
+
value: addressForm.street,
|
|
1598
|
+
onChange: handleInputChange
|
|
1599
|
+
}
|
|
1600
|
+
)
|
|
1601
|
+
] }),
|
|
1602
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-grid rf-grid-cols-2 rf-gap-4", children: [
|
|
1603
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-space-y-2", children: [
|
|
1604
|
+
/* @__PURE__ */ jsx8("label", { htmlFor: "city", children: "City" }),
|
|
1605
|
+
/* @__PURE__ */ jsx8(
|
|
1606
|
+
Input,
|
|
1607
|
+
{
|
|
1608
|
+
id: "city",
|
|
1609
|
+
name: "city",
|
|
1610
|
+
placeholder: "City",
|
|
1611
|
+
value: addressForm.city,
|
|
1612
|
+
onChange: handleInputChange
|
|
1613
|
+
}
|
|
1614
|
+
)
|
|
1615
|
+
] }),
|
|
1616
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-space-y-2", children: [
|
|
1617
|
+
/* @__PURE__ */ jsx8("label", { htmlFor: "state", children: "State" }),
|
|
1618
|
+
/* @__PURE__ */ jsx8(
|
|
1619
|
+
Input,
|
|
1620
|
+
{
|
|
1621
|
+
id: "state",
|
|
1622
|
+
name: "state",
|
|
1623
|
+
placeholder: "State",
|
|
1624
|
+
value: addressForm.state,
|
|
1625
|
+
onChange: handleInputChange
|
|
1626
|
+
}
|
|
1627
|
+
)
|
|
1628
|
+
] })
|
|
1629
|
+
] }),
|
|
1630
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-grid rf-grid-cols-2 rf-gap-4", children: [
|
|
1631
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-space-y-2", children: [
|
|
1632
|
+
/* @__PURE__ */ jsx8("label", { htmlFor: "zipCode", children: "Zip Code" }),
|
|
1633
|
+
/* @__PURE__ */ jsx8(
|
|
1634
|
+
Input,
|
|
1635
|
+
{
|
|
1636
|
+
id: "zipCode",
|
|
1637
|
+
name: "zipCode",
|
|
1638
|
+
placeholder: "Zip Code",
|
|
1639
|
+
value: addressForm.zipCode,
|
|
1640
|
+
onChange: handleInputChange
|
|
1641
|
+
}
|
|
1642
|
+
)
|
|
1643
|
+
] }),
|
|
1644
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-space-y-2", children: [
|
|
1645
|
+
/* @__PURE__ */ jsx8("label", { htmlFor: "country", children: "Country" }),
|
|
1646
|
+
/* @__PURE__ */ jsx8(
|
|
1647
|
+
Input,
|
|
1648
|
+
{
|
|
1649
|
+
id: "country",
|
|
1650
|
+
name: "country",
|
|
1651
|
+
placeholder: "Country",
|
|
1652
|
+
value: addressForm.country,
|
|
1653
|
+
onChange: handleInputChange
|
|
1654
|
+
}
|
|
1655
|
+
)
|
|
1656
|
+
] })
|
|
1657
|
+
] })
|
|
1658
|
+
] })
|
|
1659
|
+
] }),
|
|
1660
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-bg-gray-50 rf-p-6 rf-rounded-lg", children: [
|
|
1661
|
+
/* @__PURE__ */ jsx8("h3", { className: "rf-text-lg rf-font-semibold rf-mb-4", children: "Order Summary" }),
|
|
1662
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-space-y-4", children: [
|
|
1663
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-flex rf-justify-between rf-py-2 rf-border-b rf-border-gray-200", children: [
|
|
1664
|
+
/* @__PURE__ */ jsx8("span", { className: "rf-text-gray-600", children: "PCB Manufacturing" }),
|
|
1665
|
+
/* @__PURE__ */ jsxs6("span", { className: "rf-font-medium", children: [
|
|
1666
|
+
"$",
|
|
1667
|
+
(finalCost * 0.6).toFixed(2)
|
|
1668
|
+
] })
|
|
1669
|
+
] }),
|
|
1670
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-flex rf-justify-between rf-py-2 rf-border-b rf-border-gray-200", children: [
|
|
1671
|
+
/* @__PURE__ */ jsx8("span", { className: "rf-text-gray-600", children: "Components" }),
|
|
1672
|
+
/* @__PURE__ */ jsxs6("span", { className: "rf-font-medium", children: [
|
|
1673
|
+
"$",
|
|
1674
|
+
(finalCost * 0.3).toFixed(2)
|
|
1675
|
+
] })
|
|
1676
|
+
] }),
|
|
1677
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-flex rf-justify-between rf-py-2 rf-border-b rf-border-gray-200", children: [
|
|
1678
|
+
/* @__PURE__ */ jsx8("span", { className: "rf-text-gray-600", children: "Assembly" }),
|
|
1679
|
+
/* @__PURE__ */ jsxs6("span", { className: "rf-font-medium", children: [
|
|
1680
|
+
"$",
|
|
1681
|
+
(finalCost * 0.1).toFixed(2)
|
|
1682
|
+
] })
|
|
1683
|
+
] }),
|
|
1684
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-flex rf-justify-between rf-py-2 rf-border-b rf-border-gray-200", children: [
|
|
1685
|
+
/* @__PURE__ */ jsx8("span", { className: "rf-text-gray-600", children: "Shipping" }),
|
|
1686
|
+
/* @__PURE__ */ jsx8("span", { className: "rf-font-medium", children: "$15.00" })
|
|
1687
|
+
] }),
|
|
1688
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-flex rf-justify-between rf-py-2 rf-text-lg rf-font-bold", children: [
|
|
1689
|
+
/* @__PURE__ */ jsx8("span", { children: "Total" }),
|
|
1690
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1691
|
+
"$",
|
|
1692
|
+
(finalCost + 15).toFixed(2)
|
|
1693
|
+
] })
|
|
1694
|
+
] }),
|
|
1695
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-pt-4", children: [
|
|
1696
|
+
/* @__PURE__ */ jsx8(
|
|
1697
|
+
Button,
|
|
1698
|
+
{
|
|
1699
|
+
onClick: handleConfirmCheckout,
|
|
1700
|
+
className: "rf-w-full rf-bg-gray-700 rf-hover:bg-gray-800 rf-text-white rf-py-3",
|
|
1701
|
+
children: "Confirm and Place Order"
|
|
1702
|
+
}
|
|
1703
|
+
),
|
|
1704
|
+
/* @__PURE__ */ jsx8(
|
|
1705
|
+
Button,
|
|
1706
|
+
{
|
|
1707
|
+
variant: "outline",
|
|
1708
|
+
onClick: onBack,
|
|
1709
|
+
className: "rf-w-full rf-mt-3",
|
|
1710
|
+
children: "Back to PCB Order"
|
|
1711
|
+
}
|
|
1712
|
+
)
|
|
1713
|
+
] })
|
|
1714
|
+
] })
|
|
1715
|
+
] })
|
|
1716
|
+
] })
|
|
1717
|
+
] });
|
|
1718
|
+
};
|
|
1719
|
+
|
|
1720
|
+
// lib/components/OrderDialog/InitialOrder.tsx
|
|
1721
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1722
|
+
var InitialOrderScreen = ({
|
|
1723
|
+
onCancel,
|
|
1724
|
+
onContinue
|
|
1725
|
+
}) => {
|
|
1726
|
+
return /* @__PURE__ */ jsxs7("div", { className: "rf-flex rf-flex-col rf-bg-white rf-rounded-xl rf-p-8 rf-max-w-md rf-w-full rf-mx-auto", children: [
|
|
1727
|
+
/* @__PURE__ */ jsx9("h2", { className: "rf-text-3xl rf-font-bold rf-text-center rf-mb-8", children: "Order" }),
|
|
1728
|
+
/* @__PURE__ */ jsx9("p", { className: "rf-text-lg rf-text-center rf-mb-12", children: "Want to place an order?" }),
|
|
1729
|
+
/* @__PURE__ */ jsxs7("div", { className: "rf-flex rf-justify-between rf-mt-auto", children: [
|
|
1730
|
+
/* @__PURE__ */ jsx9(
|
|
1731
|
+
Button,
|
|
1732
|
+
{
|
|
1733
|
+
variant: "outline",
|
|
1734
|
+
onClick: onCancel,
|
|
1735
|
+
className: "rf-px-8 rf-border-red-500 rf-text-red-500 rf-hover:bg-red-50 rf-hover:text-red-600",
|
|
1736
|
+
children: "Cancel"
|
|
1737
|
+
}
|
|
1738
|
+
),
|
|
1739
|
+
/* @__PURE__ */ jsx9(
|
|
1740
|
+
Button,
|
|
1741
|
+
{
|
|
1742
|
+
onClick: onContinue,
|
|
1743
|
+
className: "rf-px-8 rf-bg-gray-700 rf-hover:bg-gray-800",
|
|
1744
|
+
children: "Continue"
|
|
1745
|
+
}
|
|
1746
|
+
)
|
|
1747
|
+
] })
|
|
1748
|
+
] });
|
|
1749
|
+
};
|
|
1750
|
+
|
|
1751
|
+
// lib/components/OrderDialog/StepwiseProgress.tsx
|
|
1752
|
+
import { Check as Check2, Loader2 as Loader23, ArrowDown } from "lucide-react";
|
|
1753
|
+
|
|
1754
|
+
// lib/components/ui/progress.tsx
|
|
1755
|
+
import * as React5 from "react";
|
|
1756
|
+
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
1757
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1758
|
+
var Progress = React5.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
1759
|
+
ProgressPrimitive.Root,
|
|
1760
|
+
{
|
|
1761
|
+
ref,
|
|
1762
|
+
className: cn(
|
|
1763
|
+
"rf-relative rf-h-2 rf-w-full rf-overflow-hidden rf-rounded-full rf-bg-zinc-100 dark:rf-bg-zinc-800",
|
|
1764
|
+
className
|
|
1765
|
+
),
|
|
1766
|
+
...props,
|
|
1767
|
+
children: /* @__PURE__ */ jsx10(
|
|
1768
|
+
ProgressPrimitive.Indicator,
|
|
1487
1769
|
{
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
overflowY: "scroll",
|
|
1491
|
-
fontSize: "8px"
|
|
1492
|
-
},
|
|
1493
|
-
children: JSON.stringify(order, null, 2)
|
|
1770
|
+
className: "rf-h-full rf-w-full rf-flex-1 rf-bg-zinc-900 rf-transition-all dark:rf-bg-zinc-50",
|
|
1771
|
+
style: { transform: `translateX(-${100 - (value || 0)}%)` }
|
|
1494
1772
|
}
|
|
1495
|
-
)
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1773
|
+
)
|
|
1774
|
+
}
|
|
1775
|
+
));
|
|
1776
|
+
Progress.displayName = "Progress";
|
|
1777
|
+
|
|
1778
|
+
// lib/components/OrderDialog/StepwiseProgress.tsx
|
|
1779
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1780
|
+
var StepwiseProgressPanel = ({
|
|
1781
|
+
steps,
|
|
1782
|
+
title = "Order PCB",
|
|
1783
|
+
onCancel,
|
|
1784
|
+
onContinue,
|
|
1785
|
+
continueButtonText = "Continue",
|
|
1786
|
+
cancelButtonText = "Cancel",
|
|
1787
|
+
loading = false
|
|
1788
|
+
}) => {
|
|
1789
|
+
const completedSteps = steps.filter((step) => step.completed);
|
|
1790
|
+
const activeStep = steps.find((step) => step.active);
|
|
1791
|
+
const totalSteps = steps.length;
|
|
1792
|
+
const progress = Math.round(completedSteps.length / totalSteps * 100);
|
|
1793
|
+
const displayedCompletedSteps = completedSteps.slice(-1);
|
|
1794
|
+
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: [
|
|
1795
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-items-center rf-justify-between rf-mb-6", children: [
|
|
1796
|
+
/* @__PURE__ */ jsx11("h2", { className: "rf-text-2xl rf-font-bold", children: title }),
|
|
1797
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-text-sm rf-text-muted-foreground", children: [
|
|
1798
|
+
completedSteps.length,
|
|
1799
|
+
" of ",
|
|
1800
|
+
totalSteps,
|
|
1801
|
+
" completed"
|
|
1802
|
+
] })
|
|
1803
|
+
] }),
|
|
1804
|
+
/* @__PURE__ */ jsx11(Progress, { value: progress, className: "rf-h-2 rf-mb-8" }),
|
|
1805
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-space-y-6 rf-mb-8", children: [
|
|
1806
|
+
displayedCompletedSteps.map((step, index) => /* @__PURE__ */ jsxs8(
|
|
1807
|
+
"div",
|
|
1808
|
+
{
|
|
1809
|
+
className: "rf-flex rf-items-start rf-gap-4",
|
|
1810
|
+
children: [
|
|
1811
|
+
/* @__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" }) }) }),
|
|
1812
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex-1", children: [
|
|
1813
|
+
/* @__PURE__ */ jsx11("p", { className: "rf-text-sm rf-font-medium rf-text-muted-foreground", children: index === displayedCompletedSteps.length - 1 ? "Last Completed" : "Completed" }),
|
|
1814
|
+
/* @__PURE__ */ jsxs8("p", { className: "rf-font-medium rf-text-green-600", children: [
|
|
1815
|
+
step.order_step_id,
|
|
1816
|
+
". ",
|
|
1817
|
+
step.title
|
|
1818
|
+
] })
|
|
1819
|
+
] })
|
|
1820
|
+
]
|
|
1821
|
+
},
|
|
1822
|
+
step.order_step_id
|
|
1823
|
+
)),
|
|
1824
|
+
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" }) }),
|
|
1825
|
+
activeStep && /* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-items-start rf-gap-4", children: [
|
|
1826
|
+
/* @__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" }) }) }),
|
|
1827
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex-1", children: [
|
|
1828
|
+
/* @__PURE__ */ jsx11("p", { className: "rf-text-sm rf-font-medium rf-text-muted-foreground", children: "Current Step" }),
|
|
1829
|
+
/* @__PURE__ */ jsxs8("p", { className: "rf-font-medium rf-text-blue-600", children: [
|
|
1830
|
+
activeStep.order_step_id,
|
|
1831
|
+
". ",
|
|
1832
|
+
activeStep.title
|
|
1833
|
+
] })
|
|
1834
|
+
] })
|
|
1835
|
+
] })
|
|
1836
|
+
] }),
|
|
1837
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-justify-end rf-gap-3 rf-mt-auto", children: [
|
|
1838
|
+
onCancel && /* @__PURE__ */ jsx11(Button, { variant: "outline", onClick: onCancel, className: "rf-px-6", children: cancelButtonText }),
|
|
1839
|
+
onContinue && /* @__PURE__ */ jsx11(
|
|
1499
1840
|
Button,
|
|
1500
1841
|
{
|
|
1501
|
-
onClick:
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
},
|
|
1509
|
-
headers: {
|
|
1510
|
-
Authorization: `Bearer account-1234`
|
|
1511
|
-
}
|
|
1512
|
-
}).json();
|
|
1513
|
-
setOrder(order2);
|
|
1514
|
-
setStage("order-progress");
|
|
1515
|
-
},
|
|
1516
|
-
children: "Submit Order"
|
|
1842
|
+
onClick: onContinue,
|
|
1843
|
+
className: "rf-px-6 rf-bg-gray-700 rf-hover:bg-gray-800",
|
|
1844
|
+
disabled: loading || !activeStep,
|
|
1845
|
+
children: loading ? /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1846
|
+
/* @__PURE__ */ jsx11(Loader23, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-animate-spin" }),
|
|
1847
|
+
"Processing..."
|
|
1848
|
+
] }) : continueButtonText
|
|
1517
1849
|
}
|
|
1518
|
-
)
|
|
1519
|
-
stage === "order-progress" && /* @__PURE__ */ jsx8(Button, { disabled: true, children: "Continue to Shipping" })
|
|
1850
|
+
)
|
|
1520
1851
|
] })
|
|
1521
|
-
] })
|
|
1852
|
+
] });
|
|
1853
|
+
};
|
|
1854
|
+
|
|
1855
|
+
// lib/components/OrderDialog/OrderDialog.tsx
|
|
1856
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1857
|
+
var orderSteps = [
|
|
1858
|
+
{ order_step_id: 1, key: "are_gerbers_generated", title: "Generate Gerbers" },
|
|
1859
|
+
{ order_step_id: 2, key: "are_gerbers_uploaded", title: "Upload Gerbers" },
|
|
1860
|
+
{ order_step_id: 3, key: "is_gerber_analyzed", title: "Analyze Gerber" },
|
|
1861
|
+
{
|
|
1862
|
+
order_step_id: 4,
|
|
1863
|
+
key: "are_initial_costs_calculated",
|
|
1864
|
+
title: "Calculate Initial Costs"
|
|
1865
|
+
},
|
|
1866
|
+
{ order_step_id: 5, key: "is_pcb_added_to_cart", title: "Add PCB to Cart" },
|
|
1867
|
+
{ order_step_id: 6, key: "is_bom_uploaded", title: "Upload BOM" },
|
|
1868
|
+
{ order_step_id: 7, key: "is_pnp_uploaded", title: "Upload PnP" },
|
|
1869
|
+
{ order_step_id: 8, key: "is_bom_pnp_analyzed", title: "Analyze BOM & PnP" },
|
|
1870
|
+
{
|
|
1871
|
+
order_step_id: 9,
|
|
1872
|
+
key: "is_bom_parsing_complete",
|
|
1873
|
+
title: "BOM Parsing Complete"
|
|
1874
|
+
},
|
|
1875
|
+
{
|
|
1876
|
+
order_step_id: 10,
|
|
1877
|
+
key: "are_components_available",
|
|
1878
|
+
title: "Components Available"
|
|
1879
|
+
},
|
|
1880
|
+
{
|
|
1881
|
+
order_step_id: 11,
|
|
1882
|
+
key: "is_patch_map_generated",
|
|
1883
|
+
title: "Generate Patch Map"
|
|
1884
|
+
},
|
|
1885
|
+
{
|
|
1886
|
+
order_step_id: 12,
|
|
1887
|
+
key: "is_json_merge_file_created",
|
|
1888
|
+
title: "Create JSON Merge File"
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
order_step_id: 13,
|
|
1892
|
+
key: "is_dfm_result_generated",
|
|
1893
|
+
title: "Generate DFM Result"
|
|
1894
|
+
},
|
|
1895
|
+
{ order_step_id: 14, key: "are_files_downloaded", title: "Download Files" },
|
|
1896
|
+
{
|
|
1897
|
+
order_step_id: 15,
|
|
1898
|
+
key: "are_product_categories_fetched",
|
|
1899
|
+
title: "Fetch Product Categories"
|
|
1900
|
+
},
|
|
1901
|
+
{
|
|
1902
|
+
order_step_id: 16,
|
|
1903
|
+
key: "are_final_costs_calculated",
|
|
1904
|
+
title: "Calculate Final Costs"
|
|
1905
|
+
},
|
|
1906
|
+
{
|
|
1907
|
+
order_step_id: 17,
|
|
1908
|
+
key: "is_json_merge_file_updated",
|
|
1909
|
+
title: "Update JSON Merge File"
|
|
1910
|
+
},
|
|
1911
|
+
{ order_step_id: 18, key: "is_added_to_cart", title: "Add to Cart" }
|
|
1912
|
+
].map((step, index) => ({
|
|
1913
|
+
...step,
|
|
1914
|
+
completed: false,
|
|
1915
|
+
active: index === 0
|
|
1916
|
+
// First step starts as active
|
|
1917
|
+
}));
|
|
1918
|
+
var OrderDialog = ({
|
|
1919
|
+
isOpen,
|
|
1920
|
+
onClose,
|
|
1921
|
+
stage,
|
|
1922
|
+
setStage
|
|
1923
|
+
}) => {
|
|
1924
|
+
const [order, setOrder] = useState7(null);
|
|
1925
|
+
const [orderState, setOrderState] = useState7(null);
|
|
1926
|
+
const [steps, setSteps] = useState7(orderSteps);
|
|
1927
|
+
const [loading, setLoading] = useState7(false);
|
|
1928
|
+
const circuitJson = useRunFrameStore((state) => state.circuitJson);
|
|
1929
|
+
const simulateScenarioOrder = useRunFrameStore(
|
|
1930
|
+
(state) => state.simulateScenarioOrder
|
|
1931
|
+
);
|
|
1932
|
+
const createOrder = async () => {
|
|
1933
|
+
const { order: order2 } = await ky2.post("registry/orders/create", {
|
|
1934
|
+
json: {
|
|
1935
|
+
circuit_json: circuitJson
|
|
1936
|
+
},
|
|
1937
|
+
headers: {
|
|
1938
|
+
Authorization: `Bearer account-1234`
|
|
1939
|
+
}
|
|
1940
|
+
}).json();
|
|
1941
|
+
return order2;
|
|
1942
|
+
};
|
|
1943
|
+
const getOrderState = async (orderId) => {
|
|
1944
|
+
let response;
|
|
1945
|
+
try {
|
|
1946
|
+
response = await ky2.get("registry/orders/get", {
|
|
1947
|
+
searchParams: {
|
|
1948
|
+
order_id: orderId,
|
|
1949
|
+
...simulateScenarioOrder ? { _simulate_scenario: simulateScenarioOrder } : {}
|
|
1950
|
+
},
|
|
1951
|
+
headers: {
|
|
1952
|
+
Authorization: `Bearer account-1234`
|
|
1953
|
+
}
|
|
1954
|
+
}).json();
|
|
1955
|
+
} catch (error) {
|
|
1956
|
+
console.error(error);
|
|
1957
|
+
}
|
|
1958
|
+
setOrder(response.order);
|
|
1959
|
+
setOrderState(response.orderState);
|
|
1960
|
+
setStage("progress");
|
|
1961
|
+
};
|
|
1962
|
+
const handleProgressContinue = async () => {
|
|
1963
|
+
setLoading(true);
|
|
1964
|
+
try {
|
|
1965
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
1966
|
+
setSteps((currentSteps) => {
|
|
1967
|
+
const activeStepIndex = currentSteps.findIndex((step) => step.active);
|
|
1968
|
+
if (activeStepIndex === -1) return currentSteps;
|
|
1969
|
+
const newSteps = [...currentSteps];
|
|
1970
|
+
newSteps[activeStepIndex] = {
|
|
1971
|
+
...newSteps[activeStepIndex],
|
|
1972
|
+
completed: true,
|
|
1973
|
+
active: false
|
|
1974
|
+
};
|
|
1975
|
+
if (activeStepIndex === currentSteps.length - 1) {
|
|
1976
|
+
setTimeout(() => setStage("checkout"), 500);
|
|
1977
|
+
} else {
|
|
1978
|
+
newSteps[activeStepIndex + 1] = {
|
|
1979
|
+
...newSteps[activeStepIndex + 1],
|
|
1980
|
+
active: true
|
|
1981
|
+
};
|
|
1982
|
+
}
|
|
1983
|
+
return newSteps;
|
|
1984
|
+
});
|
|
1985
|
+
} catch (error) {
|
|
1986
|
+
console.error(error);
|
|
1987
|
+
}
|
|
1988
|
+
setLoading(false);
|
|
1989
|
+
};
|
|
1990
|
+
const handleInitialContinue = () => {
|
|
1991
|
+
setStage("progress");
|
|
1992
|
+
};
|
|
1993
|
+
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: [
|
|
1994
|
+
stage === "initial" && /* @__PURE__ */ jsx12(
|
|
1995
|
+
InitialOrderScreen,
|
|
1996
|
+
{
|
|
1997
|
+
onCancel: onClose,
|
|
1998
|
+
onContinue: handleInitialContinue
|
|
1999
|
+
}
|
|
2000
|
+
),
|
|
2001
|
+
stage === "progress" && /* @__PURE__ */ jsx12(
|
|
2002
|
+
StepwiseProgressPanel,
|
|
2003
|
+
{
|
|
2004
|
+
steps,
|
|
2005
|
+
onCancel: onClose,
|
|
2006
|
+
onContinue: handleProgressContinue,
|
|
2007
|
+
loading
|
|
2008
|
+
}
|
|
2009
|
+
),
|
|
2010
|
+
stage === "checkout" && /* @__PURE__ */ jsx12(
|
|
2011
|
+
CheckoutOrder,
|
|
2012
|
+
{
|
|
2013
|
+
finalCost: 0,
|
|
2014
|
+
onConfirmCheckout: () => onClose(),
|
|
2015
|
+
onBack: () => setStage("progress")
|
|
2016
|
+
}
|
|
2017
|
+
)
|
|
2018
|
+
] }) }) });
|
|
1522
2019
|
};
|
|
1523
2020
|
|
|
1524
2021
|
// lib/components/OrderDialog/useOrderDialog.tsx
|
|
1525
|
-
import { jsx as
|
|
2022
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1526
2023
|
var useOrderDialog = () => {
|
|
1527
|
-
const [isOpen, setIsOpen] =
|
|
1528
|
-
const [
|
|
2024
|
+
const [isOpen, setIsOpen] = useState8(false);
|
|
2025
|
+
const [stage, setStage] = useState8("initial");
|
|
2026
|
+
const [isRegistryConnected, setIsRegistryConnected] = useState8(false);
|
|
2027
|
+
const handleClose = () => {
|
|
2028
|
+
setIsOpen(false);
|
|
2029
|
+
setStage("initial");
|
|
2030
|
+
};
|
|
1529
2031
|
return {
|
|
1530
2032
|
isOpen,
|
|
2033
|
+
stage,
|
|
1531
2034
|
isRegistryConnected,
|
|
1532
2035
|
open: () => setIsOpen(true),
|
|
1533
|
-
close:
|
|
2036
|
+
close: handleClose,
|
|
2037
|
+
setStage,
|
|
1534
2038
|
OrderDialog: () => {
|
|
1535
|
-
return /* @__PURE__ */
|
|
2039
|
+
return /* @__PURE__ */ jsx13(
|
|
2040
|
+
OrderDialog,
|
|
2041
|
+
{
|
|
2042
|
+
isOpen,
|
|
2043
|
+
onClose: handleClose,
|
|
2044
|
+
stage,
|
|
2045
|
+
setStage
|
|
2046
|
+
}
|
|
2047
|
+
);
|
|
1536
2048
|
}
|
|
1537
2049
|
};
|
|
1538
2050
|
};
|
|
1539
2051
|
|
|
1540
2052
|
// lib/components/RunFrameForCli/LeftHeader.tsx
|
|
1541
|
-
import { Fragment as
|
|
2053
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1542
2054
|
var RunframeCliLeftHeader = (props) => {
|
|
1543
2055
|
const lastRunEvalVersion = useRunnerStore((s) => s.lastRunEvalVersion);
|
|
1544
|
-
const [snippetName, setSnippetName] =
|
|
1545
|
-
const [hasUnsavedChanges, setHasUnsavedChanges] =
|
|
1546
|
-
const [hasNeverBeenSaved, setHasNeverBeenSaved] =
|
|
1547
|
-
const [isSaving, setIsSaving] =
|
|
1548
|
-
const [requestToSaveSentAt, setRequestToSaveSentAt] =
|
|
2056
|
+
const [snippetName, setSnippetName] = useState9(null);
|
|
2057
|
+
const [hasUnsavedChanges, setHasUnsavedChanges] = useState9(false);
|
|
2058
|
+
const [hasNeverBeenSaved, setHasNeverBeenSaved] = useState9(true);
|
|
2059
|
+
const [isSaving, setIsSaving] = useState9(false);
|
|
2060
|
+
const [requestToSaveSentAt, setRequestToSaveSentAt] = useState9(
|
|
1549
2061
|
null
|
|
1550
2062
|
);
|
|
1551
|
-
const [availableSnippets, setAvailableSnippets] =
|
|
2063
|
+
const [availableSnippets, setAvailableSnippets] = useState9(
|
|
1552
2064
|
null
|
|
1553
2065
|
);
|
|
1554
|
-
const [isSelectSnippetDialogOpen, setIsSelectSnippetDialogOpen] =
|
|
1555
|
-
const [notificationMessage, setNotificationMessage] =
|
|
2066
|
+
const [isSelectSnippetDialogOpen, setIsSelectSnippetDialogOpen] = useState9(false);
|
|
2067
|
+
const [notificationMessage, setNotificationMessage] = useState9(
|
|
1556
2068
|
null
|
|
1557
2069
|
);
|
|
1558
|
-
const [errorMessage, setErrorMessage] =
|
|
1559
|
-
const [isError, setIsError] =
|
|
1560
|
-
const [isExporting, setisExporting] =
|
|
2070
|
+
const [errorMessage, setErrorMessage] = useState9(null);
|
|
2071
|
+
const [isError, setIsError] = useState9(false);
|
|
2072
|
+
const [isExporting, setisExporting] = useState9(false);
|
|
1561
2073
|
const orderDialog = useOrderDialog();
|
|
1562
2074
|
const pushEvent = useRunFrameStore((state) => state.pushEvent);
|
|
1563
2075
|
const recentEvents = useRunFrameStore((state) => state.recentEvents);
|
|
@@ -1586,7 +2098,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
1586
2098
|
setisExporting(false);
|
|
1587
2099
|
}
|
|
1588
2100
|
});
|
|
1589
|
-
|
|
2101
|
+
useEffect7(() => {
|
|
1590
2102
|
if (!isSaving || requestToSaveSentAt === null) return;
|
|
1591
2103
|
const eventsSinceRequestToSave = recentEvents.filter(
|
|
1592
2104
|
(event) => new Date(event.created_at).valueOf() > requestToSaveSentAt
|
|
@@ -1628,12 +2140,12 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
1628
2140
|
});
|
|
1629
2141
|
};
|
|
1630
2142
|
const circuitJson = useRunFrameStore((state) => state.circuitJson);
|
|
1631
|
-
const [isImportDialogOpen, setIsImportDialogOpen] =
|
|
1632
|
-
return /* @__PURE__ */
|
|
1633
|
-
/* @__PURE__ */
|
|
1634
|
-
/* @__PURE__ */
|
|
1635
|
-
/* @__PURE__ */
|
|
1636
|
-
/* @__PURE__ */
|
|
2143
|
+
const [isImportDialogOpen, setIsImportDialogOpen] = useState9(false);
|
|
2144
|
+
return /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2145
|
+
/* @__PURE__ */ jsxs10(DropdownMenu, { children: [
|
|
2146
|
+
/* @__PURE__ */ jsx14(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx14("div", { className: "rf-whitespace-nowrap rf-text-xs font-medium rf-p-2 rf-mx-1 rf-cursor-pointer rf-relative", children: "File" }) }),
|
|
2147
|
+
/* @__PURE__ */ jsxs10(DropdownMenuContent, { children: [
|
|
2148
|
+
/* @__PURE__ */ jsx14(
|
|
1637
2149
|
DropdownMenuItem,
|
|
1638
2150
|
{
|
|
1639
2151
|
className: "rf-text-xs",
|
|
@@ -1642,7 +2154,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
1642
2154
|
children: isSaving ? "Saving..." : "Push"
|
|
1643
2155
|
}
|
|
1644
2156
|
),
|
|
1645
|
-
parseInt(window.location.port) > 5e3 && /* @__PURE__ */
|
|
2157
|
+
parseInt(window.location.port) > 5e3 && /* @__PURE__ */ jsx14(
|
|
1646
2158
|
DropdownMenuItem,
|
|
1647
2159
|
{
|
|
1648
2160
|
className: "rf-text-xs",
|
|
@@ -1652,7 +2164,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
1652
2164
|
children: "Order"
|
|
1653
2165
|
}
|
|
1654
2166
|
),
|
|
1655
|
-
/* @__PURE__ */
|
|
2167
|
+
/* @__PURE__ */ jsx14(
|
|
1656
2168
|
DropdownMenuItem,
|
|
1657
2169
|
{
|
|
1658
2170
|
className: "rf-text-xs",
|
|
@@ -1661,8 +2173,8 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
1661
2173
|
children: "Import"
|
|
1662
2174
|
}
|
|
1663
2175
|
),
|
|
1664
|
-
/* @__PURE__ */
|
|
1665
|
-
/* @__PURE__ */
|
|
2176
|
+
/* @__PURE__ */ jsxs10(DropdownMenuSub, { children: [
|
|
2177
|
+
/* @__PURE__ */ jsx14(
|
|
1666
2178
|
DropdownMenuSubTrigger,
|
|
1667
2179
|
{
|
|
1668
2180
|
className: "rf-text-xs",
|
|
@@ -1670,7 +2182,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
1670
2182
|
children: isExporting ? "Exporting..." : "Export"
|
|
1671
2183
|
}
|
|
1672
2184
|
),
|
|
1673
|
-
/* @__PURE__ */
|
|
2185
|
+
/* @__PURE__ */ jsx14(DropdownMenuPortal, { children: /* @__PURE__ */ jsx14(DropdownMenuSubContent, { children: availableExports.map((exp, i) => /* @__PURE__ */ jsx14(
|
|
1674
2186
|
DropdownMenuItem,
|
|
1675
2187
|
{
|
|
1676
2188
|
onSelect: () => {
|
|
@@ -1685,16 +2197,16 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
1685
2197
|
});
|
|
1686
2198
|
},
|
|
1687
2199
|
disabled: isExporting,
|
|
1688
|
-
children: /* @__PURE__ */
|
|
2200
|
+
children: /* @__PURE__ */ jsx14("span", { className: "rf-text-xs", children: exp.name })
|
|
1689
2201
|
},
|
|
1690
2202
|
i
|
|
1691
2203
|
)) }) })
|
|
1692
2204
|
] }),
|
|
1693
|
-
/* @__PURE__ */
|
|
1694
|
-
/* @__PURE__ */
|
|
1695
|
-
/* @__PURE__ */
|
|
1696
|
-
/* @__PURE__ */
|
|
1697
|
-
/* @__PURE__ */
|
|
2205
|
+
/* @__PURE__ */ jsxs10(DropdownMenuSub, { children: [
|
|
2206
|
+
/* @__PURE__ */ jsx14(DropdownMenuSubTrigger, { className: "rf-text-xs", children: "Advanced" }),
|
|
2207
|
+
/* @__PURE__ */ jsx14(DropdownMenuPortal, { children: /* @__PURE__ */ jsxs10(DropdownMenuSubContent, { children: [
|
|
2208
|
+
/* @__PURE__ */ jsx14(DropdownMenuItem, { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsxs10("div", { className: "rf-flex rf-items-center rf-gap-2", children: [
|
|
2209
|
+
/* @__PURE__ */ jsx14(
|
|
1698
2210
|
Checkbox,
|
|
1699
2211
|
{
|
|
1700
2212
|
id: "load-latest-eval",
|
|
@@ -1704,7 +2216,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
1704
2216
|
}
|
|
1705
2217
|
}
|
|
1706
2218
|
),
|
|
1707
|
-
/* @__PURE__ */
|
|
2219
|
+
/* @__PURE__ */ jsx14(
|
|
1708
2220
|
"label",
|
|
1709
2221
|
{
|
|
1710
2222
|
htmlFor: "load-latest-eval",
|
|
@@ -1713,31 +2225,31 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
1713
2225
|
}
|
|
1714
2226
|
)
|
|
1715
2227
|
] }) }),
|
|
1716
|
-
lastRunEvalVersion && /* @__PURE__ */
|
|
2228
|
+
lastRunEvalVersion && /* @__PURE__ */ jsx14(DropdownMenuItem, { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsx14("div", { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsxs10("span", { className: "rf-text-xs", children: [
|
|
1717
2229
|
"@tscircuit/eval@",
|
|
1718
2230
|
lastRunEvalVersion
|
|
1719
2231
|
] }) }) }),
|
|
1720
|
-
/* @__PURE__ */
|
|
2232
|
+
/* @__PURE__ */ jsx14(
|
|
1721
2233
|
DropdownMenuItem,
|
|
1722
2234
|
{
|
|
1723
2235
|
className: "rf-flex rf-items-center rf-gap-2",
|
|
1724
2236
|
onClick: () => {
|
|
1725
2237
|
window.open("/api/admin", "_blank");
|
|
1726
2238
|
},
|
|
1727
|
-
children: /* @__PURE__ */
|
|
2239
|
+
children: /* @__PURE__ */ jsx14("div", { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsx14("span", { className: "rf-text-xs", children: "CLI Admin Panel" }) })
|
|
1728
2240
|
}
|
|
1729
2241
|
)
|
|
1730
2242
|
] }) })
|
|
1731
2243
|
] })
|
|
1732
2244
|
] }),
|
|
1733
|
-
/* @__PURE__ */
|
|
1734
|
-
/* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
1736
|
-
/* @__PURE__ */
|
|
2245
|
+
/* @__PURE__ */ jsx14(AlertDialog, { open: isError, onOpenChange: setIsError, children: /* @__PURE__ */ jsxs10(AlertDialogContent, { children: [
|
|
2246
|
+
/* @__PURE__ */ jsxs10(AlertDialogHeader, { children: [
|
|
2247
|
+
/* @__PURE__ */ jsx14(AlertDialogTitle, { children: "Error Saving Snippet" }),
|
|
2248
|
+
/* @__PURE__ */ jsx14(AlertDialogDescription, { children: errorMessage })
|
|
1737
2249
|
] }),
|
|
1738
|
-
/* @__PURE__ */
|
|
2250
|
+
/* @__PURE__ */ jsx14(AlertDialogFooter, { children: /* @__PURE__ */ jsx14(AlertDialogCancel, { onClick: () => setIsError(false), children: "Dismiss" }) })
|
|
1739
2251
|
] }) }),
|
|
1740
|
-
/* @__PURE__ */
|
|
2252
|
+
/* @__PURE__ */ jsx14(
|
|
1741
2253
|
SelectSnippetDialog,
|
|
1742
2254
|
{
|
|
1743
2255
|
snippetNames: availableSnippets ?? [],
|
|
@@ -1756,7 +2268,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
1756
2268
|
}
|
|
1757
2269
|
)
|
|
1758
2270
|
] }),
|
|
1759
|
-
/* @__PURE__ */
|
|
2271
|
+
/* @__PURE__ */ jsx14(
|
|
1760
2272
|
ImportComponentDialog,
|
|
1761
2273
|
{
|
|
1762
2274
|
isOpen: isImportDialogOpen,
|
|
@@ -1785,43 +2297,51 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
1785
2297
|
}
|
|
1786
2298
|
}
|
|
1787
2299
|
),
|
|
1788
|
-
/* @__PURE__ */
|
|
1789
|
-
/* @__PURE__ */
|
|
2300
|
+
/* @__PURE__ */ jsx14(Toaster, { position: "top-center", reverseOrder: false }),
|
|
2301
|
+
/* @__PURE__ */ jsx14(orderDialog.OrderDialog, {})
|
|
1790
2302
|
] });
|
|
1791
2303
|
};
|
|
1792
2304
|
|
|
1793
2305
|
// lib/components/RunFrameForCli/RunFrameForCli.tsx
|
|
1794
|
-
import { jsx as
|
|
2306
|
+
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1795
2307
|
var RunFrameForCli = (props) => {
|
|
1796
2308
|
const [shouldLoadLatestEval, setLoadLatestEval] = useLocalStorageState(
|
|
1797
2309
|
"load-latest-eval",
|
|
1798
2310
|
true
|
|
1799
2311
|
);
|
|
1800
|
-
return /* @__PURE__ */
|
|
2312
|
+
return /* @__PURE__ */ jsx15(
|
|
1801
2313
|
RunFrameWithApi,
|
|
1802
2314
|
{
|
|
1803
2315
|
debug: props.debug,
|
|
1804
2316
|
forceLatestEvalVersion: shouldLoadLatestEval,
|
|
1805
2317
|
defaultToFullScreen: true,
|
|
1806
2318
|
showToggleFullScreen: false,
|
|
1807
|
-
leftHeaderContent: /* @__PURE__ */
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
2319
|
+
leftHeaderContent: /* @__PURE__ */ jsxs11("div", { className: "rf-flex rf-items-center rf-justify-between", children: [
|
|
2320
|
+
/* @__PURE__ */ jsx15(
|
|
2321
|
+
RunframeCliLeftHeader,
|
|
2322
|
+
{
|
|
2323
|
+
shouldLoadLatestEval,
|
|
2324
|
+
onChangeShouldLoadLatestEval: (newShouldLoadLatestEval) => {
|
|
2325
|
+
setLoadLatestEval(newShouldLoadLatestEval);
|
|
2326
|
+
globalThis.runFrameWorker = null;
|
|
2327
|
+
}
|
|
1814
2328
|
}
|
|
1815
|
-
|
|
1816
|
-
|
|
2329
|
+
),
|
|
2330
|
+
props.scenarioSelectorContent
|
|
2331
|
+
] })
|
|
1817
2332
|
}
|
|
1818
2333
|
);
|
|
1819
2334
|
};
|
|
1820
2335
|
export {
|
|
2336
|
+
BomTable,
|
|
1821
2337
|
CircuitJsonPreview,
|
|
2338
|
+
PCBViewer as PcbViewer,
|
|
2339
|
+
PcbViewerWithContainerHeight,
|
|
1822
2340
|
RunFrame,
|
|
1823
2341
|
RunFrameForCli,
|
|
1824
2342
|
RunFrameWithApi,
|
|
2343
|
+
SchematicViewer,
|
|
1825
2344
|
guessEntrypoint,
|
|
1826
|
-
guessManualEditsFilePath
|
|
2345
|
+
guessManualEditsFilePath,
|
|
2346
|
+
linkify
|
|
1827
2347
|
};
|