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